Skip to main content

IBitcoinWallet

Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:26

Interface to be implemented by Bitcoin wallets

Methods

fundPsbt()

fundPsbt(psbt, feeRate?): Promise<Transaction>;

Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:43

Funds (populates the inputs) for a given PSBT from wallet's UTXO set

Parameters

ParameterTypeDescription
psbtTransactionPSBT to add the inputs to
feeRate?numberOptional fee rate in sats/vB to use for the transaction

Returns

Promise<Transaction>


getBalance()

getBalance(): Promise<{
confirmedBalance: bigint;
unconfirmedBalance: bigint;
}>;

Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:83

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:56

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:73

Estimates a total fee in satoshis for a given transaction as identified by the PSBT

Parameters

ParameterTypeDescription
psbtTransactionA PSBT to which additional inputs from wallet's UTXO set will be added and fee estimated
feeRate?numberOptional 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:78

Returns the bitcoin address suitable for receiving funds

Returns

string


getSpendableBalance()

getSpendableBalance(psbt?, feeRate?): Promise<{
balance: bigint;
feeRate: number;
totalFee: number;
}>;

Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:94

Returns the maximum spendable balance in satoshis given a specific PSBT that should be funded

Parameters

ParameterTypeDescription
psbt?TransactionA PSBT to which additional inputs from wallet's UTXO set will be added and fee estimated
feeRate?numberOptional fee rate in sats/vB to use for the transaction

Returns

Promise<{ balance: bigint; feeRate: number; totalFee: number; }>


getTransactionFee()

getTransactionFee(
address,
amount,
feeRate?): Promise<number>;

Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:65

Estimates a total fee in satoshis for a given transaction

Parameters

ParameterTypeDescription
addressstringDestination address of the transaction
amountbigintAmount of satoshis to send (1 BTC = 100,000,000 sats)
feeRate?numberOptional fee rate in sats/vB to use for the transaction

Returns

Promise<number>


sendTransaction()

sendTransaction(
address,
amount,
feeRate?): Promise<string>;

Defined in: atomiq-sdk/src/bitcoin/wallet/IBitcoinWallet.ts:35

Signs and broadcasts a transaction sending amount of sats to address, optionally with the feeRate sats/vB fee rate.

Parameters

ParameterTypeDescription
addressstringDestination address of the transaction
amountbigintAmount of satoshis to send (1 BTC = 100,000,000 sats)
feeRate?numberOptional 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:51

Signs inputs in the provided PSBT

Parameters

ParameterTypeDescription
psbtTransactionA PSBT to sign
signInputsnumber[]Indices of the inputs to sign

Returns

Promise<Transaction>