Documentation
¶
Overview ¶
Package account manages the accounts in the network.
Index ¶
- Variables
- type Manager
- func (am *Manager) CreateAccount(putter db.Putter, accountID string, balance int64, signer string, ...) error
- func (am *Manager) CreateMasterAccount(networkID []byte, balance int64, seqNum uint64) error
- func (am *Manager) CreateTrust(putter db.Putter, accountID string, asset *ultpb.Asset, limit int64) error
- func (am *Manager) DeleteTrust(deleter db.Deleter, accountID string, asset *ultpb.Asset) error
- func (am *Manager) GetAccount(getter db.Getter, accountID string) (*ultpb.Account, error)
- func (am *Manager) GetBalance(acc *ultpb.Account) int64
- func (am *Manager) GetRestLimit(acc *ultpb.Account) int64
- func (am *Manager) GetTrust(getter db.Getter, accountID string, asset *ultpb.Asset) (*ultpb.Trust, error)
- func (am *Manager) GetTrustBalance(trust *ultpb.Trust) int64
- func (am *Manager) GetTrustRestLimit(trust *ultpb.Trust) int64
- func (am *Manager) SaveAccount(putter db.Putter, acc *ultpb.Account) error
- func (am *Manager) SaveTrust(putter db.Putter, trust *ultpb.Trust) error
- func (am *Manager) UpdateBalance(acc *ultpb.Account, balance int64) error
- func (am *Manager) UpdateEntryCount(acc *ultpb.Account, count int32) error
- func (am *Manager) UpdateLiability(acc *ultpb.Account, amount int64, buy bool) error
- func (am *Manager) UpdateTrustBalance(trust *ultpb.Trust, balance int64) error
- func (am *Manager) UpdateTrustLiability(trust *ultpb.Trust, amount int64, buy bool) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrBalanceOverflow = errors.New("account balance overflow") ErrBalanceUnderflow = errors.New("account balance underflow") ErrBalanceUnderfund = errors.New("account balance underfund") ErrTrustOverLimit = errors.New("trust balance over limit") ErrTrustUnderflow = errors.New("trust balance underflow") ErrInvalidUpdate = errors.New("account update invalid") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
Manager manages accounts and trusts.
func (*Manager) CreateAccount ¶
func (am *Manager) CreateAccount(putter db.Putter, accountID string, balance int64, signer string, seqNum uint64) error
Create a new account with initial balance. Note that this method simply save the account info in database and all the necessary validity checks should be done before invoking this method.
func (*Manager) CreateMasterAccount ¶
Create master account with native asset (ULT) and initial balances.
func (*Manager) CreateTrust ¶
func (am *Manager) CreateTrust(putter db.Putter, accountID string, asset *ultpb.Asset, limit int64) error
Create a new trust for issued asset.
func (*Manager) DeleteTrust ¶
Delete the trust.
func (*Manager) GetAccount ¶
Get account information.
func (*Manager) GetBalance ¶
Get the balance of the account.
func (*Manager) GetRestLimit ¶
Get the rest limit of native asset the account can have.
func (*Manager) GetTrust ¶
func (am *Manager) GetTrust(getter db.Getter, accountID string, asset *ultpb.Asset) (*ultpb.Trust, error)
Get trust information.
func (*Manager) GetTrustBalance ¶
Get available balance for trust.
func (*Manager) GetTrustRestLimit ¶
Get rest limit of custom asset the trust can have.
func (*Manager) SaveAccount ¶
Update account information.
func (*Manager) UpdateBalance ¶
Update account balance.
func (*Manager) UpdateEntryCount ¶
Update entry count.
func (*Manager) UpdateLiability ¶
Update account liability.
func (*Manager) UpdateTrustBalance ¶
Update trust balance.