electrs

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package electrs get or post RPC queries to electrs server.

Index

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

func GetLatestBlockNumberOf(apiAddress string) (uint64, error)

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

func FindUtxos

func FindUtxos(b tokens.CrossChainBridge, addr string) (result []*ElectUtxo, err error)

FindUtxos call /address/{add}/utxo (confirmed first, then big value first)

func (*ElectUtxo) String

func (utxo *ElectUtxo) String() string

type SortableElectUtxoSlice

type SortableElectUtxoSlice []*ElectUtxo

SortableElectUtxoSlice sortable

func (SortableElectUtxoSlice) Len

func (s SortableElectUtxoSlice) Len() int

Len impl 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

Jump to

Keyboard shortcuts

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