Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- Variables
- func ErrInvalidInput(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidOutput(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrNoInputs(codespace sdk.CodespaceType) sdk.Error
- func ErrNoOutputs(codespace sdk.CodespaceType) sdk.Error
- func NewHandler(k Keeper) sdk.Handler
- func RegisterCodec(cdc *codec.Codec)
- func ValidateInputsOutputs(inputs []Input, outputs []Output) sdk.Error
- type BaseKeeper
- func (keeper BaseKeeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) DelegateCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.Error
- func (keeper BaseKeeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- func (keeper BaseKeeper) UndelegateCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- type BaseSendKeeper
- type BaseViewKeeper
- type Input
- type Keeper
- type MsgSend
- type Output
- type SendKeeper
- type ViewKeeper
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = "bank" CodeInvalidInput sdk.CodeType = 101 CodeInvalidOutput sdk.CodeType = 102 )
Bank errors reserve 100 ~ 199.
const RouterKey = "bank"
name to identify transaction routes
Variables ¶
var ( TagActionUndelegateCoins = []byte("undelegateCoins") TagActionDelegateCoins = []byte("delegateCoins") TagKeyRecipient = "recipient" TagKeySender = "sender" )
Tag keys and values
Functions ¶
func ErrInvalidInput ¶
func ErrInvalidInput(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidOutput ¶
func ErrInvalidOutput(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrNoInputs ¶
func ErrNoInputs(codespace sdk.CodespaceType) sdk.Error
func ErrNoOutputs ¶
func ErrNoOutputs(codespace sdk.CodespaceType) sdk.Error
func NewHandler ¶
NewHandler returns a handler for "bank" type messages.
func RegisterCodec ¶ added in v0.25.0
Register concrete types on codec codec
Types ¶
type BaseKeeper ¶ added in v0.25.0
type BaseKeeper struct { BaseSendKeeper // contains filtered or unexported fields }
BaseKeeper manages transfers between accounts. It implements the Keeper interface.
func NewBaseKeeper ¶ added in v0.25.0
func NewBaseKeeper(ak auth.AccountKeeper) BaseKeeper
NewBaseKeeper returns a new BaseKeeper
func (BaseKeeper) AddCoins ¶ added in v0.25.0
func (keeper BaseKeeper) AddCoins( ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins, ) (sdk.Coins, sdk.Tags, sdk.Error)
AddCoins adds amt to the coins at the addr.
func (BaseKeeper) DelegateCoins ¶ added in v0.30.0
func (keeper BaseKeeper) DelegateCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
DelegateCoins performs delegation by deducting amt coins from an account with address addr. For vesting accounts, delegations amounts are tracked for both vesting and vested coins.
func (BaseKeeper) InputOutputCoins ¶ added in v0.25.0
func (keeper BaseKeeper) InputOutputCoins( ctx sdk.Context, inputs []Input, outputs []Output, ) (sdk.Tags, sdk.Error)
InputOutputCoins handles a list of inputs and outputs
func (BaseKeeper) SetCoins ¶ added in v0.25.0
func (keeper BaseKeeper) SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.Error
SetCoins sets the coins at the addr.
func (BaseKeeper) SubtractCoins ¶ added in v0.25.0
func (keeper BaseKeeper) SubtractCoins( ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins, ) (sdk.Coins, sdk.Tags, sdk.Error)
SubtractCoins subtracts amt from the coins at the addr.
func (BaseKeeper) UndelegateCoins ¶ added in v0.30.0
func (keeper BaseKeeper) UndelegateCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
UndelegateCoins performs undelegation by crediting amt coins to an account with address addr. For vesting accounts, undelegation amounts are tracked for both vesting and vested coins.
type BaseSendKeeper ¶ added in v0.25.0
type BaseSendKeeper struct { BaseViewKeeper // contains filtered or unexported fields }
SendKeeper only allows transfers between accounts without the possibility of creating coins. It implements the SendKeeper interface.
func NewBaseSendKeeper ¶ added in v0.25.0
func NewBaseSendKeeper(ak auth.AccountKeeper) BaseSendKeeper
NewBaseSendKeeper returns a new BaseSendKeeper.
func (BaseSendKeeper) SendCoins ¶ added in v0.25.0
func (keeper BaseSendKeeper) SendCoins( ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins, ) (sdk.Tags, sdk.Error)
SendCoins moves coins from one account to another
type BaseViewKeeper ¶ added in v0.25.0
type BaseViewKeeper struct {
// contains filtered or unexported fields
}
BaseViewKeeper implements a read only keeper implementation of ViewKeeper.
func NewBaseViewKeeper ¶ added in v0.25.0
func NewBaseViewKeeper(ak auth.AccountKeeper) BaseViewKeeper
NewBaseViewKeeper returns a new BaseViewKeeper.
func (BaseViewKeeper) GetCoins ¶ added in v0.25.0
func (keeper BaseViewKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (BaseViewKeeper) HasCoins ¶ added in v0.25.0
func (keeper BaseViewKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
HasCoins returns whether or not an account has at least amt coins.
type Input ¶
type Input struct { Address sdk.AccAddress `json:"address"` Coins sdk.Coins `json:"coins"` }
Transaction Input
func NewInput ¶
func NewInput(addr sdk.AccAddress, coins sdk.Coins) Input
NewInput - create a transaction input, used with MsgSend
func (Input) ValidateBasic ¶
ValidateBasic - validate transaction input
type Keeper ¶ added in v0.16.0
type Keeper interface { SendKeeper SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.Error SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error) DelegateCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error) UndelegateCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error) }
Keeper defines a module interface that facilitates the transfer of coins between accounts.
type MsgSend ¶ added in v0.16.0
MsgSend - high level transaction of the coin module
func NewMsgSend ¶ added in v0.16.0
NewMsgSend - construct arbitrary multi-in, multi-out send msg.
func (MsgSend) GetSignBytes ¶ added in v0.16.0
Implements Msg.
func (MsgSend) GetSigners ¶ added in v0.16.0
func (msg MsgSend) GetSigners() []sdk.AccAddress
Implements Msg.
func (MsgSend) ValidateBasic ¶ added in v0.16.0
Implements Msg.
type Output ¶
type Output struct { Address sdk.AccAddress `json:"address"` Coins sdk.Coins `json:"coins"` }
Transaction Output
func NewOutput ¶
func NewOutput(addr sdk.AccAddress, coins sdk.Coins) Output
NewOutput - create a transaction output, used with MsgSend
func (Output) ValidateBasic ¶
ValidateBasic - validate transaction output
type SendKeeper ¶ added in v0.16.0
type SendKeeper interface { ViewKeeper SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error) }
SendKeeper defines a module interface that facilitates the transfer of coins between accounts without the possibility of creating coins.
type ViewKeeper ¶ added in v0.16.0
type ViewKeeper interface { GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool }
ViewKeeper defines a module interface that facilitates read only access to account balances.