wallet

package
v0.2.97 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AlreadyExistsError = errors.New("wallet already exists")
	AlreadyLoadedError = errors.New("wallet is already loaded")
)
View Source
var (
	NotEnoughBalanceError = errors.New("Not enough balance on utxos")
)

Functions

This section is empty.

Types

type ElementsRpcWallet

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

ElementsRpcWallet uses the elementsd rpc wallet

func NewRpcWallet

func NewRpcWallet(rpcClient *gelements.Elements, walletName string) (*ElementsRpcWallet, error)

func (*ElementsRpcWallet) CreateFundedTransaction

func (r *ElementsRpcWallet) CreateFundedTransaction(preparedTx *transaction.Transaction) (rawTx string, fee uint64, err error)

CreateFundedTransaction takes a tx with outputs and adds inputs in order to spend the tx

func (*ElementsRpcWallet) FinalizeFundedTransaction

func (r *ElementsRpcWallet) FinalizeFundedTransaction(rawTx string) (txId string, err error)

FinalizeAndBroadcastFundedTransaction finalizes a tx and broadcasts it

func (*ElementsRpcWallet) FinalizeTransaction

func (r *ElementsRpcWallet) FinalizeTransaction(rawTx string) (string, error)

FinalizeTransaction takes a rawtx, blinds it and signs it

func (*ElementsRpcWallet) GetAddress

func (r *ElementsRpcWallet) GetAddress() (string, error)

GetAddress returns a new blech32 address

func (*ElementsRpcWallet) GetBalance

func (r *ElementsRpcWallet) GetBalance() (uint64, error)

GetBalance returns the balance in sats

func (*ElementsRpcWallet) SendToAddress

func (r *ElementsRpcWallet) SendToAddress(address string, amount uint64) (string, error)

SendToAddress sends an amount to an address

type RpcClient

type RpcClient interface {
	GetNewAddress(addrType int) (string, error)
	SendToAddress(address string, amount string) (string, error)
	GetBalance() (uint64, error)
	LoadWallet(filename string, loadonstartup bool) (string, error)
	CreateWallet(walletname string) (string, error)
	SetRpcWallet(walletname string)
	ListWallets() ([]string, error)
	FundRawTx(txHex string) (*gelements.FundRawResult, error)
	BlindRawTransaction(txHex string) (string, error)
	SignRawTransactionWithWallet(txHex string) (gelements.SignRawTransactionWithWalletRes, error)
	SendRawTx(txHex string) (string, error)
}

type Wallet

type Wallet interface {
	GetAddress() (string, error)
	SendToAddress(string, uint64) (string, error)
	GetBalance() (uint64, error)
	CreateFundedTransaction(preparedTx *transaction.Transaction) (rawTx string, fee uint64, err error)
	FinalizeFundedTransaction(unpreparedTx string) (preparedTxHex string, err error)
}

Jump to

Keyboard shortcuts

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