Skip to content

fix(cross-platform): remove bitcoinjs deep imports from internals#61

Merged
landabaso merged 1 commit intomainfrom
remove_bjs_internals_call
Feb 25, 2026
Merged

fix(cross-platform): remove bitcoinjs deep imports from internals#61
landabaso merged 1 commit intomainfrom
remove_bjs_internals_call

Conversation

@landabaso
Copy link
Copy Markdown
Member

  • Reimplement required bitcoinjs internal helpers locally in src/bitcoinjs-lib-internals.ts (tapleafHash, tapTweakHash, witnessStackToScriptWitness, isTaprootInput) using public APIs and deterministic local serialization.
  • Remove runtime deep import resolver logic to avoid bitcoinjs-lib/src/* dependency in bundled output.
  • Update taproot control-block derivation in src/tapMiniscript.ts to use public payments.p2tr with scriptTree + redeem.
  • Remove deep type import from src/tapMiniscript.ts by introducing local Taptree typing.
  • Add test/bitcoinjsLibInternals.test.ts for behavior parity and a dist guard against reintroducing deep runtime imports.
  • Remove stale comment in src/tapTree.ts and bump package version to 3.0.6.

Why

Node, CodeSandbox and React Native/Metro resolve modules differently; deep imports and dynamic require fallbacks are brittle across environments. This change moves internals access (imports from bitcoinjs-lib/src/) to a stable, public-API-based path while preserving behavior.

Reimplement bitcoinjs-lib internal helpers locally to not import from
bitcoinjs-lib/src (which is error prone) so behavior stays stable across
Node.js, CodeSandbox and React Native/Metro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant