Published @bsv/templates@1.10.2 fails to construct token scripts when consumed through CommonJS with @bsv/sdk@2.8.0. This was found during reference-wallet dependency qualification and also reproduces in a fresh Node 24.18 directory containing only the two registry packages, outside Jest or React Native.
npm install --ignore-scripts --no-save @bsv/sdk@2.8.0 @bsv/templates@1.10.2
node -e "const {MandalaToken}=require('@bsv/templates'); console.log(new MandalaToken().lock('ab'.repeat(32)+'.0',1,Array(20).fill(0)).toHex())"
Actual: TypeError: _bsv_sdk_script_LockingScript.default is not a constructor.
Expected: a locking script for the synthetic asset and public-key hash; no network or wallet operation is involved.
The published CJS files call Rolldown's __toESM(sdkModule, 1), which forces Node default wrapping. SDK CJS leaf modules already expose __esModule and default, so the constructor becomes a nested object. The same wrapping occurs for 30 SDK default imports across the template artifacts, including OP, signatures and locking/unlocking scripts.
A temporary consumer compatibility patch in BSV Browser removes the forced Node flag only for those SDK imports. All 21 local-payment verification tests then pass, including the five token cases that fail on the unpatched package. The full wallet suite passes 1,135 tests. The durable fix should be in the templates build/source configuration with packed CommonJS and ESM behavioral tests, followed by a coordinated patch release; export-name presence alone does not catch this regression.
Coordination: reporting-only handle #570. No TS Stack source, release metadata, or publication has been changed by this report. Existing #569 remains with its current owner.
Published
@bsv/templates@1.10.2fails to construct token scripts when consumed through CommonJS with@bsv/sdk@2.8.0. This was found during reference-wallet dependency qualification and also reproduces in a fresh Node 24.18 directory containing only the two registry packages, outside Jest or React Native.npm install --ignore-scripts --no-save @bsv/sdk@2.8.0 @bsv/templates@1.10.2 node -e "const {MandalaToken}=require('@bsv/templates'); console.log(new MandalaToken().lock('ab'.repeat(32)+'.0',1,Array(20).fill(0)).toHex())"Actual:
TypeError: _bsv_sdk_script_LockingScript.default is not a constructor.Expected: a locking script for the synthetic asset and public-key hash; no network or wallet operation is involved.
The published CJS files call Rolldown's
__toESM(sdkModule, 1), which forces Node default wrapping. SDK CJS leaf modules already expose__esModuleanddefault, so the constructor becomes a nested object. The same wrapping occurs for 30 SDK default imports across the template artifacts, including OP, signatures and locking/unlocking scripts.A temporary consumer compatibility patch in BSV Browser removes the forced Node flag only for those SDK imports. All 21 local-payment verification tests then pass, including the five token cases that fail on the unpatched package. The full wallet suite passes 1,135 tests. The durable fix should be in the templates build/source configuration with packed CommonJS and ESM behavioral tests, followed by a coordinated patch release; export-name presence alone does not catch this regression.
Coordination: reporting-only handle #570. No TS Stack source, release metadata, or publication has been changed by this report. Existing #569 remains with its current owner.