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

difftreelog

test upgrade for new logic

Yaroslav Bolyukin2023-05-22parent: #768e7a3.patch.diff
in: master

28 files changed

modifiedtests/src/benchmarks/mintFee/index.tsdiffbeforeafterboth
--- a/tests/src/benchmarks/mintFee/index.ts
+++ b/tests/src/benchmarks/mintFee/index.ts
@@ -72,7 +72,7 @@
     ).toString();
 
     const donor = await privateKey('//Alice'); // Seed from account with balance on this network
-    const ethSigner = await helper.eth.createAccountWithBalance(donor, 100n);
+    const ethSigner = await helper.eth.createAccountWithBalance(donor);
 
     const contract = await helper.ethContract.deployByCode(
       ethSigner,
@@ -131,7 +131,7 @@
 }> {
   const donor = await privateKey('//Alice');
   const substrateReceiver = await privateKey('//Bob');
-  const ethSigner = await helper.eth.createAccountWithBalance(donor, 100n);
+  const ethSigner = await helper.eth.createAccountWithBalance(donor);
 
   const nominal = helper.balance.getOneTokenNominal();
 
@@ -205,7 +205,7 @@
   setup: { propertiesNumber: number },
 ): Promise<IBenchmarkResultForProp> {
   const donor = await privateKey('//Alice'); // Seed from account with balance on this network
-  const ethSigner = await helper.eth.createAccountWithBalance(donor, 100n);
+  const ethSigner = await helper.eth.createAccountWithBalance(donor);
 
   const susbstrateReceiver = await privateKey('//Bob');
   const receiverEthAddress = helper.address.substrateToEth(susbstrateReceiver.address);
modifiedtests/src/benchmarks/opsFee/index.tsdiffbeforeafterboth
--- a/tests/src/benchmarks/opsFee/index.ts
+++ b/tests/src/benchmarks/opsFee/index.ts
@@ -61,8 +61,8 @@
   const res: IFunctionFee = {};
   const donor = await privateKey('//Alice');
   const [subReceiver] = await helper.arrange.createAccounts([10n], donor);
-  const ethSigner = await helper.eth.createAccountWithBalance(donor, 100n);
-  const ethReceiver = await helper.eth.createAccountWithBalance(donor, 10n);
+  const ethSigner = await helper.eth.createAccountWithBalance(donor);
+  const ethReceiver = await helper.eth.createAccountWithBalance(donor);
   const crossSigner = helper.ethCrossAccount.fromAddress(ethSigner);
   const crossReceiver = helper.ethCrossAccount.fromAddress(ethReceiver);
   const collection = (await createCollectionForBenchmarks(
@@ -521,8 +521,8 @@
   const res: IFunctionFee = {};
   const donor = await privateKey('//Alice');
   const [subReceiver] = await helper.arrange.createAccounts([10n], donor);
-  const ethSigner = await helper.eth.createAccountWithBalance(donor, 100n);
-  const ethReceiver = await helper.eth.createAccountWithBalance(donor, 10n);
+  const ethSigner = await helper.eth.createAccountWithBalance(donor);
+  const ethReceiver = await helper.eth.createAccountWithBalance(donor);
   const crossSigner = helper.ethCrossAccount.fromAddress(ethSigner);
   const crossReceiver = helper.ethCrossAccount.fromAddress(ethReceiver);
   const collection = (await createCollectionForBenchmarks(
modifiedtests/src/calibrate.tsdiffbeforeafterboth
--- a/tests/src/calibrate.ts
+++ b/tests/src/calibrate.ts
@@ -76,7 +76,7 @@
 
   sqrt() {
     if (this.a < 0n) {
-      throw 'square root of negative numbers is not supported';
+      throw new Error('square root of negative numbers is not supported');
     }
 
     if (this.lt(new Fract(2n))) {
modifiedtests/src/collator-selection/collatorSelection.seqtest.tsdiffbeforeafterboth
--- a/tests/src/collator-selection/collatorSelection.seqtest.ts
+++ b/tests/src/collator-selection/collatorSelection.seqtest.ts
@@ -31,8 +31,8 @@
       // In case there are too many invulnerables already, remove some of them, leaving space for Alice and Bob.
       if (invulnerables.length + 2 >= helper.collatorSelection.maxCollators()) {
         await Promise.all([
-          helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [invulnerables.pop()], true, {nonce: nonce++}),
-          helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [invulnerables.pop()], true, {nonce: nonce++}),
+          helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [invulnerables.pop()!], true, {nonce: nonce++}),
+          helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.removeInvulnerable', [invulnerables.pop()!], true, {nonce: nonce++}),
         ]);
       }
 
@@ -465,4 +465,4 @@
         helper.getSudo().executeExtrinsic(superuser, 'api.tx.collatorSelection.forceReleaseLicense', [candidate], true, {nonce: nonce++})));
     });
   });
-});
\ No newline at end of file
+});
modifiedtests/src/collator-selection/identity.seqtest.tsdiffbeforeafterboth
--- a/tests/src/collator-selection/identity.seqtest.ts
+++ b/tests/src/collator-selection/identity.seqtest.ts
@@ -51,7 +51,7 @@
 
   itSub('Normal calls do not work', async ({helper}) => {
     // console.error = () => {};
-    await expect(helper.executeExtrinsic(superuser, 'api.tx.identity.setIdentity', [{info: {display: {Raw: 'Meowser'}}}]))
+    await expect(helper.executeExtrinsic(superuser, 'api.tx.identity.setIdentity', [{info: {display: {Raw: 'Meowser'}}}] as any))
       .to.be.rejectedWith(/Transaction call is not expected/);
   });
 
@@ -62,7 +62,7 @@
       const crowdSize = 10;
       const crowd = await helper.arrange.createCrowd(crowdSize, 0n, superuser);
       const identities = crowd.map((acc, i) => [acc.address, {info: {display: {Raw: `accounter #${i}`}}}]);
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [identities]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [identities] as any);
 
       expect((await getIdentityAccounts(helper)).length).to.be.equal(oldIdentitiesCount + crowdSize);
     });
@@ -73,14 +73,14 @@
 
       // insert a single identity
       let singleIdentity = identities.pop()!;
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [[singleIdentity]]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [[singleIdentity]] as any);
 
       const oldIdentitiesCount = (await getIdentityAccounts(helper)).length;
 
       // change an identity and push it with a few new others
       singleIdentity = [singleIdentity[0], {info: {display: {Raw: 'something special'}}}];
       identities.push(singleIdentity);
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [identities]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [identities] as any);
 
       // oldIdentitiesCount + 9 because one identity is overwritten, not inserted on top
       expect((await getIdentityAccounts(helper)).length).to.be.equal(oldIdentitiesCount + 9);
@@ -91,7 +91,7 @@
     itSub('Removes identities', async ({helper}) => {
       const crowd = await helper.arrange.createCrowd(10, 0n, superuser);
       const identities = crowd.map((acc, i) => [acc.address, {info: {display: {Raw: `accounter #${i}`}}}]);
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [identities]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [identities] as any);
       const oldIdentities = await getIdentityAccounts(helper);
 
       // delete a couple, check that they are no longer there
@@ -124,7 +124,7 @@
           ]),
         ],
       ]);
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo] as any);
 
       for (let i = 0; i < supers.length; i++) {
         // check deposit
@@ -162,7 +162,7 @@
           ]),
         ],
       ]);
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo1]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo1] as any);
 
       // change some sub-identities...
       subs[2].pop(); subs[2].pop(); subs[2].push(...await helper.arrange.createAccounts([0n], superuser));
@@ -176,7 +176,7 @@
           ]),
         ],
       ]];
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo2]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo2] as any);
 
       // make sure everything else is the same
       for (let i = 0; i < supers.length - 1; i++) {
@@ -219,7 +219,7 @@
           ]),
         ],
       ]];
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo1]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo1] as any);
 
       // empty sub-identities should delete the records
       const subsInfo2 = [[
@@ -228,7 +228,7 @@
           [],
         ],
       ]];
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo2]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo2] as any);
 
       // check deposit
       expect((await helper.getApi().query.identity.subsOf(sup.address)).toHuman()).to.be.deep.equal(['0', []]);
@@ -245,7 +245,7 @@
 
       // insert identity
       const identities = [[sup.address, {info: {display: {Raw: 'mental'}}}]];
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [identities]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceInsertIdentities', [identities] as any);
 
       // and its sub-identities
       const subsInfo = [[
@@ -256,7 +256,7 @@
           ]),
         ],
       ]];
-      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo]);
+      await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceSetSubs', [subsInfo] as any);
 
       // delete top identity
       await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.forceRemoveIdentities', [[sup.address]]);
modifiedtests/src/creditFeesToTreasury.seqtest.tsdiffbeforeafterboth
--- a/tests/src/creditFeesToTreasury.seqtest.ts
+++ b/tests/src/creditFeesToTreasury.seqtest.ts
@@ -88,14 +88,14 @@
     expect(treasuryIncrease).to.be.equal(fee);
   });
 
-  itSub('Treasury balance increased by failed tx fee', async ({helper}) => {
+  itSub.only('Treasury balance increased by failed tx fee', async ({helper}) => {
     const api = helper.getApi();
     await helper.wait.newBlocks(1);
 
     const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
     const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
 
-    await expect(helper.signTransaction(bob, api.tx.balances.setBalance(alice.address, 0, 0))).to.be.rejected;
+    await expect(helper.signTransaction(bob, api.tx.balances.forceSetBalance(alice.address, 0))).to.be.rejected;
 
     const treasuryBalanceAfter = await helper.balance.getSubstrate(TREASURY);
     const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
modifiedtests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -18,7 +18,7 @@
 import {Pallets, requirePalletsOrSkip, usingPlaygrounds} from '../util/index';
 import {itEth, expect} from './util';
 
-describe('evm nft collection sponsoring', () => {
+describe.only('evm nft collection sponsoring', () => {
   let donor: IKeyringPair;
   let alice: IKeyringPair;
   let nominal: bigint;
@@ -319,7 +319,7 @@
   });
 });
 
-describe('evm RFT collection sponsoring', () => {
+describe.only('evm RFT collection sponsoring', () => {
   let donor: IKeyringPair;
   let alice: IKeyringPair;
   let nominal: bigint;
@@ -592,6 +592,7 @@
         tokenId: '1',
       },
     });
+    // FIXME: doesn't work
     expect(await collectionEvm.methods.tokenURI(tokenId).call({from: user})).to.be.equal('Test URI');
 
     const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
modifiedtests/src/eth/createFTCollection.seqtest.tsdiffbeforeafterboth
--- a/tests/src/eth/createFTCollection.seqtest.ts
+++ b/tests/src/eth/createFTCollection.seqtest.ts
@@ -20,7 +20,7 @@
 
 const DECIMALS = 18;
 
-describe('Create FT collection from EVM', () => {
+describe.only('Create FT collection from EVM', () => {
   let donor: IKeyringPair;
 
   before(async function() {
modifiedtests/src/eth/createFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createFTCollection.test.ts
+++ b/tests/src/eth/createFTCollection.test.ts
@@ -22,7 +22,7 @@
 
 const DECIMALS = 18;
 
-describe('Create FT collection from EVM', () => {
+describe.only('Create FT collection from EVM', () => {
   let donor: IKeyringPair;
 
   before(async function() {
@@ -129,7 +129,7 @@
   });
 });
 
-describe('(!negative tests!) Create FT collection from EVM', () => {
+describe.only('(!negative tests!) Create FT collection from EVM', () => {
   let donor: IKeyringPair;
   let nominal: bigint;
 
modifiedtests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -21,7 +21,7 @@
 import {COLLECTION_HELPER} from '../util';
 
 
-describe('Create NFT collection from EVM', () => {
+describe.only('Create NFT collection from EVM', () => {
   let donor: IKeyringPair;
 
   before(async function () {
@@ -143,7 +143,7 @@
   });
 });
 
-describe('(!negative tests!) Create NFT collection from EVM', () => {
+describe.only('(!negative tests!) Create NFT collection from EVM', () => {
   let donor: IKeyringPair;
   let nominal: bigint;
 
@@ -199,7 +199,8 @@
   // Soft-deprecated
   itEth('(!negative test!) [eth] Check owner', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
-    const malfeasant = helper.eth.createAccount();
+    // FIXME: do not give balance
+    const malfeasant = await helper.eth.createAccountWithBalance(donor);
     const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'Transgressed', 'absolutely anything', 'COR');
     const malfeasantCollection = await helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant, true);
     const EXPECTED_ERROR = 'NoPermission';
modifiedtests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth
--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -21,7 +21,7 @@
 import {CollectionLimitField} from './util/playgrounds/types';
 
 
-describe('Create RFT collection from EVM', () => {
+describe.only('Create RFT collection from EVM', () => {
   let donor: IKeyringPair;
 
   before(async function() {
@@ -63,7 +63,8 @@
     const baseUri = 'BaseURI';
 
     const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, name, description, prefix, baseUri);
-    const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft');
+    // FIXME: caller is not needed
+    const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
 
     const collection = helper.rft.getCollectionObject(collectionId);
     const data = (await collection.getData())!;
@@ -153,7 +154,7 @@
   });
 });
 
-describe('(!negative tests!) Create RFT collection from EVM', () => {
+describe.only('(!negative tests!) Create RFT collection from EVM', () => {
   let donor: IKeyringPair;
   let nominal: bigint;
 
modifiedtests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fractionalizer/fractionalizer.test.ts
+++ b/tests/src/eth/fractionalizer/fractionalizer.test.ts
@@ -80,7 +80,7 @@
 };
 
 
-describe('Fractionalizer contract usage', () => {
+describe.only('Fractionalizer contract usage', () => {
   let donor: IKeyringPair;
 
   before(async function() {
@@ -91,7 +91,7 @@
   });
 
   itEth('Set RFT collection', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 10n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const fractionalizer = await deployContract(helper, owner);
     const rftCollection = await helper.eth.createRFTCollection(owner, 'rft', 'RFT collection', 'RFT');
     const rftContract = await helper.ethNativeContract.collection(rftCollection.collectionAddress, 'rft', owner);
@@ -109,7 +109,7 @@
   });
 
   itEth('Mint RFT collection', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 10n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const fractionalizer = await deployContract(helper, owner);
     await helper.balance.transferToSubstrate(donor, evmToAddress(fractionalizer.options.address), 10n * helper.balance.getOneTokenNominal());
 
@@ -121,7 +121,7 @@
   });
 
   itEth('Set Allowlist', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const {contract: fractionalizer} = await initContract(helper, owner);
     const nftCollection = await helper.eth.createNFTCollection(owner, 'nft', 'NFT collection', 'NFT');
 
@@ -146,7 +146,7 @@
   });
 
   itEth('NFT to RFT', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
 
     const nftCollection = await helper.eth.createNFTCollection(owner, 'nft', 'NFT collection', 'NFT');
     const nftContract = await helper.ethNativeContract.collection(nftCollection.collectionAddress, 'nft', owner);
@@ -169,12 +169,13 @@
     });
     const rftTokenAddress = result.events.Fractionalized.returnValues._rftToken;
 
-    const rftTokenContract = await helper.ethNativeContract.rftToken(rftTokenAddress);
+    // FIXME: should work without the caller
+    const rftTokenContract = await helper.ethNativeContract.rftToken(rftTokenAddress, owner);
     expect(await rftTokenContract.methods.balanceOf(owner).call()).to.equal('100');
   });
 
   itEth('RFT to NFT', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 30n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
 
     const {contract: fractionalizer, rftCollectionAddress} = await initContract(helper, owner);
     const {rftTokenAddress, nftCollectionAddress, nftTokenId} = await mintRFTToken(helper, owner, fractionalizer, 100n);
@@ -197,7 +198,7 @@
   });
 
   itEth('Test fractionalizer NFT <-> RFT mapping ', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 200n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
 
     const {contract: fractionalizer, rftCollectionAddress} = await initContract(helper, owner);
     const {rftTokenAddress, nftCollectionAddress, nftTokenId} = await mintRFTToken(helper, owner, fractionalizer, 100n);
@@ -232,7 +233,7 @@
   });
 
   itEth('call setRFTCollection twice', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const rftCollection = await helper.eth.createRFTCollection(owner, 'rft', 'RFT collection', 'RFT');
     const refungibleContract = await helper.ethNativeContract.collection(rftCollection.collectionAddress, 'rft', owner);
 
@@ -246,7 +247,7 @@
   });
 
   itEth('call setRFTCollection with NFT collection', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const nftCollection = await helper.eth.createNFTCollection(owner, 'nft', 'NFT collection', 'NFT');
     const nftContract = await helper.ethNativeContract.collection(nftCollection.collectionAddress, 'nft', owner);
 
@@ -259,7 +260,7 @@
   });
 
   itEth('call setRFTCollection while not collection admin', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const fractionalizer = await deployContract(helper, owner);
     const rftCollection = await helper.eth.createRFTCollection(owner, 'rft', 'RFT collection', 'RFT');
 
@@ -268,7 +269,7 @@
   });
 
   itEth('call setRFTCollection after createAndSetRFTCollection', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const fractionalizer = await deployContract(helper, owner);
     await helper.balance.transferToSubstrate(donor, evmToAddress(fractionalizer.options.address), 10n * helper.balance.getOneTokenNominal());
 
@@ -280,7 +281,7 @@
   });
 
   itEth('call nft2rft without setting RFT collection for contract', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
 
     const nftCollection = await helper.eth.createNFTCollection(owner, 'nft', 'NFT collection', 'NFT');
     const nftContract = await helper.ethNativeContract.collection(nftCollection.collectionAddress, 'nft', owner);
@@ -294,8 +295,8 @@
   });
 
   itEth('call nft2rft while not owner of NFT token', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
-    const nftOwner = await helper.eth.createAccountWithBalance(donor, 10n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const nftOwner = await helper.eth.createAccountWithBalance(donor);
 
     const nftCollection = await helper.eth.createNFTCollection(owner, 'nft', 'NFT collection', 'NFT');
     const nftContract = await helper.ethNativeContract.collection(nftCollection.collectionAddress, 'nft', owner);
@@ -312,7 +313,7 @@
   });
 
   itEth('call nft2rft while not in list of allowed accounts', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
 
     const nftCollection = await helper.eth.createNFTCollection(owner, 'nft', 'NFT collection', 'NFT');
     const nftContract = await helper.ethNativeContract.collection(nftCollection.collectionAddress, 'nft', owner);
@@ -327,7 +328,7 @@
   });
 
   itEth('call nft2rft while fractionalizer doesnt have approval for nft token', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
 
     const nftCollection = await helper.eth.createNFTCollection(owner, 'nft', 'NFT collection', 'NFT');
     const nftContract = await helper.ethNativeContract.collection(nftCollection.collectionAddress, 'nft', owner);
@@ -342,7 +343,7 @@
   });
 
   itEth('call rft2nft without setting RFT collection for contract', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
 
     const fractionalizer = await deployContract(helper, owner);
     const rftCollection = await helper.eth.createRFTCollection(owner, 'rft', 'RFT collection', 'RFT');
@@ -355,7 +356,7 @@
   });
 
   itEth('call rft2nft for RFT token that is not from configured RFT collection', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
 
     const {contract: fractionalizer} = await initContract(helper, owner);
     const rftCollection = await helper.eth.createRFTCollection(owner, 'rft', 'RFT collection', 'RFT');
@@ -368,7 +369,7 @@
   });
 
   itEth('call rft2nft for RFT token that was not minted by fractionalizer contract', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const rftCollection = await helper.eth.createRFTCollection(owner, 'rft', 'RFT collection', 'RFT');
     const refungibleContract = await helper.ethNativeContract.collection(rftCollection.collectionAddress, 'rft', owner);
 
@@ -386,8 +387,8 @@
   });
 
   itEth('call rft2nft without owning all RFT pieces', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 200n);
-    const receiver = await helper.eth.createAccountWithBalance(donor, 10n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const receiver = await helper.eth.createAccountWithBalance(donor);
 
     const {contract: fractionalizer, rftCollectionAddress} = await initContract(helper, owner);
     const {rftTokenAddress} = await mintRFTToken(helper, owner, fractionalizer, 100n);
@@ -401,8 +402,8 @@
   });
 
   itEth('send QTZ/UNQ to contract from non owner', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
-    const payer = await helper.eth.createAccountWithBalance(donor, 10n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const payer = await helper.eth.createAccountWithBalance(donor);
 
     const fractionalizer = await deployContract(helper, owner);
     const amount = 10n * helper.balance.getOneTokenNominal();
@@ -413,7 +414,7 @@
   itEth('fractionalize NFT with NFT transfers disallowed', async ({helper}) => {
     const nftCollection = await helper.nft.mintCollection(donor, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const nftToken = await nftCollection.mintToken(donor, {Ethereum: owner});
     await helper.executeExtrinsic(donor, 'api.tx.unique.setTransfersEnabledFlag', [nftCollection.collectionId, false], true);
     const nftCollectionAddress = helper.ethAddress.fromCollectionId(nftCollection.collectionId);
@@ -427,7 +428,7 @@
   });
 
   itEth('fractionalize NFT with RFT transfers disallowed', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 20n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
 
     const rftCollection = await helper.rft.mintCollection(donor, {name: 'A', description: 'B', tokenPrefix: 'C'});
     const rftCollectionAddress = helper.ethAddress.fromCollectionId(rftCollection.collectionId);
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -205,7 +205,7 @@
 
 
   itEth('Can perform burnFromCross()', async ({helper}) => {
-    const sender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const sender = await helper.eth.createAccountWithBalance(donor);
 
     const collection = await helper.ft.mintCollection(owner, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
 
@@ -382,7 +382,7 @@
   });
 
   itEth('Can perform transferFromCross()', async ({helper}) => {
-    const sender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const sender = await helper.eth.createAccountWithBalance(donor);
 
     const collection = await helper.ft.mintCollection(owner, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
 
@@ -603,7 +603,7 @@
   });
 
   itEth('Events emitted for transferFromCross()', async ({helper}) => {
-    const sender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const sender = await helper.eth.createAccountWithBalance(donor);
 
     const collection = await helper.ft.mintCollection(owner, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
 
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -303,7 +303,7 @@
     const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
     const owner = await helper.eth.createAccountWithBalance(donor);
-    const operator = await helper.eth.createAccountWithBalance(donor, 100n);
+    const operator = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(minter, {Ethereum: owner});
 
@@ -366,10 +366,10 @@
     const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
     const ownerSub = bob;
     const ownerCrossSub = helper.ethCrossAccount.fromKeyringPair(ownerSub);
-    const ownerEth = await helper.eth.createAccountWithBalance(donor, 100n);
+    const ownerEth = await helper.eth.createAccountWithBalance(donor);
     const ownerCrossEth = helper.ethCrossAccount.fromAddress(ownerEth);
 
-    const burnerEth = await helper.eth.createAccountWithBalance(donor, 100n);
+    const burnerEth = await helper.eth.createAccountWithBalance(donor);
     const burnerCrossEth = helper.ethCrossAccount.fromAddress(burnerEth);
 
     const token1 = await collection.mintToken(minter, {Substrate: ownerSub.address});
@@ -411,11 +411,11 @@
   // TODO combine all approve tests in one place
   itEth('Can perform approveCross()', async ({helper}) => {
     // arrange: create accounts
-    const owner = await helper.eth.createAccountWithBalance(donor, 100n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const ownerCross = helper.ethCrossAccount.fromAddress(owner);
     const receiverSub = charlie;
     const recieverCrossSub = helper.ethCrossAccount.fromKeyringPair(receiverSub);
-    const receiverEth = await helper.eth.createAccountWithBalance(donor, 100n);
+    const receiverEth = await helper.eth.createAccountWithBalance(donor);
     const receiverCrossEth = helper.ethCrossAccount.fromAddress(receiverEth);
 
     // arrange: create collection and tokens:
@@ -469,7 +469,7 @@
   });
 
   itEth('Can reaffirm approved address', async ({helper}) => {
-    const owner = await helper.eth.createAccountWithBalance(donor, 100n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const ownerCrossEth = helper.ethCrossAccount.fromAddress(owner);
     const [receiver1, receiver2] = await helper.arrange.createAccounts([100n, 100n], donor);
     const receiver1Cross = helper.ethCrossAccount.fromKeyringPair(receiver1);
@@ -743,7 +743,7 @@
     const receiver = charlie;
     const collection = await helper.nft.mintCollection(collectionMinter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const spender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const spender = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(collectionMinter, {Substrate: owner.address});
 
@@ -929,7 +929,8 @@
     });
   });
 
-  itEth('Returns collection name', async ({helper}) => {
+  itEth.only('Returns collection name', async ({helper}) => {
+    // FIXME: should not have balance to use .call()
     const caller = await helper.eth.createAccountWithBalance(donor);
     const tokenPropertyPermissions = [{
       key: 'URI',
@@ -995,8 +996,8 @@
   itEth('[negative] Cant perform burn without approval', async ({helper}) => {
     const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const owner = await helper.eth.createAccountWithBalance(donor, 100n);
-    const spender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const spender = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(minter, {Ethereum: owner});
 
@@ -1016,8 +1017,8 @@
     const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
     const receiver = alice;
 
-    const owner = await helper.eth.createAccountWithBalance(donor, 100n);
-    const spender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const spender = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(minter, {Ethereum: owner});
 
modifiedtests/src/eth/payable.test.tsdiffbeforeafterboth
--- a/tests/src/eth/payable.test.ts
+++ b/tests/src/eth/payable.test.ts
@@ -41,10 +41,10 @@
     expect(await contract.methods.getCollected().call()).to.be.equal('10000');
   });
 
-  itEth('Evm contract can receive wei from substrate account', async ({helper}) => {
+  itEth.only('Evm contract can receive wei from substrate account', async ({helper}) => {
     const deployer = await helper.eth.createAccountWithBalance(donor);
     const contract = await helper.eth.deployCollectorContract(deployer);
-    const [alice] = await helper.arrange.createAccounts([10n], donor);
+    const [alice] = await helper.arrange.createAccounts([40n], donor);
 
     const weiCount = '10000';
 
modifiedtests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth
--- a/tests/src/eth/proxy/nonFungibleProxy.test.ts
+++ b/tests/src/eth/proxy/nonFungibleProxy.test.ts
@@ -178,7 +178,7 @@
   itEth.skip('Can perform mintBulk()', async ({helper}) => {
     const collection = await helper.nft.mintCollection(donor, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});
 
-    const caller = await helper.eth.createAccountWithBalance(donor, 30n);
+    const caller = await helper.eth.createAccountWithBalance(donor);
     const receiver = helper.eth.createAccount();
 
     const address = helper.ethAddress.fromCollectionId(collection.collectionId);
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -177,7 +177,7 @@
     const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
     const owner = await helper.eth.createAccountWithBalance(donor);
-    const operator = await helper.eth.createAccountWithBalance(donor, 100n);
+    const operator = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(minter, 100n, {Ethereum: owner});
 
@@ -206,7 +206,7 @@
     const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
     const owner = await helper.eth.createAccountWithBalance(donor);
-    const operator = await helper.eth.createAccountWithBalance(donor, 100n);
+    const operator = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(minter, 100n, {Ethereum: owner});
 
@@ -331,8 +331,8 @@
   itEth('Can perform burnFrom()', async ({helper}) => {
     const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const owner = await helper.eth.createAccountWithBalance(donor, 100n);
-    const spender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const spender = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(minter, 100n, {Ethereum: owner});
 
@@ -365,7 +365,7 @@
     const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
     const owner = bob;
-    const spender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const spender = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(minter, 100n, {Substrate: owner.address});
 
@@ -397,7 +397,7 @@
     const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
     const owner = bob;
-    const spender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const spender = await helper.eth.createAccountWithBalance(donor);
     const receiver = charlie;
 
     const token = await collection.mintToken(minter, 100n, {Substrate: owner.address});
@@ -679,8 +679,9 @@
     });
   });
 
-  itEth('Returns collection name', async ({helper}) => {
-    const caller = helper.eth.createAccount();
+  itEth.only('Returns collection name', async ({helper}) => {
+    // FIXME: should not have balance to use .call()
+    const caller = await helper.eth.createAccountWithBalance(alice);
     const tokenPropertyPermissions = [{
       key: 'URI',
       permission: {
@@ -747,8 +748,8 @@
   itEth('[negative] Cant perform burn without approval', async ({helper}) => {
     const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const owner = await helper.eth.createAccountWithBalance(donor, 100n);
-    const spender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const spender = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(minter, 100n, {Ethereum: owner});
 
@@ -767,10 +768,10 @@
 
   itEth('[negative] Cant perform transfer without approval', async ({helper}) => {
     const collection = await helper.rft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
-    const owner = await helper.eth.createAccountWithBalance(donor, 100n);
+    const owner = await helper.eth.createAccountWithBalance(donor);
     const receiver = alice;
 
-    const spender = await helper.eth.createAccountWithBalance(donor, 100n);
+    const spender = await helper.eth.createAccountWithBalance(donor);
 
     const token = await collection.mintToken(minter, 100n, {Ethereum: owner});
 
modifiedtests/src/eth/tokenProperties.test.tsdiffbeforeafterboth
--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -29,7 +29,7 @@
   before(async function() {
     await usingEthPlaygrounds(async (helper, privateKey) => {
       donor = await privateKey({url: import.meta.url});
-      [alice] = await helper.arrange.createAccounts([100n], donor);
+      [alice] = await helper.arrange.createAccounts([1000n], donor);
     });
   });
 
@@ -314,8 +314,9 @@
       expect(result.length).to.equal(0);
     }));
 
-  itEth('Can be read', async({helper}) => {
-    const caller = helper.eth.createAccount();
+  itEth.only('Can be read', async({helper}) => {
+    // FIXME: User with no balance should be able to call
+    const caller = await helper.eth.createAccountWithBalance(alice);
     const collection = await helper.nft.mintCollection(alice, {
       tokenPropertyPermissions: [{
         key: 'testKey',
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -49,43 +49,20 @@
   }
 }
 
-function unlimitedMoneyHack<C>(_contract: C): C {
-  const contract = _contract as any;
-  // Hack: fight against gasPrice override
-  for (const method in contract.methods) {
-    const _method = contract.methods[method];
-    contract.methods[method] = function (...args: any) {
-      const encodedCall = _method.call(this, ...args);
-      const _call = encodedCall.call;
-      encodedCall.call = function (...args: any) {
-        if (args.length === 0) {
-          return _call.call(this, {gasPrice: '0'});
-        }
-        // No support for callback/defaultBlock, they may be placed as first argument
-        if (typeof args[0] !== 'object')
-          throw new Error('only options are supported');
-        args[0].gasPrice = '0';
-        return _call.call(this, ...args);
-      };
-      return encodedCall;
-    };
-  }
-  return contract;
-}
 
 class ContractGroup extends EthGroupBase {
-  async findImports(imports?: ContractImports[]){
-    if(!imports) return function(path: string) {
+  async findImports(imports?: ContractImports[]) {
+    if (!imports) return function(path: string) {
       return {error: `File not found: ${path}`};
     };
 
-    const knownImports = {} as {[key: string]: string};
-    for(const imp of imports) {
+    const knownImports = {} as { [key: string]: string };
+    for (const imp of imports) {
       knownImports[imp.solPath] = (await readFile(imp.fsPath)).toString();
     }
 
     return function(path: string) {
-      if(path in knownImports) return {contents: knownImports[path]};
+      if (path in knownImports) return {contents: knownImports[path]};
       return {error: `File not found: ${path}`};
     };
   }
@@ -137,7 +114,7 @@
       gas: gas ?? this.helper.eth.DEFAULT_GAS,
       gasPrice: await this.getGasPrice(),
     });
-    return unlimitedMoneyHack(await contract.deploy({data: object}).send({from: signer}));
+    return await contract.deploy({data: object}).send({from: signer});
   }
 
 }
@@ -146,20 +123,20 @@
 
   async contractHelpers(caller: string): Promise<Contract> {
     const web3 = this.helper.getWeb3();
-    return unlimitedMoneyHack(new web3.eth.Contract(contractHelpersAbi as any, this.helper.getApi().consts.evmContractHelpers.contractAddress.toString(), {
+    return new web3.eth.Contract(contractHelpersAbi as any, this.helper.getApi().consts.evmContractHelpers.contractAddress.toString(), {
       from: caller,
       gas: this.helper.eth.DEFAULT_GAS,
       gasPrice: await this.getGasPrice(),
-    }));
+    });
   }
 
   async collectionHelpers(caller: string) {
     const web3 = this.helper.getWeb3();
-    return unlimitedMoneyHack(new web3.eth.Contract(collectionHelpersAbi as any, this.helper.getApi().consts.common.contractAddress.toString(), {
+    return new web3.eth.Contract(collectionHelpersAbi as any, this.helper.getApi().consts.common.contractAddress.toString(), {
       from: caller,
       gas: this.helper.eth.DEFAULT_GAS,
       gasPrice: await this.getGasPrice(),
-    }));
+    });
   }
 
   async collection(address: string, mode: TCollectionMode, caller?: string, mergeDeprecated = false) {
@@ -174,14 +151,14 @@
         'rft': refungibleDeprecatedAbi,
         'ft': fungibleDeprecatedAbi,
       }[mode];
-      abi = [...abi,...deprecated];
+      abi = [...abi, ...deprecated];
     }
     const web3 = this.helper.getWeb3();
-    return unlimitedMoneyHack(new web3.eth.Contract(abi as any, address, {
+    return new web3.eth.Contract(abi as any, address, {
       gas: this.helper.eth.DEFAULT_GAS,
       gasPrice: await this.getGasPrice(),
       ...(caller ? {from: caller} : {}),
-    }));
+    });
   }
 
   collectionById(collectionId: number, mode: 'nft' | 'rft' | 'ft', caller?: string, mergeDeprecated = false) {
@@ -191,11 +168,11 @@
   async rftToken(address: string, caller?: string, mergeDeprecated = false) {
     const web3 = this.helper.getWeb3();
     const abi = mergeDeprecated ? [...refungibleTokenAbi, ...refungibleTokenDeprecatedAbi] : refungibleTokenAbi;
-    return unlimitedMoneyHack(new web3.eth.Contract(abi as any, address, {
+    return new web3.eth.Contract(abi as any, address, {
       gas: this.helper.eth.DEFAULT_GAS,
       gasPrice: await this.getGasPrice(),
       ...(caller ? {from: caller} : {}),
-    }));
+    });
   }
 
   rftTokenById(collectionId: number, tokenId: number, caller?: string, mergeDeprecated = false) {
@@ -214,14 +191,14 @@
     return account.address;
   }
 
-  async createAccountWithBalance(donor: IKeyringPair, amount=100n) {
+  async createAccountWithBalance(donor: IKeyringPair, amount = 600n) {
     const account = this.createAccount();
     await this.transferBalanceFromSubstrate(donor, account, amount);
 
     return account;
   }
 
-  async transferBalanceFromSubstrate(donor: IKeyringPair, recepient: string, amount=100n, inTokens=true) {
+  async transferBalanceFromSubstrate(donor: IKeyringPair, recepient: string, amount = 100n, inTokens = true) {
     return await this.helper.balance.transferToSubstrate(donor, evmToAddress(recepient), amount * (inTokens ? this.helper.balance.getOneTokenNominal() : 1n));
   }
 
@@ -231,7 +208,7 @@
   }
 
   async sendEVM(signer: IKeyringPair, contractAddress: string, abi: string, value: string, gasLimit?: number) {
-    if(!gasLimit) gasLimit = this.DEFAULT_GAS;
+    if (!gasLimit) gasLimit = this.DEFAULT_GAS;
     const web3 = this.helper.getWeb3();
     const gasPrice = await web3.eth.getGasPrice();
     // TODO: check execution status
@@ -277,7 +254,7 @@
     return this.createCollection('nft', signer, name, description, tokenPrefix);
   }
 
-  async createERC721MetadataCompatibleNFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
+  async createERC721MetadataCompatibleNFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
     const collectionHelper = await this.helper.ethNativeContract.collectionHelpers(signer);
 
     const {collectionId, collectionAddress, events} = await this.createCollection('nft', signer, name, description, tokenPrefix);
@@ -287,15 +264,15 @@
     return {collectionId, collectionAddress, events};
   }
 
-  createRFTCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string, events: NormalizedEvent[]}> {
+  createRFTCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
     return this.createCollection('rft', signer, name, description, tokenPrefix);
   }
 
-  createFungibleCollection(signer: string, name: string, decimals: number, description: string, tokenPrefix: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[]}> {
+  createFungibleCollection(signer: string, name: string, decimals: number, description: string, tokenPrefix: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
     return this.createCollection('ft', signer, name, description, tokenPrefix, decimals);
   }
 
-  async createERC721MetadataCompatibleRFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
+  async createERC721MetadataCompatibleRFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {
     const collectionHelper = await this.helper.ethNativeContract.collectionHelpers(signer);
 
     const {collectionId, collectionAddress, events} = await this.createCollection('rft', signer, name, description, tokenPrefix);
@@ -408,7 +385,7 @@
     return Web3.utils.toChecksumAddress(`0x17c4e6453cc49aaaaeaca894e6d9683e${collectionId.toString(16).padStart(8, '0')}`);
   }
 
-  extractTokenId(address: string): {collectionId: number, tokenId: number} {
+  extractTokenId(address: string): { collectionId: number, tokenId: number } {
     if (!address.startsWith('0x'))
       throw 'address not starts with "0x"';
     if (address.length > 42)
@@ -419,7 +396,7 @@
     };
   }
 
-  fromTokenId(collectionId: number, tokenId: number): string  {
+  fromTokenId(collectionId: number, tokenId: number): string {
     return this.helper.util.getTokenAddress({collectionId, tokenId});
   }
 
@@ -431,7 +408,7 @@
   property(key: string, value: string): EthProperty {
     return [
       key,
-      '0x'+Buffer.from(value).toString('hex'),
+      '0x' + Buffer.from(value).toString('hex'),
     ];
   }
 }
@@ -442,7 +419,7 @@
     return this.fromAddress(this.helper.eth.createAccount());
   }
 
-  async createAccountWithBalance(donor: IKeyringPair, amount=100n) {
+  async createAccountWithBalance(donor: IKeyringPair, amount = 100n) {
     return this.fromAddress(await this.helper.eth.createAccountWithBalance(donor, amount));
   }
 
@@ -507,7 +484,7 @@
   ethContract: ContractGroup;
   ethProperty: EthPropertyGroup;
   arrange: EthArrangeGroup;
-  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {
+  constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: { [key: string]: any } = {}) {
     options.helperBase = options.helperBase ?? EthUniqueHelper;
 
     super(logger, options);
@@ -522,18 +499,18 @@
   }
 
   getWeb3(): Web3 {
-    if(this.web3 === null) throw Error('Web3 not connected');
+    if (this.web3 === null) throw Error('Web3 not connected');
     return this.web3;
   }
 
   connectWeb3(wsEndpoint: string) {
-    if(this.web3 !== null) return;
+    if (this.web3 !== null) return;
     this.web3Provider = new Web3.providers.WebsocketProvider(wsEndpoint);
     this.web3 = new Web3(this.web3Provider);
   }
 
   async disconnect() {
-    if(this.web3 === null) return;
+    if (this.web3 === null) return;
     this.web3Provider?.connection.close();
 
     await super.disconnect();
modifiedtests/src/maintenance.seqtest.tsdiffbeforeafterboth
--- a/tests/src/maintenance.seqtest.ts
+++ b/tests/src/maintenance.seqtest.ts
@@ -70,11 +70,13 @@
     itSub('MM blocks unique pallet calls', async ({helper}) => {
       // Can create an NFT collection before enabling the MM
       const nftCollection = await helper.nft.mintCollection(bob, {
-        tokenPropertyPermissions: [{key: 'test', permission: {
-          collectionAdmin: true,
-          tokenOwner: true,
-          mutable: true,
-        }}],
+        tokenPropertyPermissions: [{
+          key: 'test', permission: {
+            collectionAdmin: true,
+            tokenOwner: true,
+            mutable: true,
+          },
+        }],
       });
 
       // Can mint an NFT before enabling the MM
@@ -323,7 +325,7 @@
       expect(await helper.preimage.getPreimageInfo(preimageHashes[0])).to.have.property('unrequested');
     });
 
-    itSub('Does not allow execution of a preimage that would fail', async ({helper}) => {
+    itSub.only('Does not allow execution of a preimage that would fail', async ({helper}) => {
       const [zeroAccount] = await helper.arrange.createAccounts([0n], superuser);
 
       const preimage = helper.constructApiCall('api.tx.balances.forceTransfer', [
@@ -334,7 +336,7 @@
 
       await expect(helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.executePreimage', [
         preimageHash, {refTime: 10000000000, proofSize: 10000},
-      ])).to.be.rejectedWith(/balances\.InsufficientBalance/);
+      ])).to.be.rejectedWith(/^Token: FundsUnavailable$/);
     });
 
     itSub('Does not allow preimage execution with non-root', async ({helper}) => {
modifiedtests/src/nesting/tokenProperties.seqtest.tsdiffbeforeafterboth
--- a/tests/src/nesting/tokenProperties.seqtest.ts
+++ b/tests/src/nesting/tokenProperties.seqtest.ts
@@ -30,8 +30,8 @@
   });
 
   [
-    {mode: 'nft' as const, pieces: undefined, requiredPallets: []},
-    {mode: 'rft' as const, pieces: 100n, requiredPallets: [Pallets.ReFungible]},
+    {mode: 'nft' as const, pieces: undefined, requiredPallets: []} as const,
+    {mode: 'rft' as const, pieces: 100n, requiredPallets: [Pallets.ReFungible]} as const,
   ].map(testSuite => describe(`${testSuite.mode.toUpperCase()}`, () => {
     before(async function() {
       // eslint-disable-next-line require-await
@@ -53,7 +53,7 @@
       });
       const token = await (
         testSuite.pieces
-          ? collection.mintToken(alice, testSuite.pieces)
+          ? collection.mintToken(alice, testSuite.pieces as any)
           : collection.mintToken(alice)
       );
 
modifiedtests/src/nesting/tokenProperties.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/tokenProperties.test.ts
+++ b/tests/src/nesting/tokenProperties.test.ts
@@ -46,7 +46,7 @@
       tokenPropertyPermissions: permissions.flatMap(({permission, signers}, i) =>
         signers.map(signer => {return {key: `${i+1}_${signer.address}`, permission};})),
     });
-    return mode == 'NFT' ? [await collection.mintToken(alice), 1n] : [await collection.mintToken(alice, 100n), 100n];
+    return mode == 'NFT' ? [await collection.mintToken(alice), 1n] : [await collection.mintToken(alice, 100n as any), 100n];
   }
 
   async function testReadsYetEmptyProperties(token: UniqueNFToken | UniqueRFToken) {
@@ -322,8 +322,8 @@
   });
 
   [
-    {mode: 'nft' as const, storage: 'nonfungible' as const, pieces: undefined, requiredPallets: []},
-    {mode: 'rft' as const, storage: 'refungible' as const, pieces: 100n, requiredPallets: [Pallets.ReFungible]},
+    {mode: 'nft' as const, storage: 'nonfungible' as const, pieces: undefined, requiredPallets: []} as const,
+    {mode: 'rft' as const, storage: 'refungible' as const, pieces: 100n, requiredPallets: [Pallets.ReFungible]} as const,
   ].map(testCase =>
     itSub.ifWithPallets(`Allows modifying a token property multiple times with the same size (${testCase.mode})`, testCase.requiredPallets, async({helper}) => {
       const propKey = 'tok-prop';
@@ -349,7 +349,7 @@
 
       const token = await (
         testCase.pieces
-          ? collection.mintToken(alice, testCase.pieces)
+          ? collection.mintToken(alice, testCase.pieces as any)
           : collection.mintToken(alice)
       );
 
@@ -386,7 +386,7 @@
       });
       const token = await (
         testCase.pieces
-          ? collection.mintToken(alice, testCase.pieces)
+          ? collection.mintToken(alice, testCase.pieces as any)
           : collection.mintToken(alice)
       );
       const originalSpace = await token.getTokenPropertiesConsumedSpace();
@@ -421,7 +421,7 @@
       });
       const token = await (
         testCase.pieces
-          ? collection.mintToken(alice, testCase.pieces)
+          ? collection.mintToken(alice, testCase.pieces as any)
           : collection.mintToken(alice)
       );
       const originalSpace = await token.getTokenPropertiesConsumedSpace();
@@ -479,7 +479,7 @@
     const collection = await (mode == 'NFT' ? helper.nft : helper.rft).mintCollection(alice, {
       tokenPropertyPermissions: constitution.map(({permission}, i) => {return {key: `${i+1}`, permission};}),
     });
-    return mode == 'NFT' ? [await collection.mintToken(alice), 1n] : [await collection.mintToken(alice, 100n), 100n];
+    return mode == 'NFT' ? [await collection.mintToken(alice), 1n] : [await collection.mintToken(alice, 100n as any), 100n];
   }
 
   async function getConsumedSpace(api: any, collectionId: number, tokenId: number, mode: 'NFT' | 'RFT'): Promise<number> {
@@ -680,7 +680,7 @@
       });
       const token = await (
         testCase.pieces
-          ? collection.mintToken(alice, testCase.pieces)
+          ? collection.mintToken(alice, testCase.pieces as any)
           : collection.mintToken(alice)
       );
 
modifiedtests/src/sub/appPromotion/appPromotion.test.tsdiffbeforeafterboth
--- a/tests/src/sub/appPromotion/appPromotion.test.ts
+++ b/tests/src/sub/appPromotion/appPromotion.test.ts
@@ -86,11 +86,11 @@
       await expect(helper.staking.stake(staker, 100n * nominal - 1n)).to.be.rejected;
       await helper.staking.stake(staker, 100n * nominal);
 
-      // Staker balance is: miscFrozen: 100, feeFrozen: 100, reserved: 0n...
+      // Staker balance is: frozen: 100, reserved: 0n...
       // ...so he can not transfer 900
-      expect(await helper.balance.getSubstrateFull(staker.address)).to.contain({miscFrozen: 100n * nominal, feeFrozen: 100n * nominal, reserved: 0n});
+      expect(await helper.balance.getSubstrateFull(staker.address)).to.contain({frozen: 100n * nominal, reserved: 0n});
       expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'appstake', amount: 100n * nominal, reasons: 'All'}]);
-      await expect(helper.balance.transferToSubstrate(staker, recepient.address, 900n * nominal)).to.be.rejectedWith('balances.LiquidityRestrictions');
+      await expect(helper.balance.transferToSubstrate(staker, recepient.address, 900n * nominal)).to.be.rejectedWith(/^Token: Frozen$/);
 
       expect(await helper.staking.getTotalStaked({Substrate: staker.address})).to.be.equal(100n * nominal);
       expect(await helper.balance.getSubstrate(staker.address) / nominal).to.be.equal(999n);
@@ -151,14 +151,14 @@
       // staker has tokens locked with vesting id:
       await helper.balance.vestedTransfer(donor, staker.address, {start: 0n, period: 1n, periodCount: 1n, perPeriod: 200n * nominal});
       expect(await helper.balance.getSubstrateFull(staker.address))
-        .to.deep.contain({free: 1200n * nominal, miscFrozen: 200n * nominal, feeFrozen: 200n * nominal, reserved: 0n});
+        .to.deep.contain({free: 1200n * nominal, frozen: 200n * nominal, reserved: 0n});
 
       // Locked balance can be staked. staker can stake 1200 tokens (minus fee):
       await helper.staking.stake(staker, 1000n * nominal);
       await helper.staking.stake(staker, 199n * nominal);
       // check balances
       expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'ormlvest', amount: 200n * nominal, reasons: 'All'}, {id: 'appstake', amount: 1199n * nominal, reasons: 'All'}]);
-      expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, miscFrozen: 1199n * nominal, feeFrozen: 1199n * nominal});
+      expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, frozen: 1199n * nominal});
       expect(await helper.balance.getSubstrate(staker.address) / nominal).to.eq(1199n);
       expect(await helper.staking.getTotalStaked({Substrate: staker.address})).to.eq(1199n * nominal);
 
@@ -170,7 +170,7 @@
 
       // check balances
       expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'ormlvest', amount: 200n * nominal, reasons: 'All'}]);
-      expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, miscFrozen: 200n * nominal, feeFrozen: 200n * nominal});
+      expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, frozen: 200n * nominal});
       expect(await helper.balance.getSubstrate(staker.address) / nominal).to.eq(1199n);
       expect(await helper.staking.getTotalStaked({Substrate: staker.address})).to.eq(0n);
 
@@ -219,9 +219,9 @@
         // Right after unstake tokens are still locked
         expect(await helper.staking.getStakesNumber({Substrate: staker.address})).to.eq(0);
         expect(await helper.balance.getLocked(staker.address)).to.deep.eq([{id: 'appstake', amount: STAKE_AMOUNT, reasons: 'All'}]);
-        expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, miscFrozen: STAKE_AMOUNT, feeFrozen: STAKE_AMOUNT});
+        expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, frozen: STAKE_AMOUNT});
         // Staker can not transfer
-        await expect(helper.balance.transferToSubstrate(staker, recepient.address, 100n * nominal)).to.be.rejectedWith('balances.LiquidityRestrictions');
+        await expect(helper.balance.transferToSubstrate(staker, recepient.address, 100n * nominal)).to.be.rejectedWith(/^Token: Frozen$/);
         expect(await helper.staking.getPendingUnstake({Substrate: staker.address})).to.be.equal(STAKE_AMOUNT);
         expect(await helper.staking.getTotalStaked({Substrate: staker.address})).to.be.equal(0n);
         expect(await helper.staking.getTotalStaked()).to.be.equal(totalStakedBefore);
@@ -242,7 +242,7 @@
 
         // Wait for unstaking period. Balance now free ~1000; reserved, frozen, miscFrozeb: 0n
         await helper.wait.forParachainBlockNumber(pendingUnstake.block);
-        expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, miscFrozen: 0n, feeFrozen: 0n});
+        expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, frozen: 0n});
         expect(await helper.balance.getSubstrate(staker.address) / nominal).to.be.equal(999n);
 
         // staker can transfer:
@@ -283,10 +283,10 @@
         expect(stakes).to.be.deep.equal([]);
         expect(pendingUnstake[0].amount).to.equal(600n * nominal);
 
-        expect (await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, feeFrozen: 600n * nominal, miscFrozen: 600n * nominal});
+        expect (await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, frozen: 600n * nominal});
         expect (await helper.balance.getSubstrate(staker.address) / nominal).to.be.equal(999n);
         await helper.wait.forParachainBlockNumber(pendingUnstake[0].block);
-        expect (await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, feeFrozen: 0n, miscFrozen: 0n});
+        expect (await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, frozen: 0n});
         expect (await helper.balance.getSubstrate(staker.address) / nominal).to.be.equal(999n);
       });
     });
@@ -454,7 +454,7 @@
       await helper.wait.forParachainBlockNumber(unstake2.block);
 
       expect(await helper.balance.getLocked(staker.address)).to.deep.eq([]);
-      expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, miscFrozen: 0n, feeFrozen: 0n});
+      expect(await helper.balance.getSubstrateFull(staker.address)).to.deep.contain({reserved: 0n, frozen: 0n});
       expect(await helper.balance.getSubstrate(staker.address) / nominal).to.eq(999n);
       expect(await helper.staking.getTotalStaked({Substrate: staker.address})).to.eq(0n);
       expect(await helper.staking.getPendingUnstake({Substrate: staker.address})).to.eq(0n);
@@ -822,7 +822,7 @@
       expect(totalStakedPerBlock[1].amount).to.equal(income2);
 
       const stakerBalance = await helper.balance.getSubstrateFull(staker.address);
-      expect(stakerBalance).to.contain({miscFrozen: income1 + income2, feeFrozen: income1 + income2, reserved: 0n});
+      expect(stakerBalance).to.contain({frozen: income1 + income2, reserved: 0n});
       expect(stakerBalance.free / nominal).to.eq(999n);
     });
 
@@ -841,7 +841,7 @@
 
       const stakerFullBalance = await helper.balance.getSubstrateFull(staker.address);
 
-      expect(stakerFullBalance).to.contain({reserved: 0n, feeFrozen: frozenBalanceShouldBe, miscFrozen: frozenBalanceShouldBe});
+      expect(stakerFullBalance).to.contain({reserved: 0n, frozen: frozenBalanceShouldBe});
     });
 
     itSub('should not be credited for pending-unstaked tokens', async ({helper}) => {
@@ -923,7 +923,7 @@
       {method: 'unstakeAll' as const},
     ].map(testCase => {
       itSub(testCase.method, async ({helper}) => {
-        const unstakeParams = testCase.method === 'unstakePartial'
+        const unstakeParams: [] | [bigint] = testCase.method === 'unstakePartial'
           ? [100n * nominal - 1n]
           : [];
         const [staker] = await getAccounts(1);
modifiedtests/src/util/index.tsdiffbeforeafterboth
--- a/tests/src/util/index.ts
+++ b/tests/src/util/index.ts
@@ -135,7 +135,7 @@
   TestUtils = 'testutils',
 }
 
-export function requirePalletsOrSkip(test: Context, helper: DevUniqueHelper, requiredPallets: string[]) {
+export function requirePalletsOrSkip(test: Context, helper: DevUniqueHelper, requiredPallets: readonly string[]) {
   const missingPallets = helper.fetchMissingPalletNames(requiredPallets);
 
   if (missingPallets.length > 0) {
@@ -145,7 +145,7 @@
   }
 }
 
-export function itSub(name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+export function itSub(name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: readonly string[] } = {}) {
   (opts.only ? it.only :
     opts.skip ? it.skip : it)(name, async function () {
     await usingPlaygrounds(async (helper, privateKey) => {
@@ -157,14 +157,14 @@
     });
   });
 }
-export function itSubIfWithPallet(name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+export function itSubIfWithPallet(name: string, required: readonly string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: readonly string[] } = {}) {
   return itSub(name, cb, {requiredPallets: required, ...opts});
 }
 itSub.only = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSub(name, cb, {only: true});
 itSub.skip = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSub(name, cb, {skip: true});
 
-itSubIfWithPallet.only = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSubIfWithPallet(name, required, cb, {only: true});
-itSubIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSubIfWithPallet(name, required, cb, {skip: true});
+itSubIfWithPallet.only = (name: string, required: readonly string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSubIfWithPallet(name, required, cb, {only: true});
+itSubIfWithPallet.skip = (name: string, required: readonly string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSubIfWithPallet(name, required, cb, {skip: true});
 itSub.ifWithPallets = itSubIfWithPallet;
 
 export type SchedKind = 'anon' | 'named';
modifiedtests/src/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -61,15 +61,17 @@
   decorated?: (...args: any[]) => any;
 }
 
-export interface ICrossAccountId {
-  Substrate?: TSubstrateAccount;
-  Ethereum?: TEthereumAccount;
+export type ICrossAccountId = {
+  Substrate: TSubstrateAccount;
+} | {
+  Ethereum: TEthereumAccount;
 }
 
-export interface ICrossAccountIdLower {
-  substrate?: TSubstrateAccount;
-  ethereum?: TEthereumAccount;
-}
+export type ICrossAccountIdLower = {
+  substrate: TSubstrateAccount;
+} | {
+  ethereum: TEthereumAccount;
+};
 
 export interface IEthCrossAccountId {
   0: TEthereumAccount;
@@ -163,8 +165,7 @@
 export interface ISubstrateBalance {
   free: bigint,
   reserved: bigint,
-  miscFrozen: bigint,
-  feeFrozen: bigint
+  frozen: bigint,
 }
 
 export interface IStakingInfo {
modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -469,7 +469,7 @@
   };
 
   async calculcateFee(payer: ICrossAccountId, promise: () => Promise<any>): Promise<bigint> {
-    const address = payer.Substrate ? payer.Substrate : this.helper.address.ethToSubstrate(payer.Ethereum!);
+    const address = 'Substrate' in payer ? payer.Substrate : this.helper.address.ethToSubstrate(payer.Ethereum);
     let balance = await this.helper.balance.getSubstrate(address);
 
     await promise();
@@ -991,7 +991,7 @@
 
   //todo:collator documentation
   async getIndex(): Promise<number> {
-    return (await this.helper.callRpc('api.query.session.currentIndex')).toNumber();
+    return (await this.helper.callRpc('api.query.session.currentIndex', [])).toNumber();
   }
 
   newSessions(sessionCount = 1, blockTimeout = 24000): Promise<void> {
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
77
8import {ApiPromise, WsProvider, Keyring} from '@polkadot/api';8import {ApiPromise, WsProvider, Keyring} from '@polkadot/api';
9import {SignerOptions} from '@polkadot/api/types/submittable';9import {SignerOptions} from '@polkadot/api/types/submittable';
10import '../../interfaces/augment-api-tx';
11import {AugmentedSubmittables} from '@polkadot/api-base/types/submittable';
12import {RpcInterface} from '@polkadot/rpc-core/types';
13import {QueryableStorage} from '@polkadot/api-base/types/storage';
14import {DecoratedRpc} from '@polkadot/api-base/types/rpc';
10import {ApiInterfaceEvents} from '@polkadot/api/types';15import {ApiInterfaceEvents} from '@polkadot/api/types';
11import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm, base58Encode, blake2AsU8a} from '@polkadot/util-crypto';16import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm, base58Encode, blake2AsU8a} from '@polkadot/util-crypto';
12import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';
47import type {Vec} from '@polkadot/types-codec';52import type {Vec} from '@polkadot/types-codec';
48import {FrameSystemEventRecord} from '@polkadot/types/lookup';53import {FrameSystemEventRecord} from '@polkadot/types/lookup';
4954
50export class CrossAccountId implements ICrossAccountId {55export class CrossAccountId {
51 Substrate?: TSubstrateAccount;56 Substrate!: TSubstrateAccount;
52 Ethereum?: TEthereumAccount;57 Ethereum!: TEthereumAccount;
5358
54 constructor(account: ICrossAccountId) {59 constructor(account: ICrossAccountId) {
55 if (account.Substrate) this.Substrate = account.Substrate;60 if ('Substrate' in account) this.Substrate = account.Substrate;
56 if (account.Ethereum) this.Ethereum = account.Ethereum;61 else this.Ethereum = account.Ethereum;
57 }62 }
5863
59 static fromKeyring(account: IKeyringPair, domain: 'Substrate' | 'Ethereum' = 'Substrate') {64 static fromKeyring(account: IKeyringPair, domain: 'Substrate' | 'Ethereum' = 'Substrate') {
64 }69 }
6570
66 static fromLowerCaseKeys(address: ICrossAccountIdLower): CrossAccountId {71 static fromLowerCaseKeys(address: ICrossAccountIdLower): CrossAccountId {
67 return new CrossAccountId({Substrate: address.substrate, Ethereum: address.ethereum});72 if ('substrate' in address) return new CrossAccountId({Substrate: address.substrate});
73 else return new CrossAccountId({Ethereum: address.ethereum});
68 }74 }
6975
70 static normalizeSubstrateAddress(address: TSubstrateAccount, ss58Format = 42): TSubstrateAccount {76 static normalizeSubstrateAddress(address: TSubstrateAccount, ss58Format = 42): TSubstrateAccount {
263 if(typeof address === 'string') return address;269 if (typeof address === 'string') return address;
264 const obj = {} as any;270 const obj = {} as any;
265 Object.keys(address).forEach(k => {271 Object.keys(address).forEach(k => {
266 obj[k.toLocaleLowerCase()] = address[k as 'Substrate' | 'Ethereum'];272 obj[k.toLocaleLowerCase()] = (address as any)[k];
267 });273 });
268 if(obj.substrate) return CrossAccountId.withNormalizedSubstrate(obj.substrate);274 if (obj.substrate) return CrossAccountId.withNormalizedSubstrate(obj.substrate);
269 if(obj.ethereum) return CrossAccountId.fromLowerCaseKeys(obj).toLowerCase();275 if (obj.ethereum) return CrossAccountId.fromLowerCaseKeys(obj).toLowerCase();
360 return parsedEvents;366 return parsedEvents;
361 }367 }
362}368}
369const InvalidTypeSymbol = Symbol('Invalid type');
370// eslint-disable-next-line @typescript-eslint/no-unused-vars
371export type Invalid<ErrorMessage> =
372 | ((
373 invalidType: typeof InvalidTypeSymbol,
374 ..._: typeof InvalidTypeSymbol[]
375 ) => typeof InvalidTypeSymbol)
376 | null
377 | undefined;
378// Has slightly better error messages than Get
379type Get2<T, P extends string, E> =
380 P extends `${infer Key}.${infer Key2}` ? Key extends keyof T ? Key2 extends keyof T[Key] ? T[Key][Key2] : E : E : E;
381type ForceFunction<T> = T extends (...args: any) => any ? T : (...args: any) => Invalid<'not a function'>;
382type ReturnTypeWithArgs<T extends (...args: any[]) => any, ARGS_T> =
383 Extract<
384 T extends { (...args: infer A1): infer R1; (...args: infer A2): infer R2; (...args: infer A3): infer R3; (...args: infer A4): infer R4; } ? [A1, R1] | [A2, R2] | [A3, R3] | [A4, R4] :
385 T extends { (...args: infer A1): infer R1; (...args: infer A2): infer R2; (...args: infer A3): infer R3; } ? [A1, R1] | [A2, R2] | [A3, R3] :
386 T extends { (...args: infer A1): infer R1; (...args: infer A2): infer R2; } ? [A1, R1] | [A2, R2] :
387 T extends { (...args: infer A1): infer R1; } ? [A1, R1] :
388 never,
389 [ARGS_T, any]
390 >[1]
363391
364export class ChainHelperBase {392export class ChainHelperBase {
365 helperBase: any;393 helperBase: any;
646 return this.constructApiCall(apiCall, params).method.toHex();674 return this.constructApiCall(apiCall, params).method.toHex();
647 }675 }
648676
649 async executeExtrinsic(sender: TSigner, extrinsic: string, params: any[], expectSuccess=true, options: Partial<SignerOptions>|null = null/*, failureMessage='expected success'*/) {677 async executeExtrinsic<
678 E extends string,
679 V extends (
680...args: any) => any = ForceFunction<
681 Get2<
682 AugmentedSubmittables<'promise'>,
683 E, (...args: any) => Invalid<'not found'>
684 >
685 >
686 >(
687 sender: TSigner,
688 extrinsic: `api.tx.${E}`,
689 params: Parameters<V>,
690 expectSuccess = true,
691 options: Partial<SignerOptions> | null = null,/*, failureMessage='expected success'*/
692 ): Promise<ITransactionResult> {
650 if(this.api === null) throw Error('API not initialized');693 if (this.api === null) throw Error('API not initialized');
651 if(!extrinsic.startsWith('api.tx.')) throw Error(`${extrinsic} is not transaction`);694 if (!extrinsic.startsWith('api.tx.')) throw Error(`${extrinsic} is not transaction`);
652695
696 if (result.moduleError) throw Error(`${errorMessage}`);739 if (result.moduleError) throw Error(`${errorMessage}`);
697 else if (result.result.dispatchError) throw Error(JSON.stringify(result.result.dispatchError));740 else if (result.result.dispatchError) throw Error(JSON.stringify(result.result.dispatchError));
698 }741 }
699 return result;742 return result as any;
700 }743 }
701744
702 async callRpc(rpc: string, params?: any[]) {745 async callRpc
746 // <
747 // K extends 'rpc' | 'query',
748 // E extends string,
749 // V extends (...args: any) => any = ForceFunction<
750 // Get2<
751 // K extends 'rpc' ? DecoratedRpc<'promise', RpcInterface> : QueryableStorage<'promise'>,
752 // E, (...args: any) => Invalid<'not found'>
753 // >
754 // >,
755 // P = Parameters<V>,
756 // >
757 (rpc: string, params?: any[]): Promise<any> {
758
703 if(typeof params === 'undefined') params = [];759 if (typeof params === 'undefined') params = [] as any;
704 if(this.api === null) throw Error('API not initialized');760 if (this.api === null) throw Error('API not initialized');
705 if(!rpc.startsWith('api.rpc.') && !rpc.startsWith('api.query.')) throw Error(`${rpc} is not RPC call`);761 if (!rpc.startsWith('api.rpc.') && !rpc.startsWith('api.query.')) throw Error(`${rpc} is not RPC call`);
706762
711 type: this.chainLogType.RPC,767 type: this.chainLogType.RPC,
712 call: rpc,768 call: rpc,
713 params,769 params,
714 } as IUniqueHelperLog;770 } as any as IUniqueHelperLog;
715771
716 try {772 try {
717 result = await this.constructApiCall(rpc, params);773 result = await this.constructApiCall(rpc, params as any);
718 }774 }
719 catch(e) {775 catch (e) {
720 error = e;776 error = e;
743 return this.api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase()).sort();799 return this.api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase()).sort();
744 }800 }
745801
746 fetchMissingPalletNames(requiredPallets: string[]): string[] {802 fetchMissingPalletNames(requiredPallets: readonly string[]): string[] {
747 const palletNames = this.fetchAllPalletNames();803 const palletNames = this.fetchAllPalletNames();
748 return requiredPallets.filter(p => !palletNames.includes(p));804 return requiredPallets.filter(p => !palletNames.includes(p));
749 }805 }
1731 const creationResult = await this.helper.executeExtrinsic(1787 const creationResult = await this.helper.executeExtrinsic(
1732 signer,1788 signer,
1733 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1789 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {
1734 nft: {1790 NFT: {
1735 properties: data.properties,1791 properties: data.properties,
1736 },1792 },
1737 }],1793 }],
1918 const creationResult = await this.helper.executeExtrinsic(1974 const creationResult = await this.helper.executeExtrinsic(
1919 signer,1975 signer,
1920 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1976 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {
1921 refungible: {1977 ReFungible: {
1922 pieces: data.pieces,1978 pieces: data.pieces,
1923 properties: data.properties,1979 properties: data.properties,
1924 },1980 },
2093 const creationResult = await this.helper.executeExtrinsic(2149 const creationResult = await this.helper.executeExtrinsic(
2094 signer,2150 signer,
2095 'api.tx.unique.createItem', [collectionId, (typeof owner === 'string') ? {Substrate: owner} : owner, {2151 'api.tx.unique.createItem', [collectionId, (typeof owner === 'string') ? {Substrate: owner} : owner, {
2096 fungible: {2152 Fungible: {
2097 value: amount,2153 value: amount,
2098 },2154 },
2099 }],2155 }],
2334 return isSuccess;2390 return isSuccess;
2335 }2391 }
23362392
2337 /**2393 /**
2338 * Get full substrate balance including free, miscFrozen, feeFrozen, and reserved2394 * Get full substrate balance including free, frozen, and reserved
2339 * @param address substrate address2395 * @param address substrate address
2340 * @returns2396 * @returns
2341 */2397 */
2342 async getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {2398 async getSubstrateFull(address: TSubstrateAccount): Promise<ISubstrateBalance> {
2343 const accountInfo = (await this.helper.callRpc('api.query.system.account', [address])).data;2399 const accountInfo = (await this.helper.callRpc('api.query.system.account', [address])).data;
2344 return {free: accountInfo.free.toBigInt(), miscFrozen: accountInfo.miscFrozen.toBigInt(), feeFrozen: accountInfo.feeFrozen.toBigInt(), reserved: accountInfo.reserved.toBigInt()};2400 return {free: accountInfo.free.toBigInt(), frozen: accountInfo.frozen.toBigInt(), reserved: accountInfo.reserved.toBigInt()};
2345 }2401 }
23462402
2347 async getLocked(address: TSubstrateAccount): Promise<[{id: string, amount: bigint, reason: string}]> {2403 async getLocked(address: TSubstrateAccount): Promise<[{ id: string, amount: bigint, reason: string }]> {
2710 * @returns {number}2766 * @returns {number}
2711 */2767 */
2712 async getStakesNumber(address: ICrossAccountId): Promise<number> {2768 async getStakesNumber(address: ICrossAccountId): Promise<number> {
2713 if (address.Ethereum) throw Error('only substrate address');2769 if ('Ethereum' in address) throw Error('only substrate address');
2714 return (await this.helper.callRpc('api.query.appPromotion.stakesPerAccount', [address.Substrate])).toNumber();2770 return (await this.helper.callRpc('api.query.appPromotion.stakesPerAccount', [address.Substrate])).toNumber();
2715 }2771 }
27162772
33713427
3372 return super.executeExtrinsic(3428 return super.executeExtrinsic(
3373 sender,3429 sender,
3374 extrinsic,3430 extrinsic as any,
3375 schedArgs,3431 schedArgs,
3376 expectSuccess,3432 expectSuccess,
3377 );3433 );
3410 const error = (result.result.events[1].event.data as any).sudoResult.asErr.asModule;3466 const error = (result.result.events[1].event.data as any).sudoResult.asErr.asModule;
3411 const metaError = super.getApi()?.registry.findMetaError(error);3467 const metaError = super.getApi()?.registry.findMetaError(error);
3412 throw new Error(`${metaError.section}.${metaError.name}`);3468 throw new Error(`${metaError.section}.${metaError.name}`);
3413 } else {3469 } else if (data.asErr.isToken) {
3414 throw new Error(data.asErr.toHuman());3470 throw new Error(`Token: ${data.asErr.asToken}`);
3415 }3471 }
3416 }3472 }
3417 return result;3473 return result;
3418 }3474 }
modifiedtests/src/vesting.test.tsdiffbeforeafterboth
--- a/tests/src/vesting.test.ts
+++ b/tests/src/vesting.test.ts
@@ -47,15 +47,13 @@
     // check senders balance after vesting:
     let balanceSender = await helper.balance.getSubstrateFull(sender.address);
     expect(balanceSender.free / nominal).to.eq(699n);
-    expect(balanceSender.feeFrozen).to.eq(0n);
-    expect(balanceSender.miscFrozen).to.eq(0n);
+    expect(balanceSender.frozen).to.eq(0n);
     expect(balanceSender.reserved).to.eq(0n);
 
     // check recepient balance after vesting:
     let balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);
     expect(balanceRecepient.free).to.eq(301n * nominal);
-    expect(balanceRecepient.feeFrozen).to.eq(300n * nominal);
-    expect(balanceRecepient.miscFrozen).to.eq(300n * nominal);
+    expect(balanceRecepient.frozen).to.eq(300n * nominal);
     expect(balanceRecepient.reserved).to.eq(0n);
 
     // Schedules list correct:
@@ -70,8 +68,7 @@
     // check recepient balance after claim (50 tokens claimed, 250 left):
     balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);
     expect(balanceRecepient.free / nominal).to.eq(300n);
-    expect(balanceRecepient.feeFrozen).to.eq(250n * nominal);
-    expect(balanceRecepient.miscFrozen).to.eq(250n * nominal);
+    expect(balanceRecepient.frozen).to.eq(250n * nominal);
     expect(balanceRecepient.reserved).to.eq(0n);
 
     // Wait first schedule ends and first part od second schedule:
@@ -81,8 +78,7 @@
     // check recepient balance after second claim (150 tokens claimed, 100 left):
     balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);
     expect(balanceRecepient.free / nominal).to.eq(300n);
-    expect(balanceRecepient.feeFrozen).to.eq(100n * nominal);
-    expect(balanceRecepient.miscFrozen).to.eq(100n * nominal);
+    expect(balanceRecepient.frozen).to.eq(100n * nominal);
     expect(balanceRecepient.reserved).to.eq(0n);
 
     // Schedules list contain 1 vesting:
@@ -97,47 +93,43 @@
     // check recepient balance after second claim (100 tokens claimed, 0 left):
     balanceRecepient = await helper.balance.getSubstrateFull(recepient.address);
     expect(balanceRecepient.free / nominal).to.eq(300n);
-    expect(balanceRecepient.feeFrozen).to.eq(0n);
-    expect(balanceRecepient.miscFrozen).to.eq(0n);
+    expect(balanceRecepient.frozen).to.eq(0n);
     expect(balanceRecepient.reserved).to.eq(0n);
 
     // check sender balance does not changed:
     balanceSender = await helper.balance.getSubstrateFull(sender.address);
     expect(balanceSender.free / nominal).to.eq(699n);
-    expect(balanceSender.feeFrozen).to.eq(0n);
-    expect(balanceSender.miscFrozen).to.eq(0n);
+    expect(balanceSender.frozen).to.eq(0n);
     expect(balanceSender.reserved).to.eq(0n);
   });
 
-  itSub('cannot send more tokens than have', async ({helper}) => {
+  itSub.only('cannot send more tokens than have', async ({helper}) => {
     const [sender, receiver] = await helper.arrange.createAccounts([1000n, 1n], donor);
     const schedule = {start: 0n, period: 1n, periodCount: 1n, perPeriod: 100n * nominal};
     const manyPeriodsSchedule = {start: 0n, period: 1n, periodCount: 100n, perPeriod: 10n * nominal};
     const oneBigSumSchedule = {start: 0n, period: 1n, periodCount: 1n, perPeriod: 5000n * nominal};
 
     // Sender cannot send vestedTransfer to self or other
-    await expect(helper.balance.vestedTransfer(sender, sender.address, manyPeriodsSchedule)).to.be.rejectedWith(/InsufficientBalance/);
-    await expect(helper.balance.vestedTransfer(sender, receiver.address, manyPeriodsSchedule)).to.be.rejectedWith(/InsufficientBalance/);
-    await expect(helper.balance.vestedTransfer(sender, sender.address, oneBigSumSchedule)).to.be.rejectedWith(/InsufficientBalance/);
-    await expect(helper.balance.vestedTransfer(sender, receiver.address, oneBigSumSchedule)).to.be.rejectedWith(/InsufficientBalance/);
+    await expect(helper.balance.vestedTransfer(sender, sender.address, manyPeriodsSchedule)).to.be.rejectedWith(/^vesting.InsufficientBalanceToLock$/);
+    await expect(helper.balance.vestedTransfer(sender, receiver.address, manyPeriodsSchedule)).to.be.rejectedWith(/^Token: FundsUnavailable$/);
+    await expect(helper.balance.vestedTransfer(sender, sender.address, oneBigSumSchedule)).to.be.rejectedWith(/^vesting.InsufficientBalanceToLock$/);
+    await expect(helper.balance.vestedTransfer(sender, receiver.address, oneBigSumSchedule)).to.be.rejectedWith(/^Token: FundsUnavailable$/);
 
     const balanceSender = await helper.balance.getSubstrateFull(sender.address);
     const balanceReceiver = await helper.balance.getSubstrateFull(receiver.address);
 
     // Sender's balance has not changed
     expect(balanceSender.free / nominal).to.eq(999n);
-    expect(balanceSender.feeFrozen).to.eq(0n);
-    expect(balanceSender.miscFrozen).to.eq(0n);
+    expect(balanceSender.frozen).to.eq(0n);
     expect(balanceSender.reserved).to.eq(0n);
 
     // Receiver's balance has not changed
     expect(balanceReceiver.free).to.be.eq(1n * nominal);
-    expect(balanceReceiver.feeFrozen).to.be.eq(0n);
-    expect(balanceReceiver.miscFrozen).to.be.eq(0n);
+    expect(balanceReceiver.frozen).to.be.eq(0n);
     expect(balanceReceiver.reserved).to.be.eq(0n);
 
     // Receiver cannot send vestedTransfer back because of freeze
-    await expect(helper.balance.vestedTransfer(receiver, sender.address, schedule)).to.be.rejectedWith(/InsufficientBalance/);
+    await expect(helper.balance.vestedTransfer(receiver, sender.address, schedule)).to.be.rejectedWith(/^Token: FundsUnavailable$/);
   });
 
   itSub('cannot send vestedTransfer with incorrect parameters', async ({helper}) => {
@@ -153,8 +145,7 @@
     const balanceSender = await helper.balance.getSubstrateFull(sender.address);
     // Sender's balance has not changed
     expect(balanceSender.free / nominal).to.eq(999n);
-    expect(balanceSender.feeFrozen).to.eq(0n);
-    expect(balanceSender.miscFrozen).to.eq(0n);
+    expect(balanceSender.frozen).to.eq(0n);
     expect(balanceSender.reserved).to.eq(0n);
   });
 });