Documentation
¶
Index ¶
- func GetWallet(context view.Context, id string, opts ...token.ServiceOption) *token.OwnerWallet
- func NewFinalityView(tx *Transaction, opts ...ttx.TxOption) view.View
- func RequestRecipientIdentity(context view.Context, parties []token.Identity, opts ...token.ServiceOption) (token.Identity, error)
- type EndorseSpendView
- type EscrowAuth
- type OwnerWallet
- func (w *OwnerWallet) ListTokens(ctx context.Context, opts ...token.ListTokensOption) (*token2.UnspentTokens, error)
- func (w *OwnerWallet) ListTokensAsEscrow(ctx context.Context, opts ...token.ListTokensOption) (iterators.Iterator[*token2.UnspentToken], error)
- func (w *OwnerWallet) ListTokensIterator(ctx context.Context, opts ...token.ListTokensOption) (iterators.Iterator[*token2.UnspentToken], error)
- type QueryEngine
- type ReceiveSpendRequestView
- type RequestSpendView
- type SpendRequest
- type SpendResponse
- type TokenVault
- type Transaction
- type Vault
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetWallet ¶
func GetWallet(context view.Context, id string, opts ...token.ServiceOption) *token.OwnerWallet
GetWallet returns the wallet whose id is the passed id
func NewFinalityView ¶
func NewFinalityView(tx *Transaction, opts ...ttx.TxOption) view.View
func RequestRecipientIdentity ¶
func RequestRecipientIdentity(context view.Context, parties []token.Identity, opts ...token.ServiceOption) (token.Identity, error)
RequestRecipientIdentity requests the recipient identity for the given parties. It returns a multisig identity. All the parties are notified about the participants in the multisig identity.
Types ¶
type EndorseSpendView ¶
type EndorseSpendView struct {
// contains filtered or unexported fields
}
EndorseSpendView endorses a SpendRequest
func NewEndorseSpendView ¶
func NewEndorseSpendView(request *SpendRequest) *EndorseSpendView
type EscrowAuth ¶
type EscrowAuth struct {
WalletService driver.WalletService
}
EscrowAuth implements the Authorization interface for this script
func NewEscrowAuth ¶
func NewEscrowAuth(walletService driver.WalletService) *EscrowAuth
func (*EscrowAuth) AmIAnAuditor ¶
func (s *EscrowAuth) AmIAnAuditor() bool
AmIAnAuditor returns false for script ownership
func (*EscrowAuth) IsMine ¶
IsMine returns true if either the sender or the recipient is in one of the owner wallets. It returns an empty wallet id.
type OwnerWallet ¶
type OwnerWallet struct {
// contains filtered or unexported fields
}
OwnerWallet is a combination of a wallet and a query service
func Wallet ¶
func Wallet(context view.Context, wallet *token.OwnerWallet) *OwnerWallet
Wallet returns an OwnerWallet which contains a wallet and a query service
func (*OwnerWallet) ListTokens ¶
func (w *OwnerWallet) ListTokens(ctx context.Context, opts ...token.ListTokensOption) (*token2.UnspentTokens, error)
ListTokens returns a list of tokens that matches the passed options and whose recipient belongs to this wallet
func (*OwnerWallet) ListTokensAsEscrow ¶
func (w *OwnerWallet) ListTokensAsEscrow(ctx context.Context, opts ...token.ListTokensOption) (iterators.Iterator[*token2.UnspentToken], error)
ListTokensAsEscrow returns a list of tokens which are co-owned by OwnerWallet
func (*OwnerWallet) ListTokensIterator ¶
func (w *OwnerWallet) ListTokensIterator(ctx context.Context, opts ...token.ListTokensOption) (iterators.Iterator[*token2.UnspentToken], error)
ListTokensIterator returns an iterator of tokens that matches the passed options and whose recipient belongs to this wallet
type QueryEngine ¶
type ReceiveSpendRequestView ¶
type ReceiveSpendRequestView struct{}
ReceiveSpendRequestView receives a SpendRequest from the context's session.
func NewReceiveSpendRequestView ¶
func NewReceiveSpendRequestView() *ReceiveSpendRequestView
type RequestSpendView ¶
type RequestSpendView struct {
// contains filtered or unexported fields
}
RequestSpendView sends a SpendRequest to all parties and waits for their responses
func NewRequestSpendView ¶
func NewRequestSpendView(unspentToken *token.UnspentToken, opts ...token2.ServiceOption) *RequestSpendView
func (*RequestSpendView) Call ¶
func (c *RequestSpendView) Call(context view.Context) (interface{}, error)
func (*RequestSpendView) WithTimeout ¶
func (c *RequestSpendView) WithTimeout(timeout time.Duration) *RequestSpendView
type SpendRequest ¶
type SpendRequest struct {
Token *token.UnspentToken
}
SpendRequest is the request to spend a token
func ReceiveSpendRequest ¶
func (*SpendRequest) Bytes ¶
func (r *SpendRequest) Bytes() ([]byte, error)
func (*SpendRequest) String ¶
func (r *SpendRequest) String() string
type SpendResponse ¶
type SpendResponse struct {
Err error
}
SpendResponse is the response to a SpendRequest
type TokenVault ¶
type Transaction ¶
type Transaction struct {
*ttx.Transaction
}
Transaction wraps a ttx.Transaction to provide a more user-friendly API for multisig transactions.
func EndorseSpend ¶
func EndorseSpend(context view.Context, request *SpendRequest) (*Transaction, error)
func Wrap ¶
func Wrap(tx *ttx.Transaction) *Transaction
Wrap wraps a ttx.Transaction to provide a more user-friendly API for multisig transactions.
func (*Transaction) Lock ¶
func (t *Transaction) Lock(ctx context.Context, senderWallet *token2.OwnerWallet, tokenType token.Type, amount uint64, recipient token2.Identity, opts ...token2.TransferOption) error
Lock locks the given amount of tokens of the given type in the sender's wallet and transfers them to the recipient.
func (*Transaction) Spend ¶
func (t *Transaction) Spend(senderWallet *token2.OwnerWallet, at *token.UnspentToken, recipient token2.Identity, opts ...token2.TransferOption) error
Spend spends the given token.