git.delta.rocks / unique-network / refs/commits / 48c1587fa96f

difftreelog

test fix pallet-tokens field name change

Yaroslav Bolyukin2022-09-16parent: #6ca971a.patch.diff
in: master

4 files changed

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
1184 {Value: operationTx as any},1184 {Value: operationTx as any},
1185 );1185 );
11861186
1187 //const events = 1187 //const events =
1188 await expect(submitTransactionExpectFailAsync(sender, scheduleTx)).to.be.rejected;1188 await expect(submitTransactionExpectFailAsync(sender, scheduleTx)).to.be.rejected;
1189 //expect(getGenericResult(events).success).to.be.false;1189 //expect(getGenericResult(events).success).to.be.false;
1190 });1190 });
modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmQuartz.test.ts
+++ b/tests/src/xcm/xcmQuartz.test.ts
@@ -64,7 +64,7 @@
 describe_xcm('[XCM] Integration test: Exchanging tokens with Karura', () => {
   let alice: IKeyringPair;
   let randomAccount: IKeyringPair;
-  
+
   let balanceQuartzTokenInit: bigint;
   let balanceQuartzTokenMiddle: bigint;
   let balanceQuartzTokenFinal: bigint;
@@ -74,7 +74,7 @@
   let balanceQuartzForeignTokenInit: bigint;
   let balanceQuartzForeignTokenMiddle: bigint;
   let balanceQuartzForeignTokenFinal: bigint;
-  
+
   before(async () => {
     await usingApi(async (api, privateKeyWrapper) => {
       const keyringSr25519 = new Keyring({type: 'sr25519'});
@@ -96,50 +96,50 @@
             ],
           },
         };
-  
+
         const metadata = {
           name: 'QTZ',
           symbol: 'QTZ',
           decimals: 18,
           minimalBalance: 1,
         };
-  
+
         const tx = api.tx.assetRegistry.registerForeignAsset(destination, metadata);
         const sudoTx = api.tx.sudo.sudo(tx as any);
         const events = await submitTransactionAsync(alice, sudoTx);
         const result = getGenericResult(events);
         expect(result.success).to.be.true;
-  
+
         const tx1 = api.tx.balances.transfer(randomAccount.address, 10000000000000n);
         const events1 = await submitTransactionAsync(alice, tx1);
         const result1 = getGenericResult(events1);
         expect(result1.success).to.be.true;
-  
+
         [balanceKaruraTokenInit] = await getBalance(api, [randomAccount.address]);
         {
-          const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+          const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAssetId: 0})).toJSON() as any;
           balanceQuartzForeignTokenInit = BigInt(free);
         }
       },
       karuraOptions(),
     );
-  
+
     // Quartz side
     await usingApi(async (api) => {
       const tx0 = api.tx.balances.transfer(randomAccount.address, 10n * TRANSFER_AMOUNT);
       const events0 = await submitTransactionAsync(alice, tx0);
       const result0 = getGenericResult(events0);
       expect(result0.success).to.be.true;
-  
+
       [balanceQuartzTokenInit] = await getBalance(api, [randomAccount.address]);
     });
   });
-  
+
   it('Should connect and send QTZ to Karura', async () => {
-  
+
     // Quartz side
     await usingApi(async (api) => {
-  
+
       const destination = {
         V0: {
           X2: [
@@ -150,7 +150,7 @@
           ],
         },
       };
-  
+
       const beneficiary = {
         V0: {
           X1: {
@@ -161,7 +161,7 @@
           },
         },
       };
-  
+
       const assets = {
         V1: [
           {
@@ -177,32 +177,32 @@
           },
         ],
       };
-  
+
       const feeAssetItem = 0;
-  
+
       const weightLimit = {
         Limited: 5000000000,
       };
-  
+
       const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);
       const events = await submitTransactionAsync(randomAccount, tx);
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
-  
+
       [balanceQuartzTokenMiddle] = await getBalance(api, [randomAccount.address]);
-  
+
       const qtzFees = balanceQuartzTokenInit - balanceQuartzTokenMiddle - TRANSFER_AMOUNT;
       console.log('[Quartz -> Karura] transaction fees on Quartz: %s QTZ', bigIntToDecimals(qtzFees));
       expect(qtzFees > 0n).to.be.true;
     });
-  
+
     // Karura side
     await usingApi(
       async (api) => {
         await waitNewBlocks(api, 3);
-        const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+        const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAssetId: 0})).toJSON() as any;
         balanceQuartzForeignTokenMiddle = BigInt(free);
-  
+
         [balanceKaruraTokenMiddle] = await getBalance(api, [randomAccount.address]);
 
         const karFees = balanceKaruraTokenInit - balanceKaruraTokenMiddle;
@@ -219,9 +219,9 @@
       karuraOptions(),
     );
   });
-  
+
   it('Should connect to Karura and send QTZ back', async () => {
-  
+
     // Karura side
     await usingApi(
       async (api) => {
@@ -241,24 +241,24 @@
             },
           },
         };
-  
+
         const id = {
-          ForeignAsset: 0,
+          ForeignAssetId: 0,
         };
 
         const destWeight = 50000000;
-  
+
         const tx = api.tx.xTokens.transfer(id as any, TRANSFER_AMOUNT, destination, destWeight);
         const events = await submitTransactionAsync(randomAccount, tx);
         const result = getGenericResult(events);
         expect(result.success).to.be.true;
-  
+
         [balanceKaruraTokenFinal] = await getBalance(api, [randomAccount.address]);
         {
-          const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+          const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAssetId: 0})).toJSON() as any;
           balanceQuartzForeignTokenFinal = BigInt(free);
         }
-  
+
         const karFees = balanceKaruraTokenMiddle - balanceKaruraTokenFinal;
         const qtzOutcomeTransfer = balanceQuartzForeignTokenMiddle - balanceQuartzForeignTokenFinal;
 
@@ -277,13 +277,13 @@
     // Quartz side
     await usingApi(async (api) => {
       await waitNewBlocks(api, 3);
-  
+
       [balanceQuartzTokenFinal] = await getBalance(api, [randomAccount.address]);
       const actuallyDelivered = balanceQuartzTokenFinal - balanceQuartzTokenMiddle;
       expect(actuallyDelivered > 0).to.be.true;
 
       console.log('[Karura -> Quartz] actually delivered %s QTZ', bigIntToDecimals(actuallyDelivered));
-  
+
       const qtzFees = TRANSFER_AMOUNT - actuallyDelivered;
       console.log('[Karura -> Quartz] transaction fees on Quartz: %s QTZ', bigIntToDecimals(qtzFees));
       expect(qtzFees == 0n).to.be.true;
@@ -300,7 +300,7 @@
       alice = privateKeyWrapper('//Alice');
     });
   });
-  
+
   it('Quartz rejects tokens from the Relay', async () => {
     await usingApi(async (api) => {
       const destination = {
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -64,7 +64,7 @@
 describe_xcm('[XCM] Integration test: Exchanging tokens with Acala', () => {
   let alice: IKeyringPair;
   let randomAccount: IKeyringPair;
-  
+
   let balanceUniqueTokenInit: bigint;
   let balanceUniqueTokenMiddle: bigint;
   let balanceUniqueTokenFinal: bigint;
@@ -74,7 +74,7 @@
   let balanceUniqueForeignTokenInit: bigint;
   let balanceUniqueForeignTokenMiddle: bigint;
   let balanceUniqueForeignTokenFinal: bigint;
-  
+
   before(async () => {
     await usingApi(async (api, privateKeyWrapper) => {
       const keyringSr25519 = new Keyring({type: 'sr25519'});
@@ -96,50 +96,50 @@
             ],
           },
         };
-  
+
         const metadata = {
           name: 'UNQ',
           symbol: 'UNQ',
           decimals: 18,
           minimalBalance: 1,
         };
-  
+
         const tx = api.tx.assetRegistry.registerForeignAsset(destination, metadata);
         const sudoTx = api.tx.sudo.sudo(tx as any);
         const events = await submitTransactionAsync(alice, sudoTx);
         const result = getGenericResult(events);
         expect(result.success).to.be.true;
-  
+
         const tx1 = api.tx.balances.transfer(randomAccount.address, 10000000000000n);
         const events1 = await submitTransactionAsync(alice, tx1);
         const result1 = getGenericResult(events1);
         expect(result1.success).to.be.true;
-  
+
         [balanceAcalaTokenInit] = await getBalance(api, [randomAccount.address]);
         {
-          const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+          const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAssetId: 0})).toJSON() as any;
           balanceUniqueForeignTokenInit = BigInt(free);
         }
       },
       acalaOptions(),
     );
-  
+
     // Unique side
     await usingApi(async (api) => {
       const tx0 = api.tx.balances.transfer(randomAccount.address, 10n * TRANSFER_AMOUNT);
       const events0 = await submitTransactionAsync(alice, tx0);
       const result0 = getGenericResult(events0);
       expect(result0.success).to.be.true;
-  
+
       [balanceUniqueTokenInit] = await getBalance(api, [randomAccount.address]);
     });
   });
-  
+
   it('Should connect and send UNQ to Acala', async () => {
-  
+
     // Unique side
     await usingApi(async (api) => {
-  
+
       const destination = {
         V0: {
           X2: [
@@ -150,7 +150,7 @@
           ],
         },
       };
-  
+
       const beneficiary = {
         V0: {
           X1: {
@@ -161,7 +161,7 @@
           },
         },
       };
-  
+
       const assets = {
         V1: [
           {
@@ -177,32 +177,32 @@
           },
         ],
       };
-  
+
       const feeAssetItem = 0;
-  
+
       const weightLimit = {
         Limited: 5000000000,
       };
-  
+
       const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);
       const events = await submitTransactionAsync(randomAccount, tx);
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
-  
+
       [balanceUniqueTokenMiddle] = await getBalance(api, [randomAccount.address]);
-  
+
       const unqFees = balanceUniqueTokenInit - balanceUniqueTokenMiddle - TRANSFER_AMOUNT;
       console.log('[Unique -> Acala] transaction fees on Unique: %s UNQ', bigIntToDecimals(unqFees));
       expect(unqFees > 0n).to.be.true;
     });
-  
+
     // Acala side
     await usingApi(
       async (api) => {
         await waitNewBlocks(api, 3);
-        const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+        const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAssetId: 0})).toJSON() as any;
         balanceUniqueForeignTokenMiddle = BigInt(free);
-  
+
         [balanceAcalaTokenMiddle] = await getBalance(api, [randomAccount.address]);
 
         const acaFees = balanceAcalaTokenInit - balanceAcalaTokenMiddle;
@@ -219,9 +219,9 @@
       acalaOptions(),
     );
   });
-  
+
   it('Should connect to Acala and send UNQ back', async () => {
-  
+
     // Acala side
     await usingApi(
       async (api) => {
@@ -241,24 +241,24 @@
             },
           },
         };
-  
+
         const id = {
-          ForeignAsset: 0,
+          ForeignAssetId: 0,
         };
 
         const destWeight = 50000000;
-  
+
         const tx = api.tx.xTokens.transfer(id as any, TRANSFER_AMOUNT, destination, destWeight);
         const events = await submitTransactionAsync(randomAccount, tx);
         const result = getGenericResult(events);
         expect(result.success).to.be.true;
-  
+
         [balanceAcalaTokenFinal] = await getBalance(api, [randomAccount.address]);
         {
-          const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+          const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAssetId: 0})).toJSON() as any;
           balanceUniqueForeignTokenFinal = BigInt(free);
         }
-  
+
         const acaFees = balanceAcalaTokenMiddle - balanceAcalaTokenFinal;
         const unqOutcomeTransfer = balanceUniqueForeignTokenMiddle - balanceUniqueForeignTokenFinal;
 
@@ -277,13 +277,13 @@
     // Unique side
     await usingApi(async (api) => {
       await waitNewBlocks(api, 3);
-  
+
       [balanceUniqueTokenFinal] = await getBalance(api, [randomAccount.address]);
       const actuallyDelivered = balanceUniqueTokenFinal - balanceUniqueTokenMiddle;
       expect(actuallyDelivered > 0).to.be.true;
 
       console.log('[Acala -> Unique] actually delivered %s UNQ', bigIntToDecimals(actuallyDelivered));
-  
+
       const unqFees = TRANSFER_AMOUNT - actuallyDelivered;
       console.log('[Acala -> Unique] transaction fees on Unique: %s UNQ', bigIntToDecimals(unqFees));
       expect(unqFees == 0n).to.be.true;
@@ -300,7 +300,7 @@
       alice = privateKeyWrapper('//Alice');
     });
   });
-  
+
   it('Unique rejects tokens from the Relay', async () => {
     await usingApi(async (api) => {
       const destination = {
modifiedtests/src/xcmTransfer.test.tsdiffbeforeafterboth
--- a/tests/src/xcmTransfer.test.ts
+++ b/tests/src/xcmTransfer.test.ts
@@ -78,7 +78,7 @@
     let balanceOnKaruraBefore: bigint;
 
     await usingApi(async (api) => {
-      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAssetId: 0})).toJSON() as any;
       balanceOnKaruraBefore = free;
     }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});
 
@@ -136,7 +136,7 @@
     await usingApi(async (api) => {
       // todo do something about instant sealing, where there might not be any new blocks
       await waitNewBlocks(api, 3);
-      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+      const {free} = (await api.query.tokens.accounts(alice.addressRaw, {ForeignAssetId: 0})).toJSON() as any;
       expect(free > balanceOnKaruraBefore).to.be.true;
     }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});
   });
@@ -165,7 +165,7 @@
       };
 
       const id = {
-        ForeignAsset: 0,
+        ForeignAssetId: 0,
       };
 
       const amount = TRANSFER_AMOUNT;