Documentation ¶
Index ¶
- Constants
- Variables
- func AddressFromBalancesStore(key []byte) sdk.AccAddress
- func ParamKeyTable() paramtypes.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func RegisterInterfaces(registry types.InterfaceRegistry)
- func ValidateInputsOutputs(inputs []Input, outputs []Output) error
- type AccountKeeper
- type Balance
- type GenesisBalancesIterator
- type GenesisState
- type Input
- func (*Input) Descriptor() ([]byte, []int)
- func (this *Input) Equal(that interface{}) bool
- func (m *Input) GetAddress() github_com_cosmos_cosmos_sdk_types.AccAddress
- func (m *Input) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins
- func (m *Input) Marshal() (dAtA []byte, err error)
- func (m *Input) MarshalTo(dAtA []byte) (int, error)
- func (m *Input) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Input) ProtoMessage()
- func (m *Input) Reset()
- func (m *Input) Size() (n int)
- func (m *Input) String() string
- func (m *Input) Unmarshal(dAtA []byte) error
- func (in Input) ValidateBasic() error
- func (m *Input) XXX_DiscardUnknown()
- func (m *Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Input) XXX_Merge(src proto.Message)
- func (m *Input) XXX_Size() int
- func (m *Input) XXX_Unmarshal(b []byte) error
- type MsgMultiSend
- func (*MsgMultiSend) Descriptor() ([]byte, []int)
- func (this *MsgMultiSend) Equal(that interface{}) bool
- func (m *MsgMultiSend) GetInputs() []Input
- func (m *MsgMultiSend) GetOutputs() []Output
- func (msg MsgMultiSend) GetSignBytes() []byte
- func (msg MsgMultiSend) GetSigners() []sdk.AccAddress
- func (m *MsgMultiSend) Marshal() (dAtA []byte, err error)
- func (m *MsgMultiSend) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgMultiSend) ProtoMessage()
- func (m *MsgMultiSend) Reset()
- func (msg MsgMultiSend) Route() string
- func (m *MsgMultiSend) Size() (n int)
- func (m *MsgMultiSend) String() string
- func (msg MsgMultiSend) Type() string
- func (m *MsgMultiSend) Unmarshal(dAtA []byte) error
- func (msg MsgMultiSend) ValidateBasic() error
- func (m *MsgMultiSend) XXX_DiscardUnknown()
- func (m *MsgMultiSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgMultiSend) XXX_Merge(src proto.Message)
- func (m *MsgMultiSend) XXX_Size() int
- func (m *MsgMultiSend) XXX_Unmarshal(b []byte) error
- type MsgSend
- func (*MsgSend) Descriptor() ([]byte, []int)
- func (this *MsgSend) Equal(that interface{}) bool
- func (m *MsgSend) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins
- func (m *MsgSend) GetFromAddress() github_com_cosmos_cosmos_sdk_types.AccAddress
- func (msg MsgSend) GetSignBytes() []byte
- func (msg MsgSend) GetSigners() []sdk.AccAddress
- func (m *MsgSend) GetToAddress() github_com_cosmos_cosmos_sdk_types.AccAddress
- func (m *MsgSend) Marshal() (dAtA []byte, err error)
- func (m *MsgSend) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgSend) ProtoMessage()
- func (m *MsgSend) Reset()
- func (msg MsgSend) Route() string
- func (m *MsgSend) Size() (n int)
- func (m *MsgSend) String() string
- func (msg MsgSend) Type() string
- func (m *MsgSend) Unmarshal(dAtA []byte) error
- func (msg MsgSend) ValidateBasic() error
- func (m *MsgSend) XXX_DiscardUnknown()
- func (m *MsgSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgSend) XXX_Merge(src proto.Message)
- func (m *MsgSend) XXX_Size() int
- func (m *MsgSend) XXX_Unmarshal(b []byte) error
- type Output
- func (*Output) Descriptor() ([]byte, []int)
- func (this *Output) Equal(that interface{}) bool
- func (m *Output) GetAddress() github_com_cosmos_cosmos_sdk_types.AccAddress
- func (m *Output) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins
- func (m *Output) Marshal() (dAtA []byte, err error)
- func (m *Output) MarshalTo(dAtA []byte) (int, error)
- func (m *Output) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Output) ProtoMessage()
- func (m *Output) Reset()
- func (m *Output) Size() (n int)
- func (m *Output) String() string
- func (m *Output) Unmarshal(dAtA []byte) error
- func (out Output) ValidateBasic() error
- func (m *Output) XXX_DiscardUnknown()
- func (m *Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Output) XXX_Merge(src proto.Message)
- func (m *Output) XXX_Size() int
- func (m *Output) XXX_Unmarshal(b []byte) error
- type QueryAllBalancesParams
- type QueryBalanceParams
- type QuerySupplyOfParams
- type QueryTotalSupplyParams
- type Supply
- func (supply *Supply) Deflate(amount sdk.Coins)
- func (*Supply) Descriptor() ([]byte, []int)
- func (this *Supply) Equal(that interface{}) bool
- func (supply Supply) GetTotal() sdk.Coins
- func (supply *Supply) Inflate(amount sdk.Coins)
- func (m *Supply) Marshal() (dAtA []byte, err error)
- func (m *Supply) MarshalTo(dAtA []byte) (int, error)
- func (m *Supply) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Supply) ProtoMessage()
- func (m *Supply) Reset()
- func (supply *Supply) SetTotal(total sdk.Coins)
- func (m *Supply) Size() (n int)
- func (supply Supply) String() string
- func (m *Supply) Unmarshal(dAtA []byte) error
- func (supply Supply) ValidateBasic() error
- func (m *Supply) XXX_DiscardUnknown()
- func (m *Supply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Supply) XXX_Merge(src proto.Message)
- func (m *Supply) XXX_Size() int
- func (m *Supply) XXX_Unmarshal(b []byte) error
Constants ¶
const ( EventTypeTransfer = "transfer" AttributeKeyRecipient = "recipient" AttributeKeySender = "sender" AttributeValueCategory = ModuleName )
bank module event types
const ( // ModuleName defines the module name ModuleName = "bank" // StoreKey defines the primary module store key StoreKey = ModuleName // RouterKey defines the module's message routing key RouterKey = ModuleName // QuerierRoute defines the module's query routing key QuerierRoute = ModuleName )
const ( // DefaultParamspace for params keeper DefaultParamspace = ModuleName // DefaultSendEnabled enabled DefaultSendEnabled = true )
const ( QueryBalance = "balance" QueryAllBalances = "all_balances" QueryTotalSupply = "total_supply" QuerySupplyOf = "supply_of" )
Querier path constants
Variables ¶
var ( ErrNoInputs = sdkerrors.Register(ModuleName, 2, "no inputs to send transaction") ErrNoOutputs = sdkerrors.Register(ModuleName, 3, "no outputs to send transaction") ErrInputOutputMismatch = sdkerrors.Register(ModuleName, 4, "sum inputs != sum outputs") ErrSendDisabled = sdkerrors.Register(ModuleName, 5, "send transactions are disabled") )
x/bank module sentinel errors
var ( BalancesPrefix = []byte("balances") SupplyKey = []byte{0x00} )
KVStore keys
var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") )
var ( // ModuleCdc references the global x/staking module codec. Note, the codec should // ONLY be used in certain instances of tests and for JSON encoding as Amino is // still used for that purpose. // // The actual codec used for serialization should be provided to x/staking and // defined at the application level. ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry()) )
var ParamStoreKeySendEnabled = []byte("sendenabled")
ParamStoreKeySendEnabled is store's key for SendEnabled
Functions ¶
func AddressFromBalancesStore ¶
func AddressFromBalancesStore(key []byte) sdk.AccAddress
AddressFromBalancesStore returns an account address from a balances prefix store. The key must not contain the perfix BalancesPrefix as the prefix store iterator discards the actual prefix.
func ParamKeyTable ¶
func ParamKeyTable() paramtypes.KeyTable
ParamKeyTable type declaration for parameters
func RegisterCodec ¶
RegisterCodec registers the necessary x/bank interfaces and concrete types on the provided Amino codec. These types are used for Amino JSON serialization.
func RegisterInterfaces ¶
func RegisterInterfaces(registry types.InterfaceRegistry)
func ValidateInputsOutputs ¶
ValidateInputsOutputs validates that each respective input and output is valid and that the sum of inputs is equal to the sum of outputs.
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { NewAccount(sdk.Context, exported.Account) exported.Account NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) exported.Account GetAccount(ctx sdk.Context, addr sdk.AccAddress) exported.Account GetAllAccounts(ctx sdk.Context) []exported.Account SetAccount(ctx sdk.Context, acc exported.Account) IterateAccounts(ctx sdk.Context, process func(exported.Account) bool) ValidatePermissions(macc exported.ModuleAccountI) error GetModuleAddress(moduleName string) sdk.AccAddress GetModuleAddressAndPermissions(moduleName string) (addr sdk.AccAddress, permissions []string) GetModuleAccountAndPermissions(ctx sdk.Context, moduleName string) (exported.ModuleAccountI, []string) GetModuleAccount(ctx sdk.Context, moduleName string) exported.ModuleAccountI SetModuleAccount(ctx sdk.Context, macc exported.ModuleAccountI) }
AccountKeeper defines the account contract that must be fulfilled when creating a x/bank keeper.
type Balance ¶
type Balance struct { Address sdk.AccAddress `json:"address" yaml:"address"` Coins sdk.Coins `json:"coins" yaml:"coins"` }
Balance defines an account address and balance pair used in the bank module's genesis state.
func SanitizeGenesisBalances ¶
SanitizeGenesisAccounts sorts addresses and coin sets.
func (Balance) GetAddress ¶
func (b Balance) GetAddress() sdk.AccAddress
GetAddress returns the account address of the Balance object.
type GenesisBalancesIterator ¶
type GenesisBalancesIterator struct{}
GenesisAccountIterator implements genesis account iteration.
func (GenesisBalancesIterator) IterateGenesisBalances ¶
func (GenesisBalancesIterator) IterateGenesisBalances( cdc *codec.Codec, appState map[string]json.RawMessage, cb func(exported.GenesisBalance) (stop bool), )
IterateGenesisAccounts iterates over all the genesis accounts found in appGenesis and invokes a callback on each genesis account. If any call returns true, iteration stops.
type GenesisState ¶
type GenesisState struct { SendEnabled bool `json:"send_enabled" yaml:"send_enabled"` Balances []Balance `json:"balances" yaml:"balances"` Supply sdk.Coins `json:"supply" yaml:"supply"` }
GenesisState defines the bank module's genesis state.
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default bank module genesis state.
func GetGenesisStateFromAppState ¶
func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawMessage) GenesisState
GetGenesisStateFromAppState returns x/bank GenesisState given raw application genesis state.
func NewGenesisState ¶
func NewGenesisState(sendEnabled bool, balances []Balance, supply sdk.Coins) GenesisState
NewGenesisState creates a new genesis state.
type Input ¶
type Input struct { Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` }
Input models transaction input
func NewInput ¶
func NewInput(addr sdk.AccAddress, coins sdk.Coins) Input
NewInput - create a transaction input, used with MsgMultiSend
func (*Input) Descriptor ¶
func (*Input) GetAddress ¶
func (m *Input) GetAddress() github_com_cosmos_cosmos_sdk_types.AccAddress
func (*Input) GetCoins ¶
func (m *Input) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins
func (*Input) ProtoMessage ¶
func (*Input) ProtoMessage()
func (Input) ValidateBasic ¶
ValidateBasic - validate transaction input
func (*Input) XXX_DiscardUnknown ¶
func (m *Input) XXX_DiscardUnknown()
func (*Input) XXX_Marshal ¶
func (*Input) XXX_Unmarshal ¶
type MsgMultiSend ¶
type MsgMultiSend struct { Inputs []Input `protobuf:"bytes,1,rep,name=inputs,proto3" json:"inputs"` Outputs []Output `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs"` }
MsgMultiSend - high level transaction of the coin module
func NewMsgMultiSend ¶
func NewMsgMultiSend(in []Input, out []Output) MsgMultiSend
NewMsgMultiSend - construct arbitrary multi-in, multi-out send msg.
func (*MsgMultiSend) Descriptor ¶
func (*MsgMultiSend) Descriptor() ([]byte, []int)
func (*MsgMultiSend) Equal ¶
func (this *MsgMultiSend) Equal(that interface{}) bool
func (*MsgMultiSend) GetInputs ¶
func (m *MsgMultiSend) GetInputs() []Input
func (*MsgMultiSend) GetOutputs ¶
func (m *MsgMultiSend) GetOutputs() []Output
func (MsgMultiSend) GetSignBytes ¶
func (msg MsgMultiSend) GetSignBytes() []byte
GetSignBytes Implements Msg.
func (MsgMultiSend) GetSigners ¶
func (msg MsgMultiSend) GetSigners() []sdk.AccAddress
GetSigners Implements Msg.
func (*MsgMultiSend) Marshal ¶
func (m *MsgMultiSend) Marshal() (dAtA []byte, err error)
func (*MsgMultiSend) MarshalToSizedBuffer ¶
func (m *MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgMultiSend) ProtoMessage ¶
func (*MsgMultiSend) ProtoMessage()
func (*MsgMultiSend) Reset ¶
func (m *MsgMultiSend) Reset()
func (*MsgMultiSend) Size ¶
func (m *MsgMultiSend) Size() (n int)
func (*MsgMultiSend) String ¶
func (m *MsgMultiSend) String() string
func (*MsgMultiSend) Unmarshal ¶
func (m *MsgMultiSend) Unmarshal(dAtA []byte) error
func (MsgMultiSend) ValidateBasic ¶
func (msg MsgMultiSend) ValidateBasic() error
ValidateBasic Implements Msg.
func (*MsgMultiSend) XXX_DiscardUnknown ¶
func (m *MsgMultiSend) XXX_DiscardUnknown()
func (*MsgMultiSend) XXX_Marshal ¶
func (m *MsgMultiSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgMultiSend) XXX_Merge ¶
func (m *MsgMultiSend) XXX_Merge(src proto.Message)
func (*MsgMultiSend) XXX_Size ¶
func (m *MsgMultiSend) XXX_Size() int
func (*MsgMultiSend) XXX_Unmarshal ¶
func (m *MsgMultiSend) XXX_Unmarshal(b []byte) error
type MsgSend ¶
type MsgSend struct { FromAddress github_com_cosmos_cosmos_sdk_types.AccAddress `` /* 169-byte string literal not displayed */ ToAddress github_com_cosmos_cosmos_sdk_types.AccAddress `` /* 161-byte string literal not displayed */ Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` }
MsgSend - high level transaction of the coin module
func NewMsgSend ¶
func NewMsgSend(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) MsgSend
NewMsgSend - construct arbitrary multi-in, multi-out send msg.
func (*MsgSend) Descriptor ¶
func (*MsgSend) GetAmount ¶
func (m *MsgSend) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins
func (*MsgSend) GetFromAddress ¶
func (m *MsgSend) GetFromAddress() github_com_cosmos_cosmos_sdk_types.AccAddress
func (MsgSend) GetSigners ¶
func (msg MsgSend) GetSigners() []sdk.AccAddress
GetSigners Implements Msg.
func (*MsgSend) GetToAddress ¶
func (m *MsgSend) GetToAddress() github_com_cosmos_cosmos_sdk_types.AccAddress
func (*MsgSend) MarshalToSizedBuffer ¶
func (*MsgSend) ProtoMessage ¶
func (*MsgSend) ProtoMessage()
func (MsgSend) ValidateBasic ¶
ValidateBasic Implements Msg.
func (*MsgSend) XXX_DiscardUnknown ¶
func (m *MsgSend) XXX_DiscardUnknown()
func (*MsgSend) XXX_Marshal ¶
func (*MsgSend) XXX_Unmarshal ¶
type Output ¶
type Output struct { Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` }
Output models transaction outputs
func NewOutput ¶
func NewOutput(addr sdk.AccAddress, coins sdk.Coins) Output
NewOutput - create a transaction output, used with MsgMultiSend
func (*Output) Descriptor ¶
func (*Output) GetAddress ¶
func (m *Output) GetAddress() github_com_cosmos_cosmos_sdk_types.AccAddress
func (*Output) GetCoins ¶
func (m *Output) GetCoins() github_com_cosmos_cosmos_sdk_types.Coins
func (*Output) MarshalToSizedBuffer ¶
func (*Output) ProtoMessage ¶
func (*Output) ProtoMessage()
func (Output) ValidateBasic ¶
ValidateBasic - validate transaction output
func (*Output) XXX_DiscardUnknown ¶
func (m *Output) XXX_DiscardUnknown()
func (*Output) XXX_Marshal ¶
func (*Output) XXX_Unmarshal ¶
type QueryAllBalancesParams ¶
type QueryAllBalancesParams struct {
Address sdk.AccAddress
}
QueryAllBalancesParams defines the params for querying all account balances
func NewQueryAllBalancesParams ¶
func NewQueryAllBalancesParams(addr sdk.AccAddress) QueryAllBalancesParams
NewQueryAllBalancesParams creates a new instance of QueryAllBalancesParams.
type QueryBalanceParams ¶
type QueryBalanceParams struct { Address sdk.AccAddress Denom string }
QueryBalanceParams defines the params for querying an account balance.
func NewQueryBalanceParams ¶
func NewQueryBalanceParams(addr sdk.AccAddress, denom string) QueryBalanceParams
NewQueryBalanceParams creates a new instance of QueryBalanceParams.
type QuerySupplyOfParams ¶
type QuerySupplyOfParams struct {
Denom string
}
QuerySupplyOfParams defines the params for the following queries:
- 'custom/bank/totalSupplyOf'
func NewQuerySupplyOfParams ¶
func NewQuerySupplyOfParams(denom string) QuerySupplyOfParams
NewQuerySupplyOfParams creates a new instance to query the total supply of a given denomination
type QueryTotalSupplyParams ¶
type QueryTotalSupplyParams struct {
Page, Limit int
}
QueryTotalSupply defines the params for the following queries:
- 'custom/bank/totalSupply'
func NewQueryTotalSupplyParams ¶
func NewQueryTotalSupplyParams(page, limit int) QueryTotalSupplyParams
NewQueryTotalSupplyParams creates a new instance to query the total supply
type Supply ¶
type Supply struct {
Total github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=total,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total"`
}
Supply represents a struct that passively keeps track of the total supply amounts in the network.
func (*Supply) Descriptor ¶
func (*Supply) MarshalToSizedBuffer ¶
func (*Supply) ProtoMessage ¶
func (*Supply) ProtoMessage()
func (Supply) ValidateBasic ¶
ValidateBasic validates the Supply coins and returns error if invalid
func (*Supply) XXX_DiscardUnknown ¶
func (m *Supply) XXX_DiscardUnknown()