Documentation ¶
Index ¶
- Constants
- Variables
- func Bech32ifyConsPub(pub crypto.PubKey) (string, error)
- func GetFromBech32(bech32str, prefix string) ([]byte, error)
- func MustBech32ifyConsPub(pub crypto.PubKey) string
- func RegisterWire(cdc *amino.Codec)
- type AccAddress
- type Account
- type AppAccount
- func (acc *AppAccount) Clone() Account
- func (acc *AppAccount) GetFlags() uint64
- func (acc AppAccount) GetFrozenCoins() Coins
- func (acc AppAccount) GetLockedCoins() Coins
- func (acc AppAccount) GetName() string
- func (acc *AppAccount) SetFlags(flags uint64)
- func (acc *AppAccount) SetFrozenCoins(frozen Coins)
- func (acc *AppAccount) SetLockedCoins(frozen Coins)
- func (acc *AppAccount) SetName(name string)
- type AtomicSwap
- type BalanceAccount
- type BaseAccount
- func (acc *BaseAccount) Clone() BaseAccount
- func (acc *BaseAccount) GetAccountNumber() int64
- func (acc BaseAccount) GetAddress() AccAddress
- func (acc *BaseAccount) GetCoins() Coins
- func (acc BaseAccount) GetPubKey() crypto.PubKey
- func (acc *BaseAccount) GetSequence() int64
- func (acc *BaseAccount) SetAccountNumber(accNumber int64) error
- func (acc *BaseAccount) SetAddress(addr AccAddress) error
- func (acc *BaseAccount) SetCoins(coins Coins) error
- func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error
- func (acc *BaseAccount) SetSequence(seq int64) error
- type BondStatus
- type ChainNetwork
- type CloseOrders
- type ClosedOrdersQuery
- func (param *ClosedOrdersQuery) Check() error
- func (param *ClosedOrdersQuery) WithEnd(end int64) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithLimit(limit uint32) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithOffset(offset uint32) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithSide(side string) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithStart(start int64) *ClosedOrdersQuery
- func (param *ClosedOrdersQuery) WithSymbol(baseAssetSymbol, quoteAssetSymbol string) *ClosedOrdersQuery
- type Coin
- type Coins
- func (coins Coins) AmountOf(denom string) int64
- func (coins Coins) IsEqual(coinsB Coins) bool
- func (coins Coins) IsNotNegative() bool
- func (coins Coins) IsPositive() bool
- func (coins Coins) IsValid() bool
- func (coins Coins) IsZero() bool
- func (coins Coins) Len() int
- func (coins Coins) Less(i, j int) bool
- func (coins Coins) Plus(coinsB Coins) Coins
- func (coins Coins) Sort() Coins
- func (coins Coins) Swap(i, j int)
- type Commission
- type CommissionMsg
- type ConsAddress
- func (ca ConsAddress) Bytes() []byte
- func (ca ConsAddress) Empty() bool
- func (ca ConsAddress) Equals(ca2 ConsAddress) bool
- func (ca ConsAddress) Format(s fmt.State, verb rune)
- func (ca ConsAddress) Marshal() ([]byte, error)
- func (ca ConsAddress) MarshalJSON() ([]byte, error)
- func (ca ConsAddress) String() string
- func (ca *ConsAddress) Unmarshal(data []byte) error
- func (ca *ConsAddress) UnmarshalJSON(data []byte) error
- type Dec
- func (d Dec) Abs() Dec
- func (d Dec) Equal(d2 Dec) bool
- func (d Dec) GT(d2 Dec) bool
- func (d Dec) GTE(d2 Dec) bool
- func (d Dec) IsNil() bool
- func (d Dec) IsZero() bool
- func (d Dec) LT(d2 Dec) bool
- func (d Dec) LTE(d2 Dec) bool
- func (d Dec) MarshalAmino() (int64, error)
- func (d Dec) MarshalJSON() ([]byte, error)
- func (d Dec) MarshalText() ([]byte, error)
- func (d Dec) Neg() Dec
- func (d Dec) String() string
- func (d Dec) Sub(d2 Dec) Dec
- func (d *Dec) UnmarshalAmino(v int64) (err error)
- func (d *Dec) UnmarshalJSON(bz []byte) error
- func (d *Dec) UnmarshalText(text []byte) error
- type DepthQuery
- type Description
- type DexFeeField
- type DexFeeParam
- type Double
- type FeeDistributeType
- type FeeParam
- type Fixed8
- type FixedFeeParams
- type FlagOption
- type Kline
- type KlineQuery
- type MarketDepth
- type MarketsQuery
- type NamedAccount
- type NodeInfo
- type NodeInfoOther
- type OpenOrder
- type OpenOrders
- type OpenOrdersQuery
- type Order
- type OrderBook
- type OrderBookLevel
- type Proposal
- type ProposalKind
- type ProposalStatus
- func (status ProposalStatus) Format(s fmt.State, verb rune)
- func (status ProposalStatus) Marshal() ([]byte, error)
- func (status ProposalStatus) MarshalJSON() ([]byte, error)
- func (status ProposalStatus) String() string
- func (status *ProposalStatus) Unmarshal(data []byte) error
- func (status *ProposalStatus) UnmarshalJSON(data []byte) error
- type QueryProposalParams
- type QueryProposalsParams
- type QuerySwapByCreatorParams
- type QuerySwapByID
- type QuerySwapByRecipientParams
- type QueryTimeLockParams
- type QueryTimeLocksParams
- type ResultStatus
- type SwapBytes
- type SwapStatus
- type SyncInfo
- type TallyResult
- type TextProposal
- func (tp TextProposal) GetDescription() string
- func (tp TextProposal) GetProposalID() int64
- func (tp TextProposal) GetProposalType() ProposalKind
- func (tp TextProposal) GetStatus() ProposalStatus
- func (tp TextProposal) GetSubmitTime() time.Time
- func (tp TextProposal) GetTallyResult() TallyResult
- func (tp TextProposal) GetTitle() string
- func (tp TextProposal) GetTotalDeposit() Coins
- func (tp TextProposal) GetVotingPeriod() time.Duration
- func (tp TextProposal) GetVotingStartTime() time.Time
- func (tp *TextProposal) SetDescription(description string)
- func (tp *TextProposal) SetProposalID(proposalID int64)
- func (tp *TextProposal) SetProposalType(proposalType ProposalKind)
- func (tp *TextProposal) SetStatus(status ProposalStatus)
- func (tp *TextProposal) SetSubmitTime(submitTime time.Time)
- func (tp *TextProposal) SetTallyResult(tallyResult TallyResult)
- func (tp *TextProposal) SetTitle(title string)
- func (tp *TextProposal) SetTotalDeposit(totalDeposit Coins)
- func (tp *TextProposal) SetVotingPeriod(votingPeriod time.Duration)
- func (tp *TextProposal) SetVotingStartTime(votingStartTime time.Time)
- type Ticker24h
- type Ticker24hQuery
- type Time
- type TimeLockRecord
- type Token
- type TokenBalance
- type TokensQuery
- type Trade
- type Trades
- type TradesQuery
- func (param *TradesQuery) Check() error
- func (param *TradesQuery) WithAddress(addr string) *TradesQuery
- func (param *TradesQuery) WithEnd(end int64) *TradesQuery
- func (param *TradesQuery) WithLimit(limit uint32) *TradesQuery
- func (param *TradesQuery) WithOffset(offset uint32) *TradesQuery
- func (param *TradesQuery) WithSide(side string) *TradesQuery
- func (param *TradesQuery) WithStart(start int64) *TradesQuery
- func (param *TradesQuery) WithSymbol(baseAssetSymbol, quoteAssetSymbol string) *TradesQuery
- type TradingPair
- type TransferFeeParam
- type UnbondingDelegation
- type ValAddress
- type Validator
- type ValidatorInfo
Constants ¶
const ( Precision = 8 // bytes required to represent the above precision // ceil(log2(9999999999)) DecimalPrecisionBits = 34 )
number of decimal places
const ( OperateFeeType = "operate" TransferFeeType = "transfer" DexFeeType = "dex" FeeForProposer = FeeDistributeType(0x01) FeeForAll = FeeDistributeType(0x02) FeeFree = FeeDistributeType(0x03) )
const ( SideBuy = "BUY" SideSell = "SELL" )
const (
AddrLen = 20
)
Variables ¶
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) )
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 ") )
var Network = ProdNetwork
var OrderSide = struct { BUY string SELL string }{ "BUY", "SELL", }
OrderSide enum
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
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
var TimeInForce = struct { GTC string IOC string }{"GTC", "IOC"}
TimeInForce enum
Functions ¶
func Bech32ifyConsPub ¶
Bech32ifyConsPub returns a Bech32 encoded string containing the Bech32PrefixConsPub prefixfor a given consensus node's PubKey.
func GetFromBech32 ¶
GetFromBech32 to decode a bytestring from a bech32-encoded string
func MustBech32ifyConsPub ¶
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) 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 ¶
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 ¶
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 ¶
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) GetAccountNumber ¶
func (acc *BaseAccount) GetAccountNumber() int64
Implements Account
func (BaseAccount) GetAddress ¶
func (acc BaseAccount) GetAddress() AccAddress
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 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 )
func (ChainNetwork) Bech32Prefixes ¶
func (this ChainNetwork) Bech32Prefixes() string
func (ChainNetwork) Bech32ValidatorAddrPrefix ¶
func (this ChainNetwork) Bech32ValidatorAddrPrefix() string
type CloseOrders ¶
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 Coins ¶
type Coins []Coin
Coins def
func (Coins) IsNotNegative ¶
func (Coins) IsPositive ¶
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 ¶
func NewCommission(rate, maxRate, maxChangeRate Dec) Commission
func (Commission) String ¶
func (c Commission) String() string
func (Commission) Validate ¶
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 ¶
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 ¶
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 ¶
type ConsAddress []byte
ConsAddress defines a wrapper around bytes meant to present a consensus node. When marshaled to a string or JSON, it uses Bech32.
func ConsAddressFromBech32 ¶
func ConsAddressFromBech32(address string) (addr ConsAddress, err error)
ConsAddressFromBech32 creates a ConsAddress from a Bech32 string.
func ConsAddressFromHex ¶
func ConsAddressFromHex(address string) (addr ConsAddress, err error)
ConsAddressFromHex creates a ConsAddress from a hex string.
func GetConsAddress ¶
func GetConsAddress(pubkey crypto.PubKey) ConsAddress
get ConsAddress from pubkey
func (ConsAddress) Bytes ¶
func (ca ConsAddress) Bytes() []byte
Bytes returns the raw address bytes.
func (ConsAddress) Empty ¶
func (ca ConsAddress) Empty() bool
Returns boolean for whether an ConsAddress is empty
func (ConsAddress) Equals ¶
func (ca ConsAddress) Equals(ca2 ConsAddress) bool
Returns boolean for whether two ConsAddress are Equal
func (ConsAddress) Format ¶
func (ca ConsAddress) Format(s fmt.State, verb rune)
Format implements the fmt.Formatter interface. nolint: errcheck
func (ConsAddress) Marshal ¶
func (ca ConsAddress) Marshal() ([]byte, error)
Marshal returns the raw address bytes. It is needed for protobuf compatibility.
func (ConsAddress) MarshalJSON ¶
func (ca ConsAddress) MarshalJSON() ([]byte, error)
MarshalJSON marshals to JSON using Bech32.
func (ConsAddress) 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 {
// contains filtered or unexported fields
}
func NewDecFromStr ¶
func (Dec) MarshalAmino ¶
func (Dec) MarshalJSON ¶
MarshalJSON marshals the decimal
func (Dec) MarshalText ¶
func (*Dec) UnmarshalAmino ¶
requires a valid JSON string - strings quotes and calls UnmarshalText
func (*Dec) UnmarshalJSON ¶
UnmarshalJSON defines custom decoding scheme
func (*Dec) UnmarshalText ¶
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 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 FeeDistributeType ¶
type FeeDistributeType int8
type Fixed8 ¶
type Fixed8 int64
Fixed8 represents a fixed-point number with precision 10^-8
func Fixed8DecodeString ¶
Fixed8DecodeString parses s which must be a fixed point number with precision up to 10^-8
func (*Fixed8) MarshalJSON ¶
MarshalJSON implements the json marshaller interface
func (*Fixed8) UnmarshalJSON ¶
UnmarshalJSON implements the json unmarshaller interface
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 ¶
type FlagOption uint64
const (
TransferMemoCheckerFlag FlagOption = 0x0000000000000001
)
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 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 NamedAccount ¶
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 libbytes.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 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 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 }
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 Proposal ¶
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 ¶
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 )
nolint
func ProposalTypeFromString ¶
func ProposalTypeFromString(str string) (ProposalKind, error)
String to proposalType byte. Returns ff if invalid.
func (ProposalKind) Marshal ¶
func (pt ProposalKind) Marshal() ([]byte, error)
Marshal needed for protobuf compatibility
func (ProposalKind) MarshalJSON ¶
func (pt ProposalKind) MarshalJSON() ([]byte, error)
Marshals to JSON using string
func (*ProposalKind) Unmarshal ¶
func (pt *ProposalKind) Unmarshal(data []byte) error
Unmarshal needed for protobuf compatibility
func (*ProposalKind) UnmarshalJSON ¶
func (pt *ProposalKind) UnmarshalJSON(data []byte) error
Unmarshals from JSON assuming Bech32 encoding
type ProposalStatus ¶
type ProposalStatus byte
const ( StatusNil ProposalStatus = 0x00 StatusDepositPeriod ProposalStatus = 0x01 StatusVotingPeriod ProposalStatus = 0x02 StatusPassed ProposalStatus = 0x03 StatusRejected ProposalStatus = 0x04 )
nolint
func ProposalStatusFromString ¶
func ProposalStatusFromString(str string) (ProposalStatus, error)
ProposalStatusToString turns a string into a ProposalStatus
func (ProposalStatus) Format ¶
func (status ProposalStatus) Format(s fmt.State, verb rune)
For Printf / Sprintf, returns bech32 when using %s nolint: errcheck
func (ProposalStatus) Marshal ¶
func (status ProposalStatus) Marshal() ([]byte, error)
Marshal needed for protobuf compatibility
func (ProposalStatus) MarshalJSON ¶
func (status ProposalStatus) MarshalJSON() ([]byte, error)
Marshals to JSON using string
func (ProposalStatus) String ¶
func (status ProposalStatus) String() string
Turns VoteStatus byte to String
func (*ProposalStatus) Unmarshal ¶
func (status *ProposalStatus) Unmarshal(data []byte) error
Unmarshal needed for protobuf compatibility
func (*ProposalStatus) UnmarshalJSON ¶
func (status *ProposalStatus) UnmarshalJSON(data []byte) error
Unmarshals from JSON assuming Bech32 encoding
type QueryProposalParams ¶
type QueryProposalParams struct {
ProposalID int64
}
Params for query 'custom/gov/proposal'
type QueryProposalsParams ¶
type QueryProposalsParams struct { ProposalStatus ProposalStatus NumLatestProposals int64 }
type QuerySwapByCreatorParams ¶
type QuerySwapByCreatorParams struct { Creator AccAddress Limit int64 Offset int64 }
Params for query 'custom/atomicswap/swapcreator'
type QuerySwapByID ¶
type QuerySwapByID struct {
SwapID SwapBytes
}
Params for query 'custom/atomicswap/swapid'
type QuerySwapByRecipientParams ¶
type QuerySwapByRecipientParams struct { Recipient AccAddress Limit int64 Offset int64 }
Params for query 'custom/atomicswap/swaprecipient'
type QueryTimeLockParams ¶
type QueryTimeLockParams struct { Account AccAddress Id int64 }
Params for query 'custom/timelock/timelock'
type QueryTimeLocksParams ¶
type QueryTimeLocksParams struct {
Account AccAddress
}
Params for query 'custom/timelock/timelocks'
type ResultStatus ¶
type ResultStatus struct { NodeInfo NodeInfo `json:"node_info"` SyncInfo SyncInfo `json:"sync_info"` ValidatorInfo ValidatorInfo `json:"validator_info"` }
Account definition
type SwapBytes ¶
type SwapBytes []byte
func (SwapBytes) MarshalJSON ¶
func (*SwapBytes) UnmarshalJSON ¶
type SwapStatus ¶
type SwapStatus byte
const ( NULL SwapStatus = 0x00 Open SwapStatus = 0x01 Completed SwapStatus = 0x02 Expired SwapStatus = 0x03 )
func NewSwapStatusFromString ¶
func NewSwapStatusFromString(str string) SwapStatus
func (SwapStatus) MarshalJSON ¶
func (status SwapStatus) MarshalJSON() ([]byte, error)
func (SwapStatus) String ¶
func (status SwapStatus) String() string
func (*SwapStatus) UnmarshalJSON ¶
func (status *SwapStatus) UnmarshalJSON(data []byte) error
type TallyResult ¶
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 ¶
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 ¶
func (tp TextProposal) GetDescription() string
func (TextProposal) GetProposalType ¶
func (tp TextProposal) GetProposalType() ProposalKind
func (TextProposal) GetStatus ¶
func (tp TextProposal) GetStatus() ProposalStatus
func (TextProposal) GetSubmitTime ¶
func (tp TextProposal) GetSubmitTime() time.Time
func (TextProposal) GetTallyResult ¶
func (tp TextProposal) GetTallyResult() TallyResult
func (TextProposal) GetTitle ¶
func (tp TextProposal) GetTitle() string
func (TextProposal) GetTotalDeposit ¶
func (tp TextProposal) GetTotalDeposit() Coins
func (TextProposal) GetVotingPeriod ¶
func (tp TextProposal) GetVotingPeriod() time.Duration
func (TextProposal) GetVotingStartTime ¶
func (tp TextProposal) GetVotingStartTime() time.Time
func (*TextProposal) SetDescription ¶
func (tp *TextProposal) SetDescription(description string)
func (*TextProposal) SetProposalID ¶
func (tp *TextProposal) SetProposalID(proposalID int64)
func (*TextProposal) SetProposalType ¶
func (tp *TextProposal) SetProposalType(proposalType ProposalKind)
func (*TextProposal) SetStatus ¶
func (tp *TextProposal) SetStatus(status ProposalStatus)
func (*TextProposal) SetSubmitTime ¶
func (tp *TextProposal) SetSubmitTime(submitTime time.Time)
func (*TextProposal) SetTallyResult ¶
func (tp *TextProposal) SetTallyResult(tallyResult TallyResult)
func (*TextProposal) SetTitle ¶
func (tp *TextProposal) SetTitle(title string)
func (*TextProposal) SetTotalDeposit ¶
func (tp *TextProposal) SetTotalDeposit(totalDeposit Coins)
func (*TextProposal) SetVotingPeriod ¶
func (tp *TextProposal) SetVotingPeriod(votingPeriod time.Duration)
func (*TextProposal) SetVotingStartTime ¶
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 TimeLockRecord ¶
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"` }
Token definition
type TokenBalance ¶
type TokensQuery ¶
type TokensQuery struct { Offset *uint32 `json:"offset,omitempty,string"` //Option Limit *uint32 `json:"limit,omitempty,string"` //Option }
TokensQuery definition
func NewTokensQuery ¶
func NewTokensQuery() *TokensQuery
func (*TokensQuery) Check ¶
func (param *TokensQuery) Check() error
func (*TokensQuery) WithLimit ¶
func (param *TokensQuery) WithLimit(limit uint32) *TokensQuery
func (*TokensQuery) WithOffset ¶
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 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 ¶
func (param *TradesQuery) Check() error
func (*TradesQuery) WithAddress ¶
func (param *TradesQuery) WithAddress(addr string) *TradesQuery
func (*TradesQuery) WithEnd ¶
func (param *TradesQuery) WithEnd(end int64) *TradesQuery
func (*TradesQuery) WithLimit ¶
func (param *TradesQuery) WithLimit(limit uint32) *TradesQuery
func (*TradesQuery) WithOffset ¶
func (param *TradesQuery) WithOffset(offset uint32) *TradesQuery
func (*TradesQuery) WithSide ¶
func (param *TradesQuery) WithSide(side string) *TradesQuery
func (*TradesQuery) WithStart ¶
func (param *TradesQuery) WithStart(start int64) *TradesQuery
func (*TradesQuery) WithSymbol ¶
func (param *TradesQuery) WithSymbol(baseAssetSymbol, quoteAssetSymbol string) *TradesQuery
type TradingPair ¶
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) 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 }
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.