use-wallet
use-wallet copied to clipboard
MetaMask - RPC Error: missing value for required argument 1
<UseWalletProvider
chainId={4}
connectors={{
injected: {},
walletconnect: {
rpcUrl:
"rinkby rpc url ",
},
}}
>
- Whenever clicking on the connect button metamask gets connected but it shows MetaMask - RPC Error: missing value for required argument 1 error in the console.log
Currently into the same issue. Have you figured it out @njaindeqode ?
Hey everyone ๐๐ผ
This is no longer the right way to pass arguments to the provider. In particular, the provider no longer accepts the argument chainId
. You now have to pass the id as part of each connector you want to use.
The reason for this is that you can tell useWallet
to be be aware of several networks at the same time. WIth Metamask, for example, this allows you to change the network in your wallet. Network changes will then be picked up and reflected by useWallet
.
For that to work, you can set the injected
connector as follows:
injected: {
chainId: [1, 4],
},
@WissenIstNacht I followed your way but still getting this error, can you help me please?
Hey, could you share the code snippet where you call the context provider? Something like OP did in the first comment.
@lclement927 you probably didn't wrap it in connectors
<UseWalletProvider autoConnect connectors={{ injected:{ chainId: [1] } }} >
@WissenIstNacht would be a good idea to update the API section in the doc as it still lists chainId
@WissenIstNacht but with this config connect() doesn't seem to work anymore.
I'm still seeing the MetaMask RPC Error: missing value for required argument 1, and I'm not using the chainId
prop:
<UseWalletProvider
autoConnect={true}
pollBalanceInterval={10000}
pollBlockNumberInterval={10000}
connectors={{
injected: {
//allows you to connect and switch between mainnet and rinkeby within Metamask.
chainId: [1, 4, 1337],
}
}}>
i am also getting same error
connectors={{ injected: { chainId: chains, },
Any update on this?
Same issue here
Is there still no fix for this?
I got it fixed by making a patch for 0.13.4 Follow the steps from https://www.mariokandut.com/how-to-patch-an-npm-dependency/#use-patch-package to apply the patch.
- Skip the first part, as I already made the patch file.
- Add a patches folder in your root where package.json is located
- Add the post install script as shown in the link
- Add the package as dev dependency
- Reinstall packages with yarn / npm
Download the zip here to find the patch file https://gist.github.com/albsa/97a0b5a5f507db420f9ab6449da705b1
Good luck all
EDIT: If anyone else is interested, I also fixed 0.13.6, removed the image error for people who are using next.js including the metamask error:
https://www.npmjs.com/package/@albs1/use-wallet