diff --git a/packages/sdk/src/api/Router.ts b/packages/sdk/src/api/Router.ts index bf8d2a95..4ae6820e 100644 --- a/packages/sdk/src/api/Router.ts +++ b/packages/sdk/src/api/Router.ts @@ -97,6 +97,7 @@ export class Router { decimals: t.decimals, icon: t.icon, type: t.type, + isSufficient: t.isSufficient, existentialDeposit: t.existentialDeposit, origin: t.origin, meta: t.meta, diff --git a/packages/sdk/src/client/AssetClient.ts b/packages/sdk/src/client/AssetClient.ts index c5439cab..95a570f5 100644 --- a/packages/sdk/src/client/AssetClient.ts +++ b/packages/sdk/src/client/AssetClient.ts @@ -125,11 +125,12 @@ export class AssetClient extends PolkadotApiClient { decimals: this.chainDecimals, icon: this.chainToken, type: 'Token', + isSufficient: true, existentialDeposit: defaultAssetEd.toString(), } as Asset; } - const { name, assetType, existentialDeposit } = details; + const { name, assetType, isSufficient, existentialDeposit } = details; const { symbol, decimals } = metadata.get(tokenKey) ?? {}; return { @@ -139,6 +140,7 @@ export class AssetClient extends PolkadotApiClient { decimals: decimals, icon: symbol, type: assetType.toHuman(), + isSufficient: isSufficient ? isSufficient.toHuman() : true, origin: this.parseLocation('parachain', location), existentialDeposit: existentialDeposit.toString(), } as Asset; @@ -151,7 +153,7 @@ export class AssetClient extends PolkadotApiClient { bond: ITuple<[u32, u64]> ): Asset { const [underlyingAsset, maturity] = bond; - const { assetType, existentialDeposit } = details; + const { assetType, isSufficient, existentialDeposit } = details; const { symbol, decimals } = this.getToken( underlyingAsset.toString(), details, @@ -169,6 +171,7 @@ export class AssetClient extends PolkadotApiClient { decimals: decimals, icon: symbol, type: assetType.toString(), + isSufficient: isSufficient.toHuman(), existentialDeposit: existentialDeposit.toString(), } as Asset; } @@ -180,7 +183,8 @@ export class AssetClient extends PolkadotApiClient { share: PalletStableswapPoolInfo ): Asset { const { assets } = share; - const { name, symbol, assetType, existentialDeposit } = details; + const { name, symbol, assetType, isSufficient, existentialDeposit } = + details; const poolTokens = assets.map((asset) => asset.toString()); const poolEntries = poolTokens.map((token: string) => { const { symbol } = this.getToken(token, details, metadata); @@ -195,6 +199,7 @@ export class AssetClient extends PolkadotApiClient { decimals: 18, icon: symbols.join('/'), type: assetType.toString(), + isSufficient: isSufficient.toHuman(), existentialDeposit: existentialDeposit.toString(), meta: meta, } as Asset; diff --git a/packages/sdk/src/types.ts b/packages/sdk/src/types.ts index 51682764..d2453e54 100644 --- a/packages/sdk/src/types.ts +++ b/packages/sdk/src/types.ts @@ -171,6 +171,7 @@ export interface Asset extends AssetMetadata { icon: string; type: string; existentialDeposit: string; + isSufficient: boolean; origin?: number; meta?: Record; } diff --git a/packages/sdk/test/script/examples/getRegistryAssets.ts b/packages/sdk/test/script/examples/getRegistryAssets.ts new file mode 100644 index 00000000..f6beae78 --- /dev/null +++ b/packages/sdk/test/script/examples/getRegistryAssets.ts @@ -0,0 +1,21 @@ +import { ApiPromise } from '@polkadot/api'; +import { ApiUrl, PolkadotExecutor } from '../executor'; +import { AssetClient } from '../../../src/client'; + +class GetAssetsExample extends PolkadotExecutor { + async script(api: ApiPromise): Promise { + const external = [ + { + decimals: 8, + origin: 1000, + id: '666', + name: 'Danger Coin', + symbol: 'DANGER', + }, + ]; + const assetClient = new AssetClient(api); + return assetClient.getOnChainAssets(external); + } +} + +new GetAssetsExample(ApiUrl.Nice, 'Get all assets').run(); diff --git a/packages/sdk/test/script/examples/router/getAllAssets.ts b/packages/sdk/test/script/examples/router/getAllAssets.ts index ee514892..1d78b9ee 100644 --- a/packages/sdk/test/script/examples/router/getAllAssets.ts +++ b/packages/sdk/test/script/examples/router/getAllAssets.ts @@ -11,4 +11,4 @@ class GetAllAssetsExample extends PolkadotExecutor { } } -new GetAllAssetsExample(ApiUrl.Nice, 'Get all assets').run(); +new GetAllAssetsExample(ApiUrl.Basilisk, 'Get all assets').run(); diff --git a/packages/xcm-cfg/src/builders/pallets/polkadotXcm.ts b/packages/xcm-cfg/src/builders/pallets/polkadotXcm.ts index 7f93be0d..40f842b5 100644 --- a/packages/xcm-cfg/src/builders/pallets/polkadotXcm.ts +++ b/packages/xcm-cfg/src/builders/pallets/polkadotXcm.ts @@ -46,7 +46,6 @@ const limitedReserveTransferAssets = () => { getArgs: () => { const version = XcmVersion.v3; const account = getExtrinsicAccount(address); - const isAssetDifferent = !!feeAsset && asset !== feeAsset; const assets = [ toAsset(