diff --git a/app/scripts/controllers/swaps/index.ts b/app/scripts/controllers/swaps/index.ts index 5870e9bb8f6b..aee6417e526a 100644 --- a/app/scripts/controllers/swaps/index.ts +++ b/app/scripts/controllers/swaps/index.ts @@ -23,6 +23,7 @@ import { CHAIN_IDS } from '../../../../shared/constants/network'; import { FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER, FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME, + FALLBACK_SMART_TRANSACTIONS_DEADLINE, } from '../../../../shared/constants/smartTransactions'; import { DEFAULT_ERC20_APPROVE_GAS, @@ -918,6 +919,7 @@ export default class SwapsController extends BaseController< functionName: '_fetchSwapsNetworkConfig', }); const { refreshRates, parameters = {} } = response || {}; + console.log('parameters', parameters); if ( !refreshRates || typeof refreshRates.quotes !== 'number' || @@ -935,6 +937,7 @@ export default class SwapsController extends BaseController< stxBatchStatus: refreshRates.stxBatchStatus * 1000, stxStatusDeadline: refreshRates.stxStatusDeadline, stxMaxFeeMultiplier: parameters.stxMaxFeeMultiplier, + swapsStxStatusDeadline: parameters.stxStatusDeadline, }; } @@ -1061,6 +1064,7 @@ export default class SwapsController extends BaseController< stxBatchStatus: number; stxStatusDeadline: number; stxMaxFeeMultiplier: number; + swapsStxStatusDeadline: number; } | null = null; try { @@ -1082,6 +1086,9 @@ export default class SwapsController extends BaseController< _state.swapsState.swapsStxMaxFeeMultiplier = swapsNetworkConfig?.stxMaxFeeMultiplier || FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER; + _state.swapsState.swapsStxStatusDeadline = + swapsNetworkConfig?.swapsStxStatusDeadline || + FALLBACK_SMART_TRANSACTIONS_DEADLINE; }); } diff --git a/app/scripts/controllers/swaps/swaps.constants.ts b/app/scripts/controllers/swaps/swaps.constants.ts index d31d4b9bb918..1e5b566387b8 100644 --- a/app/scripts/controllers/swaps/swaps.constants.ts +++ b/app/scripts/controllers/swaps/swaps.constants.ts @@ -1,4 +1,5 @@ import { + FALLBACK_SMART_TRANSACTIONS_DEADLINE, FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER, FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME, } from '../../../../shared/constants/smartTransactions'; @@ -44,6 +45,7 @@ export function getDefaultSwapsControllerState(): SwapsControllerState { swapsQuoteRefreshTime: FALLBACK_QUOTE_REFRESH_TIME, swapsQuotePrefetchingRefreshTime: FALLBACK_QUOTE_REFRESH_TIME, swapsStxBatchStatusRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME, + swapsStxStatusDeadline: FALLBACK_SMART_TRANSACTIONS_DEADLINE, swapsStxGetTransactionsRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME, swapsStxMaxFeeMultiplier: FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER, diff --git a/app/scripts/controllers/swaps/swaps.test.ts b/app/scripts/controllers/swaps/swaps.test.ts index 8b2fbd22d032..cc97de595352 100644 --- a/app/scripts/controllers/swaps/swaps.test.ts +++ b/app/scripts/controllers/swaps/swaps.test.ts @@ -1171,6 +1171,7 @@ describe('SwapsController', function () { const swapsQuotePrefetchingRefreshTime = 0; const swapsStxBatchStatusRefreshTime = 0; const swapsStxGetTransactionsRefreshTime = 0; + const swapsStxStatusDeadline = 0; swapsController.__test__updateState({ swapsState: { ...swapsController.state.swapsState, @@ -1182,6 +1183,7 @@ describe('SwapsController', function () { swapsQuotePrefetchingRefreshTime, swapsStxBatchStatusRefreshTime, swapsStxGetTransactionsRefreshTime, + swapsStxStatusDeadline, }, }); diff --git a/app/scripts/lib/setupSentry.js b/app/scripts/lib/setupSentry.js index 9432f8c4e7af..971b85cec0f8 100644 --- a/app/scripts/lib/setupSentry.js +++ b/app/scripts/lib/setupSentry.js @@ -344,6 +344,7 @@ export const SENTRY_BACKGROUND_STATE = { swapsQuotePrefetchingRefreshTime: true, swapsQuoteRefreshTime: true, swapsStxBatchStatusRefreshTime: true, + swapsStxStatusDeadline: true, swapsStxGetTransactionsRefreshTime: true, swapsStxMaxFeeMultiplier: true, swapsUserFeeLevel: true, diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json index 391224338a39..2ecaf84b3140 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json @@ -274,6 +274,7 @@ "swapsQuoteRefreshTime": 60000, "swapsQuotePrefetchingRefreshTime": 60000, "swapsStxBatchStatusRefreshTime": 10000, + "swapsStxStatusDeadline": 180, "swapsStxGetTransactionsRefreshTime": 10000, "swapsStxMaxFeeMultiplier": 2, "swapsFeatureFlags": {} diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json index 4d3f7779e456..00f12016b854 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json @@ -249,6 +249,7 @@ "swapsQuoteRefreshTime": 60000, "swapsQuotePrefetchingRefreshTime": 60000, "swapsStxBatchStatusRefreshTime": 10000, + "swapsStxStatusDeadline": 180, "swapsStxGetTransactionsRefreshTime": 10000, "swapsStxMaxFeeMultiplier": 2, "swapsFeatureFlags": {} diff --git a/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js b/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js index ad60188f4ce1..157190687f31 100644 --- a/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js +++ b/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js @@ -110,7 +110,6 @@ export default function SmartTransactionStatusPage() { cancellationFeeWei = latestSmartTransaction?.statusMetadata?.cancellationFeeWei; } - const [timeLeftForPendingStxInSec, setTimeLeftForPendingStxInSec] = useState( swapsNetworkConfig.stxStatusDeadline, );