From 54fd4a526c4463c11b467306fb364cbfc8a90346 Mon Sep 17 00:00:00 2001 From: Ignat Date: Thu, 4 Jun 2026 15:09:58 -0300 Subject: [PATCH 1/7] fix(build): exclude test files from tsc emit in types and networks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both packages were emitting *.test.js / *.test.d.ts triples into dist/, which would ship in the published tarball. Match codec's existing pattern: include src/**/*.ts + exclude src/**/*.test.ts. Also aligns include glob from `src/**/*` (networks) to `src/**/*.ts` — the broader glob was causing exclude to be ignored by tsc. Fixes: Ft --- packages/networks/tsconfig.json | 5 +++-- packages/types/tsconfig.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/networks/tsconfig.json b/packages/networks/tsconfig.json index ef3e2e4..9b5d940 100644 --- a/packages/networks/tsconfig.json +++ b/packages/networks/tsconfig.json @@ -14,10 +14,11 @@ "skipLibCheck": true }, "include": [ - "src/**/*" + "src/**/*.ts" ], "exclude": [ "node_modules", - "dist" + "dist", + "src/**/*.test.ts" ] } diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index 7e8f270..981f506 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -15,5 +15,5 @@ "noUncheckedIndexedAccess": true }, "include": ["src/**/*.ts"], - "exclude": ["dist", "node_modules"] + "exclude": ["dist", "node_modules", "src/**/*.test.ts"] } From adb60e0b4696e9c123648183039ad187bb6217a3 Mon Sep 17 00:00:00 2001 From: Ignat Date: Thu, 4 Jun 2026 15:10:07 -0300 Subject: [PATCH 2/7] fix(codec): promote @void-layer/types to dependency, add sideEffects, lower engines floor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - F1: Move @void-layer/types from devDependencies to dependencies so TS consumers installing only @void-layer/codec get the type auto-installed (dist/index.d.ts imports Invoice from @void-layer/types). - F3: Add sideEffects field — wasm init files are side-effectful; JS/TS modules are tree-shakeable. Prevents bundlers from dropping wasm init. - F4: Lower engines.node from >=24 to >=20 to cover Node 20/22/24 LTS. Build confirmed green with current toolchain (wasm-pack 0.13.1). --- packages/codec/package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/codec/package.json b/packages/codec/package.json index 9e77546..d8b570b 100644 --- a/packages/codec/package.json +++ b/packages/codec/package.json @@ -43,6 +43,7 @@ "voidpay", "void-layer" ], + "sideEffects": ["*.wasm", "pkg/**", "pkg-node/**"], "publishConfig": { "access": "public", "provenance": true @@ -62,11 +63,13 @@ "lint": "cargo clippy --all-targets --all-features --locked -- -D warnings && cargo fmt --manifest-path Cargo.toml -- --check && eslint src", "size": "ls -la pkg/void_layer_codec_bg.wasm" }, + "dependencies": { + "@void-layer/types": "workspace:^" + }, "peerDependencies": { "brotli-wasm": "^3.0.1" }, "devDependencies": { - "@void-layer/types": "workspace:^", "@types/node": "25.9.1", "@vitest/coverage-v8": "4.1.8", "brotli-wasm": "^3.0.1", @@ -76,6 +79,6 @@ "vitest": "^4.1.8" }, "engines": { - "node": ">=24" + "node": ">=20" } } From b8bbfc6cf2976f3e9c72e9de0d63d8e4b00a8ed0 Mon Sep 17 00:00:00 2001 From: Ignat Date: Thu, 4 Jun 2026 15:10:13 -0300 Subject: [PATCH 3/7] fix(networks): workspace:* -> workspace:^ for types dep, add sideEffects: false MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - F5: Change @void-layer/types from workspace:* (publishes as exact 0.1.0 pin) to workspace:^ (publishes as ^0.1.0) for patch-version flexibility. - F3: Add sideEffects: false — pure data/functions package, safe for tree-shaking by bundlers. --- packages/networks/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/networks/package.json b/packages/networks/package.json index fcee9cf..0023368 100644 --- a/packages/networks/package.json +++ b/packages/networks/package.json @@ -23,9 +23,10 @@ "homepage": "https://github.com/void-layer/codec/tree/main/packages/networks#readme", "bugs": { "url": "https://github.com/void-layer/codec/issues" }, "keywords": ["voidpay","void-layer","ethereum","chains","tokens","web3"], + "sideEffects": false, "publishConfig": { "access": "public", "provenance": true }, "dependencies": { - "@void-layer/types": "workspace:*" + "@void-layer/types": "workspace:^" }, "peerDependencies": { "viem": ">=2.0.0 <3.0.0" From bbc11fc5d9b690b7e60648cad937ca575808d9ac Mon Sep 17 00:00:00 2001 From: Ignat Date: Thu, 4 Jun 2026 15:10:22 -0300 Subject: [PATCH 4/7] fix(codec): apply typed cast to wasm bindings in bundler entry (F7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bundler entry (src/index.ts) was re-exporting raw wasm bindings whose generated .d.ts types were `any`. Apply the same typed-cast pattern used in index.node.ts: import * as _wasmPkg, cast to a typed surface with Invoice return types, then re-export named consts. Runtime behaviour is unchanged — same WASM functions, same bytes. Bundler consumers now get Invoice / Uint8Array return types in their IDE and tsc --noEmit checks instead of `any`. Verified: tsc --noEmit on fresh consumer project exits 0 with strict mode. --- packages/codec/src/index.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/codec/src/index.ts b/packages/codec/src/index.ts index 178094f..52448f3 100644 --- a/packages/codec/src/index.ts +++ b/packages/codec/src/index.ts @@ -15,15 +15,20 @@ import type { BrotliWasmType } from 'brotli-wasm' import type { Invoice } from '@void-layer/types' import { encodeWire, decodeWire } from './wire.js' -// Import the canonical WASM functions for use in the wire shim below, and -// re-export them as part of the public API. -import { - encodeInvoiceCanonical, - decodeInvoiceCanonical, - receiptHash, -} from '../pkg/void_layer_codec.js' - -export { encodeInvoiceCanonical, decodeInvoiceCanonical, receiptHash } +// Import the canonical WASM module and cast to a typed surface so that +// consumers get proper Invoice types (not `any`) in the generated .d.ts. +// Runtime behaviour is unchanged — these are the same WASM functions. +import * as _wasmPkg from '../pkg/void_layer_codec.js' + +const _wasm = _wasmPkg as unknown as { + encodeInvoiceCanonical: (invoice: Invoice) => Uint8Array + decodeInvoiceCanonical: (bytes: Uint8Array) => Invoice + receiptHash: (canonical_bytes: Uint8Array) => Uint8Array +} + +export const encodeInvoiceCanonical = _wasm.encodeInvoiceCanonical +export const decodeInvoiceCanonical = _wasm.decodeInvoiceCanonical +export const receiptHash = _wasm.receiptHash // --------------------------------------------------------------------------- // Brotli lazy init (mirrors compressPayload reference pattern) From 71d793f51b0d0b679653cdea273996ab7856ab33 Mon Sep 17 00:00:00 2001 From: Ignat Date: Thu, 4 Jun 2026 15:10:28 -0300 Subject: [PATCH 5/7] fix(codec): correct stale CodecError variant name in test comment (D5) Comment referenced CodecError::PrecisionLoss; the actual variant is CodecError::InvalidAmount. Comment-only change, no logic affected. --- packages/codec/src/index.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/codec/src/index.test.ts b/packages/codec/src/index.test.ts index 6869911..26c982e 100644 --- a/packages/codec/src/index.test.ts +++ b/packages/codec/src/index.test.ts @@ -156,8 +156,8 @@ describe('decodeInvoiceWire decompression-bomb guard', () => { }) // --------------------------------------------------------------------------- -// G-11 T5: write_quantity rejects > 9 significant decimals (PrecisionLoss). -// T5 changed silent clamp → explicit CodecError::PrecisionLoss throw. +// G-11 T5: write_quantity rejects > 9 significant decimals (InvalidAmount). +// T5 changed silent clamp → explicit CodecError::InvalidAmount throw. // --------------------------------------------------------------------------- describe('G-11: write_quantity PrecisionLoss on >9 decimals (T5)', () => { From f175ff13ce47d84d2ca101278ee11b3884bcbbed Mon Sep 17 00:00:00 2001 From: Ignat Date: Thu, 4 Jun 2026 15:10:57 -0300 Subject: [PATCH 6/7] chore: update pnpm-lock.yaml after codec dependency promotion Reflects @void-layer/types moving from devDependencies to dependencies in @void-layer/codec (F1 fix). --- pnpm-lock.yaml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 733c758..5354e62 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,6 +28,10 @@ importers: version: 8.60.1(eslint@10.4.1)(typescript@6.0.3) packages/codec: + dependencies: + '@void-layer/types': + specifier: workspace:^ + version: link:../types devDependencies: '@types/node': specifier: 25.9.1 @@ -35,9 +39,6 @@ importers: '@vitest/coverage-v8': specifier: 4.1.8 version: 4.1.8(vitest@4.1.8) - '@void-layer/types': - specifier: workspace:^ - version: link:../types brotli-wasm: specifier: ^3.0.1 version: 3.0.1 @@ -57,7 +58,7 @@ importers: packages/networks: dependencies: '@void-layer/types': - specifier: workspace:* + specifier: workspace:^ version: link:../types devDependencies: '@vitest/coverage-v8': @@ -471,66 +472,79 @@ packages: resolution: {integrity: sha512-DxH0P3wxm+Yzs/p3zrk9dw1rURu8p0Nv5+MRK/L7OtnLNg5rLZraSBFZ8iUXOd9f2BlhJyEpIZUH/emjq4UJ4g==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.61.0': resolution: {integrity: sha512-T6ZvMNe84kAz6TBWHC7hGAoEtzP1LWYw/AqayGWEF6uISt3Abk/st06LqRD9THd7Xz3NxzurUpzAuEAUbZf+nw==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.61.0': resolution: {integrity: sha512-q/4hzvQkDs8b4jIBab1pnLiiM0ayTZsN2amBFPDzuyZxjEd4wDwx0UJFYM3cOZzSf5Kw8fnWSprJzIBMkcR44Q==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.61.0': resolution: {integrity: sha512-vvYWX3akdEAY6km+9wAqFDnk6pQsbJKVnj7xawcvs/+fdlYBGp+U+Qq/lLfpIxYIZvZLHMAKD9HLdacSx/r3dw==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.61.0': resolution: {integrity: sha512-DePa5cqOxDP/Zp0VOXpeWaGew5iIv5DXp9NYbzkX5PFQyWVX9184WCTh3hvr/7lhXo8ZVlbFLkz8+o/q1dU6gA==} cpu: [loong64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-loong64-musl@4.61.0': resolution: {integrity: sha512-LV8aWMB8UChglMCEzs7RkN0GsH29RJaLLqwm9fCIjlqwxQTiWAqNcc7wjBkH31hV0PU/yVxGYvrYsgfea2qw6g==} cpu: [loong64] os: [linux] + libc: [musl] '@rollup/rollup-linux-ppc64-gnu@4.61.0': resolution: {integrity: sha512-QoNSnwQtaeNu5grdBbsL0tt1uyl5EnS8DA8Mr3nluMXbhdQNyhN+G4tBax7VCdxLKj8YJ0/4OO9Ho84jMnJtKA==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-ppc64-musl@4.61.0': resolution: {integrity: sha512-/zZp5MKapIIApE8trN8qLGNSiRN9TUoaUZ1cmVu4XnVdd5LQLOXTtyi+vtfUbNnT3iyjzpPqYeKXmvJ+gJGYWw==} cpu: [ppc64] os: [linux] + libc: [musl] '@rollup/rollup-linux-riscv64-gnu@4.61.0': resolution: {integrity: sha512-RbrzcD3aJ1k3UbtMRRBNwojdVVyXjuVAFTfn/xPa6EEl6GE9Sm/akPgFTb9aAC9pMKGJ6CtWxaGrqWcabH+ySg==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.61.0': resolution: {integrity: sha512-ZF+onDsBso8PJf1XaG9lB+O9RnBpKGnY6OrzC4CSHrtC1jb6jWLTKK4bRqdoCXHd22gyr2hiYmEAm8Wns/BOCw==} cpu: [riscv64] os: [linux] + libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.61.0': resolution: {integrity: sha512-Atk0aSIk5Zx2Wuh9dgRQgLP0Koc8hOeYpbWryMXyk8G8/HmPkwPPkMqIIDhrXHHYqfUzSJA/I7IWSBv8xSmRBA==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.61.0': resolution: {integrity: sha512-0uMOcf3eZ5K+K4cYHkdxShFMPlPXCOdfDFEFn9dNYAEEd2cVvmOfH7zFgRVoDgmtQ1m9k5q7qfrHzyMAubKYUA==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.61.0': resolution: {integrity: sha512-mvFtE4A/t/7hRJ7X8Ozmu8FsIkAUat2nzl12pgU337BRmq87AQUJztwHz2Zv5/tjo9/C95E66CK03SI/ToEDJw==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-openbsd-x64@4.61.0': resolution: {integrity: sha512-z9b9+aTxvt8n2rNltMPvyaUfB8NJ+CVyOrGK/MdIKHx7B+lXmZpm/XbRsU7Rpf3fRqJ2uS6mBJiJveCtq8LHDg==} @@ -597,36 +611,42 @@ packages: engines: {node: '>=10'} cpu: [arm64] os: [linux] + libc: [glibc] '@swc/core-linux-arm64-musl@1.15.33': resolution: {integrity: sha512-il7tYM+CpUNzieQbwAjFT1P8zqAhmGWNAGhQZBnxurXZ0aNn+5nqYFTEUKNZl7QibtT0uQXzTZrNGHCIj6Y1Og==} engines: {node: '>=10'} cpu: [arm64] os: [linux] + libc: [musl] '@swc/core-linux-ppc64-gnu@1.15.33': resolution: {integrity: sha512-ZtNBwN0Z7CFj9Il0FcPaKdjgP7URyKu/3RfH46vq+0paOBqLj4NYldD6Qo//Duif/7IOtAraUfDOmp0PLAufog==} engines: {node: '>=10'} cpu: [ppc64] os: [linux] + libc: [glibc] '@swc/core-linux-s390x-gnu@1.15.33': resolution: {integrity: sha512-De1IyajoOmhOYYjw/lx66bKlyDpHZTueqwpDrWgf5O7T6d1ODeJJO9/OqMBmrBQc5C+dNnlmIufHsp4QVCWufA==} engines: {node: '>=10'} cpu: [s390x] os: [linux] + libc: [glibc] '@swc/core-linux-x64-gnu@1.15.33': resolution: {integrity: sha512-mGTH0YxmUN+x6vRN/I6NOk5X0ogNktkwPnJ94IMvR7QjhRDwL0O8RXEDhyUM0YtwWrryBOqaJQBX4zruxEPRGw==} engines: {node: '>=10'} cpu: [x64] os: [linux] + libc: [glibc] '@swc/core-linux-x64-musl@1.15.33': resolution: {integrity: sha512-hj628ZkSEJf6zMf5VMbYrG2O6QqyTIp2qwY6VlCjvIa9lAEZ5c2lfPblCLVGYubTeLJDxadLB/CxqQYOQABeEQ==} engines: {node: '>=10'} cpu: [x64] os: [linux] + libc: [musl] '@swc/core-win32-arm64-msvc@1.15.33': resolution: {integrity: sha512-GV2oohtN2/5+KSccl86VULu3aT+LrISC8uzgSq0FRnikpD+Zwc+sBlXmoKQ+Db6jI57ITUOIB8jRkdGMABC29g==} From 356c0038aafe1ad69decaa8748563f4ce688a7b8 Mon Sep 17 00:00:00 2001 From: Ignat Date: Thu, 4 Jun 2026 15:22:41 -0300 Subject: [PATCH 7/7] fix(codec): correct stale variant name in remaining describe() label (D5) --- packages/codec/src/index.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/codec/src/index.test.ts b/packages/codec/src/index.test.ts index 26c982e..e3585b5 100644 --- a/packages/codec/src/index.test.ts +++ b/packages/codec/src/index.test.ts @@ -160,7 +160,7 @@ describe('decodeInvoiceWire decompression-bomb guard', () => { // T5 changed silent clamp → explicit CodecError::InvalidAmount throw. // --------------------------------------------------------------------------- -describe('G-11: write_quantity PrecisionLoss on >9 decimals (T5)', () => { +describe('G-11: write_quantity InvalidAmount on >9 decimals (T5)', () => { it('G-11: write_quantity rejects > 9 significant decimals (T5)', () => { const inv: Invoice = { ...MINIMAL_INVOICE,