types

package
v1.5.29 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 11 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 HeightUpdateKey

func HeightUpdateKey(addr types.AccAddress, height int64) []byte

func HeightsUpdateKey

func HeightsUpdateKey(addr types.AccAddress) []byte

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"`
}

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 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 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

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