Skip to content

Commit

Permalink
fix: fixed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mishramonalisha76 committed Oct 14, 2024
1 parent db6f235 commit ed114ae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/uiweb/src/lib/context/chatContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface IChatDataContextValues {
isPushChatStreamConnected: boolean;
setIsPushChatStreamConnected: React.Dispatch<React.SetStateAction<boolean>>;
toast: any;
infuraProjectId: string | null;
infuraAPIKey: string | null;
uiConfig: {
suppressToast?: boolean;
};
Expand Down Expand Up @@ -89,7 +89,7 @@ export const initialChatDataContextValues: IChatDataContextValues = {
uiConfig: {
suppressToast: false,
},
infuraProjectId: null,
infuraAPIKey: null,
chatStream: {},
chatAcceptStream: {},
chatRejectStream: {},
Expand Down
8 changes: 4 additions & 4 deletions packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -48,7 +48,7 @@ export interface IChatUIProviderProps {
uiConfig?: {
suppressToast?: boolean;
};
infuraProjectId?: string;
infuraAPIKey?: string;
}

// Exported Functions
Expand All @@ -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;
Expand Down Expand Up @@ -454,7 +454,7 @@ export const ChatUIProvider = ({
setIsPushChatStreamConnected,
user: pushUser,
setUser: setPushUser,
infuraProjectId: infuraProjectId,
infuraAPIKey: infuraAPIKey,
toast: toastify,
uiConfig: uiConfig,
chatStream,
Expand Down
7 changes: 7 additions & 0 deletions packages/uiweb/src/lib/hooks/useAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit ed114ae

Please sign in to comment.