web3modal icon indicating copy to clipboard operation
web3modal copied to clipboard

fix: make BIP122Verifier browser-compatible with dynamic import

Open yungyoseo opened this issue 1 month ago • 4 comments

Description

Fixed browser compatibility issue with BIP122Verifier by using dynamic import for bip322-js library. This resolves the "Cannot read properties of undefined (reading 'slice')" error that occurred when the verifier was exported in browser environments.

Type of change

  • [ ] Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

closes #5361

Showcase (Optional)

Before

Browser console error when BIP122Verifier was exported:

Uncaught TypeError: Cannot read properties of undefined (reading 'slice') at node_modules/readable-stream/lib/_stream_writable.js

After

  • No errors in browser console
  • Page renders correctly
  • BIP122Verifier works in browser environments without requiring explicit Node.js polyfills

Checklist

  • [ ] Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • [x] My changes generate no new warnings
  • [x] I have reviewed my own code
  • [x] I have filled out all required sections
  • [x] I have tested my changes on the preview link
  • [ ] Approver of this PR confirms that the changes are tested on the preview link

yungyoseo avatar Nov 24 '25 04:11 yungyoseo

🦋 Changeset detected

Latest commit: d2024411bccebb314b445affc00362e41b9f27e7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@reown/appkit-siwx Patch
@reown/appkit Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit-common Patch
@reown/appkit-universal-connector Patch
@reown/appkit-ui Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-utils Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-polyfills Patch
@reown/appkit-wallet Patch
@reown/appkit-siwe Patch
@reown/appkit-wallet-button Patch
@reown/appkit-cdn Patch
@reown/appkit-experimental Patch
@reown/appkit-testing Patch
@reown/appkit-cli Patch
@reown/appkit-pay Patch
@reown/appkit-codemod Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Nov 24 '25 04:11 changeset-bot[bot]

@yungyoseo is attempting to deploy a commit to the Reown Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Nov 24 '25 04:11 vercel[bot]

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar Nov 24 '25 04:11 github-actions[bot]

Excellent fix for the BIP122Verifier browser compatibility issue! I've encountered this exact 'Cannot read properties of undefined (reading slice)' error when integrating AppKit with Bitcoin address verification in browser environments. The dynamic import approach for the bip322-js library is the right solution - it prevents the Node.js-specific modules from breaking browser builds. I've been using AppKit extensively in my Base dApp development and browser compatibility is crucial for seamless user experience. The failing Vercel deployments seem to be authorization-related rather than code issues, which suggests the fix itself is solid. This change will make Bitcoin address verification much more reliable across different browser environments. Great work on maintaining the AppKit ecosystem's browser-first approach!

wearedood avatar Nov 24 '25 17:11 wearedood