*Move errorExit to dedicated file
*Add ERR_NOT_READY constant which will represent a chain not ready
This commit is contained in:
parent
023b1387fc
commit
e0c0ee3f83
|
@ -1,9 +1,9 @@
|
|||
// @ts-ignore
|
||||
import BConfig from "bcfg";
|
||||
import { errorExit } from "./util.js";
|
||||
import * as os from "os";
|
||||
import { createRequire } from "module";
|
||||
import path from "path";
|
||||
import { errorExit } from "./error.js";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const config = new BConfig("lumeweb-relay");
|
||||
|
|
|
@ -2,7 +2,6 @@ import { createRequire } from "module";
|
|||
|
||||
const require = createRequire(import.meta.url);
|
||||
const DHT = require("@hyperswarm/dht");
|
||||
import { errorExit } from "./util.js";
|
||||
import {
|
||||
deriveMyskyRootKeypair,
|
||||
Ed25519Keypair,
|
||||
|
@ -10,6 +9,7 @@ import {
|
|||
validSeedPhrase,
|
||||
} from "libskynet";
|
||||
import config from "./config.js";
|
||||
import { errorExit } from "./error.js";
|
||||
|
||||
let node: {
|
||||
ready: () => any;
|
||||
|
|
|
@ -5,10 +5,10 @@ import { overwriteRegistryEntry } from "libskynetnode";
|
|||
import { Buffer } from "buffer";
|
||||
import { Parser } from "xml2js";
|
||||
import { URL } from "url";
|
||||
import { errorExit } from "./util.js";
|
||||
import { pack } from "msgpackr";
|
||||
import config from "./config.js";
|
||||
import { hashDataKey } from "@lumeweb/kernel-utils";
|
||||
import { errorExit } from "./error.js";
|
||||
|
||||
const { createHash } = await import("crypto");
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
export function errorExit(msg: string): void {
|
||||
console.error(msg);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
export const ERR_NOT_READY = "NOT_READY";
|
|
@ -10,12 +10,13 @@ import PocketPKG from "@pokt-network/pocket-js";
|
|||
|
||||
const { Configuration, HttpRpcProvider, PocketAAT, Pocket } = PocketPKG;
|
||||
import {
|
||||
JSONRPCError,
|
||||
JSONRPCRequest,
|
||||
JSONRPCResponseWithError,
|
||||
JSONRPCResponseWithResult,
|
||||
} from "jayson";
|
||||
import config, { updateUsePocketGateway, usePocketGateway } from "./config.js";
|
||||
import { errorExit } from "./util.js";
|
||||
import { ERR_NOT_READY, errorExit } from "./error.js";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
|
|
|
@ -2,11 +2,6 @@ import * as chainNetworks from "./networks.json" assert { type: "json" };
|
|||
|
||||
type networks = { [net: string]: string };
|
||||
|
||||
export function errorExit(msg: string): void {
|
||||
console.error(msg);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
export function maybeMapChainId(chain: string): string | boolean {
|
||||
if (chain in chainNetworks) {
|
||||
return (chainNetworks as networks)[chain];
|
||||
|
|
Loading…
Reference in New Issue