withdraw(params)
Initiates a withdrawal to move funds from the Spark network to an on-chain Bitcoin address.
params: An object with the following properties:onchainAddress: (Required) The Bitcoin address where the funds should be sent.exitSpeed: (Required) The desired speed of the exit (FAST, MEDIUM, SLOW).amountSats: (Optional) The amount in satoshis to withdraw. If not specified, attempts to withdraw all available funds.feeQuote: (Required) The fee quote object returned bygetWithdrawalFeeQuote. Must be used before it expires.deductFeeFromWithdrawalAmount: (Optional, default:true) Whentrue, fees are deducted from the withdrawal amount. Whenfalse, fees are deducted from the remaining wallet balance.
Promise<CoopExitRequest | null | undefined>: The withdrawal request details, or null/undefined if the request cannot be completed.
getWithdrawalFeeQuote(params)
Gets a fee quote for a cooperative exit (on-chain withdrawal). The quote includes options for different speeds and an expiry time and must be passed to withdraw before it expires.
params: Object containing:amountSats: The amount in satoshis to withdraw.withdrawalAddress: The Bitcoin address where the funds should be sent.
Promise<WithdrawalFeeQuote | null>: A fee quote for the withdrawal, or null if not available.
getCoopExitRequest(id: string)
Gets a cooperative exit request by ID.
id: The ID of the cooperative exit request.
Promise<CoopExitRequest | null>: The cooperative exit request details or null if not found.