@@ -20,22 +20,6 @@ export class RouteResolver<N extends Network> {
20
20
this . routeConstructors = routeConstructors ;
21
21
}
22
22
23
- async supportedSourceTokens ( chain : ChainContext < N > ) : Promise < TokenId [ ] > {
24
- if ( this . inputTokenList ) return this . inputTokenList ;
25
- const itl = await Promise . all (
26
- this . routeConstructors . map ( async ( rc ) => {
27
- try {
28
- return await rc . supportedSourceTokens ( chain ) ;
29
- } catch ( e ) {
30
- console . error ( `Failed to get supported source tokens for ${ rc . meta . name } : ` , e ) ;
31
- return [ ] ;
32
- }
33
- } ) ,
34
- ) ;
35
- this . inputTokenList = uniqueTokens ( itl . flat ( ) ) ;
36
- return this . inputTokenList ! ;
37
- }
38
-
39
23
async supportedDestinationTokens (
40
24
inputToken : TokenId ,
41
25
fromChain : ChainContext < N > ,
@@ -50,7 +34,10 @@ export class RouteResolver<N extends Network> {
50
34
}
51
35
52
36
const supportedChains = rc . supportedChains ( fromChain . network ) ;
53
- if ( ! supportedChains . includes ( fromChain . chain ) || ! supportedChains . includes ( toChain . chain ) ) {
37
+ if (
38
+ ! supportedChains . includes ( fromChain . chain ) ||
39
+ ! supportedChains . includes ( toChain . chain )
40
+ ) {
54
41
return [ ] ;
55
42
}
56
43
@@ -72,16 +59,7 @@ export class RouteResolver<N extends Network> {
72
59
const protocolSupported =
73
60
rc . supportedNetworks ( ) . includes ( this . wh . network ) &&
74
61
rc . supportedChains ( this . wh . network ) . includes ( request . toChain . chain ) &&
75
- rc . supportedChains ( this . wh . network ) . includes ( request . fromChain . chain )
76
-
77
- const sourceTokenAddress = canonicalAddress (
78
- isNative ( request . source . id . address ) ? request . source . wrapped ! : request . source . id ,
79
- ) ;
80
-
81
- const sourceTokenSupported =
82
- ( await rc . supportedSourceTokens ( request . fromChain ) ) . filter ( ( tokenId : TokenId ) => {
83
- return canonicalAddress ( tokenId ) === sourceTokenAddress ;
84
- } ) . length > 0 ;
62
+ rc . supportedChains ( this . wh . network ) . includes ( request . fromChain . chain ) ;
85
63
86
64
const dstTokenAddress = canonicalAddress (
87
65
isNative ( request . destination . id . address )
@@ -99,7 +77,7 @@ export class RouteResolver<N extends Network> {
99
77
return canonicalAddress ( tokenId ) === dstTokenAddress ;
100
78
} ) . length > 0 ;
101
79
102
- return protocolSupported && sourceTokenSupported && destinationTokenSupported ;
80
+ return protocolSupported && destinationTokenSupported ;
103
81
} catch ( e ) {
104
82
return false ;
105
83
}
0 commit comments