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.tsdiffbeforeafterboth--- a/js-packages/tests/xcm/xcmOpal.test.ts
+++ b/js-packages/tests/xcm/xcmOpal.test.ts
@@ -17,7 +17,7 @@
import type {IKeyringPair} from '@polkadot/types/types';
import config from '../config.js';
import {itSub, expect, describeXCM, usingPlaygrounds, usingWestmintPlaygrounds, usingRelayPlaygrounds} from '../util/index.js';
-import {XcmTestHelper} from './xcm.types';
+import {XcmTestHelper} from './xcm.types.js';
const STATEMINE_CHAIN = +(process.env.RELAY_WESTMINT_ID || 1000);
const UNIQUE_CHAIN = +(process.env.RELAY_OPAL_ID || 2095);
@@ -120,16 +120,23 @@
},
]},
};
+ 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 Opal');
}
balanceOpalBefore = await helper.balance.getSubstrate(alice.address);
- usdtCollectionId = await helper.foreignAssets.foreignCollectionId(location);
+ usdtCollectionId = await helper.foreignAssets.foreignCollectionId(assetId);
});
// Providing the relay currency to the unique sender account
js-packages/tests/xcm/xcmQuartz.test.tsdiffbeforeafterboth19import {DevUniqueHelper, Event} from '@unique/playgrounds/unique.dev.js';19import {DevUniqueHelper, Event} from '@unique/playgrounds/unique.dev.js';20import {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';20import {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';21import {hexToString} from '@polkadot/util';21import {hexToString} from '@polkadot/util';22import {XcmTestHelper} from './xcm.types';22import {XcmTestHelper} from './xcm.types.js';232324const STATEMINE_PALLET_INSTANCE = 50;24const STATEMINE_PALLET_INSTANCE = 50;2525130 },130 },131 ]},131 ]},132 };132 };133 const assetId = {Concrete: location};133134134 if(await helper.foreignAssets.foreignCollectionId(location) == null) {135 if(await helper.foreignAssets.foreignCollectionId(assetId) == null) {135 const tokenPrefix = USDT_ASSET_METADATA_NAME;136 const tokenPrefix = USDT_ASSET_METADATA_NAME;136 await helper.getSudo().foreignAssets.register(alice, location, USDT_ASSET_METADATA_NAME, tokenPrefix, {Fungible: USDT_ASSET_METADATA_DECIMALS});137 await helper.getSudo().foreignAssets.register(alice, assetId, USDT_ASSET_METADATA_NAME, tokenPrefix, {Fungible: USDT_ASSET_METADATA_DECIMALS});137 } else {138 } else {138 console.log('Foreign collection is already registered on Quartz');139 console.log('Foreign collection is already registered on Quartz');139 }140 }140141141 balanceQuartzBefore = await helper.balance.getSubstrate(alice.address);142 balanceQuartzBefore = await helper.balance.getSubstrate(alice.address);142 usdtCollectionId = await helper.foreignAssets.foreignCollectionId(location);143 usdtCollectionId = await helper.foreignAssets.foreignCollectionId(assetId);143 });144 });144145145146js-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);
});