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
2959 await this.helper.executeExtrinsic(signer, `api.tx.${this.palletName}.teleportAssets`, [destination, beneficiary, assets, feeAssetItem], true);2959 await this.helper.executeExtrinsic(signer, `api.tx.${this.palletName}.teleportAssets`, [destination, beneficiary, assets, feeAssetItem], true);
2960 }2960 }
29612961
2962 async teleportNativeAsset(signer: TSigner, destinationParaId: number, targetAccount: Uint8Array, amount: bigint) {2962 async teleportNativeAsset(signer: TSigner, destinationParaId: number, targetAccount: Uint8Array, amount: bigint, xcmVersion: number = 3) {
2963 const destination = {2963 const destinationContent = {
2964 V1: {
2965 parents: 0,2964 parents: 0,
2966 interior: {2965 interior: {
2967 X1: {2966 X1: {
2968 Parachain: destinationParaId,2967 Parachain: destinationParaId,
2969 },2968 },
2970 },2969 },
2971 },
2972 };2970 };
29732971
2974 const beneficiary = {2972 const beneficiaryContent = {
2975 V1: {
2976 parents: 0,2973 parents: 0,
2977 interior: {2974 interior: {
2978 X1: {2975 X1: {
2982 },2979 },
2983 },2980 },
2984 },2981 },
2985 },
2986 };2982 };
29872983
2988 const assets = {2984 const assetsContent = [
2989 V1: [
2990 {2985 {
2991 id: {2986 id: {
2992 Concrete: {2987 Concrete: {
2998 Fungible: amount,2993 Fungible: amount,
2999 },2994 },
3000 },2995 },
3001 ],2996 ];
3002 };2997
2998 let destination;
2999 let beneficiary;
3000 let assets;
3001
3002 if (xcmVersion == 2) {
3003 destination = { V1: destinationContent };
3004 beneficiary = { V1: beneficiaryContent };
3005 assets = { V1: assetsContent };
3006
3007 } else if (xcmVersion == 3) {
3008 destination = { V2: destinationContent };
3009 beneficiary = { V2: beneficiaryContent };
3010 assets = { V2: assetsContent };
3011
3012 } else {
3013 throw Error("Unknown XCM version: " + xcmVersion);
3014 }
30033015
3004 const feeAssetItem = 0;3016 const feeAssetItem = 0;
30053017
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
--- 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) => {