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.tsdiffbeforeafterboth512 parents: 1,512 parents: 1,513 interior: 'Here',513 interior: 'Here',514 };514 };515 const relayAssetId = {Concrete: relayLocation};515516516 const relayCollectionId = await helper.foreignAssets.foreignCollectionId(relayLocation);517 const relayCollectionId = await helper.foreignAssets.foreignCollectionId(relayAssetId);517 if(relayCollectionId == null) {518 if(relayCollectionId == null) {518 const name = 'Relay Tokens';519 const name = 'Relay Tokens';519 const tokenPrefix = 'xDOT';520 const tokenPrefix = 'xDOT';520 const decimals = 10;521 const decimals = 10;521 await helper.getSudo().foreignAssets.register(alice, relayLocation, name, tokenPrefix, {Fungible: decimals});522 await helper.getSudo().foreignAssets.register(alice, relayAssetId, name, tokenPrefix, {Fungible: decimals});522523523 return await helper.foreignAssets.foreignCollectionId(relayLocation);524 return await helper.foreignAssets.foreignCollectionId(relayAssetId);524 } else {525 } else {525 console.log('Relay foreign collection is already registered');526 console.log('Relay foreign collection is already registered');526 return relayCollectionId;527 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.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);
});