essential-eth
essential-eth copied to clipboard
getNetwork allow optional chainId and network name
The function already exists in essential-eth
, but it does not accept any params. The params should be optional and introduce a new type Networkish
https://docs.ethers.io/v5/api/providers/#providers--networks
// By Chain Name
getNetwork("homestead");
// {
// chainId: 1,
// ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
// name: 'homestead'
// }
// By Chain ID
getNetwork(1);
// {
// chainId: 1,
// ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
// name: 'homestead'
// }
Hey, are we trying to implement something like this? https://github.com/ethers-io/ethers.js/blob/master/packages/networks/src.ts/index.ts
Look for getNetwork function in this file.
@iadnanmalik Great question. I just updated the first comment above so that it's explained better. I realize now that since this introduces a new TS type, it's not a "good first issue".
If it's still interesting to you feel free to try it out!
I tried to send a string or id in the post request via params but it gave an error. Not sure if eth_chainId
is the correct type of request.
Oh, interesting. It sounds like this might need a different JSON RPC method
name.
If you want to run free-eth-node
locally then set your .env
in essential-eth
to point to http://localhost:3000
, you can run the ethers
function and see what they are sending.
Sure will try that!
@iadnanmalik How is it going? Do you want any help getting started on this one?
I can unassign you if you're no longer interested in this.
Yea, sorry @dawsbot I got super busy in other stuff. Unassign me for now, and I'll come back after a while!