From b8a6158d63738ebfc1e7eb221909436d050c7e39 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 15 Aug 2023 08:18:12 -0700 Subject: [PATCH] feat: bump viem to 1.6.0 (#1308) --- .changeset/lazy-ladybugs-return.md | 6 ++ .changeset/red-turkeys-develop.md | 14 ++++ .changeset/sharp-worms-kneel.md | 7 ++ .changeset/spotty-cups-destroy.md | 5 ++ e2e/packages/client-vanilla/package.json | 2 +- e2e/packages/sync-test/package.json | 2 +- e2e/pnpm-lock.yaml | 29 ++++++-- .../packages/client-phaser/package.json | 2 +- .../packages/client-react/package.json | 2 +- .../packages/client-vanilla/package.json | 2 +- examples/minimal/pnpm-lock.yaml | 36 +++++++--- packages/block-logs-stream/README.md | 13 +--- packages/block-logs-stream/package.json | 2 +- .../block-logs-stream/src/blockRangeToLogs.ts | 4 +- .../src/createBlockStream.ts | 11 +-- packages/block-logs-stream/src/fetchLogs.ts | 12 ++-- packages/block-logs-stream/src/getLogs.ts | 72 ------------------- .../src/groupLogsByBlockNumber.test.ts | 56 +-------------- .../src/groupLogsByBlockNumber.ts | 25 +++---- packages/block-logs-stream/src/index.ts | 3 - .../src/isNonPendingBlock.ts | 14 ---- .../block-logs-stream/src/isNonPendingLog.ts | 21 ------ packages/common/package.json | 2 +- packages/common/src/chains/mudFoundry.ts | 4 +- packages/common/src/createContract.ts | 13 ---- packages/common/src/createNonceManager.ts | 15 +++- packages/dev-tools/package.json | 2 +- packages/network/package.json | 2 +- packages/protocol-parser/package.json | 2 +- packages/schema-type/package.json | 2 +- packages/std-client/package.json | 2 +- packages/store-indexer/package.json | 2 +- packages/store-sync/package.json | 2 +- packages/store-sync/src/common.ts | 11 +-- packages/store-sync/src/createStoreSync.ts | 9 +-- pnpm-lock.yaml | 55 ++++++++------ templates/phaser/packages/client/package.json | 2 +- templates/react/packages/client/package.json | 2 +- .../threejs/packages/client/package.json | 2 +- .../vanilla/packages/client/package.json | 2 +- 40 files changed, 184 insertions(+), 287 deletions(-) create mode 100644 .changeset/lazy-ladybugs-return.md create mode 100644 .changeset/red-turkeys-develop.md create mode 100644 .changeset/sharp-worms-kneel.md create mode 100644 .changeset/spotty-cups-destroy.md delete mode 100644 packages/block-logs-stream/src/getLogs.ts delete mode 100644 packages/block-logs-stream/src/isNonPendingBlock.ts delete mode 100644 packages/block-logs-stream/src/isNonPendingLog.ts diff --git a/.changeset/lazy-ladybugs-return.md b/.changeset/lazy-ladybugs-return.md new file mode 100644 index 0000000000..d02d9e3454 --- /dev/null +++ b/.changeset/lazy-ladybugs-return.md @@ -0,0 +1,6 @@ +--- +"@latticexyz/common": minor +--- + +- adds `defaultPriorityFee` to `mudFoundry` for better support with MUD's default anvil config and removes workaround in `createContract` +- improves nonce error detection using viem's custom errors diff --git a/.changeset/red-turkeys-develop.md b/.changeset/red-turkeys-develop.md new file mode 100644 index 0000000000..f85cf4eb12 --- /dev/null +++ b/.changeset/red-turkeys-develop.md @@ -0,0 +1,14 @@ +--- +"@latticexyz/block-logs-stream": patch +"@latticexyz/common": patch +"@latticexyz/dev-tools": patch +"@latticexyz/network": patch +"@latticexyz/protocol-parser": patch +"@latticexyz/schema-type": patch +"@latticexyz/std-client": patch +"@latticexyz/store-indexer": patch +"@latticexyz/store-sync": patch +"create-mud": patch +--- + +bump viem to 1.6.0 diff --git a/.changeset/sharp-worms-kneel.md b/.changeset/sharp-worms-kneel.md new file mode 100644 index 0000000000..4ba018ceba --- /dev/null +++ b/.changeset/sharp-worms-kneel.md @@ -0,0 +1,7 @@ +--- +"@latticexyz/block-logs-stream": major +--- + +- removes our own `getLogs` function now that viem's `getLogs` supports using multiple `events` per RPC call. +- removes `isNonPendingBlock` and `isNonPendingLog` helpers now that viem narrows `Block` and `Log` types based on inputs +- simplifies `groupLogsByBlockNumber` types and tests diff --git a/.changeset/spotty-cups-destroy.md b/.changeset/spotty-cups-destroy.md new file mode 100644 index 0000000000..0681b6969e --- /dev/null +++ b/.changeset/spotty-cups-destroy.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/store-sync": patch +--- + +remove usages of `isNonPendingBlock` and `isNonPendingLog` (fixed with more specific viem types) diff --git a/e2e/packages/client-vanilla/package.json b/e2e/packages/client-vanilla/package.json index e018f52f28..0dbfe0a0de 100644 --- a/e2e/packages/client-vanilla/package.json +++ b/e2e/packages/client-vanilla/package.json @@ -33,7 +33,7 @@ "react": "^18.2.0", "rxjs": "7.5.5", "threads": "^1.7.0", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "rimraf": "^3.0.2", diff --git a/e2e/packages/sync-test/package.json b/e2e/packages/sync-test/package.json index 96e0eef955..aef3d3bb45 100644 --- a/e2e/packages/sync-test/package.json +++ b/e2e/packages/sync-test/package.json @@ -22,7 +22,7 @@ "execa": "^7.1.1", "jsdom": "^22.0.0", "typescript": "5.1.6", - "viem": "1.3.1", + "viem": "1.6.0", "vite": "^4.2.1", "vitest": "^0.31.0" } diff --git a/e2e/pnpm-lock.yaml b/e2e/pnpm-lock.yaml index 8431f3df3b..50dc0ee03d 100644 --- a/e2e/pnpm-lock.yaml +++ b/e2e/pnpm-lock.yaml @@ -84,8 +84,8 @@ importers: specifier: ^1.7.0 version: 1.7.0 viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6) devDependencies: rimraf: specifier: ^3.0.2 @@ -193,8 +193,8 @@ importers: specifier: 5.1.6 version: 5.1.6 viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6) vite: specifier: ^4.2.1 version: 4.3.5(@types/node@20.1.3) @@ -745,9 +745,18 @@ packages: dependencies: '@noble/hashes': 1.3.0 + /@noble/curves@1.1.0: + resolution: {integrity: sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==} + dependencies: + '@noble/hashes': 1.3.1 + /@noble/hashes@1.3.0: resolution: {integrity: sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==} + /@noble/hashes@1.3.1: + resolution: {integrity: sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==} + engines: {node: '>= 16'} + /@playwright/test@1.35.1: resolution: {integrity: sha512-b5YoFe6J9exsMYg0pQAobNDR85T1nLumUYgUTtKm4d21iX2L7WqKq9dW8NGJ+2vX0etZd+Y7UeuqsxDXm9+5ZA==} engines: {node: '>=16'} @@ -864,6 +873,11 @@ packages: resolution: {integrity: sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==} dev: true + /@types/ws@8.5.5: + resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==} + dependencies: + '@types/node': 20.1.3 + /@viem/anvil@0.0.6: resolution: {integrity: sha512-OjKR/+FVwzuygXYFqP8MBal1SXG8bT2gbZwqqB0XuLw81LNBBvmE/Repm6+5kkBh4IUj0PhYdrqOsnayS14Gtg==} dependencies: @@ -2252,8 +2266,8 @@ packages: hasBin: true dev: true - /viem@1.3.1(typescript@5.1.6): - resolution: {integrity: sha512-Yv+y3/exrrEN4EAkVUtUuQxsjF4+3taHY2aSinJnNWtcA4fBZ+WfPJBTywcnFIa/Q5oDcQN85yqPFBbkXqWHdw==} + /viem@1.6.0(typescript@5.1.6): + resolution: {integrity: sha512-ae9Twkd0q2Qlj4yYpWjb4DzYAhKY0ibEpRH8FJaTywZXNpTjFidSdBaT0CVn1BaH7O7cnX4/O47zvDUMGJD1AA==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -2261,10 +2275,11 @@ packages: optional: true dependencies: '@adraffy/ens-normalize': 1.9.0 - '@noble/curves': 1.0.0 + '@noble/curves': 1.1.0 '@noble/hashes': 1.3.0 '@scure/bip32': 1.3.0 '@scure/bip39': 1.2.0 + '@types/ws': 8.5.5 '@wagmi/chains': 1.6.0(typescript@5.1.6) abitype: 0.9.3(typescript@5.1.6) isomorphic-ws: 5.0.0(ws@8.12.0) diff --git a/examples/minimal/packages/client-phaser/package.json b/examples/minimal/packages/client-phaser/package.json index a8d9dee5ee..449784bebd 100644 --- a/examples/minimal/packages/client-phaser/package.json +++ b/examples/minimal/packages/client-phaser/package.json @@ -39,7 +39,7 @@ "styled-components": "^5.3.10", "threads": "^1.7.0", "use-resize-observer": "^9.1.0", - "viem": "1.3.1", + "viem": "1.6.0", "vite": "^4.2.1", "zustand": "^4.3.8" }, diff --git a/examples/minimal/packages/client-react/package.json b/examples/minimal/packages/client-react/package.json index 41d7c968e9..b96385353b 100644 --- a/examples/minimal/packages/client-react/package.json +++ b/examples/minimal/packages/client-react/package.json @@ -35,7 +35,7 @@ "react-dom": "^18.2.0", "rxjs": "7.5.5", "threads": "^1.7.0", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "@types/react": "^18.2.6", diff --git a/examples/minimal/packages/client-vanilla/package.json b/examples/minimal/packages/client-vanilla/package.json index d85d867e04..0d3e54c5b2 100644 --- a/examples/minimal/packages/client-vanilla/package.json +++ b/examples/minimal/packages/client-vanilla/package.json @@ -33,7 +33,7 @@ "react": "^18.2.0", "rxjs": "7.5.5", "threads": "^1.7.0", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "vite": "^4.2.1", diff --git a/examples/minimal/pnpm-lock.yaml b/examples/minimal/pnpm-lock.yaml index bd8a0af437..0a493f2028 100644 --- a/examples/minimal/pnpm-lock.yaml +++ b/examples/minimal/pnpm-lock.yaml @@ -114,8 +114,8 @@ importers: specifier: ^9.1.0 version: 9.1.0(react-dom@18.2.0)(react@18.2.0) viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6) vite: specifier: ^4.2.1 version: 4.2.1 @@ -226,8 +226,8 @@ importers: specifier: ^1.7.0 version: 1.7.0 viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6) devDependencies: '@types/react': specifier: ^18.2.6 @@ -323,8 +323,8 @@ importers: specifier: ^1.7.0 version: 1.7.0 viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6) devDependencies: vite: specifier: ^4.2.1 @@ -1292,10 +1292,21 @@ packages: '@noble/hashes': 1.3.0 dev: false + /@noble/curves@1.1.0: + resolution: {integrity: sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==} + dependencies: + '@noble/hashes': 1.3.1 + dev: false + /@noble/hashes@1.3.0: resolution: {integrity: sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==} dev: false + /@noble/hashes@1.3.1: + resolution: {integrity: sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==} + engines: {node: '>= 16'} + dev: false + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -1487,6 +1498,12 @@ packages: csstype: 3.1.2 dev: true + /@types/ws@8.5.5: + resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==} + dependencies: + '@types/node': 18.15.11 + dev: false + /@typescript-eslint/eslint-plugin@5.46.1(@typescript-eslint/parser@5.46.1)(eslint@8.29.0)(typescript@5.1.6): resolution: {integrity: sha512-YpzNv3aayRBwjs4J3oz65eVLXc9xx0PDbIRisHj+dYhvBn02MjYOD96P8YGiWEIFBrojaUjxvkaUpakD82phsA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4233,8 +4250,8 @@ packages: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} dev: true - /viem@1.3.1(typescript@5.1.6): - resolution: {integrity: sha512-Yv+y3/exrrEN4EAkVUtUuQxsjF4+3taHY2aSinJnNWtcA4fBZ+WfPJBTywcnFIa/Q5oDcQN85yqPFBbkXqWHdw==} + /viem@1.6.0(typescript@5.1.6): + resolution: {integrity: sha512-ae9Twkd0q2Qlj4yYpWjb4DzYAhKY0ibEpRH8FJaTywZXNpTjFidSdBaT0CVn1BaH7O7cnX4/O47zvDUMGJD1AA==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -4242,10 +4259,11 @@ packages: optional: true dependencies: '@adraffy/ens-normalize': 1.9.0 - '@noble/curves': 1.0.0 + '@noble/curves': 1.1.0 '@noble/hashes': 1.3.0 '@scure/bip32': 1.3.0 '@scure/bip39': 1.2.0 + '@types/ws': 8.5.5 '@wagmi/chains': 1.6.0(typescript@5.1.6) abitype: 0.9.3(typescript@5.1.6) isomorphic-ws: 5.0.0(ws@8.12.0) diff --git a/packages/block-logs-stream/README.md b/packages/block-logs-stream/README.md index 1cbdc26dfd..06ff3e3624 100644 --- a/packages/block-logs-stream/README.md +++ b/packages/block-logs-stream/README.md @@ -10,23 +10,14 @@ A set of utilities for efficiently retrieving blockchain event logs. Built on to ```ts import { filter, map, mergeMap } from "rxjs"; import { createPublicClient, parseAbi } from "viem"; -import { - createBlockStream, - isNonPendingBlock, - groupLogsByBlockNumber, - blockRangeToLogs, -} from "@latticexyz/block-logs-stream"; +import { createBlockStream, groupLogsByBlockNumber, blockRangeToLogs } from "@latticexyz/block-logs-stream"; const publicClient = createPublicClient({ // your viem public client config here }); const latestBlock$ = await createBlockStream({ publicClient, blockTag: "latest" }); - -const latestBlockNumber$ = latestBlock$.pipe( - filter(isNonPendingBlock), - map((block) => block.number) -); +const latestBlockNumber$ = latestBlock$.pipe(map((block) => block.number)); latestBlockNumber$ .pipe( diff --git a/packages/block-logs-stream/package.json b/packages/block-logs-stream/package.json index a1f055f07e..9f8f5e8407 100644 --- a/packages/block-logs-stream/package.json +++ b/packages/block-logs-stream/package.json @@ -29,7 +29,7 @@ "abitype": "0.9.3", "debug": "^4.3.4", "rxjs": "7.5.5", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "@types/debug": "^4.1.7", diff --git a/packages/block-logs-stream/src/blockRangeToLogs.ts b/packages/block-logs-stream/src/blockRangeToLogs.ts index 07df9e2512..a626858a42 100644 --- a/packages/block-logs-stream/src/blockRangeToLogs.ts +++ b/packages/block-logs-stream/src/blockRangeToLogs.ts @@ -1,7 +1,7 @@ import { EMPTY, OperatorFunction, concatMap, from, pipe, tap } from "rxjs"; import { FetchLogsResult, fetchLogs } from "./fetchLogs"; -import { AbiEvent, Address } from "abitype"; -import { BlockNumber, PublicClient } from "viem"; +import { AbiEvent } from "abitype"; +import { Address, BlockNumber, PublicClient } from "viem"; export type BlockRangeToLogsOptions = { /** diff --git a/packages/block-logs-stream/src/createBlockStream.ts b/packages/block-logs-stream/src/createBlockStream.ts index b51e11ff6b..7fa6f82b46 100644 --- a/packages/block-logs-stream/src/createBlockStream.ts +++ b/packages/block-logs-stream/src/createBlockStream.ts @@ -1,14 +1,17 @@ import { Observable } from "rxjs"; import type { Block, BlockTag, PublicClient } from "viem"; -export type CreateBlockStreamOptions = { +export type CreateBlockStreamOptions = { publicClient: PublicClient; - blockTag: BlockTag; + blockTag: TBlockTag; }; -export type CreateBlockStreamResult = Observable; +export type CreateBlockStreamResult = Observable>; -export function createBlockStream({ publicClient, blockTag }: CreateBlockStreamOptions): CreateBlockStreamResult { +export function createBlockStream({ + publicClient, + blockTag, +}: CreateBlockStreamOptions): CreateBlockStreamResult { return new Observable(function subscribe(subscriber) { return publicClient.watchBlocks({ blockTag, diff --git a/packages/block-logs-stream/src/fetchLogs.ts b/packages/block-logs-stream/src/fetchLogs.ts index 2e1e60440e..00d8e47af9 100644 --- a/packages/block-logs-stream/src/fetchLogs.ts +++ b/packages/block-logs-stream/src/fetchLogs.ts @@ -1,7 +1,6 @@ -import { AbiEvent, Address } from "abitype"; -import { PublicClient, BlockNumber } from "viem"; +import { AbiEvent } from "abitype"; +import { Address, PublicClient, BlockNumber, GetLogsReturnType } from "viem"; import { bigIntMin, wait } from "@latticexyz/common/utils"; -import { GetLogsResult, getLogs } from "./getLogs"; import { debug } from "./debug"; export type FetchLogsOptions = { @@ -40,7 +39,7 @@ export type FetchLogsOptions = { export type FetchLogsResult = { fromBlock: BlockNumber; toBlock: BlockNumber; - logs: GetLogsResult; + logs: GetLogsReturnType; }; /** @@ -61,6 +60,7 @@ export type FetchLogsResult = { export async function* fetchLogs({ maxBlockRange = 1000n, maxRetryCount = 3, + publicClient, ...getLogsOpts }: FetchLogsOptions): AsyncGenerator> { let fromBlock = getLogsOpts.fromBlock; @@ -70,13 +70,14 @@ export async function* fetchLogs({ while (fromBlock <= getLogsOpts.toBlock) { try { const toBlock = fromBlock + blockRange; - const logs = await getLogs({ ...getLogsOpts, fromBlock, toBlock }); + const logs = await publicClient.getLogs({ ...getLogsOpts, fromBlock, toBlock, strict: true }); yield { fromBlock, toBlock, logs }; fromBlock = toBlock + 1n; blockRange = bigIntMin(maxBlockRange, getLogsOpts.toBlock - fromBlock); } catch (error: unknown) { if (!(error instanceof Error)) throw error; + // TODO: figure out actual rate limit message for RPCs if (error.message.includes("rate limit exceeded") && retryCount < maxRetryCount) { const seconds = 2 * retryCount; debug(`too many requests, retrying in ${seconds}s`, error); @@ -85,6 +86,7 @@ export async function* fetchLogs({ continue; } + // TODO: figure out actual block range exceeded message for RPCs if (error.message.includes("block range exceeded")) { blockRange /= 2n; if (blockRange <= 0n) { diff --git a/packages/block-logs-stream/src/getLogs.ts b/packages/block-logs-stream/src/getLogs.ts deleted file mode 100644 index 0d3a4cc11f..0000000000 --- a/packages/block-logs-stream/src/getLogs.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { AbiEvent } from "abitype"; -import { - Address, - BlockNumber, - BlockTag, - Log, - PublicClient, - decodeEventLog, - encodeEventTopics, - numberToHex, - formatLog, -} from "viem"; -import { isDefined } from "@latticexyz/common/utils"; - -// Based on https://github.com/wagmi-dev/viem/blob/main/src/actions/public/getLogs.ts -// TODO: swap this out once viem has support for multiple events: https://github.com/wagmi-dev/viem/pull/633 - -export type GetLogsOptions = { - publicClient: PublicClient; - address?: Address | Address[]; - events: TAbiEvents; - fromBlock: BlockNumber | BlockTag; - toBlock: BlockNumber | BlockTag; -}; - -export type GetLogsResult = Log< - bigint, - number, - TAbiEvents[number], - true, - TAbiEvents ->[]; - -export async function getLogs({ - publicClient, - address, - events, - fromBlock, - toBlock, -}: GetLogsOptions): Promise> { - const topics = [events.flatMap((event) => encodeEventTopics({ abi: [event], eventName: event.name }))]; - - const logs = await publicClient.request({ - method: "eth_getLogs", - params: [ - { - address, - topics, - fromBlock: typeof fromBlock === "bigint" ? numberToHex(fromBlock) : fromBlock, - toBlock: typeof toBlock === "bigint" ? numberToHex(toBlock) : toBlock, - }, - ], - }); - - return logs - .map((log) => { - try { - const { eventName, args } = decodeEventLog({ - abi: events, - data: log.data, - topics: log.topics, - strict: true, - }); - return formatLog(log, { args, eventName }); - } catch (err) { - // We're using strict mode, so just skip if there is an error decoding. - // https://viem.sh/docs/actions/public/getLogs.html#strict-mode - return; - } - }) - .filter(isDefined) as GetLogsResult; -} diff --git a/packages/block-logs-stream/src/groupLogsByBlockNumber.test.ts b/packages/block-logs-stream/src/groupLogsByBlockNumber.test.ts index 0e3fd796f9..7498ba3c53 100644 --- a/packages/block-logs-stream/src/groupLogsByBlockNumber.test.ts +++ b/packages/block-logs-stream/src/groupLogsByBlockNumber.test.ts @@ -1,53 +1,30 @@ import { describe, it, expect } from "vitest"; import { groupLogsByBlockNumber } from "./groupLogsByBlockNumber"; -import { Log } from "viem"; describe("groupLogsByBlockNumber", () => { it("groups logs by block number and correctly sorts them", () => { const logs = [ { blockNumber: 1n, - blockHash: "0x", logIndex: 4, - transactionHash: "0x", - transactionIndex: 0, }, { blockNumber: 5n, - blockHash: "0x", logIndex: 0, - transactionHash: "0x", - transactionIndex: 0, }, { blockNumber: 1n, - blockHash: "0x", logIndex: 0, - transactionHash: "0x", - transactionIndex: 0, }, { blockNumber: 1n, - blockHash: "0x", logIndex: 2, - transactionHash: "0x", - transactionIndex: 0, - }, - { - blockNumber: null, - blockHash: null, - logIndex: null, - transactionHash: null, - transactionIndex: null, }, { blockNumber: 3n, - blockHash: "0x", logIndex: 3, - transactionHash: "0x", - transactionIndex: 0, }, - ] as any as Log[]; + ]; expect(groupLogsByBlockNumber(logs)).toMatchInlineSnapshot(` [ @@ -55,25 +32,16 @@ describe("groupLogsByBlockNumber", () => { "blockNumber": 1n, "logs": [ { - "blockHash": "0x", "blockNumber": 1n, "logIndex": 0, - "transactionHash": "0x", - "transactionIndex": 0, }, { - "blockHash": "0x", "blockNumber": 1n, "logIndex": 2, - "transactionHash": "0x", - "transactionIndex": 0, }, { - "blockHash": "0x", "blockNumber": 1n, "logIndex": 4, - "transactionHash": "0x", - "transactionIndex": 0, }, ], }, @@ -81,11 +49,8 @@ describe("groupLogsByBlockNumber", () => { "blockNumber": 3n, "logs": [ { - "blockHash": "0x", "blockNumber": 3n, "logIndex": 3, - "transactionHash": "0x", - "transactionIndex": 0, }, ], }, @@ -93,11 +58,8 @@ describe("groupLogsByBlockNumber", () => { "blockNumber": 5n, "logs": [ { - "blockHash": "0x", "blockNumber": 5n, "logIndex": 0, - "transactionHash": "0x", - "transactionIndex": 0, }, ], }, @@ -109,12 +71,9 @@ describe("groupLogsByBlockNumber", () => { const logs = [ { blockNumber: 1n, - blockHash: "0x", logIndex: 4, - transactionHash: "0x", - transactionIndex: 0, }, - ] as any as Log[]; + ]; expect(groupLogsByBlockNumber(logs, 2n)).toMatchInlineSnapshot(` [ @@ -122,11 +81,8 @@ describe("groupLogsByBlockNumber", () => { "blockNumber": 1n, "logs": [ { - "blockHash": "0x", "blockNumber": 1n, "logIndex": 4, - "transactionHash": "0x", - "transactionIndex": 0, }, ], }, @@ -142,12 +98,9 @@ describe("groupLogsByBlockNumber", () => { const logs = [ { blockNumber: 2n, - blockHash: "0x", logIndex: 4, - transactionHash: "0x", - transactionIndex: 0, }, - ] as any as Log[]; + ]; expect(groupLogsByBlockNumber(logs, 2n)).toMatchInlineSnapshot(` [ @@ -155,11 +108,8 @@ describe("groupLogsByBlockNumber", () => { "blockNumber": 2n, "logs": [ { - "blockHash": "0x", "blockNumber": 2n, "logIndex": 4, - "transactionHash": "0x", - "transactionIndex": 0, }, ], }, diff --git a/packages/block-logs-stream/src/groupLogsByBlockNumber.ts b/packages/block-logs-stream/src/groupLogsByBlockNumber.ts index 0b94024f58..e0d2f1144e 100644 --- a/packages/block-logs-stream/src/groupLogsByBlockNumber.ts +++ b/packages/block-logs-stream/src/groupLogsByBlockNumber.ts @@ -1,11 +1,11 @@ -import { BlockNumber, Log } from "viem"; -import { NonPendingLog, isNonPendingLog } from "./isNonPendingLog"; +import { BlockNumber } from "viem"; import { bigIntSort, isDefined } from "@latticexyz/common/utils"; -import { debug } from "./debug"; -export type GroupLogsByBlockNumberResult = { +type PartialLog = { blockNumber: bigint; logIndex: number }; + +export type GroupLogsByBlockNumberResult = { blockNumber: BlockNumber; - logs: readonly NonPendingLog[]; + logs: TLog[]; }[]; /** @@ -22,25 +22,16 @@ export type GroupLogsByBlockNumberResult = { * @returns An array of objects where each object represents a distinct block and includes the block number, * the block hash, and an array of logs for that block. */ -export function groupLogsByBlockNumber( +export function groupLogsByBlockNumber( logs: readonly TLog[], toBlock?: BlockNumber ): GroupLogsByBlockNumberResult { - // Pending logs don't have block numbers, so filter them out. - const nonPendingLogs = logs.filter(isNonPendingLog); - if (logs.length !== nonPendingLogs.length) { - debug( - "pending logs discarded", - logs.filter((log) => !isNonPendingLog(log)) - ); - } - - const blockNumbers = Array.from(new Set(nonPendingLogs.map((log) => log.blockNumber))); + const blockNumbers = Array.from(new Set(logs.map((log) => log.blockNumber))); blockNumbers.sort(bigIntSort); const groupedBlocks = blockNumbers .map((blockNumber) => { - const blockLogs = nonPendingLogs.filter((log) => log.blockNumber === blockNumber); + const blockLogs = logs.filter((log) => log.blockNumber === blockNumber); if (!blockLogs.length) return; blockLogs.sort((a, b) => (a.logIndex < b.logIndex ? -1 : a.logIndex > b.logIndex ? 1 : 0)); diff --git a/packages/block-logs-stream/src/index.ts b/packages/block-logs-stream/src/index.ts index da2dfb6bc0..b765828242 100644 --- a/packages/block-logs-stream/src/index.ts +++ b/packages/block-logs-stream/src/index.ts @@ -1,7 +1,4 @@ export * from "./blockRangeToLogs"; export * from "./createBlockStream"; export * from "./fetchLogs"; -export * from "./getLogs"; export * from "./groupLogsByBlockNumber"; -export * from "./isNonPendingBlock"; -export * from "./isNonPendingLog"; diff --git a/packages/block-logs-stream/src/isNonPendingBlock.ts b/packages/block-logs-stream/src/isNonPendingBlock.ts deleted file mode 100644 index cbf39086ea..0000000000 --- a/packages/block-logs-stream/src/isNonPendingBlock.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Block } from "viem"; - -// TODO: get rid of this once https://github.com/wagmi-dev/viem/pull/847 lands - -export type NonPendingBlock = TBlock & { - hash: NonNullable; - logsBloom: NonNullable; - nonce: NonNullable; - number: NonNullable; -}; - -export function isNonPendingBlock(block: TBlock): block is NonPendingBlock { - return block.hash != null && block.logsBloom != null && block.nonce != null && block.number != null; -} diff --git a/packages/block-logs-stream/src/isNonPendingLog.ts b/packages/block-logs-stream/src/isNonPendingLog.ts deleted file mode 100644 index c93033f74e..0000000000 --- a/packages/block-logs-stream/src/isNonPendingLog.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { Log } from "viem"; - -// TODO: get rid of this once https://github.com/wagmi-dev/viem/pull/847 lands - -export type NonPendingLog = TLog & { - blockHash: NonNullable; - blockNumber: NonNullable; - logIndex: NonNullable; - transactionHash: NonNullable; - transactionIndex: NonNullable; -}; - -export function isNonPendingLog(log: TLog): log is NonPendingLog { - return ( - log.blockHash != null && - log.blockNumber != null && - log.logIndex != null && - log.transactionHash != null && - log.transactionIndex != null - ); -} diff --git a/packages/common/package.json b/packages/common/package.json index 86df629bb5..c3dd94e3b4 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -65,7 +65,7 @@ "p-retry": "^5.1.2", "prettier": "^2.8.4", "prettier-plugin-solidity": "^1.1.2", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "@types/debug": "^4.1.7", diff --git a/packages/common/src/chains/mudFoundry.ts b/packages/common/src/chains/mudFoundry.ts index f3d0b62501..1754534d8d 100644 --- a/packages/common/src/chains/mudFoundry.ts +++ b/packages/common/src/chains/mudFoundry.ts @@ -3,5 +3,7 @@ import { MUDChain } from "./types"; export const mudFoundry = { ...foundry, - // We may override chain settings here + fees: { + defaultPriorityFee: 0n, + }, } as const satisfies MUDChain; diff --git a/packages/common/src/createContract.ts b/packages/common/src/createContract.ts index 1a72a204e6..b88924fc19 100644 --- a/packages/common/src/createContract.ts +++ b/packages/common/src/createContract.ts @@ -110,19 +110,6 @@ export function createContract< } async function write(options: WriteContractParameters): Promise { - // Temporarily override base fee for our default anvil config - // TODO: replace with https://github.com/wagmi-dev/viem/pull/1006 once merged - // TODO: more specific mud foundry check? or can we safely assume anvil+mud will be block fee zero for now? - if ( - walletClient.chain.id === 31337 && - options.maxFeePerGas == null && - options.maxPriorityFeePerGas == null - ) { - debug("assuming zero base fee for anvil chain"); - options.maxFeePerGas = 0n; - options.maxPriorityFeePerGas = 0n; - } - const preparedWrite = await prepareWrite(options); return await pRetry( diff --git a/packages/common/src/createNonceManager.ts b/packages/common/src/createNonceManager.ts index 5a38611c0a..f9d3b8222c 100644 --- a/packages/common/src/createNonceManager.ts +++ b/packages/common/src/createNonceManager.ts @@ -1,4 +1,12 @@ -import { BlockTag, Hex, PublicClient } from "viem"; +import { + BaseError, + BlockTag, + Hex, + NonceTooHighError, + NonceTooLowError, + PublicClient, + TransactionExecutionError, +} from "viem"; import { debug as parentDebug } from "./debug"; const debug = parentDebug.extend("createNonceManager"); @@ -55,7 +63,10 @@ export function createNonceManager({ } function shouldResetNonce(error: unknown): boolean { - return /already known|nonce too low/.test(String(error)); + return ( + error instanceof BaseError && + error.walk((e) => e instanceof NonceTooLowError || e instanceof NonceTooHighError) != null + ); } return { diff --git a/packages/dev-tools/package.json b/packages/dev-tools/package.json index 547ae9b4a0..022dd74099 100644 --- a/packages/dev-tools/package.json +++ b/packages/dev-tools/package.json @@ -36,7 +36,7 @@ "rxjs": "7.5.5", "tailwind-merge": "^1.12.0", "use-local-storage-state": "^18.3.2", - "viem": "1.3.1", + "viem": "1.6.0", "zustand": "^4.3.7" }, "devDependencies": { diff --git a/packages/network/package.json b/packages/network/package.json index 0c773301a2..b66814f66a 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -51,7 +51,7 @@ "nice-grpc-web": "^2.0.1", "rxjs": "7.5.5", "threads": "^1.7.0", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "@types/debug": "^4.1.7", diff --git a/packages/protocol-parser/package.json b/packages/protocol-parser/package.json index c340f7660c..da17fb5ff4 100644 --- a/packages/protocol-parser/package.json +++ b/packages/protocol-parser/package.json @@ -26,7 +26,7 @@ "@latticexyz/common": "workspace:*", "@latticexyz/schema-type": "workspace:*", "abitype": "0.9.3", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "tsup": "^6.7.0", diff --git a/packages/schema-type/package.json b/packages/schema-type/package.json index 8359220b20..e87b61fbc1 100644 --- a/packages/schema-type/package.json +++ b/packages/schema-type/package.json @@ -34,7 +34,7 @@ }, "dependencies": { "abitype": "0.9.3", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "@latticexyz/gas-report": "workspace:*", diff --git a/packages/std-client/package.json b/packages/std-client/package.json index 025cb9ddac..6719631898 100644 --- a/packages/std-client/package.json +++ b/packages/std-client/package.json @@ -48,7 +48,7 @@ "mobx": "^6.7.0", "react": "^18.2.0", "rxjs": "7.5.5", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "@types/jest": "^27.4.1", diff --git a/packages/store-indexer/package.json b/packages/store-indexer/package.json index e23a10802b..f73899adfa 100644 --- a/packages/store-indexer/package.json +++ b/packages/store-indexer/package.json @@ -40,7 +40,7 @@ "drizzle-orm": "^0.27.0", "rxjs": "7.5.5", "superjson": "^1.12.4", - "viem": "1.3.1", + "viem": "1.6.0", "zod": "^3.21.4" }, "devDependencies": { diff --git a/packages/store-sync/package.json b/packages/store-sync/package.json index 28b9411071..2da5df238f 100644 --- a/packages/store-sync/package.json +++ b/packages/store-sync/package.json @@ -57,7 +57,7 @@ "rxjs": "7.5.5", "sql.js": "^1.8.0", "superjson": "^1.12.4", - "viem": "1.3.1", + "viem": "1.6.0", "zod": "^3.21.4" }, "devDependencies": { diff --git a/packages/store-sync/src/common.ts b/packages/store-sync/src/common.ts index b0d5b3ba63..31c54689ff 100644 --- a/packages/store-sync/src/common.ts +++ b/packages/store-sync/src/common.ts @@ -1,13 +1,14 @@ -import { Address, Block, Hex, PublicClient, TransactionReceipt } from "viem"; -import { GetLogsResult, GroupLogsByBlockNumberResult, NonPendingLog } from "@latticexyz/block-logs-stream"; +import { Address, Block, Hex, Log, PublicClient, TransactionReceipt } from "viem"; +import { GroupLogsByBlockNumberResult } from "@latticexyz/block-logs-stream"; import { - StoreEventsAbi, StoreConfig, KeySchema, ValueSchema, ConfigToKeyPrimitives as Key, ConfigToValuePrimitives as Value, TableRecord, + StoreEventsAbiItem, + StoreEventsAbi, } from "@latticexyz/store"; import { Observable } from "rxjs"; import { BlockStorageOperations } from "./blockLogsToStorage"; @@ -29,11 +30,11 @@ export type Table = { export type TableWithRecords = Table & { records: TableRecord[] }; -export type StoreEventsLog = GetLogsResult[number]; +export type StoreEventsLog = Log; export type BlockLogs = GroupLogsByBlockNumberResult[number]; export type BaseStorageOperation = { - log?: NonPendingLog; + log?: StoreEventsLog; address: Hex; namespace: TableNamespace; name: TableName; diff --git a/packages/store-sync/src/createStoreSync.ts b/packages/store-sync/src/createStoreSync.ts index 0e99d49685..d0bdcfb301 100644 --- a/packages/store-sync/src/createStoreSync.ts +++ b/packages/store-sync/src/createStoreSync.ts @@ -1,12 +1,7 @@ import { ConfigToKeyPrimitives, ConfigToValuePrimitives, StoreConfig, storeEventsAbi } from "@latticexyz/store"; import { Hex, TransactionReceipt } from "viem"; import { SetRecordOperation, SyncOptions, SyncResult } from "./common"; -import { - createBlockStream, - isNonPendingBlock, - blockRangeToLogs, - groupLogsByBlockNumber, -} from "@latticexyz/block-logs-stream"; +import { createBlockStream, blockRangeToLogs, groupLogsByBlockNumber } from "@latticexyz/block-logs-stream"; import { filter, map, tap, mergeMap, from, concatMap, share, firstValueFrom } from "rxjs"; import { blockLogsToStorage } from "./blockLogsToStorage"; import { debug as parentDebug } from "./debug"; @@ -100,9 +95,7 @@ export async function createStoreSync debug("starting sync from block", startBlock); const latestBlock$ = createBlockStream({ publicClient, blockTag: "latest" }).pipe(share()); - const latestBlockNumber$ = latestBlock$.pipe( - filter(isNonPendingBlock), map((block) => block.number), share() ); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab5561955b..70027a0ae8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,8 +75,8 @@ importers: specifier: 7.5.5 version: 7.5.5 viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6)(zod@3.21.4) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6)(zod@3.21.4) devDependencies: '@types/debug': specifier: ^4.1.7 @@ -248,8 +248,8 @@ importers: specifier: ^1.1.2 version: 1.1.2(prettier@2.8.4) viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6)(zod@3.21.4) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6)(zod@3.21.4) devDependencies: '@types/debug': specifier: ^4.1.7 @@ -353,8 +353,8 @@ importers: specifier: ^18.3.2 version: 18.3.2(react-dom@18.2.0)(react@18.2.0) viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6)(zod@3.21.4) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6)(zod@3.21.4) zustand: specifier: ^4.3.7 version: 4.3.7(react@18.2.0) @@ -524,8 +524,8 @@ importers: specifier: ^1.7.0 version: 1.7.0 viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6)(zod@3.21.4) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6)(zod@3.21.4) devDependencies: '@types/debug': specifier: ^4.1.7 @@ -635,8 +635,8 @@ importers: specifier: 0.9.3 version: 0.9.3(typescript@5.1.6)(zod@3.21.4) viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6)(zod@3.21.4) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6)(zod@3.21.4) devDependencies: tsup: specifier: ^6.7.0 @@ -737,8 +737,8 @@ importers: specifier: 0.9.3 version: 0.9.3(typescript@5.1.6)(zod@3.21.4) viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6)(zod@3.21.4) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6)(zod@3.21.4) devDependencies: '@latticexyz/gas-report': specifier: workspace:* @@ -885,8 +885,8 @@ importers: specifier: 7.5.5 version: 7.5.5 viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6)(zod@3.21.4) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6)(zod@3.21.4) devDependencies: '@types/jest': specifier: ^27.4.1 @@ -1089,8 +1089,8 @@ importers: specifier: ^1.12.4 version: 1.12.4 viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6)(zod@3.21.4) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6)(zod@3.21.4) zod: specifier: ^3.21.4 version: 3.21.4 @@ -1165,8 +1165,8 @@ importers: specifier: ^1.12.4 version: 1.12.4 viem: - specifier: 1.3.1 - version: 1.3.1(typescript@5.1.6)(zod@3.21.4) + specifier: 1.6.0 + version: 1.6.0(typescript@5.1.6)(zod@3.21.4) zod: specifier: ^3.21.4 version: 3.21.4 @@ -3014,6 +3014,12 @@ packages: '@noble/hashes': 1.3.0 dev: false + /@noble/curves@1.1.0: + resolution: {integrity: sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==} + dependencies: + '@noble/hashes': 1.3.1 + dev: false + /@noble/hashes@1.2.0: resolution: {integrity: sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==} dev: true @@ -3022,6 +3028,11 @@ packages: resolution: {integrity: sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==} dev: false + /@noble/hashes@1.3.1: + resolution: {integrity: sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==} + engines: {node: '>= 16'} + dev: false + /@noble/secp256k1@1.7.1: resolution: {integrity: sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==} dev: true @@ -3620,7 +3631,6 @@ packages: resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} dependencies: '@types/node': 18.15.11 - dev: true /@types/yargs-interactive@2.1.3: resolution: {integrity: sha512-bYB8ah0JPR6/lpHlxUzeHsrb3RK5OW7N8Hnth2nefnr6zQ5KFoDQ6wM5x58dTLEDYrwikFy3EPTf/O0HKLNaIg==} @@ -11140,8 +11150,8 @@ packages: engines: {node: '>= 0.8'} dev: false - /viem@1.3.1(typescript@5.1.6)(zod@3.21.4): - resolution: {integrity: sha512-Yv+y3/exrrEN4EAkVUtUuQxsjF4+3taHY2aSinJnNWtcA4fBZ+WfPJBTywcnFIa/Q5oDcQN85yqPFBbkXqWHdw==} + /viem@1.6.0(typescript@5.1.6)(zod@3.21.4): + resolution: {integrity: sha512-ae9Twkd0q2Qlj4yYpWjb4DzYAhKY0ibEpRH8FJaTywZXNpTjFidSdBaT0CVn1BaH7O7cnX4/O47zvDUMGJD1AA==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -11149,10 +11159,11 @@ packages: optional: true dependencies: '@adraffy/ens-normalize': 1.9.0 - '@noble/curves': 1.0.0 + '@noble/curves': 1.1.0 '@noble/hashes': 1.3.0 '@scure/bip32': 1.3.0 '@scure/bip39': 1.2.0 + '@types/ws': 8.5.4 '@wagmi/chains': 1.6.0(typescript@5.1.6) abitype: 0.9.3(typescript@5.1.6)(zod@3.21.4) isomorphic-ws: 5.0.0(ws@8.12.0) diff --git a/templates/phaser/packages/client/package.json b/templates/phaser/packages/client/package.json index f81e6be20a..a7cc7a229c 100644 --- a/templates/phaser/packages/client/package.json +++ b/templates/phaser/packages/client/package.json @@ -32,7 +32,7 @@ "simplex-noise": "^4.0.1", "styled-components": "^5.3.10", "use-resize-observer": "^9.1.0", - "viem": "1.3.1", + "viem": "1.6.0", "zustand": "^4.3.8" }, "devDependencies": { diff --git a/templates/react/packages/client/package.json b/templates/react/packages/client/package.json index 678c504b09..51136034e4 100644 --- a/templates/react/packages/client/package.json +++ b/templates/react/packages/client/package.json @@ -27,7 +27,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "rxjs": "7.5.5", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "@types/react": "^18.2.6", diff --git a/templates/threejs/packages/client/package.json b/templates/threejs/packages/client/package.json index 0cb2eb6f62..3c93834ce1 100644 --- a/templates/threejs/packages/client/package.json +++ b/templates/threejs/packages/client/package.json @@ -28,7 +28,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "rxjs": "7.5.5", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "@types/react": "^18.2.6", diff --git a/templates/vanilla/packages/client/package.json b/templates/vanilla/packages/client/package.json index 7a9d6363a7..ca849d3f48 100644 --- a/templates/vanilla/packages/client/package.json +++ b/templates/vanilla/packages/client/package.json @@ -24,7 +24,7 @@ "contracts": "workspace:*", "ethers": "^5.7.2", "rxjs": "7.5.5", - "viem": "1.3.1" + "viem": "1.6.0" }, "devDependencies": { "vite": "^4.2.1",