Comments (4)
I don't use react, but I'm happy to provide an integration. Would you mind posting your manual wrapper as a PR in the clients/web3-react
folder? I can help get it ready for merging in. Thanks!
from sapphire-paratime.
The problem with our current solution is that it only allows using sapphire. So I was wondering if you have any ideas of how to implement a wrapper connector that only wraps provider if it's connected to sapphire supported chains. And that can automatically unwrap if chain is changed by user (e.g. user changes it in MetaMask).
from sapphire-paratime.
You could check and then listen to the chain ID, then monkey patch when required. When the chain ID is 0x5aff
or 0x5afe
(saff or safe), then wrap (storing the original provider), otherwise set the object back to the original one.
The specifics of how to monkey patch depend on how clients access the object. For example, to patch metamask directly, you'd need to replace its send
method, as clients may already have captured a reference to the original window.ethereum
(so you can't replace it directly). If it's in some react store, and accesses to it are reactive, you can replace the object since there's one layer of indirection.
If you post some almost-working code, we can discuss and get it to a fully working state.
from sapphire-paratime.
Here's an example of doing that https://github.com/oasislabs/wordleish/blob/main/frontend/src/stores/ethereum.ts. I think that using a store (or equivalent) is the canonical solution, so I'm going to close this issue. If using a store ends up not working, I'm more than happy to reopen it.
from sapphire-paratime.
Related Issues (20)
- Ensure support for Tenderly HOT 2
- Update React tutorial
- Deploy CreateX on Oasis Sapphire
- Publish packages on https://jsr.io/new
- Add sourcify support to Hardhat verify HOT 1
- Wrong gas estimates for sending ether during contract create
- Why is this function returns a `bind.ContractBackend` instead of `WrappedBackend`? Transactor is not available this way. HOT 2
- Feature: EIP1559Signer library
- `_parseCBORUint` failing in `_decodeReceiptUndelegateStart` HOT 3
- Test `provider.getSigner` is wrapped with `sapphire-ethers-v6` in MetaMask
- sapphire-contracts: Add SIWE parser
- ci: Add e2e tests for Sapphire Go client using sapphire-localnet
- docs: Better document the usage/behavior of `contextOrHash` for .sign() and .verify()
- go-client: Properly implement WrappedBackend
- sapphire-contracts: Flaky Gas padding test HOT 1
- docs: Add SIWE login for authentication to Guide/Quickstart
- Fix subcall bug with `consensusTakeReceiptUndelegateDone` HOT 1
- Test and publish RC version of JS and integration clients
- Add information for using Band on Sapphire
- sapphire-py: Add support for signed queries
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 sapphire-paratime.