@waves/node-state
Version:
41 lines • 1.87 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const constants_1 = require("../constants");
const docker_1 = require("../utils/docker");
const NODE_IMAGE = 'wavesplatform/waves-private-node';
exports.default = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
console.info(`NODE_URL ${constants_1.NODE_URL}`);
console.info(`MASTER_ACCOUNT_SEED ${constants_1.MASTER_ACCOUNT_SEED}`);
console.info(`CHAIN_ID ${constants_1.CHAIN_ID}`);
const state = yield docker_1.isRunImage(NODE_IMAGE);
if (state) {
yield docker_1.stop(NODE_IMAGE);
yield docker_1.remove(NODE_IMAGE);
}
const node = yield docker_1.run([
'--rm',
'-p', `${constants_1.NODE_API_PORT}:6869`,
`--network=${constants_1.DOCKER_NETWORK}`,
'--name=node',
], NODE_IMAGE);
yield new Promise(resolve => {
node.stdout.on('data', chunk => {
const message = String(chunk);
if (message.includes('REST API was bound')) {
console.info('REST API was bound');
resolve();
}
});
});
next();
});
//# sourceMappingURL=node.js.map
;