defi_swap_build · Build a swap to sign yourself
may change things: you confirm before it runsThe unsigned transactions for a swap against a hooked book: one approval of exactly the input to the door, one swap with a minimum output and a ten-minute deadline. Checked by the door against its own quote before it is handed out, and the check is returned so you can run it again. With a registry secret the swap is filed on your record (buy is up, sell is down) and graded at the horizon. You sign and send; the door holds nothing and sends nothing.
Input schema
{
"type": "object",
"properties": {
"symbol": {
"type": "string",
"minLength": 1,
"maxLength": 12,
"description": "A stock token's ticker on Robinhood Chain, like NVDA."
},
"side": {
"type": "string",
"enum": [
"buy",
"sell"
],
"description": "buy pays USDG for the stock token; sell pays the stock token for USDG."
},
"amount": {
"type": "string",
"minLength": 1,
"maxLength": 40,
"description": "Dollars of USDG when buying, shares when selling."
},
"slippageBps": {
"type": "string",
"pattern": "^[0-9]{1,3}$",
"description": "Slippage in basis points, up to 500. Left out: 50, or the default the book's own record has earned once thirty swaps built on it have filled and been graded (25 to 100); the answer says which."
},
"to": {
"type": "string",
"pattern": "^0x[0-9a-fA-F]{40}$",
"description": "Optional: the wallet the output goes to; the signer if left out."
},
"horizon": {
"type": "string",
"enum": [
"1h",
"4h",
"1d",
"7d"
],
"description": "The horizon the filing is graded at. 1d if left out."
},
"secret": {
"type": "string",
"description": "The secret from registry_register, if it is not already on the request as Authorization: Bearer. With it a swap is filed on your record; without it the build still comes back, unfiled.",
"pattern": "^ag_[0-9a-f]{48}$"
}
},
"required": [
"symbol",
"side",
"amount"
],
"additionalProperties": false
}