UNPKG

deth

Version:

Ethereum node focused on Developer Experience

28 lines (27 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const TestChain_1 = require("../TestChain"); const WalletManager_1 = require("../WalletManager"); const RealFileSystem_1 = require("../fs/RealFileSystem"); const AbiDecoder_1 = require("../debugger/AbiDecoder"); const CliLogger_1 = require("../debugger/Logger/CliLogger"); const config_1 = require("../config/config"); const TestChainOptions_1 = require("../TestChainOptions"); async function makeDefaultCtx(_config = config_1.getConfigWithDefaults()) { const config = config_1.getConfigWithDefaults(_config); const abiDecoder = new AbiDecoder_1.AbiDecoder(new RealFileSystem_1.RealFileSystem()); if (config.debugger.abiFilesGlob) { abiDecoder.loadAbis(config.debugger.abiFilesGlob, config.cwd); } const logger = new CliLogger_1.CliLogger(abiDecoder); const chain = new TestChain_1.TestChain(logger, TestChainOptions_1.getTestChainOptionsFromConfig(config)); await chain.init(); return { chain, walletManager: new WalletManager_1.WalletManager(config.accounts.privateKeys), abiDecoder, logger, cfg: config, }; } exports.makeDefaultCtx = makeDefaultCtx;