multisig

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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

func (*EndorseSpendView) Call

func (a *EndorseSpendView) Call(context view.Context) (interface{}, error)

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

func (s *EscrowAuth) IsMine(ctx context.Context, tok *token3.Token) (string, []string, bool)

IsMine returns true if either the sender or the recipient is in one of the owner wallets. It returns an empty wallet id.

func (*EscrowAuth) Issued

func (s *EscrowAuth) Issued(ctx context.Context, issuer driver.Identity, tok *token3.Token) bool

func (*EscrowAuth) OwnerType

func (s *EscrowAuth) OwnerType(raw []byte) (string, []byte, error)

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 QueryEngine interface {
	// UnspentTokensIteratorBy returns an iterator over all unspent tokens by type and id. Type can be empty
	UnspentTokensIteratorBy(ctx context.Context, id string, tokenType token2.Type) (driver.UnspentTokensIterator, error)
}

type ReceiveSpendRequestView

type ReceiveSpendRequestView struct{}

ReceiveSpendRequestView receives a SpendRequest from the context's session.

func NewReceiveSpendRequestView

func NewReceiveSpendRequestView() *ReceiveSpendRequestView

func (*ReceiveSpendRequestView) Call

func (f *ReceiveSpendRequestView) Call(context view.Context) (interface{}, error)

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 ReceiveSpendRequest(context view.Context, opts ...ttx.TxOption) (*SpendRequest, error)

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 TokenVault interface {
	DeleteTokens(ctx context.Context, toDelete ...*token2.ID) error
}

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.

type Vault

type Vault interface {
	DeleteTokens(ctx context.Context, toDelete ...*token2.ID) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL