diff --git a/app/reducers/swaps/index.js b/app/reducers/swaps/index.js index d4d3bd26f31..84674aee8ca 100644 --- a/app/reducers/swaps/index.js +++ b/app/reducers/swaps/index.js @@ -89,7 +89,13 @@ export const swapsSmartTxFlagEnabled = createSelector( export const selectSwapsChainFeatureFlags = createSelector( swapsStateSelector, chainIdSelector, - (swapsState, chainId) => swapsState[chainId].featureFlags, + (swapsState, chainId) => ({ + ...swapsState[chainId].featureFlags, + smartTransactions: { + ...(swapsState[chainId].featureFlags?.smartTransactions || {}), + ...(swapsState.featureFlags?.smartTransactions || {}), + }, + }), ); /** diff --git a/app/reducers/swaps/swaps.test.ts b/app/reducers/swaps/swaps.test.ts index 402b96bb85b..f8bfdeae4e9 100644 --- a/app/reducers/swaps/swaps.test.ts +++ b/app/reducers/swaps/swaps.test.ts @@ -24,7 +24,7 @@ const DEFAULT_FEATURE_FLAGS = { smartTransactions: { expectedDeadline: 45, maxDeadline: 150, - returnTxHashAsap: false, + mobileReturnTxHashAsap: false, }, }, bsc: { @@ -90,7 +90,7 @@ describe('swaps reducer', () => { smartTransactions: { expectedDeadline: 45, maxDeadline: 150, - returnTxHashAsap: false, + mobileReturnTxHashAsap: false, }, }; @@ -122,7 +122,7 @@ describe('swaps reducer', () => { smartTransactions: { expectedDeadline: 45, maxDeadline: 150, - returnTxHashAsap: false, + mobileReturnTxHashAsap: false, }, }; @@ -154,7 +154,7 @@ describe('swaps reducer', () => { smartTransactions: { expectedDeadline: 45, maxDeadline: 150, - returnTxHashAsap: false, + mobileReturnTxHashAsap: false, }, }; @@ -226,7 +226,7 @@ describe('swaps reducer', () => { smartTransactions: { expectedDeadline: 45, maxDeadline: 150, - returnTxHashAsap: false, + mobileReturnTxHashAsap: false, }, }, }, @@ -281,7 +281,7 @@ describe('swaps reducer', () => { smartTransactions: { expectedDeadline: 45, maxDeadline: 150, - returnTxHashAsap: false, + mobileReturnTxHashAsap: false, }, }, }, diff --git a/app/selectors/smartTransactionsController.test.ts b/app/selectors/smartTransactionsController.test.ts index a3a5fdabee5..12363ad1a0e 100644 --- a/app/selectors/smartTransactionsController.test.ts +++ b/app/selectors/smartTransactionsController.test.ts @@ -37,7 +37,7 @@ const getDefaultState = () => { smartTransactions: { expectedDeadline: 45, maxDeadline: 160, - returnTxHashAsap: false, + mobileReturnTxHashAsap: false, }, }, }, diff --git a/app/util/smart-transactions/smart-publish-hook.test.ts b/app/util/smart-transactions/smart-publish-hook.test.ts index 481932af255..0a902572214 100644 --- a/app/util/smart-transactions/smart-publish-hook.test.ts +++ b/app/util/smart-transactions/smart-publish-hook.test.ts @@ -200,7 +200,7 @@ function withRequest( smartTransactions: { expectedDeadline: 45, maxDeadline: 150, - returnTxHashAsap: false, + mobileReturnTxHashAsap: false, }, mobile_active: true, extension_active: true, @@ -231,7 +231,7 @@ describe('submitSmartTransactionHook', () => { it('returns a txHash asap if the feature flag requires it', async () => { withRequest(async ({ request }) => { - request.featureFlags.smartTransactions.returnTxHashAsap = true; + request.featureFlags.smartTransactions.mobileReturnTxHashAsap = true; const result = await submitSmartTransactionHook(request); expect(result).toEqual({ transactionHash }); }); diff --git a/app/util/smart-transactions/smart-publish-hook.ts b/app/util/smart-transactions/smart-publish-hook.ts index 8562b5d07f9..5f9c4c9d489 100644 --- a/app/util/smart-transactions/smart-publish-hook.ts +++ b/app/util/smart-transactions/smart-publish-hook.ts @@ -52,7 +52,7 @@ export interface SubmitSmartTransactionRequest { | { expectedDeadline: number; maxDeadline: number; - returnTxHashAsap: boolean; + mobileReturnTxHashAsap: boolean; } | Record; }; @@ -74,7 +74,7 @@ class SmartTransactionHook { smartTransactions: { expectedDeadline?: number; maxDeadline?: number; - returnTxHashAsap?: boolean; + mobileReturnTxHashAsap?: boolean; }; }; #shouldUseSmartTransaction: boolean; @@ -262,10 +262,10 @@ class SmartTransactionHook { uuid: string, ) => { let transactionHash: string | undefined | null; - const returnTxHashAsap = - this.#featureFlags?.smartTransactions?.returnTxHashAsap; + const mobileReturnTxHashAsap = + this.#featureFlags?.smartTransactions?.mobileReturnTxHashAsap; - if (returnTxHashAsap && submitTransactionResponse?.txHash) { + if (mobileReturnTxHashAsap && submitTransactionResponse?.txHash) { transactionHash = submitTransactionResponse.txHash; } else { transactionHash = await this.#waitForTransactionHash({