UNPKG

deth

Version:

Ethereum node focused on Developer Experience

31 lines (30 loc) 1.08 kB
import { getTestChainOptionsWithDefaults } from './TestChainOptions'; import BN from 'bn.js'; export function toTestChainOptions(options = {}) { var _a, _b; const result = {}; if (options.hardfork) { result.hardfork = options.hardfork; } if (options.privateKeys) { result.accounts = (_a = result.accounts, (_a !== null && _a !== void 0 ? _a : {})); result.accounts.privateKeys = options.privateKeys; } if (options.initialBalance) { result.accounts = (_b = result.accounts, (_b !== null && _b !== void 0 ? _b : {})); result.accounts.initialBalance = toBN(options.initialBalance); } if (options.blockGasLimit) { result.blockGasLimit = toBN(options.blockGasLimit); } if (options.defaultGasPrice) { result.defaultGasPrice = toBN(options.defaultGasPrice); } if (options.coinbaseAddress) { result.coinbaseAddress = options.coinbaseAddress; } return getTestChainOptionsWithDefaults(result); } function toBN(bigNumber) { return new BN(bigNumber.toString()); }