model

package
v0.0.0-...-0584d29 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CoinMarketCapCacheKey     = "coinMarketCapInfo"
	CoinMarketCapIOSOfBTCTUrl = "https://api.coinmarketcap.com/v2/ticker/2405?convert=BTC"
	CoinMarketCapIOSOfETHTUrl = "https://api.coinmarketcap.com/v2/ticker/2405?convert=ETH"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockOutput

type BlockOutput struct {
	Height        int64    `json:"height"`
	ParentHash    string   `json:"parentHash"`
	BlockHash     string   `json:"blockHash"`
	Witness       string   `json:"witness"`
	Age           string   `json:"age"`
	UTCTime       string   `json:"utcTime"`
	Timestamp     int64    `json:"timestamp"`
	TxList        []string `json:"txList"`
	Txn           int64    `json:"txn"`
	TotalGasLimit int64    `json:"totalGasLimit"`
	AvgGasPrice   float64  `json:"avgGasPrice"`
}

func GenerateBlockOutput

func GenerateBlockOutput(bInfo *rpcpb.Block, pos int64) *BlockOutput

func GetBlock

func GetBlock(page, eachPageNum int64) ([]*BlockOutput, error)

type MarketInfo

type MarketInfo struct {
	Price            string  `json:"price"`
	Volume24h        int64   `json:"volume24h"`
	PercentChange24h float64 `json:"percentChange24h"`
	MarketCap        int64   `json:"marketCap"`
	BtcPrice         string  `json:"btcPrice"`
	EthPrice         string  `json:"ethPrice"`
	LastUpdate       string  `json:"lastUpdate"`
}

func GetMarketInfo

func GetMarketInfo() (*MarketInfo, error)

type TxJson

type TxJson struct {
	Hash        string  `json:"hash"`
	BlockNumber int64   `json:"blockNumber"`
	From        string  `json:"from"`
	To          string  `json:"to"`
	Amount      float64 `json:"amount"`
	GasLimit    float64 `json:"gasLimit"`
	GasPrice    float64 `json:"gasPrice"`
	Age         string  `json:"age"`
	UTCTime     string  `json:"utcTime"`
}

func ConvertTxJsons

func ConvertTxJsons(txs []*db.TxStore) []*TxJson

type TxnDetail

type TxnDetail struct {
	Hash          string  `json:"txHash"`
	BlockNumber   int64   `json:"blockHeight"`
	From          string  `json:"from"`
	To            string  `json:"to"`
	Amount        float64 `json:"amount"`
	GasLimit      float64 `json:"gasLimit"`
	GasPrice      float64 `json:"price"`
	Age           string  `json:"age"`
	UTCTime       string  `json:"utcTime"`
	Code          string  `json:"code"`
	StatusCode    int32   `json:"statusCode"`
	StatusMessage string  `json:"statusMessage"`
	Contract      string  `json:"contract"`
	ActionName    string  `json:"actionName"`
	Data          string  `json:"data"`
	Memo          string  `json:"memo"`
}

/ this struct is used as json to return

func ConvertTxOutput

func ConvertTxOutput(tx *db.TxStore) *TxnDetail

/ convert FlatTx to TxnDetail

func ConvertTxsOutputs

func ConvertTxsOutputs(tx []*db.TxStore) []*TxnDetail

func GetDetailTxn

func GetDetailTxn(txHash string) (*TxnDetail, error)

func GetFlatTxnSlicePage

func GetFlatTxnSlicePage(page, eachPageNum, block int64) ([]*TxnDetail, error)

/ get a list of transactions for a specific page using account and block

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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