Skip to content

Commit

Permalink
Feat: Add v1 ArbGasInfo getters
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx committed Jul 15, 2024
1 parent a57924e commit 542316e
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/actions/getGasAccountingParams.ts
Original file line number Diff line number Diff line change
@@ -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<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
): Promise<GetGasAccountingParamsReturnType> {
return client.readContract({
abi: arbGasInfo.abi,
functionName: 'getGasAccountingParams',
address: arbGasInfo.address,
});
}
20 changes: 20 additions & 0 deletions src/actions/getMinimumGasPrice.ts
Original file line number Diff line number Diff line change
@@ -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<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
): Promise<GetMinimumGasPriceReturnType> {
return client.readContract({
abi: arbGasInfo.abi,
functionName: 'getMinimumGasPrice',
address: arbGasInfo.address,
});
}
20 changes: 20 additions & 0 deletions src/actions/getParentBaseFeeEstimate.ts
Original file line number Diff line number Diff line change
@@ -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<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
): Promise<GetParentbaseFeeEstimateReturnType> {
return client.readContract({
abi: arbGasInfo.abi,
functionName: 'getL1BaseFeeEstimate',
address: arbGasInfo.address,
});
}
20 changes: 20 additions & 0 deletions src/actions/getParentRewardRate.ts
Original file line number Diff line number Diff line change
@@ -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<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
): Promise<GetParentRewardRateReturnType> {
return client.readContract({
abi: arbGasInfo.abi,
functionName: 'getL1RewardRate',
address: arbGasInfo.address,
});
}
20 changes: 20 additions & 0 deletions src/actions/getParentRewardRecipient.ts
Original file line number Diff line number Diff line change
@@ -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<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
): Promise<GetParentRewardRecipientReturnType> {
return client.readContract({
abi: arbGasInfo.abi,
functionName: 'getL1RewardRecipient',
address: arbGasInfo.address,
});
}

0 comments on commit 542316e

Please sign in to comment.