Skip to content

Commit

Permalink
feat: bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Jun 24, 2023
1 parent 1237624 commit 26af1f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/web-lib/hooks/useChainID.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export type TUseChainIDRes = {
safeChainID: number;
}

export const toSafeChainID = (chainID: number, fallback: number): number => {
if ([1337, 31337].includes(chainID)) {
return fallback;
}
return chainID;
};

/* 🔵 - Yearn Finance ******************************************************
** This hook can be used to grab the current injected wallet provider.
** It will return the name and icon of the wallet provider.
Expand All @@ -15,7 +22,7 @@ export function useChainID(defaultChainID?: number): TUseChainIDRes {
const {chainID, onSwitchChain} = useWeb3();
const safeChainID = useMemo((): number => {
const fallbackChainID = defaultChainID || 1;
return [1337, 31337].includes(chainID) ? fallbackChainID : chainID || fallbackChainID;
return toSafeChainID(chainID, fallbackChainID);
}, [chainID, defaultChainID]);

return ({
Expand Down
2 changes: 1 addition & 1 deletion packages/web-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yearn-finance/web-lib",
"version": "0.20.76",
"version": "0.20.77",
"files": [
"."
],
Expand Down

0 comments on commit 26af1f4

Please sign in to comment.