1
1
import { Address , PublicClient , encodeFunctionData } from 'viem' ;
2
2
3
- import { CreateRollupParams } from './createRollup' ;
3
+ import { CreateRollupFunctionInputs , CreateRollupParams } from './createRollup' ;
4
4
import { defaults } from './createRollupDefaults' ;
5
5
import { createRollupGetCallValue } from './createRollupGetCallValue' ;
6
6
import { createRollupGetMaxDataSize } from './createRollupGetMaxDataSize' ;
@@ -10,13 +10,11 @@ import { isCustomFeeTokenAddress } from './utils/isCustomFeeTokenAddress';
10
10
import { ChainConfig } from './types/ChainConfig' ;
11
11
import { isAnyTrustChainConfig } from './utils/isAnyTrustChainConfig' ;
12
12
13
- function createRollupEncodeFunctionData (
14
- params : CreateRollupParams & { maxDataSize : bigint }
15
- ) {
13
+ function createRollupEncodeFunctionData ( args : CreateRollupFunctionInputs ) {
16
14
return encodeFunctionData ( {
17
15
abi : rollupCreator . abi ,
18
16
functionName : 'createRollup' ,
19
- args : [ { ... defaults , ... params } ] ,
17
+ args,
20
18
} ) ;
21
19
}
22
20
@@ -47,12 +45,13 @@ export async function createRollupPrepareTransactionRequest({
47
45
}
48
46
49
47
const maxDataSize = createRollupGetMaxDataSize ( chainId ) ;
48
+ const paramsWithDefaults = { ...defaults , ...params , maxDataSize } ;
50
49
51
50
const request = await publicClient . prepareTransactionRequest ( {
52
51
chain : publicClient . chain ,
53
52
to : rollupCreator . address [ chainId ] ,
54
- data : createRollupEncodeFunctionData ( { ... params , maxDataSize } ) ,
55
- value : createRollupGetCallValue ( params ) ,
53
+ data : createRollupEncodeFunctionData ( [ paramsWithDefaults ] ) ,
54
+ value : createRollupGetCallValue ( paramsWithDefaults ) ,
56
55
account,
57
56
} ) ;
58
57
0 commit comments