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
20import {WsProvider} from '@polkadot/api';20import {WsProvider} from '@polkadot/api';
21import {ApiOptions} from '@polkadot/api/types';21import {ApiOptions} from '@polkadot/api/types';
22import {IKeyringPair} from '@polkadot/types/types';22import {IKeyringPair} from '@polkadot/types/types';
23import usingApi, {submitTransactionAsync} from './../substrate/substrate-api';23import usingApi, {executeTransaction} from './../substrate/substrate-api';
24import {bigIntToDecimals, describe_xcm, getGenericResult, paraSiblingSovereignAccount} from './../util/helpers';24import {bigIntToDecimals, describe_xcm, getGenericResult, paraSiblingSovereignAccount} from './../util/helpers';
25import waitNewBlocks from './../substrate/wait-new-blocks';25import waitNewBlocks from './../substrate/wait-new-blocks';
26import {normalizeAccountId} from './../util/helpers';26import {normalizeAccountId} from './../util/helpers';
93 const fundingAmount = 3_500_000_000_000; 93 const fundingAmount = 3_500_000_000_000;
9494
95 const tx = api.tx.assets.create(ASSET_ID, alice.addressRaw, ASSET_METADATA_MINIMAL_BALANCE);95 const tx = api.tx.assets.create(ASSET_ID, alice.addressRaw, ASSET_METADATA_MINIMAL_BALANCE);
96 const events = await submitTransactionAsync(alice, tx);96 const events = await executeTransaction(api, alice, tx);
97 const result = getGenericResult(events);97 const result = getGenericResult(events);
98 expect(result.success).to.be.true;98 expect(result.success).to.be.true;
9999
100 // set metadata100 // set metadata
101 const tx2 = api.tx.assets.setMetadata(ASSET_ID, ASSET_METADATA_NAME, ASSET_METADATA_DESCRIPTION, ASSET_METADATA_DECIMALS);101 const tx2 = api.tx.assets.setMetadata(ASSET_ID, ASSET_METADATA_NAME, ASSET_METADATA_DESCRIPTION, ASSET_METADATA_DECIMALS);
102 const events2 = await submitTransactionAsync(alice, tx2);102 const events2 = await executeTransaction(api, alice, tx2);
103 const result2 = getGenericResult(events2);103 const result2 = getGenericResult(events2);
104 expect(result2.success).to.be.true;104 expect(result2.success).to.be.true;
105105
106 // mint some amount of asset106 // mint some amount of asset
107 const tx3 = api.tx.assets.mint(ASSET_ID, alice.addressRaw, ASSET_AMOUNT);107 const tx3 = api.tx.assets.mint(ASSET_ID, alice.addressRaw, ASSET_AMOUNT);
108 const events3 = await submitTransactionAsync(alice, tx3);108 const events3 = await executeTransaction(api, alice, tx3);
109 const result3 = getGenericResult(events3);109 const result3 = getGenericResult(events3);
110 expect(result3.success).to.be.true;110 expect(result3.success).to.be.true;
111111
112 // funding parachain sovereing account (Parachain: 2095)112 // funding parachain sovereing account (Parachain: 2095)
113 const parachainSovereingAccount = await paraSiblingSovereignAccount(UNIQUE_CHAIN);113 const parachainSovereingAccount = await paraSiblingSovereignAccount(UNIQUE_CHAIN);
114 const tx4 = api.tx.balances.transfer(parachainSovereingAccount, fundingAmount);114 const tx4 = api.tx.balances.transfer(parachainSovereingAccount, fundingAmount);
115 const events4 = await submitTransactionAsync(bob, tx4);115 const events4 = await executeTransaction(api, bob, tx4);
116 const result4 = getGenericResult(events4);116 const result4 = getGenericResult(events4);
117 expect(result4.success).to.be.true;117 expect(result4.success).to.be.true;
118118
148 //registerForeignAsset(owner, location, metadata)148 //registerForeignAsset(owner, location, metadata)
149 const tx = api.tx.foreignAssets.registerForeignAsset(alice.addressRaw, location, metadata);149 const tx = api.tx.foreignAssets.registerForeignAsset(alice.addressRaw, location, metadata);
150 const sudoTx = api.tx.sudo.sudo(tx as any);150 const sudoTx = api.tx.sudo.sudo(tx as any);
151 const events = await submitTransactionAsync(alice, sudoTx);151 const events = await executeTransaction(api, alice, sudoTx);
152 const result = getGenericResult(events);152 const result = getGenericResult(events);
153 expect(result.success).to.be.true;153 expect(result.success).to.be.true;
154154
203 };203 };
204204
205 const tx = api.tx.xcmPallet.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);205 const tx = api.tx.xcmPallet.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);
206 const events = await submitTransactionAsync(alice, tx);206 const events = await executeTransaction(api, alice, tx);
207 const result = getGenericResult(events);207 const result = getGenericResult(events);
208 expect(result.success).to.be.true;208 expect(result.success).to.be.true;
209 }, relayApiOptions);209 }, relayApiOptions);
276 [balanceStmnBefore] = await getBalance(api, [alice.address]);276 [balanceStmnBefore] = await getBalance(api, [alice.address]);
277277
278 const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(dest, beneficiary, assets, feeAssetItem, weightLimit);278 const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(dest, beneficiary, assets, feeAssetItem, weightLimit);
279 const events = await submitTransactionAsync(alice, tx);279 const events = await executeTransaction(api, alice, tx);
280 const result = getGenericResult(events);280 const result = getGenericResult(events);
281 expect(result.success).to.be.true;281 expect(result.success).to.be.true;
282282
365 const destWeight = 500000000000;365 const destWeight = 500000000000;
366366
367 const tx = api.tx.xTokens.transferMulticurrencies(currencies, feeItem, destination, destWeight);367 const tx = api.tx.xTokens.transferMulticurrencies(currencies, feeItem, destination, destWeight);
368 const events = await submitTransactionAsync(alice, tx);368 const events = await executeTransaction(api, alice, tx);
369 const result = getGenericResult(events);369 const result = getGenericResult(events);
370 expect(result.success).to.be.true;370 expect(result.success).to.be.true;
371 371
452 };452 };
453453
454 const tx = api.tx.xcmPallet.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);454 const tx = api.tx.xcmPallet.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);
455 const events = await submitTransactionAsync(bob, tx);455 const events = await executeTransaction(api, bob, tx);
456 const result = getGenericResult(events);456 const result = getGenericResult(events);
457 expect(result.success).to.be.true;457 expect(result.success).to.be.true;
458 }, relayApiOptions);458 }, relayApiOptions);
514 const destWeight = 500000000000;514 const destWeight = 500000000000;
515515
516 const tx = api.tx.xTokens.transferMulticurrencies(currencies, feeItem, destination, destWeight);516 const tx = api.tx.xTokens.transferMulticurrencies(currencies, feeItem, destination, destWeight);
517 const events = await submitTransactionAsync(bob, tx);517 const events = await executeTransaction(api, bob, tx);
518 const result = getGenericResult(events);518 const result = getGenericResult(events);
519 expect(result.success).to.be.true;519 expect(result.success).to.be.true;
520520
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
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 // Acala side86 // Acala 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 uniqueAlice = privateKeyWrapper('//Alice');485 uniqueAlice = privateKeyWrapper('//Alice');
481 randomAccountUnique = generateKeyringPair();486 randomAccountUnique = generateKeyringPair(keyringSr25519);
482 randomAccountMoonbeam = generateKeyringPair('ethereum');487 randomAccountMoonbeam = generateKeyringPair(keyringEth);
483488
484 balanceForeignUnqTokenInit = 0n;489 balanceForeignUnqTokenInit = 0n;
485 });490 });