mirror of
https://github.com/hanzoai/viem.git
synced 2026-10-30 19:36:39 +00:00
18 lines
471 B
JavaScript
18 lines
471 B
JavaScript
import { Client, http, publicActions, webSocket } from 'viem'
|
|
import { mainnet } from 'viem/chains'
|
|
|
|
const client = Client.create({
|
|
chain: mainnet,
|
|
transport: http('https://ethereum-rpc.publicnode.com'),
|
|
}).extend(publicActions())
|
|
|
|
const webSocketClient = Client.create({
|
|
chain: mainnet,
|
|
transport: webSocket('wss://mainnet.gateway.tenderly.co'),
|
|
}).extend(publicActions())
|
|
|
|
await client.block.getNumber()
|
|
await webSocketClient.block.getNumber()
|
|
|
|
process.exit(0)
|