From f1959a02f54e8db860277d5d57b702021d7d65b0 Mon Sep 17 00:00:00 2001 From: PraetorP Date: Tue, 3 Oct 2023 10:43:50 +0000 Subject: [PATCH] fix(xcm test): hooks for `Astar`\`Shiden` --- tests/src/util/playgrounds/unique.xcm.ts | 4 ++++ tests/src/xcm/lowLevelXcmQuartz.test.ts | 2 +- tests/src/xcm/lowLevelXcmUnique.test.ts | 2 +- tests/src/xcm/xcmQuartz.test.ts | 6 +++--- tests/src/xcm/xcmUnique.test.ts | 6 +++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/src/util/playgrounds/unique.xcm.ts b/tests/src/util/playgrounds/unique.xcm.ts index a980c2c99c..c9704ac7f2 100644 --- a/tests/src/util/playgrounds/unique.xcm.ts +++ b/tests/src/util/playgrounds/unique.xcm.ts @@ -244,6 +244,10 @@ export class AssetsGroup extends HelperGroup { await this.helper.executeExtrinsic(signer, 'api.tx.assets.create', [assetId, admin, minimalBalance], true); } + async forceCreate(signer: TSigner, assetId: number | bigint, admin: string, minimalBalance: bigint, isSufficient = true) { + await this.helper.executeExtrinsic(signer, 'api.tx.assets.forceCreate', [assetId, admin, isSufficient, minimalBalance], true); + } + async setMetadata(signer: TSigner, assetId: number | bigint, name: string, symbol: string, decimals: number) { await this.helper.executeExtrinsic(signer, 'api.tx.assets.setMetadata', [assetId, name, symbol, decimals], true); } diff --git a/tests/src/xcm/lowLevelXcmQuartz.test.ts b/tests/src/xcm/lowLevelXcmQuartz.test.ts index 6f06ed760d..fd3549d353 100644 --- a/tests/src/xcm/lowLevelXcmQuartz.test.ts +++ b/tests/src/xcm/lowLevelXcmQuartz.test.ts @@ -243,7 +243,7 @@ describeXCM('[XCMLL] Integration test: Exchanging tokens with Shiden', () => { await usingShidenPlaygrounds(shidenUrl, async (helper) => { if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) { console.log('1. Create foreign asset and metadata'); - await helper.assets.create( + await helper.getSudo().assets.forceCreate( alice, QTZ_ASSET_ID_ON_SHIDEN, alice.address, diff --git a/tests/src/xcm/lowLevelXcmUnique.test.ts b/tests/src/xcm/lowLevelXcmUnique.test.ts index f66432dab1..8bab9e31de 100644 --- a/tests/src/xcm/lowLevelXcmUnique.test.ts +++ b/tests/src/xcm/lowLevelXcmUnique.test.ts @@ -309,7 +309,7 @@ describeXCM('[XCMLL] Integration test: Exchanging tokens with Astar', () => { await usingAstarPlaygrounds(astarUrl, async (helper) => { if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) { console.log('1. Create foreign asset and metadata'); - await helper.assets.create( + await helper.getSudo().assets.forceCreate( alice, UNQ_ASSET_ID_ON_ASTAR, alice.address, diff --git a/tests/src/xcm/xcmQuartz.test.ts b/tests/src/xcm/xcmQuartz.test.ts index 92e4310e89..49b9f84bb2 100644 --- a/tests/src/xcm/xcmQuartz.test.ts +++ b/tests/src/xcm/xcmQuartz.test.ts @@ -1290,11 +1290,11 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => { const shidenInitialBalance = 1n * (10n ** SHIDEN_DECIMALS); // 1 SHD, existential deposit required to actually create the account on Shiden const unitsPerSecond = 500_451_000_000_000_000_000n; // The value is taken from the live Shiden const qtzToShidenTransferred = 10n * (10n ** QTZ_DECIMALS); // 10 QTZ - const qtzToShidenArrived = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens + const qtzToShidenArrived = 7_998_196_000_000_000_000n; // 7.99 ... QTZ, Shiden takes a commision in foreign tokens // Shiden -> Quartz const qtzFromShidenTransfered = 5n * (10n ** QTZ_DECIMALS); // 5 QTZ - const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 4.999_999_999_088_000_000n QTZ + const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 2.99 ... QTZ let balanceAfterQuartzToShidenXCM: bigint; @@ -1311,7 +1311,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => { await usingShidenPlaygrounds(shidenUrl, async (helper) => { if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) { console.log('1. Create foreign asset and metadata'); - await helper.assets.create( + await helper.getSudo().assets.forceCreate( alice, QTZ_ASSET_ID_ON_SHIDEN, alice.address, diff --git a/tests/src/xcm/xcmUnique.test.ts b/tests/src/xcm/xcmUnique.test.ts index b720914581..76f7693bb8 100644 --- a/tests/src/xcm/xcmUnique.test.ts +++ b/tests/src/xcm/xcmUnique.test.ts @@ -1518,11 +1518,11 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => { const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Astar. const unitsPerSecond = 9_451_000_000_000_000_000n; // The value is taken from the live Astar const unqToAstarTransferred = 10n * (10n ** UNQ_DECIMALS); // 10 UNQ - const unqToAstarArrived = 9_999_999_999_088_000_000n; // 9.999 ... UNQ, Astar takes a commision in foreign tokens + const unqToAstarArrived = 9_962_196_000_000_000_000n; // 9.962 ... UNQ, Astar takes a commision in foreign tokens // Astar -> Unique const unqFromAstarTransfered = 5n * (10n ** UNQ_DECIMALS); // 5 UNQ - const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.999_999_999_088_000_000n UNQ + const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.962_219_600_000_000_000n UNQ let balanceAfterUniqueToAstarXCM: bigint; @@ -1539,7 +1539,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => { await usingAstarPlaygrounds(astarUrl, async (helper) => { if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) { console.log('1. Create foreign asset and metadata'); - await helper.assets.create( + await helper.getSudo().assets.forceCreate( alice, UNQ_ASSET_ID_ON_ASTAR, alice.address,