@0xfacet/sdk
Version:
A toolkit for Facet blockchain integration.
23 lines (22 loc) • 906 B
TypeScript
/**
* Calculates the gas cost of input data based on EVM gas rules.
* Each zero byte costs 4 gas, while each non-zero byte costs 16 gas.
*
* @param input - The input data as a Uint8Array
* @returns The total gas cost as a BigInt
*/
/**
* Calculate the input gas cost for calldata according to EIP-7623.
*
* EIP-7623 introduces a floor cost for calldata to prevent abuse for data availability.
* The gas cost is the maximum of:
* 1. Standard cost: 4 gas per zero byte + 16 gas per non-zero byte
* 2. Floor cost: 10 gas per token (where tokens = zero_bytes + nonzero_bytes * 4)
*
* This function only calculates the calldata portion - execution gas and base costs
* are handled elsewhere in the transaction gas calculation.
*
* @param input - The calldata bytes
* @returns The gas cost for the calldata portion
*/
export declare const calculateInputGasCost: (input: Uint8Array) => bigint;