Refunds a deposit made to a static deposit address back to a specified Bitcoin address for the SparkWallet.
Method Signature
async refundStaticDeposit({
depositTransactionId,
outputIndex,
destinationAddress,
fee,
satsPerVbyteFee,
}: {
depositTransactionId: string;
outputIndex?: number;
destinationAddress: string;
fee?: number; // Deprecated: use satsPerVbyteFee
satsPerVbyteFee?: number;
}): Promise<string>
Parameters
The transaction ID of the original deposit
The index of the output (auto-detected if not provided)
The Bitcoin address to send the refund to
Deprecated. Total fee in sats for the refund transaction. Use satsPerVbyteFee instead.
The fee rate in sats per vbyte (must be less than 150)
Returns
The refund transaction as a hex string that needs to be broadcast
Example
const txHex = await wallet.refundStaticDeposit({
depositTransactionId: "abc123...",
destinationAddress: "bcrt1p...",
satsPerVbyteFee: 10
});
console.log("Refund transaction:", txHex);