Documentation
¶
Index ¶
- Constants
- Variables
- func GetFromBech32(bech32str, prefix string) ([]byte, error)
- func RegisterWire(cdc *amino.Codec)
- type AccAddress
- type Account
- type AppAccount
- func (acc *AppAccount) Clone() Account
- func (acc AppAccount) GetFrozenCoins() Coins
- func (acc AppAccount) GetLockedCoins() Coins
- func (acc AppAccount) GetName() string
- func (acc *AppAccount) SetFrozenCoins(frozen Coins)
- func (acc *AppAccount) SetLockedCoins(frozen Coins)
- func (acc *AppAccount) SetName(name string)
- type BalanceAccount
- type BaseAccount
- func (acc *BaseAccount) Clone() Account
- 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
- type Commission
- type Dec
- type DepthQuery
- type Description
- type DexFeeField
- type DexFeeParam
- type Double
- type FeeDistributeType
- type FeeParam
- type Fixed8
- type FixedFeeParams
- type Kline
- type KlineQuery
- type MarketDepth
- type MarketsQuery
- type NamedAccount
- type NamedAcount
- type NodeInfo
- type NodeInfoOther
- type OpenOrder
- type OpenOrders
- type OpenOrdersQuery
- type Order
- type OrderBook
- type OrderBookLevel
- type ResultStatus
- type SyncInfo
- type Ticker24h
- type Ticker24hQuery
- type Time
- type Token
- type TokenBalance
- type Trade
- type Trades
- type TradesQuery
- type TradingPair
- type TransferFeeParam
- type UnbondingDelegation
- type ValAddress
- type Validator
- type ValidatorInfo
Constants ¶
const ( OperateFeeType = "operate" TransferFeeType = "transfer" DexFeeType = "dex" FeeForProposer = FeeDistributeType(0x01) FeeForAll = FeeDistributeType(0x02) FeeFree = FeeDistributeType(0x03) )
const ( SideBuy = "BUY" SideSell = "SELL" )
Variables ¶
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 Fixed8Decimals = int(math.Pow10(precision))
Fixed8Decimals represents 10^precision (100000000), a value of 1 in Fixed8 format
var Fixed8One = NewFixed8(1)
Fixed8One represetns one unit
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 GetFromBech32 ¶
GetFromBech32 to decode a bytestring from a bech32-encoded 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) 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 }
type AppAccount ¶
type AppAccount struct { BaseAccount `json:"base"` Name string `json:"name"` FrozenCoins Coins `json:"frozen"` LockedCoins Coins `json:"locked"` }
AppAccount definition
func (*AppAccount) Clone ¶
func (acc *AppAccount) Clone() Account
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) 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 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"` }
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 }
func (Commission) String ¶
func (c Commission) String() string
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 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 NamedAcount ¶
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 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 ResultStatus ¶
type ResultStatus struct { NodeInfo NodeInfo `json:"node_info"` SyncInfo SyncInfo `json:"sync_info"` ValidatorInfo ValidatorInfo `json:"validator_info"` }
Account definition
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 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 Trade ¶
type Trade struct { BuyerOrderID string `json:"buyerOrderId"` BuyFee string `json:"buyFee"` BuyerId string `json:"buyerId"` Price string `json:"price"` Quantity string `json:"quantity"` SellFee string `json:"sellFee"` SellerId string `json:"sellerId"` SellerOrderID string `json:"sellerOrderId"` Symbol string `json:"symbol"` Time int64 `json:"time"` TradeID string `json:"tradeId"` BlockHeight int64 `json:"blockHeight"` BaseAsset string `json:"baseAsset"` QuoteAsset string `json:"quoteAsset"` }
Trade def
type TradesQuery ¶
type TradesQuery = ClosedOrdersQuery
TradesQuery definition
func NewTradesQuery ¶
func NewTradesQuery(senderAddres string, withTotal bool) *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.