difftreelog
fix xcm tests
in: master
5 files changed
js-packages/playgrounds/unique.xcm.tsdiffbeforeafterboth--- a/js-packages/playgrounds/unique.xcm.ts
+++ b/js-packages/playgrounds/unique.xcm.ts
@@ -104,17 +104,17 @@
}
export class ForeignAssetsGroup extends HelperGroup<UniqueHelper> {
- async register(signer: TSigner, location: any, name: string, tokenPrefix: string, mode: 'NFT' | { Fungible: number }) {
+ async register(signer: TSigner, assetId: any, name: string, tokenPrefix: string, mode: 'NFT' | { Fungible: number }) {
await this.helper.executeExtrinsic(
signer,
'api.tx.foreignAssets.forceRegisterForeignAsset',
- [location, this.helper.util.str2vec(name), tokenPrefix, mode],
+ [assetId, this.helper.util.str2vec(name), tokenPrefix, mode],
true,
);
}
- async foreignCollectionId(location: any) {
- return (await this.helper.callRpc('api.query.foreignAssets.foreignReserveLocationToCollection', [location])).toJSON();
+ async foreignCollectionId(assetId: any) {
+ return (await this.helper.callRpc('api.query.foreignAssets.foreignAssetToCollection', [assetId])).toJSON();
}
}
js-packages/tests/xcm/xcm.types.tsdiffbeforeafterboth--- a/js-packages/tests/xcm/xcm.types.ts
+++ b/js-packages/tests/xcm/xcm.types.ts
@@ -512,15 +512,16 @@
parents: 1,
interior: 'Here',
};
+ const relayAssetId = {Concrete: relayLocation};
- const relayCollectionId = await helper.foreignAssets.foreignCollectionId(relayLocation);
+ const relayCollectionId = await helper.foreignAssets.foreignCollectionId(relayAssetId);
if(relayCollectionId == null) {
const name = 'Relay Tokens';
const tokenPrefix = 'xDOT';
const decimals = 10;
- await helper.getSudo().foreignAssets.register(alice, relayLocation, name, tokenPrefix, {Fungible: decimals});
+ await helper.getSudo().foreignAssets.register(alice, relayAssetId, name, tokenPrefix, {Fungible: decimals});
- return await helper.foreignAssets.foreignCollectionId(relayLocation);
+ return await helper.foreignAssets.foreignCollectionId(relayAssetId);
} else {
console.log('Relay foreign collection is already registered');
return relayCollectionId;
js-packages/tests/xcm/xcmOpal.test.tsdiffbeforeafterboth17import type {IKeyringPair} from '@polkadot/types/types';17import type {IKeyringPair} from '@polkadot/types/types';18import config from '../config.js';18import config from '../config.js';19import {itSub, expect, describeXCM, usingPlaygrounds, usingWestmintPlaygrounds, usingRelayPlaygrounds} from '../util/index.js';19import {itSub, expect, describeXCM, usingPlaygrounds, usingWestmintPlaygrounds, usingRelayPlaygrounds} from '../util/index.js';20import {XcmTestHelper} from './xcm.types';20import {XcmTestHelper} from './xcm.types.js';212122const STATEMINE_CHAIN = +(process.env.RELAY_WESTMINT_ID || 1000);22const STATEMINE_CHAIN = +(process.env.RELAY_WESTMINT_ID || 1000);23const UNIQUE_CHAIN = +(process.env.RELAY_OPAL_ID || 2095);23const UNIQUE_CHAIN = +(process.env.RELAY_OPAL_ID || 2095);120 },120 },121 ]},121 ]},122 };122 };123 const assetId = {Concrete: location};123124124 if(await helper.foreignAssets.foreignCollectionId(location) == null) {125 if(await helper.foreignAssets.foreignCollectionId(assetId) == null) {125 const tokenPrefix = USDT_ASSET_METADATA_NAME;126 const tokenPrefix = USDT_ASSET_METADATA_NAME;126 await helper.getSudo().foreignAssets.register(alice, location, USDT_ASSET_METADATA_NAME, tokenPrefix, {Fungible: USDT_ASSET_METADATA_DECIMALS});127 await helper.getSudo().foreignAssets.register(128 alice,129 assetId,130 USDT_ASSET_METADATA_NAME,131 tokenPrefix,132 {Fungible: USDT_ASSET_METADATA_DECIMALS},133 );127 } else {134 } else {128 console.log('Foreign collection is already registered on Opal');135 console.log('Foreign collection is already registered on Opal');129 }136 }130137131 balanceOpalBefore = await helper.balance.getSubstrate(alice.address);138 balanceOpalBefore = await helper.balance.getSubstrate(alice.address);132 usdtCollectionId = await helper.foreignAssets.foreignCollectionId(location);139 usdtCollectionId = await helper.foreignAssets.foreignCollectionId(assetId);133 });140 });134141135 // Providing the relay currency to the unique sender account142 // Providing the relay currency to the unique sender accountjs-packages/tests/xcm/xcmQuartz.test.tsdiffbeforeafterboth--- a/js-packages/tests/xcm/xcmQuartz.test.ts
+++ b/js-packages/tests/xcm/xcmQuartz.test.ts
@@ -19,7 +19,7 @@
import {DevUniqueHelper, Event} from '@unique/playgrounds/unique.dev.js';
import {STATEMINE_CHAIN, QUARTZ_CHAIN, KARURA_CHAIN, MOONRIVER_CHAIN, SHIDEN_CHAIN, STATEMINE_DECIMALS, KARURA_DECIMALS, QTZ_DECIMALS, RELAY_DECIMALS, SHIDEN_DECIMALS, karuraUrl, moonriverUrl, relayUrl, shidenUrl, statemineUrl} from './xcm.types.js';
import {hexToString} from '@polkadot/util';
-import {XcmTestHelper} from './xcm.types';
+import {XcmTestHelper} from './xcm.types.js';
const STATEMINE_PALLET_INSTANCE = 50;
@@ -130,16 +130,17 @@
},
]},
};
+ const assetId = {Concrete: location};
- if(await helper.foreignAssets.foreignCollectionId(location) == null) {
+ if(await helper.foreignAssets.foreignCollectionId(assetId) == null) {
const tokenPrefix = USDT_ASSET_METADATA_NAME;
- await helper.getSudo().foreignAssets.register(alice, location, USDT_ASSET_METADATA_NAME, tokenPrefix, {Fungible: USDT_ASSET_METADATA_DECIMALS});
+ await helper.getSudo().foreignAssets.register(alice, assetId, USDT_ASSET_METADATA_NAME, tokenPrefix, {Fungible: USDT_ASSET_METADATA_DECIMALS});
} else {
console.log('Foreign collection is already registered on Quartz');
}
balanceQuartzBefore = await helper.balance.getSubstrate(alice.address);
- usdtCollectionId = await helper.foreignAssets.foreignCollectionId(location);
+ usdtCollectionId = await helper.foreignAssets.foreignCollectionId(assetId);
});
js-packages/tests/xcm/xcmUnique.test.tsdiffbeforeafterboth--- a/js-packages/tests/xcm/xcmUnique.test.ts
+++ b/js-packages/tests/xcm/xcmUnique.test.ts
@@ -20,7 +20,7 @@
import {Event} from '@unique/playgrounds/unique.dev.js';
import {hexToString, nToBigInt} from '@polkadot/util';
import {ACALA_CHAIN, ASTAR_CHAIN, MOONBEAM_CHAIN, POLKADEX_CHAIN, SAFE_XCM_VERSION, STATEMINT_CHAIN, UNIQUE_CHAIN, expectFailedToTransact, expectUntrustedReserveLocationFail, uniqueAssetId, uniqueVersionedMultilocation} from './xcm.types.js';
-import {XcmTestHelper} from './xcm.types';
+import {XcmTestHelper} from './xcm.types.js';
const STATEMINT_PALLET_INSTANCE = 50;
@@ -142,16 +142,17 @@
},
]},
};
+ const assetId = {Concrete: location};
- if(await helper.foreignAssets.foreignCollectionId(location) == null) {
+ if(await helper.foreignAssets.foreignCollectionId(assetId) == null) {
const tokenPrefix = USDT_ASSET_METADATA_NAME;
- await helper.getSudo().foreignAssets.register(alice, location, USDT_ASSET_METADATA_NAME, tokenPrefix, {Fungible: USDT_ASSET_METADATA_DECIMALS});
+ await helper.getSudo().foreignAssets.register(alice, assetId, USDT_ASSET_METADATA_NAME, tokenPrefix, {Fungible: USDT_ASSET_METADATA_DECIMALS});
} else {
console.log('Foreign collection is already registered on Unique');
}
balanceUniqueBefore = await helper.balance.getSubstrate(alice.address);
- usdtCollectionId = await helper.foreignAssets.foreignCollectionId(location);
+ usdtCollectionId = await helper.foreignAssets.foreignCollectionId(assetId);
});