Delayed withdrawals
After initiating a delayed withdrawal or leverage decrease, monitor settlement and complete the operation once the proceeds are claimable. For route selection and the request transaction, see Withdraw or Adjust leverage.
Use the connected sdk and the leveraged position selected in
Manage.
Monitor maturity
const withdrawals = await sdk.positions.getCurrentWithdrawals({ chainId: position.chainId, creditAccount: position.creditAccount, creditManager: position.creditManager, });
| Field | Type | Meaning |
|---|---|---|
data.pending | PositionPendingWithdrawal[] | Requests still waiting for settlement |
data.pending[].claimableAt | Timestamp | Expected claimable time, in Unix seconds; reread status before claiming |
data.pending[].expectedOutputs | WithdrawalOutputAmount[] | Estimated settlement outputs |
data.claimable | PositionClaimableWithdrawal[] | Matured withdrawals available to claim now |
data.claimable[].outputs | WithdrawalOutputAmount[] | Outputs of the claim; isDelayed: true means that output still needs a later claim |
data.claimable[].withdrawalPhantomToken | TokenAmount | Withdrawal representation and amount burned by the claim |
data.claimable[].claimCall | TxCall | Encoded claim call used by the SDK during finalization |
meta.chains | Per-chain metadata | Source, block, timestamp, and read status |
Both pending and claimable entries include sourceToken, the asset submitted
for redemption. They may also include redeemer, the request's contract, and
intent, the recorded operation to complete after settlement.
Reread this method to follow progress. Check response metadata before treating
empty arrays as a completed withdrawal. Use a fresh data.claimable entry,
rather than assuming a request has matured because its timestamp has passed.
While settlement is pending, the request has not repaid the debt. Interest continues to accrue, so keep monitoring the leveraged position's HF.
Claim and complete the operation
finalize prepares the claim together with the remaining steps, such as
repaying debt and transferring the requested withdrawal to the wallet.
const claimableIndex = 0; // Select the matured request to complete const claimable = withdrawals.data.claimable[claimableIndex]; const sim = await sdk.opportunities.prepare.finalize(position, { claimable, slippage, }); if (!sim.ok) throw sim.error;
| Field | Type | Meaning |
|---|---|---|
claimable | PositionClaimableWithdrawal | Fresh matured withdrawal selected above |
slippage Optional | number | Swap slippage in basis points; defaults to 0 |
quotaReserve Optional | number | Extra quota buffer in basis points; defaults to 0 |
intent Optional | ResumableIntent | Operation to resume; defaults to the intent recorded in the withdrawal |
Continue with position, sim, and owner in
Build, preview, and check.
Refresh the leveraged position and its withdrawals after confirmation.
When an explicit intent is needed
An intent records what should happen after the claim: for example, repay debt to decrease leverage, or repay debt and withdraw tokens to a recipient. The SDK normally reads it from the withdrawal automatically.
Older withdrawal compressors do not report it. For those requests, pass
intent from the saved initiation result's
delayed.record into finalize. Keep that record associated with the confirmed
request so it can be used after restarting the script.
Redeemers and liquidation
Supported redemption gateways use redeemer contracts to hold a request and receive settlement proceeds. Their mechanics are described in What a redeemer is and Protocol-specific redeemers. If liquidation transfers the redeemer to a liquidator, follow the liquidator claim flow.