Documentation ¶
Overview ¶
nolint
Index ¶
- Constants
- 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 ModuleInvariants(t *testing.T, app *mock.App, log string)
- func NewHandler(k Keeper) sdk.Handler
- func NonnegativeBalanceInvariant(t *testing.T, app *mock.App, log string)
- func RegisterWire(cdc *wire.Codec)
- func TestAndRunSingleInputMsgSend(t *testing.T, r *rand.Rand, app *mock.App, ctx sdk.Context, ...) (action string, err sdk.Error)
- func TotalCoinsInvariant(t *testing.T, app *mock.App, log string)
- type Input
- type Keeper
- func (keeper Keeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- func (keeper Keeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper Keeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- func (keeper Keeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
- func (keeper Keeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- func (keeper Keeper) SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.Error
- func (keeper Keeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)
- type MsgIssue
- type MsgSend
- type Output
- type SendKeeper
- func (keeper SendKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (keeper SendKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
- func (keeper SendKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
- func (keeper SendKeeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
- type ViewKeeper
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = 2 CodeInvalidInput sdk.CodeType = 101 CodeInvalidOutput sdk.CodeType = 102 )
Bank errors reserve 100 ~ 199.
Variables ¶
This section is empty.
Functions ¶
func ErrInvalidInput ¶ added in v0.2.0
func ErrInvalidInput(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidOutput ¶ added in v0.2.0
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 ModuleInvariants ¶ added in v0.20.0
ModuleInvariants runs all invariants of the bank module. Currently runs non-negative balance invariant and TotalCoinsInvariant
func NewHandler ¶
NewHandler returns a handler for "bank" type messages.
func NonnegativeBalanceInvariant ¶
NonnegativeBalanceInvariant checks that all accounts in the application have non-negative balances
func RegisterWire ¶ added in v0.2.0
Register concrete types on wire codec
func TestAndRunSingleInputMsgSend ¶ added in v0.20.0
func TestAndRunSingleInputMsgSend(t *testing.T, r *rand.Rand, app *mock.App, ctx sdk.Context, keys []crypto.PrivKey, log string) (action string, err sdk.Error)
TestAndRunSingleInputMsgSend tests and runs a single msg send, with one input and one output, where both accounts already exist.
Types ¶
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) GetSignBytes ¶ added in v0.19.0
Return bytes to sign for Input
func (Input) ValidateBasic ¶ added in v0.2.0
ValidateBasic - validate transaction input
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper manages transfers between accounts
func NewKeeper ¶ added in v0.16.0
func NewKeeper(am auth.AccountMapper) Keeper
NewKeeper returns a new Keeper
func (Keeper) AddCoins ¶ added in v0.16.0
func (keeper Keeper) 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 (Keeper) HasCoins ¶ added in v0.16.0
HasCoins returns whether or not an account has at least amt coins.
func (Keeper) InputOutputCoins ¶ added in v0.16.0
func (keeper Keeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
InputOutputCoins handles a list of inputs and outputs
func (Keeper) SendCoins ¶ added in v0.16.0
func (keeper Keeper) 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 MsgIssue ¶ added in v0.16.0
type MsgIssue struct { Banker sdk.AccAddress `json:"banker"` Outputs []Output `json:"outputs"` }
MsgIssue - high level transaction of the coin module
func NewMsgIssue ¶ added in v0.16.0
func NewMsgIssue(banker sdk.AccAddress, out []Output) MsgIssue
NewMsgIssue - construct arbitrary multi-in, multi-out send msg.
func (MsgIssue) GetSignBytes ¶ added in v0.16.0
Implements Msg.
func (MsgIssue) GetSigners ¶ added in v0.16.0
func (msg MsgIssue) GetSigners() []sdk.AccAddress
Implements Msg.
func (MsgIssue) ValidateBasic ¶ added in v0.16.0
Implements Msg.
type MsgSend ¶
MsgSend - high level transaction of the coin module
func NewMsgSend ¶
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) GetSignBytes ¶ added in v0.19.0
Return bytes to sign for Output
func (Output) ValidateBasic ¶ added in v0.2.0
ValidateBasic - validate transaction output
type SendKeeper ¶
type SendKeeper struct {
// contains filtered or unexported fields
}
SendKeeper only allows transfers between accounts, without the possibility of creating coins
func NewSendKeeper ¶ added in v0.16.0
func NewSendKeeper(am auth.AccountMapper) SendKeeper
NewSendKeeper returns a new Keeper
func (SendKeeper) GetCoins ¶ added in v0.16.0
func (keeper SendKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (SendKeeper) HasCoins ¶ added in v0.16.0
func (keeper SendKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
HasCoins returns whether or not an account has at least amt coins.
func (SendKeeper) InputOutputCoins ¶ added in v0.16.0
func (keeper SendKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (sdk.Tags, sdk.Error)
InputOutputCoins handles a list of inputs and outputs
func (SendKeeper) SendCoins ¶ added in v0.16.0
func (keeper SendKeeper) 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 ViewKeeper ¶
type ViewKeeper struct {
// contains filtered or unexported fields
}
ViewKeeper only allows reading of balances
func NewViewKeeper ¶ added in v0.16.0
func NewViewKeeper(am auth.AccountMapper) ViewKeeper
NewViewKeeper returns a new Keeper
func (ViewKeeper) GetCoins ¶ added in v0.16.0
func (keeper ViewKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetCoins returns the coins at the addr.
func (ViewKeeper) HasCoins ¶ added in v0.16.0
func (keeper ViewKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
HasCoins returns whether or not an account has at least amt coins.