types

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package types is a generated GoMock package.

Index

Constants

View Source
const (
	// AddrLen defines a valid address length
	AddrLen = 20
	// Bech32MainPrefix defines the Bech32 prefix of an account's address
	Bech32MainPrefix = "okchain"

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

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

	// 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

	// 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

Variables

View Source
var Cdc = NewCodec()

Cdc is the codec for signing

Functions

func Bech32ifyAccPub

func Bech32ifyAccPub(pub crypto.PubKey) (string, error)

Bech32ifyAccPub returns a Bech32 encoded string containing the Bech32PrefixAccPub prefix for a given account PubKey.

func Bech32ifyConsPub

func Bech32ifyConsPub(pub crypto.PubKey) (string, error)

Bech32ifyConsPub returns a Bech32 encoded string containing the Bech32PrefixConsPub prefixfor a given consensus node's PubKey

func CodeToDefaultMsg

func CodeToDefaultMsg(code CodeType) string

CodeToDefaultMsg converts code to string message NOTE: Don't stringer this, we'll put better messages in later.

func GetAccPubKeyBech32

func GetAccPubKeyBech32(pubkey string) (pk crypto.PubKey, err error)

GetAccPubKeyBech32 creates a PubKey for an account with a given public key string using the Bech32 Bech32PrefixAccPub prefix

func GetConsPubKeyBech32

func GetConsPubKeyBech32(pubkey string) (pk crypto.PubKey, err error)

GetConsPubKeyBech32 creates a PubKey for a consensus node with a given public key string using the Bech32 Bech32PrefixConsPub prefix

func GetFromBech32

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

GetFromBech32 decodes a bytestring from a Bech32 encoded string.

func MustBech32ifyAccPub

func MustBech32ifyAccPub(pub crypto.PubKey) string

MustBech32ifyAccPub returns the result of Bech32ifyAccPub panicing on failure.

func MustBech32ifyConsPub

func MustBech32ifyConsPub(pub crypto.PubKey) string

MustBech32ifyConsPub returns the result of Bech32ifyConsPub panicing on failure

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 NewDecFromStr

func NewDecFromStr(str string) (d Dec, err Error)

NewDecFromStr creates 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 RegisterBasicCodec

func RegisterBasicCodec(cdc SDKCodec)

RegisterBasicCodec registers the basic data types for gosdk codec

func SortJSON

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

SortJSON takes any JSON and returns it sorted by keys. Also, all white-spaces are removed

func VerifyAddressFormat

func VerifyAddressFormat(bz []byte) error

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

Types

type ABCIMessageLog

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

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

ABCIMessageLog defines a structure containing an indexed tx ABCI message log

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 AccAddress

type AccAddress []byte

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

func AccAddressFromBech32

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

AccAddressFromBech32 creates an AccAddress from a Bech32 string.

func (AccAddress) Bytes

func (aa AccAddress) Bytes() []byte

Bytes returns the raw address bytes.

func (AccAddress) Empty

func (aa AccAddress) Empty() bool

Empty returns boolean for whether an AccAddress is empty

func (AccAddress) Equals

func (aa AccAddress) Equals(aa2 Address) bool

Equals returns boolean for whether two AccAddresses are Equal

func (AccAddress) Format

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

Format implements the fmt.Formatter interface.

func (AccAddress) Marshal

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

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

func (AccAddress) MarshalJSON

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

MarshalJSON marshals to JSON using Bech32.

func (AccAddress) String

func (aa AccAddress) String() string

String implements the Stringer interface.

func (*AccAddress) Unmarshal

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

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

func (*AccAddress) UnmarshalJSON

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

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

type Address

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

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

type Attribute

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

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

func (Attribute) String

func (a Attribute) String() string

String returns a human readable string representation of Attribute

type BaseClient

type BaseClient interface {
	ClientQuery
	ClientTx
	TxHandler
	SimulationHandler
	GetCodec() SDKCodec
	GetConfig() ClientConfig
}

BaseClient shows the expected behavior for a base client

type BroadcastMode

type BroadcastMode string

BroadcastMode defines different mode to broadcast

const (
	BroadcastSync  BroadcastMode = "sync"
	BroadcastAsync BroadcastMode = "async"
	BroadcastBlock BroadcastMode = "commit"
)

const

type ClientConfig

type ClientConfig struct {
	NodeURI       string
	ChainID       string
	BroadcastMode BroadcastMode
	Gas           uint64
	GasAdjustment float64
	Fees          DecCoins
	GasPrices     DecCoins
}

ClientConfig records the base config of gosdk client

func NewClientConfig

func NewClientConfig(nodeURI, chainID string, broadcastMode BroadcastMode, feesStr string, gas uint64, gasAdjustment float64,
	gasPricesStr string) (
	cliConfig ClientConfig, err error)

NewClientConfig creates a new instance of ClientConfig

type ClientQuery

type ClientQuery interface {
	rpc.SignClient
	Query(path string, key cmn.HexBytes) ([]byte, error)
	QueryStore(key cmn.HexBytes, storeName, endPath string) ([]byte, error)
	QuerySubspace(subspace []byte, storeName string) ([]cmn.KVPair, error)
}

ClientQuery shows the expected query behavior

type ClientTx

type ClientTx interface {
	Broadcast(txBytes []byte, broadcastMode BroadcastMode) (res TxResponse, err error)
}

ClientTx shows the expected tx behavior

type CodeType

type CodeType uint32

CodeType - ABCI code identifier within codespace

func (CodeType) IsOK

func (code CodeType) IsOK() bool

IsOK - is everything okay?

type Codec

type Codec struct {
	*amino.Codec
}

Codec defines the codec only for okchain gosdk

func (Codec) RegisterConcrete

func (cdc Codec) RegisterConcrete(o interface{}, name string)

RegisterConcrete implements the SDKCodec interface

func (Codec) RegisterInterface

func (cdc Codec) RegisterInterface(ptr interface{})

RegisterInterface implements the SDKCodec interface

func (Codec) Seal

func (cdc Codec) Seal()

Seal implements the SDKCodec interface

type CodespaceType

type CodespaceType string

CodespaceType - codespace identifier

type Config

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

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

func GetConfig

func GetConfig() *Config

GetConfig returns the config instance for the SDK.

func (*Config) GetAddressVerifier

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

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

func (*Config) GetBech32AccountAddrPrefix

func (config *Config) GetBech32AccountAddrPrefix() string

GetBech32AccountAddrPrefix returns the Bech32 prefix for account address

func (*Config) GetBech32AccountPubPrefix

func (config *Config) GetBech32AccountPubPrefix() string

GetBech32AccountPubPrefix returns the Bech32 prefix for account public key

func (*Config) GetBech32ConsensusAddrPrefix

func (config *Config) GetBech32ConsensusAddrPrefix() string

GetBech32ConsensusAddrPrefix returns the Bech32 prefix for consensus node address

func (*Config) GetBech32ConsensusPubPrefix

func (config *Config) GetBech32ConsensusPubPrefix() string

GetBech32ConsensusPubPrefix returns the Bech32 prefix for consensus node public key

func (*Config) GetBech32ValidatorAddrPrefix

func (config *Config) GetBech32ValidatorAddrPrefix() string

GetBech32ValidatorAddrPrefix returns the Bech32 prefix for validator address

type ConsAddress

type ConsAddress []byte

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

func ConsAddressFromBech32

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

ConsAddressFromBech32 creates a ConsAddress from a Bech32 string

func (ConsAddress) Bytes

func (ca ConsAddress) Bytes() []byte

Bytes returns the raw address bytes

func (ConsAddress) Empty

func (ca ConsAddress) Empty() bool

Empty returns boolean for whether an ConsAddress is empty

func (ConsAddress) Equals

func (ca ConsAddress) Equals(ca2 Address) bool

Equals returns boolean for whether two ConsAddress are Equal

func (ConsAddress) Format

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

Format implements the fmt.Formatter interface

func (ConsAddress) Marshal

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

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

func (ConsAddress) MarshalJSON

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

MarshalJSON marshals to JSON using Bech32

func (ConsAddress) String

func (ca ConsAddress) String() string

String implements the Stringer interface

func (*ConsAddress) Unmarshal

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

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

func (*ConsAddress) UnmarshalJSON

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

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding

type Dec

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

Dec - structure for the number with decimal values NOTE: never use new(Dec) or else we will panic unmarshalling into the nil embedded big.Int

func MustNewDecFromStr

func MustNewDecFromStr(s string) Dec

MustNewDecFromStr parses decimal from string, panic on error

func NewDec

func NewDec(i int64) Dec

create a new Dec from integer assuming whole number

func NewDecFromBigInt

func NewDecFromBigInt(i *big.Int) Dec

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

func NewDecFromBigIntWithPrec

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

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

func NewDecFromInt

func NewDecFromInt(i Int) Dec

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

func NewDecFromIntWithPrec

func NewDecFromIntWithPrec(i Int, prec int64) Dec

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

func NewDecWithPrec

func NewDecWithPrec(i, prec int64) Dec

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

func OneDec

func OneDec() Dec

func ZeroDec

func ZeroDec() Dec

nolint - common values

func (Dec) Abs

func (d Dec) Abs() Dec

func (Dec) Add

func (d Dec) Add(d2 Dec) Dec

Add defines addition

func (Dec) Ceil

func (d Dec) Ceil() Dec

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

func (Dec) Equal

func (d Dec) Equal(d2 Dec) bool

func (Dec) Format

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

Format formats decimal state

func (Dec) GT

func (d Dec) GT(d2 Dec) bool

func (Dec) GTE

func (d Dec) GTE(d2 Dec) bool

func (Dec) IsInteger

func (d Dec) IsInteger() bool

IsInteger checks whether it is integer, e.g. decimals are zero

func (Dec) IsNegative

func (d Dec) IsNegative() bool

func (Dec) IsNil

func (d Dec) IsNil() bool

nolint

func (Dec) IsPositive

func (d Dec) IsPositive() bool

func (Dec) IsZero

func (d Dec) IsZero() bool

func (Dec) LT

func (d Dec) LT(d2 Dec) bool

func (Dec) LTE

func (d Dec) LTE(d2 Dec) bool

func (Dec) MarshalAmino

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

MarshalAmino wraps d.MarshalText()

func (Dec) MarshalJSON

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

MarshalJSON marshals the decimal

func (Dec) Mul

func (d Dec) Mul(d2 Dec) Dec

Mul defines multiplication

func (Dec) MulInt

func (d Dec) MulInt(i Int) Dec

MulInt defines multiplication with Int

func (Dec) MulInt64

func (d Dec) MulInt64(i int64) Dec

MulInt64 defines multiplication with int64

func (Dec) MulTruncate

func (d Dec) MulTruncate(d2 Dec) Dec

MulTruncate defines multiplication truncate

func (Dec) Neg

func (d Dec) Neg() Dec

func (Dec) Quo

func (d Dec) Quo(d2 Dec) Dec

Quo defines quotient

func (Dec) QuoInt

func (d Dec) QuoInt(i Int) Dec

QuoInt defines quotient

func (Dec) QuoInt64

func (d Dec) QuoInt64(i int64) Dec

QuoInt64 defines quotient with int64

func (Dec) QuoRoundUp

func (d Dec) QuoRoundUp(d2 Dec) Dec

QuoRoundUp defines quotient, round up

func (Dec) QuoTruncate

func (d Dec) QuoTruncate(d2 Dec) Dec

QuoTruncate defines quotient truncate

func (Dec) RoundInt

func (d Dec) RoundInt() Int

RoundInt rounds the decimal using bankers rounding

func (Dec) RoundInt64

func (d Dec) RoundInt64() int64

RoundInt64 rounds the decimal using bankers rounding

func (Dec) String

func (d Dec) String() string

String returns a human readable string representation of Dec

func (Dec) Sub

func (d Dec) Sub(d2 Dec) Dec

Sub defines subtraction

func (Dec) TruncateDec

func (d Dec) TruncateDec() Dec

TruncateDec truncates the decimals from the number and returns a Dec

func (Dec) TruncateInt

func (d Dec) TruncateInt() Int

TruncateInt truncates the decimals from the number and returns an Int

func (Dec) TruncateInt64

func (d Dec) TruncateInt64() int64

TruncateInt64 truncates the decimals from the number and returns an int64

func (*Dec) UnmarshalAmino

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

UnmarshalAmino requires a valid JSON string - strings quotes and calls UnmarshalText

func (*Dec) UnmarshalJSON

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

UnmarshalJSON defines custom decoding scheme

type DecCoin

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

DecCoin defines a coin which can have additional decimal points

func NewDecCoinFromDec

func NewDecCoinFromDec(denom string, amount Dec) DecCoin

NewDecCoinFromDec returns a dec coin from a Dec number and string denom

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

func (coin DecCoin) IsNegative() bool

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

func (DecCoin) IsPositive

func (coin DecCoin) IsPositive() bool

IsPositive returns true if coin amount is positive

func (DecCoin) IsZero

func (coin DecCoin) IsZero() bool

IsZero returns if the DecCoin amount is zero

type DecCoins

type DecCoins []DecCoin

DecCoins defines a slice of coins with decimal values

func NewDecCoins

func NewDecCoins(coins ...DecCoin) DecCoins

NewDecCoins creates a new instance of DecCoins

func ParseDecCoins

func ParseDecCoins(coinsStr string) (DecCoins, error)

ParseDecCoins parses DecCoins from string

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

func (coins DecCoins) IsAllPositive() bool

IsAllPositive returns true if there is at least one coin and all currencies

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

func (coins DecCoins) Sort() DecCoins

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

func (DecCoins) Swap

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

type Error

type Error interface {

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

	// set codespace
	WithDefaultCodespace(CodespaceType) Error

	Code() CodeType
	Codespace() CodespaceType
	ABCILog() string
	Result() Result
	QueryResult() abci.ResponseQuery
	// contains filtered or unexported methods
}

Error shows the expected behavior of a sdk error type

func ErrUnknownRequest

func ErrUnknownRequest(msg string) Error

nolint

type Event

type Event abci.Event

Event is a type alias for an ABCI Event

type Events

type Events []Event

Events defines a slice of Event objects

type Int

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

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

func MaxInt

func MaxInt(i, i2 Int) Int

MaxInt returns the maximum between two integers.

func MinInt

func MinInt(i1, i2 Int) Int

MinInt returns the minimum of the ints

func NewInt

func NewInt(n int64) Int

NewInt constructs Int from int64

func NewIntFromBigInt

func NewIntFromBigInt(i *big.Int) Int

NewIntFromBigInt constructs Int from big.Int

func (Int) Add

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

Add adds Int from another

func (Int) AddRaw

func (i Int) AddRaw(i2 int64) Int

AddRaw adds int64 to Int

func (Int) BigInt

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

BigInt converts Int to big.Int

func (Int) Equal

func (i Int) Equal(i2 Int) bool

Equal compares two Ints

func (Int) GT

func (i Int) GT(i2 Int) bool

GT returns true if first Int is greater than second

func (Int) GTE

func (i Int) GTE(i2 Int) bool

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

func (Int) Int64

func (i Int) Int64() int64

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

func (Int) IsInt64

func (i Int) IsInt64() bool

IsInt64 returns true if Int64() not panics

func (Int) IsNegative

func (i Int) IsNegative() bool

IsNegative returns true if Int is negative

func (Int) IsPositive

func (i Int) IsPositive() bool

IsPositive returns true if Int is positive

func (Int) IsZero

func (i Int) IsZero() bool

IsZero returns true if Int is zero

func (Int) LT

func (i Int) LT(i2 Int) bool

LT returns true if first Int is lesser than second

func (Int) LTE

func (i Int) LTE(i2 Int) bool

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

func (Int) MarshalAmino

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

MarshalAmino defines custom encoding scheme

func (Int) MarshalJSON

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

MarshalJSON defines custom encoding scheme

func (Int) Mod

func (i Int) Mod(i2 Int) Int

Mod returns remainder after dividing with Int

func (Int) ModRaw

func (i Int) ModRaw(i2 int64) Int

ModRaw returns remainder after dividing with int64

func (Int) Mul

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

Mul multiples two Ints

func (Int) MulRaw

func (i Int) MulRaw(i2 int64) Int

MulRaw multipies Int and int64

func (Int) Neg

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

Neg negates Int

func (Int) Quo

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

Quo divides Int with Int

func (Int) QuoRaw

func (i Int) QuoRaw(i2 int64) Int

QuoRaw divides Int with int64

func (Int) Sign

func (i Int) Sign() int

Sign returns sign of Int

func (Int) String

func (i Int) String() string

String returns Human readable string

func (Int) Sub

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

Sub subtracts Int from another

func (Int) SubRaw

func (i Int) SubRaw(i2 int64) Int

SubRaw subtracts int64 from Int

func (Int) ToDec

func (i Int) ToDec() Dec

ToDec converts Int to Dec

func (*Int) UnmarshalAmino

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

UnmarshalAmino defines custom decoding scheme

func (*Int) UnmarshalJSON

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

UnmarshalJSON defines custom decoding scheme

type MockBaseClient

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

MockBaseClient is a mock of BaseClient interface

func NewMockBaseClient

func NewMockBaseClient(ctrl *gomock.Controller) *MockBaseClient

NewMockBaseClient creates a new mock instance

func (*MockBaseClient) Block

func (m *MockBaseClient) Block(height *int64) (*core_types.ResultBlock, error)

Block mocks base method

func (*MockBaseClient) BlockResults

func (m *MockBaseClient) BlockResults(height *int64) (*core_types.ResultBlockResults, error)

BlockResults mocks base method

func (*MockBaseClient) Broadcast

func (m *MockBaseClient) Broadcast(txBytes []byte, broadcastMode BroadcastMode) (TxResponse, error)

Broadcast mocks base method

func (*MockBaseClient) BuildAndBroadcast

func (m *MockBaseClient) BuildAndBroadcast(fromName, passphrase, memo string, msgs []Msg, accNumber, seqNumber uint64) (TxResponse, error)

BuildAndBroadcast mocks base method

func (*MockBaseClient) BuildStdTx

func (m *MockBaseClient) BuildStdTx(fromName, passphrase, memo string, msgs []Msg, accNumber, seqNumber uint64) (StdTx, error)

BuildStdTx mocks base method

func (*MockBaseClient) BuildTxForSim

func (m *MockBaseClient) BuildTxForSim(msgs []Msg, memo string, accNumber, seqNumber uint64) ([]byte, error)

BuildTxForSim mocks base method

func (*MockBaseClient) BuildUnsignedStdTxOffline

func (m *MockBaseClient) BuildUnsignedStdTxOffline(msgs []Msg, memo string) StdTx

BuildUnsignedStdTxOffline mocks base method

func (*MockBaseClient) CalculateGas

func (m *MockBaseClient) CalculateGas(txBytes []byte) (StdFee, error)

CalculateGas mocks base method

func (*MockBaseClient) Commit

func (m *MockBaseClient) Commit(height *int64) (*core_types.ResultCommit, error)

Commit mocks base method

func (*MockBaseClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockBaseClient) GetCodec

func (m *MockBaseClient) GetCodec() SDKCodec

GetCodec mocks base method

func (*MockBaseClient) GetConfig

func (m *MockBaseClient) GetConfig() ClientConfig

GetConfig mocks base method

func (*MockBaseClient) Query

func (m *MockBaseClient) Query(path string, key common.HexBytes) ([]byte, error)

Query mocks base method

func (*MockBaseClient) QueryStore

func (m *MockBaseClient) QueryStore(key common.HexBytes, storeName, endPath string) ([]byte, error)

QueryStore mocks base method

func (*MockBaseClient) QuerySubspace

func (m *MockBaseClient) QuerySubspace(subspace []byte, storeName string) ([]common.KVPair, error)

QuerySubspace mocks base method

func (*MockBaseClient) Tx

func (m *MockBaseClient) Tx(hash []byte, prove bool) (*core_types.ResultTx, error)

Tx mocks base method

func (*MockBaseClient) TxSearch

func (m *MockBaseClient) TxSearch(query string, prove bool, page, perPage int) (*core_types.ResultTxSearch, error)

TxSearch mocks base method

func (*MockBaseClient) Validators

func (m *MockBaseClient) Validators(height *int64) (*core_types.ResultValidators, error)

Validators mocks base method

type MockBaseClientMockRecorder

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

MockBaseClientMockRecorder is the mock recorder for MockBaseClient

func (*MockBaseClientMockRecorder) Block

func (mr *MockBaseClientMockRecorder) Block(height interface{}) *gomock.Call

Block indicates an expected call of Block

func (*MockBaseClientMockRecorder) BlockResults

func (mr *MockBaseClientMockRecorder) BlockResults(height interface{}) *gomock.Call

BlockResults indicates an expected call of BlockResults

func (*MockBaseClientMockRecorder) Broadcast

func (mr *MockBaseClientMockRecorder) Broadcast(txBytes, broadcastMode interface{}) *gomock.Call

Broadcast indicates an expected call of Broadcast

func (*MockBaseClientMockRecorder) BuildAndBroadcast

func (mr *MockBaseClientMockRecorder) BuildAndBroadcast(fromName, passphrase, memo, msgs, accNumber, seqNumber interface{}) *gomock.Call

BuildAndBroadcast indicates an expected call of BuildAndBroadcast

func (*MockBaseClientMockRecorder) BuildStdTx

func (mr *MockBaseClientMockRecorder) BuildStdTx(fromName, passphrase, memo, msgs, accNumber, seqNumber interface{}) *gomock.Call

BuildStdTx indicates an expected call of BuildStdTx

func (*MockBaseClientMockRecorder) BuildTxForSim

func (mr *MockBaseClientMockRecorder) BuildTxForSim(msgs, memo, accNumber, seqNumber interface{}) *gomock.Call

BuildTxForSim indicates an expected call of BuildTxForSim

func (*MockBaseClientMockRecorder) BuildUnsignedStdTxOffline

func (mr *MockBaseClientMockRecorder) BuildUnsignedStdTxOffline(msgs, memo interface{}) *gomock.Call

BuildUnsignedStdTxOffline indicates an expected call of BuildUnsignedStdTxOffline

func (*MockBaseClientMockRecorder) CalculateGas

func (mr *MockBaseClientMockRecorder) CalculateGas(txBytes interface{}) *gomock.Call

CalculateGas indicates an expected call of CalculateGas

func (*MockBaseClientMockRecorder) Commit

func (mr *MockBaseClientMockRecorder) Commit(height interface{}) *gomock.Call

Commit indicates an expected call of Commit

func (*MockBaseClientMockRecorder) GetCodec

func (mr *MockBaseClientMockRecorder) GetCodec() *gomock.Call

GetCodec indicates an expected call of GetCodec

func (*MockBaseClientMockRecorder) GetConfig

func (mr *MockBaseClientMockRecorder) GetConfig() *gomock.Call

GetConfig indicates an expected call of GetConfig

func (*MockBaseClientMockRecorder) Query

func (mr *MockBaseClientMockRecorder) Query(path, key interface{}) *gomock.Call

Query indicates an expected call of Query

func (*MockBaseClientMockRecorder) QueryStore

func (mr *MockBaseClientMockRecorder) QueryStore(key, storeName, endPath interface{}) *gomock.Call

QueryStore indicates an expected call of QueryStore

func (*MockBaseClientMockRecorder) QuerySubspace

func (mr *MockBaseClientMockRecorder) QuerySubspace(subspace, storeName interface{}) *gomock.Call

QuerySubspace indicates an expected call of QuerySubspace

func (*MockBaseClientMockRecorder) Tx

func (mr *MockBaseClientMockRecorder) Tx(hash, prove interface{}) *gomock.Call

Tx indicates an expected call of Tx

func (*MockBaseClientMockRecorder) TxSearch

func (mr *MockBaseClientMockRecorder) TxSearch(query, prove, page, perPage interface{}) *gomock.Call

TxSearch indicates an expected call of TxSearch

func (*MockBaseClientMockRecorder) Validators

func (mr *MockBaseClientMockRecorder) Validators(height interface{}) *gomock.Call

Validators indicates an expected call of Validators

type MockClientQuery

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

MockClientQuery is a mock of ClientQuery interface

func NewMockClientQuery

func NewMockClientQuery(ctrl *gomock.Controller) *MockClientQuery

NewMockClientQuery creates a new mock instance

func (*MockClientQuery) Block

func (m *MockClientQuery) Block(height *int64) (*core_types.ResultBlock, error)

Block mocks base method

func (*MockClientQuery) BlockResults

func (m *MockClientQuery) BlockResults(height *int64) (*core_types.ResultBlockResults, error)

BlockResults mocks base method

func (*MockClientQuery) Commit

func (m *MockClientQuery) Commit(height *int64) (*core_types.ResultCommit, error)

Commit mocks base method

func (*MockClientQuery) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockClientQuery) Query

func (m *MockClientQuery) Query(path string, key common.HexBytes) ([]byte, error)

Query mocks base method

func (*MockClientQuery) QueryStore

func (m *MockClientQuery) QueryStore(key common.HexBytes, storeName, endPath string) ([]byte, error)

QueryStore mocks base method

func (*MockClientQuery) QuerySubspace

func (m *MockClientQuery) QuerySubspace(subspace []byte, storeName string) ([]common.KVPair, error)

QuerySubspace mocks base method

func (*MockClientQuery) Tx

func (m *MockClientQuery) Tx(hash []byte, prove bool) (*core_types.ResultTx, error)

Tx mocks base method

func (*MockClientQuery) TxSearch

func (m *MockClientQuery) TxSearch(query string, prove bool, page, perPage int) (*core_types.ResultTxSearch, error)

TxSearch mocks base method

func (*MockClientQuery) Validators

func (m *MockClientQuery) Validators(height *int64) (*core_types.ResultValidators, error)

Validators mocks base method

type MockClientQueryMockRecorder

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

MockClientQueryMockRecorder is the mock recorder for MockClientQuery

func (*MockClientQueryMockRecorder) Block

func (mr *MockClientQueryMockRecorder) Block(height interface{}) *gomock.Call

Block indicates an expected call of Block

func (*MockClientQueryMockRecorder) BlockResults

func (mr *MockClientQueryMockRecorder) BlockResults(height interface{}) *gomock.Call

BlockResults indicates an expected call of BlockResults

func (*MockClientQueryMockRecorder) Commit

func (mr *MockClientQueryMockRecorder) Commit(height interface{}) *gomock.Call

Commit indicates an expected call of Commit

func (*MockClientQueryMockRecorder) Query

func (mr *MockClientQueryMockRecorder) Query(path, key interface{}) *gomock.Call

Query indicates an expected call of Query

func (*MockClientQueryMockRecorder) QueryStore

func (mr *MockClientQueryMockRecorder) QueryStore(key, storeName, endPath interface{}) *gomock.Call

QueryStore indicates an expected call of QueryStore

func (*MockClientQueryMockRecorder) QuerySubspace

func (mr *MockClientQueryMockRecorder) QuerySubspace(subspace, storeName interface{}) *gomock.Call

QuerySubspace indicates an expected call of QuerySubspace

func (*MockClientQueryMockRecorder) Tx

func (mr *MockClientQueryMockRecorder) Tx(hash, prove interface{}) *gomock.Call

Tx indicates an expected call of Tx

func (*MockClientQueryMockRecorder) TxSearch

func (mr *MockClientQueryMockRecorder) TxSearch(query, prove, page, perPage interface{}) *gomock.Call

TxSearch indicates an expected call of TxSearch

func (*MockClientQueryMockRecorder) Validators

func (mr *MockClientQueryMockRecorder) Validators(height interface{}) *gomock.Call

Validators indicates an expected call of Validators

type MockClientTx

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

MockClientTx is a mock of ClientTx interface

func NewMockClientTx

func NewMockClientTx(ctrl *gomock.Controller) *MockClientTx

NewMockClientTx creates a new mock instance

func (*MockClientTx) Broadcast

func (m *MockClientTx) Broadcast(txBytes []byte, broadcastMode BroadcastMode) (TxResponse, error)

Broadcast mocks base method

func (*MockClientTx) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

type MockClientTxMockRecorder

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

MockClientTxMockRecorder is the mock recorder for MockClientTx

func (*MockClientTxMockRecorder) Broadcast

func (mr *MockClientTxMockRecorder) Broadcast(txBytes, broadcastMode interface{}) *gomock.Call

Broadcast indicates an expected call of Broadcast

type MockRPCClient

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

MockRPCClient is a mock of RPCClient interface

func NewMockRPCClient

func NewMockRPCClient(ctrl *gomock.Controller) *MockRPCClient

NewMockRPCClient creates a new mock instance

func (*MockRPCClient) ABCIInfo

func (m *MockRPCClient) ABCIInfo() (*core_types.ResultABCIInfo, error)

ABCIInfo mocks base method

func (*MockRPCClient) ABCIQuery

func (m *MockRPCClient) ABCIQuery(path string, data common.HexBytes) (*core_types.ResultABCIQuery, error)

ABCIQuery mocks base method

func (*MockRPCClient) ABCIQueryWithOptions

func (m *MockRPCClient) ABCIQueryWithOptions(path string, data common.HexBytes, opts client.ABCIQueryOptions) (*core_types.ResultABCIQuery, error)

ABCIQueryWithOptions mocks base method

func (*MockRPCClient) Block

func (m *MockRPCClient) Block(height *int64) (*core_types.ResultBlock, error)

Block mocks base method

func (*MockRPCClient) BlockResults

func (m *MockRPCClient) BlockResults(height *int64) (*core_types.ResultBlockResults, error)

BlockResults mocks base method

func (*MockRPCClient) BroadcastTxAsync

func (m *MockRPCClient) BroadcastTxAsync(tx types.Tx) (*core_types.ResultBroadcastTx, error)

BroadcastTxAsync mocks base method

func (*MockRPCClient) BroadcastTxCommit

func (m *MockRPCClient) BroadcastTxCommit(tx types.Tx) (*core_types.ResultBroadcastTxCommit, error)

BroadcastTxCommit mocks base method

func (*MockRPCClient) BroadcastTxSync

func (m *MockRPCClient) BroadcastTxSync(tx types.Tx) (*core_types.ResultBroadcastTx, error)

BroadcastTxSync mocks base method

func (*MockRPCClient) Commit

func (m *MockRPCClient) Commit(height *int64) (*core_types.ResultCommit, error)

Commit mocks base method

func (*MockRPCClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockRPCClient) Tx

func (m *MockRPCClient) Tx(hash []byte, prove bool) (*core_types.ResultTx, error)

Tx mocks base method

func (*MockRPCClient) TxSearch

func (m *MockRPCClient) TxSearch(query string, prove bool, page, perPage int) (*core_types.ResultTxSearch, error)

TxSearch mocks base method

func (*MockRPCClient) Validators

func (m *MockRPCClient) Validators(height *int64) (*core_types.ResultValidators, error)

Validators mocks base method

type MockRPCClientMockRecorder

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

MockRPCClientMockRecorder is the mock recorder for MockRPCClient

func (*MockRPCClientMockRecorder) ABCIInfo

func (mr *MockRPCClientMockRecorder) ABCIInfo() *gomock.Call

ABCIInfo indicates an expected call of ABCIInfo

func (*MockRPCClientMockRecorder) ABCIQuery

func (mr *MockRPCClientMockRecorder) ABCIQuery(path, data interface{}) *gomock.Call

ABCIQuery indicates an expected call of ABCIQuery

func (*MockRPCClientMockRecorder) ABCIQueryWithOptions

func (mr *MockRPCClientMockRecorder) ABCIQueryWithOptions(path, data, opts interface{}) *gomock.Call

ABCIQueryWithOptions indicates an expected call of ABCIQueryWithOptions

func (*MockRPCClientMockRecorder) Block

func (mr *MockRPCClientMockRecorder) Block(height interface{}) *gomock.Call

Block indicates an expected call of Block

func (*MockRPCClientMockRecorder) BlockResults

func (mr *MockRPCClientMockRecorder) BlockResults(height interface{}) *gomock.Call

BlockResults indicates an expected call of BlockResults

func (*MockRPCClientMockRecorder) BroadcastTxAsync

func (mr *MockRPCClientMockRecorder) BroadcastTxAsync(tx interface{}) *gomock.Call

BroadcastTxAsync indicates an expected call of BroadcastTxAsync

func (*MockRPCClientMockRecorder) BroadcastTxCommit

func (mr *MockRPCClientMockRecorder) BroadcastTxCommit(tx interface{}) *gomock.Call

BroadcastTxCommit indicates an expected call of BroadcastTxCommit

func (*MockRPCClientMockRecorder) BroadcastTxSync

func (mr *MockRPCClientMockRecorder) BroadcastTxSync(tx interface{}) *gomock.Call

BroadcastTxSync indicates an expected call of BroadcastTxSync

func (*MockRPCClientMockRecorder) Commit

func (mr *MockRPCClientMockRecorder) Commit(height interface{}) *gomock.Call

Commit indicates an expected call of Commit

func (*MockRPCClientMockRecorder) Tx

func (mr *MockRPCClientMockRecorder) Tx(hash, prove interface{}) *gomock.Call

Tx indicates an expected call of Tx

func (*MockRPCClientMockRecorder) TxSearch

func (mr *MockRPCClientMockRecorder) TxSearch(query, prove, page, perPage interface{}) *gomock.Call

TxSearch indicates an expected call of TxSearch

func (*MockRPCClientMockRecorder) Validators

func (mr *MockRPCClientMockRecorder) Validators(height interface{}) *gomock.Call

Validators indicates an expected call of Validators

type MockSimulationHandler

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

MockSimulationHandler is a mock of SimulationHandler interface

func NewMockSimulationHandler

func NewMockSimulationHandler(ctrl *gomock.Controller) *MockSimulationHandler

NewMockSimulationHandler creates a new mock instance

func (*MockSimulationHandler) BuildTxForSim

func (m *MockSimulationHandler) BuildTxForSim(msgs []Msg, memo string, accNumber, seqNumber uint64) ([]byte, error)

BuildTxForSim mocks base method

func (*MockSimulationHandler) CalculateGas

func (m *MockSimulationHandler) CalculateGas(txBytes []byte) (StdFee, error)

CalculateGas mocks base method

func (*MockSimulationHandler) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

type MockSimulationHandlerMockRecorder

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

MockSimulationHandlerMockRecorder is the mock recorder for MockSimulationHandler

func (*MockSimulationHandlerMockRecorder) BuildTxForSim

func (mr *MockSimulationHandlerMockRecorder) BuildTxForSim(msgs, memo, accNumber, seqNumber interface{}) *gomock.Call

BuildTxForSim indicates an expected call of BuildTxForSim

func (*MockSimulationHandlerMockRecorder) CalculateGas

func (mr *MockSimulationHandlerMockRecorder) CalculateGas(txBytes interface{}) *gomock.Call

CalculateGas indicates an expected call of CalculateGas

type MockTxHandler

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

MockTxHandler is a mock of TxHandler interface

func NewMockTxHandler

func NewMockTxHandler(ctrl *gomock.Controller) *MockTxHandler

NewMockTxHandler creates a new mock instance

func (*MockTxHandler) BuildAndBroadcast

func (m *MockTxHandler) BuildAndBroadcast(fromName, passphrase, memo string, msgs []Msg, accNumber, seqNumber uint64) (TxResponse, error)

BuildAndBroadcast mocks base method

func (*MockTxHandler) BuildStdTx

func (m *MockTxHandler) BuildStdTx(fromName, passphrase, memo string, msgs []Msg, accNumber, seqNumber uint64) (StdTx, error)

BuildStdTx mocks base method

func (*MockTxHandler) BuildUnsignedStdTxOffline

func (m *MockTxHandler) BuildUnsignedStdTxOffline(msgs []Msg, memo string) StdTx

BuildUnsignedStdTxOffline mocks base method

func (*MockTxHandler) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

type MockTxHandlerMockRecorder

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

MockTxHandlerMockRecorder is the mock recorder for MockTxHandler

func (*MockTxHandlerMockRecorder) BuildAndBroadcast

func (mr *MockTxHandlerMockRecorder) BuildAndBroadcast(fromName, passphrase, memo, msgs, accNumber, seqNumber interface{}) *gomock.Call

BuildAndBroadcast indicates an expected call of BuildAndBroadcast

func (*MockTxHandlerMockRecorder) BuildStdTx

func (mr *MockTxHandlerMockRecorder) BuildStdTx(fromName, passphrase, memo, msgs, accNumber, seqNumber interface{}) *gomock.Call

BuildStdTx indicates an expected call of BuildStdTx

func (*MockTxHandlerMockRecorder) BuildUnsignedStdTxOffline

func (mr *MockTxHandlerMockRecorder) BuildUnsignedStdTxOffline(msgs, memo interface{}) *gomock.Call

BuildUnsignedStdTxOffline indicates an expected call of BuildUnsignedStdTxOffline

type Module

type Module interface {
	RegisterCodec(cdc SDKCodec)
	Name() string
}

Module shows the expected behaviour of each module in okchain gosdk

type Msg

type Msg interface {
	Route() string
	Type() string
	ValidateBasic() Error
	GetSignBytes() []byte
	GetSigners() []AccAddress
}

Msg shows the expected behavior of any msgs of OKChain

type RPCClient

type RPCClient interface {
	rpc.ABCIClient
	rpc.SignClient
}

RPCClient shows the expected behavior for a inner exposed client

type Result

type Result struct {
	// Code is the response code, is stored back on the chain
	Code CodeType

	// Codespace is the string referring to the domain of an error
	Codespace CodespaceType

	// Data is any data returned from the app
	// Data has to be length prefixed in order to separate
	// results from multiple msgs executions
	Data []byte

	// Log contains the txs log information. NOTE: nondeterministic
	Log string

	// GasWanted is the maximum units of work we allow this tx to perform
	GasWanted uint64

	// GasUsed is the amount of gas actually consumed. NOTE: unimplemented
	GasUsed uint64

	// Events contains a slice of Event objects that were emitted during some execution
	Events Events
}

Result is the union of ResponseFormat and ResponseCheckTx

func (Result) IsOK

func (res Result) IsOK() bool

IsOK shows whether the result is successful TODO: In the future, more codes may be OK

type SDKCodec

type SDKCodec interface {
	MarshalJSON(o interface{}) ([]byte, error)
	UnmarshalJSON(bytes []byte, ptr interface{}) error
	MustMarshalJSON(o interface{}) []byte
	MustUnmarshalJSON(bytes []byte, ptr interface{})

	MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error)
	UnmarshalBinaryLengthPrefixed(bytes []byte, ptr interface{}) error
	MustMarshalBinaryLengthPrefixed(o interface{}) []byte
	MustUnmarshalBinaryLengthPrefixed(bytes []byte, ptr interface{})

	MarshalBinaryBare(o interface{}) ([]byte, error)
	UnmarshalBinaryBare(bytes []byte, ptr interface{}) error

	RegisterConcrete(o interface{}, name string)
	RegisterInterface(ptr interface{})

	Seal()
}

SDKCodec shows the expected behaviour of codec in okchain gosdk

func NewCodec

func NewCodec() SDKCodec

NewCodec creates a new instance of codec only for gosdk

type SearchTxsResult

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

SearchTxsResult defines a structure for querying txs pageable

type SimulationHandler

type SimulationHandler interface {
	CalculateGas(txBytes []byte) (StdFee, error)
	BuildTxForSim(msgs []Msg, memo string, accNumber, seqNumber uint64) ([]byte, error)
}

SimulationHandler shows the expected behavior to handle simulation

type StdFee

type StdFee struct {
	Amount DecCoins `json:"amount"`
	Gas    uint64   `json:"gas"`
}

StdFee includes the amount of coins paid in fees and the maximum gas to be used by the transaction

func NewStdFee

func NewStdFee(gas uint64, amount DecCoins) StdFee

NewStdFee creates a new instance of StdFee

func (StdFee) Bytes

func (sf StdFee) Bytes() []byte

Bytes for signing later

type StdSignDoc

type StdSignDoc struct {
	AccountNumber uint64            `json:"account_number"`
	ChainID       string            `json:"chain_id"`
	Fee           json.RawMessage   `json:"fee"`
	Memo          string            `json:"memo"`
	Msgs          []json.RawMessage `json:"msgs"`
	Sequence      uint64            `json:"sequence"`
}

StdSignDoc is replay-prevention structure It includes the result of msg.GetSignBytes(), as well as the ChainID (prevent cross chain replay) and the Sequence numbers for each signature (prevent inchain replay and enforce tx ordering per account)

type StdSignMsg

type StdSignMsg struct {
	ChainID       string `json:"chain_id"`
	AccountNumber uint64 `json:"account_number"`
	Sequence      uint64 `json:"sequence"`
	Fee           StdFee `json:"fee"`
	Msgs          []Msg  `json:"msgs"`
	Memo          string `json:"memo"`
}

StdSignMsg is a convenience structure for passing along a Msg with the other requirements for a StdSignDoc before it is signed

func (StdSignMsg) Bytes

func (msg StdSignMsg) Bytes() []byte

Bytes gets message bytes

type StdSignature

type StdSignature struct {
	crypto.PubKey `json:"pub_key"`
	Signature     []byte `json:"signature"`
}

StdSignature is the struct of signature in stdTx

func NewStdSignature

func NewStdSignature(pubkey crypto.PubKey, signature []byte) StdSignature

NewStdSignature creates a new instance of std signature

type StdTx

type StdTx struct {
	Msgs       []Msg          `json:"msg"`
	Fee        StdFee         `json:"fee"`
	Signatures []StdSignature `json:"signatures"`
	Memo       string         `json:"memo"`
}

StdTx is a standard way to wrap a Msg with Fee and Signatures

func NewStdTx

func NewStdTx(msgs []Msg, fee StdFee, sigs []StdSignature, memo string) StdTx

NewStdTx creates a new instance of StdTx

func (StdTx) GetMsgs

func (st StdTx) GetMsgs() []Msg

nolint

func (StdTx) ValidateBasic

func (st StdTx) ValidateBasic() Error

type StringEvent

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

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

type StringEvents

type StringEvents []StringEvent

StringEvents 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

String returns a human readable string representation of StringEvents

type Tx

type Tx interface {
	GetMsgs() []Msg
	ValidateBasic() Error
}

Tx shows the expected behavior of any txs of OKChain

type TxDecoder

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

TxDecoder unmarshals transaction bytes

type TxEncoder

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

TxEncoder marshals transaction to bytes

type TxHandler

type TxHandler interface {
	BuildAndBroadcast(fromName, passphrase, memo string, msgs []Msg, accNumber, seqNumber uint64) (TxResponse, error)
	BuildStdTx(fromName, passphrase, memo string, msgs []Msg, accNumber, seqNumber uint64) (StdTx, error)
	BuildUnsignedStdTxOffline(msgs []Msg, memo string) StdTx
}

TxHandler shows the expected behavior to handle tx

type TxResponse

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

	// DEPRECATED: Remove in the next next major release in favor of using the ABCIMessageLog.Events field
	Events StringEvents `json:"events,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 (TxResponse) Empty

func (r TxResponse) Empty() bool

Empty returns true if the response is empty

func (TxResponse) String

func (r TxResponse) String() string

String returns a human readable string representation of TxResponse

type ValAddress

type ValAddress []byte

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

func ValAddressFromBech32

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

ValAddressFromBech32 creates a ValAddress from a Bech32 string.

func (ValAddress) Bytes

func (va ValAddress) Bytes() []byte

Bytes returns the raw address bytes

func (ValAddress) Empty

func (va ValAddress) Empty() bool

Empty returns boolean for whether an ValAddress is empty

func (ValAddress) Equals

func (va ValAddress) Equals(va2 Address) bool

Equals returns boolean for whether two ValAddresses are Equal

func (ValAddress) Format

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

Format implements the fmt.Formatter interface

func (ValAddress) Marshal

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

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

func (ValAddress) MarshalJSON

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

MarshalJSON marshals to JSON using Bech32

func (ValAddress) String

func (va ValAddress) String() string

String implements the Stringer interface

func (*ValAddress) Unmarshal

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

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

func (*ValAddress) UnmarshalJSON

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

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding

Directories

Path Synopsis
keys/hd
Package hd provides basic functionality Hierarchical Deterministic Wallets.
Package hd provides basic functionality Hierarchical Deterministic Wallets.

Jump to

Keyboard shortcuts

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