Documentation
¶
Overview ¶
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func ExchangeRecipientIdentities(context view.Context, walletID string, recipient view.Identity, ...) (view.Identity, view.Identity, error)
- func GetAuditorWallet(sp view2.ServiceProvider, opts ...token.ServiceOption) *token.AuditorWallet
- func GetIssuerWallet(sp view2.ServiceProvider, id string, opts ...token.ServiceOption) *token.IssuerWallet
- func GetIssuerWalletForChannel(sp view2.ServiceProvider, channel, id string, opts ...token.ServiceOption) *token.IssuerWallet
- func GetWallet(sp view2.ServiceProvider, id string, opts ...token.ServiceOption) *token.OwnerWallet
- func GetWalletForChannel(sp view2.ServiceProvider, channel, id string, opts ...token.ServiceOption) *token.OwnerWallet
- func Marshal(v interface{}) ([]byte, error)
- func MarshalMeta(v map[string][]byte) ([]byte, error)
- func MyAuditorWallet(sp view2.ServiceProvider, opts ...token.ServiceOption) *token.AuditorWallet
- func MyIssuerWallet(context view.Context, opts ...token.ServiceOption) *token.IssuerWallet
- func MyWallet(sp view2.ServiceProvider, opts ...token.ServiceOption) *token.OwnerWallet
- func MyWalletFromTx(sp view2.ServiceProvider, tx *Transaction) *token.OwnerWallet
- func NewAcceptView(tx *Transaction) *acceptView
- func NewAuditor(sp view2.ServiceProvider, w *token.AuditorWallet) *txAuditor
- func NewCollectActionsResponderView(tx *Transaction, action *ActionTransfer) *collectActionsResponderView
- func NewCollectActionsView(tx *Transaction, actions ...*ActionTransfer) *collectActionsView
- func NewCollectEndorsementsView(tx *Transaction) *collectEndorsementsView
- func NewEndorseView(tx *Transaction) *endorseView
- func NewFinalityView(tx *Transaction) *finalityView
- func NewFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) *finalityView
- func NewOrderingAndFinalityView(tx *Transaction) *orderingAndFinalityView
- func NewOrderingAndFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) *orderingAndFinalityView
- func NewOrderingView(tx *Transaction) *orderingView
- func NewOwner(sp view2.ServiceProvider, tms *token.ManagementService) *txOwner
- func NewReceiveTransactionView(network string) *receiveTransactionView
- func ReceiveAction(context view.Context) (*Transaction, *ActionTransfer, error)
- func RequestRecipientIdentity(context view.Context, recipient view.Identity, opts ...token.ServiceOption) (view.Identity, 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 RunView(context view.Context, view view.View, opts ...view.RunViewOption)
- func StoreEnvelope(context view.Context, tx *Transaction) error
- func StoreTransactionRecords(context view.Context, tx *Transaction) error
- func Unmarshal(data []byte, v interface{}) error
- func UnmarshalMeta(raw []byte) (map[string][]byte, error)
- func WithType(tokenType string) token.ListTokensOption
- type ActionTransfer
- type Actions
- type AuditApproveView
- type AuditingViewInitiator
- type ExchangeRecipientIdentitiesView
- type ExchangeRecipientRequest
- type LocalBidirectionalChannel
- type Payload
- type RecipientData
- type RecipientRequest
- type RegisterAuditorView
- type RequestRecipientIdentityView
- type RespondExchangeRecipientIdentitiesView
- type RespondRequestRecipientIdentityView
- type Transaction
- func NewAnonymousTransaction(sp view.Context, opts ...TxOption) (*Transaction, error)
- func NewTransaction(sp view.Context, signer view.Identity, opts ...TxOption) (*Transaction, error)
- func NewTransactionFromBytes(sp view.Context, raw []byte) (*Transaction, error)
- func ReceiveTransaction(context view.Context) (*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) ID() string
- func (t *Transaction) Inputs() (*token.InputStream, error)
- func (t *Transaction) IsValid() error
- func (t *Transaction) Issue(wallet *token.IssuerWallet, receiver view.Identity, typ string, q uint64, ...) error
- func (t *Transaction) MarshallToAudit() ([]byte, error)
- func (t *Transaction) Namespace() string
- func (t *Transaction) Network() string
- func (t *Transaction) Outputs() (*token.OutputStream, error)
- func (t *Transaction) Redeem(wallet *token.OwnerWallet, typ string, 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) TokenService() *token.ManagementService
- func (t *Transaction) Transfer(wallet *token.OwnerWallet, typ string, values []uint64, owners []view.Identity, ...) error
- type TransactionInfo
- type TransactionInfoProvider
- type TransactionSer
- type TxOption
- type TxOptions
- type TxStatus
Constants ¶
const (
// EndorsementAckPrefix is the prefix for the endorsement ACKs.
EndorsementAckPrefix = "ttx.endorse.ack"
)
Variables ¶
This section is empty.
Functions ¶
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(sp view2.ServiceProvider, 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 GetIssuerWallet ¶
func GetIssuerWallet(sp view2.ServiceProvider, 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(sp view2.ServiceProvider, 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 GetWallet ¶
func GetWallet(sp view2.ServiceProvider, 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(sp view2.ServiceProvider, 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 MyAuditorWallet ¶
func MyAuditorWallet(sp view2.ServiceProvider, 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(sp view2.ServiceProvider, opts ...token.ServiceOption) *token.OwnerWallet
MyWallet returns the default wallet, nil if not found.
func MyWalletFromTx ¶
func MyWalletFromTx(sp view2.ServiceProvider, 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 NewAcceptView ¶
func NewAcceptView(tx *Transaction) *acceptView
func NewAuditor ¶
func NewAuditor(sp view2.ServiceProvider, w *token.AuditorWallet) *txAuditor
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 NewCollectEndorsementsView ¶
func NewCollectEndorsementsView(tx *Transaction) *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 NewEndorseView ¶
func NewEndorseView(tx *Transaction) *endorseView
NewEndorseView returns an instance of the endorseView. The view does the following: 1. Wait for signature requests. 2. Upon receiving a signature request, it validates the request and send back the requested signature. 3. After, it waits to receive the Transaction. The Transaction is validated and stored locally to be processed at time of committing. 4. It sends back an ack.
func NewFinalityView ¶
func NewFinalityView(tx *Transaction) *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 NewFinalityWithTimeoutView ¶
func NewFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) *finalityView
NewFinalityWithTimeoutView 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. It returns in case the operation is not completed before the passed timeout.
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) *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 NewOwner ¶
func NewOwner(sp view2.ServiceProvider, tms *token.ManagementService) *txOwner
NewOwner returns a new owner service.
func NewReceiveTransactionView ¶
func NewReceiveTransactionView(network string) *receiveTransactionView
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 RequestRecipientIdentity ¶
func RequestRecipientIdentity(context view.Context, recipient view.Identity, opts ...token.ServiceOption) (view.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 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 RunView ¶
RunView runs passed view within the passed context and using the passed options in a separate goroutine
func StoreEnvelope ¶
func StoreEnvelope(context view.Context, tx *Transaction) error
StoreEnvelope stores the transaction envelope locally
func StoreTransactionRecords ¶
func StoreTransactionRecords(context view.Context, tx *Transaction) error
StoreTransactionRecords stores the transaction records extracted from the passed transaction to the token transaction db
func WithType ¶
func WithType(tokenType string) token.ListTokensOption
WithType returns a list token option that filter by the passed token type. If the passed token type is the empty string, all token types are selected.
Types ¶
type ActionTransfer ¶
type ActionTransfer struct { // From is the sender From view.Identity // Type of tokens to transfer Type string // 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 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 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(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 RecipientData ¶
func (*RecipientData) Bytes ¶
func (r *RecipientData) Bytes() ([]byte, error)
func (*RecipientData) FromBytes ¶
func (r *RecipientData) FromBytes(raw []byte) error
type RecipientRequest ¶
func (*RecipientRequest) Bytes ¶
func (r *RecipientRequest) Bytes() ([]byte, error)
func (*RecipientRequest) FromBytes ¶
func (r *RecipientRequest) FromBytes(raw []byte) error
type RegisterAuditorView ¶
func NewRegisterAuditorView ¶
func NewRegisterAuditorView(auditView view.View, opts ...token.ServiceOption) *RegisterAuditorView
type RespondExchangeRecipientIdentitiesView ¶
type RespondExchangeRecipientIdentitiesView struct {
Wallet string
}
type RespondRequestRecipientIdentityView ¶
type RespondRequestRecipientIdentityView struct {
Wallet string
}
type Transaction ¶
type Transaction struct { *Payload SP view2.ServiceProvider Opts *TxOptions }
func NewAnonymousTransaction ¶
func NewAnonymousTransaction(sp view.Context, opts ...TxOption) (*Transaction, error)
NewAnonymousTransaction returns a new anonymous token transaction customized with the passed opts
func NewTransaction ¶
NewTransaction returns a new token transaction customized with the passed opts that will be signed by the passed signer. A valid signer is a signer that the target network recognizes as so. 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(sp view.Context, raw []byte) (*Transaction, error)
func ReceiveTransaction ¶
func ReceiveTransaction(context view.Context) (*Transaction, error)
func (*Transaction) ApplicationMetadata ¶
func (t *Transaction) ApplicationMetadata(k string) []byte
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
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)
func (*Transaction) IsValid ¶
func (t *Transaction) IsValid() 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 string, q uint64, opts ...token.IssueOption) error
Issue appends a new Issue operation to the TokenRequest inside this transaction
func (*Transaction) MarshallToAudit ¶
func (t *Transaction) MarshallToAudit() ([]byte, error)
func (*Transaction) Namespace ¶
func (t *Transaction) Namespace() string
func (*Transaction) Network ¶
func (t *Transaction) Network() string
func (*Transaction) Outputs ¶
func (t *Transaction) Outputs() (*token.OutputStream, error)
func (*Transaction) Redeem ¶
func (t *Transaction) Redeem(wallet *token.OwnerWallet, typ string, value uint64, opts ...token.TransferOption) error
func (*Transaction) Release ¶
func (t *Transaction) Release()
func (*Transaction) Request ¶
func (t *Transaction) Request() *token.Request
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)
func (*Transaction) TokenService ¶
func (t *Transaction) TokenService() *token.ManagementService
func (*Transaction) Transfer ¶
func (t *Transaction) Transfer(wallet *token.OwnerWallet, typ string, values []uint64, owners []view.Identity, opts ...token.TransferOption) error
Transfer appends a new Transfer operation to the TokenRequest inside this transaction
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 }
TransactionInfo contains the transaction info.
type TransactionInfoProvider ¶
type TransactionInfoProvider struct {
// contains filtered or unexported fields
}
TransactionInfoProvider allows the retrieval of the transaction info
func NewTransactionInfoProvider ¶
func NewTransactionInfoProvider(sp view.ServiceProvider, tms *token.ManagementService) *TransactionInfoProvider
func (*TransactionInfoProvider) TransactionInfo ¶
func (a *TransactionInfoProvider) TransactionInfo(txID string) (*TransactionInfo, error)
TransactionInfo returns the transaction info for the given transaction ID.
type TransactionSer ¶
type TxOption ¶
func WithAuditor ¶
func WithChannel ¶
func WithNamespace ¶
func WithNetwork ¶
type TxStatus ¶
TxStatus is the status of a transaction
const ( // Pending is the status of a transaction that has been submitted to the ledger Pending TxStatus = "Pending" // Confirmed is the status of a transaction that has been confirmed by the ledger Confirmed TxStatus = "Confirmed" // Deleted is the status of a transaction that has been deleted due to a failure to commit Deleted TxStatus = "Deleted" )