difftreelog
fix(xcm-tests) use executeTransaction
in: master
3 files changed
tests/src/xcm/xcmOpal.test.tsdiffbeforeafterboth20import {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; 949495 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;9999100 // set metadata100 // set metadata101 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;105105106 // mint some amount of asset106 // mint some amount of asset107 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;111111112 // 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;118118148 //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;154154203 };203 };204204205 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]);277277278 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;282282365 const destWeight = 500000000000;365 const destWeight = 500000000000;366366367 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 };453453454 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;515515516 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;520520tests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmQuartz.test.ts
+++ b/tests/src/xcm/xcmQuartz.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);
});
// Karura side
@@ -477,9 +479,12 @@
before(async () => {
await usingApi(async (api, privateKeyWrapper) => {
+ const keyringEth = new Keyring({type: 'ethereum'});
+ const keyringSr25519 = new Keyring({type: 'sr25519'});
+
quartzAlice = privateKeyWrapper('//Alice');
- randomAccountQuartz = generateKeyringPair();
- randomAccountMoonriver = generateKeyringPair('ethereum');
+ randomAccountQuartz = generateKeyringPair(keyringSr25519);
+ randomAccountMoonriver = generateKeyringPair(keyringEth);
balanceForeignQtzTokenInit = 0n;
});
tests/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;
});