Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed Dec 8, 2024
1 parent 5780a25 commit d47b4eb
Show file tree
Hide file tree
Showing 4 changed files with 1,159 additions and 507 deletions.
2 changes: 1 addition & 1 deletion app/scripts/controllers/app-state-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export type AppStateControllerState = {
// prior to Migration 92.3 where we split out the setting to support
// multiple networks.
hadAdvancedGasFeesSetPriorToMigration92_3: boolean;
qrHardware: Json;
qrHardware: { sign?: { request: Json } } | Json;
nftsDropdownState: Json;
surveyLinkLastClickedOrClosed: number | null;
signatureSecurityAlertResponses: Record<string, SecurityAlertResponse>;
Expand Down
52 changes: 12 additions & 40 deletions shared/modules/selectors/smart-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,18 @@ import {
// eslint-disable-next-line import/no-restricted-paths
} from '../../../ui/selectors/selectors'; // TODO: Migrate shared selectors to this file.
import { isProduction } from '../environment';
import { BackgroundStateProxy } from '../../types/metamask';
import { getCurrentChainId, NetworkState } from './networks';

type SmartTransactionsMetaMaskState = {
metamask: {
preferences: {
smartTransactionsOptInStatus?: boolean;
};
internalAccounts: {
selectedAccount: string;
accounts: {
[key: string]: {
metadata: {
keyring: {
type: string;
};
};
};
};
};
swapsState: {
swapsFeatureFlags: {
ethereum: {
extensionActive: boolean;
mobileActive: boolean;
smartTransactions: {
expectedDeadline?: number;
maxDeadline?: number;
extensionReturnTxHashAsap?: boolean;
};
};
smartTransactions: {
extensionActive: boolean;
mobileActive: boolean;
};
};
};
smartTransactionsState: {
liveness: boolean;
};
};
metamask: Pick<
BackgroundStateProxy,
| 'PreferencesController'
| 'AccountsController'
| 'SwapsController'
| 'SmartTransactionsController'
> &
Partial<BackgroundStateProxy>;
};

/**
Expand Down Expand Up @@ -134,10 +106,10 @@ export const getSmartTransactionsEnabled = (
const supportedAccount = accountSupportsSmartTx(state);
// TODO: Create a new proxy service only for MM feature flags.
const smartTransactionsFeatureFlagEnabled =
state.metamask.swapsState?.swapsFeatureFlags?.smartTransactions
?.extensionActive;
state.metamask.SwapsController.swapsState?.swapsFeatureFlags
?.smartTransactions?.extensionActive;
const smartTransactionsLiveness =
state.metamask.smartTransactionsState?.liveness;
state.metamask.SmartTransactionsController.smartTransactionsState?.liveness;
return Boolean(
getCurrentChainSupportsSmartTransactions(state) &&
getIsAllowedRpcUrlForSmartTransactions(state) &&
Expand Down
Loading

0 comments on commit d47b4eb

Please sign in to comment.