-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/paymaster-row
- Loading branch information
Showing
93 changed files
with
2,783 additions
and
1,065 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { | ||
FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER, | ||
FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME, | ||
} from '../../../shared/constants/smartTransactions'; | ||
import { MINUTE } from '../../../shared/constants/time'; | ||
|
||
import type { SwapsControllerState } from './swaps.types'; | ||
|
||
// The MAX_GAS_LIMIT is a number that is higher than the maximum gas costs we have observed on any aggregator | ||
export const MAX_GAS_LIMIT = 2500000; | ||
|
||
// To ensure that our serves are not spammed if MetaMask is left idle, we limit the number of fetches for quotes that are made on timed intervals. | ||
// 3 seems to be an appropriate balance of giving users the time they need when MetaMask is not left idle, and turning polling off when it is. | ||
export const POLL_COUNT_LIMIT = 3; | ||
|
||
// If for any reason the MetaSwap API fails to provide a refresh time, | ||
// provide a reasonable fallback to avoid further errors | ||
export const FALLBACK_QUOTE_REFRESH_TIME = MINUTE; | ||
|
||
export const swapsControllerInitialState: { swapsState: SwapsControllerState } = | ||
{ | ||
swapsState: { | ||
quotes: {}, | ||
quotesPollingLimitEnabled: false, | ||
fetchParams: null, | ||
tokens: null, | ||
tradeTxId: null, | ||
approveTxId: null, | ||
quotesLastFetched: null, | ||
customMaxGas: '', | ||
customGasPrice: null, | ||
customMaxFeePerGas: null, | ||
customMaxPriorityFeePerGas: null, | ||
swapsUserFeeLevel: '', | ||
selectedAggId: null, | ||
customApproveTxData: '', | ||
errorKey: '', | ||
topAggId: null, | ||
routeState: '', | ||
swapsFeatureIsLive: true, | ||
saveFetchedQuotes: false, | ||
swapsQuoteRefreshTime: FALLBACK_QUOTE_REFRESH_TIME, | ||
swapsQuotePrefetchingRefreshTime: FALLBACK_QUOTE_REFRESH_TIME, | ||
swapsStxBatchStatusRefreshTime: FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME, | ||
swapsStxGetTransactionsRefreshTime: | ||
FALLBACK_SMART_TRANSACTIONS_REFRESH_TIME, | ||
swapsStxMaxFeeMultiplier: FALLBACK_SMART_TRANSACTIONS_MAX_FEE_MULTIPLIER, | ||
swapsFeatureFlags: {}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.