From b39418097d535893b9a5231eb92598ce521cc0d0 Mon Sep 17 00:00:00 2001 From: Dong-Ha Kim Date: Tue, 10 Sep 2024 20:33:41 +0700 Subject: [PATCH] feat(api): add spoke pool addresses to available-routes --- api/available-routes.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api/available-routes.ts b/api/available-routes.ts index 471a558cc..78936306f 100644 --- a/api/available-routes.ts +++ b/api/available-routes.ts @@ -9,6 +9,7 @@ import { handleErrorCondition, DISABLED_CHAINS_FOR_AVAILABLE_ROUTES, DISABLED_TOKENS_FOR_AVAILABLE_ROUTES, + getSpokePoolAddress, } from "./_utils"; import { TypedVercelRequest } from "./_types"; @@ -49,6 +50,7 @@ const handler = async ( destinationToken: string; fromTokenSymbol: string; toTokenSymbol: string; + isNative: boolean; }) => ![route.originChainId, route.destinationChainId].some((chainId) => DISABLED_CHAINS_FOR_AVAILABLE_ROUTES.includes(String(chainId)) @@ -72,6 +74,9 @@ const handler = async ( fromTokenSymbol: route.fromTokenSymbol, toTokenSymbol: route.toTokenSymbol, destinationToken: route.toTokenAddress, + isNative: route.isNative, + originSpokePool: getSpokePoolAddress(route.fromChain), + destinationSpokePool: getSpokePoolAddress(route.toChain), }) ).map((route) => ({ originChainId: route.originChainId, @@ -80,6 +85,9 @@ const handler = async ( destinationToken: route.destinationToken, originTokenSymbol: route.fromTokenSymbol, destinationTokenSymbol: route.toTokenSymbol, + isNative: route.isNative, + originSpokePool: route.originSpokePool, + destinationSpokePool: route.destinationSpokePool, })); // Two different explanations for how `stale-while-revalidate` works: