types

package
v0.0.0-...-3fe421b Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 50 Imported by: 31

Documentation

Index

Constants

View Source
const (
	DefaultDDName                      = ".pocket"
	DefaultKeybaseName                 = "pocket-keybase"
	DefaultPVKName                     = "priv_val_key.json"
	DefaultPVSName                     = "priv_val_state.json"
	DefaultPVKNameLean                 = "priv_val_key_lean.json"
	DefaultPVSNameLean                 = "priv_val_state_lean.json"
	DefaultNKNameLean                  = "node_key_lean.json"
	DefaultNKName                      = "node_key.json"
	DefaultChainsName                  = "chains.json"
	DefaultGenesisName                 = "genesis.json"
	DefaultRPCPort                     = "8081"
	DefaultEvidenceDBName              = "pocket_evidence"
	DefaultTMURI                       = "tcp://localhost:26657"
	DefaultMaxSessionCacheEntries      = 500
	DefaultMaxEvidenceCacheEntries     = 500
	DefaultListenAddr                  = "tcp://0.0.0.0:"
	DefaultClientBlockSyncAllowance    = 10
	DefaultSessionSyncAllowance        = 0 // This config represents a session unit (irrespective of num blocks per session)
	DefaultJSONSortRelayResponses      = true
	DefaultTxIndexer                   = "kv"
	DefaultRPCDisableTransactionEvents = true
	DefaultTxIndexTags                 = "tx.hash,tx.height,message.sender,transfer.recipient"
	ConfigDirName                      = "config"
	ConfigFileName                     = "config.json"
	ApplicationDBName                  = "application"
	TransactionIndexerDBName           = "txindexer"
	PlaceholderHash                    = "0001"
	PlaceholderURL                     = "http://127.0.0.1:8081"
	PlaceholderServiceURL              = PlaceholderURL
	DefaultRemoteCLIURL                = "http://localhost:8081"
	DefaultUserAgent                   = ""
	DefaultValidatorCacheSize          = 40000
	DefaultApplicationCacheSize        = DefaultValidatorCacheSize / 4
	DefaultPocketPrometheusListenAddr  = "8083"
	DefaultPrometheusMaxOpenFile       = 3
	DefaultRPCTimeout                  = 30000
	DefaultMaxClaimProofRetryAge       = 32
	DefaultProofPrevalidation          = false
	DefaultCtxCacheSize                = 20
	DefaultABCILogging                 = false
	DefaultRelayErrors                 = true
	AuthFileName                       = "auth.json"
	DefaultIavlCacheSize               = 5000000
	DefaultChainHotReload              = false
	DefaultGenerateTokenOnStart        = true
	DefaultLeanPocket                  = false
	DefaultLeanPocketUserKeyFileName   = "lean_nodes_keys.json"
)
View Source
const (
	Precision = 18

	// bytes required to represent the above precision
	// Ceiling[Log2[999 999 999 999 999 999]]
	DecimalPrecisionBits = 60
)

number of decimal places

View Source
const (
	// Base error codes
	CodeOK                    CodeType = 0
	CodeInternal              CodeType = 1
	CodeTxDecode              CodeType = 2
	CodeInvalidSequence       CodeType = 3
	CodeUnauthorized          CodeType = 4
	CodeInsufficientFunds     CodeType = 5
	CodeUnknownRequest        CodeType = 6
	CodeInvalidAddress        CodeType = 7
	CodeInvalidPubKey         CodeType = 8
	CodeUnknownAddress        CodeType = 9
	CodeInsufficientCoins     CodeType = 10
	CodeInvalidCoins          CodeType = 11
	CodeOutOfGas              CodeType = 12
	CodeMemoTooLarge          CodeType = 13
	CodeInsufficientFee       CodeType = 14
	CodeTooManySignatures     CodeType = 15
	CodeGasOverflow           CodeType = 16
	CodeNoSignatures          CodeType = 17
	CodeNegativeAmont         CodeType = 18
	CodeBurnStakedTokens      CodeType = 19
	CodeForceValidatorUnstake CodeType = 20
	CodeInvalidSlash          CodeType = 21
	CodeModuleAccountCreate   CodeType = 22
	CodeForbidden             CodeType = 23

	// CodespaceRoot is a codespace for error codes in this file only.
	// Notice that 0 is an "unset" codespace, which can be overridden with
	// Error.WithDefaultCodespace().
	CodespaceUndefined CodespaceType = ""
	CodespaceRoot      CodespaceType = "sdk"
)

SDK error codes

View Source
const (
	// Transaction(tx) Block height index key.
	//
	// Note: Block height is cast as int when querying using the tx height index due to the lexicographic encoder library,
	// this is safe because v0 block height should never exceed 2^63-1 on 64-bit systems or 2^31-1 on 32-bit systems.
	TxHeightKey    = "tx.height"
	TxSignerKey    = "tx.signer"
	TxRecipientKey = "tx.recipient"
	TxHashKey      = "tx.hash"
	SortAscending  = "asc"
	SortDescending = "desc"
	AuthCodespace  = "auth"

	AnteHandlerMaxError = 10
)
View Source
const (
	// default stake denomination
	DefaultStakeDenom = "upokt"

	// 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 (
	Unstaked  StakeStatus = 0x00
	Unstaking StakeStatus = 0x01
	Staked    StakeStatus = 0x02

	StakeStatusUnstaked  = "Unstaked"
	StakeStatusUnstaking = "Unstaking"
	StakeStatusStaked    = "Staked"
)

staking constants

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

nolint - reexport

View Source
const (
	AddrLen = 20
)
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 (
	ErrInvalidLengthAbci        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAbci          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAbci = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthAddress        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAddress          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAddress = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthCoin        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCoin          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCoin = 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 (
	EventTypeMessage = "message"

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

Common event types and attribute keys

View Source
var (
	ParamsKey  = NewKVStoreKey(paramsKey)
	ParamsTKey = NewTransientStoreKey(paramsTKey)
)
View Source
var (
	// This is set at compile time. Could be cleveldb, defaults is goleveldb.
	DBBackend         = ""
	VbCCache          *Cache
	ShowTimeTrackData = false
)
View Source
var (
	ErrInvalidLengthWrappers        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowWrappers          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupWrappers = fmt.Errorf("proto: unexpected end of group")
)
View Source
var MaxSortableDec = OneDec().Quo(SmallestDec())

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

View Source
var PowerReduction = NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(6), 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 CodeToDefaultMsg

func CodeToDefaultMsg(code CodeType) string

NOTE: Don't stringer this, we'll put better messages in later.

func CompareStringMaps

func CompareStringMaps[T comparable](a, b map[string]T) bool

True if two maps are equivalent. Nil is considered to be the same as an empty map.

func CompareVersionStrings

func CompareVersionStrings(verStr1, verStr2 string) (int, error)

Compares two version strings, which are expected to be dot-delimited integers like "1.2.3.4". The result is similar to strcmp in C, negative if the first version string is considered to be earlier, positive if the second version string is considered to be earlier, and zero if both version strings are the same. If any of the given version strings is not dot-delimited, the function returns an error. For more details, see Test_CompareVersionStrings in utils_test.go.

func CopyBytes

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

copy bytes

func DecEq

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

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

func DecsEqual

func DecsEqual(d1s, d2s []BigDec) bool

test if two decimal arrays are equal

func DefaultPocketConsensusConfig

func DefaultPocketConsensusConfig(cconfig *config.ConsensusConfig)

Default Consensus Configs

func DiffKVStores

func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvA kv.Pair, kvB kv.Pair, count int64, equal bool)

Compare two KVstores, return either the first key/value pair at which they differ and whether or not they are equal, skipping 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 GetCacheKey

func GetCacheKey(height int, value string) (key string)

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 InitCtxCache

func InitCtxCache(size int)

func IsBetween

func IsBetween(target, minInclusive, maxInclusive int64) bool

func IsEmpty

func IsEmpty(o interface{}) bool

Returns true if it has zero length.

func IsTypedNil

func IsTypedNil(o interface{}) bool

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 NewEvent

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

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

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 NewLevelDB

func NewLevelDB(name, dir string, o *opt.Options) (db dbm.DB, err error)

NewLevelDB instantiate a new LevelDB instance according to DBBackend.

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 PrefixIterator

func PrefixIterator(db dbm.DB, prefix []byte, order string) (dbm.Iterator, error)

contract: caller must close iterator

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

// Register the sdk message type

func RegisterCodec(cdc *codec.Codec) {
	amino.RegisterInterface((*ProtoMsg)(nil), nil)
	amino.RegisterInterface((*Tx)(nil), nil)
	proto.Register("types/msg", (*ProtoMsg)(nil))
	proto.Register("types/tx", (*Tx)(nil))
}

func RegisterDenom

func RegisterDenom(denom string, unit BigDec) error

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

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 BigDec) []byte

SortableDecBytes returns a byte slice representation of a BigDec 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 TimeTrack

func TimeTrack(start time.Time)

func TokensToConsensusPower

func TokensToConsensusPower(tokens BigInt) 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 ValidSortableDec

func ValidSortableDec(dec BigDec) bool

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

func VerifyAddressFormat

func VerifyAddressFormat(bz []byte) error

Types

type ABCIMessageLog

type ABCIMessageLog struct {
	MsgIndex uint32 `protobuf:"varint,1,opt,name=msg_index,json=msgIndex,proto3" json:"msg_index,omitempty"`
	Success  bool   `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"`
	Log      string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
	// Events contains a slice of Event objects that were emitted during some
	// execution.
	Events StringEvents `protobuf:"bytes,4,rep,name=events,proto3,castrepeated=StringEvents" json:"events"`
}

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

func NewABCIMessageLog

func NewABCIMessageLog(i uint32, success bool, log string, events Events) ABCIMessageLog

func (*ABCIMessageLog) Descriptor

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

func (*ABCIMessageLog) GetEvents

func (m *ABCIMessageLog) GetEvents() StringEvents

func (*ABCIMessageLog) GetLog

func (m *ABCIMessageLog) GetLog() string

func (*ABCIMessageLog) GetMsgIndex

func (m *ABCIMessageLog) GetMsgIndex() uint32

func (*ABCIMessageLog) GetSuccess

func (m *ABCIMessageLog) GetSuccess() bool

func (*ABCIMessageLog) Marshal

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

func (*ABCIMessageLog) MarshalTo

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

func (*ABCIMessageLog) MarshalToSizedBuffer

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

func (*ABCIMessageLog) ProtoMessage

func (*ABCIMessageLog) ProtoMessage()

func (*ABCIMessageLog) Reset

func (m *ABCIMessageLog) Reset()

func (*ABCIMessageLog) Size

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

func (*ABCIMessageLog) String

func (this *ABCIMessageLog) String() string

func (*ABCIMessageLog) Unmarshal

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

func (*ABCIMessageLog) XXX_DiscardUnknown

func (m *ABCIMessageLog) XXX_DiscardUnknown()

func (*ABCIMessageLog) XXX_Marshal

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

func (*ABCIMessageLog) XXX_Merge

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

func (*ABCIMessageLog) XXX_Size

func (m *ABCIMessageLog) XXX_Size() int

func (*ABCIMessageLog) XXX_Unmarshal

func (m *ABCIMessageLog) XXX_Unmarshal(b []byte) 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) String

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

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

type Address

type Address tmCrypto.Address

Address a wrapper around bytes meant to represent an address. When marshaled to a string or JSON.

func AddressFromHex

func AddressFromHex(address string) (addr Address, err error)

AddressFromHex creates an Address from a hex string.

func GetAddress

func GetAddress(pubkey crypto.PublicKey) Address

get Address from pubkey

func (Address) Bytes

func (a Address) Bytes() []byte

RawBytes returns the raw address bytes.

func (Address) Empty

func (a Address) Empty() bool

Returns boolean for whether an Address is empty

func (Address) Equals

func (a Address) Equals(aa2 Address) bool

Returns boolean for whether two Addresses are Equal

func (Address) Format

func (a Address) Format(s fmt.State, verb rune)

Format implements the fmt.Formatter interface. nolint: errcheck

func (Address) Marshal

func (a Address) Marshal() ([]byte, error)

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

MarshalJSON marshals to JSON.

func (Address) MarshalTo

func (a Address) MarshalTo(data []byte) (n int, err error)

func (Address) MarshalToSizedBuffer

func (a Address) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Address) MarshalYAML

func (a Address) MarshalYAML() (interface{}, error)

MarshalYAML marshals to YAML.

func (Address) ProtoMessage

func (a Address) ProtoMessage()

func (*Address) Reset

func (a *Address) Reset()

func (Address) Size

func (a Address) Size() int

func (Address) String

func (a Address) String() string

String implements the Stringer interface.

func (Address) ToProto

func (a Address) ToProto() ProtoAddress

func (*Address) Unmarshal

func (a *Address) Unmarshal(data []byte) error

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON.

func (*Address) UnmarshalYAML

func (a *Address) UnmarshalYAML(data []byte) error

UnmarshalYAML unmarshals from JSON

type AddressI

type AddressI 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 Addresses

type Addresses []Address

Address a wrapper around bytes meant to represent an address. When marshaled to a string or JSON.

func (Addresses) Marshal

func (a Addresses) Marshal() ([]byte, error)

func (Addresses) MarshalTo

func (a Addresses) MarshalTo(data []byte) (n int, err error)

func (Addresses) MarshalToSizedBuffer

func (a Addresses) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Addresses) ProtoMessage

func (a Addresses) ProtoMessage()

func (*Addresses) Reset

func (a *Addresses) Reset()

func (Addresses) Size

func (a Addresses) Size() int

func (Addresses) String

func (a Addresses) String() string

func (Addresses) ToProto

func (a Addresses) ToProto() ProtoAddresses

func (*Addresses) Unmarshal

func (a *Addresses) Unmarshal(data []byte) error

type AnteHandler

type AnteHandler func(ctx Ctx, tx Tx, txBz []byte, txIndexer txindex.TxIndexer, simulate bool) (newCtx Ctx, result Result, signer crypto.PublicKey, abort bool)

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

type Attribute

type Attribute struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" 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) Descriptor

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

func (*Attribute) GetKey

func (m *Attribute) GetKey() string

func (*Attribute) GetValue

func (m *Attribute) GetValue() string

func (*Attribute) Marshal

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

func (*Attribute) MarshalTo

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

func (*Attribute) MarshalToSizedBuffer

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

func (*Attribute) ProtoMessage

func (*Attribute) ProtoMessage()

func (*Attribute) Reset

func (m *Attribute) Reset()

func (*Attribute) Size

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

func (Attribute) String

func (a Attribute) String() string

func (Attribute) ToKVPair

func (a Attribute) ToKVPair() kv.Pair

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

func (*Attribute) Unmarshal

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

func (*Attribute) XXX_DiscardUnknown

func (m *Attribute) XXX_DiscardUnknown()

func (*Attribute) XXX_Marshal

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

func (*Attribute) XXX_Merge

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

func (*Attribute) XXX_Size

func (m *Attribute) XXX_Size() int

func (*Attribute) XXX_Unmarshal

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

type AuthToken

type AuthToken struct {
	Value  string
	Issued time.Time
}

type BeginBlocker

type BeginBlocker func(ctx Ctx, 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 BigDec

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

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

func GetDenomUnit

func GetDenomUnit(denom string) (BigDec, 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 BigDec) BigDec

maximum decimal between two

func MinDec

func MinDec(d1, d2 BigDec) BigDec

minimum decimal between two

func MustNewDecFromStr

func MustNewDecFromStr(s string) BigDec

Decimal from string, panic on error

func NewDec

func NewDec(i int64) BigDec

create a new BigDec from integer assuming whole number

func NewDecFromBigInt

func NewDecFromBigInt(i *big.Int) BigDec

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

func NewDecFromBigIntWithPrec

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

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

func NewDecFromInt

func NewDecFromInt(i BigInt) BigDec

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

func NewDecFromIntWithPrec

func NewDecFromIntWithPrec(i BigInt, prec int64) BigDec

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

func NewDecFromStr

func NewDecFromStr(str string) (BigDec, 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 NewDecWithPrec

func NewDecWithPrec(i, prec int64) BigDec

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

func OneDec

func OneDec() BigDec

func SmallestDec

func SmallestDec() BigDec

func ZeroDec

func ZeroDec() BigDec

func (BigDec) Abs

func (d BigDec) Abs() BigDec

func (BigDec) Add

func (d BigDec) Add(d2 BigDec) BigDec

addition

func (BigDec) ApproxRoot

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

ApproxRoot returns an approximate estimation of a BigDec'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.

func (BigDec) ApproxSqrt

func (d BigDec) ApproxSqrt() (BigDec, 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 (BigDec) BigInt

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

BigInt returns a copy of the underlying big.BigInt.

func (BigDec) Ceil

func (d BigDec) Ceil() BigDec

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

func (BigDec) Equal

func (d BigDec) Equal(d2 BigDec) bool

func (BigDec) Format

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

format decimal state

func (BigDec) FracPow

func (d BigDec) FracPow(power BigDec, denominator int64) BigDec

returns the power for a Decimal power with a known denominator

func (BigDec) GT

func (d BigDec) GT(d2 BigDec) bool

func (BigDec) GTE

func (d BigDec) GTE(d2 BigDec) bool

func (BigDec) IsInteger

func (d BigDec) IsInteger() bool

is integer, e.g. decimals are zero

func (BigDec) IsNegative

func (d BigDec) IsNegative() bool

func (BigDec) IsNil

func (d BigDec) IsNil() bool

______________________________________________________________________________________________ nolint

func (BigDec) IsPositive

func (d BigDec) IsPositive() bool

func (BigDec) IsZero

func (d BigDec) IsZero() bool

func (BigDec) LT

func (d BigDec) LT(d2 BigDec) bool

func (BigDec) LTE

func (d BigDec) LTE(d2 BigDec) bool

func (BigDec) Marshal

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

MarshalObject implements the gogo proto custom type interface.

func (BigDec) MarshalAmino

func (d BigDec) MarshalAmino() ([]byte, error)

Override Amino binary serialization by proxying to protobuf.

func (BigDec) MarshalJSON

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

MarshalJSON marshals the decimal

func (*BigDec) MarshalTo

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

MarshalTo implements the gogo proto custom type interface.

func (BigDec) MarshalToSizedBuffer

func (d BigDec) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (BigDec) MarshalYAML

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

MarshalYAML returns the YAML representation.

func (BigDec) Mul

func (d BigDec) Mul(d2 BigDec) BigDec

multiplication

func (BigDec) MulInt

func (d BigDec) MulInt(i BigInt) BigDec

multiplication

func (BigDec) MulInt64

func (d BigDec) MulInt64(i int64) BigDec

MulInt64 - multiplication with int64

func (BigDec) MulTruncate

func (d BigDec) MulTruncate(d2 BigDec) BigDec

multiplication truncate

func (BigDec) Neg

func (d BigDec) Neg() BigDec

func (BigDec) Power

func (d BigDec) Power(power uint64) BigDec

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

func (BigDec) ProtoMessage

func (d BigDec) ProtoMessage()

func (BigDec) Quo

func (d BigDec) Quo(d2 BigDec) BigDec

quotient

func (BigDec) QuoInt

func (d BigDec) QuoInt(i BigInt) BigDec

quotient

func (BigDec) QuoInt64

func (d BigDec) QuoInt64(i int64) BigDec

QuoInt64 - quotient with int64

func (BigDec) QuoRoundUp

func (d BigDec) QuoRoundUp(d2 BigDec) BigDec

quotient, round up

func (BigDec) QuoTruncate

func (d BigDec) QuoTruncate(d2 BigDec) BigDec

quotient truncate

func (*BigDec) Reset

func (d *BigDec) Reset()

func (BigDec) RoundInt

func (d BigDec) RoundInt() BigInt

RoundInt round the decimal using bankers rounding

func (BigDec) RoundInt64

func (d BigDec) RoundInt64() int64

RoundInt64 rounds the decimal using bankers rounding

func (BigDec) Sign

func (d BigDec) Sign() int

func (*BigDec) Size

func (d *BigDec) Size() int

Size implements the gogo proto custom type interface.

func (BigDec) String

func (d BigDec) String() string

func (BigDec) Sub

func (d BigDec) Sub(d2 BigDec) BigDec

subtraction

func (BigDec) TruncateDec

func (d BigDec) TruncateDec() BigDec

TruncateDec truncates the decimals from the number and returns a BigDec

func (BigDec) TruncateInt

func (d BigDec) TruncateInt() BigInt

TruncateInt truncates the decimals from the number and returns an BigInt

func (BigDec) TruncateInt64

func (d BigDec) TruncateInt64() int64

TruncateInt64 truncates the decimals from the number and returns an int64

func (*BigDec) Unmarshal

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

UnmarshalObject implements the gogo proto custom type interface.

func (*BigDec) UnmarshalAmino

func (d *BigDec) UnmarshalAmino(bz []byte) error

func (*BigDec) UnmarshalJSON

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

UnmarshalJSON defines custom decoding scheme

type BigInt

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

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

MaxInt returns the maximum between two integers.

func MinInt

func MinInt(i1, i2 BigInt) BigInt

return the minimum of the ints

func NewInt

func NewInt(n int64) BigInt

NewInt constructs BigInt from int64

func NewIntFromBigInt

func NewIntFromBigInt(i *big.Int) BigInt

NewIntFromBigInt constructs BigInt from big.BigInt

func NewIntFromString

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

NewIntFromString constructs BigInt from string

func NewIntFromUint64

func NewIntFromUint64(n uint64) BigInt

NewIntFromUint64 constructs an BigInt from a uint64.

func NewIntWithDecimal

func NewIntWithDecimal(n int64, dec int) BigInt

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

func OneInt

func OneInt() BigInt

OneInt returns BigInt value with one

func TokensFromConsensusPower

func TokensFromConsensusPower(power int64) BigInt

TokensFromConsensusPower - convert input power to tokens

func ZeroInt

func ZeroInt() BigInt

ZeroInt returns BigInt value with zero

func (BigInt) Add

func (i BigInt) Add(i2 BigInt) (res BigInt)

Add adds BigInt from another

func (BigInt) AddRaw

func (i BigInt) AddRaw(i2 int64) BigInt

AddRaw adds int64 to BigInt

func (BigInt) BigInt

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

BigInt converts BigInt to big.BigInt

func (BigInt) Equal

func (i BigInt) Equal(i2 BigInt) bool

Equal compares two Ints

func (BigInt) GT

func (i BigInt) GT(i2 BigInt) bool

GT returns true if first BigInt is greater than second

func (BigInt) GTE

func (i BigInt) GTE(i2 BigInt) bool

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

func (BigInt) Int64

func (i BigInt) Int64() int64

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

func (BigInt) IsInt64

func (i BigInt) IsInt64() bool

IsInt64 returns true if Int64() not panics

func (BigInt) IsNegative

func (i BigInt) IsNegative() bool

IsNegative returns true if BigInt is negative

func (BigInt) IsPositive

func (i BigInt) IsPositive() bool

IsPositive returns true if BigInt is positive

func (BigInt) IsUint64

func (i BigInt) IsUint64() bool

IsUint64 returns true if Uint64() not panics

func (BigInt) IsZero

func (i BigInt) IsZero() bool

IsZero returns true if BigInt is zero

func (BigInt) LT

func (i BigInt) LT(i2 BigInt) bool

LT returns true if first BigInt is lesser than second

func (BigInt) LTE

func (i BigInt) LTE(i2 BigInt) bool

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

func (BigInt) Marshal

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

MarshalObject implements the gogo proto custom type interface.

func (BigInt) MarshalAmino

func (i BigInt) MarshalAmino() ([]byte, error)

Override Amino binary serialization by proxying to protobuf.

func (BigInt) MarshalJSON

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

MarshalJSON defines custom encoding scheme

func (*BigInt) MarshalTo

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

MarshalTo implements the gogo proto custom type interface.

func (BigInt) MarshalToSizedBuffer

func (i BigInt) MarshalToSizedBuffer(dAtA []byte) (int, error)

autogenerated

func (BigInt) MarshalYAML

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

MarshalYAML returns the YAML representation.

func (BigInt) Mod

func (i BigInt) Mod(i2 BigInt) BigInt

Mod returns remainder after dividing with BigInt

func (BigInt) ModRaw

func (i BigInt) ModRaw(i2 int64) BigInt

ModRaw returns remainder after dividing with int64

func (BigInt) Mul

func (i BigInt) Mul(i2 BigInt) (res BigInt)

Mul multiples two Ints

func (BigInt) MulRaw

func (i BigInt) MulRaw(i2 int64) BigInt

MulRaw multipies BigInt and int64

func (BigInt) Neg

func (i BigInt) Neg() (res BigInt)

Neg negates BigInt

func (BigInt) Pow

func (i BigInt) Pow(i2 BigInt) (res BigInt)

func (BigInt) ProtoMessage

func (i BigInt) ProtoMessage()

func (BigInt) Quo

func (i BigInt) Quo(i2 BigInt) (res BigInt)

Quo divides BigInt with BigInt

func (BigInt) QuoRaw

func (i BigInt) QuoRaw(i2 int64) BigInt

QuoRaw divides BigInt with int64

func (*BigInt) Reset

func (i *BigInt) Reset()

func (BigInt) Sign

func (i BigInt) Sign() int

Sign returns sign of BigInt

func (*BigInt) Size

func (i *BigInt) Size() int

Size implements the gogo proto custom type interface.

func (BigInt) String

func (i BigInt) String() string

Human readable string

func (BigInt) Sub

func (i BigInt) Sub(i2 BigInt) (res BigInt)

Sub subtracts BigInt from another

func (BigInt) SubRaw

func (i BigInt) SubRaw(i2 int64) BigInt

SubRaw subtracts int64 from BigInt

func (BigInt) ToDec

func (i BigInt) ToDec() BigDec

ToDec converts BigInt to BigDec

func (BigInt) Uint64

func (i BigInt) Uint64() uint64

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

func (*BigInt) Unmarshal

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

UnmarshalObject implements the gogo proto custom type interface.

func (*BigInt) UnmarshalAmino

func (i *BigInt) UnmarshalAmino(bz []byte) error

func (*BigInt) UnmarshalJSON

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

UnmarshalJSON defines custom decoding scheme

type Bool

type Bool bool

func (Bool) Marshal

func (b Bool) Marshal() ([]byte, error)

func (Bool) MarshalTo

func (b Bool) MarshalTo(data []byte) (n int, err error)

func (Bool) MarshalToSizedBuffer

func (b Bool) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Bool) ProtoMessage

func (b Bool) ProtoMessage()

func (*Bool) Reset

func (b *Bool) Reset()

func (Bool) Size

func (b Bool) Size() int

func (Bool) String

func (b Bool) String() string

func (Bool) ToProto

func (b Bool) ToProto() ProtoBool

func (*Bool) Unmarshal

func (b *Bool) Unmarshal(data []byte) (err error)

type Cache

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

Cache is a thread-safe fixed cap LRU cache.

var GlobalCtxCache *Cache

var _ Ctx = Context

func NewCache

func NewCache(size int) *Cache

New creates an LRU of the given cap.

func (*Cache) Add

func (c *Cache) Add(key string, value interface{}) (evicted bool)

Add adds a value to the cache. Returns true if an eviction occurred.

func (*Cache) AddWithCtx

func (c *Cache) AddWithCtx(ctx Ctx, key string, value interface{}) (evicted bool)

Add adds a value to the cache. Returns true if an eviction occurred.

func (*Cache) Cap

func (c *Cache) Cap() int

func (*Cache) Contains

func (c *Cache) Contains(key string) bool

Contains checks if a key is in the cache, without updating the recent-ness or deleting it for being stale.

func (*Cache) ContainsOrAdd

func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool)

ContainsOrAdd checks if a key is in the cache without updating the recent-ness or deleting it for being stale, and if not, adds the value. Returns whether found and whether an eviction occurred.

func (*Cache) Get

func (c *Cache) Get(key string) (value interface{}, ok bool)

Get looks up a key's value from the cache.

func (*Cache) GetOldest

func (c *Cache) GetOldest() (key string, value interface{}, ok bool)

GetOldest returns the oldest entry

func (*Cache) GetWithCtx

func (c *Cache) GetWithCtx(ctx Ctx, key string) (value interface{}, ok bool)

Add adds a value to the cache. Returns true if an eviction occurred.

func (*Cache) Keys

func (c *Cache) Keys() []interface{}

Keys returns a slice of the keys in the cache, from oldest to newest.

func (*Cache) Len

func (c *Cache) Len() int

Len returns the number of items in the cache.

func (*Cache) Peek

func (c *Cache) Peek(key string) (value interface{}, ok bool)

Peek returns the key value (or undefined if not found) without updating the "recently used"-ness of the key.

func (*Cache) PeekOrAdd

func (c *Cache) PeekOrAdd(key, value interface{}) (previous interface{}, ok, evicted bool)

PeekOrAdd checks if a key is in the cache without updating the recent-ness or deleting it for being stale, and if not, adds the value. Returns whether found and whether an eviction occurred.

func (*Cache) Purge

func (c *Cache) Purge()

Purge is used to completely clear the cache.

func (*Cache) Remove

func (c *Cache) Remove(key string) (present bool)

Remove removes the provided key from the cache.

func (*Cache) RemoveOldest

func (c *Cache) RemoveOldest() (key string, value interface{}, ok bool)

RemoveOldest removes the oldest item from the cache.

func (*Cache) RemoveWithCtx

func (c *Cache) RemoveWithCtx(ctx Ctx, key string) (present bool)

Remove removes the provided key from the cache.

func (*Cache) Resize

func (c *Cache) Resize(size int) (evicted int)

Resize changes the cache capacity.

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 CodeType

type CodeType uint32

CodeType - ABCI code identifier within codespace

func (CodeType) IsOK

func (code CodeType) IsOK() bool

IsOK - is everything okay?

type CodespaceType

type CodespaceType string

CodespaceType - codespace identifier

type Coin

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

Coin 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 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 NewCoin

func NewCoin(denom string, amount BigInt) Coin

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

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 ParseCoin

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

ParseCoin parses a cli input for one coin type, returning errors if invalid. This returns an error on an empty string as well.

func (Coin) Add

func (coin Coin) Add(coinB Coin) Coin

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

func (*Coin) Descriptor

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

func (*Coin) Equal

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

func (*Coin) GetDenom

func (m *Coin) GetDenom() string

func (Coin) IsEqual

func (coin Coin) IsEqual(other Coin) bool

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

func (Coin) IsGTE

func (coin Coin) IsGTE(other Coin) bool

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

func (Coin) IsLT

func (coin Coin) IsLT(other Coin) bool

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

func (Coin) IsNegative

func (coin Coin) IsNegative() bool

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

TODO: Remove once unsigned integers are used.

func (Coin) IsPositive

func (coin Coin) IsPositive() bool

IsPositive returns true if coin amount is positive.

TODO: Remove once unsigned integers are used.

func (Coin) IsValid

func (coin Coin) IsValid() bool

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

func (Coin) IsZero

func (coin Coin) IsZero() bool

IsZero returns if this represents no money

func (*Coin) Marshal

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

func (*Coin) MarshalTo

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

func (*Coin) MarshalToSizedBuffer

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

func (*Coin) ProtoMessage

func (*Coin) ProtoMessage()

func (*Coin) Reset

func (m *Coin) Reset()

func (*Coin) Size

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

func (Coin) String

func (coin Coin) String() string

String provides a human-readable representation of a coin

func (Coin) Sub

func (coin Coin) Sub(coinB Coin) Coin

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

func (*Coin) Unmarshal

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

func (*Coin) XXX_DiscardUnknown

func (m *Coin) XXX_DiscardUnknown()

func (*Coin) XXX_Marshal

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

func (*Coin) XXX_Merge

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

func (*Coin) XXX_Size

func (m *Coin) XXX_Size() int

func (*Coin) XXX_Unmarshal

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

type Coins

type Coins []Coin

Coins is a set of Coin, one per currency

func NewCoins

func NewCoins(coins ...Coin) Coins

NewCoins constructs a new coin set.

func ParseCoins

func ParseCoins(coinsStr string) (Coins, error)

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

func (Coins) Add

func (coins Coins) Add(coinsB Coins) Coins

Add adds two sets of coins.

e.g. {2A} + {A, 2B} = {3A, 2B} {2A} + {0B} = {2A}

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 (Coins) AmountOf

func (coins Coins) AmountOf(denom string) BigInt

Returns the amount of a denom from coins

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

func (coins Coins) Empty() bool

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

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

func (coins Coins) IsAllPositive() bool

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

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

func (coins Coins) IsAnyNegative() bool

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

TODO: Remove once unsigned integers are used.

func (Coins) IsEqual

func (coins Coins) IsEqual(coinsB Coins) bool

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

func (Coins) IsValid

func (coins Coins) IsValid() bool

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

func (Coins) IsZero

func (coins Coins) IsZero() bool

IsZero returns true if there are no coins or all coins are zero.

func (Coins) Len

func (coins Coins) Len() int

nolint

func (Coins) Less

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

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.

func (Coins) SafeSub

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

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

func (Coins) Sort

func (coins Coins) Sort() Coins

Sort is a helper function to sort the set of coins inplace

func (Coins) String

func (coins Coins) String() string

func (Coins) Sub

func (coins Coins) Sub(coinsB Coins) Coins

Sub subtracts a set of coins from another.

e.g. {2A, 3B} - {A} = {A, 3B} {2A} - {0B} = {2A} {A, B} - {A} = {B}

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

func (Coins) Swap

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

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 {
	TendermintConfig config.Config `json:"tendermint_config"`
	PocketConfig     PocketConfig  `json:"pocket_config"`
}

func DefaultConfig

func DefaultConfig(dataDir string) Config

func DefaultTestingPocketConfig

func DefaultTestingPocketConfig() Config

type Context

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

func NewContext

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

create a new context

func (Context) AppVersion

func (c Context) AppVersion() string

func (Context) BlockGasMeter

func (c Context) BlockGasMeter() GasMeter

func (Context) BlockHash

func (c Context) BlockHash(cdc *codec.Codec, height int64) ([]byte, error)

clone the header before returning

func (Context) BlockHeader

func (c Context) BlockHeader() abci.Header

clone the header before returning

func (Context) BlockHeight

func (c Context) BlockHeight() int64

func (Context) BlockStore

func (c Context) BlockStore() *store.BlockStore

func (Context) BlockTime

func (c Context) BlockTime() time.Time

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

func (c Context) ClearGlobalCache()

func (Context) ConsensusParams

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

func (Context) Context

func (c Context) Context() context.Context

Read-only accessors

func (Context) EventManager

func (c Context) EventManager() *EventManager

func (Context) GasMeter

func (c Context) GasMeter() GasMeter

func (Context) GetPrevBlockHash

func (c Context) GetPrevBlockHash(height int64) (hash []byte, err error)

func (Context) IsAfterUpgradeHeight

func (c Context) IsAfterUpgradeHeight() bool

func (Context) IsCheckTx

func (c Context) IsCheckTx() bool

func (Context) IsOnUpgradeHeight

func (c Context) IsOnUpgradeHeight() bool

func (Context) IsPrevCtx

func (c Context) IsPrevCtx() 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) MustGetPrevCtx

func (c Context) MustGetPrevCtx(height int64) Context

func (Context) PrevCtx

func (c Context) PrevCtx(height int64) (Context, error)

func (Context) SetPrevCtx

func (c Context) SetPrevCtx(b bool) Context

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

func (c Context) WithAppVersion(version string) Context

func (Context) WithBlockGasMeter

func (c Context) WithBlockGasMeter(meter GasMeter) Context

func (Context) WithBlockHeader

func (c Context) WithBlockHeader(header abci.Header) Context

func (Context) WithBlockHeight

func (c Context) WithBlockHeight(height int64) Context

func (Context) WithBlockStore

func (c Context) WithBlockStore(bs *store.BlockStore) Context

func (Context) WithBlockTime

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

func (Context) WithChainID

func (c Context) WithChainID(chainID string) Context

func (Context) WithConsensusParams

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

func (Context) WithContext

func (c Context) WithContext(ctx context.Context) Context

func (Context) WithEventManager

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

func (Context) WithGasMeter

func (c Context) WithGasMeter(meter GasMeter) Context

func (Context) WithIsCheckTx

func (c Context) WithIsCheckTx(isCheckTx bool) Context

func (Context) WithLogger

func (c Context) WithLogger(logger log.Logger) Context

func (Context) WithMinGasPrices

func (c Context) WithMinGasPrices(gasPrices DecCoins) Context

func (Context) WithMultiStore

func (c Context) WithMultiStore(ms MultiStore) Context

func (Context) WithProposer

func (c Context) WithProposer(addr Address) Context

func (Context) WithTxBytes

func (c Context) WithTxBytes(txBytes []byte) 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)

func (Context) WithVoteInfos

func (c Context) WithVoteInfos(voteInfo []abci.VoteInfo) Context

type Ctx

type Ctx interface {
	Context() context.Context
	MultiStore() MultiStore
	BlockHeight() int64
	BlockTime() time.Time
	ChainID() string
	TxBytes() []byte
	Logger() log.Logger
	VoteInfos() []abci.VoteInfo
	GasMeter() GasMeter
	BlockGasMeter() GasMeter
	IsCheckTx() bool
	MinGasPrices() DecCoins
	EventManager() *EventManager
	BlockHeader() abci.Header
	ConsensusParams() *abci.ConsensusParams
	MustGetPrevCtx(height int64) Context
	PrevCtx(height int64) (Context, error)
	WithBlockStore(bs *store.BlockStore) Context
	BlockStore() *store.BlockStore
	GetPrevBlockHash(height int64) (hash []byte, err error)
	WithContext(ctx context.Context) Context
	WithMultiStore(ms MultiStore) Context
	WithBlockHeader(header abci.Header) Context
	WithBlockTime(newTime time.Time) Context
	WithProposer(addr Address) Context
	WithBlockHeight(height int64) Context
	WithChainID(chainID string) Context
	WithTxBytes(txBytes []byte) Context
	WithLogger(logger log.Logger) Context
	WithVoteInfos(voteInfo []abci.VoteInfo) Context
	WithGasMeter(meter GasMeter) Context
	WithBlockGasMeter(meter GasMeter) Context
	WithIsCheckTx(isCheckTx bool) Context
	WithMinGasPrices(gasPrices DecCoins) Context
	WithConsensusParams(params *abci.ConsensusParams) Context
	WithEventManager(em *EventManager) Context
	WithValue(key, value interface{}) Context
	Value(key interface{}) interface{}
	KVStore(key StoreKey) KVStore
	TransientStore(key StoreKey) KVStore
	CacheContext() (cc Context, writeCache func())
	IsZero() bool
	AppVersion() string
	ClearGlobalCache()
	IsPrevCtx() bool
	IsAfterUpgradeHeight() bool
	IsOnUpgradeHeight() bool
	BlockHash(cdc *codec.Codec, height int64) ([]byte, error)
}

type CustomProtobufType

type CustomProtobufType interface {
	Marshal() ([]byte, error)
	MarshalTo(data []byte) (n int, err error)
	Unmarshal(data []byte) error
	Size() int

	MarshalJSON() ([]byte, error)
	UnmarshalJSON(data []byte) error
}

CustomProtobufType defines the interface custom gogo proto types must implement in order to be used as a "customtype" extension.

ref: https://github.com/gogo/protobuf/blob/master/custom_types.md

type DecCoin

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

DecCoin 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 NewDecCoin

func NewDecCoin(denom string, amount BigInt) DecCoin

NewDecCoin creates a new DecCoin instance from an BigInt.

func NewDecCoinFromCoin

func NewDecCoinFromCoin(coin Coin) DecCoin

NewDecCoinFromCoin creates a new DecCoin from a Coin.

func NewDecCoinFromDec

func NewDecCoinFromDec(denom string, amount BigDec) DecCoin

NewDecCoinFromDec creates a new DecCoin instance from a BigDec.

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

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

func (*DecCoin) Equal

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

func (*DecCoin) GetDenom

func (m *DecCoin) GetDenom() string

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

func (DecCoin) IsZero

func (coin DecCoin) IsZero() bool

IsZero returns if the DecCoin amount is zero.

func (*DecCoin) Marshal

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

func (*DecCoin) MarshalTo

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

func (*DecCoin) MarshalToSizedBuffer

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

func (*DecCoin) ProtoMessage

func (*DecCoin) ProtoMessage()

func (*DecCoin) Reset

func (m *DecCoin) Reset()

func (*DecCoin) Size

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

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

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

func (*DecCoin) XXX_DiscardUnknown

func (m *DecCoin) XXX_DiscardUnknown()

func (*DecCoin) XXX_Marshal

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

func (*DecCoin) XXX_Merge

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

func (*DecCoin) XXX_Size

func (m *DecCoin) XXX_Size() int

func (*DecCoin) XXX_Unmarshal

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

type DecCoins

type DecCoins []DecCoin

DecCoins defines a slice of coins with decimal values

func NewDecCoins

func NewDecCoins(coins Coins) DecCoins

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

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 DecCoins) 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) AmountOf

func (coins DecCoins) AmountOf(denom string) BigDec

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) 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 BigDec) DecCoins

MulDec multiplies all the coins by a decimal.

CONTRACT: No zero coins will be returned.

func (DecCoins) MulDecTruncate

func (coins DecCoins) MulDecTruncate(d BigDec) 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 BigDec) 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 BigDec) 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.

type EndBlocker

type EndBlocker func(ctx Ctx, 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 Error

type Error interface {
	Error() string
	Stacktrace() error
	Trace(offset int, format string, args ...interface{}) error
	Data() interface{}

	// convenience
	TraceSDK(format string, args ...interface{}) Error

	// set codespace
	WithDefaultCodespace(CodespaceType) Error

	Code() CodeType
	Codespace() CodespaceType
	ABCILog() string
	Result() Result
	QueryResult() abci.ResponseQuery
}

---------------------------------------- sdk Error type

func ErrBurnStakedTokens

func ErrBurnStakedTokens(msg string) Error

func ErrForbidden

func ErrForbidden(msg string) Error

func ErrForceValidatorUnstake

func ErrForceValidatorUnstake(msg string) Error

func ErrGasOverflow

func ErrGasOverflow(msg string) Error

func ErrInsufficientCoins

func ErrInsufficientCoins(msg string) Error

func ErrInsufficientFee

func ErrInsufficientFee(msg string) Error

func ErrInsufficientFunds

func ErrInsufficientFunds(msg string) Error

func ErrInternal

func ErrInternal(msg string) Error

nolint

func ErrInvalidAddress

func ErrInvalidAddress(msg string) Error

func ErrInvalidCoins

func ErrInvalidCoins(msg string) Error

func ErrInvalidPubKey

func ErrInvalidPubKey(msg string) Error

func ErrInvalidSequence

func ErrInvalidSequence(msg string) Error

func ErrInvalidSlash

func ErrInvalidSlash(msg string) Error

func ErrMemoTooLarge

func ErrMemoTooLarge(msg string) Error

func ErrModuleAccountCreate

func ErrModuleAccountCreate(msg string) Error

func ErrNegativeAmount

func ErrNegativeAmount(msg string) Error

func ErrNoSignatures

func ErrNoSignatures(msg string) Error

func ErrOutOfGas

func ErrOutOfGas(msg string) Error

func ErrTooManySignatures

func ErrTooManySignatures(msg string) Error

func ErrTxDecode

func ErrTxDecode(msg string) Error

func ErrUnauthorized

func ErrUnauthorized(msg string) Error

func ErrUnknownAddress

func ErrUnknownAddress(msg string) Error

func ErrUnknownRequest

func ErrUnknownRequest(msg string) Error

func NewError

func NewError(codespace CodespaceType, code CodeType, format string, args ...interface{}) Error

NewError - create an error.

type ErrorGasOverflow

type ErrorGasOverflow = types.ErrorGasOverflow

nolint - reexport

type ErrorOutOfGas

type ErrorOutOfGas = types.ErrorOutOfGas

nolint - reexport

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 abci.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 []abci.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 abci.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 FmtError

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

func (FmtError) Error

func (fe FmtError) Error() string

func (FmtError) Format

func (fe FmtError) Format() string

func (FmtError) String

func (fe FmtError) String() string

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 `protobuf:"varint,1,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty" yaml:"gas_wanted"`
	// GasUsed is the amount of gas actually consumed.
	GasUsed uint64 `protobuf:"varint,2,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty" yaml:"gas_used"`
}

GasInfo defines tx execution gas context.

func (*GasInfo) Descriptor

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

func (*GasInfo) GetGasUsed

func (m *GasInfo) GetGasUsed() uint64

func (*GasInfo) GetGasWanted

func (m *GasInfo) GetGasWanted() uint64

func (*GasInfo) Marshal

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

func (*GasInfo) MarshalTo

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

func (*GasInfo) MarshalToSizedBuffer

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

func (*GasInfo) ProtoMessage

func (*GasInfo) ProtoMessage()

func (*GasInfo) Reset

func (m *GasInfo) Reset()

func (*GasInfo) Size

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

func (*GasInfo) String

func (this *GasInfo) String() string

func (*GasInfo) Unmarshal

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

func (*GasInfo) XXX_DiscardUnknown

func (m *GasInfo) XXX_DiscardUnknown()

func (*GasInfo) XXX_Marshal

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

func (*GasInfo) XXX_Merge

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

func (*GasInfo) XXX_Size

func (m *GasInfo) XXX_Size() int

func (*GasInfo) XXX_Unmarshal

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

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 Handler

type Handler func(ctx Ctx, msg Msg, signer crypto.PublicKey) Result

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

type InitChainer

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

InitChainer initializes application state at genesis

type Int64

type Int64 int64

func (Int64) Marshal

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

func (Int64) MarshalTo

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

func (Int64) MarshalToSizedBuffer

func (i Int64) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Int64) ProtoMessage

func (i Int64) ProtoMessage()

func (*Int64) Reset

func (i *Int64) Reset()

func (Int64) Size

func (i Int64) Size() int

func (Int64) String

func (i Int64) String() string

func (Int64) ToProto

func (i Int64) ToProto() ProtoInt64

func (*Int64) Unmarshal

func (i *Int64) Unmarshal(data []byte) (err error)

type Invariant

type Invariant func(ctx Ctx) (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, error)

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

func KVStoreReversePrefixIterator

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

Iterator over all the keys with a certain prefix 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 KeyTable

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

KeyTable subspaces appropriate type for each parameter key

func NewKeyTable

func NewKeyTable(keytypes ...interface{}) (res KeyTable)

Constructs new table

func (KeyTable) RegisterParamSet

func (t KeyTable) RegisterParamSet(ps ParamSet) KeyTable

Register multiple pairs from ParamSet

func (KeyTable) RegisterType

func (t KeyTable) RegisterType(key []byte, ty interface{}) KeyTable

Register single key-type pair

type KvPairs

type KvPairs []types.KVPair

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 ProtoMsg.
	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() []Address

	// Returns the recipient of the tx, if no recipient returns nil
	GetRecipient() Address

	// Returns an BigInt for the ProtoMsg
	GetFee() BigInt
}

type MsgData

type MsgData struct {
	MsgType string `protobuf:"bytes,1,opt,name=msg_type,json=msgType,proto3" json:"msg_type,omitempty"`
	Data    []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}

MsgData defines the data returned in a Result object during message execution.

func (*MsgData) Descriptor

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

func (*MsgData) GetData

func (m *MsgData) GetData() []byte

func (*MsgData) GetMsgType

func (m *MsgData) GetMsgType() string

func (*MsgData) Marshal

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

func (*MsgData) MarshalTo

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

func (*MsgData) MarshalToSizedBuffer

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

func (*MsgData) ProtoMessage

func (*MsgData) ProtoMessage()

func (*MsgData) Reset

func (m *MsgData) Reset()

func (*MsgData) Size

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

func (*MsgData) String

func (this *MsgData) String() string

func (*MsgData) Unmarshal

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

func (*MsgData) XXX_DiscardUnknown

func (m *MsgData) XXX_DiscardUnknown()

func (*MsgData) XXX_Marshal

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

func (*MsgData) XXX_Merge

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

func (*MsgData) XXX_Size

func (m *MsgData) XXX_Size() int

func (*MsgData) XXX_Unmarshal

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

type MultiStore

type MultiStore = types.MultiStore

nolint - reexport

type ParamSet

type ParamSet interface {
	ParamSetPairs() ParamSetPairs
}

Interface for structs containing parameters for a module

type ParamSetPair

type ParamSetPair struct {
	Key   []byte      `json:"key"`
	Value interface{} `json:"value"`
}

Used for associating paramsubspace key and field of param structs

type ParamSetPairs

type ParamSetPairs []ParamSetPair

Slice of KeyFieldPair

type PeerFilter

type PeerFilter func(info string) abci.ResponseQuery

PeerFilter responds to p2p filtering queries from Tendermint

type PocketConfig

type PocketConfig struct {
	DataDir                    string `json:"data_dir"`
	GenesisName                string `json:"genesis_file"`
	ChainsName                 string `json:"chains_name"`
	EvidenceDBName             string `json:"evidence_db_name"`
	TendermintURI              string `json:"tendermint_uri"`
	KeybaseName                string `json:"keybase_name"`
	RPCPort                    string `json:"rpc_port"`
	ClientBlockSyncAllowance   int    `json:"client_block_sync_allowance"`
	ClientSessionSyncAllowance int64  `json:"client_session_sync_allowance"`
	MaxEvidenceCacheEntires    int    `json:"max_evidence_cache_entries"`
	MaxSessionCacheEntries     int    `json:"max_session_cache_entries"`
	JSONSortRelayResponses     bool   `json:"json_sort_relay_responses"`
	RemoteCLIURL               string `json:"remote_cli_url"`
	UserAgent                  string `json:"user_agent"`
	ValidatorCacheSize         int64  `json:"validator_cache_size"`
	ApplicationCacheSize       int64  `json:"application_cache_size"`
	RPCTimeout                 int64  `json:"rpc_timeout"`
	PrometheusAddr             string `json:"pocket_prometheus_port"`
	PrometheusMaxOpenfiles     int    `json:"prometheus_max_open_files"`
	MaxClaimAgeForProofRetry   int    `json:"max_claim_age_for_proof_retry"`
	ProofPrevalidation         bool   `json:"proof_prevalidation"`
	CtxCacheSize               int    `json:"ctx_cache_size"`
	ABCILogging                bool   `json:"abci_logging"`
	RelayErrors                bool   `json:"show_relay_errors"`
	DisableTxEvents            bool   `json:"disable_tx_events"`
	Cache                      bool   `json:"-"`
	IavlCacheSize              int64  `json:"iavl_cache_size"`
	ChainsHotReload            bool   `json:"chains_hot_reload"`
	GenerateTokenOnStart       bool   `json:"generate_token_on_start"`
	LeanPocket                 bool   `json:"lean_pocket"`
	LeanPocketUserKeyFileName  string `json:"lean_pocket_user_key_file"`
	PreventNegativeRewardClaim bool   `json:"prevent_negative_reward_claim"`
}

func (PocketConfig) GetLeanPocketUserKeyFilePath

func (c PocketConfig) GetLeanPocketUserKeyFilePath() string

type ProtoAddress

type ProtoAddress struct {
	Address Address `protobuf:"bytes,1,opt,name=address,proto3,casttype=Address" json:"address,omitempty"`
}

func (*ProtoAddress) Descriptor

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

func (ProtoAddress) FromProto

func (pa ProtoAddress) FromProto() Address

func (*ProtoAddress) GetAddress

func (m *ProtoAddress) GetAddress() Address

func (*ProtoAddress) Marshal

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

func (*ProtoAddress) MarshalTo

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

func (*ProtoAddress) MarshalToSizedBuffer

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

func (*ProtoAddress) ProtoMessage

func (*ProtoAddress) ProtoMessage()

func (*ProtoAddress) Reset

func (m *ProtoAddress) Reset()

func (*ProtoAddress) Size

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

func (*ProtoAddress) String

func (m *ProtoAddress) String() string

func (*ProtoAddress) Unmarshal

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

func (*ProtoAddress) XXX_DiscardUnknown

func (m *ProtoAddress) XXX_DiscardUnknown()

func (*ProtoAddress) XXX_Marshal

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

func (*ProtoAddress) XXX_Merge

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

func (*ProtoAddress) XXX_Size

func (m *ProtoAddress) XXX_Size() int

func (*ProtoAddress) XXX_Unmarshal

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

type ProtoAddresses

type ProtoAddresses struct {
	Arr Addresses `protobuf:"bytes,1,rep,name=arr,proto3,castrepeated=Addresses" json:"arr,omitempty"`
}

func (*ProtoAddresses) Descriptor

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

func (ProtoAddresses) FromProto

func (pa ProtoAddresses) FromProto() Addresses

func (*ProtoAddresses) GetArr

func (m *ProtoAddresses) GetArr() Addresses

func (*ProtoAddresses) Marshal

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

func (*ProtoAddresses) MarshalTo

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

func (*ProtoAddresses) MarshalToSizedBuffer

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

func (*ProtoAddresses) ProtoMessage

func (*ProtoAddresses) ProtoMessage()

func (*ProtoAddresses) Reset

func (m *ProtoAddresses) Reset()

func (*ProtoAddresses) Size

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

func (*ProtoAddresses) String

func (m *ProtoAddresses) String() string

func (*ProtoAddresses) Unmarshal

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

func (*ProtoAddresses) XXX_DiscardUnknown

func (m *ProtoAddresses) XXX_DiscardUnknown()

func (*ProtoAddresses) XXX_Marshal

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

func (*ProtoAddresses) XXX_Merge

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

func (*ProtoAddresses) XXX_Size

func (m *ProtoAddresses) XXX_Size() int

func (*ProtoAddresses) XXX_Unmarshal

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

type ProtoBool

type ProtoBool struct {
	B bool `protobuf:"varint,1,opt,name=b,proto3" json:"b,omitempty"`
}

func (*ProtoBool) Descriptor

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

func (ProtoBool) FromProto

func (pb ProtoBool) FromProto() Bool

func (*ProtoBool) GetB

func (m *ProtoBool) GetB() bool

func (*ProtoBool) Marshal

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

func (*ProtoBool) MarshalTo

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

func (*ProtoBool) MarshalToSizedBuffer

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

func (*ProtoBool) ProtoMessage

func (*ProtoBool) ProtoMessage()

func (*ProtoBool) Reset

func (m *ProtoBool) Reset()

func (*ProtoBool) Size

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

func (*ProtoBool) String

func (m *ProtoBool) String() string

func (*ProtoBool) Unmarshal

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

func (*ProtoBool) XXX_DiscardUnknown

func (m *ProtoBool) XXX_DiscardUnknown()

func (*ProtoBool) XXX_Marshal

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

func (*ProtoBool) XXX_Merge

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

func (*ProtoBool) XXX_Size

func (m *ProtoBool) XXX_Size() int

func (*ProtoBool) XXX_Unmarshal

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

type ProtoInt64

type ProtoInt64 struct {
	I int64 `protobuf:"varint,1,opt,name=i,proto3" json:"i,omitempty"`
}

func (*ProtoInt64) Descriptor

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

func (ProtoInt64) FromProto

func (pi ProtoInt64) FromProto() Int64

func (*ProtoInt64) GetI

func (m *ProtoInt64) GetI() int64

func (*ProtoInt64) Marshal

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

func (*ProtoInt64) MarshalTo

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

func (*ProtoInt64) MarshalToSizedBuffer

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

func (*ProtoInt64) ProtoMessage

func (*ProtoInt64) ProtoMessage()

func (*ProtoInt64) Reset

func (m *ProtoInt64) Reset()

func (*ProtoInt64) Size

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

func (*ProtoInt64) String

func (m *ProtoInt64) String() string

func (*ProtoInt64) Unmarshal

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

func (*ProtoInt64) XXX_DiscardUnknown

func (m *ProtoInt64) XXX_DiscardUnknown()

func (*ProtoInt64) XXX_Marshal

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

func (*ProtoInt64) XXX_Merge

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

func (*ProtoInt64) XXX_Size

func (m *ProtoInt64) XXX_Size() int

func (*ProtoInt64) XXX_Unmarshal

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

type ProtoMsg

type ProtoMsg interface {
	proto.Message
	// 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 ProtoMsg.
	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() []Address

	// Returns the recipient of the tx, if no recipient returns nil
	GetRecipient() Address

	// Returns an BigInt for the ProtoMsg
	GetFee() BigInt
}

Transactions messages must fulfill the ProtoMsg

type PruningOptions

type PruningOptions = types.PruningOptions

nolint - reexport

type Querier

type Querier = func(ctx Ctx, path []string, req abci.RequestQuery) (res []byte, err Error)

Type for querier functions on keepers to implement to handle custom queries

type QueryRouter

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

QueryRouter provides queryables for each query path.

type Queryable

type Queryable = types.Queryable

nolint - reexport

type Raw

type Raw []byte

Raw is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.

func (Raw) MarshalJSON

func (m Raw) MarshalJSON() ([]byte, error)

MarshalJSON returns m as the JSON encoding of m.

func (*Raw) UnmarshalJSON

func (m *Raw) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *m to a copy of data.

type ReadOnlySubspace

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

Wrapper of Subspace, provides immutable functions only

func (ReadOnlySubspace) Get

func (ros ReadOnlySubspace) Get(ctx Ctx, key []byte, ptr interface{})

Exposes Get

func (ReadOnlySubspace) GetRaw

func (ros ReadOnlySubspace) GetRaw(ctx Ctx, key []byte) ([]byte, error)

Exposes GetRaw

func (ReadOnlySubspace) Has

func (ros ReadOnlySubspace) Has(ctx Ctx, key []byte) (bool, error)

Exposes Has

func (ReadOnlySubspace) Modified

func (ros ReadOnlySubspace) Modified(ctx Ctx, key []byte) (bool, error)

Exposes Modified

func (ReadOnlySubspace) Name

func (ros ReadOnlySubspace) Name() string

Exposes Space

type Request

type Request = Context

Proposed rename, not done to avoid API breakage

type Result

type Result struct {
	Code      CodeType      `protobuf:"varint,1,opt,name=code,proto3,casttype=CodeType" json:"code,omitempty"`
	Codespace CodespaceType `protobuf:"bytes,2,opt,name=codespace,proto3,casttype=CodespaceType" json:"codespace,omitempty"`
	// 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 `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// Log contains the log information from message or handler execution.
	Log       string `protobuf:"bytes,4,opt,name=log,proto3" json:"log,omitempty"`
	GasWanted uint64 `protobuf:"varint,5,opt,name=gasWanted,proto3" json:"gasWanted,omitempty"`
	GasUsed   uint64 `protobuf:"varint,6,opt,name=gasUsed,proto3" json:"gasUsed,omitempty"`
	// Events contains a slice of Event objects that were emitted during message or
	// handler execution.
	Events Events `protobuf:"bytes,7,rep,name=events,proto3,castrepeated=Events" json:"events"`
}

Result is the union of ResponseFormat and ResponseCheckTx.

func (*Result) Descriptor

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

func (Result) IsOK

func (res Result) IsOK() bool

TODO: In the future, more codes may be OK.

func (*Result) Marshal

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

func (*Result) MarshalTo

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

func (*Result) MarshalToSizedBuffer

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

func (*Result) ProtoMessage

func (*Result) ProtoMessage()

func (*Result) Reset

func (m *Result) Reset()

func (*Result) Size

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

func (*Result) String

func (this *Result) String() string

func (*Result) Unmarshal

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

func (*Result) XXX_DiscardUnknown

func (m *Result) XXX_DiscardUnknown()

func (*Result) XXX_Marshal

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

func (*Result) XXX_Merge

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

func (*Result) XXX_Size

func (m *Result) XXX_Size() int

func (*Result) XXX_Unmarshal

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

type Router

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

Router provides handlers for each transaction type.

type SDKConfig

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

TmConfig 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() *SDKConfig

GetConfig returns the config instance for the SDK.

func (*SDKConfig) GetAddressVerifier

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

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

func (*SDKConfig) GetTxEncoder

func (config *SDKConfig) GetTxEncoder() TxEncoder

GetTxEncoder return function to encode transactions

func (*SDKConfig) Seal

func (config *SDKConfig) Seal() *SDKConfig

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

func (*SDKConfig) SetAddressVerifier

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

SetAddressVerifier builds the TmConfig with the provided function for verifying that Addresses have the correct format

func (*SDKConfig) SetCoinType

func (config *SDKConfig) SetCoinType(coinType uint32)

Set the BIP-0044 CoinType code on the config

func (*SDKConfig) SetTxEncoder

func (config *SDKConfig) SetTxEncoder(encoder TxEncoder)

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

type SimulationResponse

type SimulationResponse struct {
	GasInfo `protobuf:"bytes,1,opt,name=gas_info,json=gasInfo,proto3,embedded=gas_info" json:"gas_info"`
	Result  *Result `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
}

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

func (*SimulationResponse) Descriptor

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

func (*SimulationResponse) GetResult

func (m *SimulationResponse) GetResult() *Result

func (*SimulationResponse) Marshal

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

func (*SimulationResponse) MarshalTo

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

func (*SimulationResponse) MarshalToSizedBuffer

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

func (*SimulationResponse) ProtoMessage

func (*SimulationResponse) ProtoMessage()

func (*SimulationResponse) Reset

func (m *SimulationResponse) Reset()

func (*SimulationResponse) Size

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

func (*SimulationResponse) String

func (this *SimulationResponse) String() string

func (*SimulationResponse) Unmarshal

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

func (*SimulationResponse) XXX_DiscardUnknown

func (m *SimulationResponse) XXX_DiscardUnknown()

func (*SimulationResponse) XXX_Marshal

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

func (*SimulationResponse) XXX_Merge

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

func (*SimulationResponse) XXX_Size

func (m *SimulationResponse) XXX_Size() int

func (*SimulationResponse) XXX_Unmarshal

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

type StakeStatus

type StakeStatus byte

StakeStatus is the status of a validator

func (StakeStatus) Equal

func (b StakeStatus) Equal(b2 StakeStatus) bool

Equal compares two StakeStatus instances

func (StakeStatus) String

func (b StakeStatus) String() string

String implements the Stringer interface for StakeStatus.

type Store

type Store = types.Store

nolint - reexport

type StoreKey

type StoreKey = types.StoreKey

nolint - reexport

type StoreType

type StoreType = types.StoreType

nolint - reexport

type StringEvent

type StringEvent struct {
	Type       string      `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Attributes []Attribute `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes"`
}

StringEvent 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 abci.Event) StringEvent

StringifyEvent converts an Event object to a StringEvent object.

func (*StringEvent) Descriptor

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

func (*StringEvent) GetAttributes

func (m *StringEvent) GetAttributes() []Attribute

func (*StringEvent) GetType

func (m *StringEvent) GetType() string

func (*StringEvent) Marshal

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

func (*StringEvent) MarshalTo

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

func (*StringEvent) MarshalToSizedBuffer

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

func (*StringEvent) ProtoMessage

func (*StringEvent) ProtoMessage()

func (*StringEvent) Reset

func (m *StringEvent) Reset()

func (*StringEvent) Size

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

func (*StringEvent) String

func (this *StringEvent) String() string

func (*StringEvent) Unmarshal

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

func (*StringEvent) XXX_DiscardUnknown

func (m *StringEvent) XXX_DiscardUnknown()

func (*StringEvent) XXX_Marshal

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

func (*StringEvent) XXX_Merge

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

func (*StringEvent) XXX_Size

func (m *StringEvent) XXX_Size() int

func (*StringEvent) XXX_Unmarshal

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

type StringEvents

type StringEvents []StringEvent

StringAttributes defines a slice of StringEvents objects.

func StringifyEvents

func StringifyEvents(events []abci.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) String

func (se StringEvents) String() string

type Subspace

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

Individual parameter store for each keeper Transient store persists for a block, so we use it for recording whether the parameter has been changed or not

func NewSubspace

func NewSubspace(name string) (res Subspace)

NewSubspace constructs a store with namestore

func (Subspace) Get

func (s Subspace) Get(ctx Ctx, key []byte, ptr interface{})

Get parameter from store

func (Subspace) GetAllParamKeys

func (s Subspace) GetAllParamKeys(ctx Ctx) (keys []string)

func (Subspace) GetIfExists

func (s Subspace) GetIfExists(ctx Ctx, key []byte, ptr interface{})

GetIfExists do not modify ptr if the stored parameter is nil

func (Subspace) GetIfExistsRaw

func (s Subspace) GetIfExistsRaw(ctx Ctx, key []byte) []byte

func (Subspace) GetParamSet

func (s Subspace) GetParamSet(ctx Ctx, ps ParamSet)

Get to ParamSet

func (Subspace) GetRaw

func (s Subspace) GetRaw(ctx Ctx, key []byte) ([]byte, error)

Get raw bytes of parameter from store

func (Subspace) GetWithSubkey

func (s Subspace) GetWithSubkey(ctx Ctx, key, subkey []byte, ptr interface{})

GetWithSubkey returns a parameter with a given key and a subkey.

func (Subspace) GetWithSubkeyIfExists

func (s Subspace) GetWithSubkeyIfExists(ctx Ctx, key, subkey []byte, ptr interface{})

GetWithSubkeyIfExists returns a parameter with a given key and a subkey but does not modify ptr if the stored parameter is nil.

func (Subspace) Has

func (s Subspace) Has(ctx Ctx, key []byte) (bool, error)

Check if the parameter is set in the store

func (Subspace) Modified

func (s Subspace) Modified(ctx Ctx, key []byte) (bool, error)

Returns true if the parameter is set in the block

func (Subspace) Name

func (s Subspace) Name() string

Returns name of Subspace

func (Subspace) Set

func (s Subspace) Set(ctx Ctx, key []byte, param interface{})

Set stores the parameter. It returns error if stored parameter has different type from input. It also set to the transient store to record change.

func (*Subspace) SetCodec

func (s *Subspace) SetCodec(cdc *codec.Codec)

func (Subspace) SetParamSet

func (s Subspace) SetParamSet(ctx Ctx, ps ParamSet)

Set from ParamSet

func (Subspace) SetWithSubkey

func (s Subspace) SetWithSubkey(ctx Ctx, key []byte, subkey []byte, param interface{})

SetWithSubkey set a parameter with a key and subkey Checks parameter type only over the key

func (Subspace) Update

func (s Subspace) Update(ctx Ctx, key []byte, param []byte) error

Update stores raw parameter bytes. It returns error if the stored parameter has a different type from the input. It also sets to the transient store to record change.

func (Subspace) UpdateWithSubkey

func (s Subspace) UpdateWithSubkey(ctx Ctx, key []byte, subkey []byte, param []byte) error

UpdateWithSubkey stores raw parameter bytes with a key and subkey. It checks the parameter type only over the key.

func (Subspace) WithKeyTable

func (s Subspace) WithKeyTable(table KeyTable) Subspace

WithKeyTable initializes KeyTable and returns modified Subspace

type TraceContext

type TraceContext = types.TraceContext

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

type TransactionIndexer

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

func NewTransactionIndexer

func NewTransactionIndexer(store dbm.DB) *TransactionIndexer

func (*TransactionIndexer) AddBatch

func (t *TransactionIndexer) AddBatch(b *txindex.Batch) error

func (*TransactionIndexer) DeleteFromHeight

func (t *TransactionIndexer) DeleteFromHeight(ctx context.Context, height int64) error

func (*TransactionIndexer) Get

func (t *TransactionIndexer) Get(hash []byte) (*types.TxResult, error)

func (*TransactionIndexer) Index

func (t *TransactionIndexer) Index(result *types.TxResult) error

func (*TransactionIndexer) Search

func (t *TransactionIndexer) Search(ctx context.Context, q *query.Query) (res []*types.TxResult, total int, err error)

NOTE: Only supports op.Equal for hash, height, signer, or recipient, we only support op.Equal for simplicity and optimization of our use case

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.
	GetMsg() Msg

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

Transactions objects must fulfill the Tx

type TxDecoder

type TxDecoder func(txBytes []byte, blockHeight int64) (Tx, Error)

TxDecoder unmarshals transaction bytes

type TxEncoder

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

TxEncoder marshals transaction to bytes

type TxMsgData

type TxMsgData struct {
	Data []*MsgData `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
}

TxMsgData defines a list of MsgData. A transaction will have a MsgData object for each message.

func (*TxMsgData) Descriptor

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

func (*TxMsgData) GetData

func (m *TxMsgData) GetData() []*MsgData

func (*TxMsgData) Marshal

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

func (*TxMsgData) MarshalTo

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

func (*TxMsgData) MarshalToSizedBuffer

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

func (*TxMsgData) ProtoMessage

func (*TxMsgData) ProtoMessage()

func (*TxMsgData) Reset

func (m *TxMsgData) Reset()

func (*TxMsgData) Size

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

func (*TxMsgData) String

func (this *TxMsgData) String() string

func (*TxMsgData) Unmarshal

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

func (*TxMsgData) XXX_DiscardUnknown

func (m *TxMsgData) XXX_DiscardUnknown()

func (*TxMsgData) XXX_Marshal

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

func (*TxMsgData) XXX_Merge

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

func (*TxMsgData) XXX_Size

func (m *TxMsgData) XXX_Size() int

func (*TxMsgData) XXX_Unmarshal

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

type TxResponse

type TxResponse struct {
	// The block height
	Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	// The transaction hash.
	TxHash string `protobuf:"bytes,2,opt,name=txhash,proto3" json:"txhash,omitempty"`
	// Namespace for the Code
	Codespace string `protobuf:"bytes,3,opt,name=codespace,proto3" json:"codespace,omitempty"`
	// Response code.
	Code uint32 `protobuf:"varint,4,opt,name=code,proto3" json:"code,omitempty"`
	// Result bytes, if any.
	Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
	// The output of the application's logger (raw string). May be non-deterministic.
	RawLog string `protobuf:"bytes,6,opt,name=raw_log,json=rawLog,proto3" json:"raw_log,omitempty"`
	// The output of the application's logger (typed). May be non-deterministic.
	Logs ABCIMessageLogs `protobuf:"bytes,7,rep,name=logs,proto3,castrepeated=ABCIMessageLogs" json:"logs"`
	// Additional information. May be non-deterministic.
	Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"`
	// Amount of gas requested for transaction.
	GasWanted int64 `protobuf:"varint,9,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"`
	// Amount of gas consumed by transaction.
	GasUsed int64 `protobuf:"varint,10,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
	// The request transaction bytes.
	Tx *types.Any `protobuf:"bytes,11,opt,name=tx,proto3" json:"tx,omitempty"`
	// Time of the previous block. For heights > 1, it's the weighted median of the
	// timestamps of the valid votes in the block.LastCommit. For height == 1, it's genesis time.
	Timestamp string `protobuf:"bytes,12,opt,name=timestamp,proto3" 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) Descriptor

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

func (TxResponse) Empty

func (r TxResponse) Empty() bool

Empty returns true if the response is empty

func (*TxResponse) Marshal

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

func (*TxResponse) MarshalTo

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

func (*TxResponse) MarshalToSizedBuffer

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

func (*TxResponse) ProtoMessage

func (*TxResponse) ProtoMessage()

func (*TxResponse) Reset

func (m *TxResponse) Reset()

func (*TxResponse) Size

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

func (TxResponse) String

func (r TxResponse) String() string

func (*TxResponse) Unmarshal

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

func (*TxResponse) XXX_DiscardUnknown

func (m *TxResponse) XXX_DiscardUnknown()

func (*TxResponse) XXX_Marshal

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

func (*TxResponse) XXX_Merge

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

func (*TxResponse) XXX_Size

func (m *TxResponse) XXX_Size() int

func (*TxResponse) XXX_Unmarshal

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

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

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

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

MarshalObject implements the gogo proto custom type interface.

func (Uint) MarshalAmino

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

Override Amino binary serialization by proxying to protobuf.

func (Uint) MarshalJSON

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

MarshalJSON defines custom encoding scheme

func (*Uint) MarshalTo

func (u *Uint) MarshalTo(data []byte) (n int, err error)

MarshalTo implements the gogo proto custom type interface.

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

func (u *Uint) Size() int

Size implements the gogo proto custom type interface.

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

func (u *Uint) Unmarshal(data []byte) error

UnmarshalObject implements the gogo proto custom type interface.

func (*Uint) UnmarshalAmino

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

func (*Uint) UnmarshalJSON

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

UnmarshalJSON defines custom decoding scheme

Directories

Path Synopsis
Package module contains application module patterns and associated "manager" functionality.
Package module contains application module patterns and associated "manager" functionality.

Jump to

Keyboard shortcuts

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