Skip to content

Commit 806a2e3

Browse files
committed
Feat: Add v1 ArbOwnerPublic getters
1 parent 7804ca2 commit 806a2e3

File tree

5 files changed

+107
-0
lines changed

5 files changed

+107
-0
lines changed

src/actions/getAllChainOwners.ts

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

src/actions/getInfraFeeAccount.ts

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

src/actions/getNetworkFeeAccount.ts

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

src/actions/getScheduledUpgrade.ts

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

src/actions/isChainOwner.ts

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

0 commit comments

Comments
 (0)