Skip to content

BigInt Conversion Error with @reown/walletkit on React Native Hermes #27

@xwartz

Description

@xwartz

Describe the bug

After migrating from @walletconnect/web3wallet to @reown/walletkit v1.2.7, our React Native app crashes with BigInt conversion errors when running on Hermes JavaScript engine. The app fails to initialize WalletKit and throws "Cannot convert BigInt to number" and "Maximum call stack size exceeded" errors.

SDK Version (if relevant)

To Reproduce
Steps to reproduce the behavior:

  1. Create a React Native app with Hermes enabled (RN 0.71.x)
  2. Install @reown/[email protected] and related WalletConnect dependencies
  3. Import and initialize WalletKit:
    import { WalletKit } from '@reown/walletkit'
    import { Core } from '@walletconnect/core'
    
    const signClient = await WalletKit.init({
      core: new Core({
        projectId: 'your-project-id',
        relayUrl: 'wss://relay.walletconnect.com'
      }),
      metadata: {
        name: 'Test App',
        description: 'Test',
        url: 'https://test.com',
        icons: []
      }
    })
  4. See error: TypeError: Cannot convert BigInt to number, js engine: hermes

Expected behavior
WalletKit should initialize successfully on React Native Hermes, just like the previous @walletconnect/web3wallet did. The migration should be seamless without BigInt-related crashes.

Screenshots
Error logs:

ERROR ❌ BigInt polyfill error: {"error": "Maximum call stack size exceeded (native stack depth)", "value": "0x6c44198c4a475817", "valueType": "string"}
ERROR ❌ BigInt polyfill error: {"error": "Maximum call stack size exceeded", "value": 4294967295, "valueType": "number"}

Desktop (please complete the following information):

  • OS: macOS
  • Development Environment: React Native CLI
  • Version: React Native 0.71.x

Smartphone (please complete the following information):

  • Device: iPhone/Android simulators and physical devices
  • OS: iOS 15+/Android API 21+
  • JavaScript Engine: Hermes
  • Version: React Native 0.71.x

Additional context

  • The previous @walletconnect/web3wallet worked perfectly with the same setup
  • We've tried implementing comprehensive BigInt polyfills using big-integer library, but the errors persist
  • The issue appears to be internal to how @reown/walletkit handles BigInt operations
  • This is a blocking issue preventing React Native developers from upgrading to the latest WalletConnect SDK
  • Specific problematic values include large hex strings and numbers exceeding safe integer limits
  • The error occurs during WalletKit initialization, not during specific wallet operations

Migration context:
Before (Working):

import { Web3Wallet } from '@walletconnect/web3wallet'
signClient = await Web3Wallet.init({ core, metadata })

After (Crashing):

import { WalletKit } from '@reown/walletkit'
signClient = await WalletKit.init({ core, metadata })

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions