Closed abtestingalpha closed 1 month ago
The changes in this pull request enhance the swap route functionality within an Express application by introducing a new validation step for token swaps. A new function, validSwap
, is added to validate the compatibility of token swaps based on the provided parameters. Additionally, the test suite for the swap route is updated to include tests for the newly introduced validation logic and the handling of the ETH
token. The output of the tokenAddressToToken
function is also modified to include a swappable
property, providing more detailed token information.
File Path | Change Summary |
---|---|
packages/rest-api/src/routes/swapRoute.ts |
Added import for validSwap . Included validation check using validSwap in the GET request handler. |
packages/rest-api/src/tests/swapRoute.test.ts |
Added ETH to bridgeable tokens imports. Introduced new test case for invalid token swap combinations. |
packages/rest-api/src/utils/tokenAddressToToken.ts |
Updated tokenAddressToToken to include swappable property in the returned object. |
packages/rest-api/src/validations/validSwap.ts |
Introduced validSwap function to validate token swaps based on chain , fromToken , and toToken . |
swapTxInfoController
to streamline token address handling, which is relevant to the validation logic introduced in the main PR for the swap route.validateRouteExists
function enhances the validation process for routes, which aligns with the new validation step added in the main PR for the swap route.bridgeable.ts
file, including token address modifications, are relevant as they pertain to the validation of token parameters in the main PR.size/m
π° In the land of swaps, where tokens play,
A new check was added to brighten the day.
WithvalidSwap
in hand, the routes now gleam,
Ensuring each trade is more than a dream.
So hop along, friends, letβs celebrate right,
For swaps are now safer, and futures are bright! π
Latest commit: |
a674a21
|
Status: | β Deploy successful! |
Preview URL: | https://1232df0c.sanguine-fe.pages.dev |
Branch Preview URL: | https://rest-api-valid-swap-path.sanguine-fe.pages.dev |
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 90.43902%. Comparing base (
4b49879
) to head (a674a21
). Report is 8 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Description When a user requests an invalid swap through the api, the response is a 500 instead of a 400 with error message. This adds a validation to the
swapRoute
to check tha the from and to token are swappable.Summary by CodeRabbit
New Features
Bug Fixes
Improvements