Skip to content

Commit 4ffd6a3

Browse files
fix: missing deadline in swaps stx status screen (#25779)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR fixes an issue where the STX status screen for a swap was showing a 0:00 for the timer. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25779?quickstart=1) Related to: #25063 1. Make sure Smart Transactions is on (Settings > Advanced) 2. Do a Swap 3. Observe that timer is not 0:00 and is a reasonable number <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> <!-- [screenshots/recordings] --> https://github.com/MetaMask/metamask-extension/assets/139582705/26fe6167-614f-4771-b35b-10803bc23fc0 <!-- [screenshots/recordings] --> https://github.com/MetaMask/metamask-extension/assets/139582705/d92b933d-1011-48b4-bf04-344f275d35db - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: Marta Poling <[email protected]>
1 parent a5a7f0e commit 4ffd6a3

File tree

7 files changed

+12
-1
lines changed

7 files changed

+12
-1
lines changed

app/scripts/controllers/swaps.constants.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
FALLBACK_SMART_TRANSACTIONS_DEADLINE,
23
FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER,
34
FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
45
} from '../../../shared/constants/smartTransactions';
@@ -42,6 +43,7 @@ export const swapsControllerInitialState: { swapsState: SwapsControllerState } =
4243
swapsQuoteRefreshTime: FALLBACK_QUOTE_REFRESH_TIME,
4344
swapsQuotePrefetchingRefreshTime: FALLBACK_QUOTE_REFRESH_TIME,
4445
swapsStxBatchStatusRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
46+
swapsStxStatusDeadline: FALLBACK_SMART_TRANSACTIONS_DEADLINE,
4547
swapsStxGetTransactionsRefreshTime:
4648
FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
4749
swapsStxMaxFeeMultiplier: FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER,

app/scripts/controllers/swaps.test.js

+3
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,8 @@ describe('SwapsController', function () {
943943
swapsStxGetTransactionsRefreshTime:
944944
old.swapsStxGetTransactionsRefreshTime,
945945
swapsStxBatchStatusRefreshTime: old.swapsStxBatchStatusRefreshTime,
946+
swapsStxBatchStatusRefreshTime: old.swapsStxBatchStatusRefreshTime,
947+
swapsStxStatusDeadline: old.swapsStxStatusDeadline,
946948
});
947949
});
948950

@@ -1012,6 +1014,7 @@ describe('SwapsController', function () {
10121014
swapsQuotePrefetchingRefreshTime,
10131015
swapsStxBatchStatusRefreshTime,
10141016
swapsStxGetTransactionsRefreshTime,
1017+
swapsStxStatusDeadline,
10151018
},
10161019
});
10171020

app/scripts/controllers/swaps.ts

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { CHAIN_IDS } from '../../../shared/constants/network';
2424
import {
2525
FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER,
2626
FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
27+
FALLBACK_SMART_TRANSACTIONS_DEADLINE,
2728
} from '../../../shared/constants/smartTransactions';
2829
import {
2930
DEFAULT_ERC20_APPROVE_GAS,
@@ -944,6 +945,9 @@ export default class SwapsController {
944945
swapsStxMaxFeeMultiplier:
945946
swapsNetworkConfig?.stxMaxFeeMultiplier ||
946947
FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER,
948+
swapsStxStatusDeadline:
949+
swapsNetworkConfig?.stxStatusDeadline ||
950+
FALLBACK_SMART_TRANSACTIONS_DEADLINE,
947951
},
948952
});
949953
}

app/scripts/lib/setupSentry.js

+1
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ export const SENTRY_BACKGROUND_STATE = {
335335
swapsQuotePrefetchingRefreshTime: true,
336336
swapsQuoteRefreshTime: true,
337337
swapsStxBatchStatusRefreshTime: true,
338+
swapsStxStatusDeadline: true,
338339
swapsStxGetTransactionsRefreshTime: true,
339340
swapsStxMaxFeeMultiplier: true,
340341
swapsUserFeeLevel: true,

test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json

+1
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@
271271
"swapsQuoteRefreshTime": 60000,
272272
"swapsQuotePrefetchingRefreshTime": 60000,
273273
"swapsStxBatchStatusRefreshTime": 10000,
274+
"swapsStxStatusDeadline": 180,
274275
"swapsStxGetTransactionsRefreshTime": 10000,
275276
"swapsStxMaxFeeMultiplier": 2
276277
}

test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
"swapsQuoteRefreshTime": 60000,
246246
"swapsQuotePrefetchingRefreshTime": 60000,
247247
"swapsStxBatchStatusRefreshTime": 10000,
248+
"swapsStxStatusDeadline": 180,
248249
"swapsStxGetTransactionsRefreshTime": 10000,
249250
"swapsStxMaxFeeMultiplier": 2
250251
},

ui/pages/swaps/smart-transaction-status/smart-transaction-status.js

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ export default function SmartTransactionStatusPage() {
110110
cancellationFeeWei =
111111
latestSmartTransaction?.statusMetadata?.cancellationFeeWei;
112112
}
113-
114113
const [timeLeftForPendingStxInSec, setTimeLeftForPendingStxInSec] = useState(
115114
swapsNetworkConfig.stxStatusDeadline,
116115
);

0 commit comments

Comments
 (0)