bank

package
v0.25.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: Apache-2.0 Imports: 5 Imported by: 2,319

Documentation

Overview

nolint

Index

Constants

View Source
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 NewHandler

func NewHandler(k Keeper) sdk.Handler

NewHandler returns a handler for "bank" type messages.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

Types

type BaseKeeper

type BaseKeeper struct {
	// contains filtered or unexported fields
}

BaseKeeper manages transfers between accounts. It implements the Keeper interface.

func NewBaseKeeper

func NewBaseKeeper(am 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) GetCoins added in v0.25.0

func (keeper BaseKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

GetCoins returns the coins at the addr.

func (BaseKeeper) HasCoins added in v0.25.0

func (keeper BaseKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool

HasCoins returns whether or not an account has at least amt 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) SendCoins added in v0.25.0

func (keeper BaseKeeper) 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

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.

type BaseSendKeeper

type BaseSendKeeper struct {
	// contains filtered or unexported fields
}

SendKeeper only allows transfers between accounts without the possibility of creating coins. It implements the SendKeeper interface.

func NewBaseSendKeeper

func NewBaseSendKeeper(am auth.AccountKeeper) BaseSendKeeper

NewBaseSendKeeper returns a new BaseSendKeeper.

func (BaseSendKeeper) GetCoins added in v0.25.0

func (keeper BaseSendKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

GetCoins returns the coins at the addr.

func (BaseSendKeeper) HasCoins added in v0.25.0

func (keeper BaseSendKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool

HasCoins returns whether or not an account has at least amt coins.

func (BaseSendKeeper) InputOutputCoins added in v0.25.0

func (keeper BaseSendKeeper) InputOutputCoins(
	ctx sdk.Context, inputs []Input, outputs []Output,
) (sdk.Tags, sdk.Error)

InputOutputCoins handles a list of inputs and outputs

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

type BaseViewKeeper struct {
	// contains filtered or unexported fields
}

BaseViewKeeper implements a read only keeper implementation of ViewKeeper.

func NewBaseViewKeeper

func NewBaseViewKeeper(am 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) GetSignBytes added in v0.19.0

func (in Input) GetSignBytes() []byte

Return bytes to sign for Input

func (Input) ValidateBasic added in v0.2.0

func (in Input) ValidateBasic() sdk.Error

ValidateBasic - validate transaction input

type Keeper

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

Keeper defines a module interface that facilitates the transfer of coins between accounts.

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

func (msg MsgIssue) GetSignBytes() []byte

Implements Msg.

func (MsgIssue) GetSigners added in v0.16.0

func (msg MsgIssue) GetSigners() []sdk.AccAddress

Implements Msg.

func (MsgIssue) Route added in v0.25.0

func (msg MsgIssue) Route() string

Implements Msg. nolint

func (MsgIssue) Type added in v0.16.0

func (msg MsgIssue) Type() string

func (MsgIssue) ValidateBasic added in v0.16.0

func (msg MsgIssue) ValidateBasic() sdk.Error

Implements Msg.

type MsgSend

type MsgSend struct {
	Inputs  []Input  `json:"inputs"`
	Outputs []Output `json:"outputs"`
}

MsgSend - high level transaction of the coin module

func NewMsgSend

func NewMsgSend(in []Input, out []Output) MsgSend

NewMsgSend - construct arbitrary multi-in, multi-out send msg.

func (MsgSend) GetSignBytes added in v0.16.0

func (msg MsgSend) GetSignBytes() []byte

Implements Msg.

func (MsgSend) GetSigners added in v0.16.0

func (msg MsgSend) GetSigners() []sdk.AccAddress

Implements Msg.

func (MsgSend) Route added in v0.25.0

func (msg MsgSend) Route() string

Implements Msg. nolint

func (MsgSend) Type added in v0.16.0

func (msg MsgSend) Type() string

func (MsgSend) ValidateBasic added in v0.16.0

func (msg MsgSend) ValidateBasic() sdk.Error

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

func (out Output) GetSignBytes() []byte

Return bytes to sign for Output

func (Output) ValidateBasic added in v0.2.0

func (out Output) ValidateBasic() sdk.Error

ValidateBasic - validate transaction output

type SendKeeper

type SendKeeper interface {
	ViewKeeper
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error)
	InputOutputCoins(ctx sdk.Context, inputs []Input, outputs []Output) (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

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.

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL