diff --git a/src/actions/setConfirmPeriodBlocks.ts b/src/actions/setConfirmPeriodBlocks.ts index 89a4be54..47b951a5 100644 --- a/src/actions/setConfirmPeriodBlocks.ts +++ b/src/actions/setConfirmPeriodBlocks.ts @@ -7,19 +7,12 @@ import { encodeFunctionData, } from 'viem'; import { rollupAdminLogic } from '../contracts'; -import { ActionParameters, WithAccount } from '../types/Actions'; +import { WithAccount, WithContractAddress } from '../types/Actions'; import { Prettify } from '../types/utils'; +import { getRollupAddress } from '../getRollupAddress'; export type SetConfirmPeriodBlocksParameters = Prettify< - WithAccount< - ActionParameters< - { - newPeriod: bigint; - }, - 'rollupAdminLogic', - Curried - > - > + WithAccount> >; export type SetConfirmPeriodBlocksReturnType = PrepareTransactionRequestReturnType; @@ -37,9 +30,9 @@ export async function setConfirmPeriodBlocks( args: SetConfirmPeriodBlocksParameters, ): Promise { const data = rollupAdminLogicFunctionData(args); - + const rollupAdminLogicAddresss = await getRollupAddress(client, args); return client.prepareTransactionRequest({ - to: args.rollupAdminLogic, + to: rollupAdminLogicAddresss, value: BigInt(0), chain: client.chain, data, diff --git a/src/actions/setExtraChallengeTimeBlocks.ts b/src/actions/setExtraChallengeTimeBlocks.ts index 265b8d84..4f35ce27 100644 --- a/src/actions/setExtraChallengeTimeBlocks.ts +++ b/src/actions/setExtraChallengeTimeBlocks.ts @@ -7,19 +7,12 @@ import { encodeFunctionData, } from 'viem'; import { rollupAdminLogic } from '../contracts'; -import { ActionParameters, WithAccount } from '../types/Actions'; +import { WithAccount, WithContractAddress } from '../types/Actions'; import { Prettify } from '../types/utils'; +import { getRollupAddress } from '../getRollupAddress'; export type SetExtraChallengeTimeBlocksParameters = Prettify< - WithAccount< - ActionParameters< - { - newExtraTimeBlocks: bigint; - }, - 'rollupAdminLogic', - Curried - > - > + WithAccount> >; export type SetExtraChallengeTimeBlocksReturnType = PrepareTransactionRequestReturnType; @@ -39,9 +32,9 @@ export async function setExtraChallengeTimeBlocks { const data = rollupAdminLogicFunctionData(args); - + const rollupAdminLogicAddresss = await getRollupAddress(client, args); return client.prepareTransactionRequest({ - to: args.rollupAdminLogic, + to: rollupAdminLogicAddresss, value: BigInt(0), chain: client.chain, data, diff --git a/src/actions/setMinimumAssertionPeriod.ts b/src/actions/setMinimumAssertionPeriod.ts index 1eed2739..051b7bc4 100644 --- a/src/actions/setMinimumAssertionPeriod.ts +++ b/src/actions/setMinimumAssertionPeriod.ts @@ -7,19 +7,12 @@ import { encodeFunctionData, } from 'viem'; import { rollupAdminLogic } from '../contracts'; -import { ActionParameters, WithAccount } from '../types/Actions'; +import { WithAccount, WithContractAddress } from '../types/Actions'; import { Prettify } from '../types/utils'; +import { getRollupAddress } from '../getRollupAddress'; export type SetMinimumAssertionPeriodParameters = Prettify< - WithAccount< - ActionParameters< - { - newPeriod: bigint; - }, - 'rollupAdminLogic', - Curried - > - > + WithAccount> >; export type SetMinimumAssertionPeriodReturnType = PrepareTransactionRequestReturnType; @@ -37,9 +30,9 @@ export async function setMinimumAssertionPeriod { const data = rollupAdminLogicFunctionData(args); - + const rollupAdminLogicAddresss = await getRollupAddress(client, args); return client.prepareTransactionRequest({ - to: args.rollupAdminLogic, + to: rollupAdminLogicAddresss, value: BigInt(0), chain: client.chain, data, diff --git a/src/actions/setValidator.ts b/src/actions/setValidator.ts index f49a8ba0..1163e68b 100644 --- a/src/actions/setValidator.ts +++ b/src/actions/setValidator.ts @@ -8,16 +8,21 @@ import { encodeFunctionData, } from 'viem'; import { rollupAdminLogic } from '../contracts'; -import { ActionParameters, WithAccount } from '../types/Actions'; +import { WithAccount, WithContractAddress } from '../types/Actions'; import { Prettify } from '../types/utils'; - -type Args = { - add: Address[]; - remove: Address[]; -}; +import { getRollupAddress } from '../getRollupAddress'; export type SetIsValidatorParameters = Prettify< - WithAccount> + WithAccount< + WithContractAddress< + { + add: Address[]; + remove: Address[]; + }, + 'rollupAdminLogic', + Curried + > + > >; export type SetIsValidatorReturnType = PrepareTransactionRequestReturnType; @@ -37,8 +42,9 @@ export async function setValidators( args: SetIsValidatorParameters, ): Promise { const data = rollupAdminLogicFunctionData(args); + const rollupAdminLogicAddresss = await getRollupAddress(client, args); return client.prepareTransactionRequest({ - to: args.rollupAdminLogic, + to: rollupAdminLogicAddresss, value: BigInt(0), chain: client.chain, data, diff --git a/src/actions/setValidatorWhitelistDisabled.ts b/src/actions/setValidatorWhitelistDisabled.ts index 38f36abd..a6ecd8eb 100644 --- a/src/actions/setValidatorWhitelistDisabled.ts +++ b/src/actions/setValidatorWhitelistDisabled.ts @@ -7,11 +7,12 @@ import { encodeFunctionData, } from 'viem'; import { rollupAdminLogic } from '../contracts'; -import { ActionParameters, WithAccount } from '../types/Actions'; +import { WithAccount, WithContractAddress } from '../types/Actions'; import { Prettify } from '../types/utils'; +import { getRollupAddress } from '../getRollupAddress'; export type SetValidatorWhitelistDisabledParameters = Prettify< - WithAccount> + WithAccount> >; export type SetValidatorWhitelistDisabledReturnType = PrepareTransactionRequestReturnType; @@ -31,8 +32,9 @@ async function setValidatorWhitelistDisabled( args: SetValidatorWhitelistDisabledParameters & { enable: boolean }, ): Promise { const data = rollupAdminLogicFunctionData(args); + const rollupAdminLogicAddresss = await getRollupAddress(client, args); return client.prepareTransactionRequest({ - to: args.rollupAdminLogic, + to: rollupAdminLogicAddresss, value: BigInt(0), chain: client.chain, data, diff --git a/src/actions/setWasmModuleRoot.ts b/src/actions/setWasmModuleRoot.ts index 7c856d7d..d9be7561 100644 --- a/src/actions/setWasmModuleRoot.ts +++ b/src/actions/setWasmModuleRoot.ts @@ -8,12 +8,13 @@ import { encodeFunctionData, } from 'viem'; import { rollupAdminLogic } from '../contracts'; -import { ActionParameters, WithAccount } from '../types/Actions'; +import { WithAccount, WithContractAddress } from '../types/Actions'; import { Prettify } from '../types/utils'; +import { getRollupAddress } from '../getRollupAddress'; export type SetWasmModuleRootParameters = Prettify< WithAccount< - ActionParameters< + WithContractAddress< { newWasmModuleRoot: Hex; }, @@ -38,9 +39,9 @@ export async function setWasmModuleRoot( args: SetWasmModuleRootParameters, ): Promise { const data = rollupAdminLogicFunctionData(args); - + const rollupAdminLogicAddresss = await getRollupAddress(client, args); return client.prepareTransactionRequest({ - to: args.rollupAdminLogic, + to: rollupAdminLogicAddresss, value: BigInt(0), chain: client.chain, data,