Skip to content

Commit

Permalink
remove unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Jan 23, 2024
1 parent f85aae5 commit d462cde
Showing 1 changed file with 0 additions and 56 deletions.
56 changes: 0 additions & 56 deletions src/testHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { PublicClient } from 'viem';
import { privateKeyToAccount, PrivateKeyAccount } from 'viem/accounts';
import { config } from 'dotenv';

import {
CreateRollupTransactionReceipt,
createRollupPrepareTransactionReceipt,
} from './createRollupPrepareTransactionReceipt';
import { generateChainId } from './utils';
import { prepareChainConfig } from './prepareChainConfig';
import { createRollupPrepareConfig } from './createRollupPrepareConfig';
import { createRollupPrepareTransactionRequest } from './createRollupPrepareTransactionRequest';

config();

export function getTestPrivateKeyAccount(): PrivateKeyAccount & { privateKey: `0x${string}` } {
Expand All @@ -32,49 +22,3 @@ function sanitizePrivateKey(privateKey: string): `0x${string}` {

return privateKey as `0x${string}`;
}

export type TestSetupCreateRollupParameters = {
publicClient: PublicClient;
};

export async function testSetupCreateRollup({
publicClient,
}: TestSetupCreateRollupParameters): Promise<CreateRollupTransactionReceipt> {
const deployer = getTestPrivateKeyAccount();

// generate a random chain id
const chainId = generateChainId();

// create the chain config
const chainConfig = prepareChainConfig({
chainId,
arbitrum: { InitialChainOwner: deployer.address },
});

const config = createRollupPrepareConfig({
chainId: BigInt(chainId),
owner: deployer.address,
chainConfig,
});

// prepare the transaction for deploying the core contracts
const request = await createRollupPrepareTransactionRequest({
params: {
config,
batchPoster: deployer.address,
validators: [deployer.address],
},
account: deployer.address,
publicClient,
});

// sign and send the transaction
const txHash = await publicClient.sendRawTransaction({
serializedTransaction: await deployer.signTransaction(request),
});

// get the transaction receipt after waiting for the transaction to complete
return createRollupPrepareTransactionReceipt(
await publicClient.waitForTransactionReceipt({ hash: txHash }),
);
}

0 comments on commit d462cde

Please sign in to comment.