explorer

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Page               int      `json:"page"`
	TotalPages         int      `json:"totalPages"`
	ItemsOnPage        int      `json:"itemsOnPage"`
	Address            string   `json:"address"`
	Balance            string   `json:"balance"`
	TotalReceived      string   `json:"totalReceived"`
	TotalSent          string   `json:"totalSent"`
	UnconfirmedBalance string   `json:"unconfirmedBalance"`
	UnconfirmedTxs     int      `json:"unconfirmedTxs"`
	Txs                int      `json:"txs"`
	Txids              []string `json:"txids"`
}

type BlockBook

type BlockBook struct {
	Url string
	// contains filtered or unexported fields
}

func NewBlockBookWrapper

func NewBlockBookWrapper(url string) *BlockBook

func (*BlockBook) FindDepositTxId

func (b *BlockBook) FindDepositTxId(address string, amount int64) (string, error)

utils

func (*BlockBook) GetAddress

func (b *BlockBook) GetAddress(address string) (response Address, err error)

func (*BlockBook) GetEthAddress

func (b *BlockBook) GetEthAddress(addr string) (response EthAddr, err error)

func (*BlockBook) GetFee

func (b *BlockBook) GetFee(nBlocks string) (response Fee, err error)

func (*BlockBook) GetTx

func (b *BlockBook) GetTx(txid string) (response Tx, err error)

func (*BlockBook) GetTxEth

func (b *BlockBook) GetTxEth(txid string) (response EthTx, err error)

func (*BlockBook) GetUtxo

func (b *BlockBook) GetUtxo(xpub string, confirmed bool) (response []Utxo, err error)

func (*BlockBook) GetXpub

func (b *BlockBook) GetXpub(xpub string) (response Xpub, err error)

func (*BlockBook) SendTx

func (b *BlockBook) SendTx(rawTx string) (response string, err error)

func (*BlockBook) SendTxWithMessage

func (b *BlockBook) SendTxWithMessage(rawTx string) (string, error, string)

type BroadcastRequest

type BroadcastRequest struct {
	TxHex string `json:"txHex"`
}

type EthAddr

type EthAddr struct {
	Address            string      `json:"address"`
	Balance            string      `json:"balance"`
	ItemsOnPage        int         `json:"itemsOnPage"`
	NonTokenTxs        int         `json:"nonTokenTxs"`
	Nonce              string      `json:"nonce"`
	Page               int         `json:"page"`
	Tokens             []EthTokens `json:"tokens"`
	TotalPages         int         `json:"totalPages"`
	Transactions       []EthTx     `json:"transactions"`
	Txs                int         `json:"txs"`
	UnconfirmedBalance string      `json:"unconfirmedBalance"`
	UnconfirmedTxs     int         `json:"unconfirmedTxs"`
}

type EthTokens

type EthTokens struct {
	Balance   string `json:"balance"`
	Contract  string `json:"contract"`
	Decimals  int    `json:"decimals"`
	Name      string `json:"name"`
	Symbol    string `json:"symbol"`
	Transfers int    `json:"transfers"`
	Type      string `json:"type"`
}

type EthTx

type EthTx struct {
	BlockHash        string `json:"blockHash"`
	BlockHeight      int    `json:"blockHeight"`
	BlockTime        int    `json:"blockTime"`
	Confirmations    int    `json:"confirmations"`
	EthereumSpecific struct {
		GasLimit int    `json:"gasLimit"`
		GasPrice string `json:"gasPrice"`
		GasUsed  int    `json:"gasUsed"`
		Nonce    int    `json:"nonce"`
		Status   int    `json:"status"`
	} `json:"ethereumSpecific"`
	Fees           string `json:"fees"`
	TokenTransfers []struct {
		Decimals int    `json:"decimals"`
		From     string `json:"from"`
		Name     string `json:"name"`
		Symbol   string `json:"symbol"`
		To       string `json:"to"`
		Token    string `json:"token"`
		Type     string `json:"type"`
		Value    string `json:"value"`
	} `json:"tokenTransfers"`
	Txid  string      `json:"txid"`
	Value string      `json:"value"`
	Vin   []EthTxVin  `json:"vin"`
	Vout  []EthTxVout `json:"vout"`
}

type EthTxVin

type EthTxVin struct {
	Addresses []string `json:"addresses"`
	IsAddress bool     `json:"isAddress"`
	N         int      `json:"n"`
}

type EthTxVout

type EthTxVout struct {
	Addresses []string `json:"addresses"`
	IsAddress bool     `json:"isAddress"`
	N         int      `json:"n"`
	Value     string   `json:"value"`
}

type Explorer

type Explorer interface {
	GetXpub(xpub string) (response Xpub, err error)
	GetAddress(address string) (response Address, err error)
	GetEthAddress(addr string) (response EthAddr, err error)
	GetUtxo(xpub string, confirmed bool) (response []Utxo, err error)
	GetTx(txid string) (response Tx, err error)
	GetTxEth(txid string) (response EthTx, err error)
	GetFee(nBlocks string) (response Fee, err error)
	SendTx(rawTx string) (response string, err error)
	SendTxWithMessage(rawTx string) (string, error, string)
	FindDepositTxId(address string, amount int64) (string, error)
}

type ExplorerFactory

type ExplorerFactory struct {
}

func NewExplorerFactory

func NewExplorerFactory() *ExplorerFactory

func (*ExplorerFactory) GetExplorerByCoin

func (e *ExplorerFactory) GetExplorerByCoin(coin coins.Coin) (Explorer, error)

type Fee

type Fee struct {
	Result string `json:"result"`
}

type NulsBalanceData

type NulsBalanceData struct {
	Total         string `json:"total"`
	Freeze        string `json:"freeze"`
	Available     string `json:"available"`
	TimeLock      string `json:"timeLock"`
	ConsensusLock string `json:"consensusLock"`
	Nonce         string `json:"nonce"`
	NonceType     int    `json:"nonceType"`
}

type NulsBroadcast

type NulsBroadcast struct {
	Success bool `json:"success"`
	Data    struct {
		Value bool   `json:"value"`
		Hash  string `json:"hash"`
	} `json:"data"`
}

type NulsCalculatedFee

type NulsCalculatedFee struct {
	Success bool `json:"success"`
	Data    struct {
		Value string `json:"value"`
	} `json:"data"`
}

type NulsError

type NulsError struct {
	Success bool          `json:"success"`
	Data    NulsErrorData `json:"data"`
}

type NulsErrorData

type NulsErrorData struct {
	Code    string `json:"code"`
	Message string `json:"msg"`
}

type NulsExplorer

type NulsExplorer struct {
	Url string
	// contains filtered or unexported fields
}

func NewNulsWrapper

func NewNulsWrapper(url string) *NulsExplorer

func (*NulsExplorer) FindDepositTxId

func (b *NulsExplorer) FindDepositTxId(address string, amount int64) (string, error)

utils

func (*NulsExplorer) GetAddress

func (b *NulsExplorer) GetAddress(address string) (response Address, err error)

func (*NulsExplorer) GetEthAddress

func (b *NulsExplorer) GetEthAddress(addr string) (response EthAddr, err error)

func (*NulsExplorer) GetFee

func (b *NulsExplorer) GetFee(nBlocks string) (response Fee, err error)

func (*NulsExplorer) GetTx

func (b *NulsExplorer) GetTx(txid string) (response Tx, err error)

func (*NulsExplorer) GetTxEth

func (b *NulsExplorer) GetTxEth(txid string) (response EthTx, err error)

func (*NulsExplorer) GetUtxo

func (b *NulsExplorer) GetUtxo(xpub string, confirmed bool) (response []Utxo, err error)

func (*NulsExplorer) GetXpub

func (b *NulsExplorer) GetXpub(xpub string) (response Xpub, err error)

func (*NulsExplorer) SendTx

func (b *NulsExplorer) SendTx(rawTx string) (response string, err error)

func (*NulsExplorer) SendTxWithMessage

func (b *NulsExplorer) SendTxWithMessage(rawTx string) (string, error, string)

type NulsFee

type NulsFee struct {
	ChainId int    `json:"chainId"`
	AssetId int    `json:"assetId"`
	Symbol  string `json:"symbol"`
	Value   int    `json:"value"`
}

type NulsFeeRequest

type NulsFeeRequest struct {
	AddressCount int         `json:"addressCount"`
	FromLength   int         `json:"fromLength"`
	ToLength     int         `json:"toLength"`
	Remark       interface{} `json:"remark"`
	Price        interface{} `json:"price"`
}

type NulsFrom

type NulsFrom struct {
	Address       string `json:"address"`
	AssetsChainId int    `json:"assetsChainId"`
	AssetsId      int    `json:"assetsId"`
	Amount        string `json:"amount"`
	Nonce         string `json:"nonce"`
	Locked        int    `json:"locked"`
}

type NulsInfo

type NulsInfo struct {
	Success bool            `json:"success"`
	Data    NulsBalanceData `json:"data"`
}

api models

type NulsInfoModel

type NulsInfoModel struct {
	AssetChanId int `json:"assetChainId"`
	AssetId     int `json:"assetId"`
}

type NulsTo

type NulsTo struct {
	Address       string `json:"address"`
	AssetsChainId int    `json:"assetsChainId"`
	AssetsId      int    `json:"assetsId"`
	Amount        string `json:"amount"`
	LockTime      int    `json:"lockTime"`
}

type NulsTx

type NulsTx struct {
	TxHash       string  `json:"txHash"`
	Address      string  `json:"address"`
	Type         int     `json:"type"`
	CreateTime   int     `json:"createTime"`
	Height       int     `json:"height"`
	ChainId      int     `json:"chainId"`
	AssetId      int     `json:"assetId"`
	Symbol       string  `json:"symbol"`
	Values       int     `json:"values"`
	Fee          NulsFee `json:"fee"`
	Balance      int     `json:"balance"`
	TransferType int     `json:"transferType"`
	Status       int     `json:"status"`
}

type NulsTxDetail

type NulsTxDetail struct {
	Hash                 string     `json:"hash"`
	Type                 int        `json:"type"`
	Time                 string     `json:"time"`
	Timestamp            int        `json:"timestamp"`
	BlockHeight          int        `json:"blockHeight"`
	BlockHash            string     `json:"blockHash"`
	Remark               string     `json:"remark"`
	TransactionSignature string     `json:"transactionSignature"`
	TxDataHex            string     `json:"txDataHex"`
	Status               int        `json:"status"`
	Size                 int        `json:"size"`
	InBlockIndex         int        `json:"inBlockIndex"`
	From                 []NulsFrom `json:"from"`
	To                   []NulsTo   `json:"to"`
}

type NulsTxResponse

type NulsTxResponse struct {
	Success bool         `json:"success"`
	Data    NulsTxDetail `json:"data"`
}

type RpcRequest

type RpcRequest struct {
	Jsonrpc string        `json:"jsonrpc"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
	Id      int           `json:"id"`
}

type RpcTxResponse

type RpcTxResponse struct {
	JsonRpc string         `json:"jsonrpc"`
	Id      string         `json:"id"`
	Result  TxListResponse `json:"result"`
}

type SendTx

type SendTx struct {
	Error  string `json:"error"`
	Result string `json:"result"`
}

type Status

type Status struct {
	Backend struct {
		BestBlockHash   string `json:"bestBlockHash"`
		Blocks          int    `json:"blocks"`
		Chain           string `json:"chain"`
		Difficulty      string `json:"difficulty"`
		Headers         int    `json:"headers"`
		ProtocolVersion string `json:"protocolVersion"`
		SizeOnDisk      int    `json:"sizeOnDisk"`
		Subversion      string `json:"subversion"`
		Version         string `json:"version"`
	} `json:"backend"`
	Blockbook struct {
		About           string `json:"about"`
		BestHeight      int    `json:"bestHeight"`
		BuildTime       string `json:"buildTime"`
		Coin            string `json:"coin"`
		DbSize          int    `json:"dbSize"`
		Decimals        int    `json:"decimals"`
		GitCommit       string `json:"gitCommit"`
		Host            string `json:"host"`
		InSync          bool   `json:"inSync"`
		InSyncMempool   bool   `json:"inSyncMempool"`
		InitialSync     bool   `json:"initialSync"`
		LastBlockTime   string `json:"lastBlockTime"`
		LastMempoolTime string `json:"lastMempoolTime"`
		MempoolSize     int    `json:"mempoolSize"`
		SyncMode        bool   `json:"syncMode"`
		Version         string `json:"version"`
	} `json:"blockbook"`
}

type TokenTransfer

type TokenTransfer struct {
	Type     string `json:"type"`
	From     string `json:"from"`
	To       string `json:"to"`
	Token    string `json:"token"`
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals int    `json:"decimals"`
	Value    string `json:"value"`
}

type Tokens

type Tokens struct {
	Balance       string `json:"balance"`
	Decimals      int    `json:"decimals"`
	Name          string `json:"name"`
	Path          string `json:"path"`
	TotalReceived string `json:"totalReceived"`
	TotalSent     string `json:"totalSent"`
	Transfers     int    `json:"transfers"`
	Type          string `json:"type"`
}

type Tx

type Tx struct {
	BlockHash      string          `json:"blockHash"`
	BlockHeight    int             `json:"blockHeight"`
	BlockTime      int             `json:"blockTime"`
	Confirmations  int             `json:"confirmations"`
	Fees           string          `json:"fees"`
	Hex            string          `json:"hex"`
	LockTime       int             `json:"lockTime"`
	Txid           string          `json:"txid"`
	Value          string          `json:"value"`
	ValueIn        string          `json:"valueIn"`
	Version        int             `json:"version"`
	Vin            []TxVin         `json:"vin"`
	Vout           []TxVout        `json:"vout"`
	TokenTransfers []TokenTransfer `json:"tokenTransfers"`
}

type TxListResponse

type TxListResponse struct {
	PageNumber int      `json:"pageNumber"`
	PageSize   int      `json:"pageSize"`
	TotalCount int      `json:"totalCount"`
	List       []NulsTx `json:"list"`
}

type TxVin

type TxVin struct {
	Addresses []string `json:"addresses"`
	Hex       string   `json:"hex"`
	N         int      `json:"n"`
	Sequence  int      `json:"sequence"`
	Txid      string   `json:"txid"`
	Value     string   `json:"value"`
	Vout      int      `json:"vout"`
}

type TxVout

type TxVout struct {
	Addresses []string `json:"addresses"`
	Hex       string   `json:"hex"`
	N         int      `json:"n"`
	Spent     bool     `json:"spent"`
	Value     string   `json:"value"`
}

type Utxo

type Utxo struct {
	Address       string `json:"address"`
	Confirmations int    `json:"confirmations"`
	Height        int    `json:"height"`
	Path          string `json:"path"`
	Txid          string `json:"txid"`
	Value         string `json:"value"`
	Vout          int    `json:"vout"`
}

type Xpub

type Xpub struct {
	Address            string   `json:"address"`
	Balance            string   `json:"balance"`
	ItemsOnPage        int      `json:"itemsOnPage"`
	Page               int      `json:"page"`
	Tokens             []Tokens `json:"tokens"`
	TotalPages         int      `json:"totalPages"`
	TotalReceived      string   `json:"totalReceived"`
	TotalSent          string   `json:"totalSent"`
	Transactions       []Tx     `json:"transactions"`
	Txs                int      `json:"txs"`
	UnconfirmedBalance string   `json:"unconfirmedBalance"`
	UnconfirmedTxs     int      `json:"unconfirmedTxs"`
	UsedTokens         int      `json:"usedTokens"`
}

Jump to

Keyboard shortcuts

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