UNPKG

@roochnetwork/rooch-sdk-kit

Version:
30 lines (27 loc) 758 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; } export { useRoochContext }; //# sourceMappingURL=useRoochContext.js.map