UNPKG

@roochnetwork/rooch-sdk-kit

Version:
35 lines (31 loc) 860 B
// src/hooks/client/useRoochContext.ts import { useContext } from "react"; // src/provider/clientProvider.tsx import { createContext, useMemo, useState } from "react"; import { getRoochNodeUrl, RoochClient } from "@roochnetwork/rooch-sdk"; import { jsx } from "react/jsx-runtime"; var ClientContext = createContext(null); var DEFAULT_NETWORKS = { localnet: { url: getRoochNodeUrl("localnet") } }; // src/hooks/client/useRoochContext.ts function useRoochContext() { const context = useContext(ClientContext); if (!context) { throw new Error( "Could not find RoochClientContext. Ensure that you have set up the RoochClientProvider." ); } return context; } // src/hooks/client/useRoochClient.ts function useRoochClient() { return useRoochContext().client; } export { useRoochClient }; //# sourceMappingURL=useRoochClient.js.map