Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing deadline in swaps stx status screen #25779

Merged
merged 11 commits into from
Aug 20, 2024
4 changes: 4 additions & 0 deletions app/scripts/controllers/swaps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1082,6 +1083,9 @@ export default class SwapsController extends BaseController<
_state.swapsState.swapsStxMaxFeeMultiplier =
swapsNetworkConfig?.stxMaxFeeMultiplier ||
FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER;
_state.swapsState.swapsStxStatusDeadline =
swapsNetworkConfig?.stxStatusDeadline ||
FALLBACK_SMART_TRANSACTIONS_DEADLINE;
});
}

Expand Down
2 changes: 2 additions & 0 deletions app/scripts/controllers/swaps/swaps.constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
FALLBACK_SMART_TRANSACTIONS_DEADLINE,
FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER,
FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME,
} from '../../../../shared/constants/smartTransactions';
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/controllers/swaps/swaps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ describe('SwapsController', function () {
oldState.swapsState.swapsStxGetTransactionsRefreshTime,
swapsStxBatchStatusRefreshTime:
oldState.swapsState.swapsStxBatchStatusRefreshTime,
swapsStxStatusDeadline: oldState.swapsState.swapsStxStatusDeadline,
});
});

Expand Down Expand Up @@ -1171,6 +1172,7 @@ describe('SwapsController', function () {
const swapsQuotePrefetchingRefreshTime = 0;
const swapsStxBatchStatusRefreshTime = 0;
const swapsStxGetTransactionsRefreshTime = 0;
const swapsStxStatusDeadline = 0;
swapsController.__test__updateState({
swapsState: {
...swapsController.state.swapsState,
Expand All @@ -1182,6 +1184,7 @@ describe('SwapsController', function () {
swapsQuotePrefetchingRefreshTime,
swapsStxBatchStatusRefreshTime,
swapsStxGetTransactionsRefreshTime,
swapsStxStatusDeadline,
},
});

Expand Down
1 change: 1 addition & 0 deletions app/scripts/lib/setupSentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export const SENTRY_BACKGROUND_STATE = {
swapsQuotePrefetchingRefreshTime: true,
swapsQuoteRefreshTime: true,
swapsStxBatchStatusRefreshTime: true,
swapsStxStatusDeadline: true,
swapsStxGetTransactionsRefreshTime: true,
swapsStxMaxFeeMultiplier: true,
swapsUserFeeLevel: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@
"swapsQuoteRefreshTime": 60000,
"swapsQuotePrefetchingRefreshTime": 60000,
"swapsStxBatchStatusRefreshTime": 10000,
"swapsStxStatusDeadline": 180,
"swapsStxGetTransactionsRefreshTime": 10000,
"swapsStxMaxFeeMultiplier": 2,
"swapsFeatureFlags": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
"swapsQuoteRefreshTime": 60000,
"swapsQuotePrefetchingRefreshTime": 60000,
"swapsStxBatchStatusRefreshTime": 10000,
"swapsStxStatusDeadline": 180,
"swapsStxGetTransactionsRefreshTime": 10000,
"swapsStxMaxFeeMultiplier": 2,
"swapsFeatureFlags": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export default function SmartTransactionStatusPage() {
cancellationFeeWei =
latestSmartTransaction?.statusMetadata?.cancellationFeeWei;
}

const [timeLeftForPendingStxInSec, setTimeLeftForPendingStxInSec] = useState(
swapsNetworkConfig.stxStatusDeadline,
);
Expand Down