Skip to content

Commit

Permalink
feat: index with exports
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed May 20, 2024
1 parent f5c1755 commit 097f7fc
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
77 changes: 77 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
export default async function getRPCHandler() {
let modulePath;
if (typeof window !== "undefined") {
modulePath = "./esm/index.js";
} else {
modulePath = "./cjs/index.js";
}

const { RPCHandler } = await import(modulePath);

return RPCHandler;
}

import {
ChainId,
ChainNames,
HandlerConstructorConfig,
HandlerInterface,
NativeToken,
NetworkCurrencies,
NetworkExplorers,
NetworkIds,
NetworkNames,
NetworkRPCs,
Token,
Tokens,
ValidBlockData,
} from "./types/handler";

import {
LOCAL_HOST,
chainIDList,
extraRpcs,
getNetworkName,
networkCurrencies,
networkExplorers,
networkIds,
networkNames,
networkRpcs,
nftAddress,
permit2Address,
tokens,
} from "./types/constants";

import { RPCHandler } from "./types/rpc-handler";

export {
LOCAL_HOST,
chainIDList,
extraRpcs,
getNetworkName,
networkCurrencies,
networkExplorers,
networkIds,
networkNames,
networkRpcs,
nftAddress,
permit2Address,
tokens,
};

export type {
ChainId,
ChainNames,
HandlerConstructorConfig,
HandlerInterface,
NativeToken,
NetworkCurrencies,
NetworkExplorers,
NetworkIds,
NetworkNames,
NetworkRPCs,
Token,
Tokens,
ValidBlockData,
};
export { RPCHandler };
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
],
"dependencies": {
"@ethersproject/providers": "5.7.2",
"axios": "^1.7.1",
"node-fetch": "^3.3.2"
},
"devDependencies": {
Expand Down

0 comments on commit 097f7fc

Please sign in to comment.