From aaee8c124b5e25d5ab077fa3eb71ff3e9e3bd87e Mon Sep 17 00:00:00 2001 From: Pavol Noha Date: Wed, 11 Dec 2024 16:35:21 -0500 Subject: [PATCH] remove pallet instannce from Parachain api --- integration-tests/xcm-test/src/e2e.spec.ts | 2 +- packages/xcm-core/src/chain/Chain.ts | 8 ++++---- packages/xcm-core/src/chain/Parachain.ts | 19 +++++++------------ 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/integration-tests/xcm-test/src/e2e.spec.ts b/integration-tests/xcm-test/src/e2e.spec.ts index 79832440..c606abbb 100644 --- a/integration-tests/xcm-test/src/e2e.spec.ts +++ b/integration-tests/xcm-test/src/e2e.spec.ts @@ -32,7 +32,7 @@ const { runXcm } = xcm; */ const getPolkadotChains = () => { const bridge: string[] = ['ethereum']; - const skipFor: string[] = bridge.concat(['acala-evm', 'nodle', 'phala']); + const skipFor: string[] = bridge.concat(['acala-evm', 'nodle']); const chains: Parachain[] = Array.from(configService.chains.values()) .filter((c) => c instanceof Parachain) .filter((c) => c.ecosystem === ChainEcosystem.Polkadot) diff --git a/packages/xcm-core/src/chain/Chain.ts b/packages/xcm-core/src/chain/Chain.ts index b4a53db3..61bfc5a9 100644 --- a/packages/xcm-core/src/chain/Chain.ts +++ b/packages/xcm-core/src/chain/Chain.ts @@ -24,11 +24,11 @@ export type ChainAssetId = * Chain Asset Data * * @interface ChainAssetData - * @member {Asset} asset Chain asset - * @member {ChainAssetId} balanceId asset id to fetch the balance + * @member {Asset} asset asset key & symbol * @member {number} decimals asset decimals - * @member {ChainAssetId} id asset "transfer" id - * @member {AssetAmount} min asset minimum (existentional deposit) + * @member {ChainAssetId} id asset internal id + * @member {ChainAssetId} balanceId asset id to query balance (if other than internal) + * @member {AssetAmount} min asset minimal deposit */ export interface ChainAssetData { asset: Asset; diff --git a/packages/xcm-core/src/chain/Parachain.ts b/packages/xcm-core/src/chain/Parachain.ts index 50cfe536..006a322f 100644 --- a/packages/xcm-core/src/chain/Parachain.ts +++ b/packages/xcm-core/src/chain/Parachain.ts @@ -15,14 +15,13 @@ import { * Parachain Asset Data * * @interface ParachainAssetsData - * @member {ChainAssetId} metadataId asset "on chain" id - * @member {AssetAmount} minId asset "on chain" id to fetch minimal deposit - * @member {AssetAmount} palletInstance asset pallet instance (if any) + * @member {ChainAssetId} metadataId asset id to query metadata (if other than internal) + * @member {ChainAssetId} minId asset id to query minimal deposit (if other than internal) + * @member {Record} xcmLocation asset xcm location */ export interface ParachainAssetData extends ChainAssetData { metadataId?: ChainAssetId; minId?: ChainAssetId; - palletInstance?: number; xcmLocation?: Record; } @@ -80,22 +79,18 @@ export class Parachain extends Chain { return ChainType.Parachain; } - getAssetPalletInstance(asset: Asset): number | undefined { - return this.assetsData.get(asset.key)?.palletInstance; - } - getAssetXcmLocation(asset: Asset): Record | undefined { return this.assetsData.get(asset.key)?.xcmLocation; } - getMinAssetId(asset: Asset): ChainAssetId { - return this.assetsData.get(asset.key)?.minId ?? this.getAssetId(asset); - } - getMetadataAssetId(asset: Asset): ChainAssetId { return this.assetsData.get(asset.key)?.metadataId ?? this.getAssetId(asset); } + getMinAssetId(asset: Asset): ChainAssetId { + return this.assetsData.get(asset.key)?.minId ?? this.getAssetId(asset); + } + findAssetById(id: string) { return Array.from(this.assetsData.values()).find((a) => { return Object.hasOwn(a, 'metadataId')