Skip to content

Commit 30b3787

Browse files
authored
don't throw in token bridge lookup (#566)
1 parent 2537e8f commit 30b3787

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

connect/src/routes/tokenBridge/automatic.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ export class AutomaticTokenBridgeRoute<N extends Network>
8989
fromChain: ChainContext<N>,
9090
toChain: ChainContext<N>,
9191
): Promise<TokenId[]> {
92-
return [await TokenTransfer.lookupDestinationToken(fromChain, toChain, sourceToken)];
92+
try {
93+
return [await TokenTransfer.lookupDestinationToken(fromChain, toChain, sourceToken)];
94+
} catch (e) {
95+
console.error(`Failed to get destination token: ${e}`);
96+
return [];
97+
}
9398
}
9499

95100
static isProtocolSupported<N extends Network>(chain: ChainContext<N>): boolean {

connect/src/routes/tokenBridge/manual.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ export class TokenBridgeRoute<N extends Network>
7979
fromChain: ChainContext<N>,
8080
toChain: ChainContext<N>,
8181
): Promise<TokenId[]> {
82-
return [await TokenTransfer.lookupDestinationToken(fromChain, toChain, sourceToken)];
82+
try {
83+
return [await TokenTransfer.lookupDestinationToken(fromChain, toChain, sourceToken)];
84+
} catch (e) {
85+
console.error(`Failed to get destination token: ${e}`);
86+
return [];
87+
}
8388
}
8489

8590
static isProtocolSupported<N extends Network>(chain: ChainContext<N>): boolean {

0 commit comments

Comments
 (0)