-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85999c3
commit ce044fa
Showing
4 changed files
with
45 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
PROVIDER_URLS="https://eth-mainnet.alchemyapi.io/v2/YOUR_ALCHEMY_ID" # your provider URLS seperated by comma | ||
PRIVATE_KEY="" ## Optional: Only needed if you wish to create a task from the CLI instead of the UI | ||
PRIVATE_KEY="" ## Optional: Only needed if you wish to create a task from the CLI instead of the UI | ||
RPC="" ## PRC FOR ANVIL FORK |
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,40 @@ | ||
|
||
import * as dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
const forkChain = async () => { | ||
|
||
const { spawn } = await import("child_process"); | ||
|
||
const RPC = process.env['RPC']! | ||
let params = ["-f",RPC] | ||
|
||
let blockNumber; | ||
|
||
if (blockNumber) { | ||
params.push(`--fork-block-number=${blockNumber}`) | ||
} | ||
|
||
/// You can add as much customs params as wanted | ||
const childProcess = spawn('anvil',params, { | ||
stdio: "inherit", | ||
}); | ||
|
||
childProcess.once("close", (status) => { | ||
childProcess.removeAllListeners("error"); | ||
|
||
if (status === 0) { | ||
console.log('ok') | ||
} else { | ||
console.log('error') | ||
} | ||
|
||
}); | ||
|
||
childProcess.once("error", (_status) => { | ||
childProcess.removeAllListeners("close"); | ||
console.log('error') | ||
}); | ||
} | ||
|
||
forkChain() |