From c8d891120eedc3daffc8235c2722b2dd322f922a Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Thu, 20 Nov 2025 19:38:27 -0500 Subject: [PATCH 1/8] feat: named tuples --- pnpm-lock.yaml | 64 +++++++++++++++-------- src/actions/getContract.ts | 8 +-- src/actions/public/multicall.test-d.ts | 2 +- src/actions/public/readContract.test-d.ts | 2 +- src/package.json | 2 +- src/types/contract.ts | 40 ++++++++++---- src/utils/abi/decodeAbiParameters.ts | 12 +++-- src/utils/abi/decodeEventLog.ts | 5 +- src/utils/abi/encodeAbiParameters.ts | 3 +- 9 files changed, 95 insertions(+), 43 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b3a80d0ba7..bb37ab4aa6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -563,7 +563,7 @@ importers: version: link:../src vocs: specifier: ^1.1.0 - version: 1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.2) + version: 1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.3) src: dependencies: @@ -580,8 +580,8 @@ importers: specifier: 1.6.0 version: 1.6.0 abitype: - specifier: 1.1.0 - version: 1.1.0(typescript@5.9.3)(zod@3.25.76) + specifier: https://pkg.pr.new/abitype@e56c1fa + version: https://pkg.pr.new/abitype@e56c1fa(typescript@5.9.3)(zod@3.25.76) isows: specifier: 1.0.7 version: 1.0.7(ws@8.18.3) @@ -3335,6 +3335,18 @@ packages: zod: optional: true + abitype@https://pkg.pr.new/abitype@e56c1fa: + resolution: {tarball: https://pkg.pr.new/abitype@e56c1fa} + version: 0.0.0--.cc9da9d + peerDependencies: + typescript: '>=5.0.4' + zod: ^3.22.0 || ^4.0.0 + peerDependenciesMeta: + typescript: + optional: true + zod: + optional: true + abort-controller@3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} engines: {node: '>=6.5'} @@ -6688,8 +6700,8 @@ packages: typescript: optional: true - viem@2.39.2: - resolution: {integrity: sha512-EJPt+T0AkMxKvBRPFHYMLMuvcHiIhoYItkioHRGCkkm6LBSwlK6l9DNzoKA9S09LP003BiMeYddVjVso+lg2Og==} + viem@2.39.3: + resolution: {integrity: sha512-s11rPQRvUEdc5qHK3xT4fIk4qvgPAaLwaTFq+EbFlcJJD+Xn3R4mc9H6B6fquEiHl/mdsdbG/uKCnYpoNtHNHw==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -8417,7 +8429,7 @@ snapshots: pino-pretty: 10.3.1 prom-client: 14.2.0 type-fest: 4.39.0 - viem: 2.39.2(typescript@5.9.2)(zod@3.23.8) + viem: 2.39.3(typescript@5.9.2)(zod@3.23.8) yargs: 17.7.2 zod: 3.23.8 zod-validation-error: 1.5.0(zod@3.23.8) @@ -9360,11 +9372,11 @@ snapshots: '@shikijs/core': 1.29.2 '@shikijs/types': 1.29.2 - '@shikijs/twoslash@1.29.2(typescript@5.9.2)': + '@shikijs/twoslash@1.29.2(typescript@5.9.3)': dependencies: '@shikijs/core': 1.29.2 '@shikijs/types': 1.29.2 - twoslash: 0.2.12(typescript@5.9.2) + twoslash: 0.2.12(typescript@5.9.3) transitivePeerDependencies: - supports-color - typescript @@ -9760,10 +9772,10 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript/vfs@1.6.1(typescript@5.9.2)': + '@typescript/vfs@1.6.1(typescript@5.9.3)': dependencies: debug: 4.4.3 - typescript: 5.9.2 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -10035,6 +10047,16 @@ snapshots: typescript: 5.9.3 zod: 3.25.76 + abitype@https://pkg.pr.new/abitype@e56c1fa(typescript@5.6.2)(zod@3.25.76): + optionalDependencies: + typescript: 5.6.2 + zod: 3.25.76 + + abitype@https://pkg.pr.new/abitype@e56c1fa(typescript@5.9.3)(zod@3.25.76): + optionalDependencies: + typescript: 5.9.3 + zod: 3.25.76 + abort-controller@3.0.0: dependencies: event-target-shim: 5.0.1 @@ -13820,19 +13842,19 @@ snapshots: twoslash-protocol@0.3.4: {} - twoslash@0.2.12(typescript@5.9.2): + twoslash@0.2.12(typescript@5.9.3): dependencies: - '@typescript/vfs': 1.6.1(typescript@5.9.2) + '@typescript/vfs': 1.6.1(typescript@5.9.3) twoslash-protocol: 0.2.12 - typescript: 5.9.2 + typescript: 5.9.3 transitivePeerDependencies: - supports-color - twoslash@0.3.4(typescript@5.9.2): + twoslash@0.3.4(typescript@5.9.3): dependencies: - '@typescript/vfs': 1.6.1(typescript@5.9.2) + '@typescript/vfs': 1.6.1(typescript@5.9.3) twoslash-protocol: 0.3.4 - typescript: 5.9.2 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -14002,7 +14024,7 @@ snapshots: - utf-8-validate - zod - viem@2.39.2(typescript@5.9.2)(zod@3.23.8): + viem@2.39.3(typescript@5.9.2)(zod@3.23.8): dependencies: '@noble/curves': 1.9.1 '@noble/hashes': 1.8.0 @@ -14025,7 +14047,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.6.2)(zod@3.25.76) + abitype: https://pkg.pr.new/abitype@e56c1fa(typescript@5.6.2)(zod@3.25.76) isows: 1.0.7(ws@8.18.3) ox: 0.9.6(typescript@5.6.2)(zod@3.25.76) ws: 8.18.3 @@ -14144,7 +14166,7 @@ snapshots: - tsx - yaml - vocs@1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.2): + vocs@1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.3): dependencies: '@floating-ui/react': 0.27.16(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@hono/node-server': 1.19.5(hono@4.10.3) @@ -14162,7 +14184,7 @@ snapshots: '@radix-ui/react-tabs': 1.1.3(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@shikijs/rehype': 1.29.2 '@shikijs/transformers': 1.29.2 - '@shikijs/twoslash': 1.29.2(typescript@5.9.2) + '@shikijs/twoslash': 1.29.2(typescript@5.9.3) '@tailwindcss/vite': 4.1.15(vite@7.1.11(@types/node@24.5.2)(jiti@2.6.0)(lightningcss@1.30.2)(terser@5.36.0)(yaml@2.8.1)) '@vanilla-extract/css': 1.17.4 '@vanilla-extract/dynamic': 2.1.5 @@ -14212,7 +14234,7 @@ snapshots: serve-static: 1.16.2 shiki: 1.29.2 toml: 3.0.0 - twoslash: 0.3.4(typescript@5.9.2) + twoslash: 0.3.4(typescript@5.9.3) ua-parser-js: 1.0.40 unified: 11.0.5 unist-util-visit: 5.0.0 diff --git a/src/actions/getContract.ts b/src/actions/getContract.ts index 6d2092356f..8314a7ed40 100644 --- a/src/actions/getContract.ts +++ b/src/actions/getContract.ts @@ -825,7 +825,7 @@ type GetReadFunction< ? ExtractAbiFunction : AbiFunction, // - _args = AbiParametersToPrimitiveTypes, + _args = AbiParametersToPrimitiveTypes, _options = Prettify< UnionOmit< ReadContractParameters, @@ -859,7 +859,7 @@ type GetEstimateFunction< ? ExtractAbiFunction : AbiFunction, // - _args = AbiParametersToPrimitiveTypes, + _args = AbiParametersToPrimitiveTypes, _options = Prettify< UnionOmit< EstimateContractGasParameters, @@ -909,7 +909,7 @@ type GetSimulateFunction< ? ExtractAbiFunction : AbiFunction, // - _args = AbiParametersToPrimitiveTypes, + _args = AbiParametersToPrimitiveTypes, > = narrowable extends true ? < chainOverride extends Chain | undefined = undefined, @@ -1003,7 +1003,7 @@ type GetWriteFunction< ? ExtractAbiFunction : AbiFunction, // - _args = AbiParametersToPrimitiveTypes, + _args = AbiParametersToPrimitiveTypes, // For making `options` parameter required if `account` or `chain` is undefined _isOptionsRequired = Or<[IsUndefined, IsUndefined]>, > = narrowable extends true diff --git a/src/actions/public/multicall.test-d.ts b/src/actions/public/multicall.test-d.ts index 463d2e63f1..3ccfdf2faf 100644 --- a/src/actions/public/multicall.test-d.ts +++ b/src/actions/public/multicall.test-d.ts @@ -251,7 +251,7 @@ test('many contracts of differing types', async () => { address: '0x', abi: parseAbi([ 'function foo() view returns (int8)', - 'function foo(address) view returns (string)', + 'function foo(address account) view returns (string)', 'function foo(address, address) view returns ((address foo, address bar))', 'function bar() view returns (int8)', ]), diff --git a/src/actions/public/readContract.test-d.ts b/src/actions/public/readContract.test-d.ts index 49cc7bb003..c7562e3aed 100644 --- a/src/actions/public/readContract.test-d.ts +++ b/src/actions/public/readContract.test-d.ts @@ -231,7 +231,7 @@ test('behavior', () => { test('overloads', async () => { const abi = parseAbi([ 'function foo() view returns (int8)', - 'function foo(address) view returns (string)', + 'function foo(address tokenId) view returns (string)', 'function foo(address, address) view returns ((address foo, address bar))', 'function bar() view returns (int8)', ]) diff --git a/src/package.json b/src/package.json index c4c608c1a4..b851a57aa3 100644 --- a/src/package.json +++ b/src/package.json @@ -200,7 +200,7 @@ "@noble/hashes": "1.8.0", "@scure/bip32": "1.7.0", "@scure/bip39": "1.6.0", - "abitype": "1.1.0", + "abitype": "https://pkg.pr.new/abitype@e56c1fa", "isows": "1.0.7", "ox": "0.9.6", "ws": "8.18.3" diff --git a/src/types/contract.ts b/src/types/contract.ts index e95a465749..a5eabfd286 100644 --- a/src/types/contract.ts +++ b/src/types/contract.ts @@ -71,7 +71,8 @@ export type ContractFunctionArgs< functionName, mutability >['inputs'], - 'inputs' + 'inputs', + true > extends infer args ? [args] extends [never] ? readonly unknown[] @@ -85,7 +86,8 @@ export type ContractConstructorArgs< (abi extends Abi ? abi : Abi)[number], { type: 'constructor' } >['inputs'], - 'inputs' + 'inputs', + true > extends infer args ? [args] extends [never] ? readonly unknown[] @@ -97,7 +99,8 @@ export type ContractErrorArgs< errorName extends ContractErrorName = ContractErrorName, > = AbiParametersToPrimitiveTypes< ExtractAbiError['inputs'], - 'inputs' + 'inputs', + true > extends infer args ? [args] extends [never] ? readonly unknown[] @@ -179,8 +182,9 @@ type CheckArgs< /// targetArgs extends AbiParametersToPrimitiveTypes< abiFunction['inputs'], - 'inputs' - > = AbiParametersToPrimitiveTypes, + 'inputs', + true + > = AbiParametersToPrimitiveTypes, > = (readonly [] extends args ? readonly [] : args) extends targetArgs // fallback to `readonly []` if `args` has no value (e.g. `args` property not provided) ? abiFunction : never @@ -201,6 +205,11 @@ export type ContractFunctionParameters< /// allFunctionNames = ContractFunctionName, allArgs = ContractFunctionArgs, + abiFunction = ExtractAbiFunction< + abi extends Abi ? abi : Abi, + functionName, + mutability + >, // when `args` is inferred to `readonly []` ("inputs": []) or `never` (`abi` declared as `Abi` or not inferrable), allow `args` to be optional. // important that both branches return same structural type > = { @@ -208,8 +217,15 @@ export type ContractFunctionParameters< functionName: | allFunctionNames // show all options | (functionName extends allFunctionNames ? functionName : never) // infer value - args?: (abi extends Abi ? UnionWiden : never) | allArgs | undefined -} & (readonly [] extends allArgs ? {} : { args: Widen }) & + args?: + | (abi extends Abi + ? UnionWiden extends true ? args : allArgs> + : never) + | allArgs + | undefined +} & (readonly [] extends allArgs + ? {} + : { args: Widen extends true ? args : allArgs> }) & (deployless extends true ? { address?: undefined; code: Hex } : { address: Address }) @@ -235,7 +251,9 @@ export type ContractFunctionReturnType< mutability, functionName, args - >['outputs'] + >['outputs'], + 'outputs', + true > extends infer types ? types extends readonly [] ? void @@ -265,7 +283,8 @@ export type AbiItemArgs< name extends AbiItemName = AbiItemName, > = AbiParametersToPrimitiveTypes< ExtractAbiItem['inputs'], - 'inputs' + 'inputs', + true > extends infer args ? [args] extends [never] ? readonly unknown[] @@ -290,7 +309,8 @@ export type ExtractAbiItemForArgs< : args ) extends AbiParametersToPrimitiveTypes< abiItems[k]['inputs'], - 'inputs' + 'inputs', + true > ? abiItems[k] : never diff --git a/src/utils/abi/decodeAbiParameters.ts b/src/utils/abi/decodeAbiParameters.ts index 91334a5916..5a705c1866 100644 --- a/src/utils/abi/decodeAbiParameters.ts +++ b/src/utils/abi/decodeAbiParameters.ts @@ -1,4 +1,8 @@ -import type { AbiParameter, AbiParametersToPrimitiveTypes } from 'abitype' +import type { + AbiParameter, + AbiParameterKind, + AbiParametersToPrimitiveTypes, +} from 'abitype' import { AbiDecodingDataSizeTooSmallError, AbiDecodingZeroDataError, @@ -36,7 +40,9 @@ import { getArrayComponents } from './encodeAbiParameters.js' export type DecodeAbiParametersReturnType< params extends readonly AbiParameter[] = readonly AbiParameter[], > = AbiParametersToPrimitiveTypes< - params extends readonly AbiParameter[] ? params : AbiParameter[] + params extends readonly AbiParameter[] ? params : AbiParameter[], + AbiParameterKind, + true > export type DecodeAbiParametersErrorType = @@ -76,7 +82,7 @@ export function decodeAbiParameters< consumed += consumed_ values.push(data) } - return values as DecodeAbiParametersReturnType + return values as never } type DecodeParameterErrorType = diff --git a/src/utils/abi/decodeEventLog.ts b/src/utils/abi/decodeEventLog.ts index 7fbfe750d2..f22bc3aa96 100644 --- a/src/utils/abi/decodeEventLog.ts +++ b/src/utils/abi/decodeEventLog.ts @@ -152,7 +152,10 @@ export function decodeEventLog< if (nonIndexedInputs.length > 0) { if (data && data !== '0x') { try { - const decodedData = decodeAbiParameters(nonIndexedInputs, data) + const decodedData = decodeAbiParameters( + nonIndexedInputs, + data, + ) as unknown[] if (decodedData) { if (isUnnamed) for (let i = 0; i < inputs.length; i++) diff --git a/src/utils/abi/encodeAbiParameters.ts b/src/utils/abi/encodeAbiParameters.ts index 4ce7d78107..8fb5bd55e6 100644 --- a/src/utils/abi/encodeAbiParameters.ts +++ b/src/utils/abi/encodeAbiParameters.ts @@ -1,5 +1,6 @@ import type { AbiParameter, + AbiParameterKind, AbiParametersToPrimitiveTypes, AbiParameterToPrimitiveType, } from 'abitype' @@ -87,7 +88,7 @@ export function encodeAbiParameters< >( params: params, values: params extends readonly AbiParameter[] - ? AbiParametersToPrimitiveTypes + ? AbiParametersToPrimitiveTypes : never, ): EncodeAbiParametersReturnType { if (params.length !== values.length) From dc8059dced889fa94a145d4669e7bfc4cc45b4bf Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Thu, 20 Nov 2025 20:08:31 -0500 Subject: [PATCH 2/8] chore: up --- pnpm-lock.yaml | 29 ++++++++++++++--------------- pnpm-workspace.yaml | 1 + src/package.json | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bb37ab4aa6..ec4288db85 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -580,8 +580,8 @@ importers: specifier: 1.6.0 version: 1.6.0 abitype: - specifier: https://pkg.pr.new/abitype@e56c1fa - version: https://pkg.pr.new/abitype@e56c1fa(typescript@5.9.3)(zod@3.25.76) + specifier: 1.2.0 + version: 1.2.0(typescript@5.9.3)(zod@3.25.76) isows: specifier: 1.0.7 version: 1.0.7(ws@8.18.3) @@ -3335,9 +3335,8 @@ packages: zod: optional: true - abitype@https://pkg.pr.new/abitype@e56c1fa: - resolution: {tarball: https://pkg.pr.new/abitype@e56c1fa} - version: 0.0.0--.cc9da9d + abitype@1.2.0: + resolution: {integrity: sha512-fD3ROjckUrWsybaSor2AdWxzA0e/DSyV2dA4aYd7bd8orHsoJjl09fOgKfUkTDfk0BsDGBf4NBgu/c7JoS2Npw==} peerDependencies: typescript: '>=5.0.4' zod: ^3.22.0 || ^4.0.0 @@ -10042,17 +10041,17 @@ snapshots: typescript: 5.9.2 zod: 3.23.8 - abitype@1.1.0(typescript@5.9.3)(zod@3.25.76): + abitype@1.2.0(typescript@5.6.2)(zod@3.25.76): optionalDependencies: - typescript: 5.9.3 + typescript: 5.6.2 zod: 3.25.76 - abitype@https://pkg.pr.new/abitype@e56c1fa(typescript@5.6.2)(zod@3.25.76): + abitype@1.2.0(typescript@5.9.2)(zod@3.23.8): optionalDependencies: - typescript: 5.6.2 - zod: 3.25.76 + typescript: 5.9.2 + zod: 3.23.8 - abitype@https://pkg.pr.new/abitype@e56c1fa(typescript@5.9.3)(zod@3.25.76): + abitype@1.2.0(typescript@5.9.3)(zod@3.25.76): optionalDependencies: typescript: 5.9.3 zod: 3.25.76 @@ -12636,7 +12635,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.6.2)(zod@3.25.76) + abitype: 1.2.0(typescript@5.6.2)(zod@3.25.76) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.6.2 @@ -12651,7 +12650,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.9.2)(zod@3.23.8) + abitype: 1.2.0(typescript@5.9.2)(zod@3.23.8) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.2 @@ -12666,7 +12665,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.9.3)(zod@3.25.76) + abitype: 1.2.0(typescript@5.9.3)(zod@3.25.76) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.3 @@ -14047,7 +14046,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: https://pkg.pr.new/abitype@e56c1fa(typescript@5.6.2)(zod@3.25.76) + abitype: 1.2.0(typescript@5.6.2)(zod@3.25.76) isows: 1.0.7(ws@8.18.3) ox: 0.9.6(typescript@5.6.2)(zod@3.25.76) ws: 8.18.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index c537ebf611..2806967449 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -11,6 +11,7 @@ catalog: minimumReleaseAge: 1440 minimumReleaseAgeExclude: - '@vitest/*' + - abitype - glob - hono - vitest diff --git a/src/package.json b/src/package.json index b851a57aa3..364b85c837 100644 --- a/src/package.json +++ b/src/package.json @@ -200,7 +200,7 @@ "@noble/hashes": "1.8.0", "@scure/bip32": "1.7.0", "@scure/bip39": "1.6.0", - "abitype": "https://pkg.pr.new/abitype@e56c1fa", + "abitype": "1.2.0", "isows": "1.0.7", "ox": "0.9.6", "ws": "8.18.3" From e29cc7057ee7acb5346f98905c2d5481262c4eeb Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Wed, 3 Dec 2025 13:39:16 -0500 Subject: [PATCH 3/8] chore: bump abitype --- pnpm-lock.yaml | 50 ++++++++++++++++++++++++------------------------ src/package.json | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0c791edc87..03526e6081 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -564,7 +564,7 @@ importers: version: link:../src vocs: specifier: ^1.1.0 - version: 1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.2) + version: 1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.3) src: dependencies: @@ -581,8 +581,8 @@ importers: specifier: 1.6.0 version: 1.6.0 abitype: - specifier: 1.2.0 - version: 1.2.0(typescript@5.9.3)(zod@3.25.76) + specifier: 1.2.1 + version: 1.2.1(typescript@5.9.3)(zod@3.25.76) isows: specifier: 1.0.7 version: 1.0.7(ws@8.18.3) @@ -3336,8 +3336,8 @@ packages: zod: optional: true - abitype@1.2.0: - resolution: {integrity: sha512-fD3ROjckUrWsybaSor2AdWxzA0e/DSyV2dA4aYd7bd8orHsoJjl09fOgKfUkTDfk0BsDGBf4NBgu/c7JoS2Npw==} + abitype@1.2.1: + resolution: {integrity: sha512-AhkAWBE5QqzSuaPi6B9w5scl5739iBknQdFFAbY/CybASOBVWtVmPavUYW1OrDRX/iZWB/Je80xhJMZz2G4G1Q==} peerDependencies: typescript: '>=5.0.4' zod: ^3.22.0 || ^4.0.0 @@ -9364,11 +9364,11 @@ snapshots: '@shikijs/core': 1.29.2 '@shikijs/types': 1.29.2 - '@shikijs/twoslash@1.29.2(typescript@5.9.2)': + '@shikijs/twoslash@1.29.2(typescript@5.9.3)': dependencies: '@shikijs/core': 1.29.2 '@shikijs/types': 1.29.2 - twoslash: 0.2.12(typescript@5.9.2) + twoslash: 0.2.12(typescript@5.9.3) transitivePeerDependencies: - supports-color - typescript @@ -9764,10 +9764,10 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript/vfs@1.6.1(typescript@5.9.2)': + '@typescript/vfs@1.6.1(typescript@5.9.3)': dependencies: debug: 4.4.3 - typescript: 5.9.2 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -10034,17 +10034,17 @@ snapshots: typescript: 5.9.2 zod: 3.23.8 - abitype@1.2.0(typescript@5.6.2)(zod@3.25.76): + abitype@1.2.1(typescript@5.6.2)(zod@3.25.76): optionalDependencies: typescript: 5.6.2 zod: 3.25.76 - abitype@1.2.0(typescript@5.9.2)(zod@3.23.8): + abitype@1.2.1(typescript@5.9.2)(zod@3.23.8): optionalDependencies: typescript: 5.9.2 zod: 3.23.8 - abitype@1.2.0(typescript@5.9.3)(zod@3.25.76): + abitype@1.2.1(typescript@5.9.3)(zod@3.25.76): optionalDependencies: typescript: 5.9.3 zod: 3.25.76 @@ -12628,7 +12628,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.0(typescript@5.6.2)(zod@3.25.76) + abitype: 1.2.1(typescript@5.6.2)(zod@3.25.76) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.6.2 @@ -12643,7 +12643,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.0(typescript@5.9.2)(zod@3.23.8) + abitype: 1.2.1(typescript@5.9.2)(zod@3.23.8) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.2 @@ -12658,7 +12658,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.0(typescript@5.9.3)(zod@3.25.76) + abitype: 1.2.1(typescript@5.9.3)(zod@3.25.76) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.3 @@ -13834,19 +13834,19 @@ snapshots: twoslash-protocol@0.3.4: {} - twoslash@0.2.12(typescript@5.9.2): + twoslash@0.2.12(typescript@5.9.3): dependencies: - '@typescript/vfs': 1.6.1(typescript@5.9.2) + '@typescript/vfs': 1.6.1(typescript@5.9.3) twoslash-protocol: 0.2.12 - typescript: 5.9.2 + typescript: 5.9.3 transitivePeerDependencies: - supports-color - twoslash@0.3.4(typescript@5.9.2): + twoslash@0.3.4(typescript@5.9.3): dependencies: - '@typescript/vfs': 1.6.1(typescript@5.9.2) + '@typescript/vfs': 1.6.1(typescript@5.9.3) twoslash-protocol: 0.3.4 - typescript: 5.9.2 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -14039,7 +14039,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.0(typescript@5.6.2)(zod@3.25.76) + abitype: 1.2.1(typescript@5.6.2)(zod@3.25.76) isows: 1.0.7(ws@8.18.3) ox: 0.9.6(typescript@5.6.2)(zod@3.25.76) ws: 8.18.3 @@ -14158,7 +14158,7 @@ snapshots: - tsx - yaml - vocs@1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.2): + vocs@1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.3): dependencies: '@floating-ui/react': 0.27.16(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@hono/node-server': 1.19.5(hono@4.10.3) @@ -14176,7 +14176,7 @@ snapshots: '@radix-ui/react-tabs': 1.1.3(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@shikijs/rehype': 1.29.2 '@shikijs/transformers': 1.29.2 - '@shikijs/twoslash': 1.29.2(typescript@5.9.2) + '@shikijs/twoslash': 1.29.2(typescript@5.9.3) '@tailwindcss/vite': 4.1.15(vite@7.1.11(@types/node@24.5.2)(jiti@2.6.0)(lightningcss@1.30.2)(terser@5.36.0)(yaml@2.8.1)) '@vanilla-extract/css': 1.17.4 '@vanilla-extract/dynamic': 2.1.5 @@ -14226,7 +14226,7 @@ snapshots: serve-static: 1.16.2 shiki: 1.29.2 toml: 3.0.0 - twoslash: 0.3.4(typescript@5.9.2) + twoslash: 0.3.4(typescript@5.9.3) ua-parser-js: 1.0.40 unified: 11.0.5 unist-util-visit: 5.0.0 diff --git a/src/package.json b/src/package.json index ca417b167d..c6a6f0d852 100644 --- a/src/package.json +++ b/src/package.json @@ -200,7 +200,7 @@ "@noble/hashes": "1.8.0", "@scure/bip32": "1.7.0", "@scure/bip39": "1.6.0", - "abitype": "1.2.0", + "abitype": "1.2.1", "isows": "1.0.7", "ox": "0.9.6", "ws": "8.18.3" From 239bb7215dd5e49458e0293f884e1a12e83642dc Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Thu, 4 Dec 2025 16:47:50 -0500 Subject: [PATCH 4/8] fix: lsp hover/twoslash for abi overloads --- src/actions/public/readContract.test-d.ts | 4 ++-- src/actions/wallet/writeContract.test-d.ts | 8 +++---- src/types/contract.ts | 27 +++++++++++++++------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/actions/public/readContract.test-d.ts b/src/actions/public/readContract.test-d.ts index c7562e3aed..522e0a09d0 100644 --- a/src/actions/public/readContract.test-d.ts +++ b/src/actions/public/readContract.test-d.ts @@ -207,7 +207,7 @@ test('behavior', () => { name: 'bar', type: 'function', stateMutability: 'view', - inputs: [{ type: 'address', name: '' }], + inputs: [{ type: 'address', name: 'account' }], outputs: [{ type: 'address', name: '' }], }, ], @@ -232,7 +232,7 @@ test('behavior', () => { const abi = parseAbi([ 'function foo() view returns (int8)', 'function foo(address tokenId) view returns (string)', - 'function foo(address, address) view returns ((address foo, address bar))', + 'function foo(address spender, address account) view returns ((address foo, address bar))', 'function bar() view returns (int8)', ]) diff --git a/src/actions/wallet/writeContract.test-d.ts b/src/actions/wallet/writeContract.test-d.ts index 45c6c266ed..298161a211 100644 --- a/src/actions/wallet/writeContract.test-d.ts +++ b/src/actions/wallet/writeContract.test-d.ts @@ -88,8 +88,8 @@ test('infers args', () => { transport: custom(window.ethereum!), }) const abi = parseAbi([ - 'function foo(address) payable returns (int8)', - 'function bar(address, uint256) returns (int8)', + 'function foo(address account) payable returns (int8)', + 'function bar(address account, uint256 amount) returns (int8)', ]) type Result1 = WriteContractParameters @@ -275,8 +275,8 @@ test('overloads', async () => { }) const abi = parseAbi([ 'function foo() returns (int8)', - 'function foo(address) returns (string)', - 'function foo(address, address) returns ((address foo, address bar))', + 'function foo(address account) returns (string)', + 'function foo(address sender, address account) returns ((address foo, address bar))', 'function bar() returns (int8)', ]) diff --git a/src/types/contract.ts b/src/types/contract.ts index a5eabfd286..08fedbc935 100644 --- a/src/types/contract.ts +++ b/src/types/contract.ts @@ -217,15 +217,26 @@ export type ContractFunctionParameters< functionName: | allFunctionNames // show all options | (functionName extends allFunctionNames ? functionName : never) // infer value - args?: - | (abi extends Abi - ? UnionWiden extends true ? args : allArgs> - : never) - | allArgs - | undefined } & (readonly [] extends allArgs - ? {} - : { args: Widen extends true ? args : allArgs> }) & + ? { + args?: + | allArgs + | (abi extends Abi + ? Abi extends abi + ? never + : UnionWiden extends true ? args : allArgs> + : never) + | undefined + } + : { + args: + | allArgs + | (abi extends Abi + ? Abi extends abi + ? never + : Widen extends true ? args : allArgs> + : never) + }) & (deployless extends true ? { address?: undefined; code: Hex } : { address: Address }) From 576aaaebf9e32299dae477997ed25a65ccd953b2 Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Thu, 4 Dec 2025 16:52:54 -0500 Subject: [PATCH 5/8] chore: bump next --- pnpm-lock.yaml | 167 ++++++++++++++++++++++--------------------------- 1 file changed, 74 insertions(+), 93 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 03526e6081..48558c0b99 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -135,7 +135,7 @@ importers: dependencies: next: specifier: ^15.5.4 - version: 15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 15.5.7(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react: specifier: ^19 version: 19.0.0 @@ -200,7 +200,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -213,7 +213,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -226,7 +226,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -239,7 +239,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -252,7 +252,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -271,7 +271,7 @@ importers: version: 19.0.0(react@19.0.0) viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: '@types/react': specifier: ^19 @@ -299,7 +299,7 @@ importers: version: 19.0.0(react@19.0.0) viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: '@types/react': specifier: ^19 @@ -321,7 +321,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -334,7 +334,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -353,7 +353,7 @@ importers: version: 19.0.0(react@19.0.0) viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: '@types/react': specifier: ^19 @@ -375,7 +375,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -388,7 +388,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -401,7 +401,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -414,7 +414,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -461,7 +461,7 @@ importers: version: 19.0.0(react@19.0.0) viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: '@types/react': specifier: ^19 @@ -489,7 +489,7 @@ importers: version: 19.0.0(react@19.0.0) viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: '@types/react': specifier: ^19 @@ -511,7 +511,7 @@ importers: dependencies: viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: typescript: specifier: ^5.0.3 @@ -530,7 +530,7 @@ importers: version: 19.0.0(react@19.0.0) viem: specifier: latest - version: 2.40.3(typescript@5.6.2)(zod@3.25.76) + version: 2.41.2(typescript@5.6.2)(zod@3.25.76) devDependencies: '@types/react': specifier: ^19 @@ -564,7 +564,7 @@ importers: version: link:../src vocs: specifier: ^1.1.0 - version: 1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.3) + version: 1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.7(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.3) src: dependencies: @@ -1486,57 +1486,57 @@ packages: '@napi-rs/wasm-runtime@1.0.5': resolution: {integrity: sha512-TBr9Cf9onSAS2LQ2+QHx6XcC6h9+RIzJgbqG3++9TUZSH204AwEy5jg3BTQ0VATsyoGj4ee49tN/y6rvaOOtcg==} - '@next/env@15.5.4': - resolution: {integrity: sha512-27SQhYp5QryzIT5uO8hq99C69eLQ7qkzkDPsk3N+GuS2XgOgoYEeOav7Pf8Tn4drECOVDsDg8oj+/DVy8qQL2A==} + '@next/env@15.5.7': + resolution: {integrity: sha512-4h6Y2NyEkIEN7Z8YxkA27pq6zTkS09bUSYC0xjd0NpwFxjnIKeZEeH591o5WECSmjpUhLn3H2QLJcDye3Uzcvg==} - '@next/swc-darwin-arm64@15.5.4': - resolution: {integrity: sha512-nopqz+Ov6uvorej8ndRX6HlxCYWCO3AHLfKK2TYvxoSB2scETOcfm/HSS3piPqc3A+MUgyHoqE6je4wnkjfrOA==} + '@next/swc-darwin-arm64@15.5.7': + resolution: {integrity: sha512-IZwtxCEpI91HVU/rAUOOobWSZv4P2DeTtNaCdHqLcTJU4wdNXgAySvKa/qJCgR5m6KI8UsKDXtO2B31jcaw1Yw==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@15.5.4': - resolution: {integrity: sha512-QOTCFq8b09ghfjRJKfb68kU9k2K+2wsC4A67psOiMn849K9ZXgCSRQr0oVHfmKnoqCbEmQWG1f2h1T2vtJJ9mA==} + '@next/swc-darwin-x64@15.5.7': + resolution: {integrity: sha512-UP6CaDBcqaCBuiq/gfCEJw7sPEoX1aIjZHnBWN9v9qYHQdMKvCKcAVs4OX1vIjeE+tC5EIuwDTVIoXpUes29lg==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@15.5.4': - resolution: {integrity: sha512-eRD5zkts6jS3VfE/J0Kt1VxdFqTnMc3QgO5lFE5GKN3KDI/uUpSyK3CjQHmfEkYR4wCOl0R0XrsjpxfWEA++XA==} + '@next/swc-linux-arm64-gnu@15.5.7': + resolution: {integrity: sha512-NCslw3GrNIw7OgmRBxHtdWFQYhexoUCq+0oS2ccjyYLtcn1SzGzeM54jpTFonIMUjNbHmpKpziXnpxhSWLcmBA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] libc: [glibc] - '@next/swc-linux-arm64-musl@15.5.4': - resolution: {integrity: sha512-TOK7iTxmXFc45UrtKqWdZ1shfxuL4tnVAOuuJK4S88rX3oyVV4ZkLjtMT85wQkfBrOOvU55aLty+MV8xmcJR8A==} + '@next/swc-linux-arm64-musl@15.5.7': + resolution: {integrity: sha512-nfymt+SE5cvtTrG9u1wdoxBr9bVB7mtKTcj0ltRn6gkP/2Nu1zM5ei8rwP9qKQP0Y//umK+TtkKgNtfboBxRrw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] libc: [musl] - '@next/swc-linux-x64-gnu@15.5.4': - resolution: {integrity: sha512-7HKolaj+481FSW/5lL0BcTkA4Ueam9SPYWyN/ib/WGAFZf0DGAN8frNpNZYFHtM4ZstrHZS3LY3vrwlIQfsiMA==} + '@next/swc-linux-x64-gnu@15.5.7': + resolution: {integrity: sha512-hvXcZvCaaEbCZcVzcY7E1uXN9xWZfFvkNHwbe/n4OkRhFWrs1J1QV+4U1BN06tXLdaS4DazEGXwgqnu/VMcmqw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] libc: [glibc] - '@next/swc-linux-x64-musl@15.5.4': - resolution: {integrity: sha512-nlQQ6nfgN0nCO/KuyEUwwOdwQIGjOs4WNMjEUtpIQJPR2NUfmGpW2wkJln1d4nJ7oUzd1g4GivH5GoEPBgfsdw==} + '@next/swc-linux-x64-musl@15.5.7': + resolution: {integrity: sha512-4IUO539b8FmF0odY6/SqANJdgwn1xs1GkPO5doZugwZ3ETF6JUdckk7RGmsfSf7ws8Qb2YB5It33mvNL/0acqA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] libc: [musl] - '@next/swc-win32-arm64-msvc@15.5.4': - resolution: {integrity: sha512-PcR2bN7FlM32XM6eumklmyWLLbu2vs+D7nJX8OAIoWy69Kef8mfiN4e8TUv2KohprwifdpFKPzIP1njuCjD0YA==} + '@next/swc-win32-arm64-msvc@15.5.7': + resolution: {integrity: sha512-CpJVTkYI3ZajQkC5vajM7/ApKJUOlm6uP4BknM3XKvJ7VXAvCqSjSLmM0LKdYzn6nBJVSjdclx8nYJSa3xlTgQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-x64-msvc@15.5.4': - resolution: {integrity: sha512-1ur2tSHZj8Px/KMAthmuI9FMp/YFusMMGoRNJaRZMOlSkgvLjzosSdQI0cJAKogdHl3qXUQKL9MGaYvKwA7DXg==} + '@next/swc-win32-x64-msvc@15.5.7': + resolution: {integrity: sha512-gMzgBX164I6DN+9/PGA+9dQiwmTkE4TloBNx8Kv9UiGARsr9Nba7IpcBRA1iTV9vwlYnrE3Uy6I7Aj6qLjQuqw==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -3600,9 +3600,6 @@ packages: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} - caniuse-lite@1.0.30001701: - resolution: {integrity: sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw==} - caniuse-lite@1.0.30001751: resolution: {integrity: sha512-A0QJhug0Ly64Ii3eIqHu5X51ebln3k4yTUkY1j8drqpWHVreg/VLijN48cZ1bYPiqOQuqpkIKnzr/Ul8V+p6Cw==} @@ -4064,10 +4061,6 @@ packages: resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} engines: {node: '>=8'} - detect-libc@2.0.3: - resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==} - engines: {node: '>=8'} - detect-libc@2.1.1: resolution: {integrity: sha512-ecqj/sy1jcK1uWrwpR67UhYrIFQ+5WlGxth34WquCbamhFA6hkkwiu37o6J5xCHdo1oixJRfVRw+ywV+Hq/0Aw==} engines: {node: '>=8'} @@ -5389,11 +5382,6 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - nanoid@3.3.8: - resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - nanoid@5.0.9: resolution: {integrity: sha512-Aooyr6MXU6HpvvWXKoVoXwKMs/KyVakWwg7xQfv5/S/RIgJMy0Ifa45H9qqYy7pTCszrHzP21Uk4PZq2HpEM8Q==} engines: {node: ^18 || >=20} @@ -5423,8 +5411,8 @@ packages: resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==} engines: {node: '>= 0.4.0'} - next@15.5.4: - resolution: {integrity: sha512-xH4Yjhb82sFYQfY3vbkJfgSDgXvBB6a8xPs9i35k6oZJRoQRihZH+4s9Yo2qsWpzBmZ3lPXaJ2KPXLfkvW4LnA==} + next@15.5.7: + resolution: {integrity: sha512-+t2/0jIJ48kUpGKkdlhgkv+zPTEOoXyr60qXe68eB/pl3CMJaLeIGjzp5D6Oqt25hCBiBTt8wEeeAzfJvUKnPQ==} engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} hasBin: true peerDependencies: @@ -6692,8 +6680,8 @@ packages: vfile@6.0.3: resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} - viem@2.40.3: - resolution: {integrity: sha512-feYfEpbgjRkZYQpwcgxqkWzjxHI5LSDAjcGetHHwDRuX9BRQHUdV8ohrCosCYpdEhus/RknD3/bOd4qLYVPPuA==} + viem@2.41.2: + resolution: {integrity: sha512-LYliajglBe1FU6+EH9mSWozp+gRA/QcHfxeD9Odf83AdH5fwUS7DroH4gHvlv6Sshqi1uXrYFA2B/EOczxd15g==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -7990,30 +7978,30 @@ snapshots: '@tybys/wasm-util': 0.10.1 optional: true - '@next/env@15.5.4': {} + '@next/env@15.5.7': {} - '@next/swc-darwin-arm64@15.5.4': + '@next/swc-darwin-arm64@15.5.7': optional: true - '@next/swc-darwin-x64@15.5.4': + '@next/swc-darwin-x64@15.5.7': optional: true - '@next/swc-linux-arm64-gnu@15.5.4': + '@next/swc-linux-arm64-gnu@15.5.7': optional: true - '@next/swc-linux-arm64-musl@15.5.4': + '@next/swc-linux-arm64-musl@15.5.7': optional: true - '@next/swc-linux-x64-gnu@15.5.4': + '@next/swc-linux-x64-gnu@15.5.7': optional: true - '@next/swc-linux-x64-musl@15.5.4': + '@next/swc-linux-x64-musl@15.5.7': optional: true - '@next/swc-win32-arm64-msvc@15.5.4': + '@next/swc-win32-arm64-msvc@15.5.7': optional: true - '@next/swc-win32-x64-msvc@15.5.4': + '@next/swc-win32-x64-msvc@15.5.7': optional: true '@noble/ciphers@1.3.0': {} @@ -8421,7 +8409,7 @@ snapshots: pino-pretty: 10.3.1 prom-client: 14.2.0 type-fest: 4.39.0 - viem: 2.40.3(typescript@5.9.2)(zod@3.23.8) + viem: 2.41.2(typescript@5.9.2)(zod@3.23.8) yargs: 17.7.2 zod: 3.23.8 zod-validation-error: 1.5.0(zod@3.23.8) @@ -8490,7 +8478,7 @@ snapshots: extract-zip: 2.0.1 progress: 2.0.3 proxy-agent: 6.4.0 - semver: 7.6.3 + semver: 7.7.2 tar-fs: 3.1.1 unbzip2-stream: 1.4.3 yargs: 17.7.2 @@ -10238,14 +10226,14 @@ snapshots: browserslist@4.24.2: dependencies: - caniuse-lite: 1.0.30001701 + caniuse-lite: 1.0.30001751 electron-to-chromium: 1.5.50 node-releases: 2.0.18 update-browserslist-db: 1.1.1(browserslist@4.24.2) browserslist@4.24.4: dependencies: - caniuse-lite: 1.0.30001701 + caniuse-lite: 1.0.30001751 electron-to-chromium: 1.5.107 node-releases: 2.0.19 update-browserslist-db: 1.1.3(browserslist@4.24.4) @@ -10301,8 +10289,6 @@ snapshots: cac@6.7.14: {} - caniuse-lite@1.0.30001701: {} - caniuse-lite@1.0.30001751: {} ccount@2.0.1: {} @@ -10728,9 +10714,6 @@ snapshots: detect-indent@6.1.0: {} - detect-libc@2.0.3: - optional: true - detect-libc@2.1.1: {} detect-node-es@1.1.0: {} @@ -12475,8 +12458,6 @@ snapshots: nanoid@3.3.11: {} - nanoid@3.3.8: {} - nanoid@5.0.9: {} nanoid@5.1.6: {} @@ -12493,24 +12474,24 @@ snapshots: netmask@2.0.2: {} - next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + next@15.5.7(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: - '@next/env': 15.5.4 + '@next/env': 15.5.7 '@swc/helpers': 0.5.15 - caniuse-lite: 1.0.30001701 + caniuse-lite: 1.0.30001751 postcss: 8.4.31 react: 19.0.0 react-dom: 19.0.0(react@19.0.0) styled-jsx: 5.1.6(react@19.0.0) optionalDependencies: - '@next/swc-darwin-arm64': 15.5.4 - '@next/swc-darwin-x64': 15.5.4 - '@next/swc-linux-arm64-gnu': 15.5.4 - '@next/swc-linux-arm64-musl': 15.5.4 - '@next/swc-linux-x64-gnu': 15.5.4 - '@next/swc-linux-x64-musl': 15.5.4 - '@next/swc-win32-arm64-msvc': 15.5.4 - '@next/swc-win32-x64-msvc': 15.5.4 + '@next/swc-darwin-arm64': 15.5.7 + '@next/swc-darwin-x64': 15.5.7 + '@next/swc-linux-arm64-gnu': 15.5.7 + '@next/swc-linux-arm64-musl': 15.5.7 + '@next/swc-linux-x64-gnu': 15.5.7 + '@next/swc-linux-x64-musl': 15.5.7 + '@next/swc-win32-arm64-msvc': 15.5.7 + '@next/swc-win32-x64-msvc': 15.5.7 '@opentelemetry/api': 1.7.0 '@playwright/test': 1.55.1 sharp: 0.34.4 @@ -12531,7 +12512,7 @@ snapshots: node-gyp-build-optional-packages@5.2.2: dependencies: - detect-libc: 2.0.3 + detect-libc: 2.1.1 optional: true node-releases@2.0.18: {} @@ -12566,12 +12547,12 @@ snapshots: dependencies: boolbase: 1.0.0 - nuqs@2.7.2(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-router@7.9.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0): + nuqs@2.7.2(next@15.5.7(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-router@7.9.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0): dependencies: '@standard-schema/spec': 1.0.0 react: 19.0.0 optionalDependencies: - next: 15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + next: 15.5.7(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react-router: 7.9.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0) object-assign@4.1.1: {} @@ -12896,7 +12877,7 @@ snapshots: postcss@8.4.31: dependencies: - nanoid: 3.3.8 + nanoid: 3.3.11 picocolors: 1.1.1 source-map-js: 1.2.1 @@ -13999,7 +13980,7 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - viem@2.40.3(typescript@5.6.2)(zod@3.25.76): + viem@2.41.2(typescript@5.6.2)(zod@3.25.76): dependencies: '@noble/curves': 1.9.1 '@noble/hashes': 1.8.0 @@ -14016,7 +13997,7 @@ snapshots: - utf-8-validate - zod - viem@2.40.3(typescript@5.9.2)(zod@3.23.8): + viem@2.41.2(typescript@5.9.2)(zod@3.23.8): dependencies: '@noble/curves': 1.9.1 '@noble/hashes': 1.8.0 @@ -14158,7 +14139,7 @@ snapshots: - tsx - yaml - vocs@1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.3): + vocs@1.1.0(@types/node@24.5.2)(@types/react-dom@19.0.3(@types/react@19.0.8))(@types/react@19.0.8)(jiti@2.6.0)(lightningcss@1.30.2)(next@15.5.7(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(rollup@4.52.2)(terser@5.36.0)(typescript@5.9.3): dependencies: '@floating-ui/react': 0.27.16(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@hono/node-server': 1.19.5(hono@4.10.3) @@ -14202,7 +14183,7 @@ snapshots: mdast-util-to-hast: 13.2.1 mdast-util-to-markdown: 2.1.2 minisearch: 7.2.0 - nuqs: 2.7.2(next@15.5.4(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-router@7.9.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0) + nuqs: 2.7.2(next@15.5.7(@opentelemetry/api@1.7.0)(@playwright/test@1.55.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react-router@7.9.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0) ora: 7.0.1 p-limit: 5.0.0 picomatch: 4.0.3 From 3a62d00c07c85dcc52d0762ad0e788c5a98ba27f Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Mon, 8 Dec 2025 00:48:02 -0500 Subject: [PATCH 6/8] chore: changeset --- .changeset/angry-squids-rescue.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/angry-squids-rescue.md diff --git a/.changeset/angry-squids-rescue.md b/.changeset/angry-squids-rescue.md new file mode 100644 index 0000000000..0a8626dbc2 --- /dev/null +++ b/.changeset/angry-squids-rescue.md @@ -0,0 +1,5 @@ +--- +"viem": minor +--- + +Added experimental named tuple support for contract-related actions and utilities. From 3c95c113a297a09efa4de86061b073a59ce19b49 Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Tue, 9 Dec 2025 15:59:37 -0500 Subject: [PATCH 7/8] chore: bump abitype --- pnpm-lock.yaml | 22 +++++++++++----------- src/package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 48558c0b99..496f8d2f54 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -581,8 +581,8 @@ importers: specifier: 1.6.0 version: 1.6.0 abitype: - specifier: 1.2.1 - version: 1.2.1(typescript@5.9.3)(zod@3.25.76) + specifier: 1.2.2 + version: 1.2.2(typescript@5.9.3)(zod@3.25.76) isows: specifier: 1.0.7 version: 1.0.7(ws@8.18.3) @@ -3336,8 +3336,8 @@ packages: zod: optional: true - abitype@1.2.1: - resolution: {integrity: sha512-AhkAWBE5QqzSuaPi6B9w5scl5739iBknQdFFAbY/CybASOBVWtVmPavUYW1OrDRX/iZWB/Je80xhJMZz2G4G1Q==} + abitype@1.2.2: + resolution: {integrity: sha512-4DOIMWscIB3j8hboLAUjLZCE8TMLdgecBpHFumfU4PdO/C1SBCVx4Nu1wPYXaL2iK8B0Jk3tiwnDLCpUtm3fZg==} peerDependencies: typescript: '>=5.0.4' zod: ^3.22.0 || ^4.0.0 @@ -10022,17 +10022,17 @@ snapshots: typescript: 5.9.2 zod: 3.23.8 - abitype@1.2.1(typescript@5.6.2)(zod@3.25.76): + abitype@1.2.2(typescript@5.6.2)(zod@3.25.76): optionalDependencies: typescript: 5.6.2 zod: 3.25.76 - abitype@1.2.1(typescript@5.9.2)(zod@3.23.8): + abitype@1.2.2(typescript@5.9.2)(zod@3.23.8): optionalDependencies: typescript: 5.9.2 zod: 3.23.8 - abitype@1.2.1(typescript@5.9.3)(zod@3.25.76): + abitype@1.2.2(typescript@5.9.3)(zod@3.25.76): optionalDependencies: typescript: 5.9.3 zod: 3.25.76 @@ -12609,7 +12609,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.1(typescript@5.6.2)(zod@3.25.76) + abitype: 1.2.2(typescript@5.6.2)(zod@3.25.76) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.6.2 @@ -12624,7 +12624,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.1(typescript@5.9.2)(zod@3.23.8) + abitype: 1.2.2(typescript@5.9.2)(zod@3.23.8) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.2 @@ -12639,7 +12639,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.1(typescript@5.9.3)(zod@3.25.76) + abitype: 1.2.2(typescript@5.9.3)(zod@3.25.76) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.3 @@ -14020,7 +14020,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.1(typescript@5.6.2)(zod@3.25.76) + abitype: 1.2.2(typescript@5.6.2)(zod@3.25.76) isows: 1.0.7(ws@8.18.3) ox: 0.9.6(typescript@5.6.2)(zod@3.25.76) ws: 8.18.3 diff --git a/src/package.json b/src/package.json index c6a6f0d852..0e25d806ab 100644 --- a/src/package.json +++ b/src/package.json @@ -200,7 +200,7 @@ "@noble/hashes": "1.8.0", "@scure/bip32": "1.7.0", "@scure/bip39": "1.6.0", - "abitype": "1.2.1", + "abitype": "1.2.2", "isows": "1.0.7", "ox": "0.9.6", "ws": "8.18.3" From 9727cee0c50b350ff5eeb05cc6e44ffd09ed27ba Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Mon, 15 Dec 2025 19:35:31 -0500 Subject: [PATCH 8/8] chore: up --- .github/actions/setup-wagmi/action.yml | 5 --- .github/workflows/verify.yml | 2 +- pnpm-lock.yaml | 22 ++++++------ src/actions/public/readContract.bench-d.ts | 33 +++++++++++++++--- src/actions/public/simulateContract.ts | 8 ++--- src/actions/public/verifyHash.ts | 4 +-- src/actions/wallet/writeContract.bench-d.ts | 37 +++++++++++++++++++++ src/actions/wallet/writeContract.test-d.ts | 8 ++++- src/package.json | 2 +- src/types/contract.ts | 17 +++++----- 10 files changed, 99 insertions(+), 39 deletions(-) create mode 100644 src/actions/wallet/writeContract.bench-d.ts diff --git a/.github/actions/setup-wagmi/action.yml b/.github/actions/setup-wagmi/action.yml index ed075e95ec..299e23c6dd 100644 --- a/.github/actions/setup-wagmi/action.yml +++ b/.github/actions/setup-wagmi/action.yml @@ -33,11 +33,6 @@ runs: run: pnpm install --no-frozen-lockfile working-directory: ./wagmi - - name: Build packages - shell: bash - run: pnpm build - working-directory: ./wagmi - - name: Link packages shell: bash run: pnpm preconstruct diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 04a7959472..a54b0d9318 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -227,7 +227,7 @@ jobs: timeout-minutes: 10 strategy: matrix: - typescript-version: ['5.7.2', '5.8.2', '5.9.2', 'latest'] + typescript-version: ['5.7.2', '5.8.3', '5.9.2', 'latest'] steps: - name: Clone repository diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9efd350098..0640e55fc5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -581,8 +581,8 @@ importers: specifier: 1.6.0 version: 1.6.0 abitype: - specifier: 1.2.2 - version: 1.2.2(typescript@5.9.3)(zod@3.25.76) + specifier: 1.2.3 + version: 1.2.3(typescript@5.9.3)(zod@3.25.76) isows: specifier: 1.0.7 version: 1.0.7(ws@8.18.3) @@ -3329,8 +3329,8 @@ packages: zod: optional: true - abitype@1.2.2: - resolution: {integrity: sha512-4DOIMWscIB3j8hboLAUjLZCE8TMLdgecBpHFumfU4PdO/C1SBCVx4Nu1wPYXaL2iK8B0Jk3tiwnDLCpUtm3fZg==} + abitype@1.2.3: + resolution: {integrity: sha512-Ofer5QUnuUdTFsBRwARMoWKOH1ND5ehwYhJ3OJ/BQO+StkwQjHw0XyVh4vDttzHB7QOFhPHa/o413PJ82gU/Tg==} peerDependencies: typescript: '>=5.0.4' zod: ^3.22.0 || ^4.0.0 @@ -10007,17 +10007,17 @@ snapshots: typescript: 5.9.3 zod: 3.23.8 - abitype@1.2.2(typescript@5.6.2)(zod@3.25.76): + abitype@1.2.3(typescript@5.6.2)(zod@3.25.76): optionalDependencies: typescript: 5.6.2 zod: 3.25.76 - abitype@1.2.2(typescript@5.9.3)(zod@3.23.8): + abitype@1.2.3(typescript@5.9.3)(zod@3.23.8): optionalDependencies: typescript: 5.9.3 zod: 3.23.8 - abitype@1.2.2(typescript@5.9.3)(zod@3.25.76): + abitype@1.2.3(typescript@5.9.3)(zod@3.25.76): optionalDependencies: typescript: 5.9.3 zod: 3.25.76 @@ -12599,7 +12599,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.2(typescript@5.6.2)(zod@3.25.76) + abitype: 1.2.3(typescript@5.6.2)(zod@3.25.76) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.6.2 @@ -12614,7 +12614,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.2(typescript@5.9.3)(zod@3.23.8) + abitype: 1.2.3(typescript@5.9.3)(zod@3.23.8) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.3 @@ -12629,7 +12629,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.2(typescript@5.9.3)(zod@3.25.76) + abitype: 1.2.3(typescript@5.9.3)(zod@3.25.76) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.3 @@ -14008,7 +14008,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.2.2(typescript@5.6.2)(zod@3.25.76) + abitype: 1.2.3(typescript@5.6.2)(zod@3.25.76) isows: 1.0.7(ws@8.18.3) ox: 0.9.6(typescript@5.6.2)(zod@3.25.76) ws: 8.18.3 diff --git a/src/actions/public/readContract.bench-d.ts b/src/actions/public/readContract.bench-d.ts index 9b00631339..895ff7d8de 100644 --- a/src/actions/public/readContract.bench-d.ts +++ b/src/actions/public/readContract.bench-d.ts @@ -1,20 +1,43 @@ import { attest } from '@ark/attest' +import { parseAbi } from 'abitype' +import { erc20Abi } from 'abitype/abis' import { test } from 'vitest' - -import { usdcContractConfig } from '~test/abis.js' import { mainnet } from '../../chains/index.js' import { createClient } from '../../clients/createClient.js' import { http } from '../../clients/transports/http.js' -import { readContract } from './readContract.js' +import { type ReadContractParameters, readContract } from './readContract.js' const client = createClient({ chain: mainnet, transport: http() }) test('return type', () => { const res = readContract(client, { - ...usdcContractConfig, + address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', + abi: erc20Abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) - attest.instantiations([53192, 'instantiations']) + attest.instantiations([63834, 'instantiations']) attest>(res) }) + +const abi = parseAbi([ + 'function foo() view returns (int8)', + 'function foo(address account) view returns (string)', + 'function foo(address sender, address account) view returns ((address foo, address bar))', + 'function bar() view returns (int8)', +]) +test('overloads', () => { + type Result = ReadContractParameters + const res = {} as Result + attest.instantiations([14699, 'instantiations']) + attest< + | readonly [] + | readonly [account: `0x${string}`] + | readonly [sender: `0x${string}`, account: `0x${string}`] + | undefined + >(res.args) + attest(res.args).type.toString.snap(` | readonly [] + | readonly [account: \`0x\${string}\`] + | readonly [sender: \`0x\${string}\`, account: \`0x\${string}\`] + | undefined`) +}) diff --git a/src/actions/public/simulateContract.ts b/src/actions/public/simulateContract.ts index 6bc19f24a2..ca8fda32a7 100644 --- a/src/actions/public/simulateContract.ts +++ b/src/actions/public/simulateContract.ts @@ -83,6 +83,8 @@ export type SimulateContractParameters< accountOverride extends Account | Address | null | undefined = undefined, /// derivedChain extends Chain | undefined = DeriveChain, + callParameters extends + CallParameters = CallParameters, > = { account?: accountOverride | null | undefined chain?: chainOverride | undefined @@ -95,7 +97,7 @@ export type SimulateContractParameters< args > & UnionOmit< - CallParameters, + callParameters, | 'account' | 'batch' | 'code' @@ -109,9 +111,7 @@ export type SimulateContractParameters< abi, 'nonpayable' | 'payable', functionName, - CallParameters extends CallParameters - ? CallParameters['value'] - : CallParameters['value'], + callParameters['value'], args > diff --git a/src/actions/public/verifyHash.ts b/src/actions/public/verifyHash.ts index f09d94f313..9c405fee9b 100644 --- a/src/actions/public/verifyHash.ts +++ b/src/actions/public/verifyHash.ts @@ -223,13 +223,13 @@ export async function verifyErc8010( args: [ [ ...(initData - ? [ + ? ([ { allowFailure: true, target: to ?? address, callData: initData, }, - ] + ] as const) : []), { allowFailure: true, diff --git a/src/actions/wallet/writeContract.bench-d.ts b/src/actions/wallet/writeContract.bench-d.ts new file mode 100644 index 0000000000..cf40d8e6ab --- /dev/null +++ b/src/actions/wallet/writeContract.bench-d.ts @@ -0,0 +1,37 @@ +import { attest } from '@ark/attest' +import { parseAbi } from 'abitype' +import type { erc20Abi } from 'abitype/abis' +import { test } from 'vitest' +import type { WriteContractParameters } from './writeContract.js' + +test('default', () => { + type Result = WriteContractParameters + const res = {} as Result + attest.instantiations([9217, 'instantiations']) + attest(res.args) + attest(res.args).type.toString.snap( + `readonly [spender: \`0x\${string}\`, amount: bigint]`, + ) +}) + +const abi = parseAbi([ + 'function foo() returns (int8)', + 'function foo(address account) returns (string)', + 'function foo(address sender, address account) returns ((address foo, address bar))', + 'function bar() returns (int8)', +]) +test('overloads', () => { + type Result = WriteContractParameters + const res = {} as Result + attest.instantiations([14699, 'instantiations']) + attest< + | readonly [] + | readonly [account: `0x${string}`] + | readonly [sender: `0x${string}`, account: `0x${string}`] + | undefined + >(res.args) + attest(res.args).type.toString.snap(` | readonly [] + | readonly [account: \`0x\${string}\`] + | readonly [sender: \`0x\${string}\`, account: \`0x\${string}\`] + | undefined`) +}) diff --git a/src/actions/wallet/writeContract.test-d.ts b/src/actions/wallet/writeContract.test-d.ts index 77a299a07a..fe1f712d79 100644 --- a/src/actions/wallet/writeContract.test-d.ts +++ b/src/actions/wallet/writeContract.test-d.ts @@ -1,5 +1,5 @@ import { type Address, parseAbi } from 'abitype' -import { seaportAbi } from 'abitype/abis' +import { erc20Abi, seaportAbi } from 'abitype/abis' import { assertType, expectTypeOf, test } from 'vitest' import { baycContractConfig, wagmiContractConfig } from '~test/abis.js' import { anvilMainnet } from '~test/anvil.js' @@ -13,6 +13,12 @@ import { type WriteContractParameters, writeContract } from './writeContract.js' const clientWithAccount = anvilMainnet.getClient({ account: true, }) +writeContract(clientWithAccount, { + address: '0x', + abi: erc20Abi, + functionName: 'approve', + args: ['0x', 123n], +}) test('WriteContractParameters', async () => { type Result = WriteContractParameters diff --git a/src/package.json b/src/package.json index 7b76cf830a..3705231501 100644 --- a/src/package.json +++ b/src/package.json @@ -200,7 +200,7 @@ "@noble/hashes": "1.8.0", "@scure/bip32": "1.7.0", "@scure/bip39": "1.6.0", - "abitype": "1.2.2", + "abitype": "1.2.3", "isows": "1.0.7", "ox": "0.9.6", "ws": "8.18.3" diff --git a/src/types/contract.ts b/src/types/contract.ts index 08fedbc935..06f95dd92e 100644 --- a/src/types/contract.ts +++ b/src/types/contract.ts @@ -229,17 +229,16 @@ export type ContractFunctionParameters< | undefined } : { - args: - | allArgs - | (abi extends Abi - ? Abi extends abi - ? never - : Widen extends true ? args : allArgs> - : never) + args: args }) & (deployless extends true - ? { address?: undefined; code: Hex } - : { address: Address }) + ? { + address?: undefined + code: Hex + } + : { + address: Address + }) export type ContractFunctionReturnType< abi extends Abi | readonly unknown[] = Abi,