types

package
v0.0.0-...-c763619 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0, Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AddrLen defines a valid address length
	AddrLen = 20
	// WasmContractAddrLen defines a valid wasm contract address length
	WasmContractAddrLen = 32
	// Bech32MainPrefix defines the main SDK Bech32 prefix of an account's address
	Bech32MainPrefix = "cosmos"

	// CoinType is the ATOM coin type as defined in SLIP44 (https://github.com/satoshilabs/slips/blob/master/slip-0044.md)
	CoinType = 118

	// FullFundraiserPath is the parts of the BIP44 HD path that are fixed by
	// what we used during the ATOM fundraiser.
	FullFundraiserPath = "m/44'/118'/0'/0/0"

	// PrefixAccount is the prefix for account keys
	PrefixAccount = "acc"
	// PrefixValidator is the prefix for validator keys
	PrefixValidator = "val"
	// PrefixConsensus is the prefix for consensus keys
	PrefixConsensus = "cons"
	// PrefixPublic is the prefix for public keys
	PrefixPublic = "pub"
	// PrefixOperator is the prefix for operator keys
	PrefixOperator = "oper"

	// PrefixAddress is the prefix for addresses
	PrefixAddress = "addr"

	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32PrefixAccAddr = Bech32MainPrefix
	// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
	Bech32PrefixAccPub = Bech32MainPrefix + PrefixPublic
	// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
	Bech32PrefixValAddr = Bech32MainPrefix + PrefixValidator + PrefixOperator
	// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
	Bech32PrefixValPub = Bech32MainPrefix + PrefixValidator + PrefixOperator + PrefixPublic
	// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
	Bech32PrefixConsAddr = Bech32MainPrefix + PrefixValidator + PrefixConsensus
	// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
	Bech32PrefixConsPub = Bech32MainPrefix + PrefixValidator + PrefixConsensus + PrefixPublic
)
View Source
const (
	// number of decimal places
	Precision = 18

	// bytes required to represent the above precision
	// Ceiling[Log2[999 999 999 999 999 999]]
	DecimalPrecisionBits = 60
)
View Source
const (
	CodeOK          uint32 = 0
	CodeInternal    uint32 = 23
	CodeGasOverflow uint32 = 22
)
View Source
const (

	// default bond denomination
	DefaultBondDenom = "fibo"

	// Delay, in blocks, between when validator updates are returned to the
	// consensus-engine and when they are applied. For example, if
	// ValidatorUpdateDelay is set to X, and if a validator set update is
	// returned with new validators at the end of block 10, then the new
	// validators are expected to sign blocks beginning at block 11+X.
	//
	// This value is constant as this should not change without a hard fork.
	// For Tendermint this should be set to 1 block, for more details see:
	// https://tendermint.com/docs/spec/abci/apps.html#endblock
	ValidatorUpdateDelay int64 = 1
)

staking constants

View Source
const (
	Unbonded  BondStatus = 0x00
	Unbonding BondStatus = 0x01
	Bonded    BondStatus = 0x02

	BondStatusUnbonded  = "Unbonded"
	BondStatusUnbonding = "Unbonding"
	BondStatusBonded    = "Bonded"
)

staking constants

View Source
const (
	StoreTypeMulti     = types.StoreTypeMulti
	StoreTypeDB        = types.StoreTypeDB
	StoreTypeIAVL      = types.StoreTypeIAVL
	StoreTypeTransient = types.StoreTypeTransient
	StoreTypeMPT       = types.StoreTypeMPT
	StoreTypeMemory    = types.StoreTypeMemory
)

nolint - reexport

View Source
const AnteTerminatorTag = "ante-terminator"
View Source
const DefaultDecInt = 1000000000000000000
View Source
const DefaultDecStr = "1000000000000000000"
View Source
const DefaultIbcWei = "wei"

DefaultIbcWei for ibc transfer default fibo min unit

View Source
const DefaultKeyringServiceName = "cosmos"

DefaultKeyringServiceName defines a default service name for the keyring.

View Source
const FlagDBBackend = "db_backend"
View Source
const (
	IBCROUTER = "ibc"
)
View Source
const (
	// MsgInterfaceProtoName defines the protobuf name of the cosmos Msg interface
	MsgInterfaceProtoName = "cosmos.base.v1beta1.Msg"
)
View Source
const SortableTimeFormat = "2006-01-02T15:04:05.000000000"

Slight modification of the RFC3339Nano but it right pads all zeros and drops the time zone info

Variables

View Source
var (
	ParseCoin  = ParseDecCoin
	ParseCoins = ParseDecCoins
)
View Source
var (
	FlagMultiCache         = "multi-cache"
	MaxAccInMultiCache     = "multi-cache-acc"
	MaxStorageInMultiCache = "multi-cache-storage"
	UseCache               bool
)
View Source
var (
	ErrInvalidLengthCoinAdapter        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCoinAdapter          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCoinAdapter = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrEmptyDecimalStr      = errors.New("decimal string cannot be empty")
	ErrInvalidDecimalLength = errors.New("invalid decimal length")
	ErrInvalidDecimalStr    = errors.New("invalid decimal string")
)

Decimal errors

View Source
var (
	CodeTxDecode          uint32 = errors.ErrTxDecode.ABCICode()
	CodeInvalidSequence   uint32 = errors.ErrInvalidSequence.ABCICode()
	CodeUnauthorized      uint32 = errors.ErrUnauthorized.ABCICode()
	CodeInsufficientFunds uint32 = errors.ErrInsufficientFunds.ABCICode()
	CodeUnknownRequest    uint32 = errors.ErrUnknownRequest.ABCICode()
	CodeInvalidAddress    uint32 = errors.ErrInvalidAddress.ABCICode()
	CodeInvalidPubKey     uint32 = errors.ErrInvalidPubKey.ABCICode()
	CodeUnknownAddress    uint32 = errors.ErrUnknownAddress.ABCICode()
	CodeInsufficientCoins uint32 = errors.ErrInsufficientFunds.ABCICode()
	CodeInvalidCoins      uint32 = errors.ErrInvalidCoins.ABCICode()
	CodeOutOfGas          uint32 = errors.ErrOutOfGas.ABCICode()
	CodeMemoTooLarge      uint32 = errors.ErrMemoTooLarge.ABCICode()
	CodeInsufficientFee   uint32 = errors.ErrInsufficientFee.ABCICode()
	CodeTooManySignatures uint32 = errors.ErrTooManySignatures.ABCICode()
	CodeNoSignatures      uint32 = errors.ErrNoSignatures.ABCICode()
)
View Source
var (
	EventTypeMessage = "message"

	AttributeKeyAction = "action"
	AttributeKeyModule = "module"
	AttributeKeySender = "sender"
	AttributeKeyAmount = "amount"
	AttributeKeyFee    = "fee"
)

Common event types and attribute keys

View Source
var (
	// IsAlphaNumeric defines a regular expression for matching against alpha-numeric
	// values.
	IsAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString

	// IsAlphaLower defines regular expression to check if the string has lowercase
	// alphabetic characters only.
	IsAlphaLower = regexp.MustCompile(`^[a-z]+$`).MatchString

	// IsAlphaUpper defines regular expression to check if the string has uppercase
	// alphabetic characters only.
	IsAlphaUpper = regexp.MustCompile(`^[A-Z]+$`).MatchString

	// IsAlpha defines regular expression to check if the string has alphabetic
	// characters only.
	IsAlpha = regexp.MustCompile(`^[a-zA-Z]+$`).MatchString

	// IsNumeric defines regular expression to check if the string has numeric
	// characters only.
	IsNumeric = regexp.MustCompile(`^[0-9]+$`).MatchString
)
View Source
var MaxSortableDec = OneDec().Quo(SmallestDec())

MaxSortableDec is the largest Dec that can be passed into SortableDecBytes() Its negative form is the least Dec that can be passed in.

View Source
var PowerReduction = NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(Precision), nil))

PowerReduction is the amount of staking tokens required for 1 unit of consensus-engine power

Functions

func AppendMsgToErr

func AppendMsgToErr(msg string, err string) string

appends a message to the head of the given error

func Bech32ifyPubKey

func Bech32ifyPubKey(pkt Bech32PubKeyType, pubkey crypto.PubKey) (string, error)

Bech32ifyPubKey returns a Bech32 encoded string containing the appropriate prefix based on the key type provided for a given PublicKey.

func BigEndianToUint64

func BigEndianToUint64(bz []byte) uint64

BigEndianToUint64 returns an uint64 from big endian encoded bytes. If encoding is empty, zero is returned.

func CopyBytes

func CopyBytes(bz []byte) (ret []byte)

copy bytes

func DecEq

func DecEq(t *testing.T, exp, got Dec) (*testing.T, bool, string, string, string)

intended to be used with require/assert: require.True(DecEq(...))

func DecsEqual

func DecsEqual(d1s, d2s []Dec) bool

test if two decimal arrays are equal

func DefaultCoinDenomRegex

func DefaultCoinDenomRegex() string

DefaultCoinDenomRegex returns the default regex string

func DefaultIBCCoinDenomRegex

func DefaultIBCCoinDenomRegex() string

DefaultCoinDenomRegex returns the default regex string

func Derive

func Derive(address []byte, key []byte) []byte

Derive derives a new address from the main `address` and a derivation `key`.

func DiffKVStores

func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []tmkv.Pair)

DiffKVStores compares two KVstores and returns all the key/value pairs that differ from one another. It also skips value comparison for a set of provided prefixes

func FormatInvariant

func FormatInvariant(module, name, msg string) string

FormatInvariant returns a standardized invariant message.

func FormatTimeBytes

func FormatTimeBytes(t time.Time) []byte

Formats a time.Time into a []byte that can be sorted

func GetBaseDenom

func GetBaseDenom() (string, error)

GetBaseDenom returns the denom of smallest unit registered

func GetFromBech32

func GetFromBech32(bech32str, prefix string) ([]byte, error)

GetFromBech32 decodes a bytestring from a Bech32 encoded string.

func GetPubKeyFromBech32

func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (crypto.PubKey, error)

GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with a given key type.

func Hash

func Hash(typ string, key []byte) []byte

Hash creates a new address from address type and key

func InclusiveEndBytes

func InclusiveEndBytes(inclusiveBytes []byte) (exclusiveBytes []byte)

InclusiveEndBytes returns the []byte that would end a range query such that the input would be included

func IntEq

func IntEq(t *testing.T, exp, got Int) (*testing.T, bool, string, string, string)

intended to be used with require/assert: require.True(IntEq(...))

func IsETHAddress

func IsETHAddress(addr string) bool

func IsFBCAddress

func IsFBCAddress(addr string) bool

func IsWasmAddress

func IsWasmAddress(acc AccAddress) bool

func KeyringServiceName

func KeyringServiceName() string

func MsgTypeURL

func MsgTypeURL(msg proto.Message) string

MsgTypeURL returns the TypeURL of a `sdk.Msg`.

func MustBech32ifyAccPub

func MustBech32ifyAccPub(pub crypto.PubKey) string

MustBech32ifyAccPub returns the result of Bech32ifyAccPub panicing on failure.

func MustBech32ifyPubKey

func MustBech32ifyPubKey(pkt Bech32PubKeyType, pubkey crypto.PubKey) string

MustBech32ifyPubKey calls Bech32ifyPubKey except it panics on error.

func MustGetPubKeyFromBech32

func MustGetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) crypto.PubKey

MustGetPubKeyFromBech32 calls GetPubKeyFromBech32 except it panics on error.

func MustSortJSON

func MustSortJSON(toSortJSON []byte) []byte

MustSortJSON is like SortJSON but panic if an error occurs, e.g., if the passed JSON isn't valid.

func NewDB

func NewDB(name, dir string) (db dbm.DB, err error)

NewDB instantiate a new DB instance according to db_backend.

func NewKVStoreKeys

func NewKVStoreKeys(names ...string) map[string]*KVStoreKey

NewKVStoreKeys returns a map of new pointers to KVStoreKey's. Uses pointers so keys don't collide.

func NewMemoryStoreKeys

func NewMemoryStoreKeys(names ...string) map[string]*MemoryStoreKey

NewMemoryStoreKeys constructs a new map matching store key names to their respective MemoryStoreKey references.

func NewTransientStoreKeys

func NewTransientStoreKeys(names ...string) map[string]*TransientStoreKey

NewTransientStoreKeys constructs a new map of TransientStoreKey's Must return pointers according to the ocap principle

func ParseTimeBytes

func ParseTimeBytes(bz []byte) (time.Time, error)

Parses a []byte encoded using FormatTimeKey back into a time.Time

func PrefixEndBytes

func PrefixEndBytes(prefix []byte) []byte

PrefixEndBytes returns the []byte that would end a range query for all []byte with a certain prefix Deals with last byte of prefix being FF without overflowing

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register the sdk message type

func RegisterDenom

func RegisterDenom(denom string, unit Dec) error

RegisterDenom registers a denomination with a corresponding unit. If the denomination is already registered, an error will be returned.

func ReturnInfiniteGasMeter

func ReturnInfiniteGasMeter(gm ReusableGasMeter)

func SetCoinDenomRegex

func SetCoinDenomRegex(reFn func() string)

SetCoinDenomRegex allows for coin's custom validation by overriding the regular expression string used for denom validation.

func SetIBCCoinDenomRegex

func SetIBCCoinDenomRegex(reFn func() string)

func SortJSON

func SortJSON(toSortJSON []byte) ([]byte, error)

SortedJSON takes any JSON and returns it sorted by keys. Also, all white-spaces are removed. This method can be used to canonicalize JSON to be returned by GetSignBytes, e.g. for the ledger integration. If the passed JSON isn't valid it will return an error.

func SortableDecBytes

func SortableDecBytes(dec Dec) []byte

SortableDecBytes returns a byte slice representation of a Dec that can be sorted. Left and right pads with 0s so there are 18 digits to left and right of the decimal point. For this reason, there is a maximum and minimum value for this, enforced by ValidSortableDec.

func TokensToConsensusPower

func TokensToConsensusPower(tokens Int) int64

TokensToConsensusPower - convert input tokens to potential consensus-engine power

func Uint64ToBigEndian

func Uint64ToBigEndian(i uint64) []byte

Uint64ToBigEndian - marshals uint64 to a bigendian byte slice so it can be sorted

func UintOverflow

func UintOverflow(i *big.Int) error

UintOverflow returns true if a given unsigned integer overflows and false otherwise.

func UnsafeBytesToStr

func UnsafeBytesToStr(b []byte) string

UnsafeBytesToStr is meant to make a zero allocation conversion from []byte -> string to speed up operations, it is not meant to be used generally, but for a specific pattern to delete keys from a map.

func UnsafeStrToBytes

func UnsafeStrToBytes(s string) []byte

UnsafeStrToBytes uses unsafe to convert string into byte array. Returned bytes must not be altered after this function is called as it will cause a segmentation fault.

func ValidCoins

func ValidCoins(coins Coins) bool

func ValidSortableDec

func ValidSortableDec(dec Dec) bool

ValidSortableDec ensures that a Dec is within the sortable bounds, a Dec can't have a precision of less than 10^-18. Max sortable decimal was set to the reciprocal of SmallestDec.

func ValidateDenom

func ValidateDenom(denom string) error

ValidateDenom validates a denomination string returning an error if it is invalid.

func VerifyAddressFormat

func VerifyAddressFormat(bz []byte) error

VerifyAddressFormat verifies that the provided bytes form a valid address according to the default address rules or a custom address verifier set by GetConfig().SetAddressVerifier()

func WrapSDKContext

func WrapSDKContext(ctx Context) context.Context

WrapSDKContext returns a stdlib context.Context with the provided sdk.Context's internal context as a value. It is useful for passing an sdk.Context through methods that take a stdlib context.Context parameter such as generated gRPC methods. To get the original sdk.Context back, call UnwrapSDKContext.

Types

type ABCIMessageLog

type ABCIMessageLog struct {
	MsgIndex uint16 `json:"msg_index"`
	Log      string `json:"log"`

	// Events contains a slice of Event objects that were emitted during some
	// execution.
	Events StringEvents `json:"events"`
}

ABCIMessageLog defines a structure containing an indexed tx ABCI message log.

func NewABCIMessageLog

func NewABCIMessageLog(i uint16, log string, events Events) ABCIMessageLog

func (ABCIMessageLog) MarshalJsonToBuffer

func (log ABCIMessageLog) MarshalJsonToBuffer(buf *bytes.Buffer) error

type ABCIMessageLogs

type ABCIMessageLogs []ABCIMessageLog

ABCIMessageLogs represents a slice of ABCIMessageLog.

func ParseABCILogs

func ParseABCILogs(logs string) (res ABCIMessageLogs, err error)

ParseABCILogs attempts to parse a stringified ABCI tx log into a slice of ABCIMessageLog types. It returns an error upon JSON decoding failure.

func (ABCIMessageLogs) MarshalJsonToBuffer

func (logs ABCIMessageLogs) MarshalJsonToBuffer(buf *bytes.Buffer) error

func (ABCIMessageLogs) MarshalToJson

func (logs ABCIMessageLogs) MarshalToJson() ([]byte, error)

func (ABCIMessageLogs) String

func (logs ABCIMessageLogs) String() (str string)

String implements the fmt.Stringer interface for the ABCIMessageLogs type.

type AccAddress

type AccAddress []byte

AccAddress a wrapper around bytes meant to represent an account address. When marshaled to a string or JSON, it uses Bech32.

func AccAddressFromBech32

func AccAddressFromBech32(address string) (AccAddress, error)

AccAddressFromBech32 creates an AccAddress from a Bech32 string.

func AccAddressFromBech32ByPrefix

func AccAddressFromBech32ByPrefix(address string, bech32PrefixAccAddr string) (addr AccAddress, err error)

AccAddressFromBech32ByPrefix create an AccAddress from a Bech32 string by address prefix

func AccAddressFromHex

func AccAddressFromHex(address string) (addr AccAddress, err error)

AccAddressFromHex creates an AccAddress from a hex string.

func MustAccAddressFromBech32

func MustAccAddressFromBech32(address string) AccAddress

MustAccAddressFromBech32 calls AccAddressFromBech32 and panics on error.

func (AccAddress) Bech32String

func (aa AccAddress) Bech32String(bech32PrefixAccAddr string) string

Bech32String convert account address to bech32 address.

func (AccAddress) Bech32StringOptimized

func (aa AccAddress) Bech32StringOptimized(bech32PrefixAccAddr string) string

func (AccAddress) Bytes

func (aa AccAddress) Bytes() []byte

Bytes returns the raw address bytes.

func (AccAddress) Empty

func (aa AccAddress) Empty() bool

Returns boolean for whether an AccAddress is empty

func (AccAddress) Equals

func (aa AccAddress) Equals(aa2 Address) bool

Returns boolean for whether two AccAddresses are Equal

func (AccAddress) Format

func (aa AccAddress) Format(s fmt.State, verb rune)

Format implements the fmt.Formatter interface. nolint: errcheck

func (AccAddress) Marshal

func (aa AccAddress) Marshal() ([]byte, error)

Marshal returns the raw address bytes. It is needed for protobuf compatibility.

func (AccAddress) MarshalJSON

func (aa AccAddress) MarshalJSON() ([]byte, error)

MarshalJSON marshals to JSON using Bech32.

func (AccAddress) MarshalYAML

func (aa AccAddress) MarshalYAML() (interface{}, error)

MarshalYAML marshals to YAML using Bech32.

func (AccAddress) String

func (aa AccAddress) String() string

String implements the Stringer interface.

func (*AccAddress) Unmarshal

func (aa *AccAddress) Unmarshal(data []byte) error

Unmarshal sets the address to the given data. It is needed for protobuf compatibility.

func (*AccAddress) UnmarshalJSON

func (aa *AccAddress) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

func (*AccAddress) UnmarshalYAML

func (aa *AccAddress) UnmarshalYAML(data []byte) error

UnmarshalYAML unmarshals from JSON assuming Bech32 encoding.

type AccNonceHandler

type AccNonceHandler func(ctx Context, address AccAddress) (nonce uint64)

type Account

type Account interface {
	Copy() Account
	GetAddress() AccAddress
	SetAddress(AccAddress) error
	GetPubKey() crypto.PubKey
	SetPubKey(crypto.PubKey) error
	GetAccountNumber() uint64
	SetAccountNumber(uint64) error
	GetSequence() uint64
	SetSequence(uint64) error
	GetCoins() Coins
	SetCoins(Coins) error
	SpendableCoins(blockTime time.Time) Coins
	String() string
}

type AccountCache

type AccountCache struct {
	FromAcc       interface{} // must be auth.Account
	ToAcc         interface{} // must be auth.Account
	FromAccGotGas Gas
	ToAccGotGas   Gas
}

type Address

type Address interface {
	Equals(Address) bool
	Empty() bool
	Marshal() ([]byte, error)
	MarshalJSON() ([]byte, error)
	Bytes() []byte
	String() string
	Format(s fmt.State, verb rune)
}

Address is a common interface for different types of addresses used by the SDK

type AnteDecorator

type AnteDecorator interface {
	AnteHandle(ctx Context, tx Tx, simulate bool, next AnteHandler) (newCtx Context, err error)
}

AnteDecorator wraps the next AnteHandler to perform custom pre- and post-processing.

type AnteHandler

type AnteHandler func(ctx Context, tx Tx, simulate bool) (newCtx Context, err error)

AnteHandler authenticates transactions, before their internal messages are handled. If newCtx.IsZero(), ctx is used instead.

func ChainAnteDecorators

func ChainAnteDecorators(chain ...AnteDecorator) AnteHandler

ChainDecorator chains AnteDecorators together with each AnteDecorator wrapping over the decorators further along chain and returns a single AnteHandler.

NOTE: The first element is outermost decorator, while the last element is innermost decorator. Decorator ordering is critical since some decorators will expect certain checks and updates to be performed (e.g. the Context) before the decorator is run. These expectations should be documented clearly in a CONTRACT docline in the decorator's godoc.

NOTE: Any application that uses GasMeter to limit transaction processing cost MUST set GasMeter with the FIRST AnteDecorator. Failing to do so will cause transactions to be processed with an infinite gasmeter and open a DOS attack vector. Use `ante.SetUpContextDecorator` or a custom Decorator with similar functionality. Returns nil when no AnteDecorator are supplied.

type Attribute

type Attribute struct {
	Key   string `json:"key"`
	Value string `json:"value,omitempty"`
}

Attribute defines an attribute wrapper where the key and value are strings instead of raw bytes.

func NewAttribute

func NewAttribute(k, v string) Attribute

NewAttribute returns a new key/value Attribute object.

func (Attribute) MarshalJsonToBuffer

func (a Attribute) MarshalJsonToBuffer(buf *bytes.Buffer) error

func (Attribute) String

func (a Attribute) String() string

func (Attribute) ToKVPair

func (a Attribute) ToKVPair() tmkv.Pair

ToKVPair converts an Attribute object into a Tendermint key/value pair.

type BaseTx

type BaseTx struct {
	Raw   []byte
	Hash  []byte
	From  string
	Nonce uint64
}

func (*BaseTx) GetFrom

func (tx *BaseTx) GetFrom() string

func (*BaseTx) GetGas

func (tx *BaseTx) GetGas() uint64

func (*BaseTx) GetGasPrice

func (tx *BaseTx) GetGasPrice() *big.Int

func (*BaseTx) GetMsgs

func (tx *BaseTx) GetMsgs() []Msg

func (*BaseTx) GetNonce

func (tx *BaseTx) GetNonce() uint64

func (*BaseTx) GetRaw

func (tx *BaseTx) GetRaw() []byte

func (*BaseTx) GetSender

func (tx *BaseTx) GetSender(_ Context) string

func (*BaseTx) GetSigners

func (tx *BaseTx) GetSigners() []AccAddress

func (*BaseTx) GetTxFnSignatureInfo

func (tx *BaseTx) GetTxFnSignatureInfo() ([]byte, int)

func (*BaseTx) GetType

func (tx *BaseTx) GetType() TransactionType

func (*BaseTx) SetRaw

func (tx *BaseTx) SetRaw(raw []byte)

func (*BaseTx) SetTxHash

func (tx *BaseTx) SetTxHash(hash []byte)

func (*BaseTx) TxHash

func (tx *BaseTx) TxHash() []byte

func (*BaseTx) ValidateBasic

func (tx *BaseTx) ValidateBasic() error

type Bech32PubKeyType

type Bech32PubKeyType string

Bech32PubKeyType defines a string type alias for a Bech32 public key type.

const (
	Bech32PubKeyTypeAccPub  Bech32PubKeyType = "accpub"
	Bech32PubKeyTypeValPub  Bech32PubKeyType = "valpub"
	Bech32PubKeyTypeConsPub Bech32PubKeyType = "conspub"
)

Bech32 conversion constants

type BeginBlocker

type BeginBlocker func(ctx Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock

BeginBlocker runs code before the transactions in a block

Note: applications which set create_empty_blocks=false will not have regular block timing and should use e.g. BFT timestamps rather than block height for any periodic BeginBlock logic

type BondStatus

type BondStatus byte

BondStatus is the status of a validator

func (BondStatus) Equal

func (b BondStatus) Equal(b2 BondStatus) bool

Equal compares two BondStatus instances

func (BondStatus) String

func (b BondStatus) String() string

String implements the Stringer interface for BondStatus.

type Cache

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

func NewCache

func NewCache(parent *Cache, useCache bool) *Cache

func NewChainCache

func NewChainCache() *Cache

func (*Cache) Clear

func (c *Cache) Clear()

func (*Cache) DisableCache

func (c *Cache) DisableCache()

func (*Cache) GetAccount

func (c *Cache) GetAccount(addr ethcmn.Address) (Account, uint64, bool)

func (*Cache) GetCode

func (c *Cache) GetCode(key []byte) ([]byte, bool)

func (*Cache) GetStorage

func (c *Cache) GetStorage(addr ethcmn.Address, key ethcmn.Hash) ([]byte, bool)

func (*Cache) IsEnabled

func (c *Cache) IsEnabled() bool

func (*Cache) TryDelete

func (c *Cache) TryDelete(logger log.Logger, height int64)

func (*Cache) UpdateAccount

func (c *Cache) UpdateAccount(addr AccAddress, acc Account, lenBytes int, isDirty bool)

func (*Cache) UpdateCode

func (c *Cache) UpdateCode(key []byte, value []byte, isdirty bool)

func (*Cache) UpdateStorage

func (c *Cache) UpdateStorage(addr ethcmn.Address, key ethcmn.Hash, value []byte, isDirty bool)

func (*Cache) Write

func (c *Cache) Write(updateDirty bool)

type CacheKVStore

type CacheKVStore = types.CacheKVStore

nolint - reexport

type CacheMultiStore

type CacheMultiStore = types.CacheMultiStore

nolint - reexport

type CacheWrap

type CacheWrap = types.CacheWrap

nolint - reexport

type CacheWrapper

type CacheWrapper = types.CacheWrapper

nolint - reexport

type Causer

type Causer interface {
	Cause() error
}

type Coder

type Coder interface {
	ABCICode() uint32
}

type Codespacer

type Codespacer interface {
	Codespace() string
}

type Coin

type Coin = DecCoin

func CoinAdapterToCoin

func CoinAdapterToCoin(adapter CoinAdapter) Coin

func ConvertCoin

func ConvertCoin(coin Coin, denom string) (Coin, error)

ConvertCoin attempts to convert a coin to a given denomination. If the given denomination is invalid or if neither denomination is registered, an error is returned.

func GetSystemFee

func GetSystemFee() Coin

func NewInt64Coin

func NewInt64Coin(denom string, amount int64) Coin

NewInt64Coin returns a new coin with a denomination and amount. It will panic if the amount is negative.

func NormalizeCoin

func NormalizeCoin(coin Coin) Coin

NormalizeCoin try to convert a coin to the smallest unit registered, returns original one if failed.

func ParseCoinNormalized

func ParseCoinNormalized(coinStr string) (coin Coin, err error)

ParseCoinNormalized parses and normalize a cli input for one coin type, returning errors if invalid or on an empty string as well. Expected format: "{amount}{denomination}"

func ZeroFee

func ZeroFee() Coin

type CoinAdapter

type CoinAdapter struct {
	Denom  string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	Amount Int    `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"`
}

CoinAdapter defines a token with a denomination and an amount.

NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto.

func CoinToCoinAdapter

func CoinToCoinAdapter(adapter Coin) CoinAdapter

func NewCoinAdapter

func NewCoinAdapter(denom string, amount Int) CoinAdapter

NewCoin returns a new coin with a denomination and amount. It will panic if the amount is negative or if the denomination is invalid.

func (CoinAdapter) Add

func (coin CoinAdapter) Add(coinB CoinAdapter) CoinAdapter

Add adds amounts of two coins with same denom. If the coins differ in denom then it panics.

func (CoinAdapter) AddAmount

func (coin CoinAdapter) AddAmount(amount Int) CoinAdapter

AddAmount adds an amount to the Coin.

func (*CoinAdapter) Descriptor

func (*CoinAdapter) Descriptor() ([]byte, []int)

func (*CoinAdapter) Equal

func (this *CoinAdapter) Equal(that interface{}) bool

func (*CoinAdapter) GetDenom

func (m *CoinAdapter) GetDenom() string

func (CoinAdapter) IsEqual

func (coin CoinAdapter) IsEqual(other CoinAdapter) bool

IsEqual returns true if the two sets of Coins have the same value

func (CoinAdapter) IsGTE

func (coin CoinAdapter) IsGTE(other CoinAdapter) bool

IsGTE returns true if they are the same type and the receiver is an equal or greater value

func (CoinAdapter) IsLT

func (coin CoinAdapter) IsLT(other CoinAdapter) bool

IsLT returns true if they are the same type and the receiver is a smaller value

func (CoinAdapter) IsNegative

func (coin CoinAdapter) IsNegative() bool

IsNegative returns true if the coin amount is negative and false otherwise.

TODO: Remove once unsigned integers are used.

func (CoinAdapter) IsPositive

func (coin CoinAdapter) IsPositive() bool

IsPositive returns true if coin amount is positive.

TODO: Remove once unsigned integers are used.

func (CoinAdapter) IsValid

func (coin CoinAdapter) IsValid() bool

IsValid returns true if the Coin has a non-negative amount and the denom is valid.

func (CoinAdapter) IsZero

func (coin CoinAdapter) IsZero() bool

IsZero returns if this represents no money

func (*CoinAdapter) Marshal

func (m *CoinAdapter) Marshal() (dAtA []byte, err error)

func (*CoinAdapter) MarshalTo

func (m *CoinAdapter) MarshalTo(dAtA []byte) (int, error)

func (*CoinAdapter) MarshalToSizedBuffer

func (m *CoinAdapter) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CoinAdapter) ProtoMessage

func (*CoinAdapter) ProtoMessage()

func (*CoinAdapter) Reset

func (m *CoinAdapter) Reset()

func (*CoinAdapter) Size

func (m *CoinAdapter) Size() (n int)

func (CoinAdapter) String

func (coin CoinAdapter) String() string

String provides a human-readable representation of a coin

func (CoinAdapter) Sub

func (coin CoinAdapter) Sub(coinB CoinAdapter) CoinAdapter

Sub subtracts amounts of two coins with same denom. If the coins differ in denom then it panics.

func (CoinAdapter) ToCoin

func (cs CoinAdapter) ToCoin() Coin

func (*CoinAdapter) Unmarshal

func (m *CoinAdapter) Unmarshal(dAtA []byte) error

func (CoinAdapter) Validate

func (coin CoinAdapter) Validate() error

Validate returns an error if the Coin has a negative amount or if the denom is invalid.

func (*CoinAdapter) XXX_DiscardUnknown

func (m *CoinAdapter) XXX_DiscardUnknown()

func (*CoinAdapter) XXX_Marshal

func (m *CoinAdapter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CoinAdapter) XXX_Merge

func (m *CoinAdapter) XXX_Merge(src proto.Message)

func (*CoinAdapter) XXX_Size

func (m *CoinAdapter) XXX_Size() int

func (*CoinAdapter) XXX_Unmarshal

func (m *CoinAdapter) XXX_Unmarshal(b []byte) error

type CoinAdapters

type CoinAdapters []CoinAdapter

func CoinsToCoinAdapters

func CoinsToCoinAdapters(coins Coins) CoinAdapters

func ConvWei2Tfibo

func ConvWei2Tfibo(adapters CoinAdapters) (CoinAdapters, error)

func (CoinAdapters) Add

func (coins CoinAdapters) Add(coinsB ...CoinAdapter) CoinAdapters

func (CoinAdapters) AmountOf

func (coins CoinAdapters) AmountOf(denom string) Int

AmountOf returns the amount of a denom from coins

func (CoinAdapters) AmountOfNoDenomValidation

func (coins CoinAdapters) AmountOfNoDenomValidation(denom string) Int

AmountOfNoDenomValidation returns the amount of a denom from coins without validating the denomination.

func (CoinAdapters) Copy

func (coins CoinAdapters) Copy() CoinAdapters

func (CoinAdapters) IsAllPositive

func (coins CoinAdapters) IsAllPositive() bool

IsAllPositive returns true if there is at least one coin and all currencies have a positive value.

func (CoinAdapters) IsAnyNegative

func (cas CoinAdapters) IsAnyNegative() bool

func (CoinAdapters) IsAnyNil

func (cas CoinAdapters) IsAnyNil() bool

func (CoinAdapters) IsValid

func (coins CoinAdapters) IsValid() bool

IsValid calls Validate and returns true when the Coins are sorted, have positive amount, with a valid and unique denomination (i.e no duplicates).

func (CoinAdapters) IsZero

func (coins CoinAdapters) IsZero() bool

func (CoinAdapters) MarshalJSON

func (coins CoinAdapters) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the Coins type to allow nil Coins to be encoded as an empty array.

func (CoinAdapters) SafeSub

func (coins CoinAdapters) SafeSub(coinsB CoinAdapters) (CoinAdapters, bool)

func (CoinAdapters) String

func (coins CoinAdapters) String() string

func (CoinAdapters) Sub

func (coins CoinAdapters) Sub(coinsB CoinAdapters) CoinAdapters

func (CoinAdapters) ToCoins

func (cs CoinAdapters) ToCoins() Coins

func (CoinAdapters) Validate

func (coins CoinAdapters) Validate() error

type Coins

type Coins = DecCoins

func CoinAdaptersToCoins

func CoinAdaptersToCoins(adapters CoinAdapters) Coins

func MustParseCoins

func MustParseCoins(denom, amount string) Coins

func NewCoins

func NewCoins(coins ...Coin) Coins

NewCoins constructs a new coin set.

func NewIBCCoins

func NewIBCCoins(coins ...Coin) Coins

NewCoins constructs a new coin set.

func NormalizeCoins

func NormalizeCoins(coins []DecCoin) Coins

NormalizeCoins normalize and truncate a list of decimal coins

func ParseCoinsNormalized

func ParseCoinsNormalized(coinStr string) (Coins, error)

ParseCoinsNormalized will parse out a list of coins separated by commas, and normalize them by converting to smallest unit. If the parsing is successuful, the provided coins will be sanitized by removing zero coins and sorting the coin set. Lastly a validation of the coin set is executed. If the check passes, ParseCoinsNormalized will return the sanitized coins. Otherwise it will return an error. If an empty string is provided to ParseCoinsNormalized, it returns nil Coins. ParseCoinsNormalized supports decimal coins as inputs, and truncate them to int after converted to smallest unit. Expected format: "{amount0}{denomination},...,{amountN}{denominationN}"

func (Coins) DenomsSubsetOf

func (coins Coins) DenomsSubsetOf(coinsB Coins) bool

DenomsSubsetOf returns true if receiver's denom set is subset of coinsB's denoms.

func (Coins) IsAllGT

func (coins Coins) IsAllGT(coinsB Coins) bool

IsAllGT returns true if for every denom in coinsB, the denom is present at a greater amount in coins.

func (Coins) IsAllGTE

func (coins Coins) IsAllGTE(coinsB Coins) bool

IsAllGTE returns false if for any denom in coinsB, the denom is present at a smaller amount in coins; else returns true.

func (Coins) IsAllLT

func (coins Coins) IsAllLT(coinsB Coins) bool

IsAllLT returns True iff for every denom in coins, the denom is present at a smaller amount in coinsB.

func (Coins) IsAllLTE

func (coins Coins) IsAllLTE(coinsB Coins) bool

IsAllLTE returns true iff for every denom in coins, the denom is present at a smaller or equal amount in coinsB.

func (Coins) IsAnyGT

func (coins Coins) IsAnyGT(coinsB Coins) bool

IsAnyGT returns true iff for any denom in coins, the denom is present at a greater amount in coinsB.

e.g. {2A, 3B}.IsAnyGT{A} = true {2A, 3B}.IsAnyGT{5C} = false {}.IsAnyGT{5C} = false {2A, 3B}.IsAnyGT{} = false

func (Coins) IsAnyGTE

func (coins Coins) IsAnyGTE(coinsB Coins) bool

IsAnyGTE returns true iff coins contains at least one denom that is present at a greater or equal amount in coinsB; it returns false otherwise.

NOTE: IsAnyGTE operates under the invariant that both coin sets are sorted by denominations and there exists no zero coins.

func (Coins) MarshalJSON

func (coins Coins) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom JSON marshaller for the Coins type to allow nil Coins to be encoded as an empty array.

type CommitID

type CommitID = types.CommitID

nolint - reexport

type CommitKVStore

type CommitKVStore = types.CommitKVStore

nolint - reexport

type CommitMultiStore

type CommitMultiStore = types.CommitMultiStore

nolint - reexport

type CommitStore

type CommitStore = types.CommitStore

nolint - reexport

type Committer

type Committer = types.Committer

nolint - reexport

type Config

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

Config is the structure that holds the SDK configuration parameters. This could be used to initialize certain configuration parameters for the SDK.

func GetConfig

func GetConfig() *Config

GetConfig returns the config instance for the SDK.

func GetSealedConfig

func GetSealedConfig(ctx context.Context) (*Config, error)

GetSealedConfig returns the config instance for the SDK if/once it is sealed.

func NewConfig

func NewConfig() *Config

New returns a new Config with default values.

func (*Config) GetAddressVerifier

func (config *Config) GetAddressVerifier() func([]byte) error

GetAddressVerifier returns the function to verify that addresses have the correct format

func (*Config) GetBech32AccountAddrPrefix

func (config *Config) GetBech32AccountAddrPrefix() string

GetBech32AccountAddrPrefix returns the Bech32 prefix for account address

func (*Config) GetBech32AccountPubPrefix

func (config *Config) GetBech32AccountPubPrefix() string

GetBech32AccountPubPrefix returns the Bech32 prefix for account public key

func (*Config) GetBech32ConsensusAddrPrefix

func (config *Config) GetBech32ConsensusAddrPrefix() string

GetBech32ConsensusAddrPrefix returns the Bech32 prefix for consensus node address

func (*Config) GetBech32ConsensusPubPrefix

func (config *Config) GetBech32ConsensusPubPrefix() string

GetBech32ConsensusPubPrefix returns the Bech32 prefix for consensus node public key

func (*Config) GetBech32ValidatorAddrPrefix

func (config *Config) GetBech32ValidatorAddrPrefix() string

GetBech32ValidatorAddrPrefix returns the Bech32 prefix for validator address

func (*Config) GetBech32ValidatorPubPrefix

func (config *Config) GetBech32ValidatorPubPrefix() string

GetBech32ValidatorPubPrefix returns the Bech32 prefix for validator public key

func (*Config) GetCoinType

func (config *Config) GetCoinType() uint32

GetCoinType returns the BIP-0044 CoinType code on the config.

func (*Config) GetFullFundraiserPath

func (config *Config) GetFullFundraiserPath() string

GetFullFundraiserPath returns the BIP44Prefix.

func (*Config) GetTxEncoder

func (config *Config) GetTxEncoder() TxEncoder

GetTxEncoder return function to encode transactions

func (*Config) Seal

func (config *Config) Seal() *Config

Seal seals the config such that the config state could not be modified further

func (*Config) SetAddressVerifier

func (config *Config) SetAddressVerifier(addressVerifier func([]byte) error)

SetAddressVerifier builds the Config with the provided function for verifying that addresses have the correct format

func (*Config) SetBech32PrefixForAccount

func (config *Config) SetBech32PrefixForAccount(addressPrefix, pubKeyPrefix string)

SetBech32PrefixForAccount builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts and returns the config instance

func (*Config) SetBech32PrefixForConsensusNode

func (config *Config) SetBech32PrefixForConsensusNode(addressPrefix, pubKeyPrefix string)

SetBech32PrefixForConsensusNode builds the Config with Bech32 addressPrefix and publKeyPrefix for consensus nodes and returns the config instance

func (*Config) SetBech32PrefixForValidator

func (config *Config) SetBech32PrefixForValidator(addressPrefix, pubKeyPrefix string)

SetBech32PrefixForValidator builds the Config with Bech32 addressPrefix and publKeyPrefix for validators

and returns the config instance

func (*Config) SetCoinType

func (config *Config) SetCoinType(coinType uint32)

Set the BIP-0044 CoinType code on the config

func (*Config) SetFullFundraiserPath

func (config *Config) SetFullFundraiserPath(fullFundraiserPath string)

Set the FullFundraiserPath (BIP44Prefix) on the config

func (*Config) SetTxEncoder

func (config *Config) SetTxEncoder(encoder TxEncoder)

SetTxEncoder builds the Config with TxEncoder used to marshal StdTx to bytes

type ConsAddress

type ConsAddress []byte

ConsAddress defines a wrapper around bytes meant to present a consensus node. When marshaled to a string or JSON, it uses Bech32.

func ConsAddressFromBech32

func ConsAddressFromBech32(address string) (addr ConsAddress, err error)

ConsAddressFromBech32 creates a ConsAddress from a Bech32 string.

func ConsAddressFromHex

func ConsAddressFromHex(address string) (addr ConsAddress, err error)

ConsAddressFromHex creates a ConsAddress from a hex string.

func GetConsAddress

func GetConsAddress(pubkey crypto.PubKey) ConsAddress

get ConsAddress from pubkey

func (ConsAddress) Bytes

func (ca ConsAddress) Bytes() []byte

Bytes returns the raw address bytes.

func (ConsAddress) Empty

func (ca ConsAddress) Empty() bool

Returns boolean for whether an ConsAddress is empty

func (ConsAddress) Equals

func (ca ConsAddress) Equals(ca2 Address) bool

Returns boolean for whether two ConsAddress are Equal

func (ConsAddress) Format

func (ca ConsAddress) Format(s fmt.State, verb rune)

Format implements the fmt.Formatter interface. nolint: errcheck

func (ConsAddress) Marshal

func (ca ConsAddress) Marshal() ([]byte, error)

Marshal returns the raw address bytes. It is needed for protobuf compatibility.

func (ConsAddress) MarshalJSON

func (ca ConsAddress) MarshalJSON() ([]byte, error)

MarshalJSON marshals to JSON using Bech32.

func (ConsAddress) MarshalYAML

func (ca ConsAddress) MarshalYAML() (interface{}, error)

MarshalYAML marshals to YAML using Bech32.

func (ConsAddress) String

func (ca ConsAddress) String() string

String implements the Stringer interface.

func (*ConsAddress) Unmarshal

func (ca *ConsAddress) Unmarshal(data []byte) error

Unmarshal sets the address to the given data. It is needed for protobuf compatibility.

func (*ConsAddress) UnmarshalJSON

func (ca *ConsAddress) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

func (*ConsAddress) UnmarshalYAML

func (ca *ConsAddress) UnmarshalYAML(data []byte) error

UnmarshalYAML unmarshals from YAML assuming Bech32 encoding.

type Context

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

Context is an immutable object contains all information needed to process a request.

It contains a context.Context object inside if you want to use that, but please do not over-use it. We try to keep all data structured and standard additions here would be better just to add to the Context struct

func NewContext

func NewContext(ms MultiStore, header abci.Header, isCheckTx bool, logger log.Logger) Context

NewContext create a new context

func UnwrapSDKContext

func UnwrapSDKContext(ctx context.Context) Context

UnwrapSDKContext retrieves a Context from a context.Context instance attached with WrapSDKContext. It panics if a Context was not properly attached

func (*Context) AccountNonce

func (c *Context) AccountNonce() uint64

func (*Context) AnteTracer

func (c *Context) AnteTracer() *trace.Tracer

func (*Context) BlockGasMeter

func (c *Context) BlockGasMeter() GasMeter

func (*Context) BlockHeader

func (c *Context) BlockHeader() abci.Header

BlockHeader clone the header before returning

func (*Context) BlockHeight

func (c *Context) BlockHeight() int64

func (*Context) BlockProposerAddress

func (c *Context) BlockProposerAddress() []byte

func (*Context) BlockTime

func (c *Context) BlockTime() time.Time

func (*Context) Cache

func (c *Context) Cache() *Cache

func (*Context) CacheContext

func (c *Context) CacheContext() (cc Context, writeCache func())

CacheContext returns a new Context with the multi-store cached and a new EventManager. The cached context is written to the context when writeCache is called.

func (*Context) ChainID

func (c *Context) ChainID() string

func (*Context) ConsensusParams

func (c *Context) ConsensusParams() *abci.ConsensusParams

func (*Context) Context

func (c *Context) Context() context.Context

Read-only accessors

func (*Context) DisableAccountCache

func (c *Context) DisableAccountCache()

func (*Context) EnableAccountCache

func (c *Context) EnableAccountCache()

func (*Context) EventManager

func (c *Context) EventManager() *EventManager

func (*Context) From

func (c *Context) From() string

func (*Context) GasMeter

func (c *Context) GasMeter() GasMeter

func (Context) GetFeeSplitInfo

func (c Context) GetFeeSplitInfo() *FeeSplitInfo

func (*Context) GetFromAccountCacheData

func (c *Context) GetFromAccountCacheData() interface{}

func (*Context) GetFromAccountCacheGas

func (c *Context) GetFromAccountCacheGas() Gas

func (*Context) GetReusableKVStore

func (c *Context) GetReusableKVStore(key StoreKey) KVStore

GetReusableKVStore fetches a KVStore from the MultiStore than can be reused. you must call ReturnKVStore() after you are done with the KVStore.

func (*Context) GetToAccountCacheData

func (c *Context) GetToAccountCacheData() interface{}

func (*Context) GetToAccountCacheGas

func (c *Context) GetToAccountCacheGas() Gas

func (*Context) GetWatcher

func (c *Context) GetWatcher() IWatcher

func (*Context) IsCheckTx

func (c *Context) IsCheckTx() bool

func (*Context) IsDeliver

func (c *Context) IsDeliver() bool

func (*Context) IsReCheckTx

func (c *Context) IsReCheckTx() bool

func (*Context) IsTraceTx

func (c *Context) IsTraceTx() bool

func (*Context) IsTraceTxLog

func (c *Context) IsTraceTxLog() bool

func (*Context) IsWrappedCheckTx

func (c *Context) IsWrappedCheckTx() bool

func (*Context) IsZero

func (c *Context) IsZero() bool

TODO: remove???

func (*Context) KVStore

func (c *Context) KVStore(key StoreKey) KVStore

KVStore fetches a KVStore from the MultiStore.

func (*Context) Logger

func (c *Context) Logger() log.Logger

func (*Context) MinGasPrices

func (c *Context) MinGasPrices() DecCoins

func (*Context) MultiStore

func (c *Context) MultiStore() MultiStore

func (*Context) OverrideBytes

func (c *Context) OverrideBytes() []byte

func (Context) ParaMsg

func (c Context) ParaMsg() *ParaMsg

func (*Context) ResetWatcher

func (c *Context) ResetWatcher()

func (*Context) ReturnKVStore

func (_ *Context) ReturnKVStore(store KVStore)

ReturnKVStore returns a KVStore than from GetReusableKVStore.

func (*Context) SetAccountNonce

func (c *Context) SetAccountNonce(nonce uint64) *Context

func (*Context) SetAnteTracer

func (c *Context) SetAnteTracer(trc *trace.Tracer) *Context

func (*Context) SetBlockGasMeter

func (c *Context) SetBlockGasMeter(meter GasMeter) *Context

func (*Context) SetBlockHeader

func (c *Context) SetBlockHeader(header abci.Header) *Context

func (*Context) SetBlockHeight

func (c *Context) SetBlockHeight(height int64) *Context

func (*Context) SetBlockTime

func (c *Context) SetBlockTime(newTime time.Time) *Context

func (*Context) SetCache

func (c *Context) SetCache(cache *Cache) *Context

func (*Context) SetChainID

func (c *Context) SetChainID(chainID string) *Context

func (*Context) SetConsensusParams

func (c *Context) SetConsensusParams(params *abci.ConsensusParams) *Context

func (*Context) SetContext

func (c *Context) SetContext(ctx context.Context) *Context

func (*Context) SetDeliver

func (c *Context) SetDeliver() *Context

func (*Context) SetEventManager

func (c *Context) SetEventManager(em *EventManager) *Context

func (*Context) SetFeeSplitInfo

func (c *Context) SetFeeSplitInfo(f *FeeSplitInfo) *Context

func (*Context) SetFrom

func (c *Context) SetFrom(from string) *Context

func (*Context) SetGasMeter

func (c *Context) SetGasMeter(meter GasMeter) *Context

func (*Context) SetIsCheckTx

func (c *Context) SetIsCheckTx(isCheckTx bool) *Context

func (*Context) SetIsDeliverTx

func (c *Context) SetIsDeliverTx(isDeliverTx bool) *Context

func (*Context) SetIsReCheckTx

func (c *Context) SetIsReCheckTx(isRecheckTx bool) *Context

SetIsReCheckTx called with true will also set true on checkTx in order to enforce the invariant that if recheckTx = true then checkTx = true as well.

func (*Context) SetIsTraceTx

func (c *Context) SetIsTraceTx(isTraceTx bool) *Context

func (*Context) SetIsTraceTxLog

func (c *Context) SetIsTraceTxLog(isTraceTxLog bool) *Context

func (*Context) SetIsWrappedCheckTx

func (c *Context) SetIsWrappedCheckTx(isWrappedCheckTx bool) *Context

SetIsWrappedCheckTx called with true will also set true on checkTx in order to enforce the invariant that if recheckTx = true then checkTx = true as well.

func (*Context) SetLogger

func (c *Context) SetLogger(logger log.Logger) *Context

func (*Context) SetMinGasPrices

func (c *Context) SetMinGasPrices(gasPrices DecCoins) *Context

func (*Context) SetMultiStore

func (c *Context) SetMultiStore(ms MultiStore) *Context

func (*Context) SetOverrideBytes

func (c *Context) SetOverrideBytes(b []byte) *Context

func (*Context) SetParaMsg

func (c *Context) SetParaMsg(m *ParaMsg) *Context

func (*Context) SetProposer

func (c *Context) SetProposer(addr ConsAddress) *Context

func (*Context) SetTraceTxLogConfig

func (c *Context) SetTraceTxLogConfig(traceLogConfigBytes []byte) *Context

func (*Context) SetTxBytes

func (c *Context) SetTxBytes(txBytes []byte) *Context

func (*Context) SetVoteInfos

func (c *Context) SetVoteInfos(voteInfo []abci.VoteInfo) *Context

func (*Context) SetWatcher

func (c *Context) SetWatcher(w IWatcher)

func (*Context) TraceTxLogConfig

func (c *Context) TraceTxLogConfig() []byte

func (*Context) TransientStore

func (c *Context) TransientStore(key StoreKey) KVStore

TransientStore fetches a TransientStore from the MultiStore.

func (*Context) TxBytes

func (c *Context) TxBytes() []byte

func (*Context) UpdateFromAccountCache

func (c *Context) UpdateFromAccountCache(fromAcc interface{}, fromAccGettedGas Gas)

func (*Context) UpdateToAccountCache

func (c *Context) UpdateToAccountCache(toAcc interface{}, toAccGotGas Gas)

func (*Context) UseParamCache

func (c *Context) UseParamCache() bool

func (Context) Value

func (c Context) Value(key interface{}) interface{}

Value is deprecated, provided for backwards compatibility Please use

ctx.Context().Value(key)

instead of

ctx.Value(key)

func (*Context) VoteInfos

func (c *Context) VoteInfos() []abci.VoteInfo

func (Context) WithBlockHeight

func (c Context) WithBlockHeight(height int64) Context

func (Context) WithBlockTime

func (c Context) WithBlockTime(newTime time.Time) Context

func (Context) WithIsCheckTx

func (c Context) WithIsCheckTx(isCheckTx bool) Context

func (Context) WithIsReCheckTx

func (c Context) WithIsReCheckTx(isRecheckTx bool) Context

WithIsReCheckTx called with true will also set true on checkTx in order to enforce the invariant that if recheckTx = true then checkTx = true as well.

func (Context) WithIsTraceTxLog

func (c Context) WithIsTraceTxLog(isTraceTxLog bool) Context

func (Context) WithValue

func (c Context) WithValue(key, value interface{}) Context

WithValue is deprecated, provided for backwards compatibility Please use

ctx = ctx.WithContext(context.WithValue(ctx.Context(), key, false))

instead of

ctx = ctx.WithValue(key, false)

type ContextKey

type ContextKey string

ContextKey defines a type alias for a stdlib Context key.

const SdkContextKey ContextKey = "sdk-context"

SdkContextKey is the key in the context.Context which holds the sdk.Context.

type CustomizeOnStop

type CustomizeOnStop func(ctx Context) error

type Dec

type Dec struct {
	*big.Int `json:"int"`
}

NOTE: never use new(Dec) or else we will panic unmarshalling into the nil embedded big.Int

func GetDenomUnit

func GetDenomUnit(denom string) (Dec, bool)

GetDenomUnit returns a unit for a given denomination if it exists. A boolean is returned if the denomination is registered.

func MaxDec

func MaxDec(d1, d2 Dec) Dec

maximum decimal between two

func MinDec

func MinDec(d1, d2 Dec) Dec

minimum decimal between two

func MustNewDecFromStr

func MustNewDecFromStr(s string) Dec

Decimal from string, panic on error

func NewDec

func NewDec(i int64) Dec

create a new Dec from integer assuming whole number

func NewDecFromBigInt

func NewDecFromBigInt(i *big.Int) Dec

create a new Dec from big integer assuming whole numbers CONTRACT: prec <= Precision

func NewDecFromBigIntWithPrec

func NewDecFromBigIntWithPrec(i *big.Int, prec int64) Dec

create a new Dec from big integer assuming whole numbers CONTRACT: prec <= Precision

func NewDecFromInt

func NewDecFromInt(i Int) Dec

create a new Dec from big integer assuming whole numbers CONTRACT: prec <= Precision

func NewDecFromIntWithPrec

func NewDecFromIntWithPrec(i Int, prec int64) Dec

create a new Dec from big integer with decimal place at prec CONTRACT: prec <= Precision

func NewDecFromStr

func NewDecFromStr(str string) (Dec, error)

create a decimal from an input decimal string. valid must come in the form:

(-) whole integers (.) decimal integers

examples of acceptable input include:

-123.456
456.7890
345
-456789

NOTE - An error will return if more decimal places are provided in the string than the constant Precision.

CONTRACT - This function does not mutate the input str.

func NewDecWithBigIntAndPrec

func NewDecWithBigIntAndPrec(i *big.Int, prec int64) Dec

NewDecWithBigIntAndPrec create a new Dec from big integer assuming whole numbers CONTRACT: prec <= Precision The new Dec takes ownership of i, and the caller should not use i after this call

func NewDecWithPrec

func NewDecWithPrec(i, prec int64) Dec

create a new Dec from integer with decimal place at prec CONTRACT: prec <= Precision

func OneDec

func OneDec() Dec

func SmallestDec

func SmallestDec() Dec

func ZeroDec

func ZeroDec() Dec

func (Dec) Abs

func (d Dec) Abs() Dec

func (Dec) Add

func (d Dec) Add(d2 Dec) Dec

addition

func (Dec) AminoSize

func (d Dec) AminoSize(_ *amino.Codec) int

func (Dec) ApproxRoot

func (d Dec) ApproxRoot(root uint64) (guess Dec, err error)

ApproxRoot returns an approximate estimation of a Dec's positive real nth root using Newton's method (where n is positive). The algorithm starts with some guess and computes the sequence of improved guesses until an answer converges to an approximate answer. It returns `|d|.ApproxRoot() * -1` if input is negative. A maximum number of 100 iterations is used a backup boundary condition for cases where the answer never converges enough to satisfy the main condition.

func (Dec) ApproxSqrt

func (d Dec) ApproxSqrt() (Dec, error)

ApproxSqrt is a wrapper around ApproxRoot for the common special case of finding the square root of a number. It returns -(sqrt(abs(d)) if input is negative.

func (Dec) BigInt

func (d Dec) BigInt() *big.Int

BigInt returns a copy of the underlying big.Int.

func (Dec) Ceil

func (d Dec) Ceil() Dec

Ceil returns the smallest interger value (as a decimal) that is greater than or equal to the given decimal.

func (Dec) Equal

func (d Dec) Equal(d2 Dec) bool

func (Dec) Format

func (d Dec) Format(s fmt.State, verb rune)

format decimal state

func (Dec) GT

func (d Dec) GT(d2 Dec) bool

func (Dec) GTE

func (d Dec) GTE(d2 Dec) bool

func (Dec) IsInteger

func (d Dec) IsInteger() bool

is integer, e.g. decimals are zero

func (Dec) IsNegative

func (d Dec) IsNegative() bool

func (Dec) IsNil

func (d Dec) IsNil() bool

______________________________________________________________________________________________ nolint

func (Dec) IsPositive

func (d Dec) IsPositive() bool

func (Dec) IsZero

func (d Dec) IsZero() bool

func (Dec) LT

func (d Dec) LT(d2 Dec) bool

func (Dec) LTE

func (d Dec) LTE(d2 Dec) bool

func (Dec) Marshal

func (d Dec) Marshal() ([]byte, error)

func (Dec) MarshalAmino

func (d Dec) MarshalAmino() (string, error)

wraps d.MarshalText()

func (Dec) MarshalJSON

func (d Dec) MarshalJSON() ([]byte, error)

MarshalJSON marshals the decimal

func (*Dec) MarshalTo

func (d *Dec) MarshalTo(data []byte) (n int, err error)

MarshalTo implements the gogo proto custom type interface.

func (Dec) MarshalToAmino

func (d Dec) MarshalToAmino(_ *amino.Codec) ([]byte, error)

func (Dec) MarshalYAML

func (d Dec) MarshalYAML() (interface{}, error)

MarshalYAML returns Ythe AML representation.

func (Dec) Mul

func (d Dec) Mul(d2 Dec) Dec

multiplication

func (Dec) MulInt

func (d Dec) MulInt(i Int) Dec

multiplication

func (Dec) MulInt64

func (d Dec) MulInt64(i int64) Dec

MulInt64 - multiplication with int64

func (Dec) MulInt64To

func (d Dec) MulInt64To(i int64, d2 *Dec)

MulInt64To - multiplication with int64 and store result in d2

func (Dec) MulTruncate

func (d Dec) MulTruncate(d2 Dec) Dec

multiplication truncate

func (Dec) Neg

func (d Dec) Neg() Dec

func (Dec) Power

func (d Dec) Power(power uint64) Dec

Power returns a the result of raising to a positive integer power

func (Dec) Quo

func (d Dec) Quo(d2 Dec) Dec

quotient

func (Dec) QuoInt

func (d Dec) QuoInt(i Int) Dec

quotient

func (Dec) QuoInt64

func (d Dec) QuoInt64(i int64) Dec

QuoInt64 - quotient with int64

func (Dec) QuoRoundUp

func (d Dec) QuoRoundUp(d2 Dec) Dec

quotient, round up

func (Dec) QuoTruncate

func (d Dec) QuoTruncate(d2 Dec) Dec

quotient truncate

func (Dec) RoundDecimal

func (d Dec) RoundDecimal(precision int64) Dec

Round a decimal with precision, perform bankers rounding (gaussian rounding)

func (Dec) RoundInt

func (d Dec) RoundInt() Int

RoundInt round the decimal using bankers rounding

func (Dec) RoundInt64

func (d Dec) RoundInt64() int64

RoundInt64 rounds the decimal using bankers rounding

func (*Dec) Size

func (d *Dec) Size() int

Size implements the gogo proto custom type interface.

func (Dec) String

func (d Dec) String() string

func (Dec) Sub

func (d Dec) Sub(d2 Dec) Dec

subtraction

func (Dec) TruncateDec

func (d Dec) TruncateDec() Dec

TruncateDec truncates the decimals from the number and returns a Dec

func (Dec) TruncateInt

func (d Dec) TruncateInt() Int

TruncateInt truncates the decimals from the number and returns an Int

func (Dec) TruncateInt64

func (d Dec) TruncateInt64() int64

TruncateInt64 truncates the decimals from the number and returns an int64

func (Dec) TruncateWithPrec

func (d Dec) TruncateWithPrec(prec int64) Int

TruncateWithPrec truncates an integer based on precision

func (*Dec) Unmarshal

func (d *Dec) Unmarshal(data []byte) error

Unmarshal implements the gogo proto custom type interface.

func (*Dec) UnmarshalAmino

func (d *Dec) UnmarshalAmino(text string) (err error)

requires a valid JSON string - strings quotes and calls UnmarshalText

func (*Dec) UnmarshalFromAmino

func (d *Dec) UnmarshalFromAmino(_ *amino.Codec, data []byte) error

func (*Dec) UnmarshalJSON

func (d *Dec) UnmarshalJSON(bz []byte) error

UnmarshalJSON defines custom decoding scheme

type DecCoin

type DecCoin struct {
	Denom  string `json:"denom"`
	Amount Dec    `json:"amount"`
}

DecCoin defines a coin which can have additional decimal points

func ConvertDecCoin

func ConvertDecCoin(coin DecCoin, denom string) (DecCoin, error)

ConvertDecCoin attempts to convert a decimal coin to a given denomination. If the given denomination is invalid or if neither denomination is registered, an error is returned.

func IBCParseDecCoin

func IBCParseDecCoin(coinStr string) (coin DecCoin, err error)

func NewCoin

func NewCoin(denom string, amount interface{}) DecCoin

func NewDecCoin

func NewDecCoin(denom string, amount Int) DecCoin

NewDecCoin creates a new DecCoin instance from an Int.

func NewDecCoinFromCoin

func NewDecCoinFromCoin(coin Coin) DecCoin

NewDecCoinFromCoin creates a new DecCoin from a Coin.

func NewDecCoinFromDec

func NewDecCoinFromDec(denom string, amount Dec) DecCoin

NewDecCoinFromDec creates a new DecCoin instance from a Dec.

func NewIBCCoin

func NewIBCCoin(denom string, amount interface{}) DecCoin

func NewIBCDecCoin

func NewIBCDecCoin(denom string, amount Int) DecCoin

func NewInt64DecCoin

func NewInt64DecCoin(denom string, amount int64) DecCoin

NewInt64DecCoin returns a new DecCoin with a denomination and amount. It will panic if the amount is negative or denom is invalid.

func NormalizeDecCoin

func NormalizeDecCoin(coin DecCoin) DecCoin

NormalizeDecCoin try to convert a decimal coin to the smallest unit registered, returns original one if failed.

func ParseDecCoin

func ParseDecCoin(coinStr string) (coin DecCoin, err error)

ParseDecCoin parses a decimal coin from a string, returning an error if invalid. An empty string is considered invalid.

func (DecCoin) Add

func (coin DecCoin) Add(coinB DecCoin) DecCoin

Add adds amounts of two decimal coins with same denom.

func (DecCoin) AminoSize

func (coin DecCoin) AminoSize(cdc *amino.Codec) int

func (DecCoin) IsEqual

func (coin DecCoin) IsEqual(other DecCoin) bool

IsEqual returns true if the two sets of Coins have the same value.

func (DecCoin) IsGTE

func (coin DecCoin) IsGTE(other DecCoin) bool

IsGTE returns true if they are the same type and the receiver is an equal or greater value.

func (DecCoin) IsLT

func (coin DecCoin) IsLT(other DecCoin) bool

IsLT returns true if they are the same type and the receiver is a smaller value.

func (DecCoin) IsNegative

func (coin DecCoin) IsNegative() bool

IsNegative returns true if the coin amount is negative and false otherwise.

TODO: Remove once unsigned integers are used.

func (DecCoin) IsPositive

func (coin DecCoin) IsPositive() bool

IsPositive returns true if coin amount is positive.

TODO: Remove once unsigned integers are used.

func (DecCoin) IsValid

func (coin DecCoin) IsValid() bool

IsValid returns true if the DecCoin has a non-negative amount and the denom is vaild.

func (DecCoin) IsZero

func (coin DecCoin) IsZero() bool

IsZero returns if the DecCoin amount is zero.

func (DecCoin) MarshalAminoTo

func (coin DecCoin) MarshalAminoTo(cdc *amino.Codec, buf *bytes.Buffer) error

func (DecCoin) MarshalToAmino

func (coin DecCoin) MarshalToAmino(cdc *amino.Codec) ([]byte, error)

func (DecCoin) String

func (coin DecCoin) String() string

String implements the Stringer interface for DecCoin. It returns a human-readable representation of a decimal coin.

func (DecCoin) Sub

func (coin DecCoin) Sub(coinB DecCoin) DecCoin

Sub subtracts amounts of two decimal coins with same denom.

func (DecCoin) ToCoins

func (dec DecCoin) ToCoins() Coins

func (DecCoin) TruncateDecimal

func (coin DecCoin) TruncateDecimal() (Coin, DecCoin)

TruncateDecimal returns a Coin with a truncated decimal and a DecCoin for the change. Note, the change may be zero.

func (DecCoin) TruncateWithPrec

func (coin DecCoin) TruncateWithPrec(prec int64) (Coin, DecCoin)

TruncateWithPrec returns a Coin with a truncated coin and a DecCoin for the change with prec, Note, the change may be zero.

func (*DecCoin) UnmarshalFromAmino

func (coin *DecCoin) UnmarshalFromAmino(cdc *amino.Codec, data []byte) error

type DecCoinAdapter

type DecCoinAdapter struct {
	Denom  string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	Amount Dec    `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Dec" json:"amount"`
}

DecCoinAdapter defines a token with a denomination and a decimal amount.

NOTE: The amount field is an Dec which implements the custom method signatures required by gogoproto.

func (*DecCoinAdapter) Descriptor

func (*DecCoinAdapter) Descriptor() ([]byte, []int)

func (*DecCoinAdapter) Equal

func (this *DecCoinAdapter) Equal(that interface{}) bool

func (*DecCoinAdapter) GetDenom

func (m *DecCoinAdapter) GetDenom() string

func (*DecCoinAdapter) Marshal

func (m *DecCoinAdapter) Marshal() (dAtA []byte, err error)

func (*DecCoinAdapter) MarshalTo

func (m *DecCoinAdapter) MarshalTo(dAtA []byte) (int, error)

func (*DecCoinAdapter) MarshalToSizedBuffer

func (m *DecCoinAdapter) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DecCoinAdapter) ProtoMessage

func (*DecCoinAdapter) ProtoMessage()

func (*DecCoinAdapter) Reset

func (m *DecCoinAdapter) Reset()

func (*DecCoinAdapter) Size

func (m *DecCoinAdapter) Size() (n int)

func (DecCoinAdapter) String

func (coin DecCoinAdapter) String() string

func (*DecCoinAdapter) Unmarshal

func (m *DecCoinAdapter) Unmarshal(dAtA []byte) error

func (*DecCoinAdapter) XXX_DiscardUnknown

func (m *DecCoinAdapter) XXX_DiscardUnknown()

func (*DecCoinAdapter) XXX_Marshal

func (m *DecCoinAdapter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DecCoinAdapter) XXX_Merge

func (m *DecCoinAdapter) XXX_Merge(src proto.Message)

func (*DecCoinAdapter) XXX_Size

func (m *DecCoinAdapter) XXX_Size() int

func (*DecCoinAdapter) XXX_Unmarshal

func (m *DecCoinAdapter) XXX_Unmarshal(b []byte) error

type DecCoins

type DecCoins []DecCoin

DecCoins defines a slice of coins with decimal values

func NewDecCoins

func NewDecCoins(decCoins ...DecCoin) DecCoins

NewDecCoins constructs a new coin set with with decimal values from DecCoins.

func NewDecCoinsFromCoins

func NewDecCoinsFromCoins(coins ...Coin) DecCoins

NewDecCoinsFromCoin constructs a new coin set with decimal values from regular Coins.

func NewDecCoinsFromDec

func NewDecCoinsFromDec(denom string, amount Dec) DecCoins

func ParseDecCoins

func ParseDecCoins(coinsStr string) (DecCoins, error)

ParseDecCoins will parse out a list of decimal coins separated by commas. If nothing is provided, it returns nil DecCoins. Returned decimal coins are sorted.

func (DecCoins) Add

func (coins DecCoins) Add(coinsB ...DecCoin) DecCoins

Add adds two sets of DecCoins.

NOTE: Add operates under the invariant that coins are sorted by denominations.

CONTRACT: Add will never return Coins where one Coin has a non-positive amount. In otherwords, IsValid will always return true.

func (DecCoins) Add2

func (coins DecCoins) Add2(coinsB DecCoins) DecCoins

func (DecCoins) AmountOf

func (coins DecCoins) AmountOf(denom string) Dec

AmountOf returns the amount of a denom from deccoins

func (DecCoins) Empty

func (coins DecCoins) Empty() bool

Empty returns true if there are no coins and false otherwise.

func (DecCoins) GetDenomByIndex

func (coins DecCoins) GetDenomByIndex(i int) string

GetDenomByIndex returns the Denom to make the findDup generic

func (DecCoins) Intersect

func (coins DecCoins) Intersect(coinsB DecCoins) DecCoins

Intersect will return a new set of coins which contains the minimum DecCoin for common denoms found in both `coins` and `coinsB`. For denoms not common to both `coins` and `coinsB` the minimum is considered to be 0, thus they are not added to the final set.In other words, trim any denom amount from coin which exceeds that of coinB, such that (coin.Intersect(coinB)).IsLTE(coinB).

func (DecCoins) IsAllPositive

func (coins DecCoins) IsAllPositive() bool

IsAllPositive returns true if there is at least one coin and all currencies have a positive value.

TODO: Remove once unsigned integers are used.

func (DecCoins) IsAnyNegative

func (coins DecCoins) IsAnyNegative() bool

IsAnyNegative returns true if there is at least one coin whose amount is negative; returns false otherwise. It returns false if the DecCoins set is empty too.

TODO: Remove once unsigned integers are used.

func (DecCoins) IsEqual

func (coins DecCoins) IsEqual(coinsB DecCoins) bool

IsEqual returns true if the two sets of DecCoins have the same value.

func (DecCoins) IsValid

func (coins DecCoins) IsValid() bool

IsValid asserts the DecCoins are sorted, have positive amount, and Denom does not contain upper case characters.

func (DecCoins) IsZero

func (coins DecCoins) IsZero() bool

IsZero returns whether all coins are zero

func (DecCoins) Len

func (coins DecCoins) Len() int

nolint

func (DecCoins) Less

func (coins DecCoins) Less(i, j int) bool

func (DecCoins) MulDec

func (coins DecCoins) MulDec(d Dec) DecCoins

MulDec multiplies all the coins by a decimal.

CONTRACT: No zero coins will be returned.

func (DecCoins) MulDecTruncate

func (coins DecCoins) MulDecTruncate(d Dec) DecCoins

MulDecTruncate multiplies all the decimal coins by a decimal, truncating. It panics if d is zero.

CONTRACT: No zero coins will be returned.

func (DecCoins) QuoDec

func (coins DecCoins) QuoDec(d Dec) DecCoins

QuoDec divides all the decimal coins by a decimal. It panics if d is zero.

CONTRACT: No zero coins will be returned.

func (DecCoins) QuoDecTruncate

func (coins DecCoins) QuoDecTruncate(d Dec) DecCoins

QuoDecTruncate divides all the decimal coins by a decimal, truncating. It panics if d is zero.

CONTRACT: No zero coins will be returned.

func (DecCoins) SafeSub

func (coins DecCoins) SafeSub(coinsB DecCoins) (DecCoins, bool)

SafeSub performs the same arithmetic as Sub but returns a boolean if any negative coin amount was returned.

func (DecCoins) Sort

func (coins DecCoins) Sort() DecCoins

Sort is a helper function to sort the set of decimal coins in-place.

func (DecCoins) String

func (coins DecCoins) String() string

String implements the Stringer interface for DecCoins. It returns a human-readable representation of decimal coins.

func (DecCoins) Sub

func (coins DecCoins) Sub(coinsB DecCoins) DecCoins

Sub subtracts a set of DecCoins from another (adds the inverse).

func (DecCoins) Swap

func (coins DecCoins) Swap(i, j int)

func (DecCoins) TruncateDecimal

func (coins DecCoins) TruncateDecimal() (truncatedCoins Coins, changeCoins DecCoins)

TruncateDecimal returns the coins with truncated decimals and returns the change. Note, it will not return any zero-amount coins in either the truncated or change coins.

func (DecCoins) TruncateWithPrec

func (coins DecCoins) TruncateWithPrec(prec int64) (truncatedCoins Coins, changeCoins DecCoins)

TruncateWithPrec returns the coins with truncated fix coins and returns the change with prec. Note, it will not return any zero-amount coins in either the truncated or change coins.

type DecProtoAdapter

type DecProtoAdapter struct {
	Dec Dec `protobuf:"bytes,1,opt,name=dec,proto3,customtype=Dec" json:"dec"`
}

DecProtoAdapter defines a Protobuf wrapper around a Dec object.

func (*DecProtoAdapter) Descriptor

func (*DecProtoAdapter) Descriptor() ([]byte, []int)

func (*DecProtoAdapter) Marshal

func (m *DecProtoAdapter) Marshal() (dAtA []byte, err error)

func (*DecProtoAdapter) MarshalTo

func (m *DecProtoAdapter) MarshalTo(dAtA []byte) (int, error)

func (*DecProtoAdapter) MarshalToSizedBuffer

func (m *DecProtoAdapter) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DecProtoAdapter) ProtoMessage

func (*DecProtoAdapter) ProtoMessage()

func (*DecProtoAdapter) Reset

func (m *DecProtoAdapter) Reset()

func (*DecProtoAdapter) Size

func (m *DecProtoAdapter) Size() (n int)

func (DecProtoAdapter) String

func (dp DecProtoAdapter) String() string

func (*DecProtoAdapter) Unmarshal

func (m *DecProtoAdapter) Unmarshal(dAtA []byte) error

func (*DecProtoAdapter) XXX_DiscardUnknown

func (m *DecProtoAdapter) XXX_DiscardUnknown()

func (*DecProtoAdapter) XXX_Marshal

func (m *DecProtoAdapter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DecProtoAdapter) XXX_Merge

func (m *DecProtoAdapter) XXX_Merge(src proto.Message)

func (*DecProtoAdapter) XXX_Size

func (m *DecProtoAdapter) XXX_Size() int

func (*DecProtoAdapter) XXX_Unmarshal

func (m *DecProtoAdapter) XXX_Unmarshal(b []byte) error

type EmptyWatcher

type EmptyWatcher struct {
}

func (EmptyWatcher) DeleteAccount

func (e EmptyWatcher) DeleteAccount(account interface{})

func (EmptyWatcher) DeleteContractBlockedList

func (e EmptyWatcher) DeleteContractBlockedList(addr interface{})

func (EmptyWatcher) DeleteContractDeploymentWhitelist

func (e EmptyWatcher) DeleteContractDeploymentWhitelist(addr interface{})

func (EmptyWatcher) Destruct

func (e EmptyWatcher) Destruct() []WatchMessage

func (EmptyWatcher) Enabled

func (e EmptyWatcher) Enabled() bool

func (EmptyWatcher) Finalize

func (e EmptyWatcher) Finalize()

func (EmptyWatcher) SaveAccount

func (e EmptyWatcher) SaveAccount(account interface{})

func (EmptyWatcher) SaveContractBlockedListItem

func (e EmptyWatcher) SaveContractBlockedListItem(addr interface{})

func (EmptyWatcher) SaveContractCode

func (e EmptyWatcher) SaveContractCode(addr common.Address, code []byte, height uint64)

func (EmptyWatcher) SaveContractCodeByHash

func (e EmptyWatcher) SaveContractCodeByHash(hash []byte, code []byte)

func (EmptyWatcher) SaveContractDeploymentWhitelistItem

func (e EmptyWatcher) SaveContractDeploymentWhitelistItem(addr interface{})

func (EmptyWatcher) SaveContractMethodBlockedListItem

func (e EmptyWatcher) SaveContractMethodBlockedListItem(addr interface{}, methods []byte)

func (EmptyWatcher) SaveState

func (e EmptyWatcher) SaveState(addr common.Address, key, value []byte)

type EndBlocker

type EndBlocker func(ctx Context, req abci.RequestEndBlock) abci.ResponseEndBlock

EndBlocker runs code after the transactions in a block and return updates to the validator set

Note: applications which set create_empty_blocks=false will not have regular block timing and should use e.g. BFT timestamps rather than block height for any periodic EndBlock logic

type EnvRegexp

type EnvRegexp struct {
	*regexp.Regexp
}

func (*EnvRegexp) FindStringSubmatch

func (r *EnvRegexp) FindStringSubmatch(coinStr string) []string

type EnvelopedErr

type EnvelopedErr struct {
	Err Error
}

func ErrGasOverflow

func ErrGasOverflow(msg string) EnvelopedErr

func ErrInsufficientCoins

func ErrInsufficientCoins(msg string) EnvelopedErr

func ErrInsufficientFee

func ErrInsufficientFee(msg string) EnvelopedErr

func ErrInsufficientFunds

func ErrInsufficientFunds(msg string) EnvelopedErr

func ErrInternal

func ErrInternal(msg string) EnvelopedErr

func ErrInvalidAddress

func ErrInvalidAddress(msg string) EnvelopedErr

func ErrInvalidCoins

func ErrInvalidCoins(msg string) EnvelopedErr

func ErrInvalidPubKey

func ErrInvalidPubKey(msg string) EnvelopedErr

func ErrInvalidSequence

func ErrInvalidSequence(msg string) EnvelopedErr

func ErrMemoTooLarge

func ErrMemoTooLarge(msg string) EnvelopedErr

func ErrNoSignatures

func ErrNoSignatures(msg string) EnvelopedErr

func ErrOutOfGas

func ErrOutOfGas(msg string) EnvelopedErr

func ErrTooManySignatures

func ErrTooManySignatures(msg string) EnvelopedErr

func ErrTxDecode

func ErrTxDecode(msg string) EnvelopedErr

func ErrUnauthorized

func ErrUnauthorized(msg string) EnvelopedErr

func ErrUnknownAddress

func ErrUnknownAddress(msg string) EnvelopedErr

func ErrUnknownRequest

func ErrUnknownRequest(msg string) EnvelopedErr

func (EnvelopedErr) ABCICode

func (e EnvelopedErr) ABCICode() uint32

func (EnvelopedErr) Codespace

func (e EnvelopedErr) Codespace() string

func (EnvelopedErr) Error

func (err EnvelopedErr) Error() string

func (EnvelopedErr) Result

func (err EnvelopedErr) Result() (*Result, error)

type Error

type Error = error

type ErrorGasOverflow

type ErrorGasOverflow = types.ErrorGasOverflow

nolint - reexport

type ErrorOutOfGas

type ErrorOutOfGas = types.ErrorOutOfGas

nolint - reexport

type Event

type Event abci.Event

Event is a type alias for an ABCI Event

func NewEvent

func NewEvent(ty string, attrs ...Attribute) Event

NewEvent creates a new Event object with a given type and slice of one or more attributes.

func (Event) AppendAttributes

func (e Event) AppendAttributes(attrs ...Attribute) Event

AppendAttributes adds one or more attributes to an Event.

type EventManager

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

EventManager implements a simple wrapper around a slice of Event objects that can be emitted from.

func NewEventManager

func NewEventManager() *EventManager

func (EventManager) ABCIEvents

func (em EventManager) ABCIEvents() []abci.Event

ABCIEvents returns all stored Event objects as abci.Event objects.

func (*EventManager) EmitEvent

func (em *EventManager) EmitEvent(event Event)

EmitEvent stores a single Event object.

func (*EventManager) EmitEvents

func (em *EventManager) EmitEvents(events Events)

EmitEvents stores a series of Event objects.

func (*EventManager) Events

func (em *EventManager) Events() Events

type Events

type Events []Event

Events defines a slice of Event objects

func EmptyEvents

func EmptyEvents() Events

EmptyEvents returns an empty slice of events.

func (Events) AppendEvent

func (e Events) AppendEvent(event Event) Events

AppendEvent adds an Event to a slice of events.

func (Events) AppendEvents

func (e Events) AppendEvents(events Events) Events

AppendEvents adds a slice of Event objects to an exist slice of Event objects.

func (Events) ToABCIEvents

func (e Events) ToABCIEvents() []abci.Event

ToABCIEvents converts a slice of Event objects to a slice of abci.Event objects.

type EvmSysContractAddressHandler

type EvmSysContractAddressHandler func(ctx Context, addr AccAddress) bool

type EvmWatcherCollector

type EvmWatcherCollector func(...IWatcher)

type FeeSplitInfo

type FeeSplitInfo struct {
	Addr   AccAddress
	Fee    Coins
	HasFee bool
}

type Gas

type Gas = types.Gas

nolint - reexport

type GasConfig

type GasConfig = types.GasConfig

nolint - reexport

type GasInfo

type GasInfo struct {
	// GasWanted is the maximum units of work we allow this tx to perform.
	GasWanted uint64

	// GasUsed is the amount of gas actually consumed.
	GasUsed uint64
}

GasInfo defines tx execution gas context.

type GasMeter

type GasMeter = types.GasMeter

nolint - reexport

func NewGasMeter

func NewGasMeter(limit Gas) GasMeter

nolint - reexport

func NewInfiniteGasMeter

func NewInfiniteGasMeter() GasMeter

nolint - reexport

type GasRefundHandler

type GasRefundHandler func(ctx Context, tx Tx) (fee Coins, err error)

type GetTxFeeAndFromHandler

type GetTxFeeAndFromHandler func(ctx Context, tx Tx) (Coins, bool, string, string, error)

type GetTxFeeHandler

type GetTxFeeHandler func(tx Tx) Coins

type Handler

type Handler func(ctx Context, msg Msg) (*Result, error)

Handler defines the core of the state transition function of an application.

type HeightSensitive

type HeightSensitive interface {
	ValidWithHeight(h int64) error
}

type IWatcher

type IWatcher interface {
	Enabled() bool
	SaveContractCode(addr common.Address, code []byte, height uint64)
	SaveContractCodeByHash(hash []byte, code []byte)
	SaveAccount(account interface{})
	DeleteAccount(account interface{})
	SaveState(addr common.Address, key, value []byte)
	SaveContractBlockedListItem(addr interface{})
	SaveContractMethodBlockedListItem(addr interface{}, methods []byte)
	SaveContractDeploymentWhitelistItem(addr interface{})
	DeleteContractBlockedList(addr interface{})
	DeleteContractDeploymentWhitelist(addr interface{})
	Finalize()
	Destruct() []WatchMessage
}

type InitChainer

type InitChainer func(ctx Context, req abci.RequestInitChain) abci.ResponseInitChain

InitChainer initializes application state at genesis

type Int

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

Int wraps integer with 256 bit range bound Checks overflow, underflow and division by zero Exists in range from -(2^maxBitLen-1) to 2^maxBitLen-1

func MaxInt

func MaxInt(i, i2 Int) Int

MaxInt returns the maximum between two integers.

func MinInt

func MinInt(i1, i2 Int) Int

return the minimum of the ints

func NewInt

func NewInt(n int64) Int

NewInt constructs Int from int64

func NewIntFromBigInt

func NewIntFromBigInt(i *big.Int) Int

NewIntFromBigInt constructs Int from big.Int

func NewIntFromString

func NewIntFromString(s string) (res Int, ok bool)

NewIntFromString constructs Int from string

func NewIntFromUint64

func NewIntFromUint64(n uint64) Int

NewIntFromUint64 constructs an Int from a uint64.

func NewIntWithDecimal

func NewIntWithDecimal(n int64, dec int) Int

NewIntWithDecimal constructs Int with decimal Result value is n*10^dec

func OneInt

func OneInt() Int

OneInt returns Int value with one

func TokensFromConsensusPower

func TokensFromConsensusPower(power int64) Int

TokensFromConsensusPower - convert input power to tokens

func ZeroInt

func ZeroInt() Int

ZeroInt returns Int value with zero

func (Int) Add

func (i Int) Add(i2 Int) (res Int)

Add adds Int from another

func (Int) AddRaw

func (i Int) AddRaw(i2 int64) Int

AddRaw adds int64 to Int

func (Int) BigInt

func (i Int) BigInt() *big.Int

BigInt converts Int to big.Int

func (Int) Equal

func (i Int) Equal(i2 Int) bool

Equal compares two Ints

func (Int) GT

func (i Int) GT(i2 Int) bool

GT returns true if first Int is greater than second

func (Int) GTE

func (i Int) GTE(i2 Int) bool

GTE returns true if receiver Int is greater than or equal to the parameter Int.

func (Int) Int64

func (i Int) Int64() int64

Int64 converts Int to int64 Panics if the value is out of range

func (Int) IsInt64

func (i Int) IsInt64() bool

IsInt64 returns true if Int64() not panics

func (Int) IsNegative

func (i Int) IsNegative() bool

IsNegative returns true if Int is negative

func (Int) IsNil

func (i Int) IsNil() bool

IsNil returns true if Int is uninitialized

func (Int) IsPositive

func (i Int) IsPositive() bool

IsPositive returns true if Int is positive

func (Int) IsUint64

func (i Int) IsUint64() bool

IsUint64 returns true if Uint64() not panics

func (Int) IsZero

func (i Int) IsZero() bool

IsZero returns true if Int is zero

func (Int) LT

func (i Int) LT(i2 Int) bool

LT returns true if first Int is lesser than second

func (Int) LTE

func (i Int) LTE(i2 Int) bool

LTE returns true if first Int is less than or equal to second

func (Int) Marshal

func (i Int) Marshal() ([]byte, error)

Marshal implements the gogo proto custom type interface.

func (Int) MarshalAmino

func (i Int) MarshalAmino() (string, error)

MarshalAmino defines custom encoding scheme

func (Int) MarshalJSON

func (i Int) MarshalJSON() ([]byte, error)

MarshalJSON defines custom encoding scheme

func (*Int) MarshalTo

func (i *Int) MarshalTo(data []byte) (n int, err error)

MarshalTo implements the gogo proto custom type interface.

func (Int) MarshalYAML

func (i Int) MarshalYAML() (interface{}, error)

MarshalYAML returns Ythe AML representation.

func (Int) Mod

func (i Int) Mod(i2 Int) Int

Mod returns remainder after dividing with Int

func (Int) ModRaw

func (i Int) ModRaw(i2 int64) Int

ModRaw returns remainder after dividing with int64

func (Int) Mul

func (i Int) Mul(i2 Int) (res Int)

Mul multiples two Ints

func (Int) MulRaw

func (i Int) MulRaw(i2 int64) Int

MulRaw multipies Int and int64

func (Int) Neg

func (i Int) Neg() (res Int)

Neg negates Int

func (Int) Quo

func (i Int) Quo(i2 Int) (res Int)

Quo divides Int with Int

func (Int) QuoRaw

func (i Int) QuoRaw(i2 int64) Int

QuoRaw divides Int with int64

func (Int) Sign

func (i Int) Sign() int

Sign returns sign of Int

func (*Int) Size

func (i *Int) Size() int

Size implements the gogo proto custom type interface.

func (Int) String

func (i Int) String() string

Human readable string

func (Int) Sub

func (i Int) Sub(i2 Int) (res Int)

Sub subtracts Int from another

func (Int) SubRaw

func (i Int) SubRaw(i2 int64) Int

SubRaw subtracts int64 from Int

func (Int) ToDec

func (i Int) ToDec() Dec

ToDec converts Int to Dec

func (Int) Uint64

func (i Int) Uint64() uint64

Uint64 converts Int to uint64 Panics if the value is out of range

func (*Int) Unmarshal

func (i *Int) Unmarshal(data []byte) error

Unmarshal implements the gogo proto custom type interface.

func (*Int) UnmarshalAmino

func (i *Int) UnmarshalAmino(text string) error

UnmarshalAmino defines custom decoding scheme

func (*Int) UnmarshalFromAmino

func (i *Int) UnmarshalFromAmino(_ *amino.Codec, data []byte) error

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(bz []byte) error

UnmarshalJSON defines custom decoding scheme

type IntProtoAdapter

type IntProtoAdapter struct {
	Int Int `protobuf:"bytes,1,opt,name=int,proto3,customtype=Int" json:"int"`
}

IntProtoAdapter defines a Protobuf wrapper around an Int object.

func (*IntProtoAdapter) Descriptor

func (*IntProtoAdapter) Descriptor() ([]byte, []int)

func (*IntProtoAdapter) Marshal

func (m *IntProtoAdapter) Marshal() (dAtA []byte, err error)

func (*IntProtoAdapter) MarshalTo

func (m *IntProtoAdapter) MarshalTo(dAtA []byte) (int, error)

func (*IntProtoAdapter) MarshalToSizedBuffer

func (m *IntProtoAdapter) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IntProtoAdapter) ProtoMessage

func (*IntProtoAdapter) ProtoMessage()

func (*IntProtoAdapter) Reset

func (m *IntProtoAdapter) Reset()

func (*IntProtoAdapter) Size

func (m *IntProtoAdapter) Size() (n int)

func (IntProtoAdapter) String

func (ip IntProtoAdapter) String() string

func (*IntProtoAdapter) Unmarshal

func (m *IntProtoAdapter) Unmarshal(dAtA []byte) error

func (*IntProtoAdapter) XXX_DiscardUnknown

func (m *IntProtoAdapter) XXX_DiscardUnknown()

func (*IntProtoAdapter) XXX_Marshal

func (m *IntProtoAdapter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IntProtoAdapter) XXX_Merge

func (m *IntProtoAdapter) XXX_Merge(src proto.Message)

func (*IntProtoAdapter) XXX_Size

func (m *IntProtoAdapter) XXX_Size() int

func (*IntProtoAdapter) XXX_Unmarshal

func (m *IntProtoAdapter) XXX_Unmarshal(b []byte) error

type Invariant

type Invariant func(ctx Context) (string, bool)

An Invariant is a function which tests a particular invariant. The invariant returns a descriptive message about what happened and a boolean indicating whether the invariant has been broken. The simulator will then halt and print the logs.

type InvariantRegistry

type InvariantRegistry interface {
	RegisterRoute(moduleName, route string, invar Invariant)
}

expected interface for registering invariants

type Invariants

type Invariants []Invariant

Invariants defines a group of invariants

type Iterator

type Iterator = types.Iterator

nolint - reexport

func KVStorePrefixIterator

func KVStorePrefixIterator(kvs KVStore, prefix []byte) Iterator

Iterator over all the keys with a certain prefix in ascending order

func KVStorePrefixIteratorPaginated

func KVStorePrefixIteratorPaginated(kvs KVStore, prefix []byte, page, limit uint) Iterator

KVStorePrefixIteratorPaginated returns iterator over items in the selected page. Items iterated and skipped in ascending order.

func KVStoreReversePrefixIterator

func KVStoreReversePrefixIterator(kvs KVStore, prefix []byte) Iterator

Iterator over all the keys with a certain prefix in descending order.

func KVStoreReversePrefixIteratorPaginated

func KVStoreReversePrefixIteratorPaginated(kvs KVStore, prefix []byte, page, limit uint) Iterator

KVStoreReversePrefixIteratorPaginated returns iterator over items in the selected page. Items iterated and skipped in descending order.

type KVPair

type KVPair = types.KVPair

key-value result for iterator queries

type KVStore

type KVStore = types.KVStore

nolint - reexport

type KVStoreKey

type KVStoreKey = types.KVStoreKey

nolint - reexport

func NewKVStoreKey

func NewKVStoreKey(name string) *KVStoreKey

NewKVStoreKey returns a new pointer to a KVStoreKey. Use a pointer so keys don't collide.

type LogFix

type LogFix func(tx []Tx, logIndex []int, hasEnterEvmTx []bool, errs []error, resp []abci.ResponseDeliverTx) (logs [][]byte)

type MemoryStoreKey

type MemoryStoreKey = types.MemoryStoreKey

nolint - reexport

type ModuleAccount

type ModuleAccount interface {
	Account

	GetName() string
	GetPermissions() []string
	HasPermission(string) bool
}

type MptCommitHandler

type MptCommitHandler func(ctx Context)

type Msg

type Msg interface {

	// Return the message type.
	// Must be alphanumeric or empty.
	Route() string

	// Returns a human-readable string for the message, intended for utilization
	// within tags
	Type() string

	// ValidateBasic does a simple validation check that
	// doesn't require access to any other information.
	ValidateBasic() error

	// Get the canonical byte representation of the Msg.
	GetSignBytes() []byte

	// Signers returns the addrs of signers that must sign.
	// CONTRACT: All signatures must be present to be valid.
	// CONTRACT: Returns addrs in some deterministic order.
	GetSigners() []AccAddress
}

Transactions messages must fulfill the Msg

type MsgAdapter

type MsgAdapter interface {
	Msg
	proto.Message
}

type MsgProtoAdapter

type MsgProtoAdapter interface {
	Msg
	codec.ProtoMarshaler
}

type MsgRequest

type MsgRequest interface {
	proto.Message
	// ValidateBasic does a simple validation check that
	// doesn't require access to any other information.
	ValidateBasic() error
	// Signers returns the addrs of signers that must sign.
	// CONTRACT: All signatures must be present to be valid.
	// CONTRACT: Returns addrs in some deterministic order.
	GetSigners() []AccAddress
}

MsgRequest is the interface a transaction message, defined as a proto service method, must fulfill.

type MultiStore

type MultiStore = types.MultiStore

nolint - reexport

type MultiStorePersistentCache

type MultiStorePersistentCache = types.MultiStorePersistentCache

nolint - reexport

type ParaMsg

type ParaMsg struct {
	UseCurrentState     bool
	HaveCosmosTxInBlock bool
	AnteErr             error
	RefundFee           Coins
	LogIndex            int
	HasRunEvmTx         bool
}

type PeerFilter

type PeerFilter func(info string) abci.ResponseQuery

PeerFilter responds to p2p filtering queries from Tendermint

type PreDeliverTxHandler

type PreDeliverTxHandler func(ctx Context, tx Tx, onlyVerifySig bool)

type PruningOptions

type PruningOptions = types.PruningOptions

nolint - reexport

type Querier

type Querier = func(ctx Context, path []string, req abci.RequestQuery) ([]byte, error)

Querier defines a function type that a module querier must implement to handle custom client queries.

type QueryRouter

type QueryRouter interface {
	AddRoute(r string, h Querier) QueryRouter
	Route(path string) Querier
}

QueryRouter provides queryables for each query path.

type QueryTraceTx

type QueryTraceTx struct {
	TxHash      common.Hash `json:"tx"`
	ConfigBytes []byte      `json:"config"`
}

type Queryable

type Queryable = types.Queryable

nolint - reexport

type Request

type Request = Context

Proposed rename, not done to avoid API breakage

type Result

type Result struct {
	// Data is any data returned from message or handler execution. It MUST be length
	// prefixed in order to separate data from multiple message executions.
	Data []byte

	// Log contains the log information from message or handler execution.
	Log string

	// Events contains a slice of Event objects that were emitted during message or
	// handler execution.
	Events Events
}

Result is the union of ResponseFormat and ResponseCheckTx.

func WrapServiceResult

func WrapServiceResult(ctx Context, res proto.Message, err error) (*Result, error)

WrapServiceResult wraps a result from a protobuf RPC service method call in a Result object or error. This method takes care of marshaling the res param to protobuf and attaching any events on the ctx.EventManager() to the Result.

type ReusableGasMeter

type ReusableGasMeter = types.ReusableGasMeter

nolint - reexport

func GetReusableInfiniteGasMeter

func GetReusableInfiniteGasMeter() ReusableGasMeter

GetReusableInfiniteGasMeter returns a ReusableGasMeter from the pool. you must call ReturnInfiniteGasMeter after you are done with the meter.

type Route

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

func NewRoute

func NewRoute(p string, h Handler) Route

NewRoute returns an instance of Route.

func (Route) Empty

func (r Route) Empty() bool

Empty returns true only if both handler and path are not empty.

func (Route) Handler

func (r Route) Handler() Handler

Handler returns the handler that handles the route.

func (Route) Path

func (r Route) Path() string

Path returns the path the route has assigned.

type Router

type Router interface {
	AddRoute(r string, h Handler) Router
	Route(ctx Context, path string) Handler
}

Router provides handlers for each transaction type.

type SearchTxsResult

type SearchTxsResult struct {
	TotalCount int          `json:"total_count"` // Count of all txs
	Count      int          `json:"count"`       // Count of txs in current page
	PageNumber int          `json:"page_number"` // Index of current page, start from 1
	PageTotal  int          `json:"page_total"`  // Count of total pages
	Limit      int          `json:"limit"`       // Max count txs per page
	Txs        []TxResponse `json:"txs"`         // List of txs in current page
}

SearchTxsResult defines a structure for querying txs pageable

func NewSearchTxsResult

func NewSearchTxsResult(totalCount, count, page, limit int, txs []TxResponse) SearchTxsResult

type ServiceMsg

type ServiceMsg struct {
	// MethodName is the fully-qualified service method name.
	MethodName string
	// Request is the request payload.
	Request MsgRequest
}

ServiceMsg is the struct into which an Any whose typeUrl matches a service method format (ex. `/cosmos.gov.Msg/SubmitProposal`) unpacks.

func (ServiceMsg) GetSignBytes

func (msg ServiceMsg) GetSignBytes() []byte

GetSignBytes implements Msg.GetSignBytes method.

func (ServiceMsg) GetSigners

func (msg ServiceMsg) GetSigners() []AccAddress

GetSigners implements Msg.GetSigners method.

func (ServiceMsg) ProtoMessage

func (msg ServiceMsg) ProtoMessage()

func (ServiceMsg) Reset

func (msg ServiceMsg) Reset()

func (ServiceMsg) Route

func (msg ServiceMsg) Route() string

Route implements Msg.Route method.

func (ServiceMsg) String

func (msg ServiceMsg) String() string

func (ServiceMsg) Type

func (msg ServiceMsg) Type() string

Type implements Msg.Type method.

func (ServiceMsg) ValidateBasic

func (msg ServiceMsg) ValidateBasic() error

ValidateBasic implements Msg.ValidateBasic method.

type SimulateData

type SimulateData struct {
	TxBytes        []byte `json:"tx"`
	OverridesBytes []byte `json:"overrides"`
}

type SimulationResponse

type SimulationResponse struct {
	GasInfo
	Result *Result
}

SimulationResponse defines the response generated when a transaction is successfully simulated by the Baseapp.

type Store

type Store = types.Store

nolint - reexport

type StoreDecoderRegistry

type StoreDecoderRegistry map[string]func(cdc *codec.Codec, kvA, kvB tmkv.Pair) string

StoreDecoderRegistry defines each of the modules store decoders. Used for ImportExport simulation.

type StoreKey

type StoreKey = types.StoreKey

nolint - reexport

type StoreType

type StoreType = types.StoreType

nolint - reexport

type StringEvent

type StringEvent struct {
	Type       string      `json:"type,omitempty"`
	Attributes []Attribute `json:"attributes,omitempty"`
}

StringAttribute defines en Event object wrapper where all the attributes contain key/value pairs that are strings instead of raw bytes.

func StringifyEvent

func StringifyEvent(e Event) StringEvent

StringifyEvent converts an Event object to a StringEvent object.

func (StringEvent) MarshalJsonToBuffer

func (e StringEvent) MarshalJsonToBuffer(buf *bytes.Buffer) error

type StringEvents

type StringEvents []StringEvent

StringAttributes defines a slice of StringEvents objects.

func StringifyEvents

func StringifyEvents(events []Event) StringEvents

StringifyEvents converts a slice of Event objects into a slice of StringEvent objects.

func (StringEvents) Flatten

func (se StringEvents) Flatten() StringEvents

Flatten returns a flattened version of StringEvents by grouping all attributes per unique event type.

func (StringEvents) MarshalJsonToBuffer

func (se StringEvents) MarshalJsonToBuffer(buf *bytes.Buffer) error

func (StringEvents) String

func (se StringEvents) String() string

type SysCoin

type SysCoin = DecCoin

type SysCoins

type SysCoins = DecCoins

type Terminator

type Terminator struct{}

Terminator AnteDecorator will get added to the chain to simplify decorator code Don't need to check if next == nil further up the chain

                      ______
                   <((((((\\\
                   /      . }\
                   ;--..--._|}
(\                 '--/\--'  )
 \\                | '-'  :'|
  \\               . -==- .-|
   \\               \.__.'   \--._
   [\\          __.--|       //  _/'--.
   \ \\       .'-._ ('-----'/ __/      \
    \ \\     /   __>|      | '--.       |
     \ \\   |   \   |     /    /       /
      \ '\ /     \  |     |  _/       /
       \  \       \ |     | /        /
 snd    \  \      \        /

func (Terminator) AnteHandle

func (t Terminator) AnteHandle(ctx Context, _ Tx, _ bool, _ AnteHandler) (Context, error)

Simply return provided Context and nil error

type TestMsg

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

TestMsg is msg type for testing

func NewTestMsg

func NewTestMsg(addrs ...AccAddress) *TestMsg

func (*TestMsg) GetSignBytes

func (msg *TestMsg) GetSignBytes() []byte

func (*TestMsg) GetSigners

func (msg *TestMsg) GetSigners() []AccAddress

func (*TestMsg) Route

func (msg *TestMsg) Route() string

nolint

func (*TestMsg) Type

func (msg *TestMsg) Type() string

func (*TestMsg) ValidateBasic

func (msg *TestMsg) ValidateBasic() error

type TestMsg2

type TestMsg2 struct {
	Signers []AccAddress
}

func NewTestMsg2

func NewTestMsg2(addrs ...AccAddress) *TestMsg2

func (TestMsg2) GetSignBytes

func (msg TestMsg2) GetSignBytes() []byte

func (TestMsg2) GetSigners

func (msg TestMsg2) GetSigners() []AccAddress

func (TestMsg2) Route

func (msg TestMsg2) Route() string

nolint

func (TestMsg2) Type

func (msg TestMsg2) Type() string

func (TestMsg2) ValidateBasic

func (msg TestMsg2) ValidateBasic() error

type TraceContext

type TraceContext = types.TraceContext

TraceContext contains TraceKVStore context data. It will be written with every trace operation.

type TransactionType

type TransactionType int
const (
	UnknownType TransactionType = iota
	StdTxType
	EvmTxType
)

func (TransactionType) String

func (t TransactionType) String() (res string)

type TransientStoreKey

type TransientStoreKey = types.TransientStoreKey

nolint - reexport

func NewTransientStoreKey

func NewTransientStoreKey(name string) *TransientStoreKey

Constructs new TransientStoreKey Must return a pointer according to the ocap principle

type Tx

type Tx interface {
	// Gets the all the transaction's messages.
	GetMsgs() []Msg

	// ValidateBasic does a simple and lightweight validation check that doesn't
	// require access to any other information.
	ValidateBasic() error

	// Return tx gas price
	GetGasPrice() *big.Int

	// Return tx call function signature
	GetTxFnSignatureInfo() ([]byte, int)

	GetType() TransactionType

	GetSigners() []AccAddress

	GetGas() uint64

	GetRaw() []byte
	GetFrom() string
	GetSender(ctx Context) string
	GetNonce() uint64
	TxHash() []byte
	SetRaw([]byte)
	SetTxHash([]byte)
}

Transactions objects must fulfill the Tx

type TxAdapter

type TxAdapter interface {
	Tx
	HeightSensitive
}

type TxDecoder

type TxDecoder func(txBytes []byte, height ...int64) (Tx, error)

__________________________________________________________ TxDecoder unmarshals transaction bytes

type TxEncoder

type TxEncoder func(tx Tx) ([]byte, error)

TxEncoder marshals transaction to bytes

type TxResponse

type TxResponse struct {
	Height    int64           `json:"height"`
	TxHash    string          `json:"txhash"`
	Codespace string          `json:"codespace,omitempty"`
	Code      uint32          `json:"code,omitempty"`
	Data      string          `json:"data,omitempty"`
	RawLog    string          `json:"raw_log,omitempty"`
	Logs      ABCIMessageLogs `json:"logs,omitempty"`
	Info      string          `json:"info,omitempty"`
	GasWanted int64           `json:"gas_wanted,omitempty"`
	GasUsed   int64           `json:"gas_used,omitempty"`
	Tx        Tx              `json:"tx,omitempty"`
	Timestamp string          `json:"timestamp,omitempty"`
}

TxResponse defines a structure containing relevant tx data and metadata. The tags are stringified and the log is JSON decoded.

func NewResponseFormatBroadcastTx

func NewResponseFormatBroadcastTx(res *ctypes.ResultBroadcastTx) TxResponse

NewResponseFormatBroadcastTx returns a TxResponse given a ResultBroadcastTx from tendermint

func NewResponseFormatBroadcastTxCommit

func NewResponseFormatBroadcastTxCommit(res *ctypes.ResultBroadcastTxCommit) TxResponse

NewResponseFormatBroadcastTxCommit returns a TxResponse given a ResultBroadcastTxCommit from tendermint.

func NewResponseResultTx

func NewResponseResultTx(res *ctypes.ResultTx, tx Tx, timestamp string) TxResponse

NewResponseResultTx returns a TxResponse given a ResultTx from tendermint

func (TxResponse) Empty

func (r TxResponse) Empty() bool

Empty returns true if the response is empty

func (TxResponse) String

func (r TxResponse) String() string

type TxWatcher

type TxWatcher struct {
	IWatcher
}

type Uint

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

Uint wraps integer with 256 bit range bound Checks overflow, underflow and division by zero Exists in range from 0 to 2^256-1

func MaxUint

func MaxUint(u1, u2 Uint) Uint

Return the maximum of the Uints

func MinUint

func MinUint(u1, u2 Uint) Uint

Return the minimum of the Uints

func NewUint

func NewUint(n uint64) Uint

NewUint constructs Uint from int64

func NewUintFromBigInt

func NewUintFromBigInt(i *big.Int) Uint

NewUintFromBigUint constructs Uint from big.Uint

func NewUintFromString

func NewUintFromString(s string) Uint

NewUintFromString constructs Uint from string

func OneUint

func OneUint() Uint

OneUint returns Uint value with one.

func ParseUint

func ParseUint(s string) (Uint, error)

ParseUint reads a string-encoded Uint value and return a Uint.

func RelativePow

func RelativePow(x Uint, n Uint, b Uint) (z Uint)

RelativePow raises x to the power of n, where x (and the result, z) are scaled by factor b for example, RelativePow(210, 2, 100) = 441 (2.1^2 = 4.41)

func ZeroUint

func ZeroUint() Uint

ZeroUint returns unsigned zero.

func (Uint) Add

func (u Uint) Add(u2 Uint) Uint

Add adds Uint from another

func (Uint) AddUint64

func (u Uint) AddUint64(u2 uint64) Uint

Add convert uint64 and add it to Uint

func (Uint) BigInt

func (u Uint) BigInt() *big.Int

BigInt converts Uint to big.Int

func (Uint) Decr

func (u Uint) Decr() Uint

Decr decrements the Uint by one. Decr will panic if the Uint is zero.

func (Uint) Equal

func (u Uint) Equal(u2 Uint) bool

Equal compares two Uints

func (Uint) GT

func (u Uint) GT(u2 Uint) bool

GT returns true if first Uint is greater than second

func (Uint) GTE

func (u Uint) GTE(u2 Uint) bool

GTE returns true if first Uint is greater than second

func (Uint) Incr

func (u Uint) Incr() Uint

Incr increments the Uint by one.

func (Uint) IsZero

func (u Uint) IsZero() bool

IsZero returns 1 if the uint equals to 0.

func (Uint) LT

func (u Uint) LT(u2 Uint) bool

LT returns true if first Uint is lesser than second

func (Uint) LTE

func (u Uint) LTE(u2 Uint) bool

LTE returns true if first Uint is lesser than or equal to the second

func (Uint) MarshalAmino

func (u Uint) MarshalAmino() (string, error)

MarshalAmino defines custom encoding scheme

func (Uint) MarshalJSON

func (u Uint) MarshalJSON() ([]byte, error)

MarshalJSON defines custom encoding scheme

func (Uint) Mod

func (u Uint) Mod(u2 Uint) Uint

Mod returns remainder after dividing with Uint

func (Uint) Mul

func (u Uint) Mul(u2 Uint) (res Uint)

Mul multiplies two Uints

func (Uint) MulUint64

func (u Uint) MulUint64(u2 uint64) (res Uint)

Mul multiplies two Uints

func (Uint) Quo

func (u Uint) Quo(u2 Uint) (res Uint)

Quo divides Uint with Uint

func (Uint) QuoUint64

func (u Uint) QuoUint64(u2 uint64) Uint

Quo divides Uint with uint64

func (Uint) String

func (u Uint) String() string

Human readable string

func (Uint) Sub

func (u Uint) Sub(u2 Uint) Uint

Sub adds Uint from another

func (Uint) SubUint64

func (u Uint) SubUint64(u2 uint64) Uint

SubUint64 adds Uint from another

func (Uint) Uint64

func (u Uint) Uint64() uint64

Uint64 converts Uint to uint64 Panics if the value is out of range

func (*Uint) UnmarshalAmino

func (u *Uint) UnmarshalAmino(text string) error

UnmarshalAmino defines custom decoding scheme

func (*Uint) UnmarshalJSON

func (u *Uint) UnmarshalJSON(bz []byte) error

UnmarshalJSON defines custom decoding scheme

type UpdateFeeCollectorAccHandler

type UpdateFeeCollectorAccHandler func(ctx Context, balance Coins, txFeesplit []*FeeSplitInfo) error

type UpdateFeeSplitHandler

type UpdateFeeSplitHandler func(txHash common.Hash, addr AccAddress, fee Coins, isDelete bool)

type ValAddress

type ValAddress []byte

ValAddress defines a wrapper around bytes meant to present a validator's operator. When marshaled to a string or JSON, it uses Bech32.

func ValAddressFromBech32

func ValAddressFromBech32(address string) (addr ValAddress, err error)

ValAddressFromBech32 creates a ValAddress from a Bech32 string.

func ValAddressFromHex

func ValAddressFromHex(address string) (addr ValAddress, err error)

ValAddressFromHex creates a ValAddress from a hex string.

func (ValAddress) Bytes

func (va ValAddress) Bytes() []byte

Bytes returns the raw address bytes.

func (ValAddress) Empty

func (va ValAddress) Empty() bool

Returns boolean for whether an AccAddress is empty

func (ValAddress) Equals

func (va ValAddress) Equals(va2 Address) bool

Returns boolean for whether two ValAddresses are Equal

func (ValAddress) Format

func (va ValAddress) Format(s fmt.State, verb rune)

Format implements the fmt.Formatter interface. nolint: errcheck

func (ValAddress) Marshal

func (va ValAddress) Marshal() ([]byte, error)

Marshal returns the raw address bytes. It is needed for protobuf compatibility.

func (ValAddress) MarshalJSON

func (va ValAddress) MarshalJSON() ([]byte, error)

MarshalJSON marshals to JSON using Bech32.

func (ValAddress) MarshalYAML

func (va ValAddress) MarshalYAML() (interface{}, error)

MarshalYAML marshals to YAML using Bech32.

func (ValAddress) String

func (va ValAddress) String() string

String implements the Stringer interface.

func (*ValAddress) Unmarshal

func (va *ValAddress) Unmarshal(data []byte) error

Unmarshal sets the address to the given data. It is needed for protobuf compatibility.

func (*ValAddress) UnmarshalJSON

func (va *ValAddress) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

func (*ValAddress) UnmarshalYAML

func (va *ValAddress) UnmarshalYAML(data []byte) error

UnmarshalYAML unmarshals from YAML assuming Bech32 encoding.

type WatchMessage

type WatchMessage interface {
	GetKey() []byte
	GetValue() string
	GetType() uint32
}

Directories

Path Synopsis
Package errors implements custom error interfaces for cosmos-sdk.
Package errors implements custom error interfaces for cosmos-sdk.
Package module contains application module patterns and associated "manager" functionality.
Package module contains application module patterns and associated "manager" functionality.
Package rest provides HTTP types and primitives for REST requests validation and responses handling.
Package rest provides HTTP types and primitives for REST requests validation and responses handling.
tx
Package tx is a reverse proxy.
Package tx is a reverse proxy.

Jump to

Keyboard shortcuts

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