types

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Precision = 8

	// bytes required to represent the above precision
	// ceil(log2(9999999999))
	DecimalPrecisionBits = 34
)

number of decimal places

View Source
const (
	OperateFeeType  = "operate"
	TransferFeeType = "transfer"
	DexFeeType      = "dex"

	FeeForProposer = FeeDistributeType(0x01)
	FeeForAll      = FeeDistributeType(0x02)
	FeeFree        = FeeDistributeType(0x03)
)
View Source
const (
	SideBuy  = "BUY"
	SideSell = "SELL"
)
View Source
const (
	AddrLen = 20
)

Variables

View Source
var (
	// Fixed8Decimals represents 10^precision (100000000), a value of 1 in Fixed8 format
	Fixed8Decimals = int(math.Pow10(precision))
	// Fixed8One represetns one unit
	Fixed8One  = NewFixed8(1)
	Fixed8Zero = NewFixed8(0)
)
View Source
var (
	SideChainStorePrefixByIdKey = []byte{0x01} // prefix for each key to a side chain store prefix, by side chain id

	PrefixForSendSequenceKey    = []byte{0xf0}
	PrefixForReceiveSequenceKey = []byte{0xf1}
)
View Source
var (
	// Param error
	AddressMissingError           = errors.New("Address is required ")
	SymbolMissingError            = errors.New("Symbol is required ")
	OffsetOutOfRangeError         = errors.New("offset out of range ")
	LimitOutOfRangeError          = errors.New("limit out of range ")
	TradeSideMisMatchError        = errors.New("Trade side is invalid ")
	StartTimeOutOfRangeError      = errors.New("start time out of range ")
	EndTimeOutOfRangeError        = errors.New("end time out of range ")
	IntervalMissingError          = errors.New("interval is required ")
	EndTimeLessThanStartTimeError = errors.New("end time should great than start time")
	OrderIdMissingError           = errors.New("order id is required ")
)
View Source
var Network = ProdNetwork
View Source
var OrderSide = struct {
	BUY  string
	SELL string
}{
	"BUY",
	"SELL",
}

OrderSide enum

View Source
var OrderStatus = struct {
	ACK              string
	PARTIALLY_FILLED string
	IOC_NO_FILL      string
	FULLY_FILLED     string
	CANCELED         string
	EXPIRED          string
	UNKNOWN          string
}{
	"ACK",
	"PARTIALLY_FILLED",
	"IOC_NO_FILL",
	"FULLY_FILLED",
	"CANCELED",
	"EXPIRED",
	"UNKNOWN",
}

OrderStatus enum

View Source
var OrderType = struct {
	LIMIT             string
	MARKET            string
	STOP_LOSS         string
	STOP_LOSS_LIMIT   string
	TAKE_PROFIT       string
	TAKE_PROFIT_LIMIT string
	LIMIT_MAKER       string
}{
	"LIMIT",
	"MARKET",
	"STOP_LOSS",
	"STOP_LOSS_LIMIT",
	"TAKE_PROFIT",
	"TAKE_PROFIT_LIMIT",
	"LIMIT_MAKER",
}

OrderType enum

View Source
var TimeInForce = struct {
	GTC string
	IOC string
}{"GTC", "IOC"}

TimeInForce enum

Functions

func Bech32ifyConsPub added in v1.0.5

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

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

func GetFromBech32

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

GetFromBech32 to decode a bytestring from a bech32-encoded string

func GetReceiveSequenceKey added in v1.2.4

func GetReceiveSequenceKey(destIbcChainID IbcChainID, channelID IbcChannelID) []byte

func MustBech32ifyConsPub added in v1.0.5

func MustBech32ifyConsPub(pub crypto.PubKey) string

func RegisterWire

func RegisterWire(cdc *amino.Codec)

Types

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 to create an AccAddress from a bech32 string

func AccAddressFromHex

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

AccAddressFromHex to create an AccAddress from a hex string

func (AccAddress) Bytes

func (bz AccAddress) Bytes() []byte

func (AccAddress) Marshal

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

Marshal needed for protobuf compatibility

func (AccAddress) MarshalJSON

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

MarshalJSON to Marshals to JSON using Bech32

func (AccAddress) String

func (bz AccAddress) String() string

String representation

func (*AccAddress) Unmarshal

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

Unmarshal needed for protobuf compatibility

func (*AccAddress) UnmarshalJSON

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

UnmarshalJSON to Unmarshal from JSON assuming Bech32 encoding

type Account

type Account interface {
	GetAddress() AccAddress
	SetAddress(address AccAddress) error // errors if already set.

	GetPubKey() crypto.PubKey // can return nil.
	SetPubKey(crypto.PubKey) error

	GetAccountNumber() int64
	SetAccountNumber(int64) error

	GetSequence() int64
	SetSequence(int64) error

	GetCoins() Coins
	SetCoins(Coins) error
	Clone() Account

	GetFlags() uint64
	SetFlags(flags uint64)
}

type AppAccount

type AppAccount struct {
	BaseAccount `json:"base"`
	Name        string `json:"name"`
	FrozenCoins Coins  `json:"frozen"`
	LockedCoins Coins  `json:"locked"`
	Flags       uint64 `json:"flags"`
}

AppAccount definition

func (*AppAccount) Clone

func (acc *AppAccount) Clone() Account

func (*AppAccount) GetFlags added in v1.0.9

func (acc *AppAccount) GetFlags() uint64

func (AppAccount) GetFrozenCoins

func (acc AppAccount) GetFrozenCoins() Coins

func (AppAccount) GetLockedCoins

func (acc AppAccount) GetLockedCoins() Coins

func (AppAccount) GetName

func (acc AppAccount) GetName() string

func (*AppAccount) SetFlags added in v1.0.9

func (acc *AppAccount) SetFlags(flags uint64)

func (*AppAccount) SetFrozenCoins

func (acc *AppAccount) SetFrozenCoins(frozen Coins)

func (*AppAccount) SetLockedCoins

func (acc *AppAccount) SetLockedCoins(frozen Coins)

func (*AppAccount) SetName

func (acc *AppAccount) SetName(name string)

type AtomicSwap added in v1.1.3

type AtomicSwap struct {
	From      AccAddress `json:"from"`
	To        AccAddress `json:"to"`
	OutAmount Coins      `json:"out_amount"`
	InAmount  Coins      `json:"in_amount"`

	ExpectedIncome      string `json:"expected_income"`
	RecipientOtherChain string `json:"recipient_other_chain"`

	RandomNumberHash SwapBytes `json:"random_number_hash"`
	RandomNumber     SwapBytes `json:"random_number"`
	Timestamp        int64     `json:"timestamp"`

	CrossChain bool `json:"cross_chain"`

	ExpireHeight int64      `json:"expire_height"`
	Index        int64      `json:"index"`
	ClosedTime   int64      `json:"closed_time"`
	Status       SwapStatus `json:"status"`
}

type BalanceAccount

type BalanceAccount struct {
	Number    int64          `json:"account_number"`
	Address   string         `json:"address"`
	Balances  []TokenBalance `json:"balances"`
	PublicKey []uint8        `json:"public_key"`
	Sequence  int64          `json:"sequence"`
	Flags     uint64         `json:"flags"`
}

Balance Account definition

type BaseAccount

type BaseAccount struct {
	Address       AccAddress    `json:"address"`
	Coins         Coins         `json:"coins"`
	PubKey        crypto.PubKey `json:"public_key"`
	AccountNumber int64         `json:"account_number"`
	Sequence      int64         `json:"sequence"`
}

func (*BaseAccount) Clone

func (acc *BaseAccount) Clone() BaseAccount

Implements sdk.Account.

func (*BaseAccount) GetAccountNumber

func (acc *BaseAccount) GetAccountNumber() int64

Implements Account

func (BaseAccount) GetAddress

func (acc BaseAccount) GetAddress() AccAddress

Implements sdk.Account.

func (*BaseAccount) GetCoins

func (acc *BaseAccount) GetCoins() Coins

Implements sdk.Account.

func (BaseAccount) GetPubKey

func (acc BaseAccount) GetPubKey() crypto.PubKey

Implements sdk.Account.

func (*BaseAccount) GetSequence

func (acc *BaseAccount) GetSequence() int64

Implements sdk.Account.

func (*BaseAccount) SetAccountNumber

func (acc *BaseAccount) SetAccountNumber(accNumber int64) error

Implements Account

func (*BaseAccount) SetAddress

func (acc *BaseAccount) SetAddress(addr AccAddress) error

Implements sdk.Account.

func (*BaseAccount) SetCoins

func (acc *BaseAccount) SetCoins(coins Coins) error

Implements sdk.Account.

func (*BaseAccount) SetPubKey

func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error

Implements sdk.Account.

func (*BaseAccount) SetSequence

func (acc *BaseAccount) SetSequence(seq int64) error

Implements sdk.Account.

type BaseParams added in v1.2.4

type BaseParams struct {
	SideChainId string
}

func NewBaseParams added in v1.2.4

func NewBaseParams(sideChainId string) BaseParams

type BondStatus

type BondStatus byte
const (
	Unbonded  BondStatus = 0x00
	Unbonding BondStatus = 0x01
	Bonded    BondStatus = 0x02
)

nolint

type ChainNetwork

type ChainNetwork uint8
const (
	TestNetwork ChainNetwork = iota
	ProdNetwork
	TmpTestNetwork
	GangesNetwork
)

func (ChainNetwork) Bech32Prefixes

func (this ChainNetwork) Bech32Prefixes() string

func (ChainNetwork) Bech32ValidatorAddrPrefix

func (this ChainNetwork) Bech32ValidatorAddrPrefix() string

type CloseOrders

type CloseOrders struct {
	Order []Order `json:"order"`
	Total int     `json:"total"`
}

type ClosedOrdersQuery

type ClosedOrdersQuery struct {
	SenderAddress string  `json:"address"`                 // required
	Symbol        string  `json:"symbol,omitempty"`        //option
	Offset        *uint32 `json:"offset,omitempty,string"` //option
	Limit         *uint32 `json:"limit,omitempty,string"`  //option
	Start         *int64  `json:"start,omitempty,string"`  //option
	End           *int64  `json:"end,omitempty,string"`    //option
	Side          string  `json:"side,omitempty"`          //option
	Total         int     `json:"total,string"`            //0 for not required and 1 for required; default not required, return total=-1 in response
}

ClosedOrdersQuery definition

func NewClosedOrdersQuery

func NewClosedOrdersQuery(senderAddress string, withTotal bool) *ClosedOrdersQuery

func (*ClosedOrdersQuery) Check

func (param *ClosedOrdersQuery) Check() error

func (*ClosedOrdersQuery) WithEnd

func (param *ClosedOrdersQuery) WithEnd(end int64) *ClosedOrdersQuery

func (*ClosedOrdersQuery) WithLimit

func (param *ClosedOrdersQuery) WithLimit(limit uint32) *ClosedOrdersQuery

func (*ClosedOrdersQuery) WithOffset

func (param *ClosedOrdersQuery) WithOffset(offset uint32) *ClosedOrdersQuery

func (*ClosedOrdersQuery) WithSide

func (param *ClosedOrdersQuery) WithSide(side string) *ClosedOrdersQuery

func (*ClosedOrdersQuery) WithStart

func (param *ClosedOrdersQuery) WithStart(start int64) *ClosedOrdersQuery

func (*ClosedOrdersQuery) WithSymbol

func (param *ClosedOrdersQuery) WithSymbol(baseAssetSymbol, quoteAssetSymbol string) *ClosedOrdersQuery

type Coin

type Coin struct {
	Denom  string `json:"denom"`
	Amount int64  `json:"amount"`
}

Coin def

func (Coin) IsNotNegative

func (coin Coin) IsNotNegative() bool

func (Coin) IsPositive

func (coin Coin) IsPositive() bool

func (Coin) IsZero

func (coin Coin) IsZero() bool

func (Coin) Plus

func (coin Coin) Plus(coinB Coin) Coin

func (Coin) SameDenomAs

func (coin Coin) SameDenomAs(other Coin) bool

func (Coin) String added in v1.2.4

func (coin Coin) String() string

type Coins

type Coins []Coin

Coins def

func (Coins) AmountOf

func (coins Coins) AmountOf(denom string) int64

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

func (coins Coins) IsNotNegative() bool

func (Coins) IsPositive

func (coins Coins) IsPositive() bool

func (Coins) IsValid

func (coins Coins) IsValid() bool

func (Coins) IsZero added in v1.0.5

func (coins Coins) IsZero() bool

func (Coins) Len added in v1.0.6

func (coins Coins) Len() int

nolint

func (Coins) Less added in v1.0.6

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

func (Coins) Plus

func (coins Coins) Plus(coinsB Coins) Coins

func (Coins) Sort added in v1.0.6

func (coins Coins) Sort() Coins

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

func (Coins) String added in v1.2.4

func (coins Coins) String() string

func (Coins) Swap added in v1.0.6

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

type Commission

type Commission struct {
	Rate          Dec       `json:"rate"`            // the commission rate charged to delegators
	MaxRate       Dec       `json:"max_rate"`        // maximum commission rate which validator can ever charge
	MaxChangeRate Dec       `json:"max_change_rate"` // maximum daily increase of the validator commission
	UpdateTime    time.Time `json:"update_time"`     // the last time the commission rate was changed
}

Commission defines a commission parameters for a given validator.

func NewCommission added in v1.0.5

func NewCommission(rate, maxRate, maxChangeRate Dec) Commission

func (Commission) String

func (c Commission) String() string

func (Commission) Validate added in v1.0.5

func (c Commission) Validate() error

Validate performs basic sanity validation checks of initial commission parameters. If validation fails, an error is returned.

func (Commission) ValidateNewRate added in v1.0.5

func (c Commission) ValidateNewRate(newRate Dec, blockTime time.Time) error

ValidateNewRate performs basic sanity validation checks of a new commission rate. If validation fails, an SDK error is returned.

type CommissionMsg added in v1.0.5

type CommissionMsg struct {
	Rate          Dec `json:"rate"`            // the commission rate charged to delegators
	MaxRate       Dec `json:"max_rate"`        // maximum commission rate which validator can ever charge
	MaxChangeRate Dec `json:"max_change_rate"` // maximum daily increase of the validator commission
}

CommissionMsg defines a commission message to be used for creating a validator.

type ConsAddress added in v1.0.5

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 added in v1.0.5

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

ConsAddressFromBech32 creates a ConsAddress from a Bech32 string.

func ConsAddressFromHex added in v1.0.5

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

ConsAddressFromHex creates a ConsAddress from a hex string.

func GetConsAddress added in v1.0.5

func GetConsAddress(pubkey crypto.PubKey) ConsAddress

get ConsAddress from pubkey

func (ConsAddress) Bytes added in v1.0.5

func (ca ConsAddress) Bytes() []byte

Bytes returns the raw address bytes.

func (ConsAddress) Empty added in v1.0.5

func (ca ConsAddress) Empty() bool

Returns boolean for whether an ConsAddress is empty

func (ConsAddress) Equals added in v1.0.5

func (ca ConsAddress) Equals(ca2 ConsAddress) bool

Returns boolean for whether two ConsAddress are Equal

func (ConsAddress) Format added in v1.0.5

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

Format implements the fmt.Formatter interface. nolint: errcheck

func (ConsAddress) Marshal added in v1.0.5

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

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

func (ConsAddress) MarshalJSON added in v1.0.5

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

MarshalJSON marshals to JSON using Bech32.

func (ConsAddress) String added in v1.0.5

func (ca ConsAddress) String() string

String implements the Stringer interface.

func (*ConsAddress) Unmarshal added in v1.0.5

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

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

func (*ConsAddress) UnmarshalJSON added in v1.0.5

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

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

type Dec

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

func NewDecFromStr

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

func NewDecWithPrec added in v1.2.4

func NewDecWithPrec(i, prec int64) Dec

func OneDec added in v1.0.5

func OneDec() Dec

func ZeroDec added in v1.0.5

func ZeroDec() Dec

nolint - common values

func (Dec) Abs added in v1.0.5

func (d Dec) Abs() Dec

func (Dec) Equal added in v1.0.5

func (d Dec) Equal(d2 Dec) bool

func (Dec) GT added in v1.0.5

func (d Dec) GT(d2 Dec) bool

func (Dec) GTE added in v1.0.5

func (d Dec) GTE(d2 Dec) bool

func (Dec) IsNil added in v1.0.5

func (d Dec) IsNil() bool

nolint

func (Dec) IsZero added in v1.0.5

func (d Dec) IsZero() bool

func (Dec) LT added in v1.0.5

func (d Dec) LT(d2 Dec) bool

func (Dec) LTE added in v1.0.5

func (d Dec) LTE(d2 Dec) bool

func (Dec) MarshalAmino

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

func (Dec) MarshalJSON

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

MarshalJSON marshals the decimal

func (Dec) MarshalText

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

func (Dec) Neg added in v1.0.5

func (d Dec) Neg() Dec

func (Dec) String

func (d Dec) String() string

func (Dec) Sub added in v1.0.5

func (d Dec) Sub(d2 Dec) Dec

subtraction

func (*Dec) UnmarshalAmino

func (d *Dec) UnmarshalAmino(v int64) (err error)

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

func (*Dec) UnmarshalText

func (d *Dec) UnmarshalText(text []byte) error

type Delegation added in v1.2.4

type Delegation struct {
	DelegatorAddr AccAddress `json:"delegator_addr"`
	ValidatorAddr ValAddress `json:"validator_addr"`
	Shares        Dec        `json:"shares"`
}

Delegation represents the bond with tokens held by an account. It is owned by one delegator, and is associated with the voting power of one pubKey.

type DelegationResponse added in v1.2.4

type DelegationResponse struct {
	Delegation
	Balance Coin `json:"balance"`
}

type DelegationValue added in v1.2.4

type DelegationValue struct {
	Shares Dec
	Height int64
}

type DepthQuery

type DepthQuery struct {
	Symbol string  `json:"symbol"`
	Limit  *uint32 `json:"limit,omitempty,string"`
}

DepthQuery

func NewDepthQuery

func NewDepthQuery(baseAssetSymbol, quoteAssetSymbol string) *DepthQuery

func (*DepthQuery) Check

func (param *DepthQuery) Check() error

func (*DepthQuery) WithLimit

func (param *DepthQuery) WithLimit(limit uint32) *DepthQuery

type Description

type Description struct {
	Moniker  string `json:"moniker"`  // name
	Identity string `json:"identity"` // optional identity signature (ex. UPort or Keybase)
	Website  string `json:"website"`  // optional website link
	Details  string `json:"details"`  // optional details
}

Description - description fields for a validator

type DexFeeField

type DexFeeField struct {
	FeeName  string `json:"fee_name"`
	FeeValue int64  `json:"fee_value"`
}

type DexFeeParam

type DexFeeParam struct {
	DexFeeFields []DexFeeField `json:"dex_fee_fields"`
}

dexFee

func (*DexFeeParam) Check

func (p *DexFeeParam) Check() error

func (*DexFeeParam) GetParamType

func (p *DexFeeParam) GetParamType() string

type Double

type Double float64

func (*Double) MarshalJSON

func (n *Double) MarshalJSON() ([]byte, error)

func (*Double) UnmarshalJSON

func (n *Double) UnmarshalJSON(data []byte) error

type FeeDistributeType

type FeeDistributeType int8

type FeeParam

type FeeParam interface {
	GetParamType() string
	Check() error
}

type Fixed8

type Fixed8 int64

Fixed8 represents a fixed-point number with precision 10^-8

func Fixed8DecodeString

func Fixed8DecodeString(s string) (Fixed8, error)

Fixed8DecodeString parses s which must be a fixed point number with precision up to 10^-8

func NewFixed8

func NewFixed8(val int64) Fixed8

NewFixed8 returns a new Fixed8 with the supplied int multiplied by 10^8

func (*Fixed8) MarshalJSON

func (f *Fixed8) MarshalJSON() ([]byte, error)

MarshalJSON implements the json marshaller interface

func (Fixed8) String

func (f Fixed8) String() string

String implements the Stringer interface

func (Fixed8) ToInt64

func (f Fixed8) ToInt64() int64

ToInt64 returns the original value representing the Fixed8

func (*Fixed8) UnmarshalJSON

func (f *Fixed8) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json unmarshaller interface

func (Fixed8) Value

func (f Fixed8) Value() int64

Value returns the original value representing the Fixed8 divided by 10^8

type FixedFeeParams

type FixedFeeParams struct {
	MsgType string            `json:"msg_type"`
	Fee     int64             `json:"fee"`
	FeeFor  FeeDistributeType `json:"fee_for"`
}

fixedFee

func (*FixedFeeParams) Check

func (p *FixedFeeParams) Check() error

func (*FixedFeeParams) GetParamType

func (p *FixedFeeParams) GetParamType() string

type FlagOption added in v1.0.8

type FlagOption uint64
const (
	TransferMemoCheckerFlag FlagOption = 0x0000000000000001
)

type IbcChainID added in v1.2.4

type IbcChainID uint16

type IbcChannelID added in v1.2.4

type IbcChannelID uint8

type Int added in v1.2.4

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

func NewInt added in v1.2.4

func NewInt(n int64) Int

func NewIntFromBigInt added in v1.2.4

func NewIntFromBigInt(i *big.Int) Int

func (Int) GT added in v1.2.4

func (i Int) GT(i2 Int) bool

func (Int) MarshalAmino added in v1.2.4

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

MarshalAmino defines custom encoding scheme

func (Int) MarshalJSON added in v1.2.4

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

MarshalJSON defines custom encoding scheme

func (*Int) UnmarshalAmino added in v1.2.4

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

UnmarshalAmino defines custom decoding scheme

func (*Int) UnmarshalJSON added in v1.2.4

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

UnmarshalJSON defines custom decoding scheme

type Kline

type Kline struct {
	Close            float64 `json:"close,string"`
	CloseTime        int64   `json:"closeTime"`
	High             float64 `json:"high,string"`
	Low              float64 `json:"low,string"`
	NumberOfTrades   int32   `json:"numberOfTrades"`
	Open             float64 `json:"open,string"`
	OpenTime         int64   `json:"openTime"`
	QuoteAssetVolume float64 `json:"quoteAssetVolume,string"`
	Volume           float64 `json:"volume,string"`
}

type KlineQuery

type KlineQuery struct {
	Symbol    string  `json:"symbol"`   // required
	Interval  string  `json:"interval"` // required, interval (5m, 1h, 1d, 1w, etc.)
	Limit     *uint32 `json:"limit,omitempty,string"`
	StartTime *int64  `json:"start_time,omitempty,string"`
	EndTime   *int64  `json:"end_time,omitempty,string"`
}

KlineQuery definition

func NewKlineQuery

func NewKlineQuery(baseAssetSymbol, quoteAssetSymbol, interval string) *KlineQuery

func (*KlineQuery) Check

func (param *KlineQuery) Check() error

func (*KlineQuery) WithEndTime

func (param *KlineQuery) WithEndTime(end int64) *KlineQuery

func (*KlineQuery) WithLimit

func (param *KlineQuery) WithLimit(limit uint32) *KlineQuery

func (*KlineQuery) WithStartTime

func (param *KlineQuery) WithStartTime(start int64) *KlineQuery

type MarketDepth

type MarketDepth struct {
	Bids         [][]string `json:"bids"` // "bids": [ [ "0.0024", "10" ] ]
	Asks         [][]string `json:"asks"` // "asks": [ [ "0.0024", "10" ] ]
	Height       int64      `json:"height"`
	PendingMatch bool       `json:"pending_match"`
}

type MarketsQuery

type MarketsQuery struct {
	Offset *uint32 `json:"offset,omitempty,string"` //Option
	Limit  *uint32 `json:"limit,omitempty,string"`  //Option
}

MarketsQuery definition

func NewMarketsQuery

func NewMarketsQuery() *MarketsQuery

func (*MarketsQuery) Check

func (param *MarketsQuery) Check() error

func (*MarketsQuery) WithLimit

func (param *MarketsQuery) WithLimit(limit uint32) *MarketsQuery

func (*MarketsQuery) WithOffset

func (param *MarketsQuery) WithOffset(offset uint32) *MarketsQuery

type MiniToken added in v1.2.3

type MiniToken struct {
	Name             string     `json:"name"`
	Symbol           string     `json:"symbol"`
	OrigSymbol       string     `json:"original_symbol"`
	TotalSupply      Fixed8     `json:"total_supply"`
	Owner            AccAddress `json:"owner"`
	Mintable         bool       `json:"mintable"`
	TokenType        int8       `json:"token_type"`
	TokenURI         string     `json:"token_uri"`
	ContractAddress  string     `json:"contract_address,omitempty"`
	ContractDecimals int8       `json:"contract_decimals,omitempty"`
}

MiniToken definition

type NamedAccount

type NamedAccount interface {
	Account
	GetName() string
	SetName(string)

	GetFrozenCoins() Coins
	SetFrozenCoins(Coins)

	//TODO: this should merge into Coin
	GetLockedCoins() Coins
	SetLockedCoins(Coins)
}

type NodeInfo

type NodeInfo struct {
	// Authenticate
	// TODO: replace with NetAddress
	ID         string `json:"id"`          // authenticated identifier
	ListenAddr string `json:"listen_addr"` // accepting incoming

	// Check compatibility.
	// Channels are HexBytes so easier to read as JSON
	Network  string          `json:"network"`  // network/chain ID
	Version  string          `json:"version"`  // major.minor.revision
	Channels common.HexBytes `json:"channels"` // channels this node knows about

	// ASCIIText fields
	Moniker string        `json:"moniker"` // arbitrary moniker
	Other   NodeInfoOther `json:"other"`   // other application specific data
}

type NodeInfoOther

type NodeInfoOther struct {
	AminoVersion     string `json:"amino_version"`
	P2PVersion       string `json:"p2p_version"`
	ConsensusVersion string `json:"consensus_version"`
	RPCVersion       string `json:"rpc_version"`
	TxIndex          string `json:"tx_index"`
	RPCAddress       string `json:"rpc_address"`
}

type OpenOrder

type OpenOrder struct {
	Id                   string `json:"id"`
	Symbol               string `json:"symbol"`
	Price                Fixed8 `json:"price"`
	Quantity             Fixed8 `json:"quantity"`
	CumQty               Fixed8 `json:"cumQty"`
	CreatedHeight        int64  `json:"createdHeight"`
	CreatedTimestamp     int64  `json:"createdTimestamp"`
	LastUpdatedHeight    int64  `json:"lastUpdatedHeight"`
	LastUpdatedTimestamp int64  `json:"lastUpdatedTimestamp"`
}

type OpenOrders

type OpenOrders struct {
	Order []Order `json:"order"`
	Total int     `json:"total"`
}

type OpenOrdersQuery

type OpenOrdersQuery struct {
	SenderAddress string  `json:"address"` // required
	Symbol        string  `json:"symbol,omitempty"`
	Offset        *uint32 `json:"offset,omitempty,string"`
	Limit         *uint32 `json:"limit,omitempty,string"`
	Total         int     `json:"total,string"` //0 for not required and 1 for required; default not required, return total=-1 in response
}

OpenOrdersQuery definition

func NewOpenOrdersQuery

func NewOpenOrdersQuery(senderAddress string, withTotal bool) *OpenOrdersQuery

func (*OpenOrdersQuery) Check

func (param *OpenOrdersQuery) Check() error

func (*OpenOrdersQuery) WithLimit

func (param *OpenOrdersQuery) WithLimit(limit uint32) *OpenOrdersQuery

func (*OpenOrdersQuery) WithOffset

func (param *OpenOrdersQuery) WithOffset(offset uint32) *OpenOrdersQuery

func (*OpenOrdersQuery) WithSymbol

func (param *OpenOrdersQuery) WithSymbol(symbol string) *OpenOrdersQuery

type Order

type Order struct {
	ID                   string `json:"orderId"`
	Owner                string `json:"owner"`
	Symbol               string `json:"symbol"`
	Price                string `json:"price"`
	Quantity             string `json:"quantity"`
	CumulateQuantity     string `json:"cumulateQuantity"`
	Fee                  string `json:"fee"`
	Side                 int    `json:"side"` // BUY or SELL
	Status               string `json:"status"`
	TimeInForce          int    `json:"timeInForce"`
	Type                 int    `json:"type"`
	TradeId              string `json:"tradeId"`
	LastExecutedPrice    string `json:"last_executed_price"`
	LastExecutedQuantity string `json:"lastExecutedQuantity"`
	TransactionHash      string `json:"transactionHash"`
	OrderCreateTime      string `json:"orderCreateTime"`
	TransactionTime      string `json:"transactionTime"`
}

type OrderBook

type OrderBook struct {
	Height       int64
	Levels       []OrderBookLevel
	PendingMatch bool
}

type OrderBookLevel

type OrderBookLevel struct {
	BuyQty    Fixed8 `json:"buyQty"`
	BuyPrice  Fixed8 `json:"buyPrice"`
	SellQty   Fixed8 `json:"sellQty"`
	SellPrice Fixed8 `json:"sellPrice"`
}

OrderBookLevel represents a single order book level.

type Pool added in v1.2.4

type Pool struct {
	LooseTokens  Dec `json:"loose_tokens"`  // tokens which are not bonded in a validator
	BondedTokens Dec `json:"bonded_tokens"` // reserve of bonded tokens
}

type Proposal added in v1.0.4

type Proposal interface {
	GetProposalID() int64
	SetProposalID(int64)

	GetTitle() string
	SetTitle(string)

	GetDescription() string
	SetDescription(string)

	GetProposalType() ProposalKind
	SetProposalType(ProposalKind)

	GetStatus() ProposalStatus
	SetStatus(ProposalStatus)

	GetTallyResult() TallyResult
	SetTallyResult(TallyResult)

	GetSubmitTime() time.Time
	SetSubmitTime(time.Time)

	GetTotalDeposit() Coins
	SetTotalDeposit(Coins)

	GetVotingStartTime() time.Time
	SetVotingStartTime(time.Time)

	GetVotingPeriod() time.Duration
	SetVotingPeriod(time.Duration)
}

type ProposalKind added in v1.0.4

type ProposalKind byte

Type that represents Proposal Type as a byte

const (
	ProposalTypeNil             ProposalKind = 0x00
	ProposalTypeText            ProposalKind = 0x01
	ProposalTypeParameterChange ProposalKind = 0x02
	ProposalTypeSoftwareUpgrade ProposalKind = 0x03
	ProposalTypeListTradingPair ProposalKind = 0x04
	// ProposalTypeFeeChange belongs to ProposalTypeParameterChange. We use this to make it easily to distinguish。
	ProposalTypeFeeChange            ProposalKind = 0x05
	ProposalTypeCreateValidator      ProposalKind = 0x06
	ProposalTypeRemoveValidator      ProposalKind = 0x07
	ProposalTypeDelistTradingPair    ProposalKind = 0x08
	ProposalTypeManageChanPermission ProposalKind = 0x09

	ProposalTypeSCParamsChange ProposalKind = 0x81
	// cross side chain param change
	ProposalTypeCSCParamsChange ProposalKind = 0x82
)

nolint

func ProposalTypeFromString added in v1.0.4

func ProposalTypeFromString(str string) (ProposalKind, error)

String to proposalType byte. Returns ff if invalid.

func (ProposalKind) Marshal added in v1.0.4

func (pt ProposalKind) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility

func (ProposalKind) MarshalJSON added in v1.0.4

func (pt ProposalKind) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (ProposalKind) String added in v1.0.4

func (pt ProposalKind) String() string

Turns VoteOption byte to String

func (*ProposalKind) Unmarshal added in v1.0.4

func (pt *ProposalKind) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility

func (*ProposalKind) UnmarshalJSON added in v1.0.4

func (pt *ProposalKind) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type ProposalStatus added in v1.0.4

type ProposalStatus byte
const (
	StatusNil           ProposalStatus = 0x00
	StatusDepositPeriod ProposalStatus = 0x01
	StatusVotingPeriod  ProposalStatus = 0x02
	StatusPassed        ProposalStatus = 0x03
	StatusRejected      ProposalStatus = 0x04
	StatusExecuted      ProposalStatus = 0x05
)

nolint

func ProposalStatusFromString added in v1.0.4

func ProposalStatusFromString(str string) (ProposalStatus, error)

ProposalStatusToString turns a string into a ProposalStatus

func (ProposalStatus) Format added in v1.0.4

func (status ProposalStatus) Format(s fmt.State, verb rune)

For Printf / Sprintf, returns bech32 when using %s nolint: errcheck

func (ProposalStatus) Marshal added in v1.0.4

func (status ProposalStatus) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility

func (ProposalStatus) MarshalJSON added in v1.0.4

func (status ProposalStatus) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (ProposalStatus) String added in v1.0.4

func (status ProposalStatus) String() string

Turns VoteStatus byte to String

func (*ProposalStatus) Unmarshal added in v1.0.4

func (status *ProposalStatus) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility

func (*ProposalStatus) UnmarshalJSON added in v1.0.4

func (status *ProposalStatus) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type QueryBondsParams added in v1.2.4

type QueryBondsParams struct {
	BaseParams
	DelegatorAddr AccAddress
	ValidatorAddr ValAddress
}

type QueryDelegatorParams added in v1.2.4

type QueryDelegatorParams struct {
	BaseParams
	DelegatorAddr AccAddress
}

type QueryProposalParams added in v1.0.4

type QueryProposalParams struct {
	BaseParams
	ProposalID int64
}

Params for query 'custom/gov/proposal'

type QueryProposalsParams added in v1.0.4

type QueryProposalsParams struct {
	BaseParams
	ProposalStatus     ProposalStatus
	NumLatestProposals int64
}

type QuerySwapByCreatorParams added in v1.1.3

type QuerySwapByCreatorParams struct {
	Creator AccAddress
	Limit   int64
	Offset  int64
}

Params for query 'custom/atomicswap/swapcreator'

type QuerySwapByID added in v1.1.3

type QuerySwapByID struct {
	SwapID SwapBytes
}

Params for query 'custom/atomicswap/swapid'

type QuerySwapByRecipientParams added in v1.1.3

type QuerySwapByRecipientParams struct {
	Recipient AccAddress
	Limit     int64
	Offset    int64
}

Params for query 'custom/atomicswap/swaprecipient'

type QueryTimeLockParams added in v1.0.9

type QueryTimeLockParams struct {
	Account AccAddress
	Id      int64
}

Params for query 'custom/timelock/timelock'

type QueryTimeLocksParams added in v1.0.9

type QueryTimeLocksParams struct {
	Account AccAddress
}

Params for query 'custom/timelock/timelocks'

type QueryTopValidatorsParams added in v1.2.4

type QueryTopValidatorsParams struct {
	BaseParams
	Top int
}

type QueryValidatorParams added in v1.2.4

type QueryValidatorParams struct {
	BaseParams
	ValidatorAddr ValAddress
}

type Redelegation added in v1.2.4

type Redelegation struct {
	DelegatorAddr    AccAddress `json:"delegator_addr"`     // delegator
	ValidatorSrcAddr ValAddress `json:"validator_src_addr"` // validator redelegation source operator addr
	ValidatorDstAddr ValAddress `json:"validator_dst_addr"` // validator redelegation destination operator addr
	CreationHeight   int64      `json:"creation_height"`    // height which the redelegation took place
	MinTime          time.Time  `json:"min_time"`           // unix time for redelegation completion
	InitialBalance   Coin       `json:"initial_balance"`    // initial balance when redelegation started
	Balance          Coin       `json:"balance"`            // current balance
	SharesSrc        Dec        `json:"shares_src"`         // amount of source shares redelegating
	SharesDst        Dec        `json:"shares_dst"`         // amount of destination shares redelegating
}

func UnmarshalRED added in v1.2.4

func UnmarshalRED(cdc *amino.Codec, key, value []byte) (red Redelegation, err error)

unmarshal a redelegation from a store key and value

type ResultStatus

type ResultStatus struct {
	NodeInfo      NodeInfo      `json:"node_info"`
	SyncInfo      SyncInfo      `json:"sync_info"`
	ValidatorInfo ValidatorInfo `json:"validator_info"`
}

Account definition

type SwapBytes added in v1.1.3

type SwapBytes []byte

func (SwapBytes) Marshal added in v1.1.3

func (bz SwapBytes) Marshal() ([]byte, error)

func (SwapBytes) MarshalJSON added in v1.1.3

func (bz SwapBytes) MarshalJSON() ([]byte, error)

func (*SwapBytes) Unmarshal added in v1.1.3

func (bz *SwapBytes) Unmarshal(data []byte) error

func (*SwapBytes) UnmarshalJSON added in v1.1.3

func (bz *SwapBytes) UnmarshalJSON(data []byte) error

type SwapStatus added in v1.1.3

type SwapStatus byte
const (
	NULL      SwapStatus = 0x00
	Open      SwapStatus = 0x01
	Completed SwapStatus = 0x02
	Expired   SwapStatus = 0x03
)

func NewSwapStatusFromString added in v1.1.3

func NewSwapStatusFromString(str string) SwapStatus

func (SwapStatus) MarshalJSON added in v1.1.3

func (status SwapStatus) MarshalJSON() ([]byte, error)

func (SwapStatus) String added in v1.1.3

func (status SwapStatus) String() string

func (*SwapStatus) UnmarshalJSON added in v1.1.3

func (status *SwapStatus) UnmarshalJSON(data []byte) error

type SyncInfo

type SyncInfo struct {
	LatestBlockHash   common.HexBytes `json:"latest_block_hash"`
	LatestAppHash     common.HexBytes `json:"latest_app_hash"`
	LatestBlockHeight int64           `json:"latest_block_height"`
	LatestBlockTime   time.Time       `json:"latest_block_time"`
	CatchingUp        bool            `json:"catching_up"`
}

type TallyResult added in v1.0.4

type TallyResult struct {
	Yes        Dec `json:"yes"`
	Abstain    Dec `json:"abstain"`
	No         Dec `json:"no"`
	NoWithVeto Dec `json:"no_with_veto"`
	Total      Dec `json:"total"`
}

Tally Results

type TextProposal added in v1.0.4

type TextProposal struct {
	ProposalID   int64         `json:"proposal_id"`   //  ID of the proposal
	Title        string        `json:"title"`         //  Title of the proposal
	Description  string        `json:"description"`   //  Description of the proposal
	ProposalType ProposalKind  `json:"proposal_type"` //  Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
	VotingPeriod time.Duration `json:"voting_period"` //  Length of the voting period

	Status      ProposalStatus `json:"proposal_status"` //  Status of the Proposal {Pending, Active, Passed, Rejected}
	TallyResult TallyResult    `json:"tally_result"`    //  Result of Tallys

	SubmitTime   time.Time `json:"submit_time"`   //  Height of the block where TxGovSubmitProposal was included
	TotalDeposit Coins     `json:"total_deposit"` //  Current deposit on this proposal. Initial value is set at InitialDeposit

	VotingStartTime time.Time `json:"voting_start_time"` //  Height of the block where MinDeposit was reached. -1 if MinDeposit is not reached
}

Text Proposals

func (TextProposal) GetDescription added in v1.0.4

func (tp TextProposal) GetDescription() string

func (TextProposal) GetProposalID added in v1.0.4

func (tp TextProposal) GetProposalID() int64

nolint

func (TextProposal) GetProposalType added in v1.0.4

func (tp TextProposal) GetProposalType() ProposalKind

func (TextProposal) GetStatus added in v1.0.4

func (tp TextProposal) GetStatus() ProposalStatus

func (TextProposal) GetSubmitTime added in v1.0.4

func (tp TextProposal) GetSubmitTime() time.Time

func (TextProposal) GetTallyResult added in v1.0.4

func (tp TextProposal) GetTallyResult() TallyResult

func (TextProposal) GetTitle added in v1.0.4

func (tp TextProposal) GetTitle() string

func (TextProposal) GetTotalDeposit added in v1.0.4

func (tp TextProposal) GetTotalDeposit() Coins

func (TextProposal) GetVotingPeriod added in v1.0.4

func (tp TextProposal) GetVotingPeriod() time.Duration

func (TextProposal) GetVotingStartTime added in v1.0.4

func (tp TextProposal) GetVotingStartTime() time.Time

func (*TextProposal) SetDescription added in v1.0.4

func (tp *TextProposal) SetDescription(description string)

func (*TextProposal) SetProposalID added in v1.0.4

func (tp *TextProposal) SetProposalID(proposalID int64)

func (*TextProposal) SetProposalType added in v1.0.4

func (tp *TextProposal) SetProposalType(proposalType ProposalKind)

func (*TextProposal) SetStatus added in v1.0.4

func (tp *TextProposal) SetStatus(status ProposalStatus)

func (*TextProposal) SetSubmitTime added in v1.0.4

func (tp *TextProposal) SetSubmitTime(submitTime time.Time)

func (*TextProposal) SetTallyResult added in v1.0.4

func (tp *TextProposal) SetTallyResult(tallyResult TallyResult)

func (*TextProposal) SetTitle added in v1.0.4

func (tp *TextProposal) SetTitle(title string)

func (*TextProposal) SetTotalDeposit added in v1.0.4

func (tp *TextProposal) SetTotalDeposit(totalDeposit Coins)

func (*TextProposal) SetVotingPeriod added in v1.0.4

func (tp *TextProposal) SetVotingPeriod(votingPeriod time.Duration)

func (*TextProposal) SetVotingStartTime added in v1.0.4

func (tp *TextProposal) SetVotingStartTime(votingStartTime time.Time)

type Ticker24h

type Ticker24h struct {
	Symbol             string `json:"symbol"`
	AskPrice           string `json:"askPrice"`    // In decimal form, e.g. 1.00000000
	AskQuantity        string `json:"askQuantity"` // In decimal form, e.g. 1.00000000
	BidPrice           string `json:"bidPrice"`    // In decimal form, e.g. 1.00000000
	BidQuantity        string `json:"bidQuantity"` // In decimal form, e.g. 1.00000000
	CloseTime          int64  `json:"closeTime"`
	Count              int64  `json:"count"`
	FirstID            string `json:"firstId"`
	HighPrice          string `json:"highPrice"` // In decimal form, e.g. 1.00000000
	LastID             string `json:"lastId"`
	LastPrice          string `json:"lastPrice"`    // In decimal form, e.g. 1.00000000
	LastQuantity       string `json:"lastQuantity"` // In decimal form, e.g. 1.00000000
	LowPrice           string `json:"lowPrice"`     // In decimal form, e.g. 1.00000000
	OpenPrice          string `json:"openPrice"`    // In decimal form, e.g. 1.00000000
	OpenTime           int64  `json:"openTime"`
	PrevClosePrice     string `json:"prevClosePrice"` // In decimal form, e.g. 1.00000000
	PriceChange        string `json:"priceChange"`    // In decimal form, e.g. 1.00000000
	PriceChangePercent string `json:"priceChangePercent"`
	QuoteVolume        string `json:"quoteVolume"`      // In decimal form, e.g. 1.00000000
	Volume             string `json:"volume"`           // In decimal form, e.g. 1.00000000
	WeightedAvgPrice   string `json:"weightedAvgPrice"` // In decimal form, e.g. 1.00000000
}

type Ticker24hQuery

type Ticker24hQuery struct {
	Symbol string `json:"symbol,omitempty"`
}

Ticker24hQuery definition

func NewTicker24hQuery

func NewTicker24hQuery() *Ticker24hQuery

func (*Ticker24hQuery) WithSymbol

func (param *Ticker24hQuery) WithSymbol(baseAssetSymbol, quoteAssetSymbol string) *Ticker24hQuery

type Time

type Time struct {
	ApTime    string `json:"ap_time"`
	BlockTime string `json:"block_time"`
}

type TimeLockRecord added in v1.0.9

type TimeLockRecord struct {
	Id          int64     `json:"id"`
	Description string    `json:"description"`
	Amount      Coins     `json:"amount"`
	LockTime    time.Time `json:"lock_time"`
}

type Token

type Token struct {
	Name             string     `json:"name"`
	Symbol           string     `json:"symbol"`
	OrigSymbol       string     `json:"original_symbol"`
	TotalSupply      Fixed8     `json:"total_supply"`
	Owner            AccAddress `json:"owner"`
	Mintable         bool       `json:"mintable"`
	ContractAddress  string     `json:"contract_address,omitempty"`
	ContractDecimals int8       `json:"contract_decimals,omitempty"`
}

Token definition

type TokenBalance

type TokenBalance struct {
	Symbol string `json:"symbol"`
	Free   Fixed8 `json:"free"`
	Locked Fixed8 `json:"locked"`
	Frozen Fixed8 `json:"frozen"`
}

type TokensQuery added in v1.0.8

type TokensQuery struct {
	Offset *uint32 `json:"offset,omitempty,string"` //Option
	Limit  *uint32 `json:"limit,omitempty,string"`  //Option
}

TokensQuery definition

func NewTokensQuery added in v1.0.8

func NewTokensQuery() *TokensQuery

func (*TokensQuery) Check added in v1.0.8

func (param *TokensQuery) Check() error

func (*TokensQuery) WithLimit added in v1.0.8

func (param *TokensQuery) WithLimit(limit uint32) *TokensQuery

func (*TokensQuery) WithOffset added in v1.0.8

func (param *TokensQuery) WithOffset(offset uint32) *TokensQuery

type Trade

type Trade struct {
	BaseAsset    string `json:"baseAsset"`
	BlockHeight  int64  `json:"blockHeight"`
	BuyFee       string `json:"buyFee"`
	BuySingleFee string `json:"buySingleFee"`
	BuyerId      string `json:"buyerId"`
	BuyerOrderID string `json:"buyerOrderId"`
	Price        string `json:"price"`
	Quantity     string `json:"quantity"`
	QuoteAsset   string `json:"quoteAsset"`
	SellFee      string `json:"sellFee"`

	SellerId      string `json:"sellerId"`
	SellerOrderID string `json:"sellerOrderId"`
	Symbol        string `json:"symbol"`
	Time          int64  `json:"time"`
	TradeID       string `json:"tradeId"`
	TickType      string `json:"tickType"`
	// contains filtered or unexported fields
}

Trade def

type Trades

type Trades struct {
	Trade []Trade `json:"trade"`
	Total int     `json:"total"`
}

type TradesQuery

type TradesQuery struct {
	SenderAddress *string `json:"address,omitempty"`       // option
	Symbol        string  `json:"symbol,omitempty"`        //option
	Offset        *uint32 `json:"offset,omitempty,string"` //option
	Limit         *uint32 `json:"limit,omitempty,string"`  //option
	Start         *int64  `json:"start,omitempty,string"`  //option
	End           *int64  `json:"end,omitempty,string"`    //option
	Side          *string `json:"side,omitempty"`          //option
	Total         int     `json:"total,string"`            //0 for not required and 1 for required; default not required, return total=-1 in response
}

TradesQuery definition

func NewTradesQuery

func NewTradesQuery(withTotal bool) *TradesQuery

func (*TradesQuery) Check added in v1.0.8

func (param *TradesQuery) Check() error

func (*TradesQuery) WithAddress added in v1.0.8

func (param *TradesQuery) WithAddress(addr string) *TradesQuery

func (*TradesQuery) WithEnd added in v1.0.8

func (param *TradesQuery) WithEnd(end int64) *TradesQuery

func (*TradesQuery) WithLimit added in v1.0.8

func (param *TradesQuery) WithLimit(limit uint32) *TradesQuery

func (*TradesQuery) WithOffset added in v1.0.8

func (param *TradesQuery) WithOffset(offset uint32) *TradesQuery

func (*TradesQuery) WithSide added in v1.0.8

func (param *TradesQuery) WithSide(side string) *TradesQuery

func (*TradesQuery) WithStart added in v1.0.8

func (param *TradesQuery) WithStart(start int64) *TradesQuery

func (*TradesQuery) WithSymbol added in v1.0.8

func (param *TradesQuery) WithSymbol(baseAssetSymbol, quoteAssetSymbol string) *TradesQuery

type TradingPair

type TradingPair struct {
	BaseAssetSymbol  string `json:"base_asset_symbol"`
	QuoteAssetSymbol string `json:"quote_asset_symbol"`
	ListPrice        Fixed8 `json:"list_price"`
	TickSize         Fixed8 `json:"tick_size"`
	LotSize          Fixed8 `json:"lot_size"`
}

type TransferFeeParam

type TransferFeeParam struct {
	FixedFeeParams    `json:"fixed_fee_params"`
	MultiTransferFee  int64 `json:"multi_transfer_fee"`
	LowerLimitAsMulti int64 `json:"lower_limit_as_multi"`
}

func (*TransferFeeParam) Check

func (p *TransferFeeParam) Check() error

func (*TransferFeeParam) GetParamType

func (p *TransferFeeParam) GetParamType() string

type UnbondingDelegation

type UnbondingDelegation struct {
	DelegatorAddr  AccAddress `json:"delegator_addr"`  // delegator
	ValidatorAddr  ValAddress `json:"validator_addr"`  // validator unbonding from operator addr
	CreationHeight int64      `json:"creation_height"` // height which the unbonding took place
	MinTime        time.Time  `json:"min_time"`        // unix time for unbonding completion
	InitialBalance Coin       `json:"initial_balance"` // atoms initially scheduled to receive at completion
	Balance        Coin       `json:"balance"`         // atoms to receive at completion
}

type ValAddress

type ValAddress []byte

func ValAddressFromBech32

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

func (ValAddress) Bytes

func (va ValAddress) Bytes() []byte

func (ValAddress) MarshalJSON

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

MarshalJSON marshals to JSON using Bech32.

func (ValAddress) String

func (va ValAddress) String() string

func (*ValAddress) UnmarshalJSON

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

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

type Validator

type Validator struct {
	FeeAddr      AccAddress `json:"fee_addr"`         // address for fee collection
	OperatorAddr ValAddress `json:"operator_address"` // address of the validator's operator; bech encoded in JSON
	ConsPubKey   string     `json:"consensus_pubkey"` // the consensus public key of the validator; bech encoded in JSON
	Jailed       bool       `json:"jailed"`           // has the validator been jailed from bonded status?

	Status          BondStatus `json:"status"`           // validator status (bonded/unbonding/unbonded)
	Tokens          Dec        `json:"tokens"`           // delegated tokens (incl. self-delegation)
	DelegatorShares Dec        `json:"delegator_shares"` // total shares issued to a validator's delegators

	Description        Description `json:"description"`           // description terms for the validator
	BondHeight         int64       `json:"bond_height"`           // earliest height as a bonded validator
	BondIntraTxCounter int16       `json:"bond_intra_tx_counter"` // block-local tx index of validator change

	UnbondingHeight  int64     `json:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding
	UnbondingMinTime time.Time `json:"unbonding_time"`   // if unbonding, min time for the validator to complete unbonding

	Commission Commission `json:"commission"` // commission parameters

	DistributionAddr AccAddress `json:"distribution_addr"` // the address receives rewards from the side address, and distribute rewards to delegators. It's auto generated
	SideChainId      string     `json:"side_chain_id"`     // side chain id to distinguish different side chains
	SideConsAddr     []byte     `json:"side_cons_addr"`    // consensus address of the side chain validator, this replaces the `ConsPubKey`
	SideFeeAddr      []byte     `json:"side_fee_addr"`     // fee address on the side chain
}

Validator defines the total amount of bond shares and their exchange rate to coins. Accumulation of interest is modelled as an in increase in the exchange rate, and slashing as a decrease. When coins are delegated to this validator, the validator is credited with a Delegation whose number of bond shares is based on the amount of coins delegated divided by the current exchange rate. Voting power can be calculated as total bonds multiplied by exchange rate.

type ValidatorInfo

type ValidatorInfo struct {
	Address     common.HexBytes `json:"address"`
	PubKey      []uint8         `json:"pub_key"`
	VotingPower int64           `json:"voting_power"`
}

Jump to

Keyboard shortcuts

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