git.delta.rocks / unique-network / refs/commits / 598440f58130

difftreelog

fix quartz xcm tests for kusama 0.9.38

Daniel Shiposha2023-04-10parent: #ceae5ed.patch.diff
in: master

3 files changed

modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -2959,47 +2959,59 @@
     await this.helper.executeExtrinsic(signer, `api.tx.${this.palletName}.teleportAssets`, [destination, beneficiary, assets, feeAssetItem], true);
   }
 
-  async teleportNativeAsset(signer: TSigner, destinationParaId: number, targetAccount: Uint8Array, amount: bigint) {
-    const destination = {
-      V1: {
-        parents: 0,
-        interior: {
-          X1: {
-            Parachain: destinationParaId,
-          },
+  async teleportNativeAsset(signer: TSigner, destinationParaId: number, targetAccount: Uint8Array, amount: bigint, xcmVersion: number = 3) {
+    const destinationContent = {
+      parents: 0,
+      interior: {
+        X1: {
+          Parachain: destinationParaId,
         },
       },
     };
 
-    const beneficiary = {
-      V1: {
-        parents: 0,
-        interior: {
-          X1: {
-            AccountId32: {
-              network: 'Any',
-              id: targetAccount,
-            },
+    const beneficiaryContent = {
+      parents: 0,
+      interior: {
+        X1: {
+          AccountId32: {
+            network: 'Any',
+            id: targetAccount,
           },
         },
       },
     };
 
-    const assets = {
-      V1: [
-        {
-          id: {
-            Concrete: {
-              parents: 0,
-              interior: 'Here',
-            },
+    const assetsContent = [
+      {
+        id: {
+          Concrete: {
+            parents: 0,
+            interior: 'Here',
           },
-          fun: {
-            Fungible: amount,
-          },
         },
-      ],
-    };
+        fun: {
+          Fungible: amount,
+        },
+      },
+    ];
+
+    let destination;
+    let beneficiary;
+    let assets;
+
+    if (xcmVersion == 2) {
+      destination = { V1: destinationContent };
+      beneficiary = { V1: beneficiaryContent };
+      assets = { V1: assetsContent };
+
+    } else if (xcmVersion == 3) {
+      destination = { V2: destinationContent };
+      beneficiary = { V2: beneficiaryContent };
+      assets = { V2: assetsContent };
+
+    } else {
+      throw Error("Unknown XCM version: " + xcmVersion);
+    }
 
     const feeAssetItem = 0;
 
modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
154 // (fee for USDT XCM are paid in relay tokens)154 // (fee for USDT XCM are paid in relay tokens)
155 await usingRelayPlaygrounds(relayUrl, async (helper) => {155 await usingRelayPlaygrounds(relayUrl, async (helper) => {
156 const destination = {156 const destination = {
157 V1: {157 V2: {
158 parents: 0,158 parents: 0,
159 interior: {X1: {159 interior: {X1: {
160 Parachain: QUARTZ_CHAIN,160 Parachain: QUARTZ_CHAIN,
163 }};163 }};
164164
165 const beneficiary = {165 const beneficiary = {
166 V1: {166 V2: {
167 parents: 0,167 parents: 0,
168 interior: {X1: {168 interior: {X1: {
169 AccountId32: {169 AccountId32: {
175 };175 };
176176
177 const assets = {177 const assets = {
178 V1: [178 V2: [
179 {179 {
180 id: {180 id: {
181 Concrete: {181 Concrete: {
200 itSub('Should connect and send USDT from Statemine to Quartz', async ({helper}) => {200 itSub('Should connect and send USDT from Statemine to Quartz', async ({helper}) => {
201 await usingStateminePlaygrounds(statemineUrl, async (helper) => {201 await usingStateminePlaygrounds(statemineUrl, async (helper) => {
202 const dest = {202 const dest = {
203 V1: {203 V2: {
204 parents: 1,204 parents: 1,
205 interior: {X1: {205 interior: {X1: {
206 Parachain: QUARTZ_CHAIN,206 Parachain: QUARTZ_CHAIN,
209 }};209 }};
210210
211 const beneficiary = {211 const beneficiary = {
212 V1: {212 V2: {
213 parents: 0,213 parents: 0,
214 interior: {X1: {214 interior: {X1: {
215 AccountId32: {215 AccountId32: {
221 };221 };
222222
223 const assets = {223 const assets = {
224 V1: [224 V2: [
225 {225 {
226 id: {226 id: {
227 Concrete: {227 Concrete: {
341341
342 await usingRelayPlaygrounds(relayUrl, async (helper) => {342 await usingRelayPlaygrounds(relayUrl, async (helper) => {
343 const destination = {343 const destination = {
344 V1: {344 V2: {
345 parents: 0,345 parents: 0,
346 interior: {X1: {346 interior: {X1: {
347 Parachain: QUARTZ_CHAIN,347 Parachain: QUARTZ_CHAIN,
350 }};350 }};
351351
352 const beneficiary = {352 const beneficiary = {
353 V1: {353 V2: {
354 parents: 0,354 parents: 0,
355 interior: {X1: {355 interior: {X1: {
356 AccountId32: {356 AccountId32: {
362 };362 };
363363
364 const assets = {364 const assets = {
365 V1: [365 V2: [
366 {366 {
367 id: {367 id: {
368 Concrete: {368 Concrete: {
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -85,8 +85,9 @@
 
     await usingRelayPlaygrounds(relayUrl, async (helper) => {
       // Fund accounts on Statemint
-      await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, alice.addressRaw, FUNDING_AMOUNT);
-      await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, bob.addressRaw, FUNDING_AMOUNT);
+      const relayXcmVersion = 2;
+      await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, alice.addressRaw, FUNDING_AMOUNT, relayXcmVersion);
+      await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, bob.addressRaw, FUNDING_AMOUNT, relayXcmVersion);
     });
 
     await usingStatemintPlaygrounds(statemintUrl, async (helper) => {