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
--- a/tests/src/xcm/xcmQuartz.test.ts
+++ b/tests/src/xcm/xcmQuartz.test.ts
@@ -154,7 +154,7 @@
     // (fee for USDT XCM are paid in relay tokens)
     await usingRelayPlaygrounds(relayUrl, async (helper) => {
       const destination = {
-        V1: {
+        V2: {
           parents: 0,
           interior: {X1: {
             Parachain: QUARTZ_CHAIN,
@@ -163,7 +163,7 @@
         }};
 
       const beneficiary = {
-        V1: {
+        V2: {
           parents: 0,
           interior: {X1: {
             AccountId32: {
@@ -175,7 +175,7 @@
       };
 
       const assets = {
-        V1: [
+        V2: [
           {
             id: {
               Concrete: {
@@ -200,7 +200,7 @@
   itSub('Should connect and send USDT from Statemine to Quartz', async ({helper}) => {
     await usingStateminePlaygrounds(statemineUrl, async (helper) => {
       const dest = {
-        V1: {
+        V2: {
           parents: 1,
           interior: {X1: {
             Parachain: QUARTZ_CHAIN,
@@ -209,7 +209,7 @@
         }};
 
       const beneficiary = {
-        V1: {
+        V2: {
           parents: 0,
           interior: {X1: {
             AccountId32: {
@@ -221,7 +221,7 @@
       };
 
       const assets = {
-        V1: [
+        V2: [
           {
             id: {
               Concrete: {
@@ -341,7 +341,7 @@
 
     await usingRelayPlaygrounds(relayUrl, async (helper) => {
       const destination = {
-        V1: {
+        V2: {
           parents: 0,
           interior: {X1: {
             Parachain: QUARTZ_CHAIN,
@@ -350,7 +350,7 @@
         }};
 
       const beneficiary = {
-        V1: {
+        V2: {
           parents: 0,
           interior: {X1: {
             AccountId32: {
@@ -362,7 +362,7 @@
       };
 
       const assets = {
-        V1: [
+        V2: [
           {
             id: {
               Concrete: {
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
8585
86 await usingRelayPlaygrounds(relayUrl, async (helper) => {86 await usingRelayPlaygrounds(relayUrl, async (helper) => {
87 // Fund accounts on Statemint87 // Fund accounts on Statemint
88 const relayXcmVersion = 2;
88 await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, alice.addressRaw, FUNDING_AMOUNT);89 await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, alice.addressRaw, FUNDING_AMOUNT, relayXcmVersion);
89 await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, bob.addressRaw, FUNDING_AMOUNT);90 await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, bob.addressRaw, FUNDING_AMOUNT, relayXcmVersion);
90 });91 });
9192
92 await usingStatemintPlaygrounds(statemintUrl, async (helper) => {93 await usingStatemintPlaygrounds(statemintUrl, async (helper) => {