From 9f20258d5d39cd901d2078275323071eb0f3505b Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Thu, 16 Jul 2020 05:29:33 -0400 Subject: [PATCH] Longer Etherscan throttle slot interval. --- .../providers/src.ts/etherscan-provider.ts | 2 ++ packages/tests/src.ts/test-providers.ts | 22 +++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/providers/src.ts/etherscan-provider.ts b/packages/providers/src.ts/etherscan-provider.ts index c4bd68f82..dff4f8248 100644 --- a/packages/providers/src.ts/etherscan-provider.ts +++ b/packages/providers/src.ts/etherscan-provider.ts @@ -142,6 +142,7 @@ export class EtherscanProvider extends BaseProvider{ const connection = { url: url, + throttleSlotInterval: 1000, throttleCallback: (attempt: number, url: string) => { if (this.apiKey === defaultApiKey) { showThrottleMessage(); @@ -351,6 +352,7 @@ export class EtherscanProvider extends BaseProvider{ const connection = { url: url, + throttleSlotInterval: 1000, throttleCallback: (attempt: number, url: string) => { if (this.apiKey === defaultApiKey) { showThrottleMessage(); diff --git a/packages/tests/src.ts/test-providers.ts b/packages/tests/src.ts/test-providers.ts index a36299b1d..547d24b7c 100644 --- a/packages/tests/src.ts/test-providers.ts +++ b/packages/tests/src.ts/test-providers.ts @@ -446,7 +446,7 @@ function testProvider(providerName: string, networkName: string) { // to our address; we just have to live with jerks sending us // money. *smile emoji* - this.timeout(20000); + this.timeout(60000); return provider.getBalance(test.address).then((balance) => { equals("Balance", test.balance, balance); return waiter(delay); @@ -456,7 +456,7 @@ function testProvider(providerName: string, networkName: string) { if (test.code) { it(`fetches address code: ${ test.address }`, function() { - this.timeout(20000); + this.timeout(60000); return provider.getCode(test.address).then((code) => { equals("Code", test.code, code); return waiter(delay); @@ -467,7 +467,7 @@ function testProvider(providerName: string, networkName: string) { if (test.storage) { Object.keys(test.storage).forEach((position) => { it(`fetches storage: ${ test.address }:${ position }`, function() { - this.timeout(20000); + this.timeout(60000); return provider.getStorageAt(test.address, bnify(position)).then((value) => { equals("Storage", test.storage[position], value); return waiter(delay); @@ -478,7 +478,7 @@ function testProvider(providerName: string, networkName: string) { if (test.name) { it(`fetches the ENS name: ${ test.name }`, function() { - this.timeout(20000); + this.timeout(60000); return provider.resolveName(test.name).then((address) => { equals("ENS Name", test.address, address); return waiter(delay); @@ -498,7 +498,7 @@ function testProvider(providerName: string, networkName: string) { } it(`fetches block (by number) #${ test.number }`, function() { - this.timeout(20000); + this.timeout(60000); return checkBlock(provider.getBlock(test.number)); }); @@ -508,7 +508,7 @@ function testProvider(providerName: string, networkName: string) { } it(`fetches block (by hash) ${ test.hash }`, function() { - this.timeout(20000); + this.timeout(60000); return checkBlock(provider.getBlock(test.hash)); }); }); @@ -534,7 +534,7 @@ function testProvider(providerName: string, networkName: string) { } it(`fetches transaction: ${ test.hash }`, function() { - this.timeout(20000); + this.timeout(60000); return testTransaction(test); }); }); @@ -558,7 +558,7 @@ function testProvider(providerName: string, networkName: string) { } it(`fetches transaction receipt: ${ test.transactionHash }`, function() { - this.timeout(100000); + this.timeout(60000); return testTransactionReceipt(test); }); }); @@ -626,7 +626,7 @@ describe("Test Basic Authentication", function() { function test(name: string, url: TestCase): void { it("tests " + name, function() { - this.timeout(20000); + this.timeout(60000); return ethers.utils.fetchJson(url).then((data) => { assert.equal(data.authenticated, true, "authenticates user"); }); @@ -656,7 +656,7 @@ describe("Test Basic Authentication", function() { test("insecure url", insecureForced); it("tests insecure connections fail", function() { - this.timeout(20000); + this.timeout(60000); assert.throws(() => { return ethers.utils.fetchJson(insecure); }, (error: Error) => { @@ -769,7 +769,7 @@ describe("Test Events", function() { } it("InfuraProvider", async function() { - this.timeout(50000); + this.timeout(60000); const provider = new ethers.providers.InfuraProvider("rinkeby"); await testBlockEvent(provider); });