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

difftreelog

Tests: code-style fixes

Andrey2022-10-06parent: #21df7e4.patch.diff
in: master

14 files changed

modifiedtests/src/addCollectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/addCollectionAdmin.test.ts
+++ b/tests/src/addCollectionAdmin.test.ts
@@ -110,7 +110,7 @@
     const [alice, ...accounts] = await helper.arrange.createAccounts([10n, 0n, 0n, 0n, 0n, 0n, 0n, 0n], donor);
     const collection = await helper.nft.mintCollection(alice, {name: 'Collection Name', description: 'Collection Description', tokenPrefix: 'COL'});
 
-    const chainAdminLimit = (helper.api!.consts.common.collectionAdminsLimit as any).toNumber();
+    const chainAdminLimit = (helper.getApi().consts.common.collectionAdminsLimit as any).toNumber();
     expect(chainAdminLimit).to.be.equal(5);
 
     for (let i = 0; i < chainAdminLimit; i++) {
modifiedtests/src/approve.test.tsdiffbeforeafterboth
--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -60,7 +60,7 @@
     const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
     await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
     expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
-    await helper.signTransaction(alice, helper.api?.tx.unique.approve({Substrate: bob.address}, collectionId, tokenId, 0));
+    await helper.signTransaction(alice, helper.constructApiCall('api.tx.unique.approve', [{Substrate: bob.address}, collectionId, tokenId, 0]));
     expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
   });
 
@@ -275,7 +275,7 @@
     const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
     await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
     expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
-    await helper.signTransaction(alice, helper.api?.tx.unique.approve({Substrate: bob.address}, collectionId, tokenId, 0));
+    await helper.signTransaction(alice, helper.constructApiCall('api.tx.unique.approve', [{Substrate: bob.address}, collectionId, tokenId, 0]));
     expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
     const transferTokenFromTx = async () => helper.nft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: bob.address});
     await expect(transferTokenFromTx()).to.be.rejected;
@@ -328,7 +328,7 @@
   itSub('1 for NFT', async ({helper}) => {
     const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
     const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
-    const approveTx = async () => helper.signTransaction(bob, helper.api?.tx.unique.approve({Substrate: charlie.address}, collectionId, tokenId, 2));
+    const approveTx = async () => helper.signTransaction(bob, helper.constructApiCall('api.tx.unique.approve', [{Substrate: charlie.address}, collectionId, tokenId, 2]));
     await expect(approveTx()).to.be.rejected;
     expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.false;
   });
modifiedtests/src/block-production.test.tsdiffbeforeafterboth
--- a/tests/src/block-production.test.ts
+++ b/tests/src/block-production.test.ts
@@ -37,7 +37,7 @@
 
 describe('Block Production smoke test', () => {
   itSub('Node produces new blocks', async ({helper}) => {
-    const blocks: number[] | undefined = await getBlocks(helper.api!);
+    const blocks: number[] | undefined = await getBlocks(helper.getApi());
     expect(blocks[0]).to.be.lessThan(blocks[1]);
   });
 });
modifiedtests/src/createMultipleItemsEx.test.tsdiffbeforeafterboth
--- a/tests/src/createMultipleItemsEx.test.ts
+++ b/tests/src/createMultipleItemsEx.test.ts
@@ -178,13 +178,12 @@
       tokenPrefix: 'COL',
     }, 0);
 
-    const api = helper.api;
-    await helper.signTransaction(alice, api?.tx.unique.createMultipleItemsEx(collection.collectionId, {
+    await helper.executeExtrinsic(alice, 'api.tx.unique.createMultipleItemsEx',[collection.collectionId, {
       Fungible: new Map([
         [JSON.stringify({Substrate: alice.address}), 50],
         [JSON.stringify({Substrate: bob.address}), 100],
       ]),
-    }));
+    }], true);
 
     expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(50n);
     expect(await collection.getBalance({Substrate: bob.address})).to.be.equal(100n);
@@ -200,8 +199,7 @@
       ],
     });
 
-    const api = helper.api;
-    await helper.signTransaction(alice, api?.tx.unique.createMultipleItemsEx(collection.collectionId, {
+    await helper.executeExtrinsic(alice, 'api.tx.unique.createMultipleItemsEx', [collection.collectionId, {
       RefungibleMultipleOwners: {
         users: new Map([
           [JSON.stringify({Substrate: alice.address}), 1],
@@ -211,7 +209,7 @@
           {key: 'k', value: 'v'},
         ],
       },
-    }));
+    }], true);
     const tokenId = await collection.getLastTokenId();
     expect(tokenId).to.be.equal(1);
     expect(await collection.getTokenBalance(1, {Substrate: alice.address})).to.be.equal(1n);
@@ -228,9 +226,7 @@
       ],
     });
 
-    const api = helper.api;
-
-    await helper.signTransaction(alice, api?.tx.unique.createMultipleItemsEx(collection.collectionId, {
+    await helper.executeExtrinsic(alice, 'api.tx.unique.createMultipleItemsEx', [collection.collectionId, {
       RefungibleMultipleItems: [
         {
           user: {Substrate: alice.address}, pieces: 1,
@@ -245,7 +241,7 @@
           ],
         },
       ],
-    }));
+    }], true);
 
     expect(await collection.getLastTokenId()).to.be.equal(2);
     expect(await collection.getTokenBalance(1, {Substrate: alice.address})).to.be.equal(1n);
modifiedtests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth
--- a/tests/src/creditFeesToTreasury.test.ts
+++ b/tests/src/creditFeesToTreasury.test.ts
@@ -70,7 +70,7 @@
   });
 
   itSub('Sender balance decreased by fee+sent amount, Treasury balance increased by fee', async ({helper}) => {
-    await skipInflationBlock(helper.api!);
+    await skipInflationBlock(helper.getApi());
     await helper.wait.newBlocks(1);
 
     const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
@@ -89,7 +89,7 @@
   });
 
   itSub('Treasury balance increased by failed tx fee', async ({helper}) => {
-    const api = helper.api!;
+    const api = helper.getApi();
     await helper.wait.newBlocks(1);
 
     const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
@@ -107,7 +107,7 @@
   });
 
   itSub('NFT Transactions also send fees to Treasury', async ({helper}) => {
-    await skipInflationBlock(helper.api!);
+    await skipInflationBlock(helper.getApi());
     await helper.wait.newBlocks(1);
 
     const treasuryBalanceBefore = await helper.balance.getSubstrate(TREASURY);
@@ -125,7 +125,7 @@
 
   itSub('Fees are sane', async ({helper}) => {
     const unique = helper.balance.getOneTokenNominal();
-    await skipInflationBlock(helper.api!);
+    await skipInflationBlock(helper.getApi());
     await helper.wait.newBlocks(1);
 
     const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
@@ -140,7 +140,7 @@
   });
 
   itSub('NFT Transfer fee is close to 0.1 Unique', async ({helper}) => {
-    await skipInflationBlock(helper.api!);
+    await skipInflationBlock(helper.getApi());
     await helper.wait.newBlocks(1);
 
     const collection = await helper.nft.mintCollection(alice, {
modifiedtests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth
before · tests/src/eth/createNFTCollection.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.8//9// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {evmToAddress} from '@polkadot/util-crypto';18import {IKeyringPair} from '@polkadot/types/types';19import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';202122describe('Create NFT collection from EVM', () => {23  let donor: IKeyringPair;2425  before(async function() {26    await usingEthPlaygrounds(async (_helper, privateKey) => {27      donor = privateKey('//Alice');28    });29  });3031  itEth('Create collection', async ({helper}) => {32    const owner = await helper.eth.createAccountWithBalance(donor);3334    const name = 'CollectionEVM';35    const description = 'Some description';36    const prefix = 'token prefix';3738    // todo:playgrounds this might fail when in async environment.39    const collectionCountBefore = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;40    const {collectionId} = await helper.eth.createNonfungibleCollection(owner, name, description, prefix);41    const collectionCountAfter = +(await helper.callRpc('api.rpc.unique.collectionStats')).created;4243    const collection = helper.nft.getCollectionObject(collectionId);44    const data = (await collection.getData())!;45    46    expect(collectionCountAfter - collectionCountBefore).to.be.eq(1);47    expect(collectionId).to.be.eq(collectionCountAfter);48    expect(data.name).to.be.eq(name);49    expect(data.description).to.be.eq(description);50    expect(data.raw.tokenPrefix).to.be.eq(prefix);51    expect(data.raw.mode).to.be.eq('NFT');52  });5354  // todo:playgrounds this test will fail when in async environment.55  itEth('Check collection address exist', async ({helper}) => {56    const owner = await helper.eth.createAccountWithBalance(donor);5758    const expectedCollectionId = +(await helper.callRpc('api.rpc.unique.collectionStats')).created + 1;59    const expectedCollectionAddress = helper.ethAddress.fromCollectionId(expectedCollectionId);60    const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);6162    expect(await collectionHelpers.methods63      .isCollectionExist(expectedCollectionAddress)64      .call()).to.be.false;6566    await collectionHelpers.methods67      .createNonfungibleCollection('A', 'A', 'A')68      .send({value: Number(2n * helper.balance.getOneTokenNominal())});69    70    expect(await collectionHelpers.methods71      .isCollectionExist(expectedCollectionAddress)72      .call()).to.be.true;73  });74  75  itEth('Set sponsorship', async ({helper}) => {76    const owner = await helper.eth.createAccountWithBalance(donor);77    const sponsor = await helper.eth.createAccountWithBalance(donor);78    const ss58Format = helper.chain.getChainProperties().ss58Format;79    const {collectionId, collectionAddress} = await helper.eth.createNonfungibleCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');8081    const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);82    await collection.methods.setCollectionSponsor(sponsor).send();8384    let data = (await helper.nft.getData(collectionId))!;85    expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));8687    await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');8889    const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);90    await sponsorCollection.methods.confirmCollectionSponsorship().send();9192    data = (await helper.nft.getData(collectionId))!;93    expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));94  });9596  itEth('Set limits', async ({helper}) => {97    const owner = await helper.eth.createAccountWithBalance(donor);98    const {collectionId, collectionAddress} = await helper.eth.createNonfungibleCollection(owner, 'Limits', 'absolutely anything', 'FLO');99    const limits = {100      accountTokenOwnershipLimit: 1000,101      sponsoredDataSize: 1024,102      sponsoredDataRateLimit: 30,103      tokenLimit: 1000000,104      sponsorTransferTimeout: 6,105      sponsorApproveTimeout: 6,106      ownerCanTransfer: false,107      ownerCanDestroy: false,108      transfersEnabled: false,109    };110111    const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);112    await collection.methods['setCollectionLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();113    await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();114    await collection.methods['setCollectionLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();115    await collection.methods['setCollectionLimit(string,uint32)']('tokenLimit', limits.tokenLimit).send();116    await collection.methods['setCollectionLimit(string,uint32)']('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();117    await collection.methods['setCollectionLimit(string,uint32)']('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();118    await collection.methods['setCollectionLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();119    await collection.methods['setCollectionLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();120    await collection.methods['setCollectionLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();121    122    const data = (await helper.nft.getData(collectionId))!;123    expect(data.raw.limits.accountTokenOwnershipLimit).to.be.eq(limits.accountTokenOwnershipLimit);124    expect(data.raw.limits.sponsoredDataSize).to.be.eq(limits.sponsoredDataSize);125    expect(data.raw.limits.sponsoredDataRateLimit.blocks).to.be.eq(limits.sponsoredDataRateLimit);126    expect(data.raw.limits.tokenLimit).to.be.eq(limits.tokenLimit);127    expect(data.raw.limits.sponsorTransferTimeout).to.be.eq(limits.sponsorTransferTimeout);128    expect(data.raw.limits.sponsorApproveTimeout).to.be.eq(limits.sponsorApproveTimeout);129    expect(data.raw.limits.ownerCanTransfer).to.be.eq(limits.ownerCanTransfer);130    expect(data.raw.limits.ownerCanDestroy).to.be.eq(limits.ownerCanDestroy);131    expect(data.raw.limits.transfersEnabled).to.be.eq(limits.transfersEnabled);132  });133134  itEth('Collection address exist', async ({helper}) => {135    const owner = await helper.eth.createAccountWithBalance(donor);136    const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';137    expect(await helper.ethNativeContract.collectionHelpers(collectionAddressForNonexistentCollection)138      .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())139      .to.be.false;140    141    const {collectionAddress} = await helper.eth.createNonfungibleCollection(owner, 'Exister', 'absolutely anything', 'EVC');142    expect(await helper.ethNativeContract.collectionHelpers(collectionAddress)143      .methods.isCollectionExist(collectionAddress).call())144      .to.be.true;145  });146});147148describe('(!negative tests!) Create NFT collection from EVM', () => {149  let donor: IKeyringPair;150  let nominal: bigint;151152  before(async function() {153    await usingEthPlaygrounds(async (helper, privateKey) => {154      donor = privateKey('//Alice');155      nominal = helper.balance.getOneTokenNominal()156    });157  });158159  itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {160    const owner = await helper.eth.createAccountWithBalance(donor);161    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);162    {163      const MAX_NAME_LENGTH = 64;164      const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);165      const description = 'A';166      const tokenPrefix = 'A';167168      await expect(collectionHelper.methods169        .createNonfungibleCollection(collectionName, description, tokenPrefix)170        .call({value: Number(2n * nominal)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);171      172    }173    {174      const MAX_DESCRIPTION_LENGTH = 256;175      const collectionName = 'A';176      const description = 'A'.repeat(MAX_DESCRIPTION_LENGTH + 1);177      const tokenPrefix = 'A';178      await expect(collectionHelper.methods179        .createNonfungibleCollection(collectionName, description, tokenPrefix)180        .call({value: Number(2n * nominal)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);181    }182    {183      const MAX_TOKEN_PREFIX_LENGTH = 16;184      const collectionName = 'A';185      const description = 'A';186      const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);187      await expect(collectionHelper.methods188        .createNonfungibleCollection(collectionName, description, tokenPrefix)189        .call({value: Number(2n * nominal)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);190    }191  });192  193  itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {194    const owner = await helper.eth.createAccountWithBalance(donor);195    const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);196    await expect(collectionHelper.methods197      .createNonfungibleCollection('Peasantry', 'absolutely anything', 'CVE')198      .call({value: Number(1n * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');199  });200201  itEth('(!negative test!) Check owner', async ({helper}) => {202    const owner = await helper.eth.createAccountWithBalance(donor);203    const malfeasant = helper.eth.createAccount();204    const {collectionAddress} = await helper.eth.createNonfungibleCollection(owner, 'Transgressed', 'absolutely anything', 'COR');205    const malfeasantCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', malfeasant);206    const EXPECTED_ERROR = 'NoPermission';207    {208      const sponsor = await helper.eth.createAccountWithBalance(donor);209      await expect(malfeasantCollection.methods210        .setCollectionSponsor(sponsor)211        .call()).to.be.rejectedWith(EXPECTED_ERROR);212      213      const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'nft', sponsor);214      await expect(sponsorCollection.methods215        .confirmCollectionSponsorship()216        .call()).to.be.rejectedWith('caller is not set as sponsor');217    }218    {219      await expect(malfeasantCollection.methods220        .setCollectionLimit('account_token_ownership_limit', '1000')221        .call()).to.be.rejectedWith(EXPECTED_ERROR);222    }223  });224225  itEth('(!negative test!) Set limits', async ({helper}) => {226    const owner = await helper.eth.createAccountWithBalance(donor);227    const {collectionAddress} = await helper.eth.createNonfungibleCollection(owner, 'Limits', 'absolutely anything', 'OLF');228    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);229    await expect(collectionEvm.methods230      .setCollectionLimit('badLimit', 'true')231      .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');232  });233});
modifiedtests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth
--- a/tests/src/eth/proxy/nonFungibleProxy.test.ts
+++ b/tests/src/eth/proxy/nonFungibleProxy.test.ts
@@ -138,23 +138,16 @@
   });
 
   //TODO: CORE-302 add eth methods
-  itEth.skip('Can perform mintBulk()', async ({helper, privateKey}) => {
-    const api = helper.getApi();
-    const web3 = helper.getWeb3();
-    const privateKeyWrapper = privateKey;
-    /*
-    const collection = await createCollectionExpectSuccess({
-      mode: {type: 'NFT'},
-    });
-    const alice = privateKeyWrapper('//Alice');
+  itEth.skip('Can perform mintBulk()', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(donor, {name: 'New', description: 'New collection', tokenPrefix: 'NEW'});
 
-    const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
-    const receiver = createEthAccount(web3);
+    const caller = await helper.eth.createAccountWithBalance(donor, 30n);
+    const receiver = helper.eth.createAccount();
 
-    const address = collectionIdToAddress(collection);
-    const contract = await proxyWrap(api, web3, new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS}), privateKeyWrapper);
-    const changeAdminTx = api.tx.unique.addCollectionAdmin(collection, {Ethereum: contract.options.address});
-    await submitTransactionAsync(alice, changeAdminTx);
+    const address = helper.ethAddress.fromCollectionId(collection.collectionId);
+    const evmCollection = helper.ethNativeContract.collection(address, 'nft', caller);
+    const contract = await proxyWrap(helper, evmCollection, donor);
+    await collection.addAdmin(donor, {Ethereum: contract.options.address});
 
     {
       const nextTokenId = await contract.methods.nextTokenId().call();
@@ -167,7 +160,7 @@
           [+nextTokenId + 2, 'Test URI 2'],
         ],
       ).send({from: caller});
-      const events = normalizeEvents(result.events);
+      const events = helper.eth.normalizeEvents(result.events);
 
       expect(events).to.be.deep.equal([
         {
@@ -203,7 +196,6 @@
       expect(await contract.methods.tokenURI(+nextTokenId + 1).call()).to.be.equal('Test URI 1');
       expect(await contract.methods.tokenURI(+nextTokenId + 2).call()).to.be.equal('Test URI 2');
     }
-    */
   });
 
   itEth('Can perform burn()', async ({helper}) => {
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
@@ -285,8 +285,8 @@
       await code();
       // In dev mode, the transaction might not finish processing in time
       await this.helper.wait.newBlocks(1);
-    }
-    return await this.helper.arrange.calculcateFee(address, code);
+    };
+    return await this.helper.arrange.calculcateFee(address, wrappedCode);
   }
 }  
 
modifiedtests/src/inflation.test.tsdiffbeforeafterboth
--- a/tests/src/inflation.test.ts
+++ b/tests/src/inflation.test.ts
@@ -40,9 +40,9 @@
     const tx = helper.constructApiCall('api.tx.inflation.startInflation', [1]);
     await expect(helper.executeExtrinsic(superuser, 'api.tx.sudo.sudo', [tx])).to.not.be.rejected;
 
-    const blockInterval = (helper.api!.consts.inflation.inflationBlockInterval as any).toBigInt();
-    const totalIssuanceStart = ((await helper.api!.query.inflation.startingYearTotalIssuance()) as any).toBigInt();
-    const blockInflation = (await helper.api!.query.inflation.blockInflation() as any).toBigInt();
+    const blockInterval = (helper.getApi().consts.inflation.inflationBlockInterval as any).toBigInt();
+    const totalIssuanceStart = ((await helper.callRpc('api.query.inflation.startingYearTotalIssuance', [])) as any).toBigInt();
+    const blockInflation = (await helper.callRpc('api.query.inflation.blockInflation', []) as any).toBigInt();
 
     const YEAR = 5259600n;  // 6-second block. Blocks in one year
     // const YEAR = 2629800n; // 12-second block. Blocks in one year
modifiedtests/src/nesting/properties.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/properties.test.ts
+++ b/tests/src/nesting/properties.test.ts
@@ -276,7 +276,7 @@
   
   itSub('Reads access rights to properties of a collection', async ({helper}) =>  {
     const collection = await helper.nft.mintCollection(alice);
-    const propertyRights = (await helper.api!.query.common.collectionPropertyPermissions(collection.collectionId)).toJSON();
+    const propertyRights = (await helper.callRpc('api.query.common.collectionPropertyPermissions', [collection.collectionId])).toJSON();
     expect(propertyRights).to.be.empty;
   });
   
@@ -817,7 +817,7 @@
       ).to.be.fulfilled;
     }
 
-    const originalSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    const originalSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
     return originalSpace;
   }
 
@@ -840,7 +840,7 @@
       ).to.be.rejectedWith(/common\.NoPermission/);
     }
 
-    const consumedSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
     expect(consumedSpace).to.be.equal(originalSpace);
   }
 
@@ -875,7 +875,7 @@
       ).to.be.rejectedWith(/common\.NoPermission/);
     }
   
-    const consumedSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
     expect(consumedSpace).to.be.equal(originalSpace);
   }
 
@@ -911,7 +911,7 @@
 
     expect(await token.getProperties(['non-existent', 'now-existent'])).to.be.empty;
       
-    const consumedSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
     expect(consumedSpace).to.be.equal(originalSpace);
   }
 
@@ -951,7 +951,7 @@
     ])).to.be.rejectedWith(/common\.NoSpaceForProperty/);
   
     expect(await token.getProperties(['a_holy_book', 'young_years'])).to.be.empty;
-    const consumedSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    const consumedSpace = await getConsumedSpace(token.collection.helper.getApi(), token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
     expect(consumedSpace).to.be.equal(originalSpace);
   }
 
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth
--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -59,7 +59,7 @@
 describe('Pallet presence', () => {
   before(async () => {
     await usingPlaygrounds(async helper => {
-      const chain = await helper.api!.rpc.system.chain();
+      const chain = await helper.callRpc('api.rpc.system.chain', []);
 
       const refungible = 'refungible';
       const scheduler = 'scheduler';
modifiedtests/src/tx-version-presence.test.tsdiffbeforeafterboth
--- a/tests/src/tx-version-presence.test.ts
+++ b/tests/src/tx-version-presence.test.ts
@@ -22,7 +22,7 @@
 describe('TxVersion is present', () => {
   before(async () => {
     await usingPlaygrounds(async helper => {
-      metadata = await helper.api!.rpc.state.getMetadata();
+      metadata = await helper.callRpc('api.rpc.state.getMetadata', []);
     });
   });
 
modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -215,8 +215,8 @@
   };
 
   isDevNode = async () => {
-    const block1 = await this.helper.api?.rpc.chain.getBlock(await this.helper.api?.rpc.chain.getBlockHash(1));
-    const block2 = await this.helper.api?.rpc.chain.getBlock(await this.helper.api?.rpc.chain.getBlockHash(2));
+    const block1 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [1])]);
+    const block2 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [2])]);
     const findCreationDate = async (block: any) => {
       const humanBlock = block.toHuman();
       let date;
@@ -259,7 +259,7 @@
   async newBlocks(blocksCount = 1): Promise<void> {
     // eslint-disable-next-line no-async-promise-executor
     const promise = new Promise<void>(async (resolve) => {
-      const unsubscribe = await this.helper.api!.rpc.chain.subscribeNewHeads(() => {
+      const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads(() => {
         if (blocksCount > 0) {
           blocksCount--;
         } else {
@@ -274,7 +274,7 @@
   async forParachainBlockNumber(blockNumber: bigint) {
     // eslint-disable-next-line no-async-promise-executor
     return new Promise<void>(async (resolve) => {
-      const unsubscribe = await this.helper.api!.rpc.chain.subscribeNewHeads(async (data: any) => {
+      const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads(async (data: any) => {
         if (data.number.toNumber() >= blockNumber) {
           unsubscribe();
           resolve();
@@ -286,7 +286,7 @@
   async forRelayBlockNumber(blockNumber: bigint) {
     // eslint-disable-next-line no-async-promise-executor
     return new Promise<void>(async (resolve) => {
-      const unsubscribe = await this.helper.api!.query.parachainSystem.validationData(async (data: any) => {
+      const unsubscribe = await this.helper.getApi().query.parachainSystem.validationData(async (data: any) => {
         if (data.value.relayParentNumber.toNumber() >= blockNumber) {
           // @ts-ignore
           unsubscribe();
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -1991,7 +1991,7 @@
    * @returns ss58Format, token decimals, and token symbol
    */
   getChainProperties(): IChainProperties {
-    const properties = (this.helper.api as any).registry.getChainProperties().toJSON();
+    const properties = (this.helper.getApi() as any).registry.getChainProperties().toJSON();
     return {
       ss58Format: properties.ss58Format.toJSON(),
       tokenDecimals: properties.tokenDecimals.toJSON(),
@@ -2034,7 +2034,7 @@
    * @returns number, account's nonce
    */
   async getNonce(address: TSubstrateAccount): Promise<number> {
-    return (await (this.helper.api as any).query.system.account(address)).nonce.toNumber();
+    return (await this.helper.callRpc('api.query.system.account', [address])).nonce.toNumber();
   }
 }