0.9.1 • Published 2 years ago
@constellation-labs/core-utils v0.9.1
@constellation-labs/core-utils
What is this?
@constellation-labs/core-utils
contains the Optimistic Virtual Machine core utilities.
Getting started
Building and usage
After cloning and switching to the repository, install dependencies:
$ yarn
Use the following commands to build, use, test, and lint:
$ yarn build
$ yarn start
$ yarn test
$ yarn lint
L2 Fees
TxGasLimit
can be used to encode
and decode
the L2 Gas Limit
locally.
import { TxGasLimit } from '@constellation-labs/core-utils'
import { JsonRpcProvider } from 'ethers'
const L2Provider = new JsonRpcProvider('https://mainnet.optimism.io')
const L1Provider = new JsonRpcProvider('http://127.0.0.1:8545')
const l2GasLimit = await L2Provider.send('eth_estimateExecutionGas', [tx])
const l1GasPrice = await L1Provider.getGasPrice()
const encoded = TxGasLimit.encode({
data: '0x',
l1GasPrice,
l2GasLimit,
l2GasPrice: 10000000,
})
const decoded = TxGasLimit.decode(encoded)
assert(decoded.eq(gasLimit))
const estimate = await L2Provider.estimateGas()
assert(estimate.eq(encoded))
0.9.1
2 years ago
0.9.0
2 years ago
0.8.1
2 years ago
0.7.9-alpha.1
2 years ago
0.8.0
2 years ago
0.7.8
2 years ago
0.7.7
2 years ago
0.7.9-alpha.0
2 years ago
0.7.5
2 years ago
0.7.4
2 years ago
0.7.3
2 years ago
0.7.2
3 years ago
0.7.1
3 years ago
0.7.0
3 years ago
0.6.6
3 years ago
0.6.5
3 years ago
0.6.4
3 years ago
0.6.3
3 years ago
0.6.2
3 years ago
0.6.1
3 years ago
0.6.0
3 years ago
0.5.21
3 years ago
0.5.22
3 years ago
0.5.20
3 years ago
0.5.18
3 years ago
0.5.19
3 years ago
0.5.17
3 years ago
0.5.16
3 years ago
0.5.15
3 years ago
0.5.14
3 years ago
0.5.13
3 years ago
0.5.12
3 years ago
0.5.11
3 years ago
0.5.10
3 years ago
0.5.9
3 years ago
0.5.8
3 years ago
0.5.7
3 years ago
0.5.6
3 years ago
0.5.5
3 years ago
0.5.4
3 years ago
0.5.1
3 years ago
0.5.0
3 years ago