stackup-wallet / userop.js

A simple JS library for building ERC-4337 UserOperations.
MIT License
117 stars 32 forks source link

BigNumber undefined #104

Open saugion opened 1 year ago

saugion commented 1 year ago

I receive the following error when I build my application: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'from')

It comes from exports.DEFAULT_VERIFICATION_GAS_LIMIT = ethers_1.ethers.BigNumber.from(70000); in builder.js

userop version is 0.3.3, ethers is 6.7.1, the latest.

Also constants like ethers.constants.ZeroAddress, ethers.constants.Zero, ethers.utils.hexlify , ethers_1.ethers.providers.JsonRpcProvider are not present in the latest ethers version.

I've also tried different versions but the issue persists. Could it be a conflict with other libraries? Thanks

saugion commented 1 year ago

I think the issue appears because i'm using ethers v6 in my project, but userop has a dependency to ethers v5. The framework i'm using seems to override the v5 with v6 at build time. It would be for userop to use ethers v6.

ketanjog commented 9 months ago

Got the same issue and you're right its bc ethers deprecated their use of BigNumber. I got around this by just going in and either swapping or wrapping with javascript's BigInt. Not sure if it'll work everytime but worth a try