UNPKG

chaingate

Version:

A complete TypeScript library for connecting to and making transactions on different blockchains

18 lines 790 B
import React, { useContext } from 'react'; import { CurrencyUtilsProvider } from '../CurrencyUtilsProvider'; import { createChainGateContext } from '../InitializeWallet'; import { createContext as createReactContext } from 'react'; const UtilsContextInternal = createReactContext(undefined); export const UtilsContext = ({ children, apiKey }) => { const context = createChainGateContext(apiKey); const utils = new CurrencyUtilsProvider(context); return React.createElement(UtilsContextInternal.Provider, { value: utils }, children); }; export function useUtils() { const ctx = useContext(UtilsContextInternal); if (!ctx) { throw new Error('useUtils must be used within <UtilsContext>'); } return { utils: ctx }; } //# sourceMappingURL=UtilsContext.js.map