Skip to content

Commit

Permalink
Feat: Add v1 RollupAdminLogic getters
Browse files Browse the repository at this point in the history
Closes FS-620
  • Loading branch information
chrstph-dvx committed Jul 10, 2024
1 parent 2e19334 commit f04abba
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/actions/getConfirmPeriodBlocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
import { rollupAdminLogic } from '../contracts';
import { ActionParameters } from '../types/Actions';

export type GetConfirmPeriodBlocksParameters<Curried extends boolean = false> = ActionParameters<
{},
'rollupAdminLogic',
Curried
>;

export type GetConfirmPeriodBlocksReturnType = ReadContractReturnType<
typeof rollupAdminLogic.abi,
'confirmPeriodBlocks'
>;

export async function getConfirmPeriodBlocks<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
args: GetConfirmPeriodBlocksParameters,
): Promise<GetConfirmPeriodBlocksReturnType> {
return client.readContract({
abi: rollupAdminLogic.abi,
functionName: 'confirmPeriodBlocks',
address: args.rollupAdminLogic,
});
}
22 changes: 22 additions & 0 deletions src/actions/getExtraChallengeTimeBlocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
import { rollupAdminLogic } from '../contracts';
import { ActionParameters } from '../types/Actions';

export type GetExtraChallengeTimeBlocksParameters<Curried extends boolean = false> =
ActionParameters<{}, 'rollupAdminLogic', Curried>;

export type GetExtraChallengeTimeBlocksReturnType = ReadContractReturnType<
typeof rollupAdminLogic.abi,
'extraChallengeTimeBlocks'
>;

export async function getExtraChallengeTimeBlocks<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
args: GetExtraChallengeTimeBlocksParameters,
): Promise<GetExtraChallengeTimeBlocksReturnType> {
return client.readContract({
abi: rollupAdminLogic.abi,
functionName: 'extraChallengeTimeBlocks',
address: args.rollupAdminLogic,
});
}
25 changes: 25 additions & 0 deletions src/actions/getMinimumAssertionPeriod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
import { rollupAdminLogic } from '../contracts';
import { ActionParameters } from '../types/Actions';

export type GetMinimumAssertionPeriodParameters<Curried extends boolean = false> = ActionParameters<
{},
'rollupAdminLogic',
Curried
>;

export type GetMinimumAssertionPeriodReturnType = ReadContractReturnType<
typeof rollupAdminLogic.abi,
'minimumAssertionPeriod'
>;

export async function getMinimumAssertionPeriod<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
args: GetMinimumAssertionPeriodParameters,
): Promise<GetMinimumAssertionPeriodReturnType> {
return client.readContract({
abi: rollupAdminLogic.abi,
functionName: 'minimumAssertionPeriod',
address: args.rollupAdminLogic,
});
}
25 changes: 25 additions & 0 deletions src/actions/getWasmModuleRoot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Chain, PublicClient, ReadContractReturnType, Transport } from 'viem';
import { rollupAdminLogic } from '../contracts';
import { ActionParameters } from '../types/Actions';

export type GetWasmModuleRootParameters<Curried extends boolean = false> = ActionParameters<
{},
'rollupAdminLogic',
Curried
>;

export type GetWasmModuleRootReturnType = ReadContractReturnType<
typeof rollupAdminLogic.abi,
'wasmModuleRoot'
>;

export async function getWasmModuleRoot<TChain extends Chain | undefined>(
client: PublicClient<Transport, TChain>,
args: GetWasmModuleRootParameters,
): Promise<GetWasmModuleRootReturnType> {
return client.readContract({
abi: rollupAdminLogic.abi,
functionName: 'wasmModuleRoot',
address: args.rollupAdminLogic,
});
}

0 comments on commit f04abba

Please sign in to comment.