Skip to content

Commit

Permalink
Longer Etherscan throttle slot interval.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jul 16, 2020
1 parent 63dd3d4 commit 9f20258
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions packages/providers/src.ts/etherscan-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
22 changes: 11 additions & 11 deletions packages/tests/src.ts/test-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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));
});

Expand All @@ -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));
});
});
Expand All @@ -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);
});
});
Expand All @@ -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);
});
});
Expand Down Expand Up @@ -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");
});
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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);
});
Expand Down

0 comments on commit 9f20258

Please sign in to comment.