general

package
v0.0.0-...-1c070b6 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressInfo

type AddressInfo struct {
	Address       string `json:"address"`
	MempoolStatus `json:"mempool_stats"`
	ChainStats    `json:"chain_stats"`
}

type BlockHeader

type BlockHeader struct {
	ID                string  `json:"id"`
	Height            uint64  `json:"height"`
	Version           int     `json:"version"`
	Timestamp         int64   `json:"timestamp"`
	Bits              int     `json:"bits"`
	Nonce             int64   `json:"nonce"`
	Difficulty        float64 `json:"difficulty"`
	MerkleRoot        string  `json:"merkle_root"`
	TxCount           uint64  `json:"tx_count"`
	Size              int     `json:"size"`
	Weight            int     `json:"weight"`
	PreviousBlockHash string  `json:"previousblockhash"`
	Mediantime        int64   `json:"mediantime"`
}

type BlockStatus

type BlockStatus struct {
	InBestChain bool   `json:"in_best_chain"`
	Height      uint64 `json:"height"`
	NextBest    string `json:"next_best"`
}

type ChainStats

type ChainStats struct {
	FundedTxoCount int64 `json:"funded_txo_count"`
	FundedTxoSum   int64 `json:"funded_txo_sum"`
	SpentTxoCount  int64 `json:"spent_txo_count"`
	SpentTxoSum    int64 `json:"spent_txo_sum"`
	TxCount        int64 `json:"tx_count"`
}

type Client

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

Client struct represents the client to interact with the API

func NewClient

func NewClient(url string) *Client

func (*Client) SendPostRequest

func (c *Client) SendPostRequest(endpoint string, headers map[string]string, body interface{}, result interface{}) error

SendPostRequest sends an HTTP POST request and parses the response

func (*Client) SendRequest

func (c *Client) SendRequest(endpoint string, headers map[string]string, result interface{}) error

SendRequest sends an HTTP request and parses the response

func (*Client) SendRequestForBinary

func (c *Client) SendRequestForBinary(endpoint string, headers map[string]string) ([]byte, error)

SendRequestForBinary sends an HTTP request and returns the binary response

type FeeHistogram

type FeeHistogram struct {
	Feerate float64
	Vsize   float64
}

FeeHistogram represents a fee rate and corresponding virtual size

func (*FeeHistogram) UnmarshalJSON

func (fh *FeeHistogram) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarshals a FeeHistogram from a JSON array

type MempoolInfo

type MempoolInfo struct {
	Count        int            `json:"count"`
	Vsize        int            `json:"vsize"`
	TotalFee     int            `json:"total_fee"`
	FeeHistogram []FeeHistogram `json:"fee_histogram"`
}

type MempoolStatus

type MempoolStatus struct {
	FundedTxoCount int64 `json:"funded_txo_count"`
	FundedTxoSum   int64 `json:"funded_txo_sum"`
	SpentTxoCount  int64 `json:"spent_txo_count"`
	SpentTxoSum    int64 `json:"spent_txo_sum"`
	TxCount        int64 `json:"tx_count"`
}

type MerkleProof

type MerkleProof struct {
	BlockHeight int      `json:"block_height"`
	Merkle      []string `json:"merkle"`
	Pos         int      `json:"pos"`
}

type ScripthashInfo

type ScripthashInfo struct {
	MempoolStatus `json:"mempool_stats"`
	ChainStats    `json:"chain_stats"`
	Scripthash    string `json:"scripthash"`
}

type Status

type Status struct {
	Confirmed   bool   `json:"confirmed"`
	BlockHeight int    `json:"block_height"`
	BlockHash   string `json:"block_hash"`
	BlockTime   int64  `json:"block_time"`
}

Status 表示tx或者utxo的状态

type Transaction

type Transaction struct {
	Txid     string `json:"txid"`
	Version  uint64 `json:"version"`
	Locktime uint64 `json:"locktime"`
	Size     uint64 `json:"size"`
	Weight   uint64 `json:"weight"`
	Fee      uint64 `json:"fee"`
	Vin      []Vin  `json:"vin"`
	Vout     []Vout `json:"vout"`
	Status   Status `json:"status"`
}

type Utxo

type Utxo struct {
	TxID   string `json:"txid"`
	Vout   int    `json:"vout"`
	Value  uint64 `json:"value"`
	Status `json:"status"`
}

type Vin

type Vin struct {
	TxID                  string   `json:"txid"`
	Vout                  int      `json:"vout"`
	IsCoinbase            bool     `json:"is_coinbase"`
	ScriptSig             string   `json:"scriptsig,omitempty"`
	ScriptSigAsm          string   `json:"scriptsig_asm,omitempty"`
	InnerRedeemScriptAsm  string   `json:"inner_redeemscript_asm,omitempty"`
	InnerWitnessScriptAsm string   `json:"inner_witnessscript_asm,omitempty"`
	Sequence              int      `json:"sequence"`
	Witness               []string `json:"witness"`
	Prevout               *Vout    `json:"prevout"`
}

type Vout

type Vout struct {
	Scriptpubkey        string `json:"scriptpubkey,omitempty"`
	ScriptpubkeyAsm     string `json:"scriptpubkey_asm,omitempty"`
	ScriptpubkeyType    string `json:"scriptpubkey_type,omitempty"`
	ScriptpubkeyAddress string `json:"scriptpubkey_address,omitempty"`
	Value               uint64 `json:"value"`
}

Jump to

Keyboard shortcuts

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