Documentation ¶
Index ¶
- Variables
- type Account
- type AccountStore
- func (a *AccountStore) Close() error
- func (a *AccountStore) Credit(ctx context.Context, acctID []byte, amt *big.Int) error
- func (a *AccountStore) GetAccount(ctx context.Context, ident []byte) (*Account, error)
- func (a *AccountStore) Spend(ctx context.Context, spend *Spend) error
- func (a *AccountStore) Transfer(ctx context.Context, to, from []byte, amt *big.Int) error
- type AccountStoreOpts
- type CommitRegister
- type Datastore
- type Spend
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AccountStore ¶ added in v0.6.5
type AccountStore struct {
// contains filtered or unexported fields
}
func NewAccountStore ¶ added in v0.6.5
func NewAccountStore(ctx context.Context, datastore Datastore, committable CommitRegister, opts ...AccountStoreOpts) (*AccountStore, error)
func (*AccountStore) Close ¶ added in v0.6.5
func (a *AccountStore) Close() error
func (*AccountStore) Credit ¶ added in v0.6.5
Credit credits an account. If the account does not exist, it will be created.
func (*AccountStore) GetAccount ¶ added in v0.6.5
func (*AccountStore) Spend ¶ added in v0.6.5
func (a *AccountStore) Spend(ctx context.Context, spend *Spend) error
Spend spends an amount from an account. It blocks until the spend is written to the database.
func (*AccountStore) Transfer ¶ added in v0.6.5
Transfer sends an amount from the sender's balance to another account. The amount sent is given by the amount. This does not affect the sending account's nonce; a Spend should precede this to pay for required transaction gas and validate/advance the nonce.
type AccountStoreOpts ¶ added in v0.6.5
type AccountStoreOpts func(*AccountStore)
func WithGasCosts ¶ added in v0.6.5
func WithGasCosts(gas_enabled bool) AccountStoreOpts
func WithLogger ¶ added in v0.6.5
func WithLogger(logger log.Logger) AccountStoreOpts
func WithNonces ¶ added in v0.6.5
func WithNonces(nonces_enabled bool) AccountStoreOpts
type CommitRegister ¶ added in v0.6.5
type CommitRegister interface { // Skip returns true if the commit should be skipped. // This signals that the account store should not be updated, // and simply return nil. Skip() bool // Register registers a commit. // This should be called when data is written to the database. Register(value []byte) error }
CommitRegister is an interface for registering a commit.
Click to show internal directories.
Click to hide internal directories.