Documentation ¶
Overview ¶
Package electrs get or post RPC queries to electrs server.
Index ¶
- func EstimateFeePerKb(b tokens.CrossChainBridge, blocks int) (fee int64, err error)
- func GetBlockHash(b tokens.CrossChainBridge, height uint64) (blockHash string, err error)
- func GetBlockTxids(b tokens.CrossChainBridge, blockHash string) (result []string, err error)
- func GetLatestBlockNumber(b tokens.CrossChainBridge) (result uint64, err error)
- func GetLatestBlockNumberOf(apiAddress string) (uint64, error)
- func GetPoolTxidList(b tokens.CrossChainBridge) (result []string, err error)
- func PostTransaction(b tokens.CrossChainBridge, txHex string) (txHash string, err error)
- type ElectBlock
- type ElectOutspend
- type ElectTx
- func GetBlockTransactions(b tokens.CrossChainBridge, blockHash string, startIndex uint32) (result []*ElectTx, err error)
- func GetPoolTransactions(b tokens.CrossChainBridge, addr string) (result []*ElectTx, err error)
- func GetTransactionByHash(b tokens.CrossChainBridge, txHash string) (*ElectTx, error)
- func GetTransactionHistory(b tokens.CrossChainBridge, addr, lastSeenTxid string) (result []*ElectTx, err error)
- type ElectTxOut
- type ElectTxStatus
- type ElectTxin
- type ElectUtxo
- type SortableElectUtxoSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateFeePerKb ¶ added in v0.3.0
func EstimateFeePerKb(b tokens.CrossChainBridge, blocks int) (fee int64, err error)
EstimateFeePerKb call /fee-estimates and multiply 1000
func GetBlockHash ¶
func GetBlockHash(b tokens.CrossChainBridge, height uint64) (blockHash string, err error)
GetBlockHash call /block-height/{height}
func GetBlockTxids ¶
func GetBlockTxids(b tokens.CrossChainBridge, blockHash string) (result []string, err error)
GetBlockTxids call /block/{blockHash}/txids
func GetLatestBlockNumber ¶
func GetLatestBlockNumber(b tokens.CrossChainBridge) (result uint64, err error)
GetLatestBlockNumber call /blocks/tip/height
func GetLatestBlockNumberOf ¶
GetLatestBlockNumberOf call /blocks/tip/height
func GetPoolTxidList ¶
func GetPoolTxidList(b tokens.CrossChainBridge) (result []string, err error)
GetPoolTxidList call /mempool/txids
func PostTransaction ¶
func PostTransaction(b tokens.CrossChainBridge, txHex string) (txHash string, err error)
PostTransaction call post to /tx
Types ¶
type ElectBlock ¶
type ElectBlock struct { Hash *string `json:"id"` Height *uint32 `json:"height"` Version *uint32 `json:"version"` Timestamp *uint32 `json:"timestamp"` TxCount *uint32 `json:"tx_count"` Size *uint32 `json:"size"` Weight *uint32 `json:"weight"` MerkleRoot *string `json:"merkle_root"` PreviousHash *string `json:"previousblockhash"` Nonce *uint32 `json:"nonce"` Bits *uint32 `json:"bits"` Difficulty *uint64 `json:"difficulty"` }
ElectBlock struct
func GetBlock ¶
func GetBlock(b tokens.CrossChainBridge, blockHash string) (*ElectBlock, error)
GetBlock call /block/{blockHash}
type ElectOutspend ¶
type ElectOutspend struct { Spent *bool `json:"spent"` Txid *string `json:"txid"` Vin *uint32 `json:"vin"` Status *ElectTxStatus `json:"status,omitempty"` }
ElectOutspend struct
func GetOutspend ¶
func GetOutspend(b tokens.CrossChainBridge, txHash string, vout uint32) (*ElectOutspend, error)
GetOutspend call /tx/{txHash}/outspend/{vout}
func (*ElectOutspend) String ¶ added in v0.3.9
func (outspend *ElectOutspend) String() string
type ElectTx ¶
type ElectTx struct { Txid *string `json:"txid"` Version *uint32 `json:"version"` Locktime *uint32 `json:"locktime"` Size *uint32 `json:"size"` Weight *uint32 `json:"weight"` Fee *uint64 `json:"fee"` Vin []*ElectTxin `json:"vin"` Vout []*ElectTxOut `json:"vout"` Status *ElectTxStatus `json:"status,omitempty"` }
ElectTx struct
func GetBlockTransactions ¶
func GetBlockTransactions(b tokens.CrossChainBridge, blockHash string, startIndex uint32) (result []*ElectTx, err error)
GetBlockTransactions call /block/{blockHash}/txs[/:start_index] (should start_index%25 == 0)
func GetPoolTransactions ¶
func GetPoolTransactions(b tokens.CrossChainBridge, addr string) (result []*ElectTx, err error)
GetPoolTransactions call /address/{addr}/txs/mempool
func GetTransactionByHash ¶
func GetTransactionByHash(b tokens.CrossChainBridge, txHash string) (*ElectTx, error)
GetTransactionByHash call /tx/{txHash}
func GetTransactionHistory ¶
func GetTransactionHistory(b tokens.CrossChainBridge, addr, lastSeenTxid string) (result []*ElectTx, err error)
GetTransactionHistory call /address/{addr}/txs/chain
type ElectTxOut ¶
type ElectTxOut struct { Scriptpubkey *string `json:"scriptpubkey"` ScriptpubkeyAsm *string `json:"scriptpubkey_asm"` ScriptpubkeyType *string `json:"scriptpubkey_type"` ScriptpubkeyAddress *string `json:"scriptpubkey_address"` Value *uint64 `json:"value"` }
ElectTxOut struct
type ElectTxStatus ¶
type ElectTxStatus struct { Confirmed *bool `json:"confirmed"` BlockHeight *uint64 `json:"block_height"` BlockHash *string `json:"block_hash"` BlockTime *uint64 `json:"block_time"` }
ElectTxStatus struct
func GetElectTransactionStatus ¶
func GetElectTransactionStatus(b tokens.CrossChainBridge, txHash string) (*ElectTxStatus, error)
GetElectTransactionStatus call /tx/{txHash}/status
func (*ElectTxStatus) String ¶ added in v0.3.9
func (status *ElectTxStatus) String() string
type ElectTxin ¶
type ElectTxin struct { Txid *string `json:"txid"` Vout *uint32 `json:"vout"` Scriptsig *string `json:"scriptsig"` ScriptsigAsm *string `json:"scriptsig_asm"` IsCoinbase *bool `json:"is_coinbase"` Sequence *uint32 `json:"sequence"` InnerRedeemscriptAsm *string `json:"inner_redeemscript_asm"` Prevout *ElectTxOut `json:"prevout"` }
ElectTxin struct
type ElectUtxo ¶
type ElectUtxo struct { Txid *string `json:"txid"` Vout *uint32 `json:"vout"` Value *uint64 `json:"value"` Status *ElectTxStatus `json:"status"` }
ElectUtxo struct
type SortableElectUtxoSlice ¶
type SortableElectUtxoSlice []*ElectUtxo
SortableElectUtxoSlice sortable
func (SortableElectUtxoSlice) Less ¶
func (s SortableElectUtxoSlice) Less(i, j int) bool
Less impl Sortable sort utxos 1. confirmed fisrt 2. value first
func (SortableElectUtxoSlice) Swap ¶
func (s SortableElectUtxoSlice) Swap(i, j int)
Swap impl Sortable