mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-14 05:14:28 -08:00
31 lines
464 B
JavaScript
31 lines
464 B
JavaScript
import {ethers} from 'https://unpkg.com/ethers/dist/ethers.esm.js'
|
|
|
|
const URL = 'https://ethereum-goerli-rpc.allthatnode.com'
|
|
|
|
const p = ethers.getDefaultProvider(URL)
|
|
await p._networkPromise
|
|
|
|
const latest = await p.getBlock()
|
|
latest
|
|
|
|
|
|
const txs = await Promise.all(latest.transactions.map(t =>
|
|
p.getTransactionReceipt(t)
|
|
))
|
|
|
|
|
|
|
|
const totalGas = txs.reduce((gas,tx) =>
|
|
gas.add(tx.gasUsed), ethers.BigNumber.from(0))
|
|
|
|
totalGas.add(25)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|