base

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	NameVal   = "val"
	NamePrice = "price"

	TypeValChange = NameVal + "/change"
	ByteValChange = 0xfe

	TypePriceShow = NamePrice + "/show"
	BytePriceShow = 0xfd
)

nolint

View Source
const (
	// for utils...
	ByteMultiTx = 0x2
	ByteChainTx = 0x3
)

nolint

View Source
const (
	TypeMultiTx = NameMultiplexer + "/tx"
	TypeChainTx = NameChain + "/tx"
)

nolint

View Source
const (
	NameChain = "chain"
)

nolint

View Source
const (
	NameLogger = "lggr"
)

nolint

View Source
const (
	NameMultiplexer = "mplx"
)

nolint

Variables

View Source
var PriceData = []byte{0xCA, 0xFE}

PriceData is the data we ping back

Functions

func ErrExpired

func ErrExpired() errors.TMError

func ErrNoChain

func ErrNoChain() errors.TMError

func ErrWrongChain

func ErrWrongChain(chain string) errors.TMError

func IsExpiredErr

func IsExpiredErr(err error) bool

func IsNoChainErr

func IsNoChainErr(err error) bool

func IsWrongChainErr

func IsWrongChainErr(err error) bool

func NewChainTx

func NewChainTx(chainID string, expires uint64, tx sdk.Tx) sdk.Tx

NewChainTx wraps a particular tx with the ChainTx wrapper, to enforce chain and height

func NewMultiTx

func NewMultiTx(txs ...sdk.Tx) sdk.Tx

nolint - TxInner Functions

func NewPriceShowTx

func NewPriceShowTx(gasAllocated, gasPayment uint64) sdk.Tx

Types

type Chain

type Chain struct {
	stack.PassInitState
	stack.PassInitValidate
}

Chain enforces that this tx was bound to the named chain

func (Chain) CheckTx

func (c Chain) CheckTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, next sdk.Checker) (res sdk.CheckResult, err error)

CheckTx makes sure we are on the proper chain - fulfills Middlware interface

func (Chain) DeliverTx

func (c Chain) DeliverTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, next sdk.Deliver) (res sdk.DeliverResult, err error)

DeliverTx makes sure we are on the proper chain - fulfills Middlware interface

func (Chain) Name

func (Chain) Name() string

Name of the module - fulfills Middleware interface

type ChainTx

type ChainTx struct {
	// name of chain, must be [A-Za-z0-9_-]+
	ChainID string `json:"chain_id"`
	// block height at which it is no longer valid, 0 means no expiration
	ExpiresAt uint64 `json:"expires_at"`
	Tx        sdk.Tx `json:"tx"`
}

ChainTx locks this tx to one chainTx, wrap with this before signing

func (ChainTx) ValidateBasic

func (c ChainTx) ValidateBasic() error

func (ChainTx) Wrap

func (c ChainTx) Wrap() sdk.Tx

nolint - TxInner Functions

type Logger

type Logger struct{}

Logger catches any panics and returns them as errors instead

func (Logger) CheckTx

func (Logger) CheckTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, next sdk.Checker) (res sdk.CheckResult, err error)

CheckTx logs time and result - fulfills Middlware interface

func (Logger) DeliverTx

func (Logger) DeliverTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, next sdk.Deliver) (res sdk.DeliverResult, err error)

DeliverTx logs time and result - fulfills Middlware interface

func (Logger) InitState

func (Logger) InitState(l log.Logger, store state.SimpleDB, module, key, value string, next sdk.InitStater) (string, error)

InitState logs time and result - fulfills Middlware interface

func (Logger) InitValidate

func (Logger) InitValidate(l log.Logger, store state.SimpleDB, vals []*abci.Validator, next sdk.InitValidater)

InitValidate logs time and result - fulfills Middlware interface

func (Logger) Name

func (Logger) Name() string

Name of the module - fulfills Middleware interface

type MultiTx

type MultiTx struct {
	Txs []sdk.Tx `json:"txs"`
}

MultiTx - a transaction containing multiple transactions

func (MultiTx) ValidateBasic

func (mt MultiTx) ValidateBasic() error

func (MultiTx) Wrap

func (mt MultiTx) Wrap() sdk.Tx

type Multiplexer

type Multiplexer struct {
	stack.PassInitState
	stack.PassInitValidate
}

Multiplexer grabs a MultiTx and sends them sequentially down the line

func (Multiplexer) CheckTx

func (Multiplexer) CheckTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, next sdk.Checker) (res sdk.CheckResult, err error)

CheckTx splits the input tx and checks them all - fulfills Middlware interface

func (Multiplexer) DeliverTx

func (Multiplexer) DeliverTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, next sdk.Deliver) (res sdk.DeliverResult, err error)

DeliverTx splits the input tx and checks them all - fulfills Middlware interface

func (Multiplexer) Name

func (Multiplexer) Name() string

Name of the module - fulfills Middleware interface

type PriceHandler

type PriceHandler struct {
	sdk.NopInitState
	sdk.NopInitValidate
}

PriceHandler returns checktx results based on the input

func (PriceHandler) CheckTx

func (PriceHandler) CheckTx(ctx sdk.Context, store state.SimpleDB,
	tx sdk.Tx) (res sdk.CheckResult, err error)

func (PriceHandler) DeliverTx

func (PriceHandler) DeliverTx(ctx sdk.Context, store state.SimpleDB,
	tx sdk.Tx) (res sdk.DeliverResult, err error)

func (PriceHandler) Name

func (PriceHandler) Name() string

type PriceShowTx

type PriceShowTx struct {
	GasAllocated uint64
	GasPayment   uint64
}

PriceShowTx lets us bounce back a given fee/gas on CheckTx

func (PriceShowTx) ValidateBasic

func (v PriceShowTx) ValidateBasic() error

func (PriceShowTx) Wrap

func (p PriceShowTx) Wrap() sdk.Tx

type ValChangeTx

type ValChangeTx struct {
	Diff []*abci.Validator
}

func (ValChangeTx) ValidateBasic

func (v ValChangeTx) ValidateBasic() error

func (ValChangeTx) Wrap

func (v ValChangeTx) Wrap() sdk.Tx

type ValSetHandler

type ValSetHandler struct {
	sdk.NopCheck
	sdk.NopInitState
	sdk.NopInitValidate
}

func (ValSetHandler) DeliverTx

func (ValSetHandler) DeliverTx(ctx sdk.Context, store state.SimpleDB,
	tx sdk.Tx) (res sdk.DeliverResult, err error)

func (ValSetHandler) Name

func (ValSetHandler) Name() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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