Documentation
¶
Index ¶
- Constants
- Variables
- func CompileServiceOptions(opts ...token.ServiceOption) (*token.ServiceOptions, error)
- func ExchangeRecipientIdentities(context view.Context, walletID string, recipient view.Identity, ...) (view.Identity, view.Identity, error)
- func GetAuditorWallet(context view.Context, opts ...token.ServiceOption) *token.AuditorWallet
- func GetFSCIssuerIdentityFromOpts(attributes map[interface{}]interface{}) (view.Identity, error)
- func GetIssuerPublicParamsPublicKeyFromOpts(attributes map[interface{}]interface{}) (view.Identity, error)
- func GetIssuerWallet(context view.Context, id string, opts ...token.ServiceOption) *token.IssuerWallet
- func GetIssuerWalletForChannel(context view.Context, channel, id string, opts ...token.ServiceOption) *token.IssuerWallet
- func GetRandomBytes(len int) ([]byte, error)
- func GetRandomNonce() ([]byte, error)
- func GetWallet(context view.Context, id string, opts ...token.ServiceOption) *token.OwnerWallet
- func GetWalletForChannel(context view.Context, channel, id string, opts ...token.ServiceOption) *token.OwnerWallet
- func IssueDistributionList(r *token.Request) []view.Identity
- func Marshal(v interface{}) ([]byte, error)
- func MarshalMeta(v map[string][]byte) ([]byte, error)
- func MyAuditorWallet(context view.Context, opts ...token.ServiceOption) *token.AuditorWallet
- func MyIssuerWallet(context view.Context, opts ...token.ServiceOption) *token.IssuerWallet
- func MyWallet(context view.Context, opts ...token.ServiceOption) *token.OwnerWallet
- func MyWalletFromTx(context view.Context, tx *Transaction) *token.OwnerWallet
- func NewCollectActionsResponderView(tx *Transaction, action *ActionTransfer) *collectActionsResponderView
- func NewCollectActionsView(tx *Transaction, actions ...*ActionTransfer) *collectActionsView
- func NewFinalityView(tx *Transaction, opts ...TxOption) *finalityView
- func NewFinalityWithOpts(opts ...TxOption) *finalityView
- func NewOrderingAndFinalityView(tx *Transaction) *orderingAndFinalityView
- func NewOrderingAndFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) *orderingAndFinalityView
- func NewOrderingView(tx *Transaction, opts ...TxOption) *orderingView
- func NewOrderingViewWithOpts(opts ...TxOption) *orderingView
- func ReceiveAction(context view.Context) (*Transaction, *ActionTransfer, error)
- func RequestMultisigIdentity(context view.Context, ids []view.Identity, opts ...token.ServiceOption) (token.Identity, error)
- func RequestRecipientIdentity(context view.Context, recipient view.Identity, opts ...token.ServiceOption) (token.Identity, error)
- func RequestTokensUpgrade(context view.Context, issuer view.Identity, wallet string, ...) (view.Identity, view.Session, error)
- func RequestTokensUpgradeForRecipient(context view.Context, issuer view.Identity, wallet string, ...) (view.Identity, view.Session, error)
- func RequestWithdrawal(context view.Context, issuer view.Identity, wallet string, ...) (view.Identity, view.Session, error)
- func RequestWithdrawalForRecipient(context view.Context, issuer view.Identity, wallet string, ...) (view.Identity, view.Session, error)
- func RespondExchangeRecipientIdentities(context view.Context) (view.Identity, view.Identity, error)
- func RespondRequestRecipientIdentity(context view.Context) (view.Identity, error)
- func RespondRequestRecipientIdentityUsingWallet(context view.Context, wallet string) (view.Identity, error)
- func StoreTransactionRecords(ctx view.Context, tx *Transaction) error
- func TransferDistributionList(r *token.Request) []view.Identity
- func Unmarshal(data []byte, v interface{}) error
- func UnmarshalMeta(raw []byte) (map[string][]byte, error)
- func WithFSCIssuerIdentity(issuerFSCIdentity view.Identity) token.TransferOption
- func WithIssuerPublicParamsPublicKey(issuerSigningKey view.Identity) token.TransferOption
- func WithRecipientData(recipientData *RecipientData) token.ServiceOption
- func WithRecipientWalletID(walletID string) token.ServiceOption
- func WithType(tokenType token2.Type) token.ListTokensOption
- type AcceptView
- type ActionTransfer
- type Actions
- type AuditApproveView
- type AuditingViewInitiator
- type Auditor
- func (a *Auditor) Audit(ctx context.Context, tx *Transaction) (*token.InputStream, *token.OutputStream, error)
- func (a *Auditor) Check(ctx context.Context) ([]string, error)
- func (a *Auditor) GetTokenRequest(ctx context.Context, txID string) ([]byte, error)
- func (a *Auditor) NewHoldingsFilter() *auditdb.HoldingsFilter
- func (a *Auditor) NewPaymentsFilter() *auditdb.PaymentsFilter
- func (a *Auditor) Release(ctx context.Context, tx *Transaction)
- func (a *Auditor) SetStatus(ctx context.Context, txID string, status driver.TxStatus, message string) error
- func (a *Auditor) Transactions(ctx context.Context, params db.QueryTransactionsParams, ...) (*db.PageTransactionsIterator, error)
- func (a *Auditor) Validate(tx *Transaction) error
- type CheckService
- type CheckServiceProvider
- type CollectEndorsementsView
- type Context
- type EndorseView
- type EndorsementsOpt
- type EndorsementsOpts
- type ExchangeRecipientIdentitiesView
- type ExchangeRecipientRequest
- type ExternalWalletSigner
- type GetNetworkFunc
- type LocalBidirectionalChannel
- type Metrics
- type MultisigRecipientData
- type Payload
- type ReceiveTransactionView
- type ReceiveWithdrawalRequestView
- type Recipient
- type RecipientData
- type RecipientRequest
- type Recipients
- type RegisterAuditorView
- type RequestRecipientIdentityView
- type RequestWithdrawalView
- func (r *RequestWithdrawalView) Call(context view.Context) (interface{}, error)
- func (r *RequestWithdrawalView) WithRecipientData(data *RecipientData) *RequestWithdrawalView
- func (r *RequestWithdrawalView) WithTMSID(id token.TMSID) *RequestWithdrawalView
- func (r *RequestWithdrawalView) WithWallet(wallet string) *RequestWithdrawalView
- type RespondExchangeRecipientIdentitiesView
- type RespondRequestRecipientIdentityView
- type Service
- func (a *Service) Append(ctx context.Context, tx *Transaction) error
- func (a *Service) AppendTransactionEndorseAck(ctx context.Context, txID string, id view.Identity, sigma []byte) error
- func (a *Service) Check(ctx context.Context) ([]string, error)
- func (a *Service) GetStatus(ctx context.Context, txID string) (TxStatus, string, error)
- func (a *Service) GetTokenRequest(ctx context.Context, txID string) ([]byte, error)
- func (a *Service) GetTransactionEndorsementAcks(ctx context.Context, id string) (map[string][]byte, error)
- func (a *Service) SetStatus(ctx context.Context, txID string, status driver.TxStatus, message string) error
- type ServiceManager
- type Session
- type SignatureRequest
- type SignerProvider
- type Storage
- type StorageProvider
- type StoreServiceManager
- type StreamExternalWalletMsg
- type StreamExternalWalletMsgType
- type StreamExternalWalletSignRequest
- type StreamExternalWalletSignResponse
- type StreamExternalWalletSignerClient
- type StreamExternalWalletSignerServer
- type TokenTransactionDB
- type TokensServiceManager
- type Transaction
- func NewAnonymousTransaction(context view.Context, opts ...TxOption) (*Transaction, error)
- func NewTransaction(context view.Context, signer view.Identity, opts ...TxOption) (*Transaction, error)
- func NewTransactionFromBytes(context view.Context, raw []byte) (*Transaction, error)
- func NewTransactionFromSignatureRequest(context view.Context, sr *SignatureRequest) (*Transaction, error)
- func ReceiveTransaction(context view.Context, opts ...TxOption) (*Transaction, error)
- func (t *Transaction) ApplicationMetadata(k string) []byte
- func (t *Transaction) Bytes(eIDs ...string) ([]byte, error)
- func (t *Transaction) Channel() string
- func (t *Transaction) CloseSelector() error
- func (t *Transaction) ID() string
- func (t *Transaction) Inputs() (*token.InputStream, error)
- func (t *Transaction) InputsAndOutputs(ctx context.Context) (*token.InputStream, *token.OutputStream, token.ActionMetadata, error)
- func (t *Transaction) IsValid(ctx context.Context) error
- func (t *Transaction) Issue(wallet *token.IssuerWallet, receiver view.Identity, typ token2.Type, q uint64, ...) error
- func (t *Transaction) MarshallToAudit() ([]byte, error)
- func (t *Transaction) Namespace() string
- func (t *Transaction) Network() string
- func (t *Transaction) NetworkTxID() network.TxID
- func (t *Transaction) Outputs() (*token.OutputStream, error)
- func (t *Transaction) Redeem(wallet *token.OwnerWallet, typ token2.Type, value uint64, ...) error
- func (t *Transaction) Release()
- func (t *Transaction) Request() *token.Request
- func (t *Transaction) Selector() (token.Selector, error)
- func (t *Transaction) SetApplicationMetadata(k string, v []byte)
- func (t *Transaction) TMSID() token.TMSID
- func (t *Transaction) TokenService() dep.TokenManagementServiceWithExtensions
- func (t *Transaction) Transfer(wallet *token.OwnerWallet, typ token2.Type, values []uint64, ...) error
- func (t *Transaction) Upgrade(wallet *token.IssuerWallet, receiver token.Identity, ...) error
- type TransactionInfo
- type TransactionInfoProvider
- type TransactionRecord
- type TransactionSer
- type TxOption
- func WithAnonymousTransaction(v bool) TxOption
- func WithAuditor(auditor view.Identity) TxOption
- func WithChannel(channel string) TxOption
- func WithNamespace(namespace string) TxOption
- func WithNetwork(network string) TxOption
- func WithNetworkTxID(id network.TxID) TxOption
- func WithNoCachingRequest() TxOption
- func WithNoTransactionVerification() TxOption
- func WithTMS(network, channel, namespace string) TxOption
- func WithTMSID(id token.TMSID) TxOption
- func WithTMSIDPointer(id *token.TMSID) TxOption
- func WithTimeout(timeout time.Duration) TxOption
- func WithTransactions(tx *Transaction) TxOption
- func WithTxID(txID string) TxOption
- type TxOptions
- type TxOwner
- func (a *TxOwner) Append(ctx context.Context, tx *Transaction) error
- func (a *TxOwner) Check(ctx context.Context) ([]string, error)
- func (a *TxOwner) GetStatus(ctx context.Context, txID string) (TxStatus, string, error)
- func (a *TxOwner) GetTokenRequest(ctx context.Context, txID string) ([]byte, error)
- func (a *TxOwner) SetStatus(ctx context.Context, txID string, status driver.TxStatus, message string) error
- func (a *TxOwner) TransactionInfo(ctx context.Context, txID string) (*TransactionInfo, error)
- func (a *TxOwner) Transactions(ctx context.Context, params db.QueryTransactionsParams, ...) (*driver2.PageIterator[*driver.TransactionRecord], error)
- type TxStatus
- type UpgradeTokensAgreement
- type UpgradeTokensInitiatorView
- func (r *UpgradeTokensInitiatorView) Call(context view.Context) (interface{}, error)
- func (r *UpgradeTokensInitiatorView) WithRecipientData(data *RecipientData) *UpgradeTokensInitiatorView
- func (r *UpgradeTokensInitiatorView) WithTMSID(id token.TMSID) *UpgradeTokensInitiatorView
- func (r *UpgradeTokensInitiatorView) WithWallet(wallet string) *UpgradeTokensInitiatorView
- type UpgradeTokensRequest
- type UpgradeTokensResponderView
- type WithdrawalRequest
Constants ¶
const ( IssuerFSCIdentityKey = "IssuerFSCIdentityKey" IssuerPublicParamsPublicKey = "IssuerPublicParamsPublicKey" )
const (
// NonceSize is the default NonceSize
NonceSize = 24
)
const (
TokenNamespace = "tns"
)
Variables ¶
var ( // ErrTimeout signals that a timeout happened ErrTimeout = errors.New("timeout reached") // ErrFailedCompilingOptions signals a failure when compiling the options ErrFailedCompilingOptions = errors.New("failed to compiling options") // ErrInvalidInput signals that the input is invalid ErrInvalidInput = errors.New("invalid input") // ErrHandlingSignatureRequests signals that an error occurred while handling the signature requests ErrHandlingSignatureRequests = errors.New("failed to handle signature requests") // ErrDepNotAvailableInContext signals that a dependency is not available ErrDepNotAvailableInContext = errors.New("dependency not available") // ErrTxUnmarshalling signals that an error occurred while unmarshalling a token transaction ErrTxUnmarshalling = errors.New("failed to unmarshal tx") // ErrStorage signals a generic storage failure ErrStorage = errors.New("storage failure") // ErrSignerIdentityMismatch signals that an identity mismatch ErrSignerIdentityMismatch = errors.New("signer identity mismatch") // ErrProvider signals a failure with a provider ErrProvider = errors.New("provider failure") )
var ( ErrNetworkNotSet = errors.New("network not set") ErrNamespaceNotSet = errors.New("namespace not set") )
var TxStatusMessage = driver.TxStatusMessage
TxStatusMessage maps TxStatus to string
Functions ¶
func CompileServiceOptions ¶ added in v0.4.0
func CompileServiceOptions(opts ...token.ServiceOption) (*token.ServiceOptions, error)
CompileServiceOptions compiles the service options
func ExchangeRecipientIdentities ¶
func ExchangeRecipientIdentities(context view.Context, walletID string, recipient view.Identity, opts ...token.ServiceOption) (view.Identity, view.Identity, error)
ExchangeRecipientIdentities executes the ExchangeRecipientIdentitiesView using by passed wallet id to derive the recipient identity to send to the passed recipient. The function returns, the recipient identity of the sender, the recipient identity of the recipient
func GetAuditorWallet ¶ added in v0.2.0
func GetAuditorWallet(context view.Context, opts ...token.ServiceOption) *token.AuditorWallet
GetAuditorWallet returns the wallet whose id is the passed id. If the passed id is empty, GetAuditorWallet has the same behaviour of MyAuditorWallet. It returns nil, if no wallet is found.
func GetFSCIssuerIdentityFromOpts ¶ added in v0.5.0
GetFSCIssuerIdentityFromOpts extracts an issuer's node identity from the appropriate attribute in a given attribute map.
func GetIssuerPublicParamsPublicKeyFromOpts ¶ added in v0.5.0
func GetIssuerWallet ¶
func GetIssuerWallet(context view.Context, id string, opts ...token.ServiceOption) *token.IssuerWallet
GetIssuerWallet returns the issuer wallet whose id is the passed id. If the passed id is empty, GetIssuerWallet has the same behaviour of MyIssuerWallet. It returns nil, if no wallet is found.
func GetIssuerWalletForChannel ¶
func GetIssuerWalletForChannel(context view.Context, channel, id string, opts ...token.ServiceOption) *token.IssuerWallet
GetIssuerWalletForChannel returns the issuer wallet whose id is the passed id for the passed channel. If the passed id is empty, GetIssuerWalletForChannel has the same behaviour of MyIssuerWallet. It returns nil, if no wallet is found.
func GetRandomBytes ¶ added in v0.4.0
GetRandomBytes returns len random looking bytes
func GetRandomNonce ¶ added in v0.4.0
GetRandomNonce returns a random byte array of length NonceSize
func GetWallet ¶
func GetWallet(context view.Context, id string, opts ...token.ServiceOption) *token.OwnerWallet
GetWallet returns the wallet whose id is the passed id. If the passed id is empty, GetWallet has the same behaviour of MyWallet. It returns nil, if no wallet is found.
func GetWalletForChannel ¶
func GetWalletForChannel(context view.Context, channel, id string, opts ...token.ServiceOption) *token.OwnerWallet
GetWalletForChannel returns the wallet whose id is the passed id for the passed channel. If the passed id is empty, GetWalletForChannel has the same behaviour of MyWalletFromTx. It returns nil, if no wallet is found.
func IssueDistributionList ¶ added in v0.3.0
func MyAuditorWallet ¶
func MyAuditorWallet(context view.Context, opts ...token.ServiceOption) *token.AuditorWallet
MyAuditorWallet returns the default auditor wallet, nil if not found.
func MyIssuerWallet ¶
func MyIssuerWallet(context view.Context, opts ...token.ServiceOption) *token.IssuerWallet
MyIssuerWallet returns the default issuer wallet, nil if not found
func MyWallet ¶
func MyWallet(context view.Context, opts ...token.ServiceOption) *token.OwnerWallet
MyWallet returns the default wallet, nil if not found.
func MyWalletFromTx ¶
func MyWalletFromTx(context view.Context, tx *Transaction) *token.OwnerWallet
MyWalletFromTx returns the default wallet for the tuple (network, channel, namespace) as identified by the passed transaction. Returns nil if no wallet is found.
func NewCollectActionsResponderView ¶
func NewCollectActionsResponderView(tx *Transaction, action *ActionTransfer) *collectActionsResponderView
NewCollectActionsResponderView returns an instance of the collectActionsResponderView. The view does the following: Sends back the transaction.
func NewCollectActionsView ¶
func NewCollectActionsView(tx *Transaction, actions ...*ActionTransfer) *collectActionsView
NewCollectActionsView returns an instance of collectActionsView. The view does the following: For each action, the view contact the recipient by sending as first message the transaction. Then, the view waits for the answer and append it to the transaction.
func NewFinalityView ¶
func NewFinalityView(tx *Transaction, opts ...TxOption) *finalityView
NewFinalityView returns an instance of the finalityView. The view does the following: It waits for the finality of the passed transaction. If the transaction is final, the vault is updated.
func NewFinalityWithOpts ¶ added in v0.4.0
func NewFinalityWithOpts(opts ...TxOption) *finalityView
func NewOrderingAndFinalityView ¶
func NewOrderingAndFinalityView(tx *Transaction) *orderingAndFinalityView
NewOrderingAndFinalityView returns a new instance of the orderingAndFinalityView struct. The view does the following: 1. It broadcasts the token transaction to the proper backend. 2. It waits for finality of the token transaction by listening to delivery events from one of the Fabric peer nodes trusted by the FSC node.
func NewOrderingAndFinalityWithTimeoutView ¶
func NewOrderingAndFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) *orderingAndFinalityView
NewOrderingAndFinalityWithTimeoutView returns a new instance of the orderingAndFinalityView struct. The view does the following: 1. It broadcasts the token transaction to the proper backend. 2. It waits for finality of the token transaction.
func NewOrderingView ¶
func NewOrderingView(tx *Transaction, opts ...TxOption) *orderingView
NewOrderingView returns a new instance of the orderingView struct. The view does the following: 1. It broadcasts the token transaction to the proper backend.
func NewOrderingViewWithOpts ¶ added in v0.4.0
func NewOrderingViewWithOpts(opts ...TxOption) *orderingView
func ReceiveAction ¶
func ReceiveAction(context view.Context) (*Transaction, *ActionTransfer, error)
ReceiveAction runs the receiveActionsView. The view does the following: It receives the transaction, the collection of actions, and the requested action.
func RequestMultisigIdentity ¶ added in v0.5.0
func RequestMultisigIdentity(context view.Context, ids []view.Identity, opts ...token.ServiceOption) (token.Identity, error)
RequestMultisigIdentity collects the recipient identities from all the passed identities. It merges them into a single multisig identity and distributes it to all the participants.
func RequestRecipientIdentity ¶
func RequestRecipientIdentity(context view.Context, recipient view.Identity, opts ...token.ServiceOption) (token.Identity, error)
RequestRecipientIdentity executes the RequestRecipientIdentityView. The sender contacts the recipient's FSC node identified via the passed view identity. The sender gets back the identity the recipient wants to use to assign ownership of tokens.
func RequestTokensUpgrade ¶ added in v0.5.0
func RequestTokensUpgrade(context view.Context, issuer view.Identity, wallet string, tokens []token2.LedgerToken, notAnonymous bool, opts ...token.ServiceOption) (view.Identity, view.Session, error)
RequestTokensUpgrade runs UpgradeTokensInitiatorView with the passed arguments. The view will generate a recipient identity and pass it to the issuer.
func RequestTokensUpgradeForRecipient ¶ added in v0.5.0
func RequestTokensUpgradeForRecipient(context view.Context, issuer view.Identity, wallet string, tokens []token2.LedgerToken, notAnonymous bool, recipientData *RecipientData, opts ...token.ServiceOption) (view.Identity, view.Session, error)
RequestTokensUpgradeForRecipient runs UpgradeTokensInitiatorView with the passed arguments. The view will send the passed recipient data to the issuer.
func RequestWithdrawal ¶ added in v0.3.0
func RequestWithdrawal(context view.Context, issuer view.Identity, wallet string, tokenType token2.Type, amount uint64, notAnonymous bool, opts ...token.ServiceOption) (view.Identity, view.Session, error)
RequestWithdrawal runs RequestWithdrawalView with the passed arguments. The view will generate a recipient identity and pass it to the issuer.
func RequestWithdrawalForRecipient ¶ added in v0.3.0
func RequestWithdrawalForRecipient(context view.Context, issuer view.Identity, wallet string, tokenType token2.Type, amount uint64, notAnonymous bool, recipientData *RecipientData, opts ...token.ServiceOption) (view.Identity, view.Session, error)
RequestWithdrawalForRecipient runs RequestWithdrawalView with the passed arguments. The view will send the passed recipient data to the issuer.
func RespondExchangeRecipientIdentities ¶
RespondExchangeRecipientIdentities executes the RespondExchangeRecipientIdentitiesView. The recipient sends back the identity to receive ownership of tokens. The identity is taken from the default wallet
func RespondRequestRecipientIdentity ¶
RespondRequestRecipientIdentity executes the RespondRequestRecipientIdentityView. The recipient sends back the identity to receive ownership of tokens. The identity is taken from the default wallet. If the wallet is not found, an error is returned.
func RespondRequestRecipientIdentityUsingWallet ¶
func RespondRequestRecipientIdentityUsingWallet(context view.Context, wallet string) (view.Identity, error)
RespondRequestRecipientIdentityUsingWallet executes the RespondRequestRecipientIdentityView. The recipient sends back the identity to receive ownership of tokens. The identity is taken from the passed wallet. If the wallet is not found, an error is returned. If the wallet is the empty string, the identity is taken from the default wallet.
func StoreTransactionRecords ¶
func StoreTransactionRecords(ctx view.Context, tx *Transaction) error
StoreTransactionRecords stores the transaction records extracted from the passed transaction to the Storage bound to the transaction's TMS ID
func TransferDistributionList ¶ added in v0.3.0
func WithFSCIssuerIdentity ¶ added in v0.5.0
func WithFSCIssuerIdentity(issuerFSCIdentity view.Identity) token.TransferOption
WithFSCIssuerIdentity takes an issuer's node Identity and sets the appropriate attribute in a TransferOptions struct
func WithIssuerPublicParamsPublicKey ¶ added in v0.5.0
func WithIssuerPublicParamsPublicKey(issuerSigningKey view.Identity) token.TransferOption
func WithRecipientData ¶ added in v0.4.0
func WithRecipientData(recipientData *RecipientData) token.ServiceOption
WithRecipientData is used to add a RecipientData to the service options
func WithRecipientWalletID ¶ added in v0.5.0
func WithRecipientWalletID(walletID string) token.ServiceOption
WithRecipientWalletID is used to add a recipient wallet id to the service options
Types ¶
type AcceptView ¶ added in v0.4.0
type AcceptView struct {
// contains filtered or unexported fields
}
AcceptView is used to accept tokens without the need to generate any signature. This is a view executed by a responder. This view is to be used in conjunction with CollectEndorsementsView. Usually, AcceptView is preceded by an invocation of `tx.ReceiveTransaction(context)` necessary if the initiator has invoked CollectEndorsementsView.
func NewAcceptView ¶
func NewAcceptView(tx *Transaction, opts ...EndorsementsOpt) *AcceptView
NewAcceptView returns a new instance of AcceptView given in input a transaction.
type ActionTransfer ¶
type ActionTransfer struct {
// From is the sender
From view.Identity
// Type of tokens to transfer
Type token2.Type
// Amount to transfer
Amount uint64
// Recipient is the recipient of the transfer
Recipient view.Identity
}
ActionTransfer describe a transfer operation
type Actions ¶
type Actions struct {
Transfers []*ActionTransfer
}
type AuditApproveView ¶
type AuditApproveView struct {
// contains filtered or unexported fields
}
func NewAuditApproveView ¶
func NewAuditApproveView(w *token.AuditorWallet, tx *Transaction) *AuditApproveView
type AuditingViewInitiator ¶
type AuditingViewInitiator struct {
// contains filtered or unexported fields
}
type Auditor ¶ added in v0.7.0
type Auditor struct {
dauditor.Service
dauditor.StoreService
}
Auditor wraps the functionalities of the auditor service and the audit db for the ttx service
func NewAuditor ¶
func NewAuditor(sp token.ServiceProvider, w *token.AuditorWallet) (*Auditor, error)
NewAuditor returns a new Auditor for the given wallet. This constructor uses NewAuditorFromTMSID with the wallet's TMSID.
func NewAuditorFromTMSID ¶ added in v0.7.0
NewAuditorFromTMSID returns a new Auditor for the given TMS ID
func (*Auditor) Audit ¶ added in v0.7.0
func (a *Auditor) Audit(ctx context.Context, tx *Transaction) (*token.InputStream, *token.OutputStream, error)
func (*Auditor) GetTokenRequest ¶ added in v0.7.0
func (*Auditor) NewHoldingsFilter ¶ added in v0.7.0
func (a *Auditor) NewHoldingsFilter() *auditdb.HoldingsFilter
NewHoldingsFilter returns a programmable filter over the holdings owned by enrollment IDs.
func (*Auditor) NewPaymentsFilter ¶ added in v0.7.0
func (a *Auditor) NewPaymentsFilter() *auditdb.PaymentsFilter
NewPaymentsFilter returns a programmable filter over the payments sent or received by enrollment IDs.
func (*Auditor) Release ¶ added in v0.7.0
func (a *Auditor) Release(ctx context.Context, tx *Transaction)
Release unlocks the passed enrollment IDs.
func (*Auditor) SetStatus ¶ added in v0.7.0
func (a *Auditor) SetStatus(ctx context.Context, txID string, status driver.TxStatus, message string) error
SetStatus sets the status of the audit records with the passed transaction id to the passed status
func (*Auditor) Transactions ¶ added in v0.7.0
func (a *Auditor) Transactions(ctx context.Context, params db.QueryTransactionsParams, pagination db.Pagination) (*db.PageTransactionsIterator, error)
Transactions returns an iterator of transaction records filtered by the given params.
func (*Auditor) Validate ¶ added in v0.7.0
func (a *Auditor) Validate(tx *Transaction) error
type CheckService ¶ added in v0.4.0
type CheckServiceProvider ¶ added in v0.4.0
type CheckServiceProvider interface {
CheckService(id token.TMSID, adb *ttxdb.StoreService, tdb *tokens.Service) (CheckService, error)
}
type CollectEndorsementsView ¶ added in v0.3.0
type CollectEndorsementsView struct {
Opts *EndorsementsOpts
// contains filtered or unexported fields
}
func NewCollectEndorsementsView ¶
func NewCollectEndorsementsView(tx *Transaction, opts ...EndorsementsOpt) *CollectEndorsementsView
NewCollectEndorsementsView returns an instance of the CollectEndorsementsView struct. This view does the following: 1. It collects all the required signatures to authorize any issue and transfer operation contained in the token transaction. 2. It invokes the Token Chaincode to collect endorsements on the Token Request and prepare the relative transaction. 3. Before completing, all recipients receive the approved transaction. Depending on the token driver implementation, the recipient's signature might or might not be needed to make the token transaction valid.
func (*CollectEndorsementsView) Call ¶ added in v0.3.0
func (c *CollectEndorsementsView) Call(context view.Context) (interface{}, error)
Call executes the view. This view does the following: 1. It collects all the required signatures to authorize any issue and transfer operation contained in the token transaction. 2. It invokes the Token Chaincode to collect endorsements on the Token Request and prepare the relative transaction. 3. Before completing, all recipients receive the approved transaction. Depending on the token driver implementation, the recipient's signature might or might not be needed to make the token transaction valid.
type EndorseView ¶ added in v0.3.0
type EndorseView struct {
// contains filtered or unexported fields
}
EndorseView is used to accept tokens with, possibly, the need to generate some signature for the tokens that belong to this node. This is a view executed by a responder. This view is to be used in conjunction with CollectEndorsementsView. Usually, EndorseView is preceded by an invocation of `tx.ReceiveTransaction(context)` or alike.
func NewEndorseView ¶
func NewEndorseView(tx *Transaction) *EndorseView
NewEndorseView returns an instance of the EndorseView embedding the passed transaction. The view expects that the transaction has been already checked by the business logic for containing the expected context.
func (*EndorseView) Call ¶ added in v0.3.0
func (s *EndorseView) Call(context view.Context) (interface{}, error)
Call handles the signature requests with the respect to the transaction this view has been constructed with. It expects to deal with messages coming from CollectEndorsementsView. Here are the steps: - Storage of the transaction's records. - Generation of the required signatures. - Reception of the endorsed transaction - Acknowledgement of the reception of the endorsed transaction - Finalization
type EndorsementsOpt ¶ added in v0.3.0
type EndorsementsOpt func(*EndorsementsOpts) error
EndorsementsOpt is a function that configures a EndorsementsOpts
func WithExternalWalletSigner ¶ added in v0.3.0
func WithExternalWalletSigner(walletID string, ews ExternalWalletSigner) EndorsementsOpt
func WithSkipApproval ¶ added in v0.3.0
func WithSkipApproval() EndorsementsOpt
WithSkipApproval to skip approval
func WithSkipAuditing ¶ added in v0.3.0
func WithSkipAuditing() EndorsementsOpt
WithSkipAuditing to skip auditing
func WithSkipAuditorSignatureVerification ¶ added in v0.5.0
func WithSkipAuditorSignatureVerification() EndorsementsOpt
WithSkipAuditorSignatureVerification to skip auditor signature verification
func WithSkipDistributeEnv ¶ added in v0.4.0
func WithSkipDistributeEnv() EndorsementsOpt
WithSkipDistributeEnv to skip approval
type EndorsementsOpts ¶ added in v0.3.0
type EndorsementsOpts struct {
// SkipAuditing set it to true to skip the auditing phase
SkipAuditing bool
// SkipAuditorSignatureVerification set it to true to skip the verification of the auditor signature
SkipAuditorSignatureVerification bool
// SkipApproval set it to true to skip the approval phase
SkipApproval bool
// SkipDistributeEnv set it to true to skip the distribution phase
SkipDistributeEnv bool
// External Signers
ExternalWalletSigners map[string]ExternalWalletSigner
}
EndorsementsOpts is used to configure the CollectEndorsementsView
func CompileCollectEndorsementsOpts ¶ added in v0.3.0
func CompileCollectEndorsementsOpts(opts ...EndorsementsOpt) (*EndorsementsOpts, error)
CompileCollectEndorsementsOpts compiles the given list of ServiceOption
func (*EndorsementsOpts) ExternalWalletSigner ¶ added in v0.3.0
func (o *EndorsementsOpts) ExternalWalletSigner(id string) ExternalWalletSigner
type ExchangeRecipientRequest ¶
type ExchangeRecipientRequest struct {
TMSID token.TMSID
WalletID []byte
RecipientData *RecipientData
}
func (*ExchangeRecipientRequest) Bytes ¶
func (r *ExchangeRecipientRequest) Bytes() ([]byte, error)
func (*ExchangeRecipientRequest) FromBytes ¶
func (r *ExchangeRecipientRequest) FromBytes(raw []byte) error
type ExternalWalletSigner ¶ added in v0.3.0
type GetNetworkFunc ¶ added in v0.4.0
type LocalBidirectionalChannel ¶
type LocalBidirectionalChannel struct {
// contains filtered or unexported fields
}
LocalBidirectionalChannel is a bidirectional channel that is used to simulate a session between two views (let's call them L and R) running in the same process.
func NewLocalBidirectionalChannel ¶
func NewLocalBidirectionalChannel(ctx context.Context, caller string, contextID string, endpoint string, pkid []byte) (*LocalBidirectionalChannel, error)
NewLocalBidirectionalChannel creates a new bidirectional channel
func (*LocalBidirectionalChannel) LeftSession ¶
func (c *LocalBidirectionalChannel) LeftSession() view.Session
LeftSession returns the session from the L to R
func (*LocalBidirectionalChannel) RightSession ¶
func (c *LocalBidirectionalChannel) RightSession() view.Session
RightSession returns the session from the R to L
type Metrics ¶ added in v0.3.0
type Metrics struct {
EndorsedTransactions metrics.Counter
AuditApprovedTransactions metrics.Counter
AcceptedTransactions metrics.Counter
}
func GetMetrics ¶ added in v0.3.0
func GetMetrics(sp token.ServiceProvider) *Metrics
func NewMetrics ¶ added in v0.3.0
type MultisigRecipientData ¶ added in v0.5.0
type ReceiveTransactionView ¶ added in v0.3.0
type ReceiveTransactionView struct {
// contains filtered or unexported fields
}
ReceiveTransactionView is a view to read a transaction from the context's session.
func NewReceiveTransactionView ¶
func NewReceiveTransactionView(opts ...TxOption) *ReceiveTransactionView
NewReceiveTransactionView returns a new instance of ReceiveTransactionView with the given options.
func (*ReceiveTransactionView) Call ¶ added in v0.3.0
func (f *ReceiveTransactionView) Call(context view.Context) (interface{}, error)
Call listens to a message from the context's session containing a transaction. The transaction can be received in two forms: - The serialization of the Transaction struct, or - The serialization of a SignatureRequest. The view first tries to deserialize directly as Transaction. If a failure happens, then the view tries to deserialize as SignatureRequest. If no timeout is specified via the opts, 1 minutes is used as default
type ReceiveWithdrawalRequestView ¶ added in v0.3.0
type ReceiveWithdrawalRequestView struct{}
ReceiveWithdrawalRequestView this is the view used by the issuer to receive a withdrawal request
func NewReceiveIssuanceRequestView ¶ added in v0.3.0
func NewReceiveIssuanceRequestView() *ReceiveWithdrawalRequestView
type Recipient ¶ added in v0.5.0
type Recipient struct {
Identity view.Identity
WalletID string
RecipientData *RecipientData
}
type RecipientData ¶
type RecipientData = token.RecipientData
type RecipientRequest ¶
type RecipientRequest struct {
TMSID token.TMSID
WalletID []byte
RecipientData *RecipientData
MultiSig bool
}
func (*RecipientRequest) Bytes ¶
func (r *RecipientRequest) Bytes() ([]byte, error)
func (*RecipientRequest) FromBytes ¶
func (r *RecipientRequest) FromBytes(raw []byte) error
type Recipients ¶ added in v0.5.0
type Recipients []Recipient
func (Recipients) Identities ¶ added in v0.5.0
func (r Recipients) Identities() []view.Identity
type RegisterAuditorView ¶
func NewRegisterAuditorView ¶
func NewRegisterAuditorView(auditView view.View, opts ...token.ServiceOption) *RegisterAuditorView
type RequestRecipientIdentityView ¶
type RequestRecipientIdentityView struct {
TMSID token.TMSID
Recipients Recipients
}
type RequestWithdrawalView ¶ added in v0.3.0
type RequestWithdrawalView struct {
Issuer view.Identity
TokenType token2.Type
Amount uint64
TMSID token.TMSID
Wallet string
NotAnonymous bool
RecipientData *RecipientData
}
RequestWithdrawalView is the initiator view to request an issuer the issuance of tokens. The view prepares an instance of WithdrawalRequest and send it to the issuer.
func NewRequestWithdrawalView ¶ added in v0.3.0
func (*RequestWithdrawalView) Call ¶ added in v0.3.0
func (r *RequestWithdrawalView) Call(context view.Context) (interface{}, error)
func (*RequestWithdrawalView) WithRecipientData ¶ added in v0.4.0
func (r *RequestWithdrawalView) WithRecipientData(data *RecipientData) *RequestWithdrawalView
WithRecipientData sets the recipient data to use
func (*RequestWithdrawalView) WithTMSID ¶ added in v0.3.0
func (r *RequestWithdrawalView) WithTMSID(id token.TMSID) *RequestWithdrawalView
WithTMSID sets the TMS ID to be used
func (*RequestWithdrawalView) WithWallet ¶ added in v0.3.0
func (r *RequestWithdrawalView) WithWallet(wallet string) *RequestWithdrawalView
WithWallet sets the wallet to use to retrieve a recipient identity if it has not been passed already
type RespondExchangeRecipientIdentitiesView ¶
type RespondExchangeRecipientIdentitiesView struct {
Wallet string
}
type RespondRequestRecipientIdentityView ¶
type RespondRequestRecipientIdentityView struct {
Wallet string
}
type Service ¶ added in v0.5.0
type Service struct {
// contains filtered or unexported fields
}
Service is the interface for the owner service
func Get ¶ added in v0.4.0
func Get(sp token.ServiceProvider, tms dep.TokenManagementService) *Service
Get returns the Service instance for the passed TMS
func (*Service) Append ¶ added in v0.5.0
func (a *Service) Append(ctx context.Context, tx *Transaction) error
Append adds the passed transaction to the database
func (*Service) AppendTransactionEndorseAck ¶ added in v0.5.0
func (*Service) GetStatus ¶ added in v0.5.0
GetStatus return the status of the given transaction id. It returns an error if no transaction with that id is found
func (*Service) GetTokenRequest ¶ added in v0.5.0
GetTokenRequest returns the token request bound to the passed transaction id, if available.
func (*Service) GetTransactionEndorsementAcks ¶ added in v0.5.0
type ServiceManager ¶ added in v0.5.0
type ServiceManager struct {
// contains filtered or unexported fields
}
ServiceManager handles the services
func NewServiceManager ¶ added in v0.5.0
func NewServiceManager( networkProvider dep.NetworkProvider, tmsProvider dep.TokenManagementServiceProvider, ttxStoreServiceManager StoreServiceManager, tokensServiceManager TokensServiceManager, tracerProvider trace.TracerProvider, checkServiceProvider CheckServiceProvider, ) *ServiceManager
NewServiceManager creates a new Service manager.
func (*ServiceManager) CacheRequest ¶ added in v0.7.0
func (m *ServiceManager) CacheRequest(ctx context.Context, tmsID token.TMSID, request *token.Request) error
CacheRequest stores the request's details for later use.
func (*ServiceManager) RestoreTMS ¶ added in v0.5.0
RestoreTMS restores the ttxdb corresponding to the passed TMS ID.
func (*ServiceManager) ServiceByTMSId ¶ added in v0.5.0
func (m *ServiceManager) ServiceByTMSId(tmsID token.TMSID) (*Service, error)
ServiceByTMSId returns the Service for the given TMS
type SignatureRequest ¶ added in v0.3.0
func (*SignatureRequest) Bytes ¶ added in v0.7.0
func (sr *SignatureRequest) Bytes() ([]byte, error)
Bytes returns the serialization of this struct
type SignerProvider ¶ added in v0.3.0
type Storage ¶ added in v0.7.0
type Storage interface {
Append(ctx context.Context, tx *Transaction) error
}
Storage defines the interface for storing token transaction records
type StorageProvider ¶ added in v0.7.0
type StorageProvider interface {
// GetStorage returns the Storage instance for the given TMS ID
GetStorage(id token.TMSID) (Storage, error)
// CacheRequest caches the given token request for the given TMS ID
CacheRequest(ctx context.Context, tmsID token.TMSID, request *token.Request) error
}
StorageProvider defines the interface for obtaining token transaction storage instances
func GetStorageProvider ¶ added in v0.7.0
func GetStorageProvider(sp token.ServiceProvider) (StorageProvider, error)
GetStorageProvider retrieves the StorageProvider instance from the given service provider
type StoreServiceManager ¶ added in v0.5.0
type StoreServiceManager db.StoreServiceManager[*ttxdb.StoreService]
type StreamExternalWalletMsg ¶ added in v0.3.0
type StreamExternalWalletMsg struct {
// Type is the type of this message
Type StreamExternalWalletMsgType
// Raw will be interpreted following Type
Raw []byte
}
StreamExternalWalletMsg is the root message that the remote wallet and the ttx package exchange.
func NewStreamExternalWalletMsg ¶ added in v0.3.0
func NewStreamExternalWalletMsg(Type StreamExternalWalletMsgType, v interface{}) (*StreamExternalWalletMsg, error)
NewStreamExternalWalletMsg creates a new root message for the given type and value
type StreamExternalWalletMsgType ¶ added in v0.3.0
type StreamExternalWalletMsgType = int
const ( SigRequest StreamExternalWalletMsgType SignResponse Done )
type StreamExternalWalletSignRequest ¶ added in v0.3.0
StreamExternalWalletSignRequest is a message to request a signature
type StreamExternalWalletSignResponse ¶ added in v0.3.0
type StreamExternalWalletSignResponse struct {
Sigma []byte
}
StreamExternalWalletSignResponse is a message to respond to a request of signature
type StreamExternalWalletSignerClient ¶ added in v0.3.0
type StreamExternalWalletSignerClient struct {
// contains filtered or unexported fields
}
StreamExternalWalletSignerClient is the signer client executed where the token-sdk is in execution
func NewStreamExternalWalletSignerClient ¶ added in v0.3.0
func NewStreamExternalWalletSignerClient(sp SignerProvider, stream view2.Stream, _ int) *StreamExternalWalletSignerClient
func NewStreamExternalWalletSignerClientWithTimeout ¶ added in v0.4.0
func NewStreamExternalWalletSignerClientWithTimeout(sp SignerProvider, stream view2.Stream, timeout time.Duration) *StreamExternalWalletSignerClient
func (*StreamExternalWalletSignerClient) Respond ¶ added in v0.3.0
func (s *StreamExternalWalletSignerClient) Respond() error
type StreamExternalWalletSignerServer ¶ added in v0.3.0
type StreamExternalWalletSignerServer struct {
// contains filtered or unexported fields
}
StreamExternalWalletSignerServer is the signer server executed by the remote wallet
func NewStreamExternalWalletSignerServer ¶ added in v0.3.0
func NewStreamExternalWalletSignerServer(stream view2.Stream) *StreamExternalWalletSignerServer
func (*StreamExternalWalletSignerServer) Done ¶ added in v0.3.0
func (s *StreamExternalWalletSignerServer) Done() error
type TokenTransactionDB ¶ added in v0.3.0
type TokensServiceManager ¶ added in v0.5.0
type TokensServiceManager db.ServiceManager[*tokens.Service]
type Transaction ¶
type Transaction struct {
*Payload
TMS dep.TokenManagementServiceWithExtensions
NetworkProvider GetNetworkFunc
Opts *TxOptions
Context context.Context
EndpointResolver *endpoint.Service
// FromRaw contains the raw material used to unmarshall this transaction.
// It is nil if the transaction was created from scratch.
FromRaw []byte
FromSignatureRequest *SignatureRequest
}
Transaction models a token transaction
func NewAnonymousTransaction ¶
func NewAnonymousTransaction(context view.Context, opts ...TxOption) (*Transaction, error)
NewAnonymousTransaction returns a new Transaction whose envelope will be signed by an anonymous identities. Options can be further used to customize the transaction.
func NewTransaction ¶
func NewTransaction(context view.Context, signer view.Identity, opts ...TxOption) (*Transaction, error)
NewTransaction returns a new token transaction whose envelope will be signed by the signer bound to the given identity.. Options can be further used to customize the transaction. The given identity must be recognizable by the target network. For example, in case of fabric, the signer must be a valid fabric identity. If the passed signer is nil, then the default identity is used.
func NewTransactionFromBytes ¶
func NewTransactionFromBytes(context view.Context, raw []byte) (*Transaction, error)
NewTransactionFromBytes unmarshals the given bytes into a Transaction, if possible.
func NewTransactionFromSignatureRequest ¶ added in v0.7.0
func NewTransactionFromSignatureRequest(context view.Context, sr *SignatureRequest) (*Transaction, error)
NewTransactionFromSignatureRequest calls NewTransactionFromBytes with the content of the signature request. It sets the transaction's `FromSignatureRequest` upon a success in the deserialization.
func ReceiveTransaction ¶
func ReceiveTransaction(context view.Context, opts ...TxOption) (*Transaction, error)
ReceiveTransaction reads from the context's session a message and tries to unmarshal the message payload as a Transaction.
func (*Transaction) ApplicationMetadata ¶
func (t *Transaction) ApplicationMetadata(k string) []byte
ApplicationMetadata returns the application metadata value for the given key.
func (*Transaction) Bytes ¶
func (t *Transaction) Bytes(eIDs ...string) ([]byte, error)
Bytes returns the serialized version of the transaction. If eIDs is not nil, then metadata is filtered by the passed eIDs.
func (*Transaction) Channel ¶
func (t *Transaction) Channel() string
Channel returns the channel ID of this transaction.
func (*Transaction) CloseSelector ¶ added in v0.4.0
func (t *Transaction) CloseSelector() error
CloseSelector closes the token selector for this transaction.
func (*Transaction) ID ¶
func (t *Transaction) ID() string
ID returns the ID of this transaction. It is equal to the underlying transaction's ID.
func (*Transaction) Inputs ¶
func (t *Transaction) Inputs() (*token.InputStream, error)
Inputs returns the inputs of this transaction over all the actions. The input stream returned can by further filter via the methods it exposes.
func (*Transaction) InputsAndOutputs ¶ added in v0.3.0
func (t *Transaction) InputsAndOutputs(ctx context.Context) (*token.InputStream, *token.OutputStream, token.ActionMetadata, error)
InputsAndOutputs returns the inputs and outputs of this transaction over all the actions. The input and output streams returned can by further filter via the methods they expose. The map returned contains the application metadata for all the involved tokens.
func (*Transaction) IsValid ¶
func (t *Transaction) IsValid(ctx context.Context) error
IsValid checks that the transaction is well-formed. This means checking that the embedded TokenRequest is valid.
func (*Transaction) Issue ¶
func (t *Transaction) Issue(wallet *token.IssuerWallet, receiver view.Identity, typ token2.Type, q uint64, opts ...token.IssueOption) error
Issue appends a new Issue action to the TokenRequest of this transaction
func (*Transaction) MarshallToAudit ¶
func (t *Transaction) MarshallToAudit() ([]byte, error)
MarshallToAudit returns the marshalled version of this transaction for audit purposes.
func (*Transaction) Namespace ¶
func (t *Transaction) Namespace() string
Namespace returns the namespace ID of this transaction.
func (*Transaction) Network ¶
func (t *Transaction) Network() string
Network returns the network ID of this transaction.
func (*Transaction) NetworkTxID ¶ added in v0.4.0
func (t *Transaction) NetworkTxID() network.TxID
NetworkTxID returns the network transaction ID of this transaction. The network transaction ID is the identifier the underlying network understands.
func (*Transaction) Outputs ¶
func (t *Transaction) Outputs() (*token.OutputStream, error)
Outputs returns the outputs of this transaction over all the actions. The output stream returned can by further filter via the methods it exposes.
func (*Transaction) Redeem ¶
func (t *Transaction) Redeem(wallet *token.OwnerWallet, typ token2.Type, value uint64, opts ...token.TransferOption) error
Redeem appends a new Redeem action to the TokenRequest of this transaction
func (*Transaction) Release ¶
func (t *Transaction) Release()
Release releases all the resources held by this transaction. In particular, all the tokens locked by this transaction are unlocked.
func (*Transaction) Request ¶
func (t *Transaction) Request() *token.Request
Request returns the underlying TokenRequest of this transaction.
func (*Transaction) Selector ¶
func (t *Transaction) Selector() (token.Selector, error)
Selector returns the default token selector for this transaction
func (*Transaction) SetApplicationMetadata ¶
func (t *Transaction) SetApplicationMetadata(k string, v []byte)
SetApplicationMetadata sets the application metadata key-value pair.
func (*Transaction) TMSID ¶ added in v0.3.0
func (t *Transaction) TMSID() token.TMSID
TMSID returns the TMSID of this transaction.
func (*Transaction) TokenService ¶
func (t *Transaction) TokenService() dep.TokenManagementServiceWithExtensions
TokenService returns the token management service associated to this transaction.
func (*Transaction) Transfer ¶
func (t *Transaction) Transfer(wallet *token.OwnerWallet, typ token2.Type, values []uint64, owners []view.Identity, opts ...token.TransferOption) error
Transfer appends a new Transfer action to the TokenRequest of this transaction
func (*Transaction) Upgrade ¶ added in v0.5.0
func (t *Transaction) Upgrade( wallet *token.IssuerWallet, receiver token.Identity, challenge token.TokensUpgradeChallenge, tokens []token2.LedgerToken, proof token.TokensUpgradeProof, opts ...token.IssueOption, ) error
Upgrade performs an upgrade operation of the passed ledger tokens. A proof and its challenge will be used to verify that the request of upgrade is legit. If the proof verifies then the passed wallet will be used to issue a new amount of tokens matching those whose upgrade has been requested.
type TransactionInfo ¶
type TransactionInfo struct {
// EndorsementAcks contains the endorsement ACKs received at time of dissemination.
EndorsementAcks map[string][]byte
// ApplicationMetadata contains the application metadata
ApplicationMetadata map[string][]byte
TokenRequest []byte
}
TransactionInfo contains the transaction info.
type TransactionInfoProvider ¶
type TransactionInfoProvider struct {
// contains filtered or unexported fields
}
TransactionInfoProvider allows the retrieval of the transaction info
func (*TransactionInfoProvider) TransactionInfo ¶
func (a *TransactionInfoProvider) TransactionInfo(ctx context.Context, txID string) (*TransactionInfo, error)
TransactionInfo returns the transaction info for the given transaction ID.
type TransactionRecord ¶ added in v0.5.0
type TransactionRecord = db.TransactionRecord
TransactionRecord is a more finer-grained version of a movement record. Given a Token Transaction, for each token action in the Token Request, a transaction record is created for each unique enrollment ID found in the outputs. The transaction record contains the total amount of the token type that was transferred to/from that enrollment ID in that action.
type TransactionSer ¶
type TxOption ¶
func WithAnonymousTransaction ¶ added in v0.5.0
WithAnonymousTransaction is used to tell if the transaction needs to be anonymous or not
func WithAuditor ¶
func WithChannel ¶
func WithNamespace ¶
func WithNetwork ¶
func WithNetworkTxID ¶ added in v0.4.0
func WithNoCachingRequest ¶ added in v0.4.0
func WithNoCachingRequest() TxOption
WithNoCachingRequest is used to tell the ordering view to not cache the token request
func WithNoTransactionVerification ¶ added in v0.3.0
func WithNoTransactionVerification() TxOption
func WithTMSIDPointer ¶ added in v0.5.0
WithTMSIDPointer filters by TMS identifier, if passed
func WithTimeout ¶ added in v0.4.0
func WithTransactions ¶ added in v0.4.0
func WithTransactions(tx *Transaction) TxOption
type TxOptions ¶
type TxOptions struct {
Auditor view.Identity
TMSID token.TMSID
NoTransactionVerification bool
Timeout time.Duration
TxID string
Transaction *Transaction
NetworkTxID network.TxID
NoCachingRequest bool
AnonymousTransaction bool
}
func CompileOpts ¶ added in v0.5.0
type TxOwner ¶ added in v0.4.0
type TxOwner struct {
// contains filtered or unexported fields
}
func NewOwner ¶
func NewOwner(sp token.ServiceProvider, tms dep.TokenManagementService) *TxOwner
NewOwner returns a new owner service.
func NewTxOwner ¶ added in v0.5.0
func NewTxOwner(tms dep.TokenManagementService, backend *Service) *TxOwner
func (*TxOwner) Append ¶ added in v0.4.0
func (a *TxOwner) Append(ctx context.Context, tx *Transaction) error
Append adds a new transaction to the token transaction database.
func (*TxOwner) GetStatus ¶ added in v0.4.0
GetStatus return the status of the given transaction id. It returns an error if no transaction with that id is found
func (*TxOwner) GetTokenRequest ¶ added in v0.4.0
func (*TxOwner) SetStatus ¶ added in v0.4.0
func (a *TxOwner) SetStatus(ctx context.Context, txID string, status driver.TxStatus, message string) error
SetStatus sets the status of the audit records with the passed transaction id to the passed status
func (*TxOwner) TransactionInfo ¶ added in v0.4.0
TransactionInfo returns the transaction info for the given transaction ID.
func (*TxOwner) Transactions ¶ added in v0.4.0
func (a *TxOwner) Transactions(ctx context.Context, params db.QueryTransactionsParams, pagination driver2.Pagination) (*driver2.PageIterator[*driver.TransactionRecord], error)
Transactions returns an iterators of transaction records filtered by the given params.
type TxStatus ¶
TxStatus is the status of a transaction
const ( // Unknown is the status of a transaction that is unknown Unknown TxStatus = driver.Unknown // Pending is the status of a transaction that has been submitted to the ledger Pending TxStatus = driver.Pending // Confirmed is the status of a transaction that has been confirmed by the ledger Confirmed TxStatus = driver.Confirmed // Deleted is the status of a transaction that has been deleted due to a failure to commit Deleted TxStatus = driver.Deleted )
type UpgradeTokensAgreement ¶ added in v0.5.0
type UpgradeTokensInitiatorView ¶ added in v0.5.0
type UpgradeTokensInitiatorView struct {
Issuer view.Identity
TokenType token2.Type
Amount uint64
TMSID token.TMSID
Wallet string
NotAnonymous bool
RecipientData *RecipientData
Tokens []token2.LedgerToken
}
UpgradeTokensInitiatorView is the initiator view to request an issuer the upgrade of tokens. The view prepares an instance of UpgradeTokensRequest and send it to the issuer.
func NewRequestTokensUpgradeView ¶ added in v0.5.0
func NewRequestTokensUpgradeView(issuer view.Identity, wallet string, tokens []token2.LedgerToken, notAnonymous bool) *UpgradeTokensInitiatorView
func (*UpgradeTokensInitiatorView) Call ¶ added in v0.5.0
func (r *UpgradeTokensInitiatorView) Call(context view.Context) (interface{}, error)
func (*UpgradeTokensInitiatorView) WithRecipientData ¶ added in v0.5.0
func (r *UpgradeTokensInitiatorView) WithRecipientData(data *RecipientData) *UpgradeTokensInitiatorView
WithRecipientData sets the recipient data to use
func (*UpgradeTokensInitiatorView) WithTMSID ¶ added in v0.5.0
func (r *UpgradeTokensInitiatorView) WithTMSID(id token.TMSID) *UpgradeTokensInitiatorView
WithTMSID sets the TMS ID to be used
func (*UpgradeTokensInitiatorView) WithWallet ¶ added in v0.5.0
func (r *UpgradeTokensInitiatorView) WithWallet(wallet string) *UpgradeTokensInitiatorView
WithWallet sets the wallet to use to retrieve a recipient identity if it has not been passed already
type UpgradeTokensRequest ¶ added in v0.5.0
type UpgradeTokensRequest struct {
TMSID token.TMSID // The TMSID this request refers to
ID token.TokensUpgradeChallenge // The unique ID of this request, it used as challenge of the upgrade protocol
Tokens []token2.LedgerToken // The tokens to be upgraded
Proof token.TokensUpgradeProof // The proof
RecipientData RecipientData // The info about the recipient of the new issues tokens
NotAnonymous bool // Should be the transaction anonymous
}
func ReceiveTokensUpgradeRequest ¶ added in v0.5.0
func ReceiveTokensUpgradeRequest(context view.Context) (*UpgradeTokensRequest, error)
type UpgradeTokensResponderView ¶ added in v0.5.0
type UpgradeTokensResponderView struct{}
UpgradeTokensResponderView this is the view used by the issuer to receive a upgrade request
func NewReceiveUpgradeRequestView ¶ added in v0.5.0
func NewReceiveUpgradeRequestView() *UpgradeTokensResponderView
type WithdrawalRequest ¶ added in v0.3.0
type WithdrawalRequest struct {
TMSID token.TMSID
RecipientData RecipientData
TokenType token2.Type
Amount uint64
NotAnonymous bool
}
func ReceiveWithdrawalRequest ¶ added in v0.3.0
func ReceiveWithdrawalRequest(context view.Context) (*WithdrawalRequest, error)
Source Files
¶
- accept.go
- auditor.go
- collectactions.go
- collectendorsements.go
- db.go
- endorse.go
- endorse_opts.go
- errors.go
- external.go
- finality.go
- info.go
- logger.go
- manager.go
- marshaller.go
- metrics.go
- opts.go
- ordering.go
- owner.go
- random.go
- receivetx.go
- recipients.go
- session.go
- status.go
- storage.go
- transaction.go
- transfer_opts.go
- upgrade.go
- views.go
- wallet.go
- withdrawal.go