Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static async create(
hardfork: string,
networkName: string,
chainId: number,
networkId: number,
blockGasLimit: number,
throwOnTransactionFailures: boolean,
throwOnCallFailures: boolean,
genesisAccounts: GenesisAccount[] = [],
stackTracesOptions?: SolidityTracerOptions
): Promise<[Common, BuidlerNode]> {
const stateTrie = new Trie();
const putIntoStateTrie = promisify(stateTrie.put.bind(stateTrie));
for (const acc of genesisAccounts) {
let balance: BN;
if (
typeof acc.balance === "string" &&
acc.balance.toLowerCase().startsWith("0x")
) {
balance = new BN(toBuffer(acc.balance));
} else {
balance = new BN(acc.balance);
}
const account = new Account({ balance });
const pk = toBuffer(acc.privateKey);
const address = privateToAddress(pk);