IBitcoinWallet
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:55
Interface to be implemented by Bitcoin wallets
Methods
fundPsbt()
fundPsbt(
psbt,
feeRate?,
utxos?,
spendFully?): Promise<Transaction>;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:76
Funds (populates the inputs) for a given PSBT from wallet's UTXO set
Parameters
| Parameter | Type | Description |
|---|---|---|
psbt | Transaction | PSBT to add the inputs to |
feeRate? | number | Optional fee rate in sats/vB to use for the transaction |
utxos? | BitcoinWalletUtxo[] | Pre-fetched list of UTXOs to spend from |
spendFully? | boolean | Instructs the wallet to spend all the passed UTXOs in the transaction without creating any change output, if the feeRate is passed, it will also enforce that the feeRate in sats/vB for the resulting transaction is not more than 50% and 10 sats/vB larger (considering also the CPFP adjustments) |
Returns
Promise<Transaction>
getBalance()
getBalance(): Promise<{
confirmedBalance: bigint;
unconfirmedBalance: bigint;
}>;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:116
Returns confirmed and unconfirmed balance in satoshis of the wallet
Returns
Promise<{
confirmedBalance: bigint;
unconfirmedBalance: bigint;
}>
getFeeRate()
getFeeRate(): Promise<number>;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:89
Returns the current fee rate in sats/vB
Returns
Promise<number>
getFundedPsbtFee()
getFundedPsbtFee(psbt, feeRate?): Promise<number>;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:106
Estimates a total fee in satoshis for a given transaction as identified by the PSBT
Parameters
| Parameter | Type | Description |
|---|---|---|
psbt | Transaction | A PSBT to which additional inputs from wallet's UTXO set will be added and fee estimated |
feeRate? | number | Optional fee rate in sats/vB to use for the transaction |
Returns
Promise<number>
getReceiveAddress()
getReceiveAddress(): string;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:111
Returns the bitcoin address suitable for receiving funds
Returns
string
getSpendableBalance()
getSpendableBalance(
psbt?,
feeRate?,
outputAddressType?,
utxos?): Promise<{
balance: bigint;
feeRate: number;
totalFee: number;
}>;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:129
Returns the maximum spendable balance in satoshis given a specific PSBT that should be funded
Parameters
| Parameter | Type | Description |
|---|---|---|
psbt? | Transaction | A PSBT to which additional inputs from wallet's UTXO set will be added and fee estimated |
feeRate? | number | Optional fee rate in sats/vB to use for the transaction |
outputAddressType? | CoinselectAddressTypes | Expected output address type, if known |
utxos? | BitcoinWalletUtxoBase[] | Optional pre-fetched UTXOs |
Returns
Promise<{
balance: bigint;
feeRate: number;
totalFee: number;
}>
getTransactionFee()
getTransactionFee(
address,
amount,
feeRate?): Promise<number>;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:98
Estimates a total fee in satoshis for a given transaction
Parameters
| Parameter | Type | Description |
|---|---|---|
address | string | Destination address of the transaction |
amount | bigint | Amount of satoshis to send (1 BTC = 100,000,000 sats) |
feeRate? | number | Optional fee rate in sats/vB to use for the transaction |
Returns
Promise<number>
getUtxoPool()?
optional getUtxoPool(): Promise<BitcoinWalletUtxo[]>;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:138
Returns a list of available UTXOs for the wallet
Returns
Promise<BitcoinWalletUtxo[]>
sendTransaction()
sendTransaction(
address,
amount,
feeRate?): Promise<string>;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:64
Signs and broadcasts a transaction sending amount of sats to address, optionally with the
feeRate sats/vB fee rate.
Parameters
| Parameter | Type | Description |
|---|---|---|
address | string | Destination address of the transaction |
amount | bigint | Amount of satoshis to send (1 BTC = 100,000,000 sats) |
feeRate? | number | Optional fee rate in sats/vB to use for the transaction |
Returns
Promise<string>
signPsbt()
signPsbt(psbt, signInputs): Promise<Transaction>;
Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:84
Signs inputs in the provided PSBT
Parameters
| Parameter | Type | Description |
|---|---|---|
psbt | Transaction | A PSBT to sign |
signInputs | number[] | Indices of the inputs to sign |
Returns
Promise<Transaction>