diff --git a/src/app/features/collectibles/components/bitcoin/inscription.tsx b/src/app/features/collectibles/components/bitcoin/inscription.tsx
index bf1ee54201..a14e6a45e3 100644
--- a/src/app/features/collectibles/components/bitcoin/inscription.tsx
+++ b/src/app/features/collectibles/components/bitcoin/inscription.tsx
@@ -10,6 +10,7 @@ import { ORD_IO_URL } from '@shared/constants';
import { RouteUrls } from '@shared/route-urls';
import { openInNewTab } from '@app/common/utils/open-in-new-tab';
+import { useDiscardedInscriptions } from '@app/store/settings/settings.selectors';
import { CollectibleAudio } from '../_collectible-types/collectible-audio';
import { CollectibleIframe } from '../_collectible-types/collectible-iframe';
@@ -29,6 +30,7 @@ function openInscriptionUrl(num: number) {
export function Inscription({ inscription }: InscriptionProps) {
const navigate = useNavigate();
const location = useLocation();
+ const { hasBeenDiscarded, discardInscription, recoverInscription } = useDiscardedInscriptions();
const openSendInscriptionModal = useCallback(() => {
navigate(RouteUrls.SendOrdinalInscription, {
@@ -112,6 +114,19 @@ export function Inscription({ inscription }: InscriptionProps) {
{content}
+ IsDiscarded: {String(hasBeenDiscarded(inscription.id))}
+
+ value: {inscription.value}
+
+
);
}
diff --git a/src/app/store/settings/settings.selectors.ts b/src/app/store/settings/settings.selectors.ts
index 91f8d30107..f0f40053ba 100644
--- a/src/app/store/settings/settings.selectors.ts
+++ b/src/app/store/settings/settings.selectors.ts
@@ -1,9 +1,12 @@
-import { useSelector } from 'react-redux';
+import { useMemo } from 'react';
+import { useDispatch, useSelector } from 'react-redux';
import { createSelector } from '@reduxjs/toolkit';
import { RootState } from '@app/store';
+import { settingsSlice } from './settings.slice';
+
const selectSettings = (state: RootState) => state.settings;
const selectUserSelectedTheme = createSelector(selectSettings, state => state.userSelectedTheme);
@@ -27,6 +30,37 @@ export function useIsPrivateMode() {
return useSelector(selectIsPrivateMode);
}
+const selectHasUserBypassedInscriptionChecks = createSelector(
+ selectSettings,
+ state => state.bypassInscriptionChecks ?? false
+);
+
export function useHasUserBypassedInscriptionChecks() {
- return useSelector(selectSettings, state => state.bypassInscriptionChecks ?? false);
+ return useSelector(selectHasUserBypassedInscriptionChecks);
+}
+
+const selectDiscardedInscriptions = createSelector(
+ selectSettings,
+ state => state.discardedInscriptions
+);
+
+export function useDiscardedInscriptions() {
+ const discardedInscriptions = useSelector(selectDiscardedInscriptions);
+ const dispatch = useDispatch();
+
+ return useMemo(
+ () => ({
+ discardedInscriptions,
+ hasBeenDiscarded(inscriptionId: string) {
+ return discardedInscriptions.includes(inscriptionId);
+ },
+ discardInscription(inscriptionId: string) {
+ dispatch(settingsSlice.actions.discardInscription(inscriptionId));
+ },
+ recoverInscription(inscriptionId: string) {
+ dispatch(settingsSlice.actions.recoverInscription(inscriptionId));
+ },
+ }),
+ [discardedInscriptions, dispatch]
+ );
}
diff --git a/src/app/store/settings/settings.slice.ts b/src/app/store/settings/settings.slice.ts
index 831bee507a..fd403a74bc 100644
--- a/src/app/store/settings/settings.slice.ts
+++ b/src/app/store/settings/settings.slice.ts
@@ -7,11 +7,13 @@ interface InitialState {
dismissedMessages: string[];
isPrivateMode?: boolean;
bypassInscriptionChecks?: boolean;
+ discardedInscriptions: string[];
}
const initialState: InitialState = {
userSelectedTheme: 'system',
dismissedMessages: [],
+ discardedInscriptions: [],
};
export const settingsSlice = createSlice({
@@ -34,5 +36,14 @@ export const settingsSlice = createSlice({
dangerouslyChosenToBypassAllInscriptionChecks(state) {
state.bypassInscriptionChecks = true;
},
+ discardInscription(state, action: PayloadAction) {
+ if (!Array.isArray(state.discardedInscriptions)) state.discardedInscriptions = [];
+ state.discardedInscriptions.push(action.payload);
+ },
+ recoverInscription(state, action: PayloadAction) {
+ state.discardedInscriptions = state.discardedInscriptions.filter(
+ inscriptionId => inscriptionId !== action.payload
+ );
+ },
},
});