question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sebastiandinecommented, Jun 27, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found