Documentation ¶
Index ¶
- Constants
- Variables
- func AddressStoreKey(addr types.AccAddress) []byte
- func HeightUpdateKey(addr types.AccAddress, height int64) []byte
- func HeightsUpdateKey(addr types.AccAddress) []byte
- func ProtoBaseAccount() exported.Account
- func RegisterCodec(cdc *codec.Codec)
- func SetGenesisStateInAppState(cdc *codec.Codec, appState map[string]json.RawMessage, ...) map[string]json.RawMessage
- type BaseAccount
- func (acc *BaseAccount) Balance(denom string) types.Int
- func (acc *BaseAccount) EthAddress() ethcmn.Address
- func (acc *BaseAccount) GetAccountNumber() uint64
- func (acc *BaseAccount) GetAddress() types.AccAddress
- func (acc *BaseAccount) GetCoins() types.Coins
- func (acc *BaseAccount) GetContractType() string
- func (acc *BaseAccount) GetPubKey() crypto.PubKey
- func (acc *BaseAccount) GetSequence() uint64
- func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error
- func (acc *BaseAccount) SetAddress(addr types.AccAddress) error
- func (acc *BaseAccount) SetBalance(denom string, amt types.Int)
- func (acc *BaseAccount) SetCoins(coin types.Coins) error
- func (acc *BaseAccount) SetContractType(contractType string) error
- func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error
- func (acc *BaseAccount) SetSequence(seq uint64) error
- func (acc *BaseAccount) SpendableCoins(_ time.Time) types.Coins
- func (acc *BaseAccount) String() string
- type CodeType
- type GenesisAccount
- type GenesisAccounts
- type GenesisState
Constants ¶
const ( EvmContractType string = "evm" WasmContractType string = "wasm" )
const ModuleName = "accounts"
const QueryAccount = "queryAccount"
const QueryAccountNonce = "queryAccountNonce"
const RouteKey = "accounts"
const StoreKey = "accounts"
Variables ¶
var ( ErrAccountNotExisted = sdkerrors.Register(string(DefaultCodespace), uint32(CodeAccountNotExisted), "account not exist") ErrInsufficientFunds = sdkerrors.Register(string(DefaultCodespace), uint32(CodeInsufficientFunds), "insufficient funds") ErrInvalidParam = sdkerrors.Register(string(DefaultCodespace), uint32(CodeInvalidParam), "invalid params") ErrInvalidEndPoint = sdkerrors.Register(string(DefaultCodespace), uint32(CodeInvalidEndPoint), "invalid endpoint") ErrCdcMarshalFailed = sdkerrors.Register(string(DefaultCodespace), uint32(CodeCdcMarshalFailed), "cdc marshal failed") ErrCdcUnmarshalFailed = sdkerrors.Register(string(DefaultCodespace), uint32(CodeCdcUnmarshalFailed), "cdc unmarshal failed") )
var ( // AddressStoreKeyPrefix prefix for account-by-address store AddressStoreKeyPrefix = []byte{0x01} HeightUpdateKeyPrefix = []byte{0x02} HeightsUpdateKeyPrefix = []byte{0x03} GlobalAccountNumberKey = []byte("globalAccountNumber") BalancesPrefix = []byte("balances") EventTypeTransfer = "transfer" AttributeKeyRecipient = "recipient" AttributeKeySender = "sender" )
var ModuleCdc *codec.Codec
Functions ¶
func AddressStoreKey ¶
func AddressStoreKey(addr types.AccAddress) []byte
AddressStoreKey turn an address to types used to get it from the account store
func HeightUpdateKey ¶
func HeightUpdateKey(addr types.AccAddress, height int64) []byte
func HeightsUpdateKey ¶
func HeightsUpdateKey(addr types.AccAddress) []byte
func ProtoBaseAccount ¶
func RegisterCodec ¶
func SetGenesisStateInAppState ¶
func SetGenesisStateInAppState(cdc *codec.Codec, appState map[string]json.RawMessage, genesisState GenesisState) map[string]json.RawMessage
Types ¶
type BaseAccount ¶
type BaseAccount struct { Address types.AccAddress `json:"address" yaml:"address"` Coins types.Coins `json:"coins" yaml:"coins"` Sequence uint64 `json:"sequence_number" yaml:"sequence_number"` AccountNumber uint64 `json:"account_number" yaml:"account_number"` PubKey crypto.PubKey `json:"pub_key" yaml:"pub_key"` ContractList []string `json:"contract_list" yaml:"contract_list"` ContractType string `json:"contract_type" yaml:"contract_type"` CodeHash []byte `json:"code_hash" yaml:"code_hash"` }
func NewBaseAccount ¶
func NewBaseAccount(address types.AccAddress, coin types.Coins, pubKey crypto.PubKey, accountNumber uint64, sequence uint64) *BaseAccount
NewBaseAccount creates a new BaseAccount object
func NewBaseAccountWithAddress ¶
func NewBaseAccountWithAddress(addr types.AccAddress) BaseAccount
NewBaseAccountWithAddress - returns a new base account with a given address
func (*BaseAccount) Balance ¶
func (acc *BaseAccount) Balance(denom string) types.Int
Balance returns the balance of an account.
func (*BaseAccount) EthAddress ¶
func (acc *BaseAccount) EthAddress() ethcmn.Address
EthAddress returns the account address ethereum format.
func (*BaseAccount) GetAccountNumber ¶
func (acc *BaseAccount) GetAccountNumber() uint64
GetAccountNumber - Implements Account
func (*BaseAccount) GetAddress ¶
func (acc *BaseAccount) GetAddress() types.AccAddress
GetAddress - Implements sdk.Account.
func (*BaseAccount) GetCoins ¶
func (acc *BaseAccount) GetCoins() types.Coins
GetCoins - Implements sdk.Account.
func (*BaseAccount) GetContractType ¶
func (acc *BaseAccount) GetContractType() string
func (*BaseAccount) GetPubKey ¶
func (acc *BaseAccount) GetPubKey() crypto.PubKey
GetPubKey - Implements sdk.Account.
func (*BaseAccount) GetSequence ¶
func (acc *BaseAccount) GetSequence() uint64
GetSequence - Implements sdk.Account.
func (*BaseAccount) SetAccountNumber ¶
func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error
SetAccountNumber - Implements Account
func (*BaseAccount) SetAddress ¶
func (acc *BaseAccount) SetAddress(addr types.AccAddress) error
SetAddress - Implements sdk.Account.
func (*BaseAccount) SetBalance ¶
func (acc *BaseAccount) SetBalance(denom string, amt types.Int)
SetBalance sets an account's balance of the given coin denomination.
CONTRACT: assumes the denomination is valid.
func (*BaseAccount) SetCoins ¶
func (acc *BaseAccount) SetCoins(coin types.Coins) error
SetCoins - Implements sdk.Account.
func (*BaseAccount) SetContractType ¶
func (acc *BaseAccount) SetContractType(contractType string) error
func (*BaseAccount) SetPubKey ¶
func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error
SetPubKey - Implements sdk.Account.
func (*BaseAccount) SetSequence ¶
func (acc *BaseAccount) SetSequence(seq uint64) error
SetSequence - Implements sdk.Account.
func (*BaseAccount) SpendableCoins ¶
func (acc *BaseAccount) SpendableCoins(_ time.Time) types.Coins
SpendableCoins returns the total set of spendable coins. For a base account, this is simply the base coins.
func (*BaseAccount) String ¶
func (acc *BaseAccount) String() string
type GenesisAccount ¶
type GenesisAccount struct { Address types.AccAddress `json:"address" yaml:"address"` Coins types.Coins `json:"coins" yaml:"coins"` Sequence uint64 `json:"sequence_number" yaml:"sequence_number"` AccountNumber uint64 `json:"account_number" yaml:"account_number"` }
GenesisAccount is a struct for account initialization used exclusively during genesis
func NewGenesisAccountRaw ¶
func NewGenesisAccountRaw(address types.AccAddress, coin types.Coins) GenesisAccount
func (GenesisAccount) ToAccount ¶
func (ga GenesisAccount) ToAccount() exported.Account
func (GenesisAccount) Validate ¶
func (ga GenesisAccount) Validate() error
type GenesisAccounts ¶
type GenesisAccounts []GenesisAccount
GenesisAccounts defines a set of genesis account
func (GenesisAccounts) Contains ¶
func (gaccs GenesisAccounts) Contains(acc types.AccAddress) bool
type GenesisState ¶
type GenesisState GenesisAccounts