IBTCWalletSwap
Defined in: atomiq-sdk/src/swaps/IBTCWalletSwap.ts:30
Interface for swaps requiring Bitcoin wallet interaction
Methods
estimateBitcoinFee()
estimateBitcoinFee(wallet, feeRate?): Promise<TokenAmount<any, BtcToken<false>>>;
Defined in: atomiq-sdk/src/swaps/IBTCWalletSwap.ts:60
Estimates a bitcoin on-chain fee paid for the bitcoin swap transaction
Parameters
| Parameter | Type | Description |
|---|---|---|
wallet | | IBitcoinWallet | MinimalBitcoinWalletInterface | Sender's bitcoin wallet |
feeRate? | number | Optional fee rate in sats/vB for the transaction |
Returns
Promise<TokenAmount<any, 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
| Parameter | Type | Description |
|---|---|---|
_bitcoinWallet | | IBitcoinWallet | MinimalBitcoinWalletInterface | Sender's bitcoin wallet |
feeRate? | number | Optional 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
| Parameter | Type | Description |
|---|---|---|
wallet | | IBitcoinWallet | MinimalBitcoinWalletInterfaceWithSigner | Sender's bitcoin wallet |
feeRate? | number | Optional 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
| Parameter | Type | Description |
|---|---|---|
psbt | any | A 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
| Parameter | Type | Description |
|---|---|---|
updateCallback? | (txId?, confirmations?, targetConfirmations?, txEtaMs?) => void | Callback called when txId is found, and also called with subsequent confirmations |
checkIntervalSeconds? | number | How often to check the bitcoin transaction |
abortSignal? | AbortSignal | Abort signal |
Returns
Promise<string>
Throws
if in invalid state