diff --git a/networks.json b/src/networks.json similarity index 100% rename from networks.json rename to src/networks.json diff --git a/src/rpc/common.ts b/src/rpc/common.ts index 4a7ff7e..caef806 100644 --- a/src/rpc/common.ts +++ b/src/rpc/common.ts @@ -5,8 +5,6 @@ import { Connection } from "@solana/web3.js"; import { getAat, getPocketServer } from "../rpc.js"; import config, { usePocketGateway } from "../config.js"; -export const chainNetworks = require("../../networks.json"); - type RpcProviderMethod = (method: string, params: Array) => Promise; const gatewayProviders: { [name: string]: RpcProviderMethod } = {}; diff --git a/src/rpc/solana.ts b/src/rpc/solana.ts index 1581f3d..b438cb6 100644 --- a/src/rpc/solana.ts +++ b/src/rpc/solana.ts @@ -1,5 +1,6 @@ -import { chainNetworks, proxyRpcMethod } from "./common.js"; +import { proxyRpcMethod } from "./common.js"; import { RpcMethodList } from "./index.js"; +import * as chainNetworks from "../networks.json"; export default { getAccountInfo: proxyRpcMethod("getAccountInfo", [ diff --git a/src/util.ts b/src/util.ts index 4e64146..992b998 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,4 +1,6 @@ -import { chainNetworks } from "./rpc/index.js"; +import * as chainNetworks from "./networks.json"; + +type networks = { [net: string]: string }; export function errorExit(msg: string): void { console.error(msg); @@ -7,7 +9,7 @@ export function errorExit(msg: string): void { export function maybeMapChainId(chain: string): string | boolean { if (chain in chainNetworks) { - return chainNetworks[chain]; + return (chainNetworks as networks)[chain]; } if ( diff --git a/tsconfig.json b/tsconfig.json index 570cfad..b742cda 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, - "skipLibCheck": true + "skipLibCheck": true, + "resolveJsonModule": true } }