From f03aa32e243051e9caf3474884863e737bc7030e Mon Sep 17 00:00:00 2001 From: Michael Absolon Date: Sat, 14 Dec 2024 02:04:31 +0100 Subject: [PATCH] =?UTF-8?q?fix(sdk):=20Fix=20incomplete=20Assethub=20asset?= =?UTF-8?q?=20symbols=20=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/sdk/src/pallets/assets/assets.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/sdk/src/pallets/assets/assets.ts b/packages/sdk/src/pallets/assets/assets.ts index b621ed52..2d5cd256 100644 --- a/packages/sdk/src/pallets/assets/assets.ts +++ b/packages/sdk/src/pallets/assets/assets.ts @@ -68,7 +68,12 @@ export const getNativeAssets = (node: TNode): TNativeAsset[] => getAssetsObject( * @param node - The node for which to get other assets. * @returns An array of other asset details. */ -export const getOtherAssets = (node: TNode): TForeignAsset[] => getAssetsObject(node).otherAssets +export const getOtherAssets = (node: TNode): TForeignAsset[] => { + const otherAssets = getAssetsObject(node).otherAssets + return node === 'AssetHubPolkadot' + ? [...otherAssets, ...getAssetsObject('Ethereum').otherAssets] + : otherAssets +} /** * Retrieves the complete list of assets for a specified node, including relay chain asset, native, and other assets. @@ -90,10 +95,14 @@ export const getAssets = (node: TNodeWithRelayChains): TAsset[] => { export const getAllAssetsSymbols = (node: TNodeWithRelayChains): string[] => { const { nativeAssets, otherAssets } = getAssetsObject(node) const nativeAssetsSymbols = nativeAssets.map(({ symbol }) => symbol) - const otherAssetsSymbols = otherAssets - .filter(asset => asset.symbol !== undefined) - .map(({ symbol }) => symbol) - return [...nativeAssetsSymbols, ...otherAssetsSymbols] + const otherAssetsSymbols = otherAssets.map(({ symbol }) => symbol) + + const ethAssetsSymbols = + node === 'AssetHubPolkadot' + ? getAssetsObject('Ethereum').otherAssets.map(({ symbol }) => symbol) + : [] + + return [...nativeAssetsSymbols, ...otherAssetsSymbols, ...ethAssetsSymbols] } /**