From 930d1a9122e94b808aeded81ff6671cadf7d9269 Mon Sep 17 00:00:00 2001 From: Christophe Date: Fri, 28 Jun 2024 15:05:11 +0000 Subject: [PATCH 1/2] Feat: Add v1 ArbGasInfo getters --- src/actions/getGasAccountingParams.ts | 20 ++++++++++++++++++++ src/actions/getMinimumGasPrice.ts | 20 ++++++++++++++++++++ src/actions/getParentBaseFeeEstimate.ts | 20 ++++++++++++++++++++ src/actions/getParentRewardRate.ts | 20 ++++++++++++++++++++ src/actions/getParentRewardRecipient.ts | 20 ++++++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 src/actions/getGasAccountingParams.ts create mode 100644 src/actions/getMinimumGasPrice.ts create mode 100644 src/actions/getParentBaseFeeEstimate.ts create mode 100644 src/actions/getParentRewardRate.ts create mode 100644 src/actions/getParentRewardRecipient.ts diff --git a/src/actions/getGasAccountingParams.ts b/src/actions/getGasAccountingParams.ts new file mode 100644 index 00000000..fd8dfbff --- /dev/null +++ b/src/actions/getGasAccountingParams.ts @@ -0,0 +1,20 @@ +import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem'; +import { arbGasInfo } from '../contracts'; + +type ArbGasInfoABI = typeof arbGasInfo.abi; +export type GetGasAccountingParamsParameters = void; + +export type GetGasAccountingParamsReturnType = ReadContractReturnType< + ArbGasInfoABI, + 'getGasAccountingParams' +>; + +export async function getGasAccountingParams( + client: PublicClient, +): Promise { + return client.readContract({ + abi: arbGasInfo.abi, + functionName: 'getGasAccountingParams', + address: arbGasInfo.address, + }); +} diff --git a/src/actions/getMinimumGasPrice.ts b/src/actions/getMinimumGasPrice.ts new file mode 100644 index 00000000..5d285b72 --- /dev/null +++ b/src/actions/getMinimumGasPrice.ts @@ -0,0 +1,20 @@ +import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem'; +import { arbGasInfo } from '../contracts'; + +type ArbGasInfoABI = typeof arbGasInfo.abi; +export type GetMinimumGasPriceParameters = void; + +export type GetMinimumGasPriceReturnType = ReadContractReturnType< + ArbGasInfoABI, + 'getMinimumGasPrice' +>; + +export async function getMinimumGasPrice( + client: PublicClient, +): Promise { + return client.readContract({ + abi: arbGasInfo.abi, + functionName: 'getMinimumGasPrice', + address: arbGasInfo.address, + }); +} diff --git a/src/actions/getParentBaseFeeEstimate.ts b/src/actions/getParentBaseFeeEstimate.ts new file mode 100644 index 00000000..a83b8e50 --- /dev/null +++ b/src/actions/getParentBaseFeeEstimate.ts @@ -0,0 +1,20 @@ +import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem'; +import { arbGasInfo } from '../contracts'; + +type ArbGasInfoABI = typeof arbGasInfo.abi; +export type GetParentbaseFeeEstimateParameters = void; + +export type GetParentbaseFeeEstimateReturnType = ReadContractReturnType< + ArbGasInfoABI, + 'getL1BaseFeeEstimate' +>; + +export async function getParentbaseFeeEstimate( + client: PublicClient, +): Promise { + return client.readContract({ + abi: arbGasInfo.abi, + functionName: 'getL1BaseFeeEstimate', + address: arbGasInfo.address, + }); +} diff --git a/src/actions/getParentRewardRate.ts b/src/actions/getParentRewardRate.ts new file mode 100644 index 00000000..7be94c03 --- /dev/null +++ b/src/actions/getParentRewardRate.ts @@ -0,0 +1,20 @@ +import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem'; +import { arbGasInfo } from '../contracts'; + +type ArbGasInfoABI = typeof arbGasInfo.abi; +export type GetParentRewardRateParameters = void; + +export type GetParentRewardRateReturnType = ReadContractReturnType< + ArbGasInfoABI, + 'getL1RewardRate' +>; + +export async function getParentRewardRate( + client: PublicClient, +): Promise { + return client.readContract({ + abi: arbGasInfo.abi, + functionName: 'getL1RewardRate', + address: arbGasInfo.address, + }); +} diff --git a/src/actions/getParentRewardRecipient.ts b/src/actions/getParentRewardRecipient.ts new file mode 100644 index 00000000..433d0ebd --- /dev/null +++ b/src/actions/getParentRewardRecipient.ts @@ -0,0 +1,20 @@ +import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem'; +import { arbGasInfo } from '../contracts'; + +type ArbGasInfoABI = typeof arbGasInfo.abi; +export type GetParentRewardRecipientParameters = void; + +export type GetParentRewardRecipientReturnType = ReadContractReturnType< + ArbGasInfoABI, + 'getL1RewardRecipient' +>; + +export async function getParentRewardRecipient( + client: PublicClient, +): Promise { + return client.readContract({ + abi: arbGasInfo.abi, + functionName: 'getL1RewardRecipient', + address: arbGasInfo.address, + }); +} From 741a0bc2a72bc968843d25cee675b59743e6c0b1 Mon Sep 17 00:00:00 2001 From: Christophe Date: Mon, 1 Jul 2024 11:39:21 +0000 Subject: [PATCH 2/2] Use proper case for getParentBaseFeeEstimate --- src/actions/getParentBaseFeeEstimate.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/actions/getParentBaseFeeEstimate.ts b/src/actions/getParentBaseFeeEstimate.ts index a83b8e50..704e6b9e 100644 --- a/src/actions/getParentBaseFeeEstimate.ts +++ b/src/actions/getParentBaseFeeEstimate.ts @@ -2,16 +2,16 @@ import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem'; import { arbGasInfo } from '../contracts'; type ArbGasInfoABI = typeof arbGasInfo.abi; -export type GetParentbaseFeeEstimateParameters = void; +export type GetParentBaseFeeEstimateParameters = void; -export type GetParentbaseFeeEstimateReturnType = ReadContractReturnType< +export type GetParentBaseFeeEstimateReturnType = ReadContractReturnType< ArbGasInfoABI, 'getL1BaseFeeEstimate' >; -export async function getParentbaseFeeEstimate( +export async function getParentBaseFeeEstimate( client: PublicClient, -): Promise { +): Promise { return client.readContract({ abi: arbGasInfo.abi, functionName: 'getL1BaseFeeEstimate',