From 40ea2de16415e5e5fe340f9a7472680fd4e5ffaa Mon Sep 17 00:00:00 2001 From: elmar Date: Tue, 19 Mar 2024 10:03:02 +0200 Subject: [PATCH] Fixed get decimals for Hydra DX (#218) --- .changeset/brown-dancers-walk.md | 5 +++++ packages/sdk/src/polkadot/PolkadotService.ts | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/brown-dancers-walk.md diff --git a/.changeset/brown-dancers-walk.md b/.changeset/brown-dancers-walk.md new file mode 100644 index 00000000..62e99713 --- /dev/null +++ b/.changeset/brown-dancers-walk.md @@ -0,0 +1,5 @@ +--- +'@moonbeam-network/xcm-sdk': patch +--- + +Fixed get decimals for HydraDX diff --git a/packages/sdk/src/polkadot/PolkadotService.ts b/packages/sdk/src/polkadot/PolkadotService.ts index f45c1420..837f5846 100644 --- a/packages/sdk/src/polkadot/PolkadotService.ts +++ b/packages/sdk/src/polkadot/PolkadotService.ts @@ -113,6 +113,7 @@ export class PolkadotService { ): Promise<{ symbol: string; decimals: number } | undefined> { const fn = this.api.query.assets?.metadata || + this.api.query.assetRegistry?.assets || this.api.query.assetRegistry?.metadata || this.api.query.assetRegistry?.currencyMetadatas || this.api.query.assetRegistry?.assetMetadatas || @@ -147,6 +148,7 @@ export class PolkadotService { async getAssetDecimals(asset: Asset): Promise { const metaId = this.chain.getMetadataAssetId(asset); + return ( this.chain.getAssetDecimals(asset) || (await this.getAssetDecimalsFromQuery(metaId)) ||