*refactor loading networks.json

This commit is contained in:
Derrick Hammer 2022-07-05 16:14:39 -04:00
parent 6a2ea8b4f2
commit 7c13ab7f3f
5 changed files with 8 additions and 6 deletions

View File

@ -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<any>) => Promise<any>;
const gatewayProviders: { [name: string]: RpcProviderMethod } = {};

View File

@ -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", [

View File

@ -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 (

View File

@ -8,6 +8,7 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
"skipLibCheck": true,
"resolveJsonModule": true
}
}