From 7d24bac0a044266ca7a0f08933a77b0fb7602da5 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 7 Jan 2025 17:33:55 +1000 Subject: [PATCH] fix: Fix solana token check issue --- .../src/debridge/index.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/canonical-bridge-sdk/src/debridge/index.ts b/packages/canonical-bridge-sdk/src/debridge/index.ts index 6791a2be..3ba9e9b9 100644 --- a/packages/canonical-bridge-sdk/src/debridge/index.ts +++ b/packages/canonical-bridge-sdk/src/debridge/index.ts @@ -290,10 +290,23 @@ export class DeBridge { fromTokenList.status === 'fulfilled' && toTokenList.status === 'fulfilled' ) { - const fromToken = - fromTokenList?.value?.data.tokens[fromTokenAddress.toLowerCase()]; - const toToken = - toTokenList?.value?.data.tokens[toTokenAddress.toLowerCase()]; + const fromTokenAddr = + fromChainType === 'solana' + ? fromTokenAddress + : fromTokenAddress.toLowerCase(); + const toTokenAddr = + toChainType === 'solana' + ? toTokenAddress + : toTokenAddress.toLowerCase(); + const fromToken = fromTokenList?.value?.data.tokens[fromTokenAddr]; + const toToken = toTokenList?.value?.data.tokens[toTokenAddr]; + + if (!toToken) { + console.log('Can not find toToken info'); + } + if (!fromToken) { + console.log('Can not find fromToken info'); + } if ( !!fromToken && fromToken?.address.toLowerCase() === fromTokenAddress.toLowerCase() &&