console.error('Request for swaps quote refresh time failed: ',e)
}
const{swapsState}=this.store.getState()
this.store.updateState({
swapsState:{...swapsState,swapsQuoteRefreshTime},
})
}
// Once quotes are fetched, we poll for new ones to keep the quotes up to date. Market and aggregator contract conditions can change fast enough
// that quotes will no longer be available after 1 or 2 minutes. When fetchAndSetQuotes is first called it, receives fetch that parameters are stored in
// state. These stored parameters are used on subsequent calls made during polling.
// Note: we stop polling after 3 requests, until new quotes are explicitly asked for. The logic that enforces that maximum is in the body of fetchAndSetQuotes
pollForNewQuotes(){
const{
swapsState:{swapsQuoteRefreshTime},
}=this.store.getState()
this.pollingTimeout=setTimeout(()=>{
const{swapsState}=this.store.getState()
this.fetchAndSetQuotes(
@ -113,7 +142,7 @@ export default class SwapsController {
@ -128,7 +157,6 @@ export default class SwapsController {
if(!fetchParams){
returnnull
}
// Every time we get a new request that is not from the polling, we reset the poll count so we can poll for up to three more sets of quotes with these new params.
if(!isPolledRequest){
this.pollCount=0
@ -144,7 +172,10 @@ export default class SwapsController {