Skip to content

Commit 6b92e77

Browse files
committed
Feat: Add v1 ArbOwnerPublic getters
1 parent 7804ca2 commit 6b92e77

File tree

5 files changed

+109
-0
lines changed

5 files changed

+109
-0
lines changed

src/actions/getAllChainOwners.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 { arbOwnerPublic } from '../contracts';
3+
4+
type ArbOwnerPublicABI = typeof arbOwnerPublic.abi;
5+
export type GetAllChainOwnersParameters = void;
6+
7+
export type GetAllChainOwnersReturnType = ReadContractReturnType<
8+
ArbOwnerPublicABI,
9+
'getAllChainOwners'
10+
>;
11+
12+
export async function getAllChainOwners<TChain extends Chain | undefined>(
13+
client: PublicClient<Transport, TChain>,
14+
): Promise<GetAllChainOwnersReturnType> {
15+
return client.readContract({
16+
abi: arbOwnerPublic.abi,
17+
functionName: 'getAllChainOwners',
18+
address: arbOwnerPublic.address,
19+
});
20+
}

src/actions/getInfraFeeAccount.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 { arbOwnerPublic } from '../contracts';
3+
4+
type ArbOwnerPublicABI = typeof arbOwnerPublic.abi;
5+
export type GetInfraFeeAccountParameters = void;
6+
7+
export type GetInfraFeeAccountReturnType = ReadContractReturnType<
8+
ArbOwnerPublicABI,
9+
'getInfraFeeAccount'
10+
>;
11+
12+
export async function getInfraFeeAccount<TChain extends Chain | undefined>(
13+
client: PublicClient<Transport, TChain>,
14+
): Promise<GetInfraFeeAccountReturnType> {
15+
return client.readContract({
16+
abi: arbOwnerPublic.abi,
17+
functionName: 'getInfraFeeAccount',
18+
address: arbOwnerPublic.address,
19+
});
20+
}

src/actions/getNetworkFeeAccount.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 { arbOwnerPublic } from '../contracts';
3+
4+
type ArbOwnerPublicABI = typeof arbOwnerPublic.abi;
5+
export type GetNetworkFeeAccountParameters = void;
6+
7+
export type GetNetworkFeeAccountReturnType = ReadContractReturnType<
8+
ArbOwnerPublicABI,
9+
'getNetworkFeeAccount'
10+
>;
11+
12+
export async function getNetworkFeeAccount<TChain extends Chain | undefined>(
13+
client: PublicClient<Transport, TChain>,
14+
): Promise<GetNetworkFeeAccountReturnType> {
15+
return client.readContract({
16+
abi: arbOwnerPublic.abi,
17+
functionName: 'getNetworkFeeAccount',
18+
address: arbOwnerPublic.address,
19+
});
20+
}

src/actions/getScheduledUpgrade.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
2+
import { arbOwnerPublic } from '../contracts';
3+
4+
type ArbOwnerPublicABI = typeof arbOwnerPublic.abi;
5+
export type GetScheduledUpgradeParameters = void;
6+
7+
type GetScheduledUpgradeRawReturnType = ReadContractReturnType<
8+
ArbOwnerPublicABI,
9+
'getScheduledUpgrade'
10+
>;
11+
export type GetScheduledUpgradeReturnType = {
12+
arbosVersion: GetScheduledUpgradeRawReturnType[0];
13+
scheduledForTimestamp: GetScheduledUpgradeRawReturnType[1];
14+
};
15+
16+
export async function getScheduledUpgrade<TChain extends Chain | undefined>(
17+
client: PublicClient<Transport, TChain>,
18+
): Promise<GetScheduledUpgradeReturnType> {
19+
const [arbosVersion, scheduledForTimestamp] = await client.readContract({
20+
abi: arbOwnerPublic.abi,
21+
functionName: 'getScheduledUpgrade',
22+
address: arbOwnerPublic.address,
23+
});
24+
return {
25+
arbosVersion,
26+
scheduledForTimestamp,
27+
};
28+
}

src/actions/isChainOwner.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Address, Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
2+
import { arbOwnerPublic } from '../contracts';
3+
4+
type ArbOwnerPublicABI = typeof arbOwnerPublic.abi;
5+
export type IsChainOwnerParameters = {
6+
address: Address;
7+
};
8+
9+
export type IsChainOwnerReturnType = ReadContractReturnType<ArbOwnerPublicABI, 'isChainOwner'>;
10+
11+
export async function isChainOwner<TChain extends Chain | undefined>(
12+
client: PublicClient<Transport, TChain>,
13+
args: IsChainOwnerParameters,
14+
): Promise<IsChainOwnerReturnType> {
15+
return client.readContract({
16+
abi: arbOwnerPublic.abi,
17+
functionName: 'isChainOwner',
18+
address: arbOwnerPublic.address,
19+
args: [args.address],
20+
});
21+
}

0 commit comments

Comments
 (0)