Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Dec 21, 2023
1 parent 06d2835 commit 4fe0adb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/createRollup.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ it(`successfully deploys core contracts through rollup creator`, async () => {
);

expect(txReceipt.status).toEqual('success');
expect(txReceipt.getCoreContracts()).not.toThrowError();
expect(() => txReceipt.getCoreContracts()).not.toThrowError();
});
5 changes: 3 additions & 2 deletions src/createRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ export async function createRollup({
}

const maxDataSize = createRollupGetMaxDataSize(chainId);
const paramsWithDefaults = { ...defaults, ...params, maxDataSize };

const { request } = await publicClient.simulateContract({
address: rollupCreator.address[chainId],
abi: rollupCreator.abi,
functionName: 'createRollup',
args: [{ ...defaults, ...params, maxDataSize }],
value: createRollupGetCallValue(params),
args: [paramsWithDefaults],
value: createRollupGetCallValue(paramsWithDefaults),
account,
});

Expand Down
13 changes: 6 additions & 7 deletions src/createRollupPrepareTransactionRequest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Address, PublicClient, encodeFunctionData } from 'viem';

import { CreateRollupParams } from './createRollup';
import { CreateRollupFunctionInputs, CreateRollupParams } from './createRollup';
import { defaults } from './createRollupDefaults';
import { createRollupGetCallValue } from './createRollupGetCallValue';
import { createRollupGetMaxDataSize } from './createRollupGetMaxDataSize';
Expand All @@ -10,13 +10,11 @@ import { isCustomFeeTokenAddress } from './utils/isCustomFeeTokenAddress';
import { ChainConfig } from './types/ChainConfig';
import { isAnyTrustChainConfig } from './utils/isAnyTrustChainConfig';

function createRollupEncodeFunctionData(
params: CreateRollupParams & { maxDataSize: bigint }
) {
function createRollupEncodeFunctionData(args: CreateRollupFunctionInputs) {
return encodeFunctionData({
abi: rollupCreator.abi,
functionName: 'createRollup',
args: [{ ...defaults, ...params }],
args,
});
}

Expand Down Expand Up @@ -47,12 +45,13 @@ export async function createRollupPrepareTransactionRequest({
}

const maxDataSize = createRollupGetMaxDataSize(chainId);
const paramsWithDefaults = { ...defaults, ...params, maxDataSize };

const request = await publicClient.prepareTransactionRequest({
chain: publicClient.chain,
to: rollupCreator.address[chainId],
data: createRollupEncodeFunctionData({ ...params, maxDataSize }),
value: createRollupGetCallValue(params),
data: createRollupEncodeFunctionData([paramsWithDefaults]),
value: createRollupGetCallValue(paramsWithDefaults),
account,
});

Expand Down

0 comments on commit 4fe0adb

Please sign in to comment.