-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add fast-forward script for demo
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This script will: | ||
// 1. fast forward the blockchain by 10 blocks | ||
|
||
import { config } from "../deploy/utils"; | ||
import * as zks from "zksync-web3"; | ||
|
||
const RPC_URL = config.L2RpcUrl; | ||
|
||
async function advanceBlocks(blockCount: number, provider: zks.Provider) { | ||
for (let i = 0; i < blockCount; i++) { | ||
// Use the 'send' method to send the 'evm_mine' request | ||
await provider.send('evm_mine', []); | ||
} | ||
} | ||
|
||
async function main() { | ||
// Create a new provider instance | ||
const provider = new zks.Provider(RPC_URL); | ||
// Fast forward the blockchain by 10 blocks | ||
await advanceBlocks(10, provider); | ||
console.log(`Fast forwarded 10 blocks`); | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); | ||
|
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