Fixed INFURA project ID checking (#534).
This commit is contained in:
parent
e8f5e4a9d9
commit
5bf763fe23
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user