Comments (5)
pushed a change to update the signer field on change
from eth-ui.
I think this is also related to the useSignerAddress
hook because with the fix implemented in #178, running the test scenario again, logging ethersContext.signer
when it changes:
After changing accounts, the signer on ethersContext
is correct but the result of useSignerAddress
is still outdated:
from eth-ui.
I've been experiencing this issue for many days now and didn't know what was going on.
But it came with another symptom, and I kept blaming Metamask for it: my transactions would fail with a Metamask error saying RPC Error: Invalid parameters: must provide an Ethereum address
Only accidentally I discovered that it was occurring when I was changing accounts in metamask:
The header account was always updating correctly, so I never considered to check the context values.
But indeed the ethersContext.signer would keep the old address.
Only a page reload would fix the mismatch...
from eth-ui.
@ShravanSunder I've looked into it just a bit and it seems to be a bug in web3-react, rather than in eth-hooks
from eth-ui.
@stephancill have you found a suitable workaround?
For anyone having this issue and looking for a quick fix:
Create a helper like
export const getCurrentSigner = async () => {
const ethereum = window.ethereum;
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const provider = new ethers.providers.Web3Provider(ethereum);
await provider.send('eth_requestAccounts', []);
return provider.getSigner();
};
It works without making any other changes than this:
Instead of
contract.functionCall(arg1, arg2)
you can
contract.connect(await getCurrentSigner()).functionCall(arg1, arg2)
from eth-ui.
Related Issues (20)
- Does not work with CRA HOT 1
- Unclear instruction to integrate it with typescript HOT 2
- We need to be able to connect to local contracts with abi and types HOT 1
- errors using nextjs HOT 1
- Issue using v4 hooks with next.js HOT 2
- React 18 update HOT 1
- Allow callbacks on ethers web3 modal login and logout
- Feature: Hook to get any uniswap token price
- bug: issues with web3modal cache
- create a contribution.md guide for eth-hooks
- parseProviderOrSigner should work when called from another library
- eth-hooks should work with Nextjs HOT 1
- esm fixes for compatiblity
- The context for blocknumber isn't being updated properly
- Update ContractsAppContext to use zustand instead
- Convert eth-hooks into a monorepo called eth-ui for future flexibility
- Foundry integration for scaffold-eth changes
- leadingTrigger on useExchangeEthPrice HOT 3
- Reference implementation for v4 and v5 beta? HOT 1
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 eth-ui.