difftreelog
fix(xcm test) hooks for `Astar`\`Shiden`
in: master
5 files changed
tests/src/util/playgrounds/unique.xcm.tsdiffbeforeafterboth244 await this.helper.executeExtrinsic(signer, 'api.tx.assets.create', [assetId, admin, minimalBalance], true);244 await this.helper.executeExtrinsic(signer, 'api.tx.assets.create', [assetId, admin, minimalBalance], true);245 }245 }246247 async forceCreate(signer: TSigner, assetId: number | bigint, admin: string, minimalBalance: bigint, isSufficient = true) {248 await this.helper.executeExtrinsic(signer, 'api.tx.assets.forceCreate', [assetId, admin, isSufficient, minimalBalance], true);249 }246250247 async setMetadata(signer: TSigner, assetId: number | bigint, name: string, symbol: string, decimals: number) {251 async setMetadata(signer: TSigner, assetId: number | bigint, name: string, symbol: string, decimals: number) {248 await this.helper.executeExtrinsic(signer, 'api.tx.assets.setMetadata', [assetId, name, symbol, decimals], true);252 await this.helper.executeExtrinsic(signer, 'api.tx.assets.setMetadata', [assetId, name, symbol, decimals], true);tests/src/xcm/lowLevelXcmQuartz.test.tsdiffbeforeafterboth243 await usingShidenPlaygrounds(shidenUrl, async (helper) => {243 await usingShidenPlaygrounds(shidenUrl, async (helper) => {244 if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) {244 if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) {245 console.log('1. Create foreign asset and metadata');245 console.log('1. Create foreign asset and metadata');246 await helper.assets.create(246 await helper.getSudo().assets.forceCreate(247 alice,247 alice,248 QTZ_ASSET_ID_ON_SHIDEN,248 QTZ_ASSET_ID_ON_SHIDEN,249 alice.address,249 alice.address,tests/src/xcm/lowLevelXcmUnique.test.tsdiffbeforeafterboth309 await usingAstarPlaygrounds(astarUrl, async (helper) => {309 await usingAstarPlaygrounds(astarUrl, async (helper) => {310 if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) {310 if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) {311 console.log('1. Create foreign asset and metadata');311 console.log('1. Create foreign asset and metadata');312 await helper.assets.create(312 await helper.getSudo().assets.forceCreate(313 alice,313 alice,314 UNQ_ASSET_ID_ON_ASTAR,314 UNQ_ASSET_ID_ON_ASTAR,315 alice.address,315 alice.address,tests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth1290 const shidenInitialBalance = 1n * (10n ** SHIDEN_DECIMALS); // 1 SHD, existential deposit required to actually create the account on Shiden1290 const shidenInitialBalance = 1n * (10n ** SHIDEN_DECIMALS); // 1 SHD, existential deposit required to actually create the account on Shiden1291 const unitsPerSecond = 500_451_000_000_000_000_000n; // The value is taken from the live Shiden1291 const unitsPerSecond = 500_451_000_000_000_000_000n; // The value is taken from the live Shiden1292 const qtzToShidenTransferred = 10n * (10n ** QTZ_DECIMALS); // 10 QTZ1292 const qtzToShidenTransferred = 10n * (10n ** QTZ_DECIMALS); // 10 QTZ1293 const qtzToShidenArrived = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens1293 const qtzToShidenArrived = 7_998_196_000_000_000_000n; // 7.99 ... QTZ, Shiden takes a commision in foreign tokens129412941295 // Shiden -> Quartz1295 // Shiden -> Quartz1296 const qtzFromShidenTransfered = 5n * (10n ** QTZ_DECIMALS); // 5 QTZ1296 const qtzFromShidenTransfered = 5n * (10n ** QTZ_DECIMALS); // 5 QTZ1297 const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 4.999_999_999_088_000_000n QTZ1297 const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 2.99 ... QTZ129812981299 let balanceAfterQuartzToShidenXCM: bigint;1299 let balanceAfterQuartzToShidenXCM: bigint;130013001311 await usingShidenPlaygrounds(shidenUrl, async (helper) => {1311 await usingShidenPlaygrounds(shidenUrl, async (helper) => {1312 if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) {1312 if(!(await helper.callRpc('api.query.assets.asset', [QTZ_ASSET_ID_ON_SHIDEN])).toJSON()) {1313 console.log('1. Create foreign asset and metadata');1313 console.log('1. Create foreign asset and metadata');1314 await helper.assets.create(1314 await helper.getSudo().assets.forceCreate(1315 alice,1315 alice,1316 QTZ_ASSET_ID_ON_SHIDEN,1316 QTZ_ASSET_ID_ON_SHIDEN,1317 alice.address,1317 alice.address,tests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth1518 const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Astar.1518 const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Astar.1519 const unitsPerSecond = 9_451_000_000_000_000_000n; // The value is taken from the live Astar1519 const unitsPerSecond = 9_451_000_000_000_000_000n; // The value is taken from the live Astar1520 const unqToAstarTransferred = 10n * (10n ** UNQ_DECIMALS); // 10 UNQ1520 const unqToAstarTransferred = 10n * (10n ** UNQ_DECIMALS); // 10 UNQ1521 const unqToAstarArrived = 9_999_999_999_088_000_000n; // 9.999 ... UNQ, Astar takes a commision in foreign tokens1521 const unqToAstarArrived = 9_962_196_000_000_000_000n; // 9.962 ... UNQ, Astar takes a commision in foreign tokens152215221523 // Astar -> Unique1523 // Astar -> Unique1524 const unqFromAstarTransfered = 5n * (10n ** UNQ_DECIMALS); // 5 UNQ1524 const unqFromAstarTransfered = 5n * (10n ** UNQ_DECIMALS); // 5 UNQ1525 const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.999_999_999_088_000_000n UNQ1525 const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.962_219_600_000_000_000n UNQ152615261527 let balanceAfterUniqueToAstarXCM: bigint;1527 let balanceAfterUniqueToAstarXCM: bigint;152815281539 await usingAstarPlaygrounds(astarUrl, async (helper) => {1539 await usingAstarPlaygrounds(astarUrl, async (helper) => {1540 if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) {1540 if(!(await helper.callRpc('api.query.assets.asset', [UNQ_ASSET_ID_ON_ASTAR])).toJSON()) {1541 console.log('1. Create foreign asset and metadata');1541 console.log('1. Create foreign asset and metadata');1542 await helper.assets.create(1542 await helper.getSudo().assets.forceCreate(1543 alice,1543 alice,1544 UNQ_ASSET_ID_ON_ASTAR,1544 UNQ_ASSET_ID_ON_ASTAR,1545 alice.address,1545 alice.address,