Skip to content

Add validation for the fee property from the /trades API response#10836

Merged
danjm merged 1 commit intoMetaMask:developfrom
dan437:trades-fee-validation
Apr 7, 2021
Merged

Add validation for the fee property from the /trades API response#10836
danjm merged 1 commit intoMetaMask:developfrom
dan437:trades-fee-validation

Conversation

@dan437
Copy link
Copy Markdown
Contributor

@dan437 dan437 commented Apr 6, 2021

Fixes: #9681

Explanation

Now we are validating that the fee property from the /trades API response is the number type. If the API would return a different type, we would show an error page with: "No quotes available".

Manual testing steps

  • Click on the Swap button inside the MetaMask extension
  • Choose Swap from and Swap to tokens
  • Click on Review Swap, at which time the /trades API is called and response validation happens

Screenshots

Swap page:
image

fee validation passed and a user can see the Swap Review page:
image

fee property in the /trades API response:
image

"No quotes available" page would be displayed if the type validation fails (e.g. when we would expect an object instead of number):
image

All unit are tests green:
image

@dan437 dan437 requested a review from a team as a code owner April 6, 2021 23:00
@dan437 dan437 requested a review from ryanml April 6, 2021 23:00
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2021

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.

@dan437
Copy link
Copy Markdown
Contributor Author

dan437 commented Apr 6, 2021

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown
Contributor

@danjm danjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@danjm danjm merged commit 135f0bb into MetaMask:develop Apr 7, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 2021
@dan437 dan437 deleted the trades-fee-validation branch July 24, 2023 11:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add fee property to validation of swaps /trades response

2 participants