Skip to content

Commit 7499e21

Browse files
committed
Fetch rollupAddress from sequencerInbox in setters
1 parent d08c43b commit 7499e21

File tree

6 files changed

+39
-51
lines changed

6 files changed

+39
-51
lines changed

src/actions/setConfirmPeriodBlocks.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ import {
77
encodeFunctionData,
88
} from 'viem';
99
import { rollupAdminLogic } from '../contracts';
10-
import { ActionParameters, WithAccount } from '../types/Actions';
10+
import { WithAccount, WithContractAddress } from '../types/Actions';
1111
import { Prettify } from '../types/utils';
12+
import { getRollupAddress } from '../getRollupAddress';
1213

1314
export type SetConfirmPeriodBlocksParameters<Curried extends boolean = false> = Prettify<
14-
WithAccount<
15-
ActionParameters<
16-
{
17-
newPeriod: bigint;
18-
},
19-
'rollupAdminLogic',
20-
Curried
21-
>
22-
>
15+
WithAccount<WithContractAddress<{ newPeriod: bigint }, 'rollupAdminLogic', Curried>>
2316
>;
2417

2518
export type SetConfirmPeriodBlocksReturnType = PrepareTransactionRequestReturnType;
@@ -37,9 +30,9 @@ export async function setConfirmPeriodBlocks<TChain extends Chain | undefined>(
3730
args: SetConfirmPeriodBlocksParameters,
3831
): Promise<SetConfirmPeriodBlocksReturnType> {
3932
const data = rollupAdminLogicFunctionData(args);
40-
33+
const rollupAdminLogicAddresss = await getRollupAddress(client, args);
4134
return client.prepareTransactionRequest({
42-
to: args.rollupAdminLogic,
35+
to: rollupAdminLogicAddresss,
4336
value: BigInt(0),
4437
chain: client.chain,
4538
data,

src/actions/setExtraChallengeTimeBlocks.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ import {
77
encodeFunctionData,
88
} from 'viem';
99
import { rollupAdminLogic } from '../contracts';
10-
import { ActionParameters, WithAccount } from '../types/Actions';
10+
import { WithAccount, WithContractAddress } from '../types/Actions';
1111
import { Prettify } from '../types/utils';
12+
import { getRollupAddress } from '../getRollupAddress';
1213

1314
export type SetExtraChallengeTimeBlocksParameters<Curried extends boolean = false> = Prettify<
14-
WithAccount<
15-
ActionParameters<
16-
{
17-
newExtraTimeBlocks: bigint;
18-
},
19-
'rollupAdminLogic',
20-
Curried
21-
>
22-
>
15+
WithAccount<WithContractAddress<{ newExtraTimeBlocks: bigint }, 'rollupAdminLogic', Curried>>
2316
>;
2417

2518
export type SetExtraChallengeTimeBlocksReturnType = PrepareTransactionRequestReturnType;
@@ -39,9 +32,9 @@ export async function setExtraChallengeTimeBlocks<TChain extends Chain | undefin
3932
args: SetExtraChallengeTimeBlocksParameters,
4033
): Promise<SetExtraChallengeTimeBlocksReturnType> {
4134
const data = rollupAdminLogicFunctionData(args);
42-
35+
const rollupAdminLogicAddresss = await getRollupAddress(client, args);
4336
return client.prepareTransactionRequest({
44-
to: args.rollupAdminLogic,
37+
to: rollupAdminLogicAddresss,
4538
value: BigInt(0),
4639
chain: client.chain,
4740
data,

src/actions/setMinimumAssertionPeriod.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ import {
77
encodeFunctionData,
88
} from 'viem';
99
import { rollupAdminLogic } from '../contracts';
10-
import { ActionParameters, WithAccount } from '../types/Actions';
10+
import { WithAccount, WithContractAddress } from '../types/Actions';
1111
import { Prettify } from '../types/utils';
12+
import { getRollupAddress } from '../getRollupAddress';
1213

1314
export type SetMinimumAssertionPeriodParameters<Curried extends boolean = false> = Prettify<
14-
WithAccount<
15-
ActionParameters<
16-
{
17-
newPeriod: bigint;
18-
},
19-
'rollupAdminLogic',
20-
Curried
21-
>
22-
>
15+
WithAccount<WithContractAddress<{ newPeriod: bigint }, 'rollupAdminLogic', Curried>>
2316
>;
2417

2518
export type SetMinimumAssertionPeriodReturnType = PrepareTransactionRequestReturnType;
@@ -37,9 +30,9 @@ export async function setMinimumAssertionPeriod<TChain extends Chain | undefined
3730
args: SetMinimumAssertionPeriodParameters,
3831
): Promise<SetMinimumAssertionPeriodReturnType> {
3932
const data = rollupAdminLogicFunctionData(args);
40-
33+
const rollupAdminLogicAddresss = await getRollupAddress(client, args);
4134
return client.prepareTransactionRequest({
42-
to: args.rollupAdminLogic,
35+
to: rollupAdminLogicAddresss,
4336
value: BigInt(0),
4437
chain: client.chain,
4538
data,

src/actions/setValidator.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@ import {
88
encodeFunctionData,
99
} from 'viem';
1010
import { rollupAdminLogic } from '../contracts';
11-
import { ActionParameters, WithAccount } from '../types/Actions';
11+
import { WithAccount, WithContractAddress } from '../types/Actions';
1212
import { Prettify } from '../types/utils';
13-
14-
type Args = {
15-
add: Address[];
16-
remove: Address[];
17-
};
13+
import { getRollupAddress } from '../getRollupAddress';
1814

1915
export type SetIsValidatorParameters<Curried extends boolean = false> = Prettify<
20-
WithAccount<ActionParameters<Args, 'rollupAdminLogic', Curried>>
16+
WithAccount<
17+
WithContractAddress<
18+
{
19+
add: Address[];
20+
remove: Address[];
21+
},
22+
'rollupAdminLogic',
23+
Curried
24+
>
25+
>
2126
>;
2227

2328
export type SetIsValidatorReturnType = PrepareTransactionRequestReturnType;
@@ -37,8 +42,9 @@ export async function setValidators<TChain extends Chain | undefined>(
3742
args: SetIsValidatorParameters,
3843
): Promise<SetIsValidatorReturnType> {
3944
const data = rollupAdminLogicFunctionData(args);
45+
const rollupAdminLogicAddresss = await getRollupAddress(client, args);
4046
return client.prepareTransactionRequest({
41-
to: args.rollupAdminLogic,
47+
to: rollupAdminLogicAddresss,
4248
value: BigInt(0),
4349
chain: client.chain,
4450
data,

src/actions/setValidatorWhitelistDisabled.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import {
77
encodeFunctionData,
88
} from 'viem';
99
import { rollupAdminLogic } from '../contracts';
10-
import { ActionParameters, WithAccount } from '../types/Actions';
10+
import { WithAccount, WithContractAddress } from '../types/Actions';
1111
import { Prettify } from '../types/utils';
12+
import { getRollupAddress } from '../getRollupAddress';
1213

1314
export type SetValidatorWhitelistDisabledParameters<Curried extends boolean = false> = Prettify<
14-
WithAccount<ActionParameters<{}, 'rollupAdminLogic', Curried>>
15+
WithAccount<WithContractAddress<{}, 'rollupAdminLogic', Curried>>
1516
>;
1617

1718
export type SetValidatorWhitelistDisabledReturnType = PrepareTransactionRequestReturnType;
@@ -31,8 +32,9 @@ async function setValidatorWhitelistDisabled<TChain extends Chain | undefined>(
3132
args: SetValidatorWhitelistDisabledParameters & { enable: boolean },
3233
): Promise<SetValidatorWhitelistDisabledReturnType> {
3334
const data = rollupAdminLogicFunctionData(args);
35+
const rollupAdminLogicAddresss = await getRollupAddress(client, args);
3436
return client.prepareTransactionRequest({
35-
to: args.rollupAdminLogic,
37+
to: rollupAdminLogicAddresss,
3638
value: BigInt(0),
3739
chain: client.chain,
3840
data,

src/actions/setWasmModuleRoot.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import {
88
encodeFunctionData,
99
} from 'viem';
1010
import { rollupAdminLogic } from '../contracts';
11-
import { ActionParameters, WithAccount } from '../types/Actions';
11+
import { WithAccount, WithContractAddress } from '../types/Actions';
1212
import { Prettify } from '../types/utils';
13+
import { getRollupAddress } from '../getRollupAddress';
1314

1415
export type SetWasmModuleRootParameters<Curried extends boolean = false> = Prettify<
1516
WithAccount<
16-
ActionParameters<
17+
WithContractAddress<
1718
{
1819
newWasmModuleRoot: Hex;
1920
},
@@ -38,9 +39,9 @@ export async function setWasmModuleRoot<TChain extends Chain | undefined>(
3839
args: SetWasmModuleRootParameters,
3940
): Promise<SetWasmModuleRootReturnType> {
4041
const data = rollupAdminLogicFunctionData(args);
41-
42+
const rollupAdminLogicAddresss = await getRollupAddress(client, args);
4243
return client.prepareTransactionRequest({
43-
to: args.rollupAdminLogic,
44+
to: rollupAdminLogicAddresss,
4445
value: BigInt(0),
4546
chain: client.chain,
4647
data,

0 commit comments

Comments
 (0)