Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.spark.money/llms.txt

Use this file to discover all available pages before exploring further.

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

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
fee
number
Deprecated. Total fee in sats for the refund transaction. Use satsPerVbyteFee instead.
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);