From cff7ce237f5185bb7b0fb6da45f9417473019751 Mon Sep 17 00:00:00 2001 From: Artur Sapek Date: Mon, 25 Nov 2024 14:13:05 -0500 Subject: [PATCH] Make sure both chains are supported (#744) * make sure both chains are supported (this is useful in case supportedDestinationTokens doesn't verify this) * verify network too --- connect/src/routes/resolver.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/connect/src/routes/resolver.ts b/connect/src/routes/resolver.ts index a128ed3da..21765da6e 100644 --- a/connect/src/routes/resolver.ts +++ b/connect/src/routes/resolver.ts @@ -44,6 +44,16 @@ export class RouteResolver { const [, inputTokenId] = resolveWrappedToken(fromChain.network, fromChain.chain, inputToken); const tokens = await Promise.all( this.routeConstructors.map(async (rc) => { + const supportedNetworks = rc.supportedNetworks(); + if (!supportedNetworks.includes(fromChain.network)) { + return []; + } + + const supportedChains = rc.supportedChains(fromChain.network); + if (!supportedChains.includes(fromChain.chain) || !supportedChains.includes(toChain.chain)) { + return []; + } + try { return await rc.supportedDestinationTokens(inputTokenId, fromChain, toChain); } catch (e) {