diff --git a/packages/uiweb/src/lib/context/chatContext.ts b/packages/uiweb/src/lib/context/chatContext.ts index 8e28d117d..6313604ff 100644 --- a/packages/uiweb/src/lib/context/chatContext.ts +++ b/packages/uiweb/src/lib/context/chatContext.ts @@ -25,7 +25,7 @@ export interface IChatDataContextValues { isPushChatStreamConnected: boolean; setIsPushChatStreamConnected: React.Dispatch>; toast: any; - infuraProjectId: string | null; + infuraAPIKey: string | null; uiConfig: { suppressToast?: boolean; }; @@ -89,7 +89,7 @@ export const initialChatDataContextValues: IChatDataContextValues = { uiConfig: { suppressToast: false, }, - infuraProjectId: null, + infuraAPIKey: null, chatStream: {}, chatAcceptStream: {}, chatRejectStream: {}, diff --git a/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx b/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx index 778400109..e5d6d1445 100644 --- a/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx +++ b/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx @@ -16,7 +16,7 @@ import usePushUser from '../hooks/usePushUser'; // Internal Configs import { lightChatTheme } from '../components/chat/theme'; import { ThemeContext } from '../components/chat/theme/ThemeProvider'; -import { Constants, ENV, GUEST_MODE_ACCOUNT, infuraAPIKey } from '../config'; +import { Constants, ENV, GUEST_MODE_ACCOUNT, infuraAPIKey as infuraProjectId } from '../config'; // Assets @@ -48,7 +48,7 @@ export interface IChatUIProviderProps { uiConfig?: { suppressToast?: boolean; }; - infuraProjectId?: string; + infuraAPIKey?: string; } // Exported Functions @@ -62,7 +62,7 @@ export const ChatUIProvider = ({ theme, debug = false, uiConfig = {}, - infuraProjectId = infuraAPIKey, + infuraAPIKey = infuraProjectId, }: IChatUIProviderProps) => { // Now destructure with a default value for suppressToast const { suppressToast = false } = uiConfig; @@ -454,7 +454,7 @@ export const ChatUIProvider = ({ setIsPushChatStreamConnected, user: pushUser, setUser: setPushUser, - infuraProjectId: infuraProjectId, + infuraAPIKey: infuraAPIKey, toast: toastify, uiConfig: uiConfig, chatStream, diff --git a/packages/uiweb/src/lib/hooks/useAccount.ts b/packages/uiweb/src/lib/hooks/useAccount.ts index c8e4717e0..eb1119f57 100644 --- a/packages/uiweb/src/lib/hooks/useAccount.ts +++ b/packages/uiweb/src/lib/hooks/useAccount.ts @@ -20,6 +20,13 @@ export const useAccount = ({ env }: useAccountParams) => { const switchChain = async (desiredChain: number) => { setChain({ chainId: ethers.utils.hexValue(desiredChain) }); }; + /* + Create a new context provider which will hold this provider for the infura calls. + + All the chat specific things will move to top level context. + + All the widget specific things will move to top level context. + */ const provider = useMemo(() => { return wallet ? new ethers.providers.Web3Provider(wallet.provider, 'any')