Documentation ¶
Index ¶
- Constants
- func AddressStoreKey(addr types.AccAddress) []byte
- func BuildAccountStoreQueryPath() []byte
- func RegisterCodec(cdc *go_amino.Codec)
- type Account
- type AccountMapper
- func (mapper *AccountMapper) Copy() mapper.IMapper
- func (mapper *AccountMapper) GetAccount(addr types.AccAddress) (acc Account)
- func (mapper *AccountMapper) GetNonce(addr types.AccAddress) (int64, types.Error)
- func (mapper *AccountMapper) GetPubKey(addr types.AccAddress) (crypto.PubKey, types.Error)
- func (mapper *AccountMapper) IterateAccounts(process func(Account) (stop bool))
- func (mapper *AccountMapper) NewAccountWithAddress(add types.AccAddress) Account
- func (mapper *AccountMapper) SetAccount(acc Account)
- func (mapper *AccountMapper) SetNonce(addr types.AccAddress, nonce int64) types.Error
- type BaseAccount
- func (accnt *BaseAccount) GetAddress() types.AccAddress
- func (accnt *BaseAccount) GetNonce() int64
- func (accnt *BaseAccount) GetPublicKey() crypto.PubKey
- func (accnt *BaseAccount) MarshalJSON() ([]byte, error)
- func (accnt *BaseAccount) SetAddress(addr types.AccAddress) error
- func (accnt *BaseAccount) SetNonce(nonce int64) error
- func (accnt *BaseAccount) SetPublicKey(pubKey crypto.PubKey) error
- func (accnt *BaseAccount) UnmarshalJSON(data []byte) error
Constants ¶
View Source
const (
AccountMapperName = "acc" // 用户获取账户存储的store的键名
)
Variables ¶
This section is empty.
Functions ¶
func BuildAccountStoreQueryPath ¶ added in v0.0.4
func BuildAccountStoreQueryPath() []byte
Types ¶
type Account ¶
type Account interface { GetAddress() types.AccAddress SetAddress(addr types.AccAddress) error GetPublicKey() crypto.PubKey SetPublicKey(pubKey crypto.PubKey) error GetNonce() int64 SetNonce(nonce int64) error }
func ProtoBaseAccount ¶
func ProtoBaseAccount() Account
type AccountMapper ¶
type AccountMapper struct { *mapper.BaseMapper // contains filtered or unexported fields }
对BaseAccount存储操作进行包装的结构,可进行序列化
func NewAccountMapper ¶
func NewAccountMapper(cdc *go_amino.Codec, proto func() Account) *AccountMapper
用给定编码和原型生成mapper
func (*AccountMapper) Copy ¶
func (mapper *AccountMapper) Copy() mapper.IMapper
func (*AccountMapper) GetAccount ¶
func (mapper *AccountMapper) GetAccount(addr types.AccAddress) (acc Account)
从存储中获得账户
func (*AccountMapper) GetNonce ¶
func (mapper *AccountMapper) GetNonce(addr types.AccAddress) (int64, types.Error)
获取地址代表账户的nonce
func (*AccountMapper) GetPubKey ¶
func (mapper *AccountMapper) GetPubKey(addr types.AccAddress) (crypto.PubKey, types.Error)
获取地址代表账户的公钥
func (*AccountMapper) IterateAccounts ¶
func (mapper *AccountMapper) IterateAccounts(process func(Account) (stop bool))
遍历并用闭包批量处理所存储的全部账户
func (*AccountMapper) NewAccountWithAddress ¶
func (mapper *AccountMapper) NewAccountWithAddress(add types.AccAddress) Account
用指定地址生成账户返回
func (*AccountMapper) SetNonce ¶
func (mapper *AccountMapper) SetNonce(addr types.AccAddress, nonce int64) types.Error
为特定账户设置新的nonce值
type BaseAccount ¶
type BaseAccount struct { AccountAddress types.AccAddress `json:"account_address"` // account address Publickey crypto.PubKey `json:"public_key"` // public key Nonce int64 `json:"nonce"` // identifies tx_status of an account }
func (*BaseAccount) GetAddress ¶
func (accnt *BaseAccount) GetAddress() types.AccAddress
getter for account address
func (*BaseAccount) GetPublicKey ¶ added in v0.2.4
func (accnt *BaseAccount) GetPublicKey() crypto.PubKey
getter for public key
func (*BaseAccount) MarshalJSON ¶ added in v0.2.4
func (accnt *BaseAccount) MarshalJSON() ([]byte, error)
func (*BaseAccount) SetAddress ¶
func (accnt *BaseAccount) SetAddress(addr types.AccAddress) error
setter for account address
func (*BaseAccount) SetNonce ¶
func (accnt *BaseAccount) SetNonce(nonce int64) error
setter for nonce
func (*BaseAccount) SetPublicKey ¶
func (accnt *BaseAccount) SetPublicKey(pubKey crypto.PubKey) error
setter for public key
func (*BaseAccount) UnmarshalJSON ¶ added in v0.2.4
func (accnt *BaseAccount) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.