-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: scripts use infura key rpcs if available (#2037)
- Loading branch information
Showing
8 changed files
with
82 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { StaticJsonRpcProvider } from "@ethersproject/providers"; | ||
import { ConnectionInfo } from "ethers/lib/utils"; | ||
|
||
export const getProvider = (chainInfo: { | ||
rpcUrl: string; | ||
name: string; | ||
chainId: number; | ||
}) => { | ||
const connection: ConnectionInfo = { | ||
url: chainInfo.rpcUrl, | ||
timeout: 30000, | ||
allowGzip: true, | ||
skipFetchSetup: true, | ||
throttleLimit: 3, | ||
throttleSlotInterval: 1000, | ||
headers: { | ||
Accept: "*/*", | ||
"Accept-Encoding": "gzip, deflate, br", | ||
}, | ||
}; | ||
|
||
const provider = new StaticJsonRpcProvider(connection, { | ||
name: chainInfo.name, | ||
chainId: chainInfo.chainId, | ||
}); | ||
|
||
return provider; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import dotenv from "dotenv"; | ||
|
||
// Load environment variables for tests | ||
dotenv.config(); | ||
|
||
// Set GITHUB_TOKEN to "test" if it's not already set | ||
const githubToken = process.env.GITHUB_TOKEN || "test"; | ||
process.env.GITHUB_TOKEN = githubToken; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters