Skip to main content
POST /v1/redemptions/prepare returns everything a redemption needs before the depositor signs: the redemption to send back, the typedData to sign, the $TSY approval to land first, the checks intake applies, and the quote. It stores nothing and reserves no liquidity, and POST /v1/redemptions checks everything again at intake.

Preparation

The example depositor, 0x1111…1111, holds 2,000 $TSY and 2,000 $TSY of Treasury credits, and has not yet approved the Treasury delegate. Only checks.allowance fails, and approval covers it. The redemption and typedData are what the depositor signs, so they keep base units: assetInAmt 1000186050000000000000 is 1,000.18605 $TSY, which has 18 decimals, and assetOutAmt 1000000000 is 1,000 USDC, which has 6. checks and quote are in whole tokens.
Response
The bound applies slippageBps to the quote: for exact $TSY in, the minimum USDC is the quote’s USDC output less slippageBps, rounded down and at least 0.000001 USDC; for exact USDC out, the maximum $TSY is the quote’s $TSY input plus slippageBps, rounded up. A preparation answers 200 whatever its checks say, including for a wallet with too few Treasury credits or none, as Too few credits shows. It answers 422 with:
  • INVALID_BODY for an unknown or invalid field, such as an invalid or zero address, a user that is the redemption operator, a slippageBps above 5,000, or a deadline after the year 9999; for a body that names neither or both of amountIn and amountOut; for a zero amount, a JSON number, or a string that is not a decimal with at most 6 decimal places; or for an amount too small to redeem, such as amountIn is too small to redeem: its quote rounds to zero. details.field names the field.
  • DEADLINE_TOO_SOON for a deadline ten minutes away or less.
  • NO_QUOTE when the Treasury capital provider’s quote reverts for a reason other than the depositor’s credits. details.providers names the capital provider and the decoded error, and the message reads as a swap quote’s:

Checks

A failing check never fails the preparation; it tells you what intake would reject now. Each check has token, required and available in whole tokens of it, and sufficient. credits, balance, and allowance are in $TSY, and liquidity in USDC:

Too few credits

Preparation still answers 200 when the depositor’s Treasury credits fall short of the redemption, or are zero. checks.credits fails, and quote, the signed bound, and checks.liquidity.required still cover the whole amount at the depositor’s own rate. A wallet without credits is priced as a wallet with no accrued yield would be. For a wallet with no credits and no $TSY, the request above quotes about 999.92 $TSY, signs a maximum of about 1,004.92 $TSY, and fails checks.credits and checks.balance with an available of 0. Intake rejects the redemption until the credits cover it: with INSUFFICIENT_CREDITS when its quote prices the signed amounts, and otherwise with NO_QUOTE, as for exact USDC out or a wallet without credits.

What the depositor signs

The authorization is a Multiliquid swap permit: the SwapBatchApproval EIP-712 message for the MultiliquidSwap contract, with exactly one leg from $TSY to USDC. A redemption names its amounts as a swap does: inputToken is $TSY, outputToken is USDC, and swapType says which amount is exact. A response carries the exact amount and the signed bound on the other one:
  • The operator is the redemption operator, which preparation fills in. A permit that names any other operator is rejected with 409 and code OPERATOR_MISMATCH, whose details.expected is the redemption operator.
  • The nonce is the depositor’s current swap nonce, which preparation fills in.
  • The deadline must be more than ten minutes in the future when the request arrives; otherwise the request is rejected with DEADLINE_TOO_SOON.

Signing

typedData is in the eth_signTypedData_v4 form: types includes EIP712Domain, with one member per domain field, in the order name and version as string, chainId as uint256, and verifyingContract as address. Custody platforms, go-ethereum, MetaMask’s eth-sig-util, and viem sign it as it is.
ethers rejects EIP712Domain in types. With ethers, delete types.EIP712Domain before signing; the signature is the same.

Submission

POST /v1/redemptions takes {"redemption": ..., "signature": "0x..."}: the prepared redemption, unchanged, and the signature of typedData, before expiresAt. The body is limited to 4 KiB with exactly one leg, and the signature to 1 KiB. Lifecycle describes what intake checks, what it returns, and how a redemption settles.

Limits

Preparation is in the write allowance of Rate limits, and its body is limited to 1 KiB. When the service is busy, it answers 429 with code RATE_LIMITED and Retry-After.