Skip to content

Commit 62285f3

Browse files
committed
Feat: Add v1 ArbGasInfo getters
1 parent 4e61b48 commit 62285f3

File tree

5 files changed

+100
-0
lines changed

5 files changed

+100
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
2+
import { arbGasInfo } from '../contracts';
3+
4+
type ArbGasInfoABI = typeof arbGasInfo.abi;
5+
export type GetGasAccountingParamsParameters = void;
6+
7+
export type GetGasAccountingParamsReturnType = ReadContractReturnType<
8+
ArbGasInfoABI,
9+
'getGasAccountingParams'
10+
>;
11+
12+
export async function getGasAccountingParams<TChain extends Chain | undefined>(
13+
client: PublicClient<Transport, TChain>,
14+
): Promise<GetGasAccountingParamsReturnType> {
15+
return client.readContract({
16+
abi: arbGasInfo.abi,
17+
functionName: 'getGasAccountingParams',
18+
address: arbGasInfo.address,
19+
});
20+
}

src/actions/getMinimumGasPrice.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
2+
import { arbGasInfo } from '../contracts';
3+
4+
type ArbGasInfoABI = typeof arbGasInfo.abi;
5+
export type GetMinimumGasPriceParameters = void;
6+
7+
export type GetMinimumGasPriceReturnType = ReadContractReturnType<
8+
ArbGasInfoABI,
9+
'getMinimumGasPrice'
10+
>;
11+
12+
export async function getMinimumGasPrice<TChain extends Chain | undefined>(
13+
client: PublicClient<Transport, TChain>,
14+
): Promise<GetMinimumGasPriceReturnType> {
15+
return client.readContract({
16+
abi: arbGasInfo.abi,
17+
functionName: 'getMinimumGasPrice',
18+
address: arbGasInfo.address,
19+
});
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
2+
import { arbGasInfo } from '../contracts';
3+
4+
type ArbGasInfoABI = typeof arbGasInfo.abi;
5+
export type GetParentbaseFeeEstimateParameters = void;
6+
7+
export type GetParentbaseFeeEstimateReturnType = ReadContractReturnType<
8+
ArbGasInfoABI,
9+
'getL1BaseFeeEstimate'
10+
>;
11+
12+
export async function getParentbaseFeeEstimate<TChain extends Chain | undefined>(
13+
client: PublicClient<Transport, TChain>,
14+
): Promise<GetParentbaseFeeEstimateReturnType> {
15+
return client.readContract({
16+
abi: arbGasInfo.abi,
17+
functionName: 'getL1BaseFeeEstimate',
18+
address: arbGasInfo.address,
19+
});
20+
}

src/actions/getParentRewardRate.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
2+
import { arbGasInfo } from '../contracts';
3+
4+
type ArbGasInfoABI = typeof arbGasInfo.abi;
5+
export type GetParentRewardRateParameters = void;
6+
7+
export type GetParentRewardRateReturnType = ReadContractReturnType<
8+
ArbGasInfoABI,
9+
'getL1RewardRate'
10+
>;
11+
12+
export async function getParentRewardRate<TChain extends Chain | undefined>(
13+
client: PublicClient<Transport, TChain>,
14+
): Promise<GetParentRewardRateReturnType> {
15+
return client.readContract({
16+
abi: arbGasInfo.abi,
17+
functionName: 'getL1RewardRate',
18+
address: arbGasInfo.address,
19+
});
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
2+
import { arbGasInfo } from '../contracts';
3+
4+
type ArbGasInfoABI = typeof arbGasInfo.abi;
5+
export type GetParentRewardRecipientParameters = void;
6+
7+
export type GetParentRewardRecipientReturnType = ReadContractReturnType<
8+
ArbGasInfoABI,
9+
'getL1RewardRecipient'
10+
>;
11+
12+
export async function getParentRewardRecipient<TChain extends Chain | undefined>(
13+
client: PublicClient<Transport, TChain>,
14+
): Promise<GetParentRewardRecipientReturnType> {
15+
return client.readContract({
16+
abi: arbGasInfo.abi,
17+
functionName: 'getL1RewardRecipient',
18+
address: arbGasInfo.address,
19+
});
20+
}

0 commit comments

Comments
 (0)