deth
Version:
Ethereum node focused on Developer Experience
37 lines (36 loc) • 1.39 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const TestChainOptions_1 = require("./TestChainOptions");
const bn_js_1 = __importDefault(require("bn.js"));
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 TestChainOptions_1.getTestChainOptionsWithDefaults(result);
}
exports.toTestChainOptions = toTestChainOptions;
function toBN(bigNumber) {
return new bn_js_1.default(bigNumber.toString());
}