Skip to main content
POST
Builds the transaction that pays an escrowed realization surplus out of the market contract to the borrower, then confirms it once mined. The surplus is held in the settlement token (stablecoin). A liquidation’s proceeds above the debt plus the penalty belong to the borrower, and the market pays them out during settlement. When the settlement token refuses that transfer, the market escrows the amount under the borrower’s address rather than reverting the settlement. Get Escrowed Surplus reads the balance. This endpoint withdraws it, on FREEZE and CUSTODY markets alike.
The claim repeats the refused transfer of the settlement asset, so it reverts while that asset still refuses the borrower, after the borrower has paid gas. The calldata is returned without checking whether the transfer would now be accepted. Lift the restriction on the borrower’s address first, then claim.
claimSurplus() takes no arguments and pays the whole escrow of the wallet that signs it. The borrower must sign from the address the surplus was escrowed for. Signing with any other wallet claims that wallet’s own escrow, or reverts when it has none. holderAddress only decides whose escrow is checked before the calldata is handed back. It does not appear in the transaction and cannot redirect the payout.

Path Parameters

string
required
Market ID.

Body Parameters

Send holderAddress to build the transaction, or txHash to confirm one already mined. At least one is required. When both are sent, txHash wins and the call confirms.
string
Address whose escrowed surplus is to be claimed, 0x followed by 40 hex characters. The market’s escrow for it is read first, and an empty escrow is refused with NO_ESCROWED_SURPLUS rather than handing back a transaction that reverts.
string
Hash of the mined claim, 0x followed by 64 hex characters. Send it to confirm the claim and record it. Omit it to receive the calldata.

Response Fields

object
A confirmed claim is recorded on the market’s transaction ledger as SURPLUS_CLAIMED, which List Transactions returns. It is not recorded against a single position, because the escrow belongs to the address and the market’s SurplusClaimed event names no loan.

Error Codes

Confirming with txHash can also return any transaction verification error.