Skip to main content

IBTCWalletSwap

Defined in: atomiq-sdk/src/swaps/IBTCWalletSwap.ts:30

Interface for swaps requiring Bitcoin wallet interaction

Methods​

estimateBitcoinFee()​

estimateBitcoinFee(wallet, feeRate?): Promise<TokenAmount<BtcToken<false>>>;

Defined in: atomiq-sdk/src/swaps/IBTCWalletSwap.ts:60

Estimates a bitcoin on-chain fee paid for the bitcoin swap transaction

Parameters​

ParameterTypeDescription
wallet| IBitcoinWallet | MinimalBitcoinWalletInterfaceSender's bitcoin wallet
feeRate?numberOptional fee rate in sats/vB for the transaction

Returns​

Promise<TokenAmount<BtcToken<false>>>


getFundedPsbt()​

getFundedPsbt(
_bitcoinWallet,
feeRate?,
additionalOutputs?): Promise<{
psbt: Transaction;
psbtBase64: string;
psbtHex: string;
signInputs: number[];
}>;

Defined in: atomiq-sdk/src/swaps/IBTCWalletSwap.ts:41

Returns the PSBT that is already funded with wallet's UTXOs (runs a coin-selection algorithm to choose UTXOs to use), also returns inputs indices that need to be signed by the wallet before submitting the PSBT back to the SDK with submitPsbt

Parameters​

ParameterTypeDescription
_bitcoinWallet| IBitcoinWallet | MinimalBitcoinWalletInterfaceSender's bitcoin wallet
feeRate?numberOptional fee rate in sats/vB for the transaction
additionalOutputs?( | { amount: bigint; outputScript: Uint8Array; } | { address: string; amount: bigint; })[]additional outputs to add to the PSBT - can be used to collect fees from users

Returns​

Promise<{ psbt: Transaction; psbtBase64: string; psbtHex: string; signInputs: number[]; }>


getRequiredConfirmationsCount()​

getRequiredConfirmationsCount(): number;

Defined in: atomiq-sdk/src/swaps/IBTCWalletSwap.ts:91

Returns the number of confirmations required for the bitcoin transaction for this swap to complete and settle

Returns​

number


sendBitcoinTransaction()​

sendBitcoinTransaction(wallet, feeRate?): Promise<string>;

Defined in: atomiq-sdk/src/swaps/IBTCWalletSwap.ts:68

Sends a swap bitcoin transaction via the passed bitcoin wallet

Parameters​

ParameterTypeDescription
wallet| IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSignerSender's bitcoin wallet
feeRate?numberOptional fee rate in sats/vB for the transaction

Returns​

Promise<string>


submitPsbt()​

submitPsbt(psbt): Promise<string>;

Defined in: atomiq-sdk/src/swaps/IBTCWalletSwap.ts:52

Submits a PSBT signed by the wallet back to the SDK

Parameters​

ParameterTypeDescription
psbtanyA PSBT, either a Transaction object or a hex or base64 encoded PSBT string

Returns​

Promise<string>


waitForBitcoinTransaction()​

waitForBitcoinTransaction(
updateCallback?,
checkIntervalSeconds?,
abortSignal?): Promise<string>;

Defined in: atomiq-sdk/src/swaps/IBTCWalletSwap.ts:81

Waits till the bitcoin transaction gets the required number of confirmations

Parameters​

ParameterTypeDescription
updateCallback?(txId?, confirmations?, targetConfirmations?, txEtaMs?) => voidCallback called when txId is found, and also called with subsequent confirmations
checkIntervalSeconds?numberHow often to check the bitcoin transaction
abortSignal?AbortSignalAbort signal

Returns​

Promise<string>

Throws​

if in invalid state