decentraland-dapps
decentraland-dapps copied to clipboard
Optimized 'ethers' imports don't work on the Marketplace
Version v13.31.3 Includes a change to optimize ethers imports reducing the bundle size of importers considerably.
However, this change has brought some issues when being imported into the Marketplace.
One example is when the user attempts to sign-in the flow breaks with:
Which is caused by https://github.com/decentraland/decentraland-dapps/blob/master/src/modules/wallet/utils/buildWallet.ts#L20
The issue is fixed by changing:
import { Web3Provider } from '@ethersproject/providers/lib/web3-provider';
...
export async function buildWallet(appChainId: ChainId): Promise<Wallet> {
...
const eth = new Web3Provider(provider);
into:
import { ethers } from 'ethers';
...
export async function buildWallet(appChainId: ChainId): Promise<Wallet> {
...
const eth = new ethers.providers.Web3Provider(provider);
With this the user can start signing up, however, balances cannot be fetched and transactions cannot be sent, meaning it covers a lot of other aspects of the application.
To prevent blocking the marketplace from using any dapps updates, the changes to ethers can be reverted and re-evaluated on the future to work on all dapps.