Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getNetwork allow optional chainId and network name #85

Open
dawsbot opened this issue Apr 20, 2022 · 7 comments
Open

getNetwork allow optional chainId and network name #85

dawsbot opened this issue Apr 20, 2022 · 7 comments
Assignees
Labels

Comments

@dawsbot
Copy link
Owner

dawsbot commented Apr 20, 2022

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'
// }
@dawsbot dawsbot self-assigned this Apr 20, 2022
@dawsbot dawsbot removed their assignment Apr 25, 2022
@dawsbot dawsbot added help wanted Extra attention is needed good first issue Good for newcomers labels Apr 27, 2022
@iadnanmalik
Copy link
Contributor

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.

@dawsbot dawsbot removed the good first issue Good for newcomers label Apr 27, 2022
@dawsbot
Copy link
Owner Author

dawsbot commented Apr 27, 2022

@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!

@iadnanmalik
Copy link
Contributor

iadnanmalik commented Apr 27, 2022

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.

@dawsbot
Copy link
Owner Author

dawsbot commented Apr 27, 2022

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.

@iadnanmalik
Copy link
Contributor

Sure will try that!

@dawsbot
Copy link
Owner Author

dawsbot commented May 7, 2022

@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.

@iadnanmalik
Copy link
Contributor

Yea, sorry @dawsbot I got super busy in other stuff. Unassign me for now, and I'll come back after a while!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants