bank

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2018 License: Apache-2.0 Imports: 5 Imported by: 6

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

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

func NewHandler(k Keeper) sdk.Handler

NewHandler returns a handler for "bank" type messages.

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

Types

type Input

type Input struct {
	Address sdk.Address `json:"address"`
	Coins   sdk.Coins   `json:"coins"`
}

Transaction Input

func NewInput

func NewInput(addr sdk.Address, coins sdk.Coins) Input

NewInput - create a transaction input, used with MsgSend

func (Input) ValidateBasic

func (in Input) ValidateBasic() sdk.Error

ValidateBasic - validate transaction input

type Keeper added in v0.16.0

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

Keeper manages transfers between accounts

func NewKeeper added in v0.16.0

func NewKeeper(am sdk.AccountMapper) Keeper

NewKeeper returns a new Keeper

func (Keeper) AddCoins added in v0.16.0

func (keeper Keeper) AddCoins(ctx sdk.Context, addr sdk.Address, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)

AddCoins adds amt to the coins at the addr.

func (Keeper) GetCoins added in v0.16.0

func (keeper Keeper) GetCoins(ctx sdk.Context, addr sdk.Address) sdk.Coins

GetCoins returns the coins at the addr.

func (Keeper) HasCoins added in v0.16.0

func (keeper Keeper) HasCoins(ctx sdk.Context, addr sdk.Address, amt sdk.Coins) bool

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.Address, toAddr sdk.Address, amt sdk.Coins) (sdk.Tags, sdk.Error)

SendCoins moves coins from one account to another

func (Keeper) SetCoins added in v0.16.0

func (keeper Keeper) SetCoins(ctx sdk.Context, addr sdk.Address, amt sdk.Coins) sdk.Error

SetCoins sets the coins at the addr.

func (Keeper) SubtractCoins added in v0.16.0

func (keeper Keeper) SubtractCoins(ctx sdk.Context, addr sdk.Address, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error)

SubtractCoins subtracts amt from the coins at the addr.

type MsgIssue added in v0.16.0

type MsgIssue struct {
	Banker  sdk.Address `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.Address, 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.Address

Implements Msg.

func (MsgIssue) Type added in v0.16.0

func (msg MsgIssue) Type() string

Implements Msg.

func (MsgIssue) ValidateBasic added in v0.16.0

func (msg MsgIssue) ValidateBasic() sdk.Error

Implements Msg.

type MsgSend added in v0.16.0

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

MsgSend - high level transaction of the coin module

func NewMsgSend added in v0.16.0

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.Address

Implements Msg.

func (MsgSend) Type added in v0.16.0

func (msg MsgSend) Type() string

Implements Msg.

func (MsgSend) ValidateBasic added in v0.16.0

func (msg MsgSend) ValidateBasic() sdk.Error

Implements Msg.

type Output

type Output struct {
	Address sdk.Address `json:"address"`
	Coins   sdk.Coins   `json:"coins"`
}

Transaction Output

func NewOutput

func NewOutput(addr sdk.Address, coins sdk.Coins) Output

NewOutput - create a transaction output, used with MsgSend

func (Output) ValidateBasic

func (out Output) ValidateBasic() sdk.Error

ValidateBasic - validate transaction output

type SendKeeper added in v0.16.0

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 sdk.AccountMapper) SendKeeper

NewSendKeeper returns a new Keeper

func (SendKeeper) GetCoins added in v0.16.0

func (keeper SendKeeper) GetCoins(ctx sdk.Context, addr sdk.Address) 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.Address, 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.Address, toAddr sdk.Address, amt sdk.Coins) (sdk.Tags, sdk.Error)

SendCoins moves coins from one account to another

type ViewKeeper added in v0.16.0

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

ViewKeeper only allows reading of balances

func NewViewKeeper added in v0.16.0

func NewViewKeeper(am sdk.AccountMapper) ViewKeeper

NewViewKeeper returns a new Keeper

func (ViewKeeper) GetCoins added in v0.16.0

func (keeper ViewKeeper) GetCoins(ctx sdk.Context, addr sdk.Address) 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.Address, amt sdk.Coins) bool

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

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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