Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 3a7b057

Browse files
authored
Merge pull request #6171 from trufflesuite/open-ended
Remove invalid networks check from Sourcify fetcher
2 parents cc26d74 + 0a2d081 commit 3a7b057

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

packages/fetch-and-compile/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export interface FetchAndCompileOptions {
124124

125125
### `getSupportedNetworks`
126126

127-
If you want a list of supported networks, you can call `getSupportedNetworks`:
127+
If you want a (potentially partial) list of supported networks, you can call `getSupportedNetworks`:
128128

129129
```ts
130130
import { getSupportedNetworks } from "@truffle/fetch-and-compile";
@@ -140,6 +140,8 @@ const networks = getSupportedNetworks();
140140
// }
141141
```
142142

143+
Note that there may be additional unlisted supported networks.
144+
143145
You can also pass in a list of fetchers if you want to restrict the output to the networks
144146
supported by the fetchers you list. (You can also pass in a config and it will use the `sourceFetchers`
145147
property if set, or a `FetchAndCompileOptions` and it will use the `fetch.precedence` field if set.)

packages/source-fetcher/lib/sourcify.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const debug = debugModule("source-fetcher:sourcify");
33

44
import type { Fetcher, FetcherConstructor } from "./types";
55
import type * as Types from "./types";
6-
import { removeLibraries, InvalidNetworkError } from "./common";
6+
import { removeLibraries } from "./common";
77
import { networkNamesById, networksByName } from "./networks";
88
import retry from "async-retry";
99

@@ -164,12 +164,8 @@ const SourcifyFetcher: FetcherConstructor = class SourcifyFetcher
164164
constructor(networkId: number) {
165165
this.networkId = networkId;
166166
this.networkName = networkNamesById[networkId];
167-
if (
168-
this.networkName === undefined ||
169-
!SourcifyFetcher.supportedNetworks.has(this.networkName)
170-
) {
171-
throw new InvalidNetworkError(networkId, "sourcify");
172-
}
167+
//we no longer check if the network is supported; the list is now only
168+
//used for if you explicitly ask
173169
}
174170

175171
static getSupportedNetworks(): Types.SupportedNetworks {

0 commit comments

Comments
 (0)