Update type signature of `RpcProviderModule` to implement Web3's `AbstractProvider`
See original GitHub issue✅ Prerequisites
- Did you perform a cursory search of open issues? Is this feature already requested elsewhere?
- Are you reporting to the correct repository (
magic-sdk
)?
✨ Feature Request
Currently, to use Web3 features in TypeScript, the magic.rpcProvider
member must be cast to any
, like this:
new Web3(magic.rpcProvider as any);
But, now that https://github.com/ethereum/web3.js/issues/3380 is resolved, we can implement the Web3 AbstractProvider
interface to gain strong typing. Once this is implemented, consumers of rpcProvider
can simply do this:
new Web3(magic.rpcProvider); // No compiler error! Yay! 🚀
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to Integrate with the Ethereum Blockchain with Magic in ...
To interact with the Ethereum blockchain, you can use either ethers.js or web3.js ... const signedMessage = await signer.provider.send(method, params); ...
Read more >Typescript: Type signatures for any function. | by Taylor Coon
Today I will describe how to write type signatures for a wide range of javascript functions. This will help readers narrow types, ...
Read more >EIP712 is here: What to expect and how to use it | MetaMask
Figure 1: a signature request from a dApp that does not use EIP712. An adage in the cryptocurrency space states: don't trust; verify....
Read more >What is a good reason to use a type signature for functions ...
Now what happens if I want to change the type from String to ByteString to improve performance; I'll have to import the ByteString...
Read more >Change signature | PhpStorm Documentation - JetBrains
You can use this refactoring to: change the function name and return type. add, remove, and reorder parameters. assign default values to the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue still exists in the latest version. The workaround is still applicable but it would be nice to see this completely fixed in future releases.
🚀 Issue was released in
@magic-sdk/commons@3.0.0-dgerrells-ch42053-sms-feature.0
,@magic-sdk/provider@7.0.0-dgerrells-ch42053-sms-feature.0
,@magic-sdk/react-native@7.0.0-dgerrells-ch42053-sms-feature.0
,@magic-sdk/types@6.0.0-dgerrells-ch42053-sms-feature.0
,magic-sdk@7.0.0-dgerrells-ch42053-sms-feature.0
🚀