Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replace endpoints from old test solution #60

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/integration-tests/src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { execSync } from "child_process";
import { ethers } from "ethers";
import { promises as fs } from "fs";
import * as path from "path";
import { Provider } from "zksync-web3";

import { localConfig } from "./config";
import { Logger } from "./entities";

export class Helper {
Expand Down Expand Up @@ -35,4 +38,21 @@ export class Helper {
console.log(`There is no the expected file: ${fileName}`);
}
}

async getBalanceETH(walletAddress: string, layer: string) {
let network: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let provider: any;
if (layer == "L1") {
network = localConfig.L1Network;
provider = ethers.getDefaultProvider(network);
} else if (layer == "L2") {
network = localConfig.L2Network;
provider = new Provider(network);
} else {
console.log(`Wrong layer: ${layer}`);
}
const balanceEth = ethers.utils.formatUnits(await provider.getBalance(walletAddress), "wei");
return balanceEth;
}
}
Loading
Loading