Documentation ¶
Overview ¶
Package account stores and tracks accounts within a Chain Core.
Index ¶
- Constants
- Variables
- func Annotated(a *Account) (*query.AnnotatedAccount, error)
- type Account
- type Manager
- func (m *Manager) AnnotateTxs(ctx context.Context, txs []*query.AnnotatedTx) error
- func (m *Manager) Create(ctx context.Context, xpubs []chainkd.XPub, quorum int, alias string, ...) (*Account, error)
- func (m *Manager) CreateControlProgram(ctx context.Context, accountID string, change bool, expiresAt time.Time) ([]byte, error)
- func (m *Manager) CreateReceiver(ctx context.Context, accID, accAlias string, expiresAt time.Time) (*txbuilder.Receiver, error)
- func (m *Manager) DecodeControlAction(data []byte) (txbuilder.Action, error)
- func (m *Manager) DecodeSpendAction(data []byte) (txbuilder.Action, error)
- func (m *Manager) DecodeSpendUTXOAction(data []byte) (txbuilder.Action, error)
- func (m *Manager) ExpireReservations(ctx context.Context, period time.Duration)
- func (m *Manager) FindByAlias(ctx context.Context, alias string) (*signers.Signer, error)
- func (m *Manager) IndexAccounts(indexer Saver)
- func (m *Manager) NewControlAction(amt bc.AssetAmount, accountID string, refData chainjson.Map) txbuilder.Action
- func (m *Manager) NewSpendAction(amt bc.AssetAmount, accountID string, refData chainjson.Map, ...) txbuilder.Action
- func (m *Manager) NewSpendUTXOAction(outputID bc.Hash) txbuilder.Action
- func (m *Manager) ProcessBlocks(ctx context.Context)
- func (m *Manager) QueryAll(ctx context.Context) (interface{}, error)
- func (m *Manager) UpdateTags(ctx context.Context, id, alias *string, tags map[string]interface{}) error
- type Saver
Constants ¶
View Source
const ( // PinName is used to identify the pin associated with // the account indexer block processor. PinName = "account" // ExpirePinName is used to identify the pin associated // with the account control program expiration processor. ExpirePinName = "expire-control-programs" // DeleteSpentsPinName is used to identify the pin associated // with the processor that deletes spent account UTXOs. DeleteSpentsPinName = "delete-account-spents" )
Variables ¶
View Source
var ( ErrDuplicateAlias = errors.New("duplicate account alias") ErrBadIdentifier = errors.New("either ID or alias must be specified, and not both") )
View Source
var ( // ErrInsufficient indicates the account doesn't contain enough // units of the requested asset to satisfy the reservation. // New units must be deposited into the account in order to // satisfy the request; change will not be sufficient. ErrInsufficient = errors.New("reservation found insufficient funds") // ErrReserved indicates that a reservation could not be // satisfied because some of the outputs were already reserved. // When those reservations are finalized into a transaction // (and no other transaction spends funds from the account), // new change outputs will be created // in sufficient amounts to satisfy the request. ErrReserved = errors.New("reservation found outputs already reserved") )
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager stores accounts and their associated control programs.
func (*Manager) AnnotateTxs ¶
AnnotateTxs adds account data to transactions
func (*Manager) Create ¶
func (m *Manager) Create(ctx context.Context, xpubs []chainkd.XPub, quorum int, alias string, tags map[string]interface{}, clientToken string) (*Account, error)
Create creates a new Account.
func (*Manager) CreateControlProgram ¶
func (m *Manager) CreateControlProgram(ctx context.Context, accountID string, change bool, expiresAt time.Time) ([]byte, error)
CreateControlProgram creates a control program that is tied to the Account and stores it in the database.
func (*Manager) CreateReceiver ¶
func (m *Manager) CreateReceiver(ctx context.Context, accID, accAlias string, expiresAt time.Time) (*txbuilder.Receiver, error)
CreateReceiver creates a new account receiver for an account with the provided expiry. If a zero time is provided for the expiry, a default expiry of 30 days from the current time is used.
func (*Manager) DecodeControlAction ¶
func (*Manager) DecodeSpendAction ¶
func (*Manager) DecodeSpendUTXOAction ¶
func (*Manager) ExpireReservations ¶
ExpireReservations removes reservations that have expired periodically. It blocks until the context is canceled.
func (*Manager) FindByAlias ¶
FindByAlias retrieves an account's Signer record by its alias
func (*Manager) IndexAccounts ¶
func (*Manager) NewControlAction ¶
func (*Manager) NewSpendAction ¶
func (*Manager) NewSpendUTXOAction ¶
func (*Manager) ProcessBlocks ¶
Click to show internal directories.
Click to hide internal directories.