File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed
wormhole-connect/src/routes Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import { formatGasFee, isIlliquidDestToken } from 'routes/utils';
22
22
import { toDecimals } from 'utils/balance' ;
23
23
import { NO_INPUT } from 'utils/style' ;
24
24
import { hexlify } from 'ethers/lib/utils.js' ;
25
+ import { isTBTCToken } from 'routes/tbtc/utils' ;
25
26
26
27
export abstract class BaseRoute extends RouteAbstract {
27
28
async isSupportedSourceToken (
@@ -41,6 +42,9 @@ export abstract class BaseRoute extends RouteAbstract {
41
42
if ( ! token . tokenId && token . nativeChain !== chainName ) {
42
43
return false ;
43
44
}
45
+ if ( isTBTCToken ( token ) && token . nativeChain !== chainName ) {
46
+ return false ;
47
+ }
44
48
return true ;
45
49
}
46
50
@@ -53,6 +57,7 @@ export abstract class BaseRoute extends RouteAbstract {
53
57
if ( ! token ) return false ;
54
58
if ( ! token . tokenId ) return false ;
55
59
if ( destChain && isIlliquidDestToken ( token , destChain ) ) return false ;
60
+ if ( isTBTCToken ( token ) ) return false ;
56
61
if ( sourceToken ) {
57
62
const wrapped = getWrappedToken ( sourceToken ) ;
58
63
return wrapped . key === token . key ;
Original file line number Diff line number Diff line change @@ -60,11 +60,8 @@ export class TBTCRoute extends BaseRoute {
60
60
if ( ! sourceChain ) return false ;
61
61
if ( ! token || token . symbol !== TBTC_TOKEN_SYMBOL ) return false ;
62
62
if ( destToken && destToken . symbol !== TBTC_TOKEN_SYMBOL ) return false ;
63
- if (
64
- isTBTCCanonicalChain ( sourceChain ) &&
65
- token . nativeChain === wh . toChainName ( sourceChain )
66
- ) {
67
- return true ;
63
+ if ( isTBTCCanonicalChain ( sourceChain ) ) {
64
+ return token . nativeChain === wh . toChainName ( sourceChain ) ;
68
65
}
69
66
return wh . toChainId ( token . nativeChain ) === CHAIN_ID_ETH ;
70
67
}
@@ -78,11 +75,8 @@ export class TBTCRoute extends BaseRoute {
78
75
if ( ! destChain ) return false ;
79
76
if ( ! token || token . symbol !== TBTC_TOKEN_SYMBOL ) return false ;
80
77
if ( sourceToken && sourceToken . symbol !== TBTC_TOKEN_SYMBOL ) return false ;
81
- if (
82
- isTBTCCanonicalChain ( destChain ) &&
83
- token . nativeChain === wh . toChainName ( destChain )
84
- ) {
85
- return true ;
78
+ if ( isTBTCCanonicalChain ( destChain ) ) {
79
+ return token . nativeChain === wh . toChainName ( destChain ) ;
86
80
}
87
81
return wh . toChainId ( token . nativeChain ) === CHAIN_ID_ETH ;
88
82
}
Original file line number Diff line number Diff line change 1
1
import { ChainId , ChainName } from '@wormhole-foundation/wormhole-connect-sdk' ;
2
+ import { TokenConfig } from 'config/types' ;
2
3
import { wh } from 'utils/sdk' ;
3
4
4
5
export const isTBTCCanonicalChain = ( chain : ChainId | ChainName ) : boolean =>
5
6
! ! wh . getContracts ( chain ) ?. tbtcGateway ;
7
+
8
+ export const isTBTCToken = ( token : TokenConfig ) : boolean =>
9
+ token . symbol === 'tBTC' ;
You can’t perform that action at this time.
0 commit comments