From 62285f36f3a1ff83f1cabb143b06ffab5452c8e5 Mon Sep 17 00:00:00 2001 From: Christophe Date: Fri, 28 Jun 2024 15:05:11 +0000 Subject: [PATCH] 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, + }); +}