From cb66d0e5758f5bf5fb278c178efd835aff2fb620 Mon Sep 17 00:00:00 2001 From: James Lawton Date: Wed, 29 Apr 2026 09:54:50 +0100 Subject: [PATCH 1/2] chore(connector-ui): bump trails to v0.14.0 and migrate to Fund component Replaces TrailsWidget (mode="fund") with the dedicated Fund component, mapping toAddress/toChainId/toToken into the to object and fundOptions into top-level props per the v0.14 API. Adds 0xtrails to minimumReleaseAgeExclude in pnpm-workspace.yaml. Also fixes pre-existing typecheck failure in polygon-agent-cli by migrating polymarket.ts from @polymarket/clob-client + @polymarket/order-utils (not installed) to @polymarket/clob-client-v2, updating the ClobClient constructor to the options-object API and SignatureType to SignatureTypeV2. --- packages/connector-ui/package.json | 2 +- .../src/components/FundingScreen.tsx | 17 ++-- packages/polygon-agent-cli/package.json | 3 +- .../polygon-agent-cli/src/lib/polymarket.ts | 17 ++-- pnpm-lock.yaml | 94 +++++-------------- pnpm-workspace.yaml | 1 + 6 files changed, 43 insertions(+), 91 deletions(-) diff --git a/packages/connector-ui/package.json b/packages/connector-ui/package.json index 722f06e..74884f5 100644 --- a/packages/connector-ui/package.json +++ b/packages/connector-ui/package.json @@ -19,7 +19,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "0xtrails": "^0.13.2", + "0xtrails": "^0.14.0", "@0xsequence/dapp-client": "3.0.0-beta.16", "@0xsequence/wallet-primitives": "3.0.0-beta.16", "@polygonlabs/agent-shared": "workspace:*", diff --git a/packages/connector-ui/src/components/FundingScreen.tsx b/packages/connector-ui/src/components/FundingScreen.tsx index 9a5d49d..b35b9d0 100644 --- a/packages/connector-ui/src/components/FundingScreen.tsx +++ b/packages/connector-ui/src/components/FundingScreen.tsx @@ -1,4 +1,4 @@ -import { TrailsWidget } from '0xtrails/widget'; +import { Fund } from '0xtrails/widget'; import { trailsApiKey } from '../config'; @@ -83,17 +83,18 @@ export function FundingScreen({ walletAddress, chainId, onSkip }: FundingScreenP

- {/* Trails widget renders its own styled button */} - { const { Wallet } = await import('ethers5'); - const { ClobClient } = await import('@polymarket/clob-client'); - const { SignatureType } = await import('@polymarket/order-utils'); + const { ClobClient, SignatureTypeV2 } = await import('@polymarket/clob-client-v2'); const signer = new Wallet(privateKey); const chainId = 137; - const anonClient = new ClobClient(CLOB_URL, chainId, signer); + const anonClient = new ClobClient({ host: CLOB_URL, chain: chainId, signer }); const creds = await anonClient.createOrDeriveApiKey(); - const signatureType = proxyWalletAddress ? SignatureType.POLY_PROXY : SignatureType.EOA; - const client = new ClobClient( - CLOB_URL, - chainId, + const signatureType = proxyWalletAddress ? SignatureTypeV2.POLY_PROXY : SignatureTypeV2.EOA; + const client = new ClobClient({ + host: CLOB_URL, + chain: chainId, signer, creds, signatureType, - proxyWalletAddress - ); + funderAddress: proxyWalletAddress + }); return { client, creds, address: await signer.getAddress() }; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b711e7a..18b8ca0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,8 +58,8 @@ importers: packages/connector-ui: dependencies: 0xtrails: - specifier: ^0.13.2 - version: 0.13.2(88585348c7fe3646803356f2c1f98627) + specifier: ^0.14.0 + version: 0.14.0(88585348c7fe3646803356f2c1f98627) '@0xsequence/dapp-client': specifier: 3.0.0-beta.16 version: 3.0.0-beta.16(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@3.25.76) @@ -157,12 +157,9 @@ importers: '@noble/hashes': specifier: 1.8.0 version: 1.8.0 - '@polymarket/clob-client': - specifier: ^5.2.4 - version: 5.5.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@4.3.6) - '@polymarket/order-utils': - specifier: ^3.0.1 - version: 3.0.1(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@4.3.6) + '@polymarket/clob-client-v2': + specifier: ^1.0.0 + version: 1.0.2(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@4.3.6) '@polymarket/sdk': specifier: ^6.0.1 version: 6.0.1(@ethersproject/abi@5.8.0)(@ethersproject/address@5.8.0)(@ethersproject/bignumber@5.8.0)(@ethersproject/constants@5.8.0)(@ethersproject/contracts@5.8.0)(@ethersproject/keccak256@5.8.0)(@ethersproject/providers@5.8.0(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@ethersproject/solidity@5.8.0) @@ -245,8 +242,8 @@ packages: peerDependencies: ethers: '>=6' - 0xtrails@0.13.2: - resolution: {integrity: sha512-NJWduFrGkTguglYr4D6mvYmWH/s+lsKfirhiaPXPu8RMyxTwF3ZBb9iOY5s2DANLPqZBt0MqYtiacVOe0Uoo0w==} + 0xtrails@0.14.0: + resolution: {integrity: sha512-SpzYYIkutXhnltveZRL+hRexuQLgUJXe0bSTTdCiYd8IdWkNyJP+wk3s+lOJQ15yaYsSoQTOCyxyZAgllNIuzw==} peerDependencies: '@tanstack/react-query': ^5.90.20 react: ^18.0.0 || ^19.0.0 @@ -465,11 +462,11 @@ packages: '@0xtrails/api@0.10.4': resolution: {integrity: sha512-jjGYCxWvZxoox2kzEjVJSgmuy9LBKSxs1ZcEkGageJ6ggvOlN4H35H6kSouDkycz5uTyRsH3O+4qW6nxy9niBQ==} - '@0xtrails/api@0.13.2': - resolution: {integrity: sha512-6D5nrYXRx9B2AbX3bcPzefxk4rz7Zu9baI+LH4cu0MKtyBUfqN77Lzk41MvRPqZ7bVazEbUnWSOjOe97O5HQ4g==} + '@0xtrails/api@0.14.0': + resolution: {integrity: sha512-xV2SDqljJH+4yMTSCGALbJR5DfTUGGsT5cqFHCcZilaJjkBft/jEBK57e9CnuAUF/C7nbx9ZOGR8xQ0taayqSw==} - '@0xtrails/wallet-registry@0.1.1': - resolution: {integrity: sha512-zs9a2wfT7o2edkUH9bLWOH6Fi6Tk13ta1p+nFbBbHUKzbMoWIb+Ufe6qpS3EVHkF2IfBl82k8qd0h7F8ZwFNoQ==} + '@0xtrails/wallet-registry@0.2.0': + resolution: {integrity: sha512-Vm1IyIzQ+p3QBU/1reBB4vP5dYlnurv86YHGgaciyAMuaFTLb1GBefr67trOQWfiS5iyZXlJldbLxVxSAwc33g==} '@adraffy/ens-normalize@1.10.1': resolution: {integrity: sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==} @@ -2116,16 +2113,8 @@ packages: typescript: optional: true - '@polymarket/builder-signing-sdk@0.0.8': - resolution: {integrity: sha512-rZLCFxEdYahl5FiJmhe22RDXysS1ibFJlWz4NT0s3itJRYq3XJzXXHXEZkAQplU+nIS1IlbbKjA4zDQaeCyYtg==} - - '@polymarket/clob-client@5.5.0': - resolution: {integrity: sha512-ArESpXkq2Bapn3D/TQoXwxUWhz8UNPHGViU078ojQtuLvlB5IyhHipWBkUqkNNYvQ4gwAvxQEq1FTMgDTnWe6g==} - engines: {node: '>=20.10'} - - '@polymarket/order-utils@3.0.1': - resolution: {integrity: sha512-XVcVladfGtC/VmboMkcszqYs82rvath/0XFWqzIFfq8O4atVOU8ykPOGJ2ZfodBPcXETzL+2u1rcepLMLKu9AQ==} - engines: {node: '>=20.10', yarn: '>=1'} + '@polymarket/clob-client-v2@1.0.2': + resolution: {integrity: sha512-lC80Esug6s6y3uV8D5HnkxoXVZUnATjyP6PcK2IXO740iGDuLlp9Dvvkx3+VVygHahN+M3NY7JiYiTQkDfWoeQ==} '@polymarket/sdk@6.0.1': resolution: {integrity: sha512-CJSzGuT/Aavvc8ex2rDFgYm1zhwt8uu0h9NKcpTbVqKcsTjNre82/ZEaUK2Mpc8yAesMk5yHZ80aFZIMYtevpw==} @@ -3584,9 +3573,6 @@ packages: '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} - '@types/node@18.19.130': - resolution: {integrity: sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==} - '@types/node@22.19.13': resolution: {integrity: sha512-akNQMv0wW5uyRpD2v2IEyRSZiR+BeGuoB6L310EgGObO44HSMNT8z1xzio28V8qOrgYaopIDNA18YgdXd+qTiw==} @@ -4259,8 +4245,8 @@ packages: brorand@1.1.0: resolution: {integrity: sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==} - browser-or-node@2.1.1: - resolution: {integrity: sha512-8CVjaLJGuSKMVTxJ2DpBl5XnlNDiT4cQFeuCJJrvJmts9YrTZDizTX7PjC2s6W4x+MBGZeEY6dGMrF04/6Hgqg==} + browser-or-node@3.0.0: + resolution: {integrity: sha512-iczIdVJzGEYhP5DqQxYM9Hh7Ztpqqi+CXZpSmX8ALFs9ecXkQIeqRyM6TfxEfMVpwhl3dSuDvxdzzo9sUOIVBQ==} browserslist@4.28.1: resolution: {integrity: sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==} @@ -7627,9 +7613,6 @@ packages: uncrypto@0.1.3: resolution: {integrity: sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==} - undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} @@ -8272,15 +8255,15 @@ snapshots: '@0xsequence/wallet': 2.3.43(ethers@6.16.0(bufferutil@4.1.0)(utf-8-validate@6.0.6)) ethers: 6.16.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) - 0xtrails@0.13.2(88585348c7fe3646803356f2c1f98627): + 0xtrails@0.14.0(88585348c7fe3646803356f2c1f98627): dependencies: '@0xsequence/connect': 5.4.8(9f1a99b6daf6e9f1f6915a92724c8d18) '@0xsequence/hooks': 5.4.9(@0xsequence/api@3.0.0-beta.17)(@0xsequence/indexer@3.0.5)(@0xsequence/metadata@3.0.5)(@0xsequence/network@2.3.43(ethers@6.16.0(bufferutil@4.1.0)(utf-8-validate@6.0.6)))(@tanstack/react-query@5.95.2(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(viem@2.46.3(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@3.25.76)) '@0xsequence/indexer': 3.0.5 '@0xsequence/metadata': 3.0.5 '@0xsequence/wallet-primitives': 3.0.0-beta.19(typescript@5.9.3)(zod@3.25.76) - '@0xtrails/api': 0.13.2 - '@0xtrails/wallet-registry': 0.1.1 + '@0xtrails/api': 0.14.0 + '@0xtrails/wallet-registry': 0.2.0 '@databeat/tracker': 0.9.3 '@emotion/is-prop-valid': 1.4.0 '@meshconnect/web-link-sdk': 3.7.1(bs58@6.0.0)(bufferutil@4.1.0)(encoding@0.1.13)(typescript@5.9.3)(utf-8-validate@6.0.6) @@ -8288,7 +8271,6 @@ snapshots: '@tanstack/query-persist-client-core': 5.95.2 '@tanstack/react-query': 5.95.2(react@18.3.1) '@tanstack/react-virtual': 3.13.23(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - buffer: 6.0.3 lucide-react: 0.563.0(react@18.3.1) motion: 12.34.0(@emotion/is-prop-valid@1.4.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) ox: 0.13.1(typescript@5.9.3)(zod@3.25.76) @@ -8752,9 +8734,9 @@ snapshots: '@0xtrails/api@0.10.4': {} - '@0xtrails/api@0.13.2': {} + '@0xtrails/api@0.14.0': {} - '@0xtrails/wallet-registry@0.1.1': {} + '@0xtrails/wallet-registry@0.2.0': {} '@adraffy/ens-normalize@1.10.1': {} @@ -10628,23 +10610,12 @@ snapshots: - eslint-plugin-import - supports-color - '@polymarket/builder-signing-sdk@0.0.8': - dependencies: - '@types/node': 18.19.130 - axios: 1.13.6 - tslib: 2.8.1 - transitivePeerDependencies: - - debug - - '@polymarket/clob-client@5.5.0(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@4.3.6)': + '@polymarket/clob-client-v2@1.0.2(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@4.3.6)': dependencies: '@ethersproject/providers': 5.8.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) - '@ethersproject/units': 5.8.0 '@ethersproject/wallet': 5.8.0 - '@polymarket/builder-signing-sdk': 0.0.8 axios: 1.13.6 - browser-or-node: 2.1.1 - ethers: 5.8.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + browser-or-node: 3.0.0 tslib: 2.8.1 viem: 2.46.3(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@4.3.6) transitivePeerDependencies: @@ -10654,19 +10625,6 @@ snapshots: - utf-8-validate - zod - '@polymarket/order-utils@3.0.1(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@4.3.6)': - dependencies: - '@ethersproject/providers': 5.8.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) - '@ethersproject/wallet': 5.8.0 - ethers: 5.8.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) - tslib: 2.8.1 - viem: 2.46.3(bufferutil@4.1.0)(typescript@5.9.3)(utf-8-validate@6.0.6)(zod@4.3.6) - transitivePeerDependencies: - - bufferutil - - typescript - - utf-8-validate - - zod - '@polymarket/sdk@6.0.1(@ethersproject/abi@5.8.0)(@ethersproject/address@5.8.0)(@ethersproject/bignumber@5.8.0)(@ethersproject/constants@5.8.0)(@ethersproject/contracts@5.8.0)(@ethersproject/keccak256@5.8.0)(@ethersproject/providers@5.8.0(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@ethersproject/solidity@5.8.0)': dependencies: '@ethersproject/abi': 5.8.0 @@ -12376,10 +12334,6 @@ snapshots: '@types/node@12.20.55': {} - '@types/node@18.19.130': - dependencies: - undici-types: 5.26.5 - '@types/node@22.19.13': dependencies: undici-types: 6.21.0 @@ -13553,7 +13507,7 @@ snapshots: brorand@1.1.0: {} - browser-or-node@2.1.1: {} + browser-or-node@3.0.0: {} browserslist@4.28.1: dependencies: @@ -17217,8 +17171,6 @@ snapshots: uncrypto@0.1.3: {} - undici-types@5.26.5: {} - undici-types@6.19.8: {} undici-types@6.21.0: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index f182aeb..933d19b 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -9,6 +9,7 @@ minimumReleaseAgeExclude: - '@agglayer/*' - '@0xsequence/*' - '@0xtrails/*' + - '0xtrails' trustPolicy: no-downgrade trustPolicyExclude: - 'semver@5.7.2 || 6.3.1' From fa32be9f8e1ff7b1763c3b35a6df23d78f852774 Mon Sep 17 00:00:00 2001 From: James Lawton Date: Wed, 29 Apr 2026 10:01:19 +0100 Subject: [PATCH 2/2] fix(connector-ui): remove from prop missing required chain field --- packages/connector-ui/src/components/FundingScreen.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/connector-ui/src/components/FundingScreen.tsx b/packages/connector-ui/src/components/FundingScreen.tsx index b35b9d0..6023382 100644 --- a/packages/connector-ui/src/components/FundingScreen.tsx +++ b/packages/connector-ui/src/components/FundingScreen.tsx @@ -94,7 +94,6 @@ export function FundingScreen({ walletAddress, chainId, onSkip }: FundingScreenP }} buttonText="Add Funds to Agent" hideSwap={true} - from={{ amount: 20 }} onramp={{ mesh: { environment: 'production'