-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add v1 RollupAdminLogic getters
Closes FS-620
- Loading branch information
1 parent
2e19334
commit f04abba
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}); | ||
} |