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,
satsPerVbyteFee,
}: {
depositTransactionId: string;
outputIndex?: number;
destinationAddress: string;
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
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);