Documentation ¶
Index ¶
- Constants
- Variables
- func ErrInputOutputMismatch() error
- func ErrNoInputs() error
- func ErrNoOutputs() error
- func NewHandler(bank BankKeeper) bankHandler
- func NonnegativeBalanceInvariant(acck auth.AccountKeeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, acck auth.AccountKeeper)
- func ValidateInputsOutputs(inputs []Input, outputs []Output) error
- type BankKeeper
- func (bank BankKeeper) AddCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error)
- func (bank BankKeeper) InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) error
- func (bank BankKeeper) SendCoins(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error
- func (bank BankKeeper) SetCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) error
- func (bank BankKeeper) SubtractCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error)
- type BankKeeperI
- type Input
- type InputOutputMismatchError
- type MsgMultiSend
- type MsgSend
- type NoInputsError
- type NoOutputsError
- type Output
- type ViewKeeper
- type ViewKeeperI
Constants ¶
const (
ModuleName = "bank"
)
const QueryBalance = "balances"
query balance path
const RouterKey = ModuleName
RouterKey is they name of the bank module
Variables ¶
var Package = amino.RegisterPackage(amino.NewPackage( "github.com/gnolang/gno/tm2/pkg/sdk/bank", "bank", amino.GetCallersDirname(), ).WithDependencies().WithTypes( NoInputsError{}, "NoInputsError", NoOutputsError{}, "NoOutputsError", InputOutputMismatchError{}, "InputOutputMismatchError", MsgSend{}, "MsgSend", ))
Functions ¶
func ErrInputOutputMismatch ¶
func ErrInputOutputMismatch() error
func ErrNoInputs ¶
func ErrNoInputs() error
func ErrNoOutputs ¶
func ErrNoOutputs() error
func NewHandler ¶
func NewHandler(bank BankKeeper) bankHandler
NewHandler returns a handler for "bank" type messages.
func NonnegativeBalanceInvariant ¶
func NonnegativeBalanceInvariant(acck auth.AccountKeeper) sdk.Invariant
NonnegativeBalanceInvariant checks that all accounts in the application have non-negative balances
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, acck auth.AccountKeeper)
RegisterInvariants registers the bank module invariants
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 BankKeeper ¶
type BankKeeper struct { ViewKeeper // contains filtered or unexported fields }
BankKeeper only allows transfers between accounts without the possibility of creating coins. It implements the BankKeeperI interface.
func NewBankKeeper ¶
func NewBankKeeper(acck auth.AccountKeeper) BankKeeper
NewBankKeeper returns a new BankKeeper.
func (BankKeeper) AddCoins ¶
func (bank BankKeeper) AddCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error)
AddCoins adds amt to the coins at the addr.
func (BankKeeper) InputOutputCoins ¶
InputOutputCoins handles a list of inputs and outputs
func (BankKeeper) SendCoins ¶
func (bank BankKeeper) SendCoins(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error
SendCoins moves coins from one account to another
type BankKeeperI ¶
type BankKeeperI interface { ViewKeeperI InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) error SendCoins(ctx sdk.Context, fromAddr crypto.Address, toAddr crypto.Address, amt std.Coins) error SubtractCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error) AddCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) (std.Coins, error) SetCoins(ctx sdk.Context, addr crypto.Address, amt std.Coins) error }
bank.Keeper defines a module interface that facilitates the transfer of coins between accounts without the possibility of creating coins.
type Input ¶
type Input struct { Address crypto.Address `json:"address" yaml:"address"` Coins std.Coins `json:"coins" yaml:"coins"` }
Input models transaction input
func (Input) ValidateBasic ¶
ValidateBasic - validate transaction input
type InputOutputMismatchError ¶
type InputOutputMismatchError struct {
// contains filtered or unexported fields
}
func (InputOutputMismatchError) AssertABCIError ¶
func (InputOutputMismatchError) AssertABCIError()
func (InputOutputMismatchError) Error ¶
func (e InputOutputMismatchError) Error() string
type MsgMultiSend ¶
type MsgMultiSend struct { Inputs []Input `json:"inputs" yaml:"inputs"` Outputs []Output `json:"outputs" yaml:"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) GetSignBytes ¶
func (msg MsgMultiSend) GetSignBytes() []byte
GetSignBytes Implements Msg.
func (MsgMultiSend) GetSigners ¶
func (msg MsgMultiSend) GetSigners() []crypto.Address
GetSigners Implements Msg.
func (MsgMultiSend) ValidateBasic ¶
func (msg MsgMultiSend) ValidateBasic() error
ValidateBasic Implements Msg.
type MsgSend ¶
type MsgSend struct { FromAddress crypto.Address `json:"from_address" yaml:"from_address"` ToAddress crypto.Address `json:"to_address" yaml:"to_address"` Amount std.Coins `json:"amount" yaml:"amount"` }
MsgSend - high level transaction of the coin module
func NewMsgSend ¶
NewMsgSend - construct arbitrary multi-in, multi-out send msg.
func (MsgSend) GetSigners ¶
GetSigners Implements Msg.
func (MsgSend) ValidateBasic ¶
ValidateBasic Implements Msg.
type NoInputsError ¶
type NoInputsError struct {
// contains filtered or unexported fields
}
declare all bank errors. NOTE: these are meant to be used in conjunction with pkgs/errors.
func (NoInputsError) AssertABCIError ¶
func (NoInputsError) AssertABCIError()
func (NoInputsError) Error ¶
func (e NoInputsError) Error() string
type NoOutputsError ¶
type NoOutputsError struct {
// contains filtered or unexported fields
}
func (NoOutputsError) AssertABCIError ¶
func (NoOutputsError) AssertABCIError()
func (NoOutputsError) Error ¶
func (e NoOutputsError) Error() string
type Output ¶
type Output struct { Address crypto.Address `json:"address" yaml:"address"` Coins std.Coins `json:"coins" yaml:"coins"` }
Output models transaction outputs
func (Output) ValidateBasic ¶
ValidateBasic - validate transaction output
type ViewKeeper ¶
type ViewKeeper struct {
// contains filtered or unexported fields
}
ViewKeeper implements a read only keeper implementation of ViewKeeperI.
func NewViewKeeper ¶
func NewViewKeeper(acck auth.AccountKeeper) ViewKeeper
NewViewKeeper returns a new ViewKeeper.