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

Resolve getDefaultProvider network type mismatch #2031

Closed
wants to merge 1 commit into from

Conversation

NiftyAndy
Copy link

@NiftyAndy NiftyAndy commented Sep 11, 2021

getNetwork accepts type Networkish (Network | string | number) allowing users to specify chainId if they don't have the entire Network object. This functionality should still be maintained for ease of use but will throw type errors for users at the moment.

export function getNetwork(network: Networkish): Network {
// No network (null)
if (network == null) { return null; }
if (typeof(network) === "number") {
for (const name in networks) {
const standard = networks[name];
if (standard.chainId === network) {
return {
name: standard.name,
chainId: standard.chainId,
ensAddress: (standard.ensAddress || null),
_defaultProvider: (standard._defaultProvider || null)
};
}
}

@ricmoo
Copy link
Member

ricmoo commented Sep 11, 2021

I think you are right.

I’ll add this for the next minor-bump.

@ricmoo ricmoo added minor-bump Planned for the next minor version bump. on-deck This Enhancement or Bug is currently being worked on. enhancement New feature or improvement. labels Sep 11, 2021
@ricmoo
Copy link
Member

ricmoo commented Oct 20, 2021

Merged into 5.5.0.

Thanks! :)

@ricmoo ricmoo closed this Oct 20, 2021
@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published. minor-bump Planned for the next minor version bump.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants