-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rest-api): Adds validateRouteExists validation [SLT-260] (#3180)
* Adds validateRouteExists validation * Remove timeouts for 400s
- Loading branch information
1 parent
6ec996d
commit ceff8bc
Showing
9 changed files
with
113 additions
and
40 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { tokenAddressToToken } from '../utils/tokenAddressToToken' | ||
import { BRIDGE_ROUTE_MAPPING_SYMBOLS } from '../utils/bridgeRouteMapping' | ||
|
||
export const validateRouteExists = (fromChain, fromToken, toChain, toToken) => { | ||
const fromTokenInfo = tokenAddressToToken(fromChain.toString(), fromToken) | ||
const toTokenInfo = tokenAddressToToken(toChain.toString(), toToken) | ||
|
||
if (!fromTokenInfo || !toTokenInfo) { | ||
return false | ||
} | ||
|
||
const key = `${fromTokenInfo.symbol}-${fromChain}` | ||
const routes = BRIDGE_ROUTE_MAPPING_SYMBOLS[key] | ||
|
||
if (!routes) { | ||
return false | ||
} | ||
|
||
return routes.includes(`${toTokenInfo.symbol}-${toChain}`) | ||
} |
This file was deleted.
Oops, something went wrong.