Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Oct 9, 2024
1 parent a311170 commit cba60f6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/createRollupPrepareTransactionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,16 @@ export async function createRollupPrepareTransactionRequest<TChain extends Chain
}
}

if (parentChainIsCustom && typeof params.maxDataSize === 'undefined') {
throw new Error(`"params.maxDataSize" must be provided when using a custom parent chain.`);
let maxDataSize: bigint;

if (parentChainIsCustom) {
if (typeof params.maxDataSize === 'undefined') {
throw new Error(`"params.maxDataSize" must be provided when using a custom parent chain.`);
}

maxDataSize = params.maxDataSize;
} else {
maxDataSize = params.maxDataSize ?? createRollupGetMaxDataSize(parentChainId);
}

const arbOSVersion = chainConfig.arbitrum.InitialArbOSVersion;
Expand All @@ -99,10 +107,6 @@ export async function createRollupPrepareTransactionRequest<TChain extends Chain
}
}

const maxDataSize = parentChainIsCustom
? // ok to use non-null assertion here because we already checked above
params.maxDataSize!
: params.maxDataSize ?? createRollupGetMaxDataSize(parentChainId);
const batchPosterManager = params.batchPosterManager ?? zeroAddress;
const paramsWithDefaults = { ...defaults, ...params, maxDataSize, batchPosterManager };
const createRollupGetCallValueParams = { ...paramsWithDefaults, account };
Expand Down

0 comments on commit cba60f6

Please sign in to comment.