git.delta.rocks / unique-network / refs/commits / e379082d34c2

difftreelog

fix(xcm-tests) use executeTransaction

Daniel Shiposha2022-09-07parent: #2c288b0.patch.diff
in: master

3 files changed

modifiedtests/src/xcm/xcmOpal.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmOpal.test.ts
+++ b/tests/src/xcm/xcmOpal.test.ts
@@ -20,7 +20,7 @@
 import {WsProvider} from '@polkadot/api';
 import {ApiOptions} from '@polkadot/api/types';
 import {IKeyringPair} from '@polkadot/types/types';
-import usingApi, {submitTransactionAsync} from './../substrate/substrate-api';
+import usingApi, {executeTransaction} from './../substrate/substrate-api';
 import {bigIntToDecimals, describe_xcm, getGenericResult, paraSiblingSovereignAccount} from './../util/helpers';
 import waitNewBlocks from './../substrate/wait-new-blocks';
 import {normalizeAccountId} from './../util/helpers';
@@ -93,26 +93,26 @@
       const fundingAmount = 3_500_000_000_000; 
 
       const tx = api.tx.assets.create(ASSET_ID, alice.addressRaw, ASSET_METADATA_MINIMAL_BALANCE);
-      const events = await submitTransactionAsync(alice, tx);
+      const events = await executeTransaction(api, alice, tx);
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
 
       // set metadata
       const tx2 = api.tx.assets.setMetadata(ASSET_ID, ASSET_METADATA_NAME, ASSET_METADATA_DESCRIPTION, ASSET_METADATA_DECIMALS);
-      const events2 = await submitTransactionAsync(alice, tx2);
+      const events2 = await executeTransaction(api, alice, tx2);
       const result2 = getGenericResult(events2);
       expect(result2.success).to.be.true;
 
       // mint some amount of asset
       const tx3 = api.tx.assets.mint(ASSET_ID, alice.addressRaw, ASSET_AMOUNT);
-      const events3 = await submitTransactionAsync(alice, tx3);
+      const events3 = await executeTransaction(api, alice, tx3);
       const result3 = getGenericResult(events3);
       expect(result3.success).to.be.true;
 
       // funding parachain sovereing account (Parachain: 2095)
       const parachainSovereingAccount = await paraSiblingSovereignAccount(UNIQUE_CHAIN);
       const tx4 = api.tx.balances.transfer(parachainSovereingAccount, fundingAmount);
-      const events4 = await submitTransactionAsync(bob, tx4);
+      const events4 = await executeTransaction(api, bob, tx4);
       const result4 = getGenericResult(events4);
       expect(result4.success).to.be.true;
 
@@ -148,7 +148,7 @@
       //registerForeignAsset(owner, location, metadata)
       const tx = api.tx.foreignAssets.registerForeignAsset(alice.addressRaw, location, metadata);
       const sudoTx = api.tx.sudo.sudo(tx as any);
-      const events = await submitTransactionAsync(alice, sudoTx);
+      const events = await executeTransaction(api, alice, sudoTx);
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
 
@@ -203,7 +203,7 @@
       };
 
       const tx = api.tx.xcmPallet.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);
-      const events = await submitTransactionAsync(alice, tx);
+      const events = await executeTransaction(api, alice, tx);
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
     }, relayApiOptions);
@@ -276,7 +276,7 @@
       [balanceStmnBefore] = await getBalance(api, [alice.address]);
 
       const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(dest, beneficiary, assets, feeAssetItem, weightLimit);
-      const events = await submitTransactionAsync(alice, tx);
+      const events = await executeTransaction(api, alice, tx);
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
 
@@ -365,7 +365,7 @@
       const destWeight = 500000000000;
 
       const tx = api.tx.xTokens.transferMulticurrencies(currencies, feeItem, destination, destWeight);
-      const events = await submitTransactionAsync(alice, tx);
+      const events = await executeTransaction(api, alice, tx);
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
       
@@ -452,7 +452,7 @@
       };
 
       const tx = api.tx.xcmPallet.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);
-      const events = await submitTransactionAsync(bob, tx);
+      const events = await executeTransaction(api, bob, tx);
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
     }, relayApiOptions);
@@ -514,7 +514,7 @@
       const destWeight = 500000000000;
 
       const tx = api.tx.xTokens.transferMulticurrencies(currencies, feeItem, destination, destWeight);
-      const events = await submitTransactionAsync(bob, tx);
+      const events = await executeTransaction(api, bob, tx);
       const result = getGenericResult(events);
       expect(result.success).to.be.true;
 
modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
77 77
78 before(async () => {78 before(async () => {
79 await usingApi(async (api, privateKeyWrapper) => {79 await usingApi(async (api, privateKeyWrapper) => {
80 const keyringSr25519 = new Keyring({type: 'sr25519'});
81
80 alice = privateKeyWrapper('//Alice');82 alice = privateKeyWrapper('//Alice');
81 randomAccount = generateKeyringPair();83 randomAccount = generateKeyringPair(keyringSr25519);
82 });84 });
8385
84 // Karura side86 // Karura side
477479
478 before(async () => {480 before(async () => {
479 await usingApi(async (api, privateKeyWrapper) => {481 await usingApi(async (api, privateKeyWrapper) => {
482 const keyringEth = new Keyring({type: 'ethereum'});
483 const keyringSr25519 = new Keyring({type: 'sr25519'});
484
480 quartzAlice = privateKeyWrapper('//Alice');485 quartzAlice = privateKeyWrapper('//Alice');
481 randomAccountQuartz = generateKeyringPair();486 randomAccountQuartz = generateKeyringPair(keyringSr25519);
482 randomAccountMoonriver = generateKeyringPair('ethereum');487 randomAccountMoonriver = generateKeyringPair(keyringEth);
483488
484 balanceForeignQtzTokenInit = 0n;489 balanceForeignQtzTokenInit = 0n;
485 });490 });
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -77,8 +77,10 @@
   
   before(async () => {
     await usingApi(async (api, privateKeyWrapper) => {
+      const keyringSr25519 = new Keyring({type: 'sr25519'});
+
       alice = privateKeyWrapper('//Alice');
-      randomAccount = generateKeyringPair();
+      randomAccount = generateKeyringPair(keyringSr25519);
     });
 
     // Acala side
@@ -477,9 +479,12 @@
 
   before(async () => {
     await usingApi(async (api, privateKeyWrapper) => {
+      const keyringEth = new Keyring({type: 'ethereum'});
+      const keyringSr25519 = new Keyring({type: 'sr25519'});
+
       uniqueAlice = privateKeyWrapper('//Alice');
-      randomAccountUnique = generateKeyringPair();
-      randomAccountMoonbeam = generateKeyringPair('ethereum');
+      randomAccountUnique = generateKeyringPair(keyringSr25519);
+      randomAccountMoonbeam = generateKeyringPair(keyringEth);
 
       balanceForeignUnqTokenInit = 0n;
     });