diff --git a/.changeset/four-beans-tan.md b/.changeset/four-beans-tan.md new file mode 100644 index 0000000000..6d30090772 --- /dev/null +++ b/.changeset/four-beans-tan.md @@ -0,0 +1,5 @@ +--- +"viem": patch +--- + +Fixed issue where Transports were falling back on execution errors. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1237a304e5..4d589a25da 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,7 +56,7 @@ importers: version: 20.16.12 '@vitest/coverage-v8': specifier: ^1.0.4 - version: 1.0.4(vitest@1.0.4(@types/node@20.16.12)(@vitest/ui@1.0.4)(terser@5.36.0)) + version: 1.0.4(vitest@1.0.4) '@vitest/ui': specifier: ^1.0.4 version: 1.0.4(vitest@1.0.4) @@ -2635,7 +2635,6 @@ packages: bun@1.1.30: resolution: {integrity: sha512-ysRL1pq10Xba0jqVLPrKU3YIv0ohfp3cTajCPtpjCyppbn3lfiAVNpGoHfyaxS17OlPmWmR67UZRPw/EueQuug==} - cpu: [arm64, x64] os: [darwin, linux, win32] hasBin: true @@ -5427,6 +5426,14 @@ packages: typescript: optional: true + viem@2.22.16: + resolution: {integrity: sha512-Eb4Ggna2fblb0oHBmy5XZ3Q4cN6fEmKxVpIWHjmAbtYVC9IfbZ28Z1/yZP2oOgvyRrostNndmnR298pgarBVGw==} + peerDependencies: + typescript: '>=5.0.4' + peerDependenciesMeta: + typescript: + optional: true + viem@file:src: resolution: {directory: src, type: directory} peerDependencies: @@ -6678,7 +6685,7 @@ snapshots: pino-http: 8.6.1 pino-pretty: 10.3.1 prom-client: 14.2.0 - viem: 2.22.15(typescript@5.6.2)(zod@3.23.8) + viem: 2.22.16(typescript@5.6.2)(zod@3.23.8) yargs: 17.7.2 zod: 3.23.8 zod-validation-error: 1.5.0(zod@3.23.8) @@ -7561,7 +7568,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@vitest/coverage-v8@1.0.4(vitest@1.0.4(@types/node@20.16.12)(@vitest/ui@1.0.4)(terser@5.36.0))': + '@vitest/coverage-v8@1.0.4(vitest@1.0.4)': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 0.2.3 @@ -11282,6 +11289,23 @@ snapshots: - utf-8-validate - zod + viem@2.22.16(typescript@5.6.2)(zod@3.23.8): + dependencies: + '@noble/curves': 1.8.1 + '@noble/hashes': 1.7.1 + '@scure/bip32': 1.6.2 + '@scure/bip39': 1.5.4 + abitype: 1.0.8(typescript@5.6.2)(zod@3.23.8) + isows: 1.0.6(ws@8.18.0) + ox: 0.6.7(typescript@5.6.2)(zod@3.23.8) + ws: 8.18.0 + optionalDependencies: + typescript: 5.6.2 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + viem@file:src(typescript@5.6.2)(zod@3.23.8): dependencies: '@noble/curves': 1.8.1 diff --git a/src/clients/transports/fallback.ts b/src/clients/transports/fallback.ts index cf3e55375b..16b5a16535 100644 --- a/src/clients/transports/fallback.ts +++ b/src/clients/transports/fallback.ts @@ -1,3 +1,4 @@ +import { ExecutionRevertedError } from '../../errors/node.js' import { TransactionRejectedRpcError, UserRejectedRequestError, @@ -195,6 +196,7 @@ function shouldThrow(error: Error) { if ( error.code === TransactionRejectedRpcError.code || error.code === UserRejectedRequestError.code || + ExecutionRevertedError.nodeMessage.test(error.message) || error.code === 5000 // CAIP UserRejectedRequestError ) return true