btcsuite

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package btcsuite provides implementations of the privatebtc.RPCClientFactory and privatebtc.RPCClient interfaces using the https://github.com/ory/dockertest package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCClient

type RPCClient struct {
	// contains filtered or unexported fields
}

RPCClient is an RPC client for a BTC node.

func (RPCClient) AddPeer

func (c RPCClient) AddPeer(_ context.Context, peer privatebtc.Node) error

AddPeer adds a peer to the node.

func (RPCClient) CreateWallet

func (c RPCClient) CreateWallet(_ context.Context, walletName string) error

CreateWallet creates a wallet with the given name.

func (RPCClient) GenerateToAddress

func (c RPCClient) GenerateToAddress(
	_ context.Context,
	numBlocks int64,
	address string,
) ([]string, error)

GenerateToAddress generates numBlocks blocks and sends the coinbase to the given address.

func (RPCClient) GetBalance

func (c RPCClient) GetBalance(context.Context) (privatebtc.Balance, error)

GetBalance returns the balance of the wallet.

func (RPCClient) GetBestBlockHash

func (c RPCClient) GetBestBlockHash(context.Context) (string, error)

GetBestBlockHash returns the hash of the best (tip) block in the longest block chain.

func (RPCClient) GetBlockCount

func (c RPCClient) GetBlockCount(context.Context) (int, error)

GetBlockCount returns the current block count.

func (RPCClient) GetCoinbaseValue

func (c RPCClient) GetCoinbaseValue(context.Context) (int64, error)

GetCoinbaseValue returns the coinbase for the next block.

func (RPCClient) GetConnectionCount

func (c RPCClient) GetConnectionCount(context.Context) (int, error)

GetConnectionCount returns the number of connections to other nodes.

func (RPCClient) GetNewAddress

func (c RPCClient) GetNewAddress(_ context.Context, label string) (string, error)

GetNewAddress generates a new BTC address.

func (RPCClient) GetPendingBalance

func (c RPCClient) GetPendingBalance() (float64, error)

GetPendingBalance returns the pending balance of the wallet.

func (RPCClient) GetRawMempool

func (c RPCClient) GetRawMempool(context.Context) ([]string, error)

GetRawMempool returns the hashes of all transactions in the mempool.

func (RPCClient) GetTransaction

func (c RPCClient) GetTransaction(
	_ context.Context,
	txHash string,
) (*privatebtc.Transaction, error)

GetTransaction returns a transaction by its hash.

func (RPCClient) ListAddresses

func (c RPCClient) ListAddresses(context.Context) ([]string, error)

ListAddresses returns all addresses in the wallet.

func (RPCClient) RemovePeer

func (c RPCClient) RemovePeer(ctx context.Context, peer privatebtc.Node) error

RemovePeer removes a peer from the node.

func (RPCClient) SendCustomTransaction

func (c RPCClient) SendCustomTransaction(
	_ context.Context,
	inputs []privatebtc.TransactionVin,
	amounts map[string]float64,
) (string, error)

SendCustomTransaction sends a custom transaction with the given inputs and amounts.

func (RPCClient) SendToAddress

func (c RPCClient) SendToAddress(
	_ context.Context,
	address string,
	amount float64,
) (string, error)

SendToAddress sends the given amount to the given address.

type RPCClientFactory

type RPCClientFactory struct {
	NoPing bool
}

RPCClientFactory is a factory for RPC clients.

func (RPCClientFactory) NewRPCClient

func (f RPCClientFactory) NewRPCClient(hostPort,
	rpcUser,
	rpcPass string,
) (privatebtc.RPCClient, error)

NewRPCClient creates a new RPC client.

type WalletWarningError

type WalletWarningError string

WalletWarningError is an error returned by the RPC client when a wallet warning is encountered.

func (WalletWarningError) Error

func (e WalletWarningError) Error() string

Jump to

Keyboard shortcuts

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