native

package
v0.0.0-...-15c384e Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0, MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// default timeout for client
	DefaultClientTimeout = time.Minute
	// default retry period for failed connections
	DefaultClientTimeoutRetry = 10 * time.Second
	// default host to connect to rpc node
	DefaultClientHost = "http://0.0.0.0:18443"
	// default user for rpc connection
	DefaultClientUser = "user"
	// default password for rpc connection
	DefaultClientPassword = "password"
	// default auth header for rpc connection
	DefaultClientAuthHeader = ""
)

Functions

This section is empty.

Types

type ClientOptions

type ClientOptions struct {
	Timeout         time.Duration
	TimeoutRetry    time.Duration
	Host            string
	User            string
	Password        string
	AuthHeader      string
	AuthHeaderValue string
	Chaincfg        *chaincfg.Params
}

ClientOptions are used to parameterise the behaviour of the Client.

func DefaultClientOptions

func DefaultClientOptions() ClientOptions

type NativeClient

type NativeClient struct {
	Asset xc.ITask
	// contains filtered or unexported fields
}

Client for Bitcoin

func NewNativeClient

func NewNativeClient(cfgI xc.ITask) (*NativeClient, error)

NewClient returns a new Bitcoin Client

func (*NativeClient) EstimateFeeLegacy

func (client *NativeClient) EstimateFeeLegacy(ctx context.Context, numBlocks int64) (float64, error)

Older version of estimating fee for some forks of BTC (e.g. BCH).

func (*NativeClient) EstimateGas

func (client *NativeClient) EstimateGas(ctx context.Context) (xc.AmountBlockchain, error)

func (*NativeClient) EstimateSmartFee

func (client *NativeClient) EstimateSmartFee(ctx context.Context, numBlocks int64) (float64, error)

Latest way to estimate fees on BTC

func (*NativeClient) FetchBalance

func (client *NativeClient) FetchBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

func (*NativeClient) FetchDecimals

func (client *NativeClient) FetchDecimals(ctx context.Context, contract xc.ContractAddress) (int, error)

func (*NativeClient) FetchLegacyTxInfo

func (client *NativeClient) FetchLegacyTxInfo(ctx context.Context, txHash xc.TxHash) (xc.LegacyTxInfo, error)

FetchLegacyTxInfo returns tx info for a Bitcoin tx

func (*NativeClient) FetchLegacyTxInput

func (client *NativeClient) FetchLegacyTxInput(ctx context.Context, from xc.Address, to xc.Address) (xc.TxInput, error)

func (*NativeClient) FetchNativeBalance

func (client *NativeClient) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

func (*NativeClient) FetchTransferInput

func (client *NativeClient) FetchTransferInput(ctx context.Context, args xcbuilder.TransferArgs) (xc.TxInput, error)

FetchTransferInput returns tx input for a Bitcoin tx

func (*NativeClient) FetchTxInfo

func (client *NativeClient) FetchTxInfo(ctx context.Context, txHashStr xc.TxHash) (xclient.TxInfo, error)

func (*NativeClient) GetWalletInfo

func (client *NativeClient) GetWalletInfo(ctx context.Context) (float64, error)

func (*NativeClient) LatestBlock

func (client *NativeClient) LatestBlock(ctx context.Context) (uint64, error)

LatestBlock returns the height of the longest blockchain.

func (*NativeClient) Output

func (client *NativeClient) Output(ctx context.Context, outpoint tx_input.Outpoint) (tx_input.Output, uint64, error)

Output associated with an outpoint, and its number of confirmations.

func (*NativeClient) SubmitTx

func (client *NativeClient) SubmitTx(ctx context.Context, txInput xc.Tx) error

SubmitTx submits a Bitcoin tx

func (*NativeClient) UnspentOutputs

func (client *NativeClient) UnspentOutputs(ctx context.Context, minConf, maxConf int64, addr xc.Address) ([]tx_input.Output, error)

UnspentOutputs spendable by the given address.

func (*NativeClient) WithAddressDecoder

func (txBuilder *NativeClient) WithAddressDecoder(decoder address.AddressDecoder) address.WithAddressDecoder

Jump to

Keyboard shortcuts

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