Documentation ¶
Index ¶
- Constants
- func InitMetrics()
- func Plugin(ctx context.Context) *plugin.Plugin
- func ShouldRetryBlockchainError(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData, err error) bool
- type ApiWrapper
- type BlockchainClient
- type PaginatedWrapper
- type RateLimitError
- type TransactionInfo
- type WalletInfo
Constants ¶
View Source
const API_BASE_URL = "https://chain.api.btc.com/v3"
Variables ¶
This section is empty.
Functions ¶
func InitMetrics ¶
func InitMetrics()
Types ¶
type ApiWrapper ¶
type BlockchainClient ¶
type BlockchainClient struct {
// contains filtered or unexported fields
}
func (BlockchainClient) GetTransaction ¶
func (c BlockchainClient) GetTransaction(hash string) (TransactionInfo, error)
Returns data about a single transaction, identified by its hash
func (BlockchainClient) GetTransactionsForWallet ¶
func (c BlockchainClient) GetTransactionsForWallet(address string, page int) ([]TransactionInfo, error)
Returns a page of results for transactions that involve a certain wallet, identified by its Base58 address
func (BlockchainClient) GetWalletInfo ¶
func (c BlockchainClient) GetWalletInfo(address string) (WalletInfo, error)
Returns information about a single wallet, identified by its Base58 address
type PaginatedWrapper ¶
type RateLimitError ¶
type RateLimitError struct {
// contains filtered or unexported fields
}
func (RateLimitError) Error ¶
func (e RateLimitError) Error() string
type TransactionInfo ¶
type TransactionInfo struct { Hash string `json:"hash"` Fee int `json:"fee"` RelayedBy string `json:"-"` // This does not work :( OriginalTime int `json:"block_time"` Time time.Time `json:"-"` // This will be filled manually from .OriginalTime InputsCount int `json:"inputs_count"` InputsValue int `json:"inputs_value"` OutputsCount int `json:"outputs_count"` OutputsValue int `json:"outputs_value"` Balance int `json:"balance_diff"` Inputs []map[string]any `json:"inputs"` Outputs []map[string]any `json:"outputs"` }
func (*TransactionInfo) FillTime ¶
func (ti *TransactionInfo) FillTime()
Fills the .Time field by interpreting the .OriginalTime field as the number of seconds since the Unix epoch
func (TransactionInfo) String ¶
func (i TransactionInfo) String() string
type WalletInfo ¶
type WalletInfo struct { Hash160 string `json:"-"` // This will be manually extracted from .Address Address string `json:"address"` NumberTransactions int `json:"tx_count"` NumberUnredeemed int `json:"unspent_tx_count"` TotalReceived int `json:"received"` TotalSent int `json:"sent"` FinalBalance int `json:"balance"` }
func (*WalletInfo) FillHash160 ¶
func (wi *WalletInfo) FillHash160()
Fills the .Hash160 field from the .Address field, by reversing the Base58Check encoding used See the process in "Creating a Base58Check string" here: https://en.bitcoin.it/wiki/Base58Check_encoding
func (WalletInfo) String ¶
func (i WalletInfo) String() string
Click to show internal directories.
Click to hide internal directories.