From 6a2a9ced0e73ca76b3719ed042a404133e6f927b Mon Sep 17 00:00:00 2001 From: snoopy1412 Date: Mon, 18 Nov 2024 20:37:30 +0800 Subject: [PATCH] fix(xcm-chain-registry): ensure supportedNativeToken is defined before assignment --- src/utils/xcm-chain-registry.ts | 35 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/utils/xcm-chain-registry.ts b/src/utils/xcm-chain-registry.ts index edb8e0f..463ee78 100644 --- a/src/utils/xcm-chain-registry.ts +++ b/src/utils/xcm-chain-registry.ts @@ -269,24 +269,25 @@ export const getTokenList = ({ asset.symbol.toLowerCase() === fromChain.nativeToken.symbol.toLowerCase() ); - - supportedNativeToken = { - ...supportedNativeToken, - symbol: supportedNativeToken?.symbol || '', - decimals: supportedNativeToken?.decimals || 0, - paraID: Number(fromChain.id), - nativeChainID: fromChain.name.toLowerCase().replace(/\s/g, '-'), - reserveType: 'local' as ReserveType, - asset: 'Native' as AssetType, - xcmV1MultiLocation: JSON.stringify({ - v1: { - parents: 1, - interior: { - x1: { parachain: fromChain.id } + if (supportedNativeToken) { + supportedNativeToken = { + ...supportedNativeToken, + symbol: supportedNativeToken?.symbol || '', + decimals: supportedNativeToken?.decimals || 0, + paraID: Number(fromChain.id), + nativeChainID: fromChain.name.toLowerCase().replace(/\s/g, '-'), + reserveType: 'local' as ReserveType, + asset: 'Native' as AssetType, + xcmV1MultiLocation: JSON.stringify({ + v1: { + parents: 1, + interior: { + x1: { parachain: fromChain.id } + } } - } - }) - }; + }) + }; + } const otherAssets = fromChain.xcAssetsData