types

package
v1.5.70 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvmContractType  string = "evm"
	WasmContractType string = "wasm"
)
View Source
const ModuleName = "accounts"
View Source
const QueryAccount = "queryAccount"
View Source
const QueryAccountNonce = "queryAccountNonce"
View Source
const RouteKey = "accounts"
View Source
const StoreKey = "accounts"

Variables

View Source
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")
)
View Source
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"
)
View Source
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 ProtoBaseAccount

func ProtoBaseAccount() exported.Account

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

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"`
	IsModule      bool             `json:"is_module"`
}

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 NewBaseAccountFromExportAccount added in v1.5.53

func NewBaseAccountFromExportAccount(exportAcc exported.Account) *BaseAccount

func NewBaseAccountWithAddress

func NewBaseAccountWithAddress(addr types.AccAddress) BaseAccount

NewBaseAccountWithAddress - returns a new base account with a given address

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) GetCodeHash added in v1.5.53

func (acc *BaseAccount) GetCodeHash() []byte

func (*BaseAccount) GetCoins

func (acc *BaseAccount) GetCoins() types.Coins

GetCoins - Implements sdk.Account.

func (*BaseAccount) GetContractType

func (acc *BaseAccount) GetContractType() string

func (*BaseAccount) GetIsModule added in v1.5.53

func (acc *BaseAccount) GetIsModule() bool

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) SetCodeHash added in v1.5.53

func (acc *BaseAccount) SetCodeHash(bz []byte)

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) SetIsModule added in v1.5.53

func (acc *BaseAccount) SetIsModule(flag bool) 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 CodeType

type CodeType = sdk.CodeType
const (
	DefaultCodespace sdk.CodespaceType = "accounts"

	CodeAccountNotExisted  CodeType = 1101
	CodeInsufficientFunds  CodeType = 1102
	CodeInvalidParam       CodeType = 1103
	CodeInvalidEndPoint    CodeType = 1104
	CodeCdcMarshalFailed   CodeType = 1105
	CodeCdcUnmarshalFailed CodeType = 1106
)

type GenesisAccounts

type GenesisAccounts []exported.Account

GenesisAccounts defines a set of genesis account

func (GenesisAccounts) Contains

func (gaccs GenesisAccounts) Contains(acc types.AccAddress) bool

type GenesisState

type GenesisState GenesisAccounts

func NewGenesisState added in v1.5.23

func NewGenesisState(accounts GenesisAccounts) GenesisState

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL