From d3a4c160d14b0816eb3e3106851110cc806235c9 Mon Sep 17 00:00:00 2001 From: spsjvc Date: Thu, 24 Oct 2024 15:07:38 +0200 Subject: [PATCH] update --- src/createRollupPrepareTransactionRequest.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/createRollupPrepareTransactionRequest.ts b/src/createRollupPrepareTransactionRequest.ts index e130686a..0fbf4d7b 100644 --- a/src/createRollupPrepareTransactionRequest.ts +++ b/src/createRollupPrepareTransactionRequest.ts @@ -9,6 +9,7 @@ import { isCustomFeeTokenAddress } from './utils/isCustomFeeTokenAddress'; import { ChainConfig } from './types/ChainConfig'; import { isAnyTrustChainConfig } from './utils/isAnyTrustChainConfig'; import { getRollupCreatorAddress } from './utils/getRollupCreatorAddress'; +import { fetchDecimals } from './utils/erc20'; import { TransactionRequestGasOverrides, applyPercentIncrease } from './utils/gasOverrides'; import { Prettify } from './types/utils'; @@ -18,8 +19,6 @@ import { WithRollupCreatorAddressOverride, } from './types/createRollupTypes'; import { isKnownWasmModuleRoot, getConsensusReleaseByWasmModuleRoot } from './wasmModuleRoot'; -import { getNativeTokenDecimals, scaleToNativeTokenDecimals } from './utils/decimals'; -import { fetchDecimals } from './utils/erc20'; function createRollupEncodeFunctionData(args: CreateRollupFunctionInputs) { return encodeFunctionData({ @@ -68,16 +67,12 @@ export async function createRollupPrepareTransactionRequest 36n - ) { - throw new Error( - `"params.nativeToken" can only be configured with a token that uses 36 decimals or less.`, - ); + if ((await fetchDecimals({ address: params.nativeToken, publicClient })) > 36) { + throw new Error( + `"params.nativeToken" can only be configured with a token that uses 36 decimals or less.`, + ); + } } let maxDataSize: bigint;