-
Notifications
You must be signed in to change notification settings - Fork 2
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
William Cory
authored and
William Cory
committed
May 24, 2024
1 parent
c9fb3fc
commit 14cc9ae
Showing
1 changed file
with
28 additions
and
1 deletion.
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,4 +1,31 @@ | ||
import { createMemoryClient, http } from "tevm"; | ||
import { optimism } from "tevm/common"; | ||
|
||
const app = document.querySelector("#app") as Element; | ||
app.innerHTML = `<div>Hello Tevm</div>`; | ||
|
||
const memoryClient = createMemoryClient({ | ||
common: optimism, | ||
fork: { | ||
// @warning we may face throttling using the public endpoint | ||
// In production apps consider using `loadBalance` and `rateLimit` transports | ||
transport: http("https://mainnet.optimism.io")({}), | ||
}, | ||
}); | ||
|
||
async function runApp() { | ||
app.innerHTML = `<div id="status">initializing...</div> | ||
<div id="blocknumber"></div> | ||
`; | ||
const status = app.querySelector("#status")!; | ||
|
||
status.innerHTML = "Fetching block number..."; | ||
|
||
document.querySelector("#blocknumber")!.innerHTML = `Fetching block number next step. For now let's check out which methods are on memory client: | ||
<ul> | ||
${Object.keys(memoryClient).map((key) => `<li>${key}</li>`)} | ||
</ul>`; | ||
|
||
status.innerHTML = "Done"; | ||
} | ||
|
||
runApp(); |