Comments (14)
There is a fix for this available at the latest alpha version of the injected module. Thank you for reporting!
from web3-onboard.
@Adamj1232 I am using the exact same config-overrides.js as you. Here is my services.js:
import { init } from '@web3-onboard/react'
import injectedModule from '@web3-onboard/injected-wallets'
import walletConnectModule from '@web3-onboard/walletconnect'
import coinbaseModule from '@web3-onboard/coinbase'
import gnosisModule from '@web3-onboard/gnosis'
import metamaskModule from '@web3-onboard/metamask'
import { CONSTANTS } from '../utils/constants'
const apiKey = process.env.REACT_APP_BLOCKNATIVE_KEY;
const injected = injectedModule();
const coinbase = coinbaseModule();
const walletConnect = walletConnectModule({
projectId: process.env.REACT_APP_WALLETCONNECT_PROJECT_ID,
// dappUrl: 'https://reactdemo.blocknative.com/'
});
const gnosis = gnosisModule()
const metamask = metamaskModule({
options: {
extensionOnly: false,
i18nOptions: {
enabled: true
},
dappMetadata: {
name: 'Web3Onboard React Demo'
}
}
})
export const initWeb3Onboard = init({
connect: {
autoConnectAllPreviousWallet: true
},
wallets: [
metamask,
injected,
walletConnect,
coinbase,
gnosis,
],
chains: [
{
id: 1,
token: 'ETH',
label: 'Ethereum',
rpcUrl: CONSTANTS.RPC_URLS[1],
},
{
id: 8453,
token: 'ETH',
label: 'Base',
rpcUrl: CONSTANTS.RPC_URLS[8453]
},
],
appMetadata: {
name: 'My dApp Name',
description: 'My dApp description',
recommendedInjectedWallets: [
{ name: 'Coinbase', url: 'https://wallet.coinbase.com/' },
{ name: 'MetaMask', url: 'https://metamask.io' }
],
},
accountCenter: {
desktop: {
enabled: true,
position: 'topRight',
},
mobile: {
enabled: true,
position: 'topRight'
}
},
apiKey,
theme: 'dark'
})
Then in my Layout/index.js I'm using init like this:
const [{ wallet, connecting }, connect, disconnect] = useConnectWallet();
const [web3Onboard, setWeb3Onboard] = useState(null);
useEffect(() => {
setWeb3Onboard(initWeb3Onboard)
}, []);
const onClickConnect = () => {
if (wallet) disconnect(wallet);
else {
connect();
}
}
Again, now the dApp doesn't crash anymore, and connection with injected wallet works as well, but the error is still in the console:
from web3-onboard.
@BenAzlay please have a look at our react demo project that utilizing craco - https://github.com/blocknative/react-demo
from web3-onboard.
@Adamj1232 Your react demo uses React App Rewired and not Craco. Nevertheless I tried replacing Craco with React App React on my dApp and now the behavior is as follows:
- The dApp crashes for a split second with the "Cannot assign to read only property 'request' of object '[object Object]'" error before it goes back to normal
- That error still appears in the console
from web3-onboard.
Same here running a boilerplate nextjs running with some issue
"use client";
import { URLS } from "@/constants/urls";
import type { Chain, ChainWithDecimalId } from "@web3-onboard/common";
import injectedModule from "@web3-onboard/injected-wallets";
import { init } from "@web3-onboard/react";
const chains: (Chain | ChainWithDecimalId)[] = [
{
id: 1,
token: "ETH",
label: "Ethereum Mainnet",
rpcUrl: URLS.mainnetRPCUrl,
},
{
id: 11155111,
token: "sETH",
label: "Ethereum Sepolia",
rpcUrl: URLS.sepoliaRPCUrl,
},
];
const injected = injectedModule?.();
const wallets = [injected];
export const web3Onboard = init({
wallets,
chains,
});
![Screenshot 2024-03-26 at 9 57 51 PM](https://private-user-images.githubusercontent.com/26382836/316891048-afaf0dd0-1a34-461f-960b-6b15d168dd33.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTU1NTExMzYsIm5iZiI6MTcxNTU1MDgzNiwicGF0aCI6Ii8yNjM4MjgzNi8zMTY4OTEwNDgtYWZhZjBkZDAtMWEzNC00NjFmLTk2MGItNmIxNWQxNjhkZDMzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTEyVDIxNTM1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZhOTk1MjAzNGYyMmFiYTI2ZWEwZjNhMmRhN2VkOWFkMmIzMmQ2YWNkNjc1YzI2YTM0YjJkMjNiNDBkNTNiMGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.8p4TUDPAQpfWr5NQpSBpGKjDQnoiituvc_JTzDERVkc)
from web3-onboard.
@BenAzlay ah you are correct, we used to have a CRACO application but we did update to rewired on the react-demo project. If you look at the config-overrides here https://github.com/blocknative/react-demo/blob/master/config-overrides.js that should get your app up an running.
@ayepRahman Im not sure why you have a ?.
there but please also have a look at the react project for proper initialization or checkout our examples folder - https://github.com/blocknative/web3-onboard/tree/develop/examples
from web3-onboard.
@Adamj1232 initially I followed the example without the ?.
. The example shows nextjs using page routing instead of app routing.
![Screenshot 2024-03-27 at 12 14 01 AM](https://private-user-images.githubusercontent.com/26382836/316948483-277809c6-8210-4e9d-9fcb-1edab7c50ad7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTU1NTExMzYsIm5iZiI6MTcxNTU1MDgzNiwicGF0aCI6Ii8yNjM4MjgzNi8zMTY5NDg0ODMtMjc3ODA5YzYtODIxMC00ZTlkLTlmY2ItMWVkYWI3YzUwYWQ3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTEyVDIxNTM1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUyNjc2MzA3YzkxMzkwYjIzOTU3MTljNmJjNjBmYmY3OGJjZTFlNjE5MGJkZDM1M2ZhMDVkNmVmNTA0NDMxODImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RnBVRE9pWyozyu28054moWRurKDSW3lXnkJ3cB3Ui0Q)
from web3-onboard.
downgrading from 2.10.12 to 2.8.5 doesn't throw the error.
from web3-onboard.
@ayepRahman is that the max version before errors present?
from web3-onboard.
@BenAzlay what version of node? Are you using npm, yarn?
from web3-onboard.
@Adamj1232 I'm using npm, and Node v18.17.1 (as mentioned in my initial comment)
from web3-onboard.
I am experiencing the same problem - it works fine, but throws the error in the console.
from web3-onboard.
@BenAzlay which wallets do you have added to your browser?
from web3-onboard.
There is a fix for this available at the latest alpha version of the injected module. Thank you for reporting!
I confirm this fixed it (updating @web3-onboard/injected-wallets to version 2.10.14-alpha.1). Thank you so much!
from web3-onboard.
Related Issues (20)
- Sveltekit example does not work with vercel HOT 3
- How can I bypass account selection when refresh page?
- Merge
- Hola
- Sígueme
- Cesar
- [Feature]: enableMobileWalletLink for @coinbase/wallet-sdk HOT 2
- Non-existing Inter font was used HOT 2
- Walletconnect with coinbase wallet does not work from android device.
- Documentation mention wrong package `@web3-onboard/injected` HOT 4
- [Feature]: eip1271
- [BUG]: Event when user disconnects all wallets HOT 2
- [Feature]: Compatibility with Flutter
- thanks
- [Feature]: ALI Token Support
- connectWallet with autoSelect disables all wallets list
- [Feature]: Bloom Wallet Integration HOT 1
- curl -X GET "https://api.w3.org/ecosystems" -H "accept: application/json"
- WalletConnect not working with my custom evm chain
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web3-onboard.