Documentation
¶
Index ¶
- func DefaultPort(u *url.URL) int
- func HasImpliedURLSecurity(u *url.URL) bool
- func ToFloat(i interface{}) (float64, error)
- type APIClient
- type AddressTxid
- type Block
- type BlockList
- type Info
- type Input
- type OutScript
- type Output
- type Pagination
- type PoolInfo
- type RawTxResponse
- type Script
- type SocketClient
- type Status
- type Transaction
- type TransactionList
- type Utxo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPort ¶
DefaultPort returns the default port for the given connection scheme unless otherwise indicated in the url.URL provided
func HasImpliedURLSecurity ¶
HasImpliedURLSecurity returns true if the scheme is https
Types ¶
type APIClient ¶
type APIClient interface {
// Start up the API service
Start() error
// Get info about the server
GetInfo() (*Info, error)
// For a given txid get back the transaction metadata
GetTransaction(txid string) (*Transaction, error)
// For a given txid get back the full transaction bytes
GetRawTransaction(txid string) ([]byte, error)
// Get back all the transactions for the given list of addresses
GetTransactions(addrs []btcutil.Address) ([]Transaction, error)
// Get back all spendable UTXOs for the given list of addresses
GetUtxos(addrs []btcutil.Address) ([]Utxo, error)
// Returns a chan which fires on each new block
BlockNotify() <-chan Block
// Returns a chan which fires whenever a new transaction is received or
// when an existing transaction confirms for all addresses the API is listening on.
TransactionNotify() <-chan Transaction
// Listen for events on these addresses. Results are returned to TransactionNotify()
ListenAddresses(addrs ...btcutil.Address)
// Broadcast a transaction to the network
Broadcast(tx []byte) (string, error)
// Get info on the current chain tip
GetBestBlock() (*Block, error)
// Estimate the fee required for a transaction
EstimateFee(nBlocks int) (int, error)
// Close all connections and shutdown
Close()
}
type AddressTxid ¶
type Block ¶
type Block struct {
Hash string `json:"hash"`
Size int `json:"size"`
Height int `json:"height"`
Version int `json:"version"`
MerkleRoot string `json:"merkleroot"`
Tx []string `json:"tx"`
Time int64 `json:"time"`
Nonce string `json:"nonce"`
Solution string `json:"solution"`
Bits string `json:"bits"`
Difficulty float64 `json:"difficulty"`
Chainwork string `json:"chainwork"`
Confirmations int `json:"confirmations"`
PreviousBlockhash string `json:"previousblockhash"`
NextBlockhash string `json:"nextblockhash"`
Reward float64 `json:"reward"`
IsMainChain bool `json:"isMainChain"`
PoolInfo *PoolInfo `json:"poolinfo"`
}
type BlockList ¶
type BlockList struct {
Blocks []Block `json:"blocks"`
Length int `json:"length"`
Pagination Pagination `json:"pagination"`
}
type Info ¶
type Info struct {
Version int `json:"version"`
ProtocolVersion int `json:"protocolversion"`
Blocks int `json:"blocks"`
TimeOffset int `json:"timeoffset"`
Connections int `json:"connections"`
DifficultyIface interface{} `json:"difficulty"`
Difficulty float64 `json:"-"`
Testnet bool `json:"testnet"`
RelayFeeIface interface{} `json:"relayfee"`
RelayFee float64 `json:"-"`
Errors string `json:"errors"`
Network string `json:"network"`
}
type Input ¶
type Input struct {
Txid string `json:"txid"`
Vout int `json:"vout"`
Sequence uint32 `json:"sequence"`
N int `json:"n"`
ScriptSig Script `json:"scriptSig"`
Addr string `json:"addr"`
Satoshis int64 `json:"valueSat"`
ValueIface interface{} `json:"value"`
Value float64
DoubleSpentTxid string `json:"doubleSpentTxID"`
}
type Pagination ¶
type RawTxResponse ¶
type RawTxResponse struct {
RawTx string `json:"rawtx"`
}
type SocketClient ¶
type Transaction ¶
type Transaction struct {
Txid string `json:"txid"`
Version int `json:"version"`
Locktime int `json:"locktime"`
Inputs []Input `json:"vin"`
Outputs []Output `json:"vout"`
BlockHash string `json:"blockhash"`
BlockHeight int `json:"blockheight"`
Confirmations int `json:"confirmations"`
Time int64 `json:"time"`
BlockTime int64 `json:"blocktime"`
RawBytes []byte `json:"rawbytes"`
}
type TransactionList ¶
type TransactionList struct {
TotalItems int `json:"totalItems"`
From int `json:"from"`
To int `json:"to"`
Items []Transaction `json:"items"`
}
Click to show internal directories.
Click to hide internal directories.