Skip to content

Commit cff7ce2

Browse files
authored
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
1 parent 0c57292 commit cff7ce2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

connect/src/routes/resolver.ts

+10
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ export class RouteResolver<N extends Network> {
4444
const [, inputTokenId] = resolveWrappedToken(fromChain.network, fromChain.chain, inputToken);
4545
const tokens = await Promise.all(
4646
this.routeConstructors.map(async (rc) => {
47+
const supportedNetworks = rc.supportedNetworks();
48+
if (!supportedNetworks.includes(fromChain.network)) {
49+
return [];
50+
}
51+
52+
const supportedChains = rc.supportedChains(fromChain.network);
53+
if (!supportedChains.includes(fromChain.chain) || !supportedChains.includes(toChain.chain)) {
54+
return [];
55+
}
56+
4757
try {
4858
return await rc.supportedDestinationTokens(inputTokenId, fromChain, toChain);
4959
} catch (e) {

0 commit comments

Comments
 (0)