Skip to content

Commit

Permalink
Add gzip support to AlchemyProivder and InfuraProvider fetching (#1085).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Oct 7, 2020
1 parent 65772a8 commit 38a068b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/providers/src.ts/alchemy-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class AlchemyProvider extends UrlJsonRpcProvider {
}

return {
allowGzip: true,
url: ("https:/" + "/" + host + apiKey),
throttleCallback: (attempt: number, url: string) => {
if (apiKey === defaultApiKey) {
Expand Down
15 changes: 8 additions & 7 deletions packages/providers/src.ts/infura-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,14 @@ export class InfuraProvider extends UrlJsonRpcProvider {
}

const connection: ConnectionInfo = {
url: ("https:/" + "/" + host + "/v3/" + apiKey.projectId),
throttleCallback: (attempt: number, url: string) => {
if (apiKey.projectId === defaultProjectId) {
showThrottleMessage();
}
return Promise.resolve(true);
}
allowGzip: true,
url: ("https:/" + "/" + host + "/v3/" + apiKey.projectId),
throttleCallback: (attempt: number, url: string) => {
if (apiKey.projectId === defaultProjectId) {
showThrottleMessage();
}
return Promise.resolve(true);
}
};

if (apiKey.projectSecret != null) {
Expand Down

0 comments on commit 38a068b

Please sign in to comment.