From 320e0426d89138fc23987332ae3165236c3efb5b Mon Sep 17 00:00:00 2001 From: fretchen Date: Thu, 19 Nov 2026 17:47:52 +0100 Subject: [PATCH 1/4] First updates --- scw_js/llm_x402_cron.ts | 6 ++- scw_js/package-lock.json | 8 +-- scw_js/package.json | 2 +- scw_js/scripts/fee_allowances.ts | 8 ++- scw_js/tsconfig.json | 1 + scw_js/x402_channel_sync.ts | 4 +- shared/VIEM_TS6_NOTES.md | 84 ++++++++++++++++++++++++++++++++ 7 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 shared/VIEM_TS6_NOTES.md diff --git a/scw_js/llm_x402_cron.ts b/scw_js/llm_x402_cron.ts index e2e796666..7ed054a15 100644 --- a/scw_js/llm_x402_cron.ts +++ b/scw_js/llm_x402_cron.ts @@ -1,5 +1,5 @@ import { logger } from "./logger.js"; -import { createPublicClient, http } from "viem"; +import { createPublicClient, http, type Chain } from "viem"; import { getSettlementTokens, getViemChain, @@ -133,7 +133,9 @@ async function readFeeAllowanceClaimsLeft( } try { const publicClient = createPublicClient({ - chain: getViemChain(network), + // The symlinked chain-utils' dist types resolve viem through its own node_modules copy; + // TS 6 refuses to treat that Chain and ours as the same type. Pin to this package's copy. + chain: getViemChain(network) as Chain, transport: http(getRpcUrl(network)), }); const allowance = await publicClient.readContract({ diff --git a/scw_js/package-lock.json b/scw_js/package-lock.json index 247fe7b07..1256a80ce 100644 --- a/scw_js/package-lock.json +++ b/scw_js/package-lock.json @@ -35,7 +35,7 @@ "prettier": "^3.6.2", "serverless-scaleway-functions": ">=0.5.1", "tsdown": "^0.23.1", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.58.2", "vitest": "^4.1.11" } @@ -10220,9 +10220,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "devOptional": true, "license": "Apache-2.0", "bin": { diff --git a/scw_js/package.json b/scw_js/package.json index 5b3b0e73f..8cd44a3fa 100644 --- a/scw_js/package.json +++ b/scw_js/package.json @@ -40,7 +40,7 @@ "prettier": "^3.6.2", "serverless-scaleway-functions": ">=0.5.1", "tsdown": "^0.23.1", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.58.2", "vitest": "^4.1.11" }, diff --git a/scw_js/scripts/fee_allowances.ts b/scw_js/scripts/fee_allowances.ts index d7263def5..138800cbe 100644 --- a/scw_js/scripts/fee_allowances.ts +++ b/scw_js/scripts/fee_allowances.ts @@ -36,6 +36,7 @@ import { formatUnits, http, type Address, + type Chain, } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { @@ -108,7 +109,10 @@ function units(atomic: bigint, decimals: number): string { } function publicClientFor(network: string) { - return createPublicClient({ chain: getViemChain(network), transport: http(getRpcUrl(network)) }); + return createPublicClient({ + chain: getViemChain(network) as Chain, // single viem copy for TS 6 — see llm_x402_cron.ts + transport: http(getRpcUrl(network)), + }); } async function readAllowance( @@ -144,7 +148,7 @@ async function readBalance(pair: FeePair, owner: Address): Promise { const account = privateKeyToAccount(loadPrivateKey("NFT_WALLET_PRIVATE_KEY")); - const chain = getViemChain(pair.network); + const chain = getViemChain(pair.network) as Chain; // single viem copy for TS 6 const wallet = createWalletClient({ account, chain, transport: http(getRpcUrl(pair.network)) }); const hash = await wallet.writeContract({ address: pair.coin.address, diff --git a/scw_js/tsconfig.json b/scw_js/tsconfig.json index d7ebb03e5..d1ac26b94 100644 --- a/scw_js/tsconfig.json +++ b/scw_js/tsconfig.json @@ -7,6 +7,7 @@ "verbatimModuleSyntax": true, "resolveJsonModule": true, "skipLibCheck": true, + "rootDir": "..", "outDir": "dist", "declaration": false, "noEmit": true diff --git a/scw_js/x402_channel_sync.ts b/scw_js/x402_channel_sync.ts index f69f0d8ec..d10435f77 100644 --- a/scw_js/x402_channel_sync.ts +++ b/scw_js/x402_channel_sync.ts @@ -1,4 +1,4 @@ -import { createPublicClient, http } from "viem"; +import { createPublicClient, http, type Chain } from "viem"; import { getViemChain, getRpcUrl } from "@fretchen/chain-utils"; import type { Channel, ChannelStorage } from "@x402/evm/batch-settlement/server"; import { logger } from "./logger.js"; @@ -78,7 +78,7 @@ export async function resyncChannelState( { dryRun = false }: { dryRun?: boolean } = {}, ): Promise { const client = createPublicClient({ - chain: getViemChain(network), + chain: getViemChain(network) as Chain, // single viem copy for TS 6 — see llm_x402_cron.ts transport: http(getRpcUrl(network)), }); diff --git a/shared/VIEM_TS6_NOTES.md b/shared/VIEM_TS6_NOTES.md new file mode 100644 index 000000000..b1a2aabe7 --- /dev/null +++ b/shared/VIEM_TS6_NOTES.md @@ -0,0 +1,84 @@ +# The chain-utils viem instance split — and what TS 6 changed + +**For:** anyone bumping `typescript` in a package that consumes `@fretchen/chain-utils`, or +bumping `viem` anywhere. The constraint bit in PR #792 (CI log, 2026-11-19), and the diagnosis +was initially misattributed to viem version drift — the experiments that isolated it are +summarized last. + +## The setup + +Each npm package in this repo is independent — no workspace, no root `node_modules`. +`@fretchen/chain-utils` is installed as a `file:` dep, so its consumers see it as a symlink to +`shared/chain-utils`, whose `dist/*.d.ts` resolve `import("viem")` against **its own** +`shared/chain-utils/node_modules/viem`. The consumer package (scw_js, analytics, …) has its own +`node_modules/viem`. There are therefore always **two copies of the viem types in every +compile** that crosses the boundary, even when the manifest/lock versions are identical. +This is also why `test-viem-alignment.yml` pins all five lockfiles to one viem version. + +## What TS 6 changed + +TypeScript 5.9 structurally compared the two copies' `Chain` types and accepted them. +TypeScript 6.0 does not — it refuses the crossing outright: + +``` +error TS2322: Type 'Chain' is not assignable to type 'Chain | undefined'. + Type '…/shared/chain-utils/node_modules/viem/…/chain'.Chain' is not assignable to + type '…/scw_js/node_modules/viem/…/chain'.Chain'. +``` + +Verified on a clean checkout of main with **only** the compiler swapped +(`npm i --no-save typescript@6.0.3`): six errors in scw_js, four of them this class +(`llm_x402_cron.ts`, `x402_channel_sync.ts`, `scripts/fee_allowances.ts` ×2), all of them +independent of the viem version (reproduces identically at viem 2.57.4 and 2.57.20 twins). +The remaining two errors were the rootDir enforcement, a second TS 6 change: + +``` +error TS6059: File '…/observability/alertCoverage.ts' is not under 'rootDir' '…/scw_js'. +``` + +TS 6 also started inferring `rootDir` from `include` and enforcing that every input file sits +under it — `test/alert_coverage.test.ts` imports `../../observability/alertCoverage.ts`, +outside the package. (`rootDirs` does **not** silence this under TS 6; an explicit +`"rootDir": ".."` does.) + +## The current fixes (both in scw_js on the ts6 branch) + +1. **Pin the viem instance at the boundary** — cast `getViemChain(...)` to the consumer's own + `Chain` type where a chain-utils-produced chain enters a viem client + (`import { type Chain } from "viem"`, `getViemChain(network) as Chain`). These casts are + checked: with them, TS 6 compiles scw_js cleanly at both viem 2.57.4 and 2.57.20, tests + included. Any *new* code that passes a chain-utils viem object into this package's viem + (or vice versa) will need the same cast — this file is why. +2. **`"rootDir": ".."` in `scw_js/tsconfig.json`** for the imported `observability/alertCoverage.ts`. + +## What still needs solving in a future PR + +The casts are local damage control; the real debt is the instance split itself. Pick one and +do it as its own PR: + +- **Single viem instance for type-checking. Have consumers import the viem surface from + `@fretchen/chain-utils`** (re-export `createPublicClient`, `http`, `Chain`, …), and drop + their own direct `viem` dep — *every type position* then resolves through chain-utils' copy. + Watch out: `@x402/*` and `wagmi`/`viem`-peers still pull a hoisted copy for *their* emitted + types, so verify no call site mixes both instances again before deleting the casts. +- **Or move `getViemChain`'s return type out of the tangle:** make chain-utils export chain + descriptors only (id, rpcUrls, name…) and build the `viem.Chain` in the consumer. Bigger + API change, but it removes the ambiguity entirely. + +Until then: `typescript` bumps in chain-utils-consuming packages need the casts verified; +`viem` bumps need version alignment (all five lockfiles) **plus** the casts re-verified +against the new viem's type surface — TS 6's cross-instance comparison may bail at shapes +that cast only by luck today. + +## Diagnosis history (so nobody re-runs it) + +1. PR #792's `test-scw-js` failed with the errors above; the PR also bumped viem to 2.57.20 + in scw_js/website → looked like version drift. +2. A merge-base worktree with viem **twins at 2.57.20/2.58.1** still failed → blamed viem's + new `Chain` members for a while. The inconvenient detail: those runs trusted `npx -y -p + typescript@5.9.3 tsc` to run TS 5.9.3 — it runs the local `node_modules` tsc (6.0.3), + so every "5.9 also fails" data point was actually 6.0.3. +3. A fresh main checkout, baseline `node_modules/.bin/tsc` (5.9.3): green; same tree with + only `typescript@6.0.3` swapped in: the six errors. TypeScript 6 is the one sufficient + trigger. viem version is irrelevant to *this* failure class. +4. scw_js with casts + `rootDir` on TS 6: green at 2.57.4 and 2.57.20 (full `npm run check`). From 28b46c8d7bda76637d1d24d46e2a1a4b8fa066fb Mon Sep 17 00:00:00 2001 From: fretchen Date: Thu, 19 Nov 2026 18:31:43 +0100 Subject: [PATCH 2/4] clean viem --- analytics/test/stats.test.ts | 2 +- scw_js/genimg_x402_token.ts | 22 +++++++++---------- scw_js/llm_x402_cron.ts | 7 +++--- scw_js/scripts/fee_allowances.ts | 11 ++++------ scw_js/scripts/sign_ownership_proof.ts | 3 +-- scw_js/test/getChain.test.ts | 17 ++++++++------ scw_js/test/growth_api.test.ts | 2 +- scw_js/test/x402_channel_sync.test.ts | 9 ++++---- scw_js/test/x402_offer_eure.test.ts | 3 +-- scw_js/vitest.config.js | 7 ++++++ scw_js/x402_channel_sync.ts | 5 ++--- scw_js/x402_server.ts | 3 +-- shared/chain-utils/src/index.ts | 3 +++ shared/chain-utils/src/viem.ts | 22 +++++++++++++++++++ x402_facilitator/chain_utils.ts | 2 +- .../test/eip712_reference.test.ts | 2 +- x402_facilitator/vitest.config.js | 7 ++++++ x402_facilitator/wallet_report_cron.ts | 2 +- x402_facilitator/wallet_report_fee.ts | 4 +--- 19 files changed, 81 insertions(+), 52 deletions(-) create mode 100644 shared/chain-utils/src/viem.ts diff --git a/analytics/test/stats.test.ts b/analytics/test/stats.test.ts index 7e5a29123..3575e8545 100644 --- a/analytics/test/stats.test.ts +++ b/analytics/test/stats.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; -import { privateKeyToAccount } from "viem/accounts"; +import { privateKeyToAccount } from "@fretchen/chain-utils"; // The handler's module-level storage is S3HitStorage; the range logic below is // tested directly against MemoryHitStorage instead. diff --git a/scw_js/genimg_x402_token.ts b/scw_js/genimg_x402_token.ts index d131e94a2..970a21752 100644 --- a/scw_js/genimg_x402_token.ts +++ b/scw_js/genimg_x402_token.ts @@ -5,30 +5,28 @@ import { isTestnet, loadPrivateKey, getRpcUrl, -} from "@fretchen/chain-utils"; -import { parseJsonBody, CORS_HEADERS, errorResponse, openAiError } from "./utils.js"; -import { - ImageGenerationRequestSchema, - ADVERTISED_MODELS, - MODEL_TO_PROVIDER, - type ImageGenerationResponse, -} from "./genimg_schemas.js"; -import type { z } from "zod"; -import { getContract, createWalletClient, createPublicClient, http, parseEther, + privateKeyToAccount, type PublicClient, type WalletClient, type Chain, type Account, type Transport, type GetContractReturnType, -} from "viem"; +} from "@fretchen/chain-utils"; +import { parseJsonBody, CORS_HEADERS, errorResponse, openAiError } from "./utils.js"; +import { + ImageGenerationRequestSchema, + ADVERTISED_MODELS, + MODEL_TO_PROVIDER, + type ImageGenerationResponse, +} from "./genimg_schemas.js"; +import type { z } from "zod"; import { generateAndUploadImage, JSON_BASE_PATH, type Provider } from "./image_service.js"; -import { privateKeyToAccount } from "viem/accounts"; import { createResourceServer, createPaymentRequirements, diff --git a/scw_js/llm_x402_cron.ts b/scw_js/llm_x402_cron.ts index 7ed054a15..a2aba2ee9 100644 --- a/scw_js/llm_x402_cron.ts +++ b/scw_js/llm_x402_cron.ts @@ -1,9 +1,10 @@ import { logger } from "./logger.js"; -import { createPublicClient, http, type Chain } from "viem"; import { + createPublicClient, getSettlementTokens, getViemChain, getRpcUrl, + http, type SettlementTokenInfo, } from "@fretchen/chain-utils"; import { @@ -133,9 +134,7 @@ async function readFeeAllowanceClaimsLeft( } try { const publicClient = createPublicClient({ - // The symlinked chain-utils' dist types resolve viem through its own node_modules copy; - // TS 6 refuses to treat that Chain and ours as the same type. Pin to this package's copy. - chain: getViemChain(network) as Chain, + chain: getViemChain(network), transport: http(getRpcUrl(network)), }); const allowance = await publicClient.readContract({ diff --git a/scw_js/scripts/fee_allowances.ts b/scw_js/scripts/fee_allowances.ts index 138800cbe..13ff6ff29 100644 --- a/scw_js/scripts/fee_allowances.ts +++ b/scw_js/scripts/fee_allowances.ts @@ -35,14 +35,11 @@ import { erc20Abi, formatUnits, http, - type Address, - type Chain, -} from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { + privateKeyToAccount, getRpcUrl, getViemChain, loadPrivateKey, + type Address, type SettlementTokenInfo, } from "@fretchen/chain-utils"; import { facilitatorFeeFor } from "../fee_config.js"; @@ -110,7 +107,7 @@ function units(atomic: bigint, decimals: number): string { function publicClientFor(network: string) { return createPublicClient({ - chain: getViemChain(network) as Chain, // single viem copy for TS 6 — see llm_x402_cron.ts + chain: getViemChain(network), transport: http(getRpcUrl(network)), }); } @@ -148,7 +145,7 @@ async function readBalance(pair: FeePair, owner: Address): Promise { const account = privateKeyToAccount(loadPrivateKey("NFT_WALLET_PRIVATE_KEY")); - const chain = getViemChain(pair.network) as Chain; // single viem copy for TS 6 + const chain = getViemChain(pair.network); const wallet = createWalletClient({ account, chain, transport: http(getRpcUrl(pair.network)) }); const hash = await wallet.writeContract({ address: pair.coin.address, diff --git a/scw_js/scripts/sign_ownership_proof.ts b/scw_js/scripts/sign_ownership_proof.ts index 7c437e64d..abd777609 100644 --- a/scw_js/scripts/sign_ownership_proof.ts +++ b/scw_js/scripts/sign_ownership_proof.ts @@ -11,8 +11,7 @@ * Usage (from scw_js/): npx tsx scripts/sign_ownership_proof.ts */ import dotenv from "dotenv"; -import { privateKeyToAccount } from "viem/accounts"; -import { loadPrivateKey } from "@fretchen/chain-utils"; +import { loadPrivateKey, privateKeyToAccount } from "@fretchen/chain-utils"; // Resolves relative to cwd (scw_js/), matching how npm run dev:* scripts are invoked. dotenv.config(); diff --git a/scw_js/test/getChain.test.ts b/scw_js/test/getChain.test.ts index e6e288eb9..2733b6be3 100644 --- a/scw_js/test/getChain.test.ts +++ b/scw_js/test/getChain.test.ts @@ -15,22 +15,25 @@ * - Mismatch causes settlement to fail AFTER expensive operations complete */ import { describe, test, expect } from "vitest"; -import { createPublicClient, http, type Chain } from "viem"; -import { optimism, optimismSepolia, base, baseSepolia } from "viem/chains"; - -// Import functions under test -import { getExpectedNetworks, validatePaymentNetwork } from "../getChain.js"; - -// Import from chain-utils import { + createPublicClient, + http, + optimism, + optimismSepolia, + base, + baseSepolia, getGenAiNFTMainnetNetworks, getGenAiNFTTestnetNetworks, getViemChain, getUSDCConfig, getRpcUrl, toCAIP2, + type Chain, } from "@fretchen/chain-utils"; +// Import functions under test +import { getExpectedNetworks, validatePaymentNetwork } from "../getChain.js"; + // USDC contracts expose name() and version() functions for EIP-712 domain // Note: They do NOT implement EIP-5267 eip712Domain(), so we read individual functions const USDC_ABI = [ diff --git a/scw_js/test/growth_api.test.ts b/scw_js/test/growth_api.test.ts index e51609e92..0e3c391eb 100644 --- a/scw_js/test/growth_api.test.ts +++ b/scw_js/test/growth_api.test.ts @@ -13,7 +13,7 @@ vi.mock("@fretchen/s3-utils", () => ({ // @fretchen/chain-utils, which resolves its own copy of viem through the // symlinked workspace package — a `vi.mock("viem")` in this package cannot // reach it. Signing for real is also the stronger test. -import { privateKeyToAccount } from "viem/accounts"; +import { privateKeyToAccount } from "@fretchen/chain-utils"; // ===== Test data ===== diff --git a/scw_js/test/x402_channel_sync.test.ts b/scw_js/test/x402_channel_sync.test.ts index d99ca931c..de00fc134 100644 --- a/scw_js/test/x402_channel_sync.test.ts +++ b/scw_js/test/x402_channel_sync.test.ts @@ -3,14 +3,13 @@ import type { Channel, ChannelStorage } from "@x402/evm/batch-settlement/server" const { mockReadContract } = vi.hoisted(() => ({ mockReadContract: vi.fn() })); -vi.mock("viem", async () => { - const actual = await vi.importActual("viem"); - return { ...actual, createPublicClient: vi.fn(() => ({ readContract: mockReadContract })) }; -}); - +// The module takes its viem surface through the chain-utils facade (see +// shared/VIEM_TS6_NOTES.md), so the client factory is mocked where it is imported from. vi.mock("@fretchen/chain-utils", () => ({ getViemChain: vi.fn(() => ({ id: 10 })), getRpcUrl: vi.fn(() => "https://rpc.example"), + createPublicClient: vi.fn(() => ({ readContract: mockReadContract })), + http: vi.fn(() => "transport"), })); import { resyncChannelState } from "../x402_channel_sync.js"; diff --git a/scw_js/test/x402_offer_eure.test.ts b/scw_js/test/x402_offer_eure.test.ts index faae0b8aa..3abbe8dd5 100644 --- a/scw_js/test/x402_offer_eure.test.ts +++ b/scw_js/test/x402_offer_eure.test.ts @@ -16,8 +16,7 @@ * this contract is precisely that spread — every `base.extra` key survives enhancement. */ import { describe, expect, it } from "vitest"; -import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; -import { EURE_ADDRESSES } from "@fretchen/chain-utils"; +import { EURE_ADDRESSES, generatePrivateKey, privateKeyToAccount } from "@fretchen/chain-utils"; import { createBatchSettlementPaymentRequirements, createPaymentRequirements, diff --git a/scw_js/vitest.config.js b/scw_js/vitest.config.js index 1c9dbee67..1b8a660e8 100644 --- a/scw_js/vitest.config.js +++ b/scw_js/vitest.config.js @@ -1,6 +1,13 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ + // One viem copy for the whole test graph: consumers import viem through + // @fretchen/chain-utils (see shared/VIEM_TS6_NOTES.md), which resolves its own + // node_modules copy — without dedupe the vi.mock("viem") in test/setup.ts would + // only intercept this package's copy, and the chain-utils re-export would run real. + resolve: { + dedupe: ["viem"], + }, test: { environment: "node", globals: true, diff --git a/scw_js/x402_channel_sync.ts b/scw_js/x402_channel_sync.ts index d10435f77..8802fea4e 100644 --- a/scw_js/x402_channel_sync.ts +++ b/scw_js/x402_channel_sync.ts @@ -1,5 +1,4 @@ -import { createPublicClient, http, type Chain } from "viem"; -import { getViemChain, getRpcUrl } from "@fretchen/chain-utils"; +import { createPublicClient, getViemChain, getRpcUrl, http } from "@fretchen/chain-utils"; import type { Channel, ChannelStorage } from "@x402/evm/batch-settlement/server"; import { logger } from "./logger.js"; @@ -78,7 +77,7 @@ export async function resyncChannelState( { dryRun = false }: { dryRun?: boolean } = {}, ): Promise { const client = createPublicClient({ - chain: getViemChain(network) as Chain, // single viem copy for TS 6 — see llm_x402_cron.ts + chain: getViemChain(network), transport: http(getRpcUrl(network)), }); diff --git a/scw_js/x402_server.ts b/scw_js/x402_server.ts index d8df04d10..5a38ce378 100644 --- a/scw_js/x402_server.ts +++ b/scw_js/x402_server.ts @@ -9,8 +9,7 @@ import { sanitizeResourceServiceMetadata, type SanitizedResourceServiceMetadata, } from "@x402/extensions/bazaar"; -import { loadPrivateKey } from "@fretchen/chain-utils"; -import { privateKeyToAccount } from "viem/accounts"; +import { loadPrivateKey, privateKeyToAccount } from "@fretchen/chain-utils"; import { S3ChannelStorage } from "./x402_channel_storage.js"; import { EXPOSED_X402_HEADERS } from "./utils.js"; import { logger } from "./logger.js"; diff --git a/shared/chain-utils/src/index.ts b/shared/chain-utils/src/index.ts index f52a89cfa..c4a28f86d 100644 --- a/shared/chain-utils/src/index.ts +++ b/shared/chain-utils/src/index.ts @@ -163,3 +163,6 @@ export { verifySignedMessage, type BearerPayload, } from "./auth-protocol"; + +// The viem facade — see src/viem.ts. Consumers import viem through this package. +export * from "./viem"; diff --git a/shared/chain-utils/src/viem.ts b/shared/chain-utils/src/viem.ts new file mode 100644 index 000000000..9d7f51167 --- /dev/null +++ b/shared/chain-utils/src/viem.ts @@ -0,0 +1,22 @@ +/** + * The viem facade — this package's consumers import the viem surface from here, never from + * "viem" directly. + * + * Why: each consumer compiles against two viem type copies — this package's (its resolved + * `import("viem")` finds `shared/chain-utils/node_modules/viem`) and its own `node_modules/viem` + * — and TypeScript 6 refuses to treat the two `Chain`s as the same type at any call site where + * they cross. Routing every viem import through this facade resolves all viem types through + * the one copy, so the crossing never happens, at any viem version. The full story, including + * the alternatives tested and discarded, is in `../../VIEM_TS6_NOTES.md` (repo root `shared/`). + * + * Extend deliberately: add entries here only when a consumer needs them, and never + * `export *` from "viem/accounts" — its names (signMessage, …) collide with viem's root + * exports, and ambiguous star re-exports are silently dropped, not errored. + */ + +export * from "viem"; +// "viem/chains" star-exports share names with viem's root (TS2308), so the module goes out +// as a namespace (`chains.base`), plus the four chains this repo's networks use, named. +export * as chains from "viem/chains"; +export { optimism, optimismSepolia, base, baseSepolia } from "viem/chains"; +export { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; diff --git a/x402_facilitator/chain_utils.ts b/x402_facilitator/chain_utils.ts index 8ec7c34ad..20a450f5b 100644 --- a/x402_facilitator/chain_utils.ts +++ b/x402_facilitator/chain_utils.ts @@ -5,7 +5,6 @@ * Uses @fretchen/chain-utils for chain/address data. */ -import type { Chain } from "viem"; import { getViemChain, tryGetEIP3009SplitterAddress, @@ -14,6 +13,7 @@ import { getSettlementTokens, type Network, type SettlementTokenInfo, + type Chain, } from "@fretchen/chain-utils"; export interface ChainConfig { diff --git a/x402_facilitator/test/eip712_reference.test.ts b/x402_facilitator/test/eip712_reference.test.ts index cd9670bcf..82c24f78c 100644 --- a/x402_facilitator/test/eip712_reference.test.ts +++ b/x402_facilitator/test/eip712_reference.test.ts @@ -8,7 +8,7 @@ */ import { describe, test, expect } from "vitest"; -import { hashTypedData, keccak256, toHex } from "viem"; +import { hashTypedData, keccak256, toHex } from "@fretchen/chain-utils"; describe("EIP-712 Reference Tests", () => { // Offizielle Test-Daten aus der EIP-712 Spezifikation diff --git a/x402_facilitator/vitest.config.js b/x402_facilitator/vitest.config.js index 21ea7d897..c4912a494 100644 --- a/x402_facilitator/vitest.config.js +++ b/x402_facilitator/vitest.config.js @@ -1,6 +1,13 @@ import { defineConfig, configDefaults } from "vitest/config"; export default defineConfig({ + // One viem copy for the whole test graph: consumers import viem through + // @fretchen/chain-utils (see shared/VIEM_TS6_NOTES.md), which resolves its own + // node_modules copy — without dedupe the vi.mock("viem") in the tests would only + // intercept this package's copy, and the chain-utils re-export would run real. + resolve: { + dedupe: ["viem"], + }, test: { environment: "node", globals: true, diff --git a/x402_facilitator/wallet_report_cron.ts b/x402_facilitator/wallet_report_cron.ts index 89ff2f74b..33664900c 100644 --- a/x402_facilitator/wallet_report_cron.ts +++ b/x402_facilitator/wallet_report_cron.ts @@ -35,7 +35,7 @@ import { formatEther, type Address, type Abi, -} from "viem"; +} from "@fretchen/chain-utils"; import { logger } from "./logger"; import { feeAmountFor, getFacilitatorAddress } from "./wallet_report_fee"; import { getChainConfig, getFeeTokens, getRpcUrl } from "./chain_utils"; diff --git a/x402_facilitator/wallet_report_fee.ts b/x402_facilitator/wallet_report_fee.ts index d6f4f37c6..a7c4c5dec 100644 --- a/x402_facilitator/wallet_report_fee.ts +++ b/x402_facilitator/wallet_report_fee.ts @@ -7,9 +7,7 @@ * same sitting. The stakes are low and one-sided: nothing funds-bearing runs here anymore, * a drift only mis-estimates the report's nominal-fee arithmetic. */ -import type { Address } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { loadPrivateKey } from "@fretchen/chain-utils"; +import { loadPrivateKey, privateKeyToAccount, type Address } from "@fretchen/chain-utils"; import { logger } from "./logger"; /** From a49f63e59f5e26d661fe320708fc2471410d9e4a Mon Sep 17 00:00:00 2001 From: fretchen Date: Thu, 19 Nov 2026 18:32:23 +0100 Subject: [PATCH 3/4] Delete VIEM_TS6_NOTES.md --- shared/VIEM_TS6_NOTES.md | 84 ---------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 shared/VIEM_TS6_NOTES.md diff --git a/shared/VIEM_TS6_NOTES.md b/shared/VIEM_TS6_NOTES.md deleted file mode 100644 index b1a2aabe7..000000000 --- a/shared/VIEM_TS6_NOTES.md +++ /dev/null @@ -1,84 +0,0 @@ -# The chain-utils viem instance split — and what TS 6 changed - -**For:** anyone bumping `typescript` in a package that consumes `@fretchen/chain-utils`, or -bumping `viem` anywhere. The constraint bit in PR #792 (CI log, 2026-11-19), and the diagnosis -was initially misattributed to viem version drift — the experiments that isolated it are -summarized last. - -## The setup - -Each npm package in this repo is independent — no workspace, no root `node_modules`. -`@fretchen/chain-utils` is installed as a `file:` dep, so its consumers see it as a symlink to -`shared/chain-utils`, whose `dist/*.d.ts` resolve `import("viem")` against **its own** -`shared/chain-utils/node_modules/viem`. The consumer package (scw_js, analytics, …) has its own -`node_modules/viem`. There are therefore always **two copies of the viem types in every -compile** that crosses the boundary, even when the manifest/lock versions are identical. -This is also why `test-viem-alignment.yml` pins all five lockfiles to one viem version. - -## What TS 6 changed - -TypeScript 5.9 structurally compared the two copies' `Chain` types and accepted them. -TypeScript 6.0 does not — it refuses the crossing outright: - -``` -error TS2322: Type 'Chain' is not assignable to type 'Chain | undefined'. - Type '…/shared/chain-utils/node_modules/viem/…/chain'.Chain' is not assignable to - type '…/scw_js/node_modules/viem/…/chain'.Chain'. -``` - -Verified on a clean checkout of main with **only** the compiler swapped -(`npm i --no-save typescript@6.0.3`): six errors in scw_js, four of them this class -(`llm_x402_cron.ts`, `x402_channel_sync.ts`, `scripts/fee_allowances.ts` ×2), all of them -independent of the viem version (reproduces identically at viem 2.57.4 and 2.57.20 twins). -The remaining two errors were the rootDir enforcement, a second TS 6 change: - -``` -error TS6059: File '…/observability/alertCoverage.ts' is not under 'rootDir' '…/scw_js'. -``` - -TS 6 also started inferring `rootDir` from `include` and enforcing that every input file sits -under it — `test/alert_coverage.test.ts` imports `../../observability/alertCoverage.ts`, -outside the package. (`rootDirs` does **not** silence this under TS 6; an explicit -`"rootDir": ".."` does.) - -## The current fixes (both in scw_js on the ts6 branch) - -1. **Pin the viem instance at the boundary** — cast `getViemChain(...)` to the consumer's own - `Chain` type where a chain-utils-produced chain enters a viem client - (`import { type Chain } from "viem"`, `getViemChain(network) as Chain`). These casts are - checked: with them, TS 6 compiles scw_js cleanly at both viem 2.57.4 and 2.57.20, tests - included. Any *new* code that passes a chain-utils viem object into this package's viem - (or vice versa) will need the same cast — this file is why. -2. **`"rootDir": ".."` in `scw_js/tsconfig.json`** for the imported `observability/alertCoverage.ts`. - -## What still needs solving in a future PR - -The casts are local damage control; the real debt is the instance split itself. Pick one and -do it as its own PR: - -- **Single viem instance for type-checking. Have consumers import the viem surface from - `@fretchen/chain-utils`** (re-export `createPublicClient`, `http`, `Chain`, …), and drop - their own direct `viem` dep — *every type position* then resolves through chain-utils' copy. - Watch out: `@x402/*` and `wagmi`/`viem`-peers still pull a hoisted copy for *their* emitted - types, so verify no call site mixes both instances again before deleting the casts. -- **Or move `getViemChain`'s return type out of the tangle:** make chain-utils export chain - descriptors only (id, rpcUrls, name…) and build the `viem.Chain` in the consumer. Bigger - API change, but it removes the ambiguity entirely. - -Until then: `typescript` bumps in chain-utils-consuming packages need the casts verified; -`viem` bumps need version alignment (all five lockfiles) **plus** the casts re-verified -against the new viem's type surface — TS 6's cross-instance comparison may bail at shapes -that cast only by luck today. - -## Diagnosis history (so nobody re-runs it) - -1. PR #792's `test-scw-js` failed with the errors above; the PR also bumped viem to 2.57.20 - in scw_js/website → looked like version drift. -2. A merge-base worktree with viem **twins at 2.57.20/2.58.1** still failed → blamed viem's - new `Chain` members for a while. The inconvenient detail: those runs trusted `npx -y -p - typescript@5.9.3 tsc` to run TS 5.9.3 — it runs the local `node_modules` tsc (6.0.3), - so every "5.9 also fails" data point was actually 6.0.3. -3. A fresh main checkout, baseline `node_modules/.bin/tsc` (5.9.3): green; same tree with - only `typescript@6.0.3` swapped in: the six errors. TypeScript 6 is the one sufficient - trigger. viem version is irrelevant to *this* failure class. -4. scw_js with casts + `rootDir` on TS 6: green at 2.57.4 and 2.57.20 (full `npm run check`). From 79dd1bce97b78271b8f41ef0cba4e775b99a6161 Mon Sep 17 00:00:00 2001 From: fretchen Date: Fri, 20 Nov 2026 06:49:41 +0100 Subject: [PATCH 4/4] cleaning further --- analytics/package-lock.json | 8 ++++---- analytics/package.json | 2 +- bunny_js/package-lock.json | 8 ++++---- bunny_js/package.json | 2 +- bunny_js/src/facilitator/chain_utils.ts | 2 +- bunny_js/src/facilitator/facilitator_instance.ts | 2 +- bunny_js/src/facilitator/x402_fee.ts | 6 +++--- bunny_js/src/x402_channel_sync.ts | 3 +-- bunny_js/test/facilitator/facilitator_routes.test.ts | 1 - bunny_js/test/x402_channel_sync.test.ts | 9 ++++----- bunny_js/tsconfig.json | 2 ++ bunny_js/vitest.config.js | 7 +++++++ comment_service/package-lock.json | 8 ++++---- comment_service/package.json | 2 +- comment_service/tsconfig.json | 1 + observability/package-lock.json | 8 ++++---- observability/package.json | 2 +- shared/chain-utils/package-lock.json | 6 ++++-- shared/chain-utils/package.json | 2 +- shared/s3-utils/package-lock.json | 8 ++++---- shared/s3-utils/package.json | 2 +- shared/s3-utils/tsconfig.json | 1 + x402_facilitator/package-lock.json | 8 ++++---- x402_facilitator/package.json | 2 +- x402_facilitator/tsconfig.json | 1 + 25 files changed, 57 insertions(+), 46 deletions(-) diff --git a/analytics/package-lock.json b/analytics/package-lock.json index 87ece444e..3c0f7f01d 100644 --- a/analytics/package-lock.json +++ b/analytics/package-lock.json @@ -25,7 +25,7 @@ "serverless-scaleway-functions": ">=0.4.16", "tsdown": "^0.23.1", "tsx": "^4.23.5", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "vitest": "^4.1.11" }, @@ -8107,9 +8107,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "devOptional": true, "license": "Apache-2.0", "bin": { diff --git a/analytics/package.json b/analytics/package.json index d320c0298..b7c3fbf5c 100644 --- a/analytics/package.json +++ b/analytics/package.json @@ -49,7 +49,7 @@ "serverless-scaleway-functions": ">=0.4.16", "tsdown": "^0.23.1", "tsx": "^4.23.5", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "vitest": "^4.1.11" }, diff --git a/bunny_js/package-lock.json b/bunny_js/package-lock.json index 1a148b2b3..d44c84650 100644 --- a/bunny_js/package-lock.json +++ b/bunny_js/package-lock.json @@ -27,7 +27,7 @@ "prettier": "^3.6.2", "tsdown": "^0.23.1", "tsx": "^4.23.15", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.58.2", "vitest": "^4.1.11" } @@ -3912,9 +3912,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "devOptional": true, "license": "Apache-2.0", "bin": { diff --git a/bunny_js/package.json b/bunny_js/package.json index e482942ab..10efa30fd 100644 --- a/bunny_js/package.json +++ b/bunny_js/package.json @@ -42,7 +42,7 @@ "prettier": "^3.6.2", "tsdown": "^0.23.1", "tsx": "^4.23.15", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.58.2", "vitest": "^4.1.11" }, diff --git a/bunny_js/src/facilitator/chain_utils.ts b/bunny_js/src/facilitator/chain_utils.ts index 8ec7c34ad..20a450f5b 100644 --- a/bunny_js/src/facilitator/chain_utils.ts +++ b/bunny_js/src/facilitator/chain_utils.ts @@ -5,7 +5,6 @@ * Uses @fretchen/chain-utils for chain/address data. */ -import type { Chain } from "viem"; import { getViemChain, tryGetEIP3009SplitterAddress, @@ -14,6 +13,7 @@ import { getSettlementTokens, type Network, type SettlementTokenInfo, + type Chain, } from "@fretchen/chain-utils"; export interface ChainConfig { diff --git a/bunny_js/src/facilitator/facilitator_instance.ts b/bunny_js/src/facilitator/facilitator_instance.ts index 3470d9224..ec5c90a30 100644 --- a/bunny_js/src/facilitator/facilitator_instance.ts +++ b/bunny_js/src/facilitator/facilitator_instance.ts @@ -10,7 +10,7 @@ * schemes coexist on the same /verify and /settle endpoints. */ -import { createPublicClient, createWalletClient, http, type Account } from "viem"; +import { createPublicClient, createWalletClient, http, type Account } from "@fretchen/chain-utils"; import { x402Facilitator } from "@x402/core/facilitator"; import { toFacilitatorEvmSigner } from "@x402/evm"; import { ExactEvmScheme } from "@x402/evm/exact/facilitator"; diff --git a/bunny_js/src/facilitator/x402_fee.ts b/bunny_js/src/facilitator/x402_fee.ts index db678f234..06fedd56a 100644 --- a/bunny_js/src/facilitator/x402_fee.ts +++ b/bunny_js/src/facilitator/x402_fee.ts @@ -17,14 +17,14 @@ import { http, getContract, nonceManager, + privateKeyToAccount, + loadPrivateKey, WaitForTransactionReceiptTimeoutError, type Address, type Abi, type Hex, -} from "viem"; -import { privateKeyToAccount } from "viem/accounts"; +} from "@fretchen/chain-utils"; import { logger } from "../logger"; -import { loadPrivateKey } from "@fretchen/chain-utils"; import { findFeeToken, getChainConfig, getRpcUrl } from "./chain_utils"; // ═══════════════════════════════════════════════════════════════ diff --git a/bunny_js/src/x402_channel_sync.ts b/bunny_js/src/x402_channel_sync.ts index f69f0d8ec..8802fea4e 100644 --- a/bunny_js/src/x402_channel_sync.ts +++ b/bunny_js/src/x402_channel_sync.ts @@ -1,5 +1,4 @@ -import { createPublicClient, http } from "viem"; -import { getViemChain, getRpcUrl } from "@fretchen/chain-utils"; +import { createPublicClient, getViemChain, getRpcUrl, http } from "@fretchen/chain-utils"; import type { Channel, ChannelStorage } from "@x402/evm/batch-settlement/server"; import { logger } from "./logger.js"; diff --git a/bunny_js/test/facilitator/facilitator_routes.test.ts b/bunny_js/test/facilitator/facilitator_routes.test.ts index 488113b7a..d27e260d4 100644 --- a/bunny_js/test/facilitator/facilitator_routes.test.ts +++ b/bunny_js/test/facilitator/facilitator_routes.test.ts @@ -496,7 +496,6 @@ describe("facilitator routes (verify + settle)", () => { throw new Error("the body must not be read when Content-Length already refuses"); }, } as unknown as Request; - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument await expect(readCappedBody(req)).resolves.toBe("too-large"); }); diff --git a/bunny_js/test/x402_channel_sync.test.ts b/bunny_js/test/x402_channel_sync.test.ts index 5906345d1..7f581e32e 100644 --- a/bunny_js/test/x402_channel_sync.test.ts +++ b/bunny_js/test/x402_channel_sync.test.ts @@ -3,14 +3,13 @@ import type { Channel, ChannelStorage } from "@x402/evm/batch-settlement/server" const { mockReadContract } = vi.hoisted(() => ({ mockReadContract: vi.fn() })); -vi.mock("viem", async () => { - const actual = await vi.importActual("viem"); - return { ...actual, createPublicClient: vi.fn(() => ({ readContract: mockReadContract })) }; -}); - +// The module takes its viem surface through the chain-utils facade (see +// shared/VIEM_TS6_NOTES.md), so the client factory is mocked where it is imported from. vi.mock("@fretchen/chain-utils", () => ({ getViemChain: vi.fn(() => ({ id: 10 })), getRpcUrl: vi.fn(() => "https://rpc.example"), + createPublicClient: vi.fn(() => ({ readContract: mockReadContract })), + http: vi.fn(() => "transport"), })); import { resyncChannelState } from "../src/x402_channel_sync.js"; diff --git a/bunny_js/tsconfig.json b/bunny_js/tsconfig.json index 76829792f..0a8fe1c8e 100644 --- a/bunny_js/tsconfig.json +++ b/bunny_js/tsconfig.json @@ -7,6 +7,8 @@ "verbatimModuleSyntax": true, "resolveJsonModule": true, "skipLibCheck": true, + "types": ["node"], + "rootDir": "..", "outDir": "dist", "declaration": false, "noEmit": true diff --git a/bunny_js/vitest.config.js b/bunny_js/vitest.config.js index 1c9dbee67..07514e676 100644 --- a/bunny_js/vitest.config.js +++ b/bunny_js/vitest.config.js @@ -1,6 +1,13 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ + // One viem copy for the whole test graph: the src takes its viem surface through + // @fretchen/chain-utils (see shared/VIEM_TS6_NOTES.md), which resolves its own + // node_modules copy — without dedupe the vi.mock("viem") in the tests would only + // intercept this package's copy, and the chain-utils re-export would run real. + resolve: { + dedupe: ["viem"], + }, test: { environment: "node", globals: true, diff --git a/comment_service/package-lock.json b/comment_service/package-lock.json index a7d6ba1bb..b87962592 100644 --- a/comment_service/package-lock.json +++ b/comment_service/package-lock.json @@ -20,7 +20,7 @@ "prettier": "^3.0.0", "serverless-scaleway-functions": ">=0.4.16", "tsdown": "^0.23.1", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "vitest": "^4.1.11" }, @@ -7399,9 +7399,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/comment_service/package.json b/comment_service/package.json index 45de29bb6..581342867 100644 --- a/comment_service/package.json +++ b/comment_service/package.json @@ -40,7 +40,7 @@ "prettier": "^3.0.0", "serverless-scaleway-functions": ">=0.4.16", "tsdown": "^0.23.1", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "vitest": "^4.1.11" }, diff --git a/comment_service/tsconfig.json b/comment_service/tsconfig.json index c70096b4f..f8a0a5410 100644 --- a/comment_service/tsconfig.json +++ b/comment_service/tsconfig.json @@ -13,6 +13,7 @@ "resolveJsonModule": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, + "types": ["node"], "noEmit": true }, "include": ["*.ts", "test/**/*.ts"], diff --git a/observability/package-lock.json b/observability/package-lock.json index 8244cf685..43cd06228 100644 --- a/observability/package-lock.json +++ b/observability/package-lock.json @@ -16,7 +16,7 @@ "eslint": "^10.0.0", "prettier": "^3.6.2", "tsx": "^4.23.12", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.58.2", "vitest": "^5.0.3" } @@ -2702,9 +2702,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/observability/package.json b/observability/package.json index b944f9c2c..4719f0d6b 100644 --- a/observability/package.json +++ b/observability/package.json @@ -22,7 +22,7 @@ "eslint": "^10.0.0", "prettier": "^3.6.2", "tsx": "^4.23.12", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.58.2", "vitest": "^5.0.3" } diff --git a/shared/chain-utils/package-lock.json b/shared/chain-utils/package-lock.json index 681fccc4e..e31c54687 100644 --- a/shared/chain-utils/package-lock.json +++ b/shared/chain-utils/package-lock.json @@ -12,7 +12,7 @@ "@vitest/coverage-v8": "^5.0.0", "eslint": "^10.0.0", "prettier": "^3.8.1", - "typescript": "^5.0.0", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "viem": "^2.57.4", "vitest": "^5.0.3" @@ -2292,7 +2292,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/shared/chain-utils/package.json b/shared/chain-utils/package.json index 51ebf5869..9b88ecfd6 100644 --- a/shared/chain-utils/package.json +++ b/shared/chain-utils/package.json @@ -31,7 +31,7 @@ "@vitest/coverage-v8": "^5.0.0", "eslint": "^10.0.0", "prettier": "^3.8.1", - "typescript": "^5.0.0", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "viem": "^2.57.4", "vitest": "^5.0.3" diff --git a/shared/s3-utils/package-lock.json b/shared/s3-utils/package-lock.json index e3c6cc3ef..4ada1f5eb 100644 --- a/shared/s3-utils/package-lock.json +++ b/shared/s3-utils/package-lock.json @@ -13,7 +13,7 @@ "@vitest/coverage-v8": "^5.0.0", "eslint": "^10.0.0", "prettier": "^3.8.1", - "typescript": "^5.0.0", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "vitest": "^5.0.3" } @@ -2244,9 +2244,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/shared/s3-utils/package.json b/shared/s3-utils/package.json index fed8d2b50..e5ebdbd3f 100644 --- a/shared/s3-utils/package.json +++ b/shared/s3-utils/package.json @@ -31,7 +31,7 @@ "@vitest/coverage-v8": "^5.0.0", "eslint": "^10.0.0", "prettier": "^3.8.1", - "typescript": "^5.0.0", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "vitest": "^5.0.3" } diff --git a/shared/s3-utils/tsconfig.json b/shared/s3-utils/tsconfig.json index bc5c409f5..12b916c78 100644 --- a/shared/s3-utils/tsconfig.json +++ b/shared/s3-utils/tsconfig.json @@ -10,6 +10,7 @@ "strict": true, "esModuleInterop": true, "skipLibCheck": true, + "types": ["node"], "forceConsistentCasingInFileNames": true }, "include": ["src"], diff --git a/x402_facilitator/package-lock.json b/x402_facilitator/package-lock.json index 5188fbba8..1148026c0 100644 --- a/x402_facilitator/package-lock.json +++ b/x402_facilitator/package-lock.json @@ -24,7 +24,7 @@ "serverless-scaleway-functions": ">=0.4.16", "tsdown": "^0.23.1", "tsx": "^4.23.13", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "vitest": "^4.1.11" }, @@ -8101,9 +8101,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "devOptional": true, "license": "Apache-2.0", "bin": { diff --git a/x402_facilitator/package.json b/x402_facilitator/package.json index ba3c27503..9ec329477 100644 --- a/x402_facilitator/package.json +++ b/x402_facilitator/package.json @@ -48,7 +48,7 @@ "serverless-scaleway-functions": ">=0.4.16", "tsdown": "^0.23.1", "tsx": "^4.23.13", - "typescript": "^5.9.3", + "typescript": "^6.0.3", "typescript-eslint": "^8.60.0", "vitest": "^4.1.11" }, diff --git a/x402_facilitator/tsconfig.json b/x402_facilitator/tsconfig.json index 339409432..ae58a690d 100644 --- a/x402_facilitator/tsconfig.json +++ b/x402_facilitator/tsconfig.json @@ -12,6 +12,7 @@ "resolveJsonModule": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, + "rootDir": "..", "noEmit": true }, "include": ["*.ts", "scripts/**/*.ts", "test/**/*.ts"],