diff --git a/packages/connector-ui/package.json b/packages/connector-ui/package.json index 32b4a47..a124c17 100644 --- a/packages/connector-ui/package.json +++ b/packages/connector-ui/package.json @@ -1,7 +1,7 @@ { "name": "@polygonlabs/agent-connector-ui", "private": true, - "version": "1.6.4", + "version": "1.6.5", "type": "module", "description": "Wallet connector UI for Polygon Agent Kit - creates secure encrypted wallet sessions", "repository": { diff --git a/skills/SKILL.md b/skills/SKILL.md index 77e515f..9e3a60c 100644 --- a/skills/SKILL.md +++ b/skills/SKILL.md @@ -59,7 +59,16 @@ polygon-agent setup --name "MyAgent" # → all subsequent commands auto-load the access key from disk — no export needed # Step 2: Create ecosystem wallet (opens browser, waits for 6-digit code) -polygon-agent wallet create --usdc-limit 100 --native-limit 5 +# If the user's goal involves DeFi (deposit, yield, swap, Aave, Morpho), include all DeFi +# contracts now so the user only approves once — not again when the deposit is attempted. +polygon-agent wallet create --usdc-limit 100 --native-limit 5 \ + --contract 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 \ + --contract 0xc2132D05D31c914a87C6611C10748AEb04B58e8F \ + --contract 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619 \ + --contract 0x794a61358d6845594f94dc1db02a252b5b4814ad \ + --contract 0x781fb7f6d845e3be129289833b04d43aa8558c42 \ + --contract 0xf5c81d25ee174d83f1fd202ca94ae6070d073ccf \ + --contract 0x3f33f9f7e2d7cfbcbdf8ea8b870a6e3d449664c2 # → opens https://agentconnect.polygon.technology/link?rid=&... # → user approves in browser, browser shows a 6-digit code # → enter the 6-digit code in the terminal when prompted @@ -141,12 +150,13 @@ polygon-agent agent feedback --agent-id --value [--tag1 ] [--tag - **`balances --chains`** — comma-separated chains (max 20); two or more return JSON with `multiChain: true` and a `chains` array (same wallet address on each) - **Fee preference** — auto-selects USDC over native POL when both available - **`fund`** — returns `https://wallet.polygon.technology` as the `fundingUrl`. Always run `polygon-agent fund` to get the URL and wallet address — never hardcode or construct manually. -- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools` and deposits directly. If the session rejects the call, re-create the wallet with `--contract --contract ` (the dry-run output shows both addresses). Full deposit reference: https://agentconnect.polygon.technology/polygon-defi/SKILL.md +- **`deposit`** — picks highest-TVL pool via Trails `getEarnPools` and deposits directly. `wallet create` auto-whitelists USDC, Aave V3 Pool (`0x794a61358d6845594f94dc1db02a252b5b4814ad`), and all standard DeFi contracts — if the user has an older session, re-run `wallet create --usdc-limit 5` before depositing. Full deposit reference: https://agentconnect.polygon.technology/polygon-defi/SKILL.md - **`withdraw`** — `--position` = aToken or ERC-4626 vault; `--amount` = `max` or underlying units (Aave / vault). Dry-run JSON includes `poolAddress` / `vault`. Broadcast needs session on the **same chain** as `--chain`, with pool/vault + underlying token whitelisted where the relayer touches them - **`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 - **Session expiry** — 6 months from creation +- **One-pass session setup** — if the user's intent involves DeFi (deposit, yield, swap, Aave, Morpho), include all required DeFi contracts in the initial `wallet create` call. Never create a bare session and then ask the user to re-approve when a deposit is later attempted. See the Complete Setup Flow above for the full contract list. ## Wallet Creation Flow (v2 Relay) diff --git a/skills/polygon-defi/SKILL.md b/skills/polygon-defi/SKILL.md index 3aee20f..e12b5b4 100644 --- a/skills/polygon-defi/SKILL.md +++ b/skills/polygon-defi/SKILL.md @@ -5,6 +5,34 @@ description: DeFi operations on Polygon using the Polygon Agent CLI. Covers same # Polygon DeFi Skill +## Session Prerequisites + +**Before any DeFi operation, the wallet session must include the token contracts and pool contracts.** If the user does not yet have a session, or has an older session that predates this list, create one now — do not wait until a deposit fails: + +```bash +polygon-agent wallet create --usdc-limit 5 \ + --contract 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 \ + --contract 0xc2132D05D31c914a87C6611C10748AEb04B58e8F \ + --contract 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619 \ + --contract 0x794a61358d6845594f94dc1db02a252b5b4814ad \ + --contract 0x781fb7f6d845e3be129289833b04d43aa8558c42 \ + --contract 0xf5c81d25ee174d83f1fd202ca94ae6070d073ccf \ + --contract 0x3f33f9f7e2d7cfbcbdf8ea8b870a6e3d449664c2 +``` + +This automatically includes: +- USDC (native): `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` +- USDT: `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` +- WETH: `0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619` +- Aave V3 Pool (all markets): `0x794a61358d6845594f94dc1db02a252b5b4814ad` +- Morpho Compound USDC: `0x781fb7f6d845e3be129289833b04d43aa8558c42` +- Morpho Compound WETH: `0xf5c81d25ee174d83f1fd202ca94ae6070d073ccf` +- Morpho Compound POL: `0x3f33f9f7e2d7cfbcbdf8ea8b870a6e3d449664c2` + +If the user already has a session but deposit/swap calls are rejected with a permission error, re-create the session with the above command to pick up all current contracts. + +--- + ## Swap Tokens (Same-Chain) ```bash