Documentation ¶
Index ¶
- Variables
- func Respond(w http.ResponseWriter, data interface{})
- func ValidatorMsgType(msgType string) bool
- type Account
- type AccountTxArray
- type AccountTxData
- type AccountTxs
- type Asset
- type AssetChartHistory
- type AssetHolders
- type AssetInfo
- type AssetInfoList
- type AssetTxArray
- type AssetTxData
- type AssetTxs
- type BlockData
- type CoinGeckoCoinList
- type CoinGeckoMarket
- type CoinGeckoMarketChart
- type CoinMarketCurrencies
- type Commission
- type Description
- type FixedFeeParam
- type ImageList
- type Market
- type Message
- type Order
- type Paging
- type Prices
- type ResultAccountTxs
- type ResultAssetInfo
- type ResultAssetInfoList
- type ResultAssetTxs
- type ResultAssetsImages
- type ResultBlocks
- type ResultTxs
- type Signature
- type Status
- type Token
- type TxData
- type TxMsgFee
- type TxRequestPayload
- type Txs
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ChosenAssetNames = []string{
"TUSDB-888",
"USDSB-1AC",
"BTCB-1DE",
"IRIS-D88",
}
ChosenAssetNames define 4 asset names that are displayed on the card view on Asset page
Functions ¶
func Respond ¶
func Respond(w http.ResponseWriter, data interface{})
Respond responds json format with any data type
func ValidatorMsgType ¶
ValidatorMsgType verifies transaction by its message type
Types ¶
type Account ¶
type Account struct { Address string `json:"address"` PublicKey json.RawMessage `json:"public_key"` AccountNumber int64 `json:"account_number"` Sequence int64 `json:"sequence"` Flags uint64 `json:"flags"` Balances []struct { Symbol string `json:"symbol"` Free string `json:"free"` Locked string `json:"locked"` Frozen string `json:"frozen"` } `json:"balances"` }
Account defines the structure for account information
type AccountTxArray ¶
type AccountTxArray struct { BlockHeight int64 `json:"blockHeight"` Code int64 `json:"code"` TxHash string `json:"txHash"` TxType string `json:"txType"` TxAsset string `json:"txAsset"` TxQuoteAsset string `json:"txQuoteAsset,omitempty"` Value float64 `json:"value"` TxFee float64 `json:"txFee"` FromAddr string `json:"fromAddr"` ToAddr string `json:"toAddr,omitempty"` TxAge int64 `json:"txAge"` OrderID string `json:"orderId,omitempty"` Message *AccountTxData `json:"message,omitempty"` Log string `json:"log"` ConfirmBlocks int64 `json:"confirmBlocks"` Memo string `json:"memo"` Source int64 `json:"source"` HasChildren int64 `json:"hasChildren,omitempty"` Timestamp int64 `json:"timeStamp"` }
AccountTxArray wraps ResultAccountTxs TxArray
type AccountTxData ¶
type AccountTxData struct { OrderData struct { Symbol string `json:"symbol"` OrderType string `json:"orderType"` Side string `json:"side"` Price string `json:"price"` Quantity string `json:"quantity"` TimeInForce string `json:"timeInForce"` OrderID string `json:"orderId"` } `json:"orderData"` }
AccountTxData defines the structure for ResultAccountTxs Data
type AccountTxs ¶
type AccountTxs struct { TxNums int `json:"txNums"` TxArray []struct { TxHash string `json:"txHash"` BlockHeight int64 `json:"blockHeight"` TxType string `json:"txType"` TimeStamp int64 `json:"timeStamp"` FromAddr string `json:"fromAddr"` ToAddr string `json:"toAddr"` Value float64 `json:"value"` TxAsset string `json:"txAsset"` TxQuoteAsset string `json:"txQuoteAsset"` TxFee float64 `json:"txFee"` TxAge int64 `json:"txAge"` OrderID string `json:"orderId"` Data string `json:"data,omitempty"` Code int64 `json:"code"` Log string `json:"log"` ConfirmBlocks int64 `json:"confirmBlocks"` Memo string `json:"memo"` Source int64 `json:"source"` HasChildren int64 `json:"hasChildren"` } `json:"txArray"` }
AccountTxs defines the structure for asset transactions
type Asset ¶
type Asset struct { CreateTime interface{} `json:"createTime"` UpdateTime interface{} `json:"updateTime"` ID int `json:"id"` Asset string `json:"asset"` MappedAsset string `json:"mappedAsset"` Name string `json:"name"` AssetImg string `json:"assetImg"` Supply float64 `json:"supply"` Price float64 `json:"price"` QuoteUnit string `json:"quoteUnit"` ChangeRange float64 `json:"changeRange"` Owner string `json:"owner"` Mintable int `json:"mintable"` Visible interface{} `json:"visible"` Description string `json:"description"` AssetCreateTime interface{} `json:"assetCreateTime"` Transactions int `json:"transactions"` Holders int `json:"holders"` OfficialSiteURL string `json:"officialSiteUrl"` ContactEmail string `json:"contactEmail"` MediaList []struct { MediaName string `json:"mediaName"` MediaURL string `json:"mediaUrl"` MediaImg string `json:"mediaImg"` } `json:"mediaList"` }
Asset defines the structure for asset detail information
type AssetChartHistory ¶
type AssetChartHistory struct { Name string `json:"name"` Asset string `json:"asset"` MappedAsset string `json:"mapped_asset"` CurrentPrice float64 `json:"current_price"` QuoteUnit string `json:"quote_unit"` ChangeRange float64 `json:"change_range"` Supply float64 `json:"supply"` Marketcap float64 `json:"marketcap"` AssetImage string `json:"asset_img"` Prices []Prices `json:"prices"` }
AssetChartHistory defines the structure for asset chart hisotry
type AssetHolders ¶
type AssetHolders struct { TotalNum int `json:"totalNum"` AddressHolders []struct { Address string `json:"address"` Quantity float64 `json:"quantity"` Percentage float64 `json:"percentage"` Tag interface{} `json:"tag"` } `json:"addressHolders"` }
AssetHolders defines the structure for asset holders list
type AssetInfo ¶
type AssetInfo struct { TotalNum int `json:"totalNum"` AssetInfoList []AssetInfoList `json:"assetInfoList"` }
AssetInfo represents asset information list
type AssetInfoList ¶
type AssetInfoList struct { CreateTime json.RawMessage `json:"createTime"` UpdateTime json.RawMessage `json:"updateTime"` ID int32 `json:"id"` Asset string `json:"asset"` MappedAsset string `json:"mappedAsset"` Name string `json:"name"` AssetImg string `json:"assetImg"` Supply float64 `json:"supply"` Price float64 `json:"price"` QuoteUnit string `json:"quoteUnit"` ChangeRange float64 `json:"changeRange"` Owner string `json:"owner"` Mintable int32 `json:"mintable"` Visible json.RawMessage `json:"visible"` Description json.RawMessage `json:"description"` AssetCreateTime int64 `json:"assetCreateTime"` }
AssetInfoList defines the structure for asset information list
type AssetTxArray ¶
type AssetTxArray struct { BlockHeight int64 `json:"blockHeight"` Code int64 `json:"code"` TxHash string `json:"txHash"` TxType string `json:"txType"` TxAsset string `json:"txAsset"` TxQuoteAsset string `json:"txQuoteAsset,omitempty"` Value float64 `json:"value"` TxFee float64 `json:"txFee"` FromAddr string `json:"fromAddr"` ToAddr string `json:"toAddr,omitempty"` TxAge int64 `json:"txAge"` OrderID string `json:"orderId,omitempty"` Message *AssetTxData `json:"message,omitempty"` Log string `json:"log"` ConfirmBlocks int64 `json:"confirmBlocks"` Memo string `json:"memo"` Source int64 `json:"source"` HasChildren int64 `json:"hasChildren,omitempty"` Timestamp int64 `json:"timeStamp"` }
AssetTxArray wraps ResultAssetTxs TxArray
type AssetTxData ¶
type AssetTxData struct { OrderData struct { Symbol string `json:"symbol"` OrderType string `json:"orderType"` Side string `json:"side"` Price string `json:"price"` Quantity string `json:"quantity"` TimeInForce string `json:"timeInForce"` OrderID string `json:"orderId"` } `json:"orderData"` }
AssetTxData wraps ResultAssetTxs Data
type AssetTxs ¶
type AssetTxs struct { TxNums int `json:"txNums"` TxArray []struct { TxHash string `json:"txHash"` BlockHeight int64 `json:"blockHeight"` TxType string `json:"txType"` TimeStamp int64 `json:"timeStamp"` FromAddr string `json:"fromAddr"` ToAddr string `json:"toAddr"` Value float64 `json:"value"` TxAsset string `json:"txAsset"` TxQuoteAsset string `json:"txQuoteAsset"` TxFee float64 `json:"txFee"` TxAge int64 `json:"txAge"` OrderID string `json:"orderId"` Data string `json:"data,omitempty"` Code int64 `json:"code"` Log string `json:"log"` ConfirmBlocks int64 `json:"confirmBlocks"` Memo string `json:"memo"` Source int64 `json:"source"` HasChildren int64 `json:"hasChildren"` } `json:"txArray"` }
AssetTxs defines the structure for asset transactions
type BlockData ¶
type BlockData struct { Height int64 `json:"height"` Proposer string `json:"proposer"` Moniker string `json:"moniker"` BlockHash string `json:"block_hash"` ParentHash string `json:"parent_hash"` NumPrecommits int64 `json:"num_pre_commits" sql:",notnull"` NumTxs int64 `json:"num_txs" sql:"default:0"` TotalTxs int64 `json:"total_txs" sql:"default:0"` Txs []Txs `json:"txs"` Timestamp time.Time `json:"timestamp" sql:"default:now()"` }
BlockData wraps block data
type CoinGeckoCoinList ¶
type CoinGeckoCoinList struct { ID string `json:"id"` Symbol string `json:"symbol"` Name string `json:"name"` }
CoinGeckoCoinList represents CoinGecko Coin List
type CoinGeckoMarket ¶
type CoinGeckoMarket struct { ID string `json:"id"` Symbol string `json:"symbol"` Name string `json:"name"` BlockTimeInMinutes int `json:"block_time_in_minutes"` Categories json.RawMessage `json:"categories"` Localization json.RawMessage `json:"localization"` Description json.RawMessage `json:"description"` Links json.RawMessage `json:"links"` Image json.RawMessage `json:"image"` CountryOrigin string `json:"country_origin"` GenesisDate json.RawMessage `json:"genesis_date"` IcoData json.RawMessage `json:"ico_data"` MarketCapRank int `json:"market_cap_rank"` CoingeckoRank int `json:"coingecko_rank"` CoingeckoScore float64 `json:"coingecko_score"` DeveloperScore float64 `json:"developer_score"` CommunityScore float64 `json:"community_score"` LiquidityScore float64 `json:"liquidity_score"` PublicInterestScore float64 `json:"public_interest_score"` MarketData struct { CurrentPrice CoinMarketCurrencies `json:"current_price"` Roi json.RawMessage `json:"roi"` Ath json.RawMessage `json:"ath"` AthChangePercentage json.RawMessage `json:"ath_change_percentage"` AthDate json.RawMessage `json:"ath_date"` MarketCap CoinMarketCurrencies `json:"market_cap"` MarketCapRank int `json:"market_cap_rank"` TotalVolume CoinMarketCurrencies `json:"total_volume"` High24H CoinMarketCurrencies `json:"high_24h"` Low24H CoinMarketCurrencies `json:"low_24h"` PriceChange24H float64 `json:"price_change_24h"` PriceChangePercentage24H float64 `json:"price_change_percentage_24h"` PriceChangePercentage7D float64 `json:"price_change_percentage_7d"` PriceChangePercentage14D float64 `json:"price_change_percentage_14d"` PriceChangePercentage30D float64 `json:"price_change_percentage_30d"` PriceChangePercentage60D float64 `json:"price_change_percentage_60d"` PriceChangePercentage200D float64 `json:"price_change_percentage_200d"` PriceChangePercentage1Y float64 `json:"price_change_percentage_1y"` MarketCapChange24H float64 `json:"market_cap_change_24h"` MarketCapChangePercentage24H float64 `json:"market_cap_change_percentage_24h"` PriceChange24HInCurrency CoinMarketCurrencies `json:"price_change_24h_in_currency"` PriceChangePercentage1HInCurrency CoinMarketCurrencies `json:"price_change_percentage_1h_in_currency"` PriceChangePercentage24HInCurrency CoinMarketCurrencies `json:"price_change_percentage_24h_in_currency"` PriceChangePercentage7DInCurrency CoinMarketCurrencies `json:"price_change_percentage_7d_in_currency"` PriceChangePercentage14DInCurrency CoinMarketCurrencies `json:"price_change_percentage_14d_in_currency"` PriceChangePercentage30DInCurrency CoinMarketCurrencies `json:"price_change_percentage_30d_in_currency"` PriceChangePercentage60DInCurrency CoinMarketCurrencies `json:"price_change_percentage_60d_in_currency"` PriceChangePercentage200DInCurrency CoinMarketCurrencies `json:"price_change_percentage_200d_in_currency"` PriceChangePercentage1YInCurrency CoinMarketCurrencies `json:"price_change_percentage_1y_in_currency"` MarketCapChange24HInCurrency CoinMarketCurrencies `json:"market_cap_change_24h_in_currency"` MarketCapChangePercentage24HInCurrency CoinMarketCurrencies `json:"market_cap_change_percentage_24h_in_currency"` TotalSupply float64 `json:"total_supply"` CirculatingSupply float64 `json:"circulating_supply"` LastUpdated time.Time `json:"last_updated"` } `json:"market_data"` CommunityData json.RawMessage `json:"community_data"` DeveloperData json.RawMessage `json:"developer_data"` PublicInterestStats json.RawMessage `json:"public_interest_stats"` StatusUpdates json.RawMessage `json:"status_updates"` LastUpdated time.Time `json:"last_updated"` Tickers json.RawMessage `json:"tickers"` }
CoinGeckoMarket defines the structure for CoinGecko Market API
type CoinGeckoMarketChart ¶
type CoinGeckoMarketChart struct { Prices [][]float64 `json:"prices"` MarketCaps [][]float64 `json:"market_caps"` TotalVolumes [][]float64 `json:"total_volumes"` }
CoinGeckoMarketChart defines the structure for CoinGecko Market Chart API
type CoinMarketCurrencies ¶
type CoinMarketCurrencies struct { Aed float64 `json:"aed"` Ars float64 `json:"ars"` Aud float64 `json:"aud"` Bch float64 `json:"bch"` Bdt float64 `json:"bdt"` Bhd float64 `json:"bhd"` Bmd float64 `json:"bmd"` Bnb float64 `json:"bnb"` Brl float64 `json:"brl"` Btc float64 `json:"btc"` Cad float64 `json:"cad"` Chf float64 `json:"chf"` Clp float64 `json:"clp"` Cny float64 `json:"cny"` Czk float64 `json:"czk"` Dkk float64 `json:"dkk"` Eos float64 `json:"eos"` Eth float64 `json:"eth"` Eur float64 `json:"eur"` Gbp float64 `json:"gbp"` Hkd float64 `json:"hkd"` Huf float64 `json:"huf"` Idr float64 `json:"idr"` Ils float64 `json:"ils"` Inr float64 `json:"inr"` Jpy float64 `json:"jpy"` Krw float64 `json:"krw"` Kwd float64 `json:"kwd"` Lkr float64 `json:"lkr"` Ltc float64 `json:"ltc"` Mmk float64 `json:"mmk"` Mxn float64 `json:"mxn"` Myr float64 `json:"myr"` Nok float64 `json:"nok"` Nzd float64 `json:"nzd"` Php float64 `json:"php"` Pkr float64 `json:"pkr"` Pln float64 `json:"pln"` Rub float64 `json:"rub"` Sar float64 `json:"sar"` Sek float64 `json:"sek"` Sgd float64 `json:"sgd"` Thb float64 `json:"thb"` Try float64 `json:"try"` Twd float64 `json:"twd"` Usd float64 `json:"usd"` Vef float64 `json:"vef"` Vnd float64 `json:"vnd"` Xag float64 `json:"xag"` Xau float64 `json:"xau"` Xdr float64 `json:"xdr"` Xlm float64 `json:"xlm"` Xrp float64 `json:"xrp"` Zar float64 `json:"zar"` }
CoinMarketCurrencies wraps the structure for market currencies
type Commission ¶
type Commission struct { Rate string `json:"rate"` MaxRate string `json:"max_rate"` MaxChangeRate string `json:"max_change_rate"` UpdateTime time.Time `json:"update_time"` }
Commission wraps validator's commission information
type Description ¶
type Description struct { Moniker string `json:"moniker"` Identity string `json:"identity"` Website string `json:"website"` Details string `json:"details"` }
Description wraps validator's description information
type FixedFeeParam ¶
type FixedFeeParam struct { MsgType string `json:"msg_type,omitempty"` Fee int `json:"fee,omitempty"` FeeFor int `json:"fee_for,omitempty"` }
FixedFeeParam wraps fixed fee param
type ImageList ¶
type ImageList struct { Asset string `json:"asset"` Name string `json:"name"` AssetImage string `json:"assetImg"` }
ImageList wraps asset image list
type Market ¶
type Market struct { Name string `json:"name"` Symbol string `json:"symbol"` CurrentPrice string `json:"current_price"` Currency string `json:"currency"` MarketCapRank int `json:"market_cap_rank"` MarketCap string `json:"market_cap"` PercentChange1H string `json:"percent_change_1h"` PercentChange24H string `json:"percent_change_24h"` PercentChange7D string `json:"percent_change_7d"` TotalVolume string `json:"total_volume"` TotalSupply string `json:"total_supply"` CirculatingSupply string `json:"circulating_supply"` LastUpdated time.Time `json:"last_updated"` }
Market defines the structure for market data This project uses CoinGecko API
type Message ¶
type Message struct { Type string `json:"type"` Value json.RawMessage `json:"value"` }
Message wraps tx message
type Order ¶
type Order struct { OrderID string `json:"orderId"` Symbol string `json:"symbol"` Owner string `json:"owner"` Price string `json:"price"` Quantity string `json:"quantity"` CumulateQuantity string `json:"cumulateQuantity"` Fee string `json:"fee"` OrderCreateTime time.Time `json:"orderCreateTime"` TransactionTime time.Time `json:"transactionTime"` Status string `json:"status"` TimeInForce int `json:"timeInForce"` Side int `json:"side"` Type int `json:"type"` TradeID string `json:"tradeId"` LastExecutedPrice string `json:"lastExecutedPrice"` LastExecutedQuantity string `json:"lastExecutedQuantity"` TransactionHash string `json:"transactionHash"` }
Order defines the structure for order information
type Paging ¶
type Paging struct { Total int32 `json:"total"` // total number of txs saved in database Before int32 `json:"before"` // can be either block height or index num After int32 `json:"after"` // can be either block height or index num }
Paging defines the structure for required params for handling pagination
type ResultAccountTxs ¶
type ResultAccountTxs struct { TxNums int `json:"txNums"` TxArray []AccountTxArray `json:"txArray"` }
ResultAccountTxs defines the structure for response data for AssetTxs
type ResultAssetInfo ¶
type ResultAssetInfo struct { TotalNum int `json:"totalNum"` AssetInfoList []ResultAssetInfoList `json:"assetInfoList"` }
ResultAssetInfo defines the structure for result asset information list
type ResultAssetInfoList ¶
type ResultAssetInfoList struct { Asset string `json:"asset"` MappedAsset string `json:"mappedAsset"` Name string `json:"name"` Price float64 `json:"price"` QuoteUnit string `json:"quoteUnit"` }
ResultAssetInfoList wraps result asset information list
type ResultAssetTxs ¶
type ResultAssetTxs struct { TxNums int `json:"txNums"` TxArray []AssetTxArray `json:"txArray"` }
ResultAssetTxs defines the structure for result AssetTxs
type ResultAssetsImages ¶
type ResultAssetsImages struct { TotalNum int `json:"totalNum"` ImageList []ImageList `json:"imageList"` }
ResultAssetsImages defines the structure for assets image list
type ResultBlocks ¶
ResultBlocks defines the structure for block result response
type Signature ¶
type Signature struct { Pubkey string `json:"pubkey"` Address string `json:"address"` Sequence uint64 `json:"sequence"` Signature string `json:"signature"` }
Signature wraps tx signature
type Status ¶
type Status struct { ChainID string `json:"chain_id"` BlockTime float64 `json:"block_time"` LatestBlockHeight int64 `json:"latest_block_height"` TotalValidatorNum int `json:"total_validator_num"` Timestamp time.Time `json:"timestamp"` }
Status defines the structure for current status on the active chain
type Token ¶
type Token struct { Name string `json:"name"` Symbol string `json:"symbol"` OriginalSymbol string `json:"original_symbol"` TotalSupply string `json:"total_supply"` Owner string `json:"owner"` Mintable bool `json:"mintable"` }
Token defines the structure for token information
type TxData ¶
type TxData struct { ID int32 `json:"id,omitempty"` Height int64 `json:"height"` Result bool `json:"result"` TxHash string `json:"tx_hash"` TxType string `json:"tx_type"` TxFrom string `json:"tx_from"` // for EVM TxFromAcc string `json:"tx_from_acc"` // for EVM Messages []Message `json:"messages"` Signatures []Signature `json:"signatures"` Memo string `json:"memo"` Log string `json:"logs"` Info string `json:"info"` Code uint32 `json:"code"` Timestamp time.Time `json:"timestamp"` }
TxData wraps tx data
type TxMsgFee ¶
type TxMsgFee struct { MsgType string `json:"msg_type,omitempty"` Fee int `json:"fee,omitempty"` FeeFor int `json:"fee_for,omitempty"` FixedFeeParams *FixedFeeParam `json:"fixed_fee_params,omitempty"` MultiTransferFee int `json:"multi_transfer_fee,omitempty"` LowerLimitAsMulti int `json:"lower_limit_as_multi,omitempty"` DexFeeFields []struct { FeeName string `json:"fee_name,omitempty"` FeeValue int `json:"fee_value,omitempty"` } `json:"dex_fee_fields,omitempty"` }
TxMsgFee defines the structure for transaction message type fees API
type TxRequestPayload ¶
type TxRequestPayload struct { TxType string `json:"tx_type"` StartTime int64 `json:"start_time"` EndTime int64 `json:"end_time"` }
TxRequestPayload defines the structure for the data when receiving transaction request by its type and date
type Txs ¶
type Txs struct { Height int64 `json:"height"` Result bool `json:"result"` TxHash string `json:"tx_hash"` TxType string `json:"tx_type"` TxFrom string `json:"tx_from"` // for EVM TxFromAcc string `json:"tx_from_acc"` // for EVM Messages []Message `json:"messages"` Memo string `json:"memo"` Info string `json:"info"` Code uint32 `json:"code"` Timestamp time.Time `json:"timestamp"` }
Txs defines the structure for transaction data for result block
type Validator ¶
type Validator struct { OperatorAddress string `json:"operator_address" sql:",notnull, unique"` ConsensusPubKey string `json:"consensus_pubkey" sql:",notnull, unique"` Jailed bool `json:"jailed"` Status string `json:"status"` Tokens string `json:"tokens"` Power int64 `json:"power"` Description Description `json:"description"` UnbondingHeight int64 `json:"unbonding_height"` UnbondingTime string `json:"unbonding_time"` Commission Commission `json:"commission"` }
Validator defines the structure for validator API