Skip to main content
POST
Returns the EIP-2612 permit a payer signs to repay a loan through Repay Loan as one signature and one transaction. A wallet cannot read the figures the permit has to carry, so the quote supplies all of them. That is the value, the token’s current nonce for the payer, a bounded deadline and the token’s EIP-712 domain. The permit names the market as spender. The quote exists only where the settlement asset provably implements EIP-2612. Any wallet without contract code can be the payer: the borrower, or a third party repaying for it. The payer signs the permit and also sends the repayment, because the market redeems the permit for the sender. The collateral still returns to the borrower. A multisig or smart account repays through the approval steps on Repay Loan. Signing the permit moves nothing by itself: the repayment transaction redeems it.

Path Parameters

string
required
The market’s record ID, as id on List Markets, not its contract address. See Market IDs.

Body Parameters

integer
required
On-chain loan ID. A positive integer. Accepted as a JSON number or as a numeric string.
string
required
The wallet that signs the permit and sends the repayment, 0x and 40 hex characters. Its nonce is read for the permit. A call without it is refused with PAYER_REQUIRED, and a contract account with PERMIT_REQUIRES_EOA.
string
Amount to repay, as a positive decimal string in borrow asset units. The permit is quoted over exactly this amount. An amount above what a full repayment can need is quoted as all: true: the value is the forecast, repay carries all: true, requestedAmount echoes the amount sent and warning says so. Required unless all is true.
boolean
Quote a full repayment. The value is the live debt plus the interest it can accrue over one hour, plus the repayment fee, plus one base unit. The interest uses the loan’s stamped fixed rate, or on a variable-rate loan the curve rate at full utilization. forecast carries the parts.
integer
How long the permit stays valid, in seconds from the current block time. An integer from 300 to 1800. Defaults to 1800.

Sign and repay

1

Quote

Request the quote with the loan, the payer, and either amount or all: true.
2

Sign

Sign typedData from the wallet named in payer and split the signature into v, r and s.
3

Build the repayment

Call Repay Loan with the fields in repay, which already carry mode: "permit" and payer, plus a permit holding permit.value, permit.deadline, v, r and s.
4

Broadcast and confirm

Send the returned steps from the payer’s wallet, then confirm with the hash of the step at confirmStepIndex. The optional last step clears the leftover allowance after a full repayment.
A partial quote is exact: the repayment must carry the same amount. A full-repayment quote covers the debt at quote time plus an hour of interest, while the permit lives at most 30 minutes, so a value signed unchanged covers the debt until its deadline. If the live debt plus the fee has outgrown the value by the time Repay Loan is called, it refuses with INVALID_PERMIT. If the value covers the debt now but not the interest until the deadline, the repayment builds with a warning. Repay Loan accepts the permit only while its deadline lies between 2 and 31 minutes after the current block time. A permit that lapsed while the payer reviewed it is refused with INVALID_PERMIT: request a new quote and sign it. The repay call also checks the signature against the payer’s current nonce. If another permit from the payer is redeemed on the token in between, the nonce moves and the repay call refuses this signature with INVALID_PERMIT. Request a fresh quote.

Domain resolution

A token does not expose its EIP-712 domain as a readable struct, so the API rebuilds it from name() and version(). It tries the token’s own version() first, then 1 and 2, and accepts a candidate only when it reproduces the token’s DOMAIN_SEPARATOR. A token without a version() getter is resolved the same way. The wallet therefore signs a digest the token will recover. When no candidate matches, the call returns PERMIT_DOMAIN_UNRESOLVED. Sign with tooling that knows the token’s domain, or use the approval steps.

Response Fields

object

Error Codes