Skip to content

Commit

Permalink
make parent configurable in test rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
spsjvc committed Dec 28, 2023
1 parent be153ed commit d0a1eac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/createTokenBridge.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const nitroTestnodeL2Client = createPublicClient({
});

it(`successfully deploys token bridge contracts on parent chain`, async () => {
const createRollupTxReceipt = await testSetupCreateRollup();
const createRollupTxReceipt = await testSetupCreateRollup({
publicClient: nitroTestnodeL1Client,
});
const { rollup } = createRollupTxReceipt.getCoreContracts();

const txRequest = await createTokenBridgePrepareTransactionRequest({
Expand Down
15 changes: 8 additions & 7 deletions src/testHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { PublicClient } from 'viem';
import { privateKeyToAccount, PrivateKeyAccount } from 'viem/accounts';
import { config } from 'dotenv';

import {
CreateRollupTransactionReceipt,
createRollupPrepareTransactionReceipt,
Expand All @@ -8,8 +10,6 @@ import { generateChainId } from './utils';
import { prepareChainConfig } from './prepareChainConfig';
import { createRollupPrepareConfig } from './createRollupPrepareConfig';
import { createRollupPrepareTransactionRequest } from './createRollupPrepareTransactionRequest';
import { createPublicClient, http } from 'viem';
import { nitroTestnodeL1 } from './chains';

config();

Expand All @@ -31,12 +31,13 @@ function sanitizePrivateKey(privateKey: string): `0x${string}` {
return privateKey as `0x${string}`;
}

export async function testSetupCreateRollup(): Promise<CreateRollupTransactionReceipt> {
const publicClient = createPublicClient({
chain: nitroTestnodeL1,
transport: http(),
});
export type TestSetupCreateRollupParameters = {
publicClient: PublicClient;
};

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

// generate a random chain id
Expand Down

0 comments on commit d0a1eac

Please sign in to comment.