Skip to content

Commit

Permalink
feat(ui-ux): log error in evm provider (#4097)
Browse files Browse the repository at this point in the history
  • Loading branch information
lykalabrada authored Oct 23, 2023
1 parent 57f593b commit 96d2dbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mobile-app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default function App(): JSX.Element | null {
renderType={customToast}
>
<FavouritePoolpairProvider>
<EVMProvider>
<EVMProvider logger={Logging}>
<Main />
</EVMProvider>
</FavouritePoolpairProvider>
Expand Down
5 changes: 4 additions & 1 deletion mobile-app/app/contexts/EVMProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import React, {
} from "react";
import { providers } from "ethers";
import { useNetworkContext } from "@waveshq/walletkit-ui";
import { BaseLogger } from "@waveshq/walletkit-ui/dist/contexts/logger";
import { useCustomServiceProviderContext } from "./CustomServiceProvider";

interface EVMProviderContextI {
Expand All @@ -21,7 +22,8 @@ export function useEVMProvider(): EVMProviderContextI {

export function EVMProvider({
children,
}: React.PropsWithChildren<any>): JSX.Element | null {
logger,
}: React.PropsWithChildren<{ logger: BaseLogger }>): JSX.Element | null {
const { ethRpcUrl } = useCustomServiceProviderContext();
const { network } = useNetworkContext();
const [chainId, setChainId] = useState<number>();
Expand All @@ -36,6 +38,7 @@ export function EVMProvider({
setChainId(chainId);
setProvider(provider);
} catch (e) {
logger.error(e);
// Note: Added this for cases wherein eth rpc url is invalid or unreachable
setChainId(0);
setProvider(null);
Expand Down

0 comments on commit 96d2dbc

Please sign in to comment.