This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@kroma2/core-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@kroma2/core-utils

What is this?

@kroma2/core-utils contains the Kroma 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 '@kroma2/core-utils'
import { JsonRpcProvider } from 'ethers'

const L2Provider = new JsonRpcProvider(L2_JSON_RPC_URL)
const L1Provider = new JsonRpcProvider(L1_JSON_RPC_URL)

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))

Package Sidebar

Install

npm i @kroma2/core-utils

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

123 kB

Total Files

96

Last publish

Collaborators

  • chokobole