binance

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeToken added in v1.0.37

func NormalizeToken(srcToken *Balance, tokens *TokenPage) (t blockatlas.Token, ok bool)

NormalizeToken converts a Binance token into the generic model

func NormalizeTokens added in v1.0.37

func NormalizeTokens(srcBalance []Balance, tokens *TokenPage) (tokenPage []blockatlas.Token)

NormalizeTxs converts multiple Binance tokens

func NormalizeTx added in v1.0.0

func NormalizeTx(srcTx Tx, token, address string) (blockatlas.TxPage, bool)

NormalizeTx converts a Binance transaction into the generic model

func NormalizeTxs added in v1.0.0

func NormalizeTxs(srcTxs []Tx, token, adress string) (txs []blockatlas.Tx)

NormalizeTxs converts multiple Binance transactions

func TokenSymbol added in v1.0.37

func TokenSymbol(asset string) string

Types

type Account added in v1.0.0

type Account struct {
	AccountNumber int       `json:"account_number"`
	Address       string    `json:"address"`
	Balances      []Balance `json:"balances"`
	PublicKey     []byte    `json:"public_key"`
	Sequence      uint64    `json:"sequence"`
}

type Balance added in v1.0.0

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

type BlockDescriptor added in v1.0.0

type BlockDescriptor struct {
	BlockHeight int64  `json:"blockHeight"`
	BlockHash   string `json:"blockHash"`
	TxNum       int    `json:"txNum"`
}

type BlockList added in v1.0.0

type BlockList struct {
	BlockArray []BlockDescriptor `json:"blockArray"`
}

type Client added in v1.0.0

type Client struct {
	blockatlas.Request
}

func (*Client) GetBlockByNumber added in v1.0.0

func (c *Client) GetBlockByNumber(num int64) (*TxPage, error)

func (*Client) GetBlockList added in v1.0.0

func (c *Client) GetBlockList(count int) (*BlockList, error)

func (*Client) GetTx added in v1.0.37

func (c *Client) GetTx(hash string) (stx Tx, err error)

func (*Client) GetTxsOfAddress added in v1.0.0

func (c *Client) GetTxsOfAddress(address string, token string) (*TxPage, error)

type Data added in v1.0.37

type Data struct {
	OrderData OrderData `json:"orderData"`
}

type DexClient added in v1.0.37

type DexClient struct {
	blockatlas.Request
}

func (*DexClient) GetAccountMetadata added in v1.0.37

func (c *DexClient) GetAccountMetadata(address string) (account *Account, err error)

func (*DexClient) GetTokens added in v1.0.37

func (c *DexClient) GetTokens() (*TokenPage, error)

type Error added in v1.0.0

type Error struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

func (*Error) Error added in v1.0.0

func (e *Error) Error() string

type OrderData added in v1.0.37

type OrderData struct {
	Symbol   string      `json:"symbol"`
	Base     string      `json:"-"`
	Quote    string      `json:"-"`
	Quantity interface{} `json:"quantity"`
	Price    interface{} `json:"price"`
}

func (OrderData) GetPrice added in v1.0.37

func (od OrderData) GetPrice() (float64, bool)

func (OrderData) GetQuantity added in v1.0.37

func (od OrderData) GetQuantity() (float64, bool)

func (OrderData) GetVolume added in v1.0.37

func (od OrderData) GetVolume() (int64, bool)

type Platform added in v1.0.0

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

func Init added in v1.1.0

func Init(api, dex string) *Platform

func (*Platform) Coin added in v1.0.0

func (p *Platform) Coin() coin.Coin

func (*Platform) CurrentBlockNumber added in v1.0.0

func (p *Platform) CurrentBlockNumber() (int64, error)

func (*Platform) GetBlockByNumber added in v1.0.0

func (p *Platform) GetBlockByNumber(num int64) (*blockatlas.Block, error)

func (*Platform) GetTokenListByAddress added in v1.0.37

func (p *Platform) GetTokenListByAddress(address string) (blockatlas.TokenPage, error)

func (*Platform) GetTokenTxsByAddress added in v1.0.37

func (p *Platform) GetTokenTxsByAddress(address string, token string) (blockatlas.TxPage, error)

func (*Platform) GetTxsByAddress added in v1.0.37

func (p *Platform) GetTxsByAddress(address string) (blockatlas.TxPage, error)

type SubTx added in v1.0.37

type SubTx struct {
	Hash     string      `json:"hash"`
	Height   uint64      `json:"height"`
	Type     TxType      `json:"type"`
	Value    json.Number `json:"value"`
	Asset    string      `json:"asset"`
	FromAddr string      `json:"fromAddr"`
	ToAddr   string      `json:"toAddr"`
	Fee      json.Number `json:"fee"`
}

type SubTxs added in v1.0.37

type SubTxs []SubTx

type SubTxsDto added in v1.0.37

type SubTxsDto struct {
	TotalNum     uint   `json:"totalNum"`
	SubTxDtoList SubTxs `json:"subTxDtoList"`
}

type Token added in v1.0.37

type Token struct {
	Mintable       bool   `json:"mintable"`
	Name           string `json:"name"`
	OriginalSymbol string `json:"original_symbol"`
	Owner          string `json:"owner"`
	Symbol         string `json:"symbol"`
	TotalSupply    string `json:"total_supply"`
}

type TokenPage added in v1.0.37

type TokenPage []Token

type Tx added in v1.0.0

type Tx struct {
	BlockHeight   uint64      `json:"blockHeight"`
	Type          TxType      `json:"txType"`
	Code          int         `json:"code"`
	ConfirmBlocks int         `json:"confirmBlocks"`
	Data          string      `json:"data"`
	FromAddr      string      `json:"fromAddr"`
	OrderID       string      `json:"orderId"`
	Timestamp     int64       `json:"timeStamp"`
	ToAddr        string      `json:"toAddr"`
	Age           int64       `json:"txAge"`
	Asset         string      `json:"txAsset"`
	Fee           json.Number `json:"txFee"`
	Hash          string      `json:"txHash"`
	Value         json.Number `json:"value"`
	Memo          string      `json:"memo"`
	HasChildren   int         `json:"hasChildren"`
	SubTxsDto     SubTxsDto   `json:"subTxsDto"`
}

type TxPage added in v1.0.0

type TxPage struct {
	Nums int  `json:"txNums"`
	Txs  []Tx `json:"txArray"`
}

type TxType added in v1.0.37

type TxType string
const (
	TxTransfer    TxType = "TRANSFER"
	TxNewOrder    TxType = "NEW_ORDER"
	TxCancelOrder TxType = "CANCEL_ORDER"
)

Jump to

Keyboard shortcuts

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