Skip to content

Commit

Permalink
Fixed get decimals for Hydra DX (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekenigs authored Mar 19, 2024
1 parent 486c8c2 commit 40ea2de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-dancers-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@moonbeam-network/xcm-sdk': patch
---

Fixed get decimals for HydraDX
2 changes: 2 additions & 0 deletions packages/sdk/src/polkadot/PolkadotService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -147,6 +148,7 @@ export class PolkadotService {

async getAssetDecimals(asset: Asset): Promise<number> {
const metaId = this.chain.getMetadataAssetId(asset);

return (
this.chain.getAssetDecimals(asset) ||
(await this.getAssetDecimalsFromQuery(metaId)) ||
Expand Down

0 comments on commit 40ea2de

Please sign in to comment.