Longer Etherscan throttle slot interval.

This commit is contained in:
Richard Moore 2020-07-16 05:29:33 -04:00
parent 63dd3d4682
commit 9f20258d5d
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
2 changed files with 13 additions and 11 deletions

@ -142,6 +142,7 @@ export class EtherscanProvider extends BaseProvider{
const connection = { const connection = {
url: url, url: url,
throttleSlotInterval: 1000,
throttleCallback: (attempt: number, url: string) => { throttleCallback: (attempt: number, url: string) => {
if (this.apiKey === defaultApiKey) { if (this.apiKey === defaultApiKey) {
showThrottleMessage(); showThrottleMessage();
@ -351,6 +352,7 @@ export class EtherscanProvider extends BaseProvider{
const connection = { const connection = {
url: url, url: url,
throttleSlotInterval: 1000,
throttleCallback: (attempt: number, url: string) => { throttleCallback: (attempt: number, url: string) => {
if (this.apiKey === defaultApiKey) { if (this.apiKey === defaultApiKey) {
showThrottleMessage(); showThrottleMessage();

@ -446,7 +446,7 @@ function testProvider(providerName: string, networkName: string) {
// to our address; we just have to live with jerks sending us // to our address; we just have to live with jerks sending us
// money. *smile emoji* // money. *smile emoji*
this.timeout(20000); this.timeout(60000);
return provider.getBalance(test.address).then((balance) => { return provider.getBalance(test.address).then((balance) => {
equals("Balance", test.balance, balance); equals("Balance", test.balance, balance);
return waiter(delay); return waiter(delay);
@ -456,7 +456,7 @@ function testProvider(providerName: string, networkName: string) {
if (test.code) { if (test.code) {
it(`fetches address code: ${ test.address }`, function() { it(`fetches address code: ${ test.address }`, function() {
this.timeout(20000); this.timeout(60000);
return provider.getCode(test.address).then((code) => { return provider.getCode(test.address).then((code) => {
equals("Code", test.code, code); equals("Code", test.code, code);
return waiter(delay); return waiter(delay);
@ -467,7 +467,7 @@ function testProvider(providerName: string, networkName: string) {
if (test.storage) { if (test.storage) {
Object.keys(test.storage).forEach((position) => { Object.keys(test.storage).forEach((position) => {
it(`fetches storage: ${ test.address }:${ position }`, function() { it(`fetches storage: ${ test.address }:${ position }`, function() {
this.timeout(20000); this.timeout(60000);
return provider.getStorageAt(test.address, bnify(position)).then((value) => { return provider.getStorageAt(test.address, bnify(position)).then((value) => {
equals("Storage", test.storage[position], value); equals("Storage", test.storage[position], value);
return waiter(delay); return waiter(delay);
@ -478,7 +478,7 @@ function testProvider(providerName: string, networkName: string) {
if (test.name) { if (test.name) {
it(`fetches the ENS name: ${ test.name }`, function() { it(`fetches the ENS name: ${ test.name }`, function() {
this.timeout(20000); this.timeout(60000);
return provider.resolveName(test.name).then((address) => { return provider.resolveName(test.name).then((address) => {
equals("ENS Name", test.address, address); equals("ENS Name", test.address, address);
return waiter(delay); return waiter(delay);
@ -498,7 +498,7 @@ function testProvider(providerName: string, networkName: string) {
} }
it(`fetches block (by number) #${ test.number }`, function() { it(`fetches block (by number) #${ test.number }`, function() {
this.timeout(20000); this.timeout(60000);
return checkBlock(provider.getBlock(test.number)); return checkBlock(provider.getBlock(test.number));
}); });
@ -508,7 +508,7 @@ function testProvider(providerName: string, networkName: string) {
} }
it(`fetches block (by hash) ${ test.hash }`, function() { it(`fetches block (by hash) ${ test.hash }`, function() {
this.timeout(20000); this.timeout(60000);
return checkBlock(provider.getBlock(test.hash)); return checkBlock(provider.getBlock(test.hash));
}); });
}); });
@ -534,7 +534,7 @@ function testProvider(providerName: string, networkName: string) {
} }
it(`fetches transaction: ${ test.hash }`, function() { it(`fetches transaction: ${ test.hash }`, function() {
this.timeout(20000); this.timeout(60000);
return testTransaction(test); return testTransaction(test);
}); });
}); });
@ -558,7 +558,7 @@ function testProvider(providerName: string, networkName: string) {
} }
it(`fetches transaction receipt: ${ test.transactionHash }`, function() { it(`fetches transaction receipt: ${ test.transactionHash }`, function() {
this.timeout(100000); this.timeout(60000);
return testTransactionReceipt(test); return testTransactionReceipt(test);
}); });
}); });
@ -626,7 +626,7 @@ describe("Test Basic Authentication", function() {
function test(name: string, url: TestCase): void { function test(name: string, url: TestCase): void {
it("tests " + name, function() { it("tests " + name, function() {
this.timeout(20000); this.timeout(60000);
return ethers.utils.fetchJson(url).then((data) => { return ethers.utils.fetchJson(url).then((data) => {
assert.equal(data.authenticated, true, "authenticates user"); assert.equal(data.authenticated, true, "authenticates user");
}); });
@ -656,7 +656,7 @@ describe("Test Basic Authentication", function() {
test("insecure url", insecureForced); test("insecure url", insecureForced);
it("tests insecure connections fail", function() { it("tests insecure connections fail", function() {
this.timeout(20000); this.timeout(60000);
assert.throws(() => { assert.throws(() => {
return ethers.utils.fetchJson(insecure); return ethers.utils.fetchJson(insecure);
}, (error: Error) => { }, (error: Error) => {
@ -769,7 +769,7 @@ describe("Test Events", function() {
} }
it("InfuraProvider", async function() { it("InfuraProvider", async function() {
this.timeout(50000); this.timeout(60000);
const provider = new ethers.providers.InfuraProvider("rinkeby"); const provider = new ethers.providers.InfuraProvider("rinkeby");
await testBlockEvent(provider); await testBlockEvent(provider);
}); });