Skip to content

Commit

Permalink
feat: bypass inscription checks entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Dec 17, 2024
1 parent 1d3f603 commit 7b9f763
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/app/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ const debug = {
chrome.storage.local.clear();
chrome.storage.session.clear();
},
bypassInscriptionChecks() {
store.dispatch(settingsSlice.actions.dangerouslyChosenToBypassAllInscriptionChecks());
},
};

export function setDebugOnGlobal() {
Expand Down
5 changes: 4 additions & 1 deletion src/app/query/bitcoin/address/utxos-by-address.hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useNativeSegwitUtxosByAddress } from '@leather.io/query';

import { useCurrentAccountNativeSegwitIndexZeroSigner } from '@app/store/accounts/blockchain/bitcoin/native-segwit-account.hooks';
import { useHasUserBypassedInscriptionChecks } from '@app/store/settings/settings.selectors';

const defaultArgs = {
filterInscriptionUtxos: true,
Expand All @@ -15,12 +16,14 @@ const defaultArgs = {
export function useCurrentNativeSegwitUtxos(args = defaultArgs) {
const { filterInscriptionUtxos, filterPendingTxsUtxos, filterRunesUtxos } = args;

const hasUserByPassedInscriptionChecks = useHasUserBypassedInscriptionChecks();

const nativeSegwitSigner = useCurrentAccountNativeSegwitIndexZeroSigner();
const address = nativeSegwitSigner.address;

return useNativeSegwitUtxosByAddress({
address,
filterInscriptionUtxos,
filterInscriptionUtxos: hasUserByPassedInscriptionChecks ? false : filterInscriptionUtxos,
filterPendingTxsUtxos,
filterRunesUtxos,
});
Expand Down
4 changes: 4 additions & 0 deletions src/app/store/settings/settings.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ const selectIsPrivateMode = createSelector(selectSettings, state => state.isPriv
export function useIsPrivateMode() {
return useSelector(selectIsPrivateMode);
}

export function useHasUserBypassedInscriptionChecks() {
return useSelector(selectSettings, state => state.bypassInscriptionChecks ?? false);
}
4 changes: 4 additions & 0 deletions src/app/store/settings/settings.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface InitialState {
userSelectedTheme: UserSelectedTheme;
dismissedMessages: string[];
isPrivateMode?: boolean;
bypassInscriptionChecks?: boolean;
}

const initialState: InitialState = {
Expand All @@ -30,5 +31,8 @@ export const settingsSlice = createSlice({
togglePrivateMode(state) {
state.isPrivateMode = !state.isPrivateMode;
},
dangerouslyChosenToBypassAllInscriptionChecks(state) {
state.bypassInscriptionChecks = true;
},
},
});

0 comments on commit 7b9f763

Please sign in to comment.