Skip to content

Commit

Permalink
fix(sdk): Fix incomplete Assethub asset symbols 🔧
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldev5 authored and dudo50 committed Dec 14, 2024
1 parent a0ac608 commit f03aa32
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions packages/sdk/src/pallets/assets/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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]
}

/**
Expand Down

0 comments on commit f03aa32

Please sign in to comment.