2
0
mirror of synced 2025-02-24 03:58:06 +00:00

Fixed INFURA project ID checking (#534).

This commit is contained in:
Richard Moore 2019-06-04 16:03:31 -04:00
parent e8f5e4a9d9
commit 5bf763fe23
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295

View File

@ -1,6 +1,5 @@
"use strict"; "use strict";
import { isHexString } from "@ethersproject/bytes";
import * as errors from "@ethersproject/errors"; import * as errors from "@ethersproject/errors";
import { Network } from "@ethersproject/networks"; import { Network } from "@ethersproject/networks";
@ -14,9 +13,6 @@ export class InfuraProvider extends UrlJsonRpcProvider {
static getApiKey(apiKey: string): string { static getApiKey(apiKey: string): string {
if (apiKey == null) { return defaultProjectId; } if (apiKey == null) { return defaultProjectId; }
if (!isHexString(apiKey, 16)) {
errors.throwArgumentError("invalid projectId", "projectId", apiKey);
}
return apiKey; return apiKey;
} }
@ -45,6 +41,6 @@ export class InfuraProvider extends UrlJsonRpcProvider {
}); });
} }
return "https://" + host + "/v3/" + apiKey; return "https:/" + "/" + host + "/v3/" + apiKey;
} }
} }