-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Safe App info button * fix: return type * fix: mark apps agnostic of chain * Revert "fix: mark apps agnostic of chain" This reverts commit 35e7917.
- Loading branch information
Showing
8 changed files
with
294 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useCallback } from 'react' | ||
import type { SafeAppData } from '@safe-global/safe-gateway-typescript-sdk' | ||
|
||
import useChainId from '@/hooks/useChainId' | ||
import { useAppDispatch, useAppSelector } from '@/store' | ||
import { selectOpened, markOpened } from '@/store/safeAppsSlice' | ||
|
||
type ReturnType = { | ||
openedSafeAppIds: Array<SafeAppData['id']> | ||
markSafeAppOpened: (id: SafeAppData['id']) => void | ||
} | ||
|
||
// Return the ids of Safe Apps previously opened by the user | ||
export const useOpenedSafeApps = (): ReturnType => { | ||
const chainId = useChainId() | ||
|
||
const dispatch = useAppDispatch() | ||
const openedSafeAppIds = useAppSelector((state) => selectOpened(state, chainId)) | ||
|
||
const markSafeAppOpened = useCallback( | ||
(id: SafeAppData['id']) => { | ||
dispatch(markOpened({ id, chainId })) | ||
}, | ||
[dispatch, chainId], | ||
) | ||
|
||
return { openedSafeAppIds, markSafeAppOpened } | ||
} |
Oops, something went wrong.