Skip to main content
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

depositTransactionId
string
required
The transaction ID of the original deposit
outputIndex
number
The index of the output (auto-detected if not provided)
destinationAddress
string
required
The Bitcoin address to send the refund to
satsPerVbyteFee
number
The fee rate in sats per vbyte (must be less than 150)

Returns

txHex
string
required
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);