hardhat-gas-reporter
Advanced tools
Comparing version 2.0.0-beta.0 to 2.0.0-beta.1
@@ -7,3 +7,3 @@ export declare const TABLE_NAME_LEGACY = "legacy"; | ||
export declare const DEFAULT_JSON_OUTPUT_FILE = "./gasReporterOutput.json"; | ||
export declare const DEFAULT_GAS_PRICE_PRECISION = 7; | ||
export declare const DEFAULT_GAS_PRICE_PRECISION = 5; | ||
export declare const DEFAULT_GET_BLOCK_API_ARGS = "action=eth_getBlockByNumber&tag=latest&boolean=false"; | ||
@@ -13,3 +13,3 @@ export declare const DEFAULT_GAS_PRICE_API_ARGS = "action=eth_gasPrice"; | ||
export declare const DEFAULT_COINMARKET_BASE_URL = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/"; | ||
export declare const DEFAULT_OPTIMISM_HARDFORK = "bedrock"; | ||
export declare const DEFAULT_OPTIMISM_HARDFORK = "ecotone"; | ||
export declare const DEFAULT_ARBITRUM_HARDFORK = "arbOS11"; | ||
@@ -21,6 +21,19 @@ export declare const TOOLCHAIN_HARDHAT = "hardhat"; | ||
export declare const OPTIMISM_BEDROCK_DYNAMIC_OVERHEAD = 0.684; | ||
export declare const OPTIMISM_ECOTONE_BASE_FEE_SCALAR = 11000; | ||
export declare const OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR = 1087000; | ||
export declare const OPTIMISM_ECOTONE_BASE_FEE_SCALAR = 1368; | ||
export declare const OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR = 810949; | ||
export declare const UNICODE_CIRCLE = "\u25EF"; | ||
export declare const UNICODE_TRIANGLE = "\u25B3"; | ||
export declare const OPTIMISM_GAS_ORACLE_ADDRESS = "0xb528d11cc114e026f138fe568744c6d45ce6da7a"; | ||
export declare const OPTIMISM_GAS_ORACLE_ABI_PARTIAL: { | ||
constant: boolean; | ||
inputs: any[]; | ||
name: string; | ||
outputs: { | ||
name: string; | ||
type: string; | ||
}[]; | ||
payable: boolean; | ||
stateMutability: string; | ||
type: string; | ||
}[]; | ||
//# sourceMappingURL=constants.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UNICODE_TRIANGLE = exports.UNICODE_CIRCLE = exports.OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR = exports.OPTIMISM_ECOTONE_BASE_FEE_SCALAR = exports.OPTIMISM_BEDROCK_DYNAMIC_OVERHEAD = exports.OPTIMISM_BEDROCK_FIXED_OVERHEAD = exports.EVM_BASE_TX_COST = exports.TOOLCHAIN_FOUNDRY = exports.TOOLCHAIN_HARDHAT = exports.DEFAULT_ARBITRUM_HARDFORK = exports.DEFAULT_OPTIMISM_HARDFORK = exports.DEFAULT_COINMARKET_BASE_URL = exports.DEFAULT_API_KEY_ARGS = exports.DEFAULT_GAS_PRICE_API_ARGS = exports.DEFAULT_GET_BLOCK_API_ARGS = exports.DEFAULT_GAS_PRICE_PRECISION = exports.DEFAULT_JSON_OUTPUT_FILE = exports.DEFAULT_CURRENCY_DISPLAY_PRECISION = exports.DEFAULT_CURRENCY = exports.TABLE_NAME_MARKDOWN = exports.TABLE_NAME_TERMINAL = exports.TABLE_NAME_LEGACY = void 0; | ||
exports.OPTIMISM_GAS_ORACLE_ABI_PARTIAL = exports.OPTIMISM_GAS_ORACLE_ADDRESS = exports.UNICODE_TRIANGLE = exports.UNICODE_CIRCLE = exports.OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR = exports.OPTIMISM_ECOTONE_BASE_FEE_SCALAR = exports.OPTIMISM_BEDROCK_DYNAMIC_OVERHEAD = exports.OPTIMISM_BEDROCK_FIXED_OVERHEAD = exports.EVM_BASE_TX_COST = exports.TOOLCHAIN_FOUNDRY = exports.TOOLCHAIN_HARDHAT = exports.DEFAULT_ARBITRUM_HARDFORK = exports.DEFAULT_OPTIMISM_HARDFORK = exports.DEFAULT_COINMARKET_BASE_URL = exports.DEFAULT_API_KEY_ARGS = exports.DEFAULT_GAS_PRICE_API_ARGS = exports.DEFAULT_GET_BLOCK_API_ARGS = exports.DEFAULT_GAS_PRICE_PRECISION = exports.DEFAULT_JSON_OUTPUT_FILE = exports.DEFAULT_CURRENCY_DISPLAY_PRECISION = exports.DEFAULT_CURRENCY = exports.TABLE_NAME_MARKDOWN = exports.TABLE_NAME_TERMINAL = exports.TABLE_NAME_LEGACY = void 0; | ||
exports.TABLE_NAME_LEGACY = "legacy"; | ||
@@ -10,3 +10,3 @@ exports.TABLE_NAME_TERMINAL = "terminal"; | ||
exports.DEFAULT_JSON_OUTPUT_FILE = "./gasReporterOutput.json"; | ||
exports.DEFAULT_GAS_PRICE_PRECISION = 7; | ||
exports.DEFAULT_GAS_PRICE_PRECISION = 5; | ||
exports.DEFAULT_GET_BLOCK_API_ARGS = "action=eth_getBlockByNumber&tag=latest&boolean=false"; | ||
@@ -16,3 +16,3 @@ exports.DEFAULT_GAS_PRICE_API_ARGS = "action=eth_gasPrice"; | ||
exports.DEFAULT_COINMARKET_BASE_URL = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/"; | ||
exports.DEFAULT_OPTIMISM_HARDFORK = "bedrock"; | ||
exports.DEFAULT_OPTIMISM_HARDFORK = "ecotone"; | ||
exports.DEFAULT_ARBITRUM_HARDFORK = "arbOS11"; | ||
@@ -30,6 +30,51 @@ exports.TOOLCHAIN_HARDHAT = "hardhat"; | ||
// https://docs.optimism.io/builders/chain-operators/management/blobs | ||
exports.OPTIMISM_ECOTONE_BASE_FEE_SCALAR = 11000; | ||
exports.OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR = 1087000; | ||
exports.OPTIMISM_ECOTONE_BASE_FEE_SCALAR = 1368; | ||
exports.OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR = 810949; | ||
exports.UNICODE_CIRCLE = "◯"; | ||
exports.UNICODE_TRIANGLE = "△"; | ||
exports.OPTIMISM_GAS_ORACLE_ADDRESS = "0xb528d11cc114e026f138fe568744c6d45ce6da7a"; | ||
exports.OPTIMISM_GAS_ORACLE_ABI_PARTIAL = [ | ||
{ | ||
constant: true, | ||
inputs: [], | ||
name: "blobBaseFee", | ||
outputs: [ | ||
{ | ||
name: "", | ||
type: "uint256", | ||
}, | ||
], | ||
payable: false, | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
constant: true, | ||
inputs: [], | ||
name: "baseFeeScalar", | ||
outputs: [ | ||
{ | ||
name: "", | ||
type: "uint32", | ||
}, | ||
], | ||
payable: false, | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
constant: true, | ||
inputs: [], | ||
name: "blobBaseFeeScalar", | ||
outputs: [ | ||
{ | ||
name: "", | ||
type: "uint32", | ||
}, | ||
], | ||
payable: false, | ||
stateMutability: "view", | ||
type: "function", | ||
} | ||
]; | ||
//# sourceMappingURL=constants.js.map |
@@ -34,3 +34,3 @@ import { GasReporterOptions, JsonRpcTx } from "../types"; | ||
/** | ||
* Gets compressed transaction calldata gas usage (an input into the cost function below) | ||
* Gets transaction calldata gas usage (an input into the cost function below) | ||
* @param tx JSONRPC formatted getTransaction response | ||
@@ -46,4 +46,17 @@ * @returns | ||
* @returns | ||
* | ||
* Source: https://github.com/ethereum-optimism/optimism/blob/e57787ea7d0b9782cea5f32bcb92d0fdeb7bd870/ + | ||
* packages/contracts-bedrock/src/L2/GasPriceOracle.sol#L88-L92 | ||
* | ||
* DECIMALS = 6 | ||
* | ||
* function _getL1FeeEcotone(bytes memory _data) internal view returns (uint256) { | ||
* uint256 l1GasUsed = _getCalldataGas(_data); | ||
* uint256 scaledBaseFee = baseFeeScalar() * 16 * l1BaseFee(); | ||
* uint256 scaledBlobBaseFee = blobBaseFeeScalar() * blobBaseFee(); | ||
* uint256 fee = l1GasUsed * (scaledBaseFee + scaledBlobBaseFee); | ||
* return fee / (16 * 10 ** DECIMALS); | ||
* } | ||
*/ | ||
export declare function getOptimismEcotoneL1Cost(txCompressed: number, baseFee: number, blobBaseFee: number): number; | ||
export declare function getOptimismEcotoneL1Cost(txSerialized: number, baseFee: number, blobBaseFee: number): number; | ||
export declare function getArbitrum_OS11_L1Gas(tx: JsonRpcTx): number; | ||
@@ -138,3 +151,3 @@ export declare function getArbitrum_OS20_L1Gas(tx: JsonRpcTx): number; | ||
export declare function hexWeiToIntGwei(val: string): number; | ||
export declare function normalizeTxType(_type: string): string; | ||
export declare function normalizeTxType(_type: string): ("legacy" | "eip1559" | "eip2930" | "eip4844"); | ||
//# sourceMappingURL=gas.d.ts.map |
@@ -74,3 +74,3 @@ "use strict"; | ||
/** | ||
* Gets compressed transaction calldata gas usage (an input into the cost function below) | ||
* Gets transaction calldata gas usage (an input into the cost function below) | ||
* @param tx JSONRPC formatted getTransaction response | ||
@@ -80,3 +80,3 @@ * @returns | ||
function getOptimismEcotoneL1Gas(tx) { | ||
return Math.floor(getSerializedTxDataGas(tx) / 16); | ||
return getSerializedTxDataGas(tx); | ||
} | ||
@@ -90,7 +90,20 @@ exports.getOptimismEcotoneL1Gas = getOptimismEcotoneL1Gas; | ||
* @returns | ||
* | ||
* Source: https://github.com/ethereum-optimism/optimism/blob/e57787ea7d0b9782cea5f32bcb92d0fdeb7bd870/ + | ||
* packages/contracts-bedrock/src/L2/GasPriceOracle.sol#L88-L92 | ||
* | ||
* DECIMALS = 6 | ||
* | ||
* function _getL1FeeEcotone(bytes memory _data) internal view returns (uint256) { | ||
* uint256 l1GasUsed = _getCalldataGas(_data); | ||
* uint256 scaledBaseFee = baseFeeScalar() * 16 * l1BaseFee(); | ||
* uint256 scaledBlobBaseFee = blobBaseFeeScalar() * blobBaseFee(); | ||
* uint256 fee = l1GasUsed * (scaledBaseFee + scaledBlobBaseFee); | ||
* return fee / (16 * 10 ** DECIMALS); | ||
* } | ||
*/ | ||
function getOptimismEcotoneL1Cost(txCompressed, baseFee, blobBaseFee) { | ||
function getOptimismEcotoneL1Cost(txSerialized, baseFee, blobBaseFee) { | ||
const weightedBaseFee = 16 * constants_1.OPTIMISM_ECOTONE_BASE_FEE_SCALAR * baseFee; | ||
const weightedBlobBaseFee = constants_1.OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR * blobBaseFee; | ||
return txCompressed * (weightedBaseFee + weightedBlobBaseFee); | ||
return (txSerialized * (weightedBaseFee + weightedBlobBaseFee)) / 16000000; | ||
} | ||
@@ -314,6 +327,6 @@ exports.getOptimismEcotoneL1Cost = getOptimismEcotoneL1Cost; | ||
case 0: return 'legacy'; | ||
case 1: return 'eip2930;'; | ||
case 1: return 'eip2930'; | ||
case 2: return 'eip1559'; | ||
// This will error within viem.serializeTransaction | ||
default: return _type; | ||
case 3: return 'eip4844'; | ||
default: return 'legacy'; | ||
} | ||
@@ -320,0 +333,0 @@ } |
@@ -91,19 +91,56 @@ "use strict"; | ||
} | ||
// blobBaseFee data: etherscan (or `getBlockAPI`) | ||
if (options.L2 && !options.blobBaseFee) { | ||
options.blobBaseFee = 0; | ||
// TODO: DENCUN | ||
/* if (block === undefined) { | ||
try { | ||
block = await axiosInstance.get(blockUrl); | ||
checkForEtherscanError(block.data.result); | ||
} catch (error) { | ||
options.blobBaseFee = 0; | ||
warnings.push(warnBlobBaseFeeRemoteCallFailed(error, blockUrl)); | ||
return; | ||
} | ||
} | ||
options.baseFee = Math.round( | ||
parseInt(block.data.result.blobBaseFeePerGas, 16) / Math.pow(10, 9) | ||
);*/ | ||
// blobBaseFee data: alchemy or infura call to Optimism's gas oracle on L2 | ||
if (options.L2 === "optimism" && | ||
options.optimismHardfork === "ecotone" && | ||
!options.blobBaseFee) { | ||
options.blobBaseFee = .1; | ||
// TODO: Check the GasOracle value against the eth_blobBaseFee value once | ||
// it becomes available and then make a decision about how to | ||
// fetch the data.... | ||
// | ||
// At the moment oracle fee comes back as `1`, which seems fake/wrong and | ||
// produces numbers that are 10% too high. `.1` gets the | ||
// calculations in the right ballpark. | ||
/* | ||
import { OPTIMISM_GAS_ORACLE_ABI_PARTIAL, OPTIMISM_GAS_ORACLE_ADDRESS } from "../constants"; | ||
import { createPublicClient, http } from "viem"; | ||
import { optimism } from 'viem/chains' | ||
import { AbiCoder, Interface } from "@ethersproject/abi"; | ||
import { BytesLike } from "@ethersproject/bytes"; | ||
const iface = new Interface(OPTIMISM_GAS_ORACLE_ABI_PARTIAL); | ||
const blobBaseFeeData = iface.encodeFunctionData("blobBaseFee()", []); | ||
const baseFeeScalarData = iface.encodeFunctionData("baseFeeScalar()", []); | ||
const blobBaseFeeScalarData = iface.encodeFunctionData("blobBaseFeeScalar()", []); | ||
// check that transport url exists.... | ||
const client = createPublicClient({ | ||
chain: optimism, | ||
transport: http(process.env.ALCHEMY_OPTIMISM_URL) | ||
}); | ||
const blobBaseFeeResponse = await client.call({ | ||
data: blobBaseFeeData as hexString, | ||
to: OPTIMISM_GAS_ORACLE_ADDRESS as hexString, | ||
}) | ||
const baseFeeScalarResponse = await client.call({ | ||
data: baseFeeScalarData as hexString, | ||
to: OPTIMISM_GAS_ORACLE_ADDRESS as hexString, | ||
}); | ||
const blobBaseFeeScalarResponse = await client.call({ | ||
data: blobBaseFeeScalarData as hexString, | ||
to: OPTIMISM_GAS_ORACLE_ADDRESS as hexString, | ||
}); | ||
const abiCoder = new AbiCoder(); | ||
const blobBaseFee = abiCoder.decode(["uint256"], blobBaseFeeResponse.data as BytesLike ); | ||
const baseFeeScalar = abiCoder.decode(["uint32"], baseFeeScalarResponse.data as BytesLike ); | ||
const blobBaseFeeScalar = abiCoder.decode(["uint32"], blobBaseFeeScalarResponse.data as BytesLike); | ||
console.log("blobBaseFee: " + blobBaseFee); | ||
console.log("baseFeeScalar: " + baseFeeScalar); | ||
console.log("blobBaseFeeScalar: " + blobBaseFeeScalar); | ||
*/ | ||
} | ||
@@ -110,0 +147,0 @@ return warnings; |
{ | ||
"name": "hardhat-gas-reporter", | ||
"version": "2.0.0-beta.0", | ||
"version": "2.0.0-beta.1", | ||
"description": "Hardhat plugin for eth-gas-reporter, a mocha reporter for Ethereum test suites", | ||
@@ -91,4 +91,4 @@ "repository": "github:cgewecke/hardhat-gas-reporter", | ||
"sha1": "^1.1.1", | ||
"viem": "^2.7.14" | ||
"viem": "2.7.14" | ||
} | ||
} |
@@ -8,3 +8,3 @@ export const TABLE_NAME_LEGACY = "legacy"; | ||
export const DEFAULT_JSON_OUTPUT_FILE = "./gasReporterOutput.json"; | ||
export const DEFAULT_GAS_PRICE_PRECISION = 7; | ||
export const DEFAULT_GAS_PRICE_PRECISION = 5; | ||
@@ -16,3 +16,3 @@ export const DEFAULT_GET_BLOCK_API_ARGS = "action=eth_getBlockByNumber&tag=latest&boolean=false" | ||
export const DEFAULT_OPTIMISM_HARDFORK = "bedrock"; | ||
export const DEFAULT_OPTIMISM_HARDFORK = "ecotone"; | ||
export const DEFAULT_ARBITRUM_HARDFORK = "arbOS11"; | ||
@@ -34,6 +34,52 @@ | ||
// https://docs.optimism.io/builders/chain-operators/management/blobs | ||
export const OPTIMISM_ECOTONE_BASE_FEE_SCALAR = 11000 | ||
export const OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR = 1087000 | ||
export const OPTIMISM_ECOTONE_BASE_FEE_SCALAR = 1368 | ||
export const OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR = 810949 | ||
export const UNICODE_CIRCLE = "◯"; | ||
export const UNICODE_TRIANGLE = "△" | ||
export const OPTIMISM_GAS_ORACLE_ADDRESS = "0xb528d11cc114e026f138fe568744c6d45ce6da7a"; | ||
export const OPTIMISM_GAS_ORACLE_ABI_PARTIAL = [ | ||
{ | ||
constant: true, | ||
inputs: [], | ||
name: "blobBaseFee", | ||
outputs: [ | ||
{ | ||
name: "", | ||
type: "uint256", | ||
}, | ||
], | ||
payable: false, | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
constant: true, | ||
inputs: [], | ||
name: "baseFeeScalar", | ||
outputs: [ | ||
{ | ||
name: "", | ||
type: "uint32", | ||
}, | ||
], | ||
payable: false, | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
constant: true, | ||
inputs: [], | ||
name: "blobBaseFeeScalar", | ||
outputs: [ | ||
{ | ||
name: "", | ||
type: "uint32", | ||
}, | ||
], | ||
payable: false, | ||
stateMutability: "view", | ||
type: "function", | ||
}]; | ||
@@ -82,3 +82,3 @@ import { serializeTransaction, Hex } from 'viem'; | ||
/** | ||
* Gets compressed transaction calldata gas usage (an input into the cost function below) | ||
* Gets transaction calldata gas usage (an input into the cost function below) | ||
* @param tx JSONRPC formatted getTransaction response | ||
@@ -88,3 +88,3 @@ * @returns | ||
export function getOptimismEcotoneL1Gas(tx: JsonRpcTx) { | ||
return Math.floor(getSerializedTxDataGas(tx) / 16); | ||
return getSerializedTxDataGas(tx); | ||
} | ||
@@ -98,5 +98,18 @@ | ||
* @returns | ||
* | ||
* Source: https://github.com/ethereum-optimism/optimism/blob/e57787ea7d0b9782cea5f32bcb92d0fdeb7bd870/ + | ||
* packages/contracts-bedrock/src/L2/GasPriceOracle.sol#L88-L92 | ||
* | ||
* DECIMALS = 6 | ||
* | ||
* function _getL1FeeEcotone(bytes memory _data) internal view returns (uint256) { | ||
* uint256 l1GasUsed = _getCalldataGas(_data); | ||
* uint256 scaledBaseFee = baseFeeScalar() * 16 * l1BaseFee(); | ||
* uint256 scaledBlobBaseFee = blobBaseFeeScalar() * blobBaseFee(); | ||
* uint256 fee = l1GasUsed * (scaledBaseFee + scaledBlobBaseFee); | ||
* return fee / (16 * 10 ** DECIMALS); | ||
* } | ||
*/ | ||
export function getOptimismEcotoneL1Cost( | ||
txCompressed: number, | ||
txSerialized: number, | ||
baseFee: number, | ||
@@ -107,3 +120,3 @@ blobBaseFee: number | ||
const weightedBlobBaseFee = OPTIMISM_ECOTONE_BLOB_BASE_FEE_SCALAR * blobBaseFee; | ||
return txCompressed * (weightedBaseFee + weightedBlobBaseFee); | ||
return (txSerialized * (weightedBaseFee + weightedBlobBaseFee)) / 16000000; | ||
} | ||
@@ -346,12 +359,11 @@ | ||
export function normalizeTxType(_type: string) { | ||
export function normalizeTxType(_type: string): ("legacy" | "eip1559" | "eip2930" | "eip4844") { | ||
switch(hexToDecimal(_type)) { | ||
case 0: return 'legacy'; | ||
case 1: return 'eip2930;' | ||
case 1: return 'eip2930'; | ||
case 2: return 'eip1559'; | ||
// This will error within viem.serializeTransaction | ||
default: return _type; | ||
case 3: return 'eip4844'; | ||
default: return 'legacy'; | ||
} | ||
} | ||
@@ -14,3 +14,2 @@ import axios from "axios"; | ||
/** | ||
@@ -105,20 +104,60 @@ * Fetches gas, base, & blob fee rates from etherscan as well as current market value of | ||
// blobBaseFee data: etherscan (or `getBlockAPI`) | ||
if (options.L2 && !options.blobBaseFee) { | ||
options.blobBaseFee = 0; | ||
// blobBaseFee data: alchemy or infura call to Optimism's gas oracle on L2 | ||
if ( | ||
options.L2 === "optimism" && | ||
options.optimismHardfork === "ecotone" && | ||
!options.blobBaseFee | ||
) { | ||
options.blobBaseFee = .1; | ||
// TODO: DENCUN | ||
/* if (block === undefined) { | ||
try { | ||
block = await axiosInstance.get(blockUrl); | ||
checkForEtherscanError(block.data.result); | ||
} catch (error) { | ||
options.blobBaseFee = 0; | ||
warnings.push(warnBlobBaseFeeRemoteCallFailed(error, blockUrl)); | ||
return; | ||
} | ||
} | ||
options.baseFee = Math.round( | ||
parseInt(block.data.result.blobBaseFeePerGas, 16) / Math.pow(10, 9) | ||
);*/ | ||
// TODO: Check the GasOracle value against the eth_blobBaseFee value once | ||
// it becomes available and then make a decision about how to | ||
// fetch the data.... | ||
// | ||
// At the moment oracle fee comes back as `1`, which seems fake/wrong and | ||
// produces numbers that are 10% too high. `.1` gets the | ||
// calculations in the right ballpark. | ||
/* | ||
import { OPTIMISM_GAS_ORACLE_ABI_PARTIAL, OPTIMISM_GAS_ORACLE_ADDRESS } from "../constants"; | ||
import { createPublicClient, http } from "viem"; | ||
import { optimism } from 'viem/chains' | ||
import { AbiCoder, Interface } from "@ethersproject/abi"; | ||
import { BytesLike } from "@ethersproject/bytes"; | ||
const iface = new Interface(OPTIMISM_GAS_ORACLE_ABI_PARTIAL); | ||
const blobBaseFeeData = iface.encodeFunctionData("blobBaseFee()", []); | ||
const baseFeeScalarData = iface.encodeFunctionData("baseFeeScalar()", []); | ||
const blobBaseFeeScalarData = iface.encodeFunctionData("blobBaseFeeScalar()", []); | ||
// check that transport url exists.... | ||
const client = createPublicClient({ | ||
chain: optimism, | ||
transport: http(process.env.ALCHEMY_OPTIMISM_URL) | ||
}); | ||
const blobBaseFeeResponse = await client.call({ | ||
data: blobBaseFeeData as hexString, | ||
to: OPTIMISM_GAS_ORACLE_ADDRESS as hexString, | ||
}) | ||
const baseFeeScalarResponse = await client.call({ | ||
data: baseFeeScalarData as hexString, | ||
to: OPTIMISM_GAS_ORACLE_ADDRESS as hexString, | ||
}); | ||
const blobBaseFeeScalarResponse = await client.call({ | ||
data: blobBaseFeeScalarData as hexString, | ||
to: OPTIMISM_GAS_ORACLE_ADDRESS as hexString, | ||
}); | ||
const abiCoder = new AbiCoder(); | ||
const blobBaseFee = abiCoder.decode(["uint256"], blobBaseFeeResponse.data as BytesLike ); | ||
const baseFeeScalar = abiCoder.decode(["uint32"], baseFeeScalarResponse.data as BytesLike ); | ||
const blobBaseFeeScalar = abiCoder.decode(["uint32"], blobBaseFeeScalarResponse.data as BytesLike); | ||
console.log("blobBaseFee: " + blobBaseFee); | ||
console.log("baseFeeScalar: " + baseFeeScalar); | ||
console.log("blobBaseFeeScalar: " + blobBaseFeeScalar); | ||
*/ | ||
} | ||
@@ -125,0 +164,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
430238
7658
+ Added@noble/curves@1.2.0(transitive)
+ Added@noble/hashes@1.3.2(transitive)
+ Added@scure/bip32@1.3.2(transitive)
+ Added@scure/bip39@1.2.1(transitive)
+ Addedabitype@1.0.0(transitive)
+ Addedisows@1.0.3(transitive)
+ Addedviem@2.7.14(transitive)
+ Addedws@8.13.0(transitive)
- Removed@noble/curves@1.4.0(transitive)
- Removed@noble/hashes@1.5.0(transitive)
- Removed@scure/bip39@1.4.0(transitive)
- Removedabitype@1.0.5(transitive)
- Removedisows@1.0.4(transitive)
- Removedviem@2.21.7(transitive)
- Removedwebauthn-p256@0.0.5(transitive)
- Removedws@8.17.1(transitive)
Updatedviem@2.7.14