-
Notifications
You must be signed in to change notification settings - Fork 5k
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 #10010 - Fetch swap quote refresh time from API #10069
Fix #10010 - Fetch swap quote refresh time from API #10069
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
e5f2393
to
9595c93
Compare
}, | ||
} | ||
|
||
const sandbox = sinon.createSandbox() | ||
const fetchTradesInfoStub = sandbox.stub() | ||
const fetchSwapsFeatureLivenessStub = sandbox.stub() | ||
const fetchSwapsQuoteRefreshTimeStub = sandbox.stub() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this stub isn't being reset correctly between tests, but we can solve that separately in a later PR. Might as well fix all of these stubs at once, since they all follow the same pattern.
03eefe3
to
911f580
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
911f580
to
24dd8fe
Compare
Supercedes: #10017
Fixes: #10010
The MetaSwap team has implemented a new endpoint which tells us how often quotes should refresh. We were hardcoding 60 seconds as the refresh value, but moving that value to the MetaSwap API would prevent the MetaMask team from needing to create and deploy a new release in each browser to adjust that value.
As to why I've gone this route to accomplish this functionality, I like this strategy because we aren't pinging MetaSwap until we absolutely need to (i.e. when we're fetching quotes to display). We also benefit from fetchWithCache caching that value, so that we aren't pinging MetaSwap each time. @cloudonshore had mentioned this value wouldn't often change, so a fetch with cache only when we need that value should make us performant.