Skip to content

Commit

Permalink
fix: Second bug using tevmMine
Browse files Browse the repository at this point in the history
  • Loading branch information
William Cory authored and William Cory committed May 24, 2024
1 parent ab2f5d7 commit 7418a4a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,23 @@ async function runApp() {
document.querySelector("#blocknumber")!.innerHTML =
`ForkBlock: ${blockNumber}`;

status.innerHTML = "Setting account...";
status.innerHTML = "Sending eth to account...";

const callResult = await memoryClient.tevmCall({
// this is the default `from` address so this line isn't actually necessary
from: prefundedAccounts[0],
to: address,
value: 420n,
// on-success will only create a transaction if the initial run of it doesn't revert
createTransaction: "on-success",
createTransaction: true,
});
// aggregate error is a good way to throw an array of errors
if (callResult.errors) throw new AggregateError(callResult.errors);

status.innerHTML = "Mining block";

const mineResult = await memoryClient.tevmMine();
if (mineResult.errors) throw new AggregateError(mineResult.errors);
console.log(mineResult.blockHashes);

status.innerHTML = "Updating account...";
await updateAccounts();

Expand Down

0 comments on commit 7418a4a

Please sign in to comment.