From 1beb54b61012c4661b3aa9602bb172b3e2c3c7d6 Mon Sep 17 00:00:00 2001 From: James Lawton Date: Thu, 16 Apr 2026 17:39:43 +0100 Subject: [PATCH 1/3] fix(deposit): whitelist ERC-20 token contracts and fix session error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deposits send two txs: approve() on the token contract + the pool call. Both need session whitelisting. This caused repeated re-authorization loops when the token contract (e.g. USDC) wasn't whitelisted alongside the pool. - Add USDC/USDT/WETH token contracts to AUTO_WHITELISTED_CONTRACTS in both wallet.ts (--print-url flow) and wallet-ui.tsx (interactive flow) - Sync wallet-ui.tsx AUTO_WHITELISTED_CONTRACTS with wallet.ts (was missing all DeFi vault contracts — only had the 3 core contracts) - Fix dry-run note and session rejection error in deposit command to name both --contract flags needed (token + pool) - Update SKILL.md and polygon-defi/SKILL.md to document the two-contract requirement Entire-Checkpoint: ada5950cb14d --- packages/connector-ui/public/skills/SKILL.md | 2 ++ packages/polygon-agent-cli/skills/SKILL.md | 2 ++ .../src/commands/operations.ts | 6 ++--- .../src/commands/wallet-ui.tsx | 27 ++++++++++++++++--- .../polygon-agent-cli/src/commands/wallet.ts | 5 ++++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/packages/connector-ui/public/skills/SKILL.md b/packages/connector-ui/public/skills/SKILL.md index dc37953..933b583 100644 --- a/packages/connector-ui/public/skills/SKILL.md +++ b/packages/connector-ui/public/skills/SKILL.md @@ -54,6 +54,8 @@ polygon-agent wallet create --usdc-limit 100 --native-limit 5 # → user approves in browser, browser shows a 6-digit code # → enter the 6-digit code in the terminal when prompted # → session saved to ~/.polygon-agent/wallets/main.json +# → notify the user and send them to https://agentconnect.polygon.technology/?rid= +# so they can fund their wallet with access to the session # Step 3: Fund wallet polygon-agent fund diff --git a/packages/polygon-agent-cli/skills/SKILL.md b/packages/polygon-agent-cli/skills/SKILL.md index dc37953..933b583 100644 --- a/packages/polygon-agent-cli/skills/SKILL.md +++ b/packages/polygon-agent-cli/skills/SKILL.md @@ -54,6 +54,8 @@ polygon-agent wallet create --usdc-limit 100 --native-limit 5 # → user approves in browser, browser shows a 6-digit code # → enter the 6-digit code in the terminal when prompted # → session saved to ~/.polygon-agent/wallets/main.json +# → notify the user and send them to https://agentconnect.polygon.technology/?rid= +# so they can fund their wallet with access to the session # Step 3: Fund wallet polygon-agent fund diff --git a/packages/polygon-agent-cli/src/commands/operations.ts b/packages/polygon-agent-cli/src/commands/operations.ts index 7e84c07..c9c677b 100644 --- a/packages/polygon-agent-cli/src/commands/operations.ts +++ b/packages/polygon-agent-cli/src/commands/operations.ts @@ -1122,7 +1122,7 @@ export const depositCommand: CommandModule = { chainId, chain: network.name, transactions, - note: `Re-run with --broadcast to submit the deposit. If session rejects the call, re-create with: polygon-agent wallet create --contract ${pool.depositAddress}` + note: `Re-run with --broadcast to submit the deposit. If session rejects the call, re-create with: polygon-agent wallet create --contract ${asset.address} --contract ${pool.depositAddress}` }, bigintReplacer, 2 @@ -1143,8 +1143,8 @@ export const depositCommand: CommandModule = { } catch (txErr) { if ((txErr as Error).message?.includes('No signer supported')) { throw new Error( - `Session does not permit calls to ${pool.depositAddress} (${pool.protocol} pool). ` + - `Re-create the wallet session with: polygon-agent wallet create --contract ${pool.depositAddress}\n` + + `Session does not permit calls to ${pool.depositAddress} (${pool.protocol} pool) or ${asset.address} (${assetSymbol} approve). ` + + `Re-create the wallet session with: polygon-agent wallet create --contract ${asset.address} --contract ${pool.depositAddress}\n` + `Original error: ${(txErr as Error).message}` ); } diff --git a/packages/polygon-agent-cli/src/commands/wallet-ui.tsx b/packages/polygon-agent-cli/src/commands/wallet-ui.tsx index 3d03ada..c058e49 100644 --- a/packages/polygon-agent-cli/src/commands/wallet-ui.tsx +++ b/packages/polygon-agent-cli/src/commands/wallet-ui.tsx @@ -32,9 +32,30 @@ interface SessionPermissionArgs { } const AUTO_WHITELISTED_CONTRACTS = [ - '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432', - '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63', - '0xABAAd93EeE2a569cF0632f39B10A9f5D734777ca' + '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432', // ERC-8004 IdentityRegistry + '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63', // ERC-8004 ReputationRegistry + '0xABAAd93EeE2a569cF0632f39B10A9f5D734777ca', // ValueForwarder (required for send native POL) + + // Polygon mainnet (chainId 137) — ERC-20 token contracts (needed for approve() in deposits/swaps) + '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', // USDC (native) + '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', // USDT + '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', // WETH + + // Polygon mainnet (chainId 137) — yield vaults + '0x794a61358d6845594f94dc1db02a252b5b4814ad', // Aave V3 Pool (all markets) + '0x781fb7f6d845e3be129289833b04d43aa8558c42', // Morpho Compound USDC + '0xf5c81d25ee174d83f1fd202ca94ae6070d073ccf', // Morpho Compound WETH + '0x3f33f9f7e2d7cfbcbdf8ea8b870a6e3d449664c2', // Morpho Compound POL + + // Katana (chainId 747474) — Morpho vaults + '0x1ecdc3f2b5e90bfb55ff45a7476ff98a8957388e', // Gauntlet USDT (~$97M TVL) + '0x61d4f9d3797ba4da152238c53a6f93fb665c3c1d', // Steakhouse Prime USDC (~$54M TVL) + '0xfade0c546f44e33c134c4036207b314ac643dc2e', // Yearn OG ETH (~$16M TVL) + '0xce2b8e464fc7b5e58710c24b7e5ebfb6027f29d7', // Yearn OG USDC (~$16M TVL) + '0xe4248e2105508fcbad3fe95691551d1af14015f7', // Gauntlet USDC (~$8M TVL) + '0x8ed68f91afbe5871dce31ae007a936ebe8511d47', // Yearn OG USDT (~$8M TVL) + '0xc5e7ab07030305fc925175b25b93b285d40dcdff', // Gauntlet WETH (~$6M TVL) + '0xef77f8c53af95f3348cee0fb2a02ee02ab9cdca5' // Hyperithm vbUSDC Apex (~$3M TVL) ]; function applySessionPermissionParams(url: URL, argv: SessionPermissionArgs): void { diff --git a/packages/polygon-agent-cli/src/commands/wallet.ts b/packages/polygon-agent-cli/src/commands/wallet.ts index 31e684a..b4a2fbb 100644 --- a/packages/polygon-agent-cli/src/commands/wallet.ts +++ b/packages/polygon-agent-cli/src/commands/wallet.ts @@ -51,6 +51,11 @@ const AUTO_WHITELISTED_CONTRACTS = [ // NOTE: Trails deposit contract for swap --from POL is dynamic (changes per route/quote) // and cannot be reliably pre-whitelisted here. + // Polygon mainnet (chainId 137) — ERC-20 token contracts (needed for approve() in deposits/swaps) + '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', // USDC (native) + '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', // USDT + '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619', // WETH + // Polygon mainnet (chainId 137) — yield vaults '0x794a61358d6845594f94dc1db02a252b5b4814ad', // Aave V3 Pool (all markets) '0x781fb7f6d845e3be129289833b04d43aa8558c42', // Morpho Compound USDC From 43fd75e626d1abceddd03903d15d090da0a8775b Mon Sep 17 00:00:00 2001 From: James Lawton Date: Thu, 16 Apr 2026 17:41:37 +0100 Subject: [PATCH 2/3] docs(skills): fix deposit session whitelisting guidance Both the token contract (approve) and pool contract must be whitelisted when creating a wallet for deposits. Update SKILL.md and polygon-defi/SKILL.md to document the two-contract requirement and list common Polygon token addresses. Entire-Checkpoint: 8754e23b78a8 --- packages/connector-ui/public/skills/SKILL.md | 4 ++-- .../public/skills/polygon-defi/SKILL.md | 24 +++++++++---------- packages/polygon-agent-cli/skills/SKILL.md | 4 ++-- .../skills/polygon-defi/SKILL.md | 24 +++++++++---------- skills/SKILL.md | 4 ++-- skills/polygon-defi/SKILL.md | 24 +++++++++---------- 6 files changed, 39 insertions(+), 45 deletions(-) diff --git a/packages/connector-ui/public/skills/SKILL.md b/packages/connector-ui/public/skills/SKILL.md index 933b583..257c5ec 100644 --- a/packages/connector-ui/public/skills/SKILL.md +++ b/packages/connector-ui/public/skills/SKILL.md @@ -129,7 +129,7 @@ polygon-agent agent feedback --agent-id --value [--tag1 ] [--tag - **Smart defaults** — `--wallet main`, `--chain polygon`, auto-wait on `wallet create` - **Fee preference** — auto-selects USDC over native POL when both available - **`fund`** — reads `walletAddress` from the wallet session and sets it as `toAddress` in the Trails widget URL. Always run `polygon-agent fund` to get the correct URL — never construct it manually or hardcode any address. -- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools`. If session rejects (contract not whitelisted), re-create wallet with `--contract ` +- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools`. Sends two txs: ERC-20 `approve()` on the token contract, then the pool deposit. If session rejects, re-create wallet with both `--contract --contract ` (the dry-run output shows both addresses). - **`x402-pay`** — probes endpoint for 402, smart wallet funds builder EOA with exact token amount, EOA signs EIP-3009 payment. Chain auto-detected from 402 response - **`send-native --direct`** — bypasses ValueForwarder contract for direct EOA transfer - **Session permissions** — without `--usdc-limit` etc., session gets bare-bones defaults and may not transact @@ -199,7 +199,7 @@ For specific workflows, load the relevant sub-skill: | `Timed out waiting for wallet approval` | Add `--timeout 600` | | `Invalid code: hash mismatch` | Wrong 6-digit code entered — retry (3 attempts allowed) | | `Relay request not found` | Session expired or already used — re-run `wallet create` (or `wallet create --print-url`) | -| Deposit session rejected | Re-create wallet with `--contract ` | +| Deposit session rejected | Re-create wallet with `--contract --contract ` (both required: token approve + pool call) | | Wrong recipient in Trails widget | Run `polygon-agent fund` (do not construct the URL manually) | | `x402-pay`: no 402 response | Endpoint doesn't require x402 payment, or URL is wrong | | `x402-pay`: payment token mismatch | Chain/token in the 402 response differs from wallet — check `--wallet` points to the right chain | diff --git a/packages/connector-ui/public/skills/polygon-defi/SKILL.md b/packages/connector-ui/public/skills/polygon-defi/SKILL.md index e04f4ff..67f12e4 100644 --- a/packages/connector-ui/public/skills/polygon-defi/SKILL.md +++ b/packages/connector-ui/public/skills/polygon-defi/SKILL.md @@ -59,27 +59,25 @@ Vault/pool addresses are resolved dynamically from Trails — they are not hardc ### Session Whitelisting -If the deposit is rejected with a session permission error, the pool's contract address needs to be whitelisted when creating the wallet session: +A deposit sends **two transactions**: an ERC-20 `approve()` on the token contract, then the pool deposit call. Both contracts must be whitelisted in the session. If the deposit is rejected with a session permission error: ```bash -# 1. Dry-run first to get the depositAddress +# 1. Dry-run first — output includes both addresses under `transactions[0].to` (token) and `depositAddress` (pool) polygon-agent deposit --asset USDC --amount 0.3 -# → note the depositAddress in output +# → note the token contract address (e.g. USDC: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359) +# → note the depositAddress (e.g. Aave V3: 0x794a61358d6845594f94dc1db02a252b5b4814ad) -# 2. Re-create wallet session with that contract whitelisted -polygon-agent wallet create --contract +# 2. Re-create wallet session with BOTH contracts whitelisted +polygon-agent wallet create --contract --contract # 3. Retry polygon-agent deposit --asset USDC --amount 0.3 --broadcast ``` -When creating a wallet specifically for yield, add `--contract` flags for all intended vaults upfront and omit `--usdc-limit`: - -```bash -polygon-agent wallet create \ - --contract 0x794a61358d6845594f94dc1db02a252b5b4814ad \ - --contract 0x781fb7f6d845e3be129289833b04d43aa8558c42 -``` +Common token contracts on Polygon mainnet (already auto-whitelisted in sessions created by the CLI): +- USDC: `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` +- USDT: `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` +- WETH: `0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619` ### Yield Vault Contract Whitelist @@ -131,7 +129,7 @@ polygon-agent swap --from USDC --to USDC --amount 0.5 --to-chain arbitrum --broa | Error | Cause | Fix | |-------|-------|-----| -| `Deposit session rejected` | Pool contract not whitelisted in session | Re-create wallet with `--contract ` | +| `Deposit session rejected` | Pool or token contract not whitelisted | Re-create wallet with `--contract --contract ` (both required) | | `Protocol X not yet supported` | Trails returned a protocol other than aave/morpho | Use `polygon-agent swap` to obtain the yield-bearing token manually | | `Fee option errors` | Wallet has insufficient balance | Run `polygon-agent balances` and fund the wallet | | `swap`: no route found | Insufficient liquidity for the pair | Try a different amount or token pair | diff --git a/packages/polygon-agent-cli/skills/SKILL.md b/packages/polygon-agent-cli/skills/SKILL.md index 933b583..257c5ec 100644 --- a/packages/polygon-agent-cli/skills/SKILL.md +++ b/packages/polygon-agent-cli/skills/SKILL.md @@ -129,7 +129,7 @@ polygon-agent agent feedback --agent-id --value [--tag1 ] [--tag - **Smart defaults** — `--wallet main`, `--chain polygon`, auto-wait on `wallet create` - **Fee preference** — auto-selects USDC over native POL when both available - **`fund`** — reads `walletAddress` from the wallet session and sets it as `toAddress` in the Trails widget URL. Always run `polygon-agent fund` to get the correct URL — never construct it manually or hardcode any address. -- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools`. If session rejects (contract not whitelisted), re-create wallet with `--contract ` +- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools`. Sends two txs: ERC-20 `approve()` on the token contract, then the pool deposit. If session rejects, re-create wallet with both `--contract --contract ` (the dry-run output shows both addresses). - **`x402-pay`** — probes endpoint for 402, smart wallet funds builder EOA with exact token amount, EOA signs EIP-3009 payment. Chain auto-detected from 402 response - **`send-native --direct`** — bypasses ValueForwarder contract for direct EOA transfer - **Session permissions** — without `--usdc-limit` etc., session gets bare-bones defaults and may not transact @@ -199,7 +199,7 @@ For specific workflows, load the relevant sub-skill: | `Timed out waiting for wallet approval` | Add `--timeout 600` | | `Invalid code: hash mismatch` | Wrong 6-digit code entered — retry (3 attempts allowed) | | `Relay request not found` | Session expired or already used — re-run `wallet create` (or `wallet create --print-url`) | -| Deposit session rejected | Re-create wallet with `--contract ` | +| Deposit session rejected | Re-create wallet with `--contract --contract ` (both required: token approve + pool call) | | Wrong recipient in Trails widget | Run `polygon-agent fund` (do not construct the URL manually) | | `x402-pay`: no 402 response | Endpoint doesn't require x402 payment, or URL is wrong | | `x402-pay`: payment token mismatch | Chain/token in the 402 response differs from wallet — check `--wallet` points to the right chain | diff --git a/packages/polygon-agent-cli/skills/polygon-defi/SKILL.md b/packages/polygon-agent-cli/skills/polygon-defi/SKILL.md index e04f4ff..67f12e4 100644 --- a/packages/polygon-agent-cli/skills/polygon-defi/SKILL.md +++ b/packages/polygon-agent-cli/skills/polygon-defi/SKILL.md @@ -59,27 +59,25 @@ Vault/pool addresses are resolved dynamically from Trails — they are not hardc ### Session Whitelisting -If the deposit is rejected with a session permission error, the pool's contract address needs to be whitelisted when creating the wallet session: +A deposit sends **two transactions**: an ERC-20 `approve()` on the token contract, then the pool deposit call. Both contracts must be whitelisted in the session. If the deposit is rejected with a session permission error: ```bash -# 1. Dry-run first to get the depositAddress +# 1. Dry-run first — output includes both addresses under `transactions[0].to` (token) and `depositAddress` (pool) polygon-agent deposit --asset USDC --amount 0.3 -# → note the depositAddress in output +# → note the token contract address (e.g. USDC: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359) +# → note the depositAddress (e.g. Aave V3: 0x794a61358d6845594f94dc1db02a252b5b4814ad) -# 2. Re-create wallet session with that contract whitelisted -polygon-agent wallet create --contract +# 2. Re-create wallet session with BOTH contracts whitelisted +polygon-agent wallet create --contract --contract # 3. Retry polygon-agent deposit --asset USDC --amount 0.3 --broadcast ``` -When creating a wallet specifically for yield, add `--contract` flags for all intended vaults upfront and omit `--usdc-limit`: - -```bash -polygon-agent wallet create \ - --contract 0x794a61358d6845594f94dc1db02a252b5b4814ad \ - --contract 0x781fb7f6d845e3be129289833b04d43aa8558c42 -``` +Common token contracts on Polygon mainnet (already auto-whitelisted in sessions created by the CLI): +- USDC: `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` +- USDT: `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` +- WETH: `0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619` ### Yield Vault Contract Whitelist @@ -131,7 +129,7 @@ polygon-agent swap --from USDC --to USDC --amount 0.5 --to-chain arbitrum --broa | Error | Cause | Fix | |-------|-------|-----| -| `Deposit session rejected` | Pool contract not whitelisted in session | Re-create wallet with `--contract ` | +| `Deposit session rejected` | Pool or token contract not whitelisted | Re-create wallet with `--contract --contract ` (both required) | | `Protocol X not yet supported` | Trails returned a protocol other than aave/morpho | Use `polygon-agent swap` to obtain the yield-bearing token manually | | `Fee option errors` | Wallet has insufficient balance | Run `polygon-agent balances` and fund the wallet | | `swap`: no route found | Insufficient liquidity for the pair | Try a different amount or token pair | diff --git a/skills/SKILL.md b/skills/SKILL.md index 933b583..257c5ec 100644 --- a/skills/SKILL.md +++ b/skills/SKILL.md @@ -129,7 +129,7 @@ polygon-agent agent feedback --agent-id --value [--tag1 ] [--tag - **Smart defaults** — `--wallet main`, `--chain polygon`, auto-wait on `wallet create` - **Fee preference** — auto-selects USDC over native POL when both available - **`fund`** — reads `walletAddress` from the wallet session and sets it as `toAddress` in the Trails widget URL. Always run `polygon-agent fund` to get the correct URL — never construct it manually or hardcode any address. -- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools`. If session rejects (contract not whitelisted), re-create wallet with `--contract ` +- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools`. Sends two txs: ERC-20 `approve()` on the token contract, then the pool deposit. If session rejects, re-create wallet with both `--contract --contract ` (the dry-run output shows both addresses). - **`x402-pay`** — probes endpoint for 402, smart wallet funds builder EOA with exact token amount, EOA signs EIP-3009 payment. Chain auto-detected from 402 response - **`send-native --direct`** — bypasses ValueForwarder contract for direct EOA transfer - **Session permissions** — without `--usdc-limit` etc., session gets bare-bones defaults and may not transact @@ -199,7 +199,7 @@ For specific workflows, load the relevant sub-skill: | `Timed out waiting for wallet approval` | Add `--timeout 600` | | `Invalid code: hash mismatch` | Wrong 6-digit code entered — retry (3 attempts allowed) | | `Relay request not found` | Session expired or already used — re-run `wallet create` (or `wallet create --print-url`) | -| Deposit session rejected | Re-create wallet with `--contract ` | +| Deposit session rejected | Re-create wallet with `--contract --contract ` (both required: token approve + pool call) | | Wrong recipient in Trails widget | Run `polygon-agent fund` (do not construct the URL manually) | | `x402-pay`: no 402 response | Endpoint doesn't require x402 payment, or URL is wrong | | `x402-pay`: payment token mismatch | Chain/token in the 402 response differs from wallet — check `--wallet` points to the right chain | diff --git a/skills/polygon-defi/SKILL.md b/skills/polygon-defi/SKILL.md index e04f4ff..67f12e4 100644 --- a/skills/polygon-defi/SKILL.md +++ b/skills/polygon-defi/SKILL.md @@ -59,27 +59,25 @@ Vault/pool addresses are resolved dynamically from Trails — they are not hardc ### Session Whitelisting -If the deposit is rejected with a session permission error, the pool's contract address needs to be whitelisted when creating the wallet session: +A deposit sends **two transactions**: an ERC-20 `approve()` on the token contract, then the pool deposit call. Both contracts must be whitelisted in the session. If the deposit is rejected with a session permission error: ```bash -# 1. Dry-run first to get the depositAddress +# 1. Dry-run first — output includes both addresses under `transactions[0].to` (token) and `depositAddress` (pool) polygon-agent deposit --asset USDC --amount 0.3 -# → note the depositAddress in output +# → note the token contract address (e.g. USDC: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359) +# → note the depositAddress (e.g. Aave V3: 0x794a61358d6845594f94dc1db02a252b5b4814ad) -# 2. Re-create wallet session with that contract whitelisted -polygon-agent wallet create --contract +# 2. Re-create wallet session with BOTH contracts whitelisted +polygon-agent wallet create --contract --contract # 3. Retry polygon-agent deposit --asset USDC --amount 0.3 --broadcast ``` -When creating a wallet specifically for yield, add `--contract` flags for all intended vaults upfront and omit `--usdc-limit`: - -```bash -polygon-agent wallet create \ - --contract 0x794a61358d6845594f94dc1db02a252b5b4814ad \ - --contract 0x781fb7f6d845e3be129289833b04d43aa8558c42 -``` +Common token contracts on Polygon mainnet (already auto-whitelisted in sessions created by the CLI): +- USDC: `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` +- USDT: `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` +- WETH: `0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619` ### Yield Vault Contract Whitelist @@ -131,7 +129,7 @@ polygon-agent swap --from USDC --to USDC --amount 0.5 --to-chain arbitrum --broa | Error | Cause | Fix | |-------|-------|-----| -| `Deposit session rejected` | Pool contract not whitelisted in session | Re-create wallet with `--contract ` | +| `Deposit session rejected` | Pool or token contract not whitelisted | Re-create wallet with `--contract --contract ` (both required) | | `Protocol X not yet supported` | Trails returned a protocol other than aave/morpho | Use `polygon-agent swap` to obtain the yield-bearing token manually | | `Fee option errors` | Wallet has insufficient balance | Run `polygon-agent balances` and fund the wallet | | `swap`: no route found | Insufficient liquidity for the pair | Try a different amount or token pair | From ce55637c1f28ec8adccfe5bdb6f092bc9937e376 Mon Sep 17 00:00:00 2001 From: James Lawton Date: Thu, 16 Apr 2026 17:43:28 +0100 Subject: [PATCH 3/3] docs(skills): clarify that SEQUENCE_PROJECT_ACCESS_KEY, TRAILS_API_KEY are the same key Agents were hitting Trails "permission wall" errors not knowing that SEQUENCE_PROJECT_ACCESS_KEY (auto-loaded from disk) is the same value as TRAILS_API_KEY. Make the one-key/many-names relationship explicit. Entire-Checkpoint: 4fd4e4cce22b --- packages/connector-ui/public/skills/SKILL.md | 8 ++++---- packages/polygon-agent-cli/skills/SKILL.md | 8 ++++---- skills/SKILL.md | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/connector-ui/public/skills/SKILL.md b/packages/connector-ui/public/skills/SKILL.md index 257c5ec..2656c7c 100644 --- a/packages/connector-ui/public/skills/SKILL.md +++ b/packages/connector-ui/public/skills/SKILL.md @@ -20,15 +20,15 @@ description: "Complete Polygon agent toolkit for on-chain operations on Polygon. ## Environment Variables -### Access key — auto-loaded, no export needed +### Access key — one key, many names -After `setup` runs, the access key is stored in `~/.polygon-agent/builder.json`. The CLI bootstraps it into `SEQUENCE_PROJECT_ACCESS_KEY` and `SEQUENCE_INDEXER_ACCESS_KEY` automatically on every invocation. Trails commands additionally fall back through `session.projectAccessKey` → `SEQUENCE_PROJECT_ACCESS_KEY`, so `TRAILS_API_KEY` also does not need to be exported manually. +`SEQUENCE_PROJECT_ACCESS_KEY`, `SEQUENCE_INDEXER_ACCESS_KEY`, and `TRAILS_API_KEY` are **all the same key** — the Sequence project access key created during `setup`. The CLI treats them as aliases and falls back through all of them automatically. -**In a fresh agent session with no environment variables set**, simply run commands — the CLI reads credentials from disk. No `export` step is required between phases. +After `setup` runs the key is stored in `~/.polygon-agent/builder.json`. Every CLI invocation bootstraps it into the environment — no `export` is needed. In a fresh agent session with no environment variables set, simply run commands and the CLI reads credentials from disk. Only set these manually to override the stored value (e.g. to point at a different project): ```bash -export SEQUENCE_PROJECT_ACCESS_KEY= +export SEQUENCE_PROJECT_ACCESS_KEY= # also covers TRAILS_API_KEY and indexer calls ``` ### Optional overrides diff --git a/packages/polygon-agent-cli/skills/SKILL.md b/packages/polygon-agent-cli/skills/SKILL.md index 257c5ec..2656c7c 100644 --- a/packages/polygon-agent-cli/skills/SKILL.md +++ b/packages/polygon-agent-cli/skills/SKILL.md @@ -20,15 +20,15 @@ description: "Complete Polygon agent toolkit for on-chain operations on Polygon. ## Environment Variables -### Access key — auto-loaded, no export needed +### Access key — one key, many names -After `setup` runs, the access key is stored in `~/.polygon-agent/builder.json`. The CLI bootstraps it into `SEQUENCE_PROJECT_ACCESS_KEY` and `SEQUENCE_INDEXER_ACCESS_KEY` automatically on every invocation. Trails commands additionally fall back through `session.projectAccessKey` → `SEQUENCE_PROJECT_ACCESS_KEY`, so `TRAILS_API_KEY` also does not need to be exported manually. +`SEQUENCE_PROJECT_ACCESS_KEY`, `SEQUENCE_INDEXER_ACCESS_KEY`, and `TRAILS_API_KEY` are **all the same key** — the Sequence project access key created during `setup`. The CLI treats them as aliases and falls back through all of them automatically. -**In a fresh agent session with no environment variables set**, simply run commands — the CLI reads credentials from disk. No `export` step is required between phases. +After `setup` runs the key is stored in `~/.polygon-agent/builder.json`. Every CLI invocation bootstraps it into the environment — no `export` is needed. In a fresh agent session with no environment variables set, simply run commands and the CLI reads credentials from disk. Only set these manually to override the stored value (e.g. to point at a different project): ```bash -export SEQUENCE_PROJECT_ACCESS_KEY= +export SEQUENCE_PROJECT_ACCESS_KEY= # also covers TRAILS_API_KEY and indexer calls ``` ### Optional overrides diff --git a/skills/SKILL.md b/skills/SKILL.md index 257c5ec..2656c7c 100644 --- a/skills/SKILL.md +++ b/skills/SKILL.md @@ -20,15 +20,15 @@ description: "Complete Polygon agent toolkit for on-chain operations on Polygon. ## Environment Variables -### Access key — auto-loaded, no export needed +### Access key — one key, many names -After `setup` runs, the access key is stored in `~/.polygon-agent/builder.json`. The CLI bootstraps it into `SEQUENCE_PROJECT_ACCESS_KEY` and `SEQUENCE_INDEXER_ACCESS_KEY` automatically on every invocation. Trails commands additionally fall back through `session.projectAccessKey` → `SEQUENCE_PROJECT_ACCESS_KEY`, so `TRAILS_API_KEY` also does not need to be exported manually. +`SEQUENCE_PROJECT_ACCESS_KEY`, `SEQUENCE_INDEXER_ACCESS_KEY`, and `TRAILS_API_KEY` are **all the same key** — the Sequence project access key created during `setup`. The CLI treats them as aliases and falls back through all of them automatically. -**In a fresh agent session with no environment variables set**, simply run commands — the CLI reads credentials from disk. No `export` step is required between phases. +After `setup` runs the key is stored in `~/.polygon-agent/builder.json`. Every CLI invocation bootstraps it into the environment — no `export` is needed. In a fresh agent session with no environment variables set, simply run commands and the CLI reads credentials from disk. Only set these manually to override the stored value (e.g. to point at a different project): ```bash -export SEQUENCE_PROJECT_ACCESS_KEY= +export SEQUENCE_PROJECT_ACCESS_KEY= # also covers TRAILS_API_KEY and indexer calls ``` ### Optional overrides