import { Chain, PrivateKeyAccount, PublicClient, Transport } from 'viem'; import { CoreContracts } from './types/CoreContracts'; import { CreateRollupTransactionReceipt } from './createRollupPrepareTransactionReceipt'; import { CreateRollupTransaction } from './createRollupPrepareTransaction'; import { CreateRollupParams } from './types/createRollupTypes'; /** * This type is for the params of the createRollup function */ export type CreateRollupFunctionParams = { params: CreateRollupParams<'v2.1'>; account: PrivateKeyAccount; parentChainPublicClient: PublicClient; rollupCreatorVersion: 'v2.1'; } | { params: CreateRollupParams<'v3.2'>; account: PrivateKeyAccount; parentChainPublicClient: PublicClient; rollupCreatorVersion: 'v3.2'; } | { params: CreateRollupParams<'v3.2'>; account: PrivateKeyAccount; parentChainPublicClient: PublicClient; rollupCreatorVersion?: never; }; /** * @param {Object} createRollupResults - results of the createRollup function * @param {Object} createRollupResults.transaction - the transaction for deploying the core contracts * @param {Object} createRollupResults.txReceipt - the transaction receipt * @param {Object} createRollupResults.coreContracts - the core contracts */ export type CreateRollupResults = { transaction: CreateRollupTransaction; transactionReceipt: CreateRollupTransactionReceipt; coreContracts: CoreContracts; }; /** * Performs the tx to deploy the chain's core contracts. * * Before creating a custom gas token chain, it checks the custom gas * token allowance granted to the rollup creator contract. Runs an approval * tx for insufficient allowance. * * Accepts rollup creation config, rollup owner, and the parent chain public client. * * Returns the transaction, the transaction receipt, and the core contracts. * * - Example 1: [Create an ETH gas token chain](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/examples/create-rollup-eth/index.ts) * - Example 2: [Create a custom gas token chain](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/examples/create-rollup-custom-fee-token/index.ts) * * @param {CreateRollupFunctionParams} createRollupFunctionParams {@link CreateRollupFunctionParams} * @param {Object} createRollupFunctionParams.params - {@link CreateRollupParams} * @param {Object} createRollupFunctionParams.params.config - The chain config * @param {string} createRollupFunctionParams.params.batchPoster - The batchPoster address * @param {Array} createRollupFunctionParams.params.validators - The validator(s) address array * @param {boolean} [createRollupFunctionParams.params.deployFactoriesToL2=] - Optional, defaults to true. * Deploying factories via retryable tickets at rollup creation time is the most reliable method to * do it since it doesn't require paying the L1 gas. If deployment is not done as part of rollup * creation TX, there is a risk that anyone can try to deploy factories and potentially burn * the nonce 0 (ie. due to gas price spike when doing direct child chain TX). That would mean we * permanently lost capability to deploy deterministic factory at expected address. * @param {string} [createRollupFunctionParams.params.nativeToken=] - The native token address, optional, defaults to ETH * @param {number} [createRollupFunctionParams.params.maxDataSize=] - The max calldata size, optional, defaults to 104_857 B for Orbit chains * @param {number} [createRollupFunctionParams.params.maxFeePerGasForRetryables=] - The max fee per gas for retryables, optional, defaults to 0.1 gwei * @param {Object} createRollupFunctionParams.account - The rollup owner private key account * @param {Object} createRollupFunctionParams.parentChainPublicClient - The parent chain Viem Public Client * * @returns Promise<{@link CreateRollupResults}> - the transaction, the transaction receipt, and the core contracts. * * @example * const createRollupConfig = createRollupPrepareDeploymentParamsConfig(parentChainPublicClient, { * chainId: BigInt(chainId), * owner: deployer.address, * chainConfig: prepareChainConfig({ * chainId, * arbitrum: { * InitialChainOwner: deployer.address, * DataAvailabilityCommittee: true, * }, * }), * }); * * const { * transaction, * transactionReceipt, * coreContracts, * } = await createRollup({ * params: { * config: createRollupConfig, * batchPosters, * validators, * }, * account: deployer, * parentChainPublicClient, * }); */ export declare function createRollup({ params, account, parentChainPublicClient, rollupCreatorVersion, }: CreateRollupFunctionParams): Promise;