AI agents
Check a plan before signing
verify.mjs checks an agent's transactions against what was asked.
verify.mjs checks a plan from the agent API before you sign it. It holds every step to the request you sent and to the contracts, functions, fee wallet and builder code pinned in its own file, never to the API's word. If our site were ever compromised, a plan that pays anyone it should not would stop here. It needs no key.
Run it
git clone https://github.com/alitiknazoglu/giftedstock-skill && cd giftedstock-skill && npm ci
node verify.mjs plan.json --wallet 0xYou --request '<the JSON body you sent>'Pass - in place of the file to read the plan from stdin. From JavaScript:
import { verifyPlan, defaultClients } from "./verify.mjs";
const { ok, problems, lines, review, unchecked, expect } =
await verifyPlan(plan, { wallet, request, clients: defaultClients() });| Option | What it does |
|---|---|
--wallet | The address you sign with. Required. |
--request | The exact body you sent. Required: the plan is held to it. |
--link-key | For a gift link: the address of the link key you made. |
--offline | Skip chain reads. Opens, sends, claims and take-backs can be checked this way; everything else needs them. |
Chain reads (token decimals and symbols, a box's price, the gift contract's fee, a basket maker's gift, ETH's Chainlink price) go through each chain's public RPC. To use your own, set BASE_RPC_URL and ROBINHOOD_RPC_URL where verify.mjs runs.
Read the answer
| Output | Meaning |
|---|---|
| each step in words | What the step does, decoded from its data. |
ok | The plan is the one you asked for. Exit code 0. |
STOP | Names the step that is not what you asked. Do not send it. Exit code 1. |
look yourself | What the API resolved for you, such as a name to an address or a symbol to a token: check it is what your user meant. |
not checked | What the file cannot see. |
A wrong command line (no plan, no --wallet or no --request) exits with code 2.
What it checks
- The plan is the action your body asks for on its chain. Every step is on that chain.
- Every step calls a pinned contract with a function that action uses. An approve is for exactly what a later step takes. setApprovalForAll, transferFrom and the like are always refused.
- A step's data is its selector and arguments, then on Base the builder code. Nothing more. A step's valueEth is exactly its value.
- What goes in is what you asked: the token and amount of a swap or bridge, the box, quantity and price, the ids, a gift's items, boxes and recipients.
- Inside a swap: one swap from the token asked to the one asked, paying the router, then one sweep to your wallet with the fee to the fee wallet at 1% with a stock or token on either side, else 0.75%. Nothing is left in a router.
- The least a swap pays is the summary's minimumOut, above 0. Deadlines are within validUntil.
- A Relay deposit is for your wallet, a send goes to the address asked, a take-back comes to your wallet.
- A gift or basket buys each item on its exchange for no more than 3% over what that exchange's own quoter says it costs now. The fee is 2.5% on top in all, to the fee wallet or to the maker of someone else's basket.
- A basket's boxes all go to your wallet and hold the same tokens as the maker's own first box of it, read onchain.
- A gift or a basket without "skill": "1.3.0" in the request is stopped.
What it cannot see
- A bridge's payout on the other chain: Relay's request id carries it, so look it up with Relay.
- Whether a minimum is a fair price.
- A basket's mix, box price and design come from the API: the basket's page shows the same.
examples/giftedstock.mjs runs verify.mjs, then the whole plan onchain without sending it (eth_simulateV1): a swap or bridge must take exactly the amount asked and bring at least the minimum. It shows what leaves and reaches the wallet and sends only after your yes.