-
Notifications
You must be signed in to change notification settings - Fork 717
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
4e5f51d
commit b97bc70
Showing
6 changed files
with
164 additions
and
167 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 was deleted.
Oops, something went wrong.
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,37 @@ | ||
/* | ||
This script advances Anvil network state. It runs as a sidecar pod alongside the devnet and | ||
ensures that manual token transfers triggered through the web UI will be able to be confirmed. | ||
*/ | ||
|
||
import fetch from "node-fetch" | ||
|
||
const RPC_URL = 'http://localhost:8545' | ||
|
||
const advanceBlock = () => { | ||
return new Promise((resolve, reject) => { | ||
fetch(RPC_URL, { | ||
method: 'POST', | ||
headers: {'content-type': 'application/json'}, | ||
body: JSON.stringify({ | ||
jsonrpc: '2.0', | ||
id: new Date().getTime(), | ||
method: "evm_mine", | ||
}) | ||
}).then(() => { | ||
resolve(0); | ||
}) | ||
}); | ||
} | ||
|
||
function sleep(ms: number) { | ||
return new Promise(resolve => setTimeout(resolve, ms)); | ||
} | ||
|
||
const fn = async () => { | ||
while (true) { | ||
await advanceBlock(); | ||
await sleep(1000); | ||
} | ||
} | ||
|
||
fn().catch(reason => console.error(reason)) |
Oops, something went wrong.