mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
finish record io
This commit is contained in:
@@ -1,26 +1,37 @@
|
||||
import {ethers} from 'https://unpkg.com/ethers/dist/ethers.esm.js'
|
||||
//import {ethers} from 'https://unpkg.com/ethers/dist/ethers.js'
|
||||
import {ethers} from 'https://unpkg.com/ethers@5.7.2/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 =>
|
||||
const txs = await Promise.all(latest.transactions.slice(0,2).map(t =>
|
||||
p.getTransactionReceipt(t)
|
||||
))
|
||||
|
||||
|
||||
|
||||
const totalGas = txs.reduce((gas,tx) =>
|
||||
gas.add(tx.gasUsed), ethers.BigNumber.from(0))
|
||||
|
||||
totalGas.add(25)
|
||||
|
||||
|
||||
|
||||
totalGas.add(20)
|
||||
|
||||
|
||||
/*
|
||||
const totalGas = txs.reduce((gas,tx) =>
|
||||
gas + tx.gasUsed, BigInt(0))
|
||||
|
||||
totalGas + 1
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -28,4 +39,4 @@ const totalGas = txs.reduce((gas,tx) =>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user