diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..2c63d61 --- /dev/null +++ b/index.ts @@ -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 }; diff --git a/package.json b/package.json index be8baf0..033b3e6 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ ], "dependencies": { "@ethersproject/providers": "5.7.2", + "axios": "^1.7.1", "node-fetch": "^3.3.2" }, "devDependencies": {