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

difftreelog

tests: refactorr playgrounds' minting signature for shorter mint for self

Fahrrader2022-09-09parent: #c067698.patch.diff
in: master

8 files changed

modifiedtests/src/fungible.test.tsdiffbeforeafterboth
--- a/tests/src/fungible.test.ts
+++ b/tests/src/fungible.test.ts
@@ -35,7 +35,7 @@
     const defaultTokenId = await collection.getLastTokenId();
     expect(defaultTokenId).to.be.equal(0);
 
-    await collection.mint(alice, {Substrate: alice.address}, U128_MAX);
+    await collection.mint(alice, U128_MAX);
     const aliceBalance = await collection.getBalance({Substrate: alice.address});
     const itemCountAfter = await collection.getLastTokenId();
 
@@ -49,7 +49,7 @@
 
     const collection = await helper.ft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
 
-    await collection.mint(alice, {Substrate: alice.address}, U128_MAX);
+    await collection.mint(alice, U128_MAX);
 
     await collection.transfer(alice, {Substrate: bob.address}, 1000n);
     await collection.transfer(alice, ethAcc, 900n);
@@ -72,7 +72,7 @@
   itSub('Transfer token', async ({helper}) => {
     const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};
     const collection = await helper.ft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    await collection.mint(alice, {Substrate: alice.address}, 500n);
+    await collection.mint(alice, 500n);
 
     expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(500n);
     expect(await collection.transfer(alice, {Substrate: bob.address}, 60n)).to.be.true;
@@ -88,7 +88,7 @@
   itSub('Tokens multiple creation', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
 
-    await collection.mintWithOneOwner(alice, {Substrate: alice.address}, [
+    await collection.mintWithOneOwner(alice, [
       {value: 500n},
       {value: 400n},
       {value: 300n},
@@ -99,7 +99,7 @@
 
   itSub('Burn some tokens ', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    await collection.mint(alice, {Substrate: alice.address}, 500n);
+    await collection.mint(alice, 500n);
 
     expect(await collection.isTokenExists(0)).to.be.true;
     expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(500n);
@@ -110,7 +110,7 @@
   
   itSub('Burn all tokens ', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    await collection.mint(alice, {Substrate: alice.address}, 500n);
+    await collection.mint(alice, 500n);
 
     expect(await collection.isTokenExists(0)).to.be.true;
     expect(await collection.burnTokens(alice, 500n)).to.be.true;
@@ -123,7 +123,7 @@
   itSub('Set allowance for token', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
     const ethAcc = {Ethereum: '0x67fb3503a61b284dc83fa96dceec4192db47dc7c'};
-    await collection.mint(alice, {Substrate: alice.address}, 100n);
+    await collection.mint(alice, 100n);
 
     expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(100n);
     
modifiedtests/src/limits.test.tsdiffbeforeafterboth
before · tests/src/limits.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.89// 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 {IKeyringPair} from '@polkadot/types/types';18import usingApi from './substrate/substrate-api';19import {20  createCollectionExpectSuccess,21  destroyCollectionExpectSuccess,22  setCollectionLimitsExpectSuccess,23  setCollectionSponsorExpectSuccess,24  confirmSponsorshipExpectSuccess,25  createItemExpectSuccess,26  createItemExpectFailure,27  transferExpectSuccess,28  getFreeBalance,29  waitNewBlocks, burnItemExpectSuccess,30  requirePallets,31  Pallets,32} from './util/helpers';33import {expect} from 'chai';3435describe('Number of tokens per address (NFT)', () => {36  let alice: IKeyringPair;3738  before(async () => {39    await usingApi(async (api, privateKeyWrapper) => {40      alice = privateKeyWrapper('//Alice');41    });42  });4344  it.skip('Collection limits allow greater number than chain limits, chain limits are enforced', async () => {4546    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});47    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 20});48    for(let i = 0; i < 10; i++){49      await createItemExpectSuccess(alice, collectionId, 'NFT');50    }51    await createItemExpectFailure(alice, collectionId, 'NFT');52    for(let i = 1; i < 11; i++) {53      await burnItemExpectSuccess(alice, collectionId, i);54    }55    await destroyCollectionExpectSuccess(collectionId);56  });5758  it('Collection limits allow lower number than chain limits, collection limits are enforced', async () => {5960    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});61    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});62    await createItemExpectSuccess(alice, collectionId, 'NFT');63    await createItemExpectFailure(alice, collectionId, 'NFT');64    await burnItemExpectSuccess(alice, collectionId, 1);65    await destroyCollectionExpectSuccess(collectionId);66  });67});6869describe('Number of tokens per address (ReFungible)', () => {70  let alice: IKeyringPair;7172  before(async function() {73    await requirePallets(this, [Pallets.ReFungible]);7475    await usingApi(async (api, privateKeyWrapper) => {76      alice = privateKeyWrapper('//Alice');77    });78  });7980  it.skip('Collection limits allow greater number than chain limits, chain limits are enforced', async () => {81    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});82    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 20});83    for(let i = 0; i < 10; i++){84      await createItemExpectSuccess(alice, collectionId, 'ReFungible');85    }86    await createItemExpectFailure(alice, collectionId, 'ReFungible');87    for(let i = 1; i < 11; i++) {88      await burnItemExpectSuccess(alice, collectionId, i, 100);89    }90    await destroyCollectionExpectSuccess(collectionId);91  });9293  it('Collection limits allow lower number than chain limits, collection limits are enforced', async () => {94    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});95    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});96    await createItemExpectSuccess(alice, collectionId, 'ReFungible');97    await createItemExpectFailure(alice, collectionId, 'ReFungible');98    await burnItemExpectSuccess(alice, collectionId, 1, 100);99    await destroyCollectionExpectSuccess(collectionId);100  });101});102103describe.skip('Sponsor timeout (NFT) (only for special chain limits test)', () => {104  let alice: IKeyringPair;105  let bob: IKeyringPair;106  let charlie: IKeyringPair;107108  before(async () => {109    await usingApi(async (api, privateKeyWrapper) => {110      alice = privateKeyWrapper('//Alice');111      bob = privateKeyWrapper('//Bob');112      charlie = privateKeyWrapper('//Charlie');113    });114  });115116  it.skip('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {117    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});118    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});119    const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');120    await setCollectionSponsorExpectSuccess(collectionId, alice.address);121    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');122    await transferExpectSuccess(collectionId, tokenId, alice, bob);123    const aliceBalanceBefore = await getFreeBalance(alice);124125    // check setting SponsorTimeout = 5, fail126    await waitNewBlocks(5);127    await transferExpectSuccess(collectionId, tokenId, bob, charlie);128    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);129    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);130131    // check setting SponsorTimeout = 7, success132    await waitNewBlocks(2); // 5 + 2133    await transferExpectSuccess(collectionId, tokenId, charlie, bob);134    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);135    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;136    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);137    await destroyCollectionExpectSuccess(collectionId);138  });139140  it('Collection limits have lower timeout value than chain limits, chain limits are enforced', async () => {141142    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});143    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 1});144    const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');145    await setCollectionSponsorExpectSuccess(collectionId, alice.address);146    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');147    await transferExpectSuccess(collectionId, tokenId, alice, bob);148    const aliceBalanceBefore = await getFreeBalance(alice);149150    // check setting SponsorTimeout = 1, fail151    await waitNewBlocks(1);152    await transferExpectSuccess(collectionId, tokenId, bob, charlie);153    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);154    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);155156    // check setting SponsorTimeout = 5, success157    await waitNewBlocks(4);158    await transferExpectSuccess(collectionId, tokenId, charlie, bob);159    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);160    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;161    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);162    await destroyCollectionExpectSuccess(collectionId);163  });164});165166describe.skip('Sponsor timeout (Fungible) (only for special chain limits test)', () => {167  let alice: IKeyringPair;168  let bob: IKeyringPair;169  let charlie: IKeyringPair;170171  before(async () => {172    await usingApi(async (api, privateKeyWrapper) => {173      alice = privateKeyWrapper('//Alice');174      bob = privateKeyWrapper('//Bob');175      charlie = privateKeyWrapper('//Charlie');176    });177  });178179  it('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {180    const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});181    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});182    const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible');183    await setCollectionSponsorExpectSuccess(collectionId, alice.address);184    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');185    await transferExpectSuccess(collectionId, tokenId, alice, bob, 10, 'Fungible');186    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');187    const aliceBalanceBefore = await getFreeBalance(alice);188189    // check setting SponsorTimeout = 5, fail190    await waitNewBlocks(5);191    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');192    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);193    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);194195    // check setting SponsorTimeout = 7, success196    await waitNewBlocks(2); // 5 + 2197    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');198    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);199    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;200    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);201202    await destroyCollectionExpectSuccess(collectionId);203  });204205  it('Collection limits have lower timeout value than chain limits, chain limits are enforced', async () => {206207    const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});208    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 1});209    const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible');210    await setCollectionSponsorExpectSuccess(collectionId, alice.address);211    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');212    await transferExpectSuccess(collectionId, tokenId, alice, bob, 10, 'Fungible');213    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');214    const aliceBalanceBefore = await getFreeBalance(alice);215216    // check setting SponsorTimeout = 1, fail217    await waitNewBlocks(1);218    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');219    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);220    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);221222    // check setting SponsorTimeout = 5, success223    await waitNewBlocks(4);224    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');225    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);226    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;227    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);228229    await destroyCollectionExpectSuccess(collectionId);230  });231});232233describe.skip('Sponsor timeout (ReFungible) (only for special chain limits test)', () => {234  let alice: IKeyringPair;235  let bob: IKeyringPair;236  let charlie: IKeyringPair;237238  before(async () => {239    await usingApi(async (api, privateKeyWrapper) => {240      alice = privateKeyWrapper('//Alice');241      bob = privateKeyWrapper('//Bob');242      charlie = privateKeyWrapper('//Charlie');243    });244  });245246  it('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {247    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});248    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});249    const tokenId = await createItemExpectSuccess(alice, collectionId, 'ReFungible');250    await setCollectionSponsorExpectSuccess(collectionId, alice.address);251    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');252    await transferExpectSuccess(collectionId, tokenId, alice, bob, 100, 'ReFungible');253    const aliceBalanceBefore = await getFreeBalance(alice);254255    // check setting SponsorTimeout = 5, fail256    await waitNewBlocks(5);257    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');258    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);259    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);260261    // check setting SponsorTimeout = 7, success262    await waitNewBlocks(2); // 5 + 2263    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');264    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);265    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;266    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);267    await destroyCollectionExpectSuccess(collectionId);268  });269270  it('Collection limits have lower timeout value than chain limits, chain limits are enforced', async () => {271272    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});273    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 1});274    const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');275    await setCollectionSponsorExpectSuccess(collectionId, alice.address);276    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');277    await transferExpectSuccess(collectionId, tokenId, alice, bob);278    const aliceBalanceBefore = await getFreeBalance(alice);279280    // check setting SponsorTimeout = 1, fail281    await waitNewBlocks(1);282    await transferExpectSuccess(collectionId, tokenId, bob, charlie);283    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);284    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);285286    // check setting SponsorTimeout = 5, success287    await waitNewBlocks(4);288    await transferExpectSuccess(collectionId, tokenId, charlie, bob);289    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);290    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;291    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);292    await destroyCollectionExpectSuccess(collectionId);293  });294});295296describe('Collection zero limits (NFT)', () => {297  let alice: IKeyringPair;298  let bob: IKeyringPair;299  let charlie: IKeyringPair;300301  before(async () => {302    await usingApi(async (api, privateKeyWrapper) => {303      alice = privateKeyWrapper('//Alice');304      bob = privateKeyWrapper('//Bob');305      charlie = privateKeyWrapper('//Charlie');306    });307  });308309  it.skip('Limits have 0 in tokens per address field, the chain limits are applied', async () => {310    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});311    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 0});312    for(let i = 0; i < 10; i++){313      await createItemExpectSuccess(alice, collectionId, 'NFT');314    }315    await createItemExpectFailure(alice, collectionId, 'NFT');316  });317318  it('Limits have 0 in sponsor timeout, no limits are applied', async () => {319320    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});321    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 0});322    const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');323    await setCollectionSponsorExpectSuccess(collectionId, alice.address);324    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');325    await transferExpectSuccess(collectionId, tokenId, alice, bob);326    const aliceBalanceBefore = await getFreeBalance(alice);327328    // check setting SponsorTimeout = 0, success with next block329    await waitNewBlocks(1);330    await transferExpectSuccess(collectionId, tokenId, bob, charlie);331    const aliceBalanceAfterSponsoredTransaction1 = await getFreeBalance(alice);332    expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;333    //expect(aliceBalanceAfterSponsoredTransaction1).to.be.lessThan(aliceBalanceBefore);334  });335});336337describe('Collection zero limits (Fungible)', () => {338  let alice: IKeyringPair;339  let bob: IKeyringPair;340  let charlie: IKeyringPair;341342  before(async () => {343    await usingApi(async (api, privateKeyWrapper) => {344      alice = privateKeyWrapper('//Alice');345      bob = privateKeyWrapper('//Bob');346      charlie = privateKeyWrapper('//Charlie');347    });348  });349350  it('Limits have 0 in sponsor timeout, no limits are applied', async () => {351    const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});352    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 0});353    const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible');354    await setCollectionSponsorExpectSuccess(collectionId, alice.address);355    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');356    await transferExpectSuccess(collectionId, tokenId, alice, bob, 10, 'Fungible');357    const aliceBalanceBefore = await getFreeBalance(alice);358    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');359360    // check setting SponsorTimeout = 0, success with next block361    await waitNewBlocks(1);362    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');363    const aliceBalanceAfterSponsoredTransaction1 = await getFreeBalance(alice);364    expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;365    //expect(aliceBalanceAfterSponsoredTransaction1).to.be.lessThan(aliceBalanceBefore);366  });367});368369describe('Collection zero limits (ReFungible)', () => {370  let alice: IKeyringPair;371  let bob: IKeyringPair;372  let charlie: IKeyringPair;373374  before(async function() {375    await requirePallets(this, [Pallets.ReFungible]);376377    await usingApi(async (api, privateKeyWrapper) => {378      alice = privateKeyWrapper('//Alice');379      bob = privateKeyWrapper('//Bob');380      charlie = privateKeyWrapper('//Charlie');381    });382  });383384  it.skip('Limits have 0 in tokens per address field, the chain limits are applied', async () => {385    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});386    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 0});387    for(let i = 0; i < 10; i++){388      await createItemExpectSuccess(alice, collectionId, 'ReFungible');389    }390    await createItemExpectFailure(alice, collectionId, 'ReFungible');391  });392393  it('Limits have 0 in sponsor timeout, no limits are applied', async () => {394395    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});396    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 0});397    const tokenId = await createItemExpectSuccess(alice, collectionId, 'ReFungible');398    await setCollectionSponsorExpectSuccess(collectionId, alice.address);399    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');400    await transferExpectSuccess(collectionId, tokenId, alice, bob, 100, 'ReFungible');401    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');402    const aliceBalanceBefore = await getFreeBalance(alice);403404    // check setting SponsorTimeout = 0, success with next block405    await waitNewBlocks(1);406    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');407    const aliceBalanceAfterSponsoredTransaction1 = await getFreeBalance(alice);408    expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;409    //expect(aliceBalanceAfterSponsoredTransaction1).to.be.lessThan(aliceBalanceBefore);410  });411  412  it('Effective collection limits', async () => {413    await usingApi(async (api) => {414      const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});415      await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});416      417      { // Check that limits is undefined418        const collection = await api.rpc.unique.collectionById(collectionId);419        expect(collection.isSome).to.be.true;420        const limits = collection.unwrap().limits;421        expect(limits).to.be.any;422        423        expect(limits.accountTokenOwnershipLimit.toHuman()).to.be.null;424        expect(limits.sponsoredDataSize.toHuman()).to.be.null;425        expect(limits.sponsoredDataRateLimit.toHuman()).to.be.null;426        expect(limits.tokenLimit.toHuman()).to.be.null;427        expect(limits.sponsorTransferTimeout.toHuman()).to.be.null;428        expect(limits.sponsorApproveTimeout.toHuman()).to.be.null;429        expect(limits.ownerCanTransfer.toHuman()).to.be.true;430        expect(limits.ownerCanDestroy.toHuman()).to.be.null;431        expect(limits.transfersEnabled.toHuman()).to.be.null;432      }433  434      { // Check that limits is undefined for non-existent collection435        const limits = await api.rpc.unique.effectiveCollectionLimits(11111);436        expect(limits.toHuman()).to.be.null;437      }438  439      { // Check that default values defined for collection limits440        const limitsOpt = await api.rpc.unique.effectiveCollectionLimits(collectionId);441        expect(limitsOpt.isNone).to.be.false;442        const limits = limitsOpt.unwrap();443  444        expect(limits.accountTokenOwnershipLimit.toHuman()).to.be.eq('100,000');445        expect(limits.sponsoredDataSize.toHuman()).to.be.eq('2,048');446        expect(limits.sponsoredDataRateLimit.toHuman()).to.be.eq('SponsoringDisabled');447        expect(limits.tokenLimit.toHuman()).to.be.eq('4,294,967,295');448        expect(limits.sponsorTransferTimeout.toHuman()).to.be.eq('5');449        expect(limits.sponsorApproveTimeout.toHuman()).to.be.eq('5');450        expect(limits.ownerCanTransfer.toHuman()).to.be.true;451        expect(limits.ownerCanDestroy.toHuman()).to.be.true;452        expect(limits.transfersEnabled.toHuman()).to.be.true;453      }454455      { //Check the values for collection limits456        await setCollectionLimitsExpectSuccess(alice, collectionId, {457          accountTokenOwnershipLimit: 99_999,458          sponsoredDataSize: 1024,459          tokenLimit: 123,460          transfersEnabled: false,461        });462463        const limitsOpt = await api.rpc.unique.effectiveCollectionLimits(collectionId);464        expect(limitsOpt.isNone).to.be.false;465        const limits = limitsOpt.unwrap();466  467        expect(limits.accountTokenOwnershipLimit.toHuman()).to.be.eq('99,999');468        expect(limits.sponsoredDataSize.toHuman()).to.be.eq('1,024');469        expect(limits.sponsoredDataRateLimit.toHuman()).to.be.eq('SponsoringDisabled');470        expect(limits.tokenLimit.toHuman()).to.be.eq('123');471        expect(limits.sponsorTransferTimeout.toHuman()).to.be.eq('5');472        expect(limits.sponsorApproveTimeout.toHuman()).to.be.eq('5');473        expect(limits.ownerCanTransfer.toHuman()).to.be.true;474        expect(limits.ownerCanDestroy.toHuman()).to.be.true;475        expect(limits.transfersEnabled.toHuman()).to.be.false;476      }477    });478  });479});480481
after · tests/src/limits.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.89// 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 {IKeyringPair} from '@polkadot/types/types';18import {expect, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util/playgrounds';1920describe('Number of tokens per address (NFT)', () => {21  let alice: IKeyringPair;2223  before(async () => {24    await usingPlaygrounds(async (helper, privateKey) => {25      const donor = privateKey('//Alice');26      [alice] = await helper.arrange.createAccounts([10n], donor);27    });28  });2930  itSub.skip('Collection limits allow greater number than chain limits, chain limits are enforced', async ({helper}) => {31    const collection = await helper.nft.mintCollection(alice, {});32    await collection.setLimits(alice, {accountTokenOwnershipLimit: 20});33    34    for(let i = 0; i < 10; i++){35      await expect(collection.mintToken(alice)).to.be.not.rejected;36    }37    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);38    for(let i = 1; i < 11; i++) {39      await expect(collection.burnToken(alice, i)).to.be.not.rejected;40    }41    await collection.burn(alice);42  });43  44  itSub('Collection limits allow lower number than chain limits, collection limits are enforced', async ({helper}) => {45    const collection = await helper.nft.mintCollection(alice, {});46    await collection.setLimits(alice, {accountTokenOwnershipLimit: 1});4748    await collection.mintToken(alice);49    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);50    51    await collection.burnToken(alice, 1);52    await expect(collection.burn(alice)).to.be.not.rejected;53  });54});5556describe('Number of tokens per address (ReFungible)', () => {57  let alice: IKeyringPair;5859  before(async function() {60    await usingPlaygrounds(async (helper, privateKey) => {61      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);6263      const donor = privateKey('//Alice');64      [alice] = await helper.arrange.createAccounts([10n], donor);65    });66  });6768  itSub.skip('Collection limits allow greater number than chain limits, chain limits are enforced', async ({helper}) => {69    const collection = await helper.rft.mintCollection(alice, {});70    await collection.setLimits(alice, {accountTokenOwnershipLimit: 20});71    72    for(let i = 0; i < 10; i++){73      await expect(collection.mintToken(alice, 10n)).to.be.not.rejected;74    }75    await expect(collection.mintToken(alice, 10n)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);76    for(let i = 1; i < 11; i++) {77      await expect(collection.burnToken(alice, i, 10n)).to.be.not.rejected;78    }79    await collection.burn(alice);80  });8182  itSub('Collection limits allow lower number than chain limits, collection limits are enforced', async ({helper}) => {83    const collection = await helper.rft.mintCollection(alice, {});84    await collection.setLimits(alice, {accountTokenOwnershipLimit: 1});8586    await collection.mintToken(alice);87    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);88    89    await collection.burnToken(alice, 1);90    await expect(collection.burn(alice)).to.be.not.rejected;91  });92});9394// todo:playgrounds skipped ~ postponed95describe.skip('Sponsor timeout (NFT) (only for special chain limits test)', () => {96  /*let alice: IKeyringPair;97  let bob: IKeyringPair;98  let charlie: IKeyringPair;99100  before(async () => {101    await usingApi(async (api, privateKeyWrapper) => {102      alice = privateKeyWrapper('//Alice');103      bob = privateKeyWrapper('//Bob');104      charlie = privateKeyWrapper('//Charlie');105    });106  });107108  itSub.skip('Collection limits have greater timeout value than chain limits, collection limits are enforced', async ({helper}) => {109    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});110    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});111    const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');112    await setCollectionSponsorExpectSuccess(collectionId, alice.address);113    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');114    await transferExpectSuccess(collectionId, tokenId, alice, bob);115    const aliceBalanceBefore = await getFreeBalance(alice);116117    // check setting SponsorTimeout = 5, fail118    await waitNewBlocks(5);119    await transferExpectSuccess(collectionId, tokenId, bob, charlie);120    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);121    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);122123    // check setting SponsorTimeout = 7, success124    await waitNewBlocks(2); // 5 + 2125    await transferExpectSuccess(collectionId, tokenId, charlie, bob);126    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);127    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;128    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);129    await destroyCollectionExpectSuccess(collectionId);130  });131132  itSub('Collection limits have lower timeout value than chain limits, chain limits are enforced', async ({helper}) => {133134    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});135    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 1});136    const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');137    await setCollectionSponsorExpectSuccess(collectionId, alice.address);138    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');139    await transferExpectSuccess(collectionId, tokenId, alice, bob);140    const aliceBalanceBefore = await getFreeBalance(alice);141142    // check setting SponsorTimeout = 1, fail143    await waitNewBlocks(1);144    await transferExpectSuccess(collectionId, tokenId, bob, charlie);145    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);146    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);147148    // check setting SponsorTimeout = 5, success149    await waitNewBlocks(4);150    await transferExpectSuccess(collectionId, tokenId, charlie, bob);151    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);152    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;153    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);154    await destroyCollectionExpectSuccess(collectionId);155  });156});157158describe.skip('Sponsor timeout (Fungible) (only for special chain limits test)', () => {159  let alice: IKeyringPair;160  let bob: IKeyringPair;161  let charlie: IKeyringPair;162163  before(async () => {164    await usingApi(async (api, privateKeyWrapper) => {165      alice = privateKeyWrapper('//Alice');166      bob = privateKeyWrapper('//Bob');167      charlie = privateKeyWrapper('//Charlie');168    });169  });170171  itSub('Collection limits have greater timeout value than chain limits, collection limits are enforced', async ({helper}) => {172    const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});173    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});174    const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible');175    await setCollectionSponsorExpectSuccess(collectionId, alice.address);176    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');177    await transferExpectSuccess(collectionId, tokenId, alice, bob, 10, 'Fungible');178    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');179    const aliceBalanceBefore = await getFreeBalance(alice);180181    // check setting SponsorTimeout = 5, fail182    await waitNewBlocks(5);183    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');184    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);185    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);186187    // check setting SponsorTimeout = 7, success188    await waitNewBlocks(2); // 5 + 2189    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');190    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);191    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;192    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);193194    await destroyCollectionExpectSuccess(collectionId);195  });196197  itSub('Collection limits have lower timeout value than chain limits, chain limits are enforced', async ({helper}) => {198199    const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});200    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 1});201    const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible');202    await setCollectionSponsorExpectSuccess(collectionId, alice.address);203    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');204    await transferExpectSuccess(collectionId, tokenId, alice, bob, 10, 'Fungible');205    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');206    const aliceBalanceBefore = await getFreeBalance(alice);207208    // check setting SponsorTimeout = 1, fail209    await waitNewBlocks(1);210    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');211    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);212    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);213214    // check setting SponsorTimeout = 5, success215    await waitNewBlocks(4);216    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');217    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);218    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;219    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);220221    await destroyCollectionExpectSuccess(collectionId);222  });223});224225describe.skip('Sponsor timeout (ReFungible) (only for special chain limits test)', () => {226  let alice: IKeyringPair;227  let bob: IKeyringPair;228  let charlie: IKeyringPair;229230  before(async () => {231    await usingApi(async (api, privateKeyWrapper) => {232      alice = privateKeyWrapper('//Alice');233      bob = privateKeyWrapper('//Bob');234      charlie = privateKeyWrapper('//Charlie');235    });236  });237238  itSub('Collection limits have greater timeout value than chain limits, collection limits are enforced', async ({helper}) => {239    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});240    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});241    const tokenId = await createItemExpectSuccess(alice, collectionId, 'ReFungible');242    await setCollectionSponsorExpectSuccess(collectionId, alice.address);243    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');244    await transferExpectSuccess(collectionId, tokenId, alice, bob, 100, 'ReFungible');245    const aliceBalanceBefore = await getFreeBalance(alice);246247    // check setting SponsorTimeout = 5, fail248    await waitNewBlocks(5);249    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');250    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);251    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);252253    // check setting SponsorTimeout = 7, success254    await waitNewBlocks(2); // 5 + 2255    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');256    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);257    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;258    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);259    await destroyCollectionExpectSuccess(collectionId);260  });261262  itSub('Collection limits have lower timeout value than chain limits, chain limits are enforced', async ({helper}) => {263264    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});265    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 1});266    const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');267    await setCollectionSponsorExpectSuccess(collectionId, alice.address);268    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');269    await transferExpectSuccess(collectionId, tokenId, alice, bob);270    const aliceBalanceBefore = await getFreeBalance(alice);271272    // check setting SponsorTimeout = 1, fail273    await waitNewBlocks(1);274    await transferExpectSuccess(collectionId, tokenId, bob, charlie);275    const aliceBalanceAfterUnsponsoredTransaction = await getFreeBalance(alice);276    expect(aliceBalanceAfterUnsponsoredTransaction).to.be.equals(aliceBalanceBefore);277278    // check setting SponsorTimeout = 5, success279    await waitNewBlocks(4);280    await transferExpectSuccess(collectionId, tokenId, charlie, bob);281    const aliceBalanceAfterSponsoredTransaction = await getFreeBalance(alice);282    expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;283    //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);284    await destroyCollectionExpectSuccess(collectionId);285  });*/286});287288describe('Collection zero limits (NFT)', () => {289  let alice: IKeyringPair;290  let bob: IKeyringPair;291  let charlie: IKeyringPair;292293  before(async () => {294    await usingPlaygrounds(async (helper, privateKey) => {295      const donor = privateKey('//Alice');296      [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);297    });298  });299300  itSub.skip('Limits have 0 in tokens per address field, the chain limits are applied', async ({helper}) => {301    const collection = await helper.nft.mintCollection(alice, {});302    await collection.setLimits(alice, {accountTokenOwnershipLimit: 0});303304    for(let i = 0; i < 10; i++){305      await collection.mintToken(alice);306    }307    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);308  });309310  itSub('Limits have 0 in sponsor timeout, no limits are applied', async ({helper}) => {311    const collection = await helper.nft.mintCollection(alice, {});312    await collection.setLimits(alice, {sponsorTransferTimeout: 0});313    const token = await collection.mintToken(alice);314315    await collection.setSponsor(alice, alice.address);316    await collection.confirmSponsorship(alice);317    318    await token.transfer(alice, {Substrate: bob.address});319    const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);320321    // check setting SponsorTimeout = 0, success with next block322    await helper.wait.newBlocks(1);323    await token.transfer(bob, {Substrate: charlie.address});324    const aliceBalanceAfterSponsoredTransaction1 = await helper.balance.getSubstrate(alice.address);325    expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;326  });327});328329describe('Collection zero limits (Fungible)', () => {330  let alice: IKeyringPair;331  let bob: IKeyringPair;332  let charlie: IKeyringPair;333334  before(async () => {335    await usingPlaygrounds(async (helper, privateKey) => {336      const donor = privateKey('//Alice');337      [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);338    });339  });340341  itSub('Limits have 0 in sponsor timeout, no limits are applied', async ({helper}) => {342    const collection = await helper.ft.mintCollection(alice, {});343    await collection.setLimits(alice, {sponsorTransferTimeout: 0});344    await collection.mint(alice, 3n);345346    await collection.setSponsor(alice, alice.address);347    await collection.confirmSponsorship(alice);348    349    await collection.transfer(alice, {Substrate: bob.address}, 2n);350    const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);351352    // check setting SponsorTimeout = 0, success with next block353    await helper.wait.newBlocks(1);354    await collection.transfer(bob, {Substrate: charlie.address});355    const aliceBalanceAfterSponsoredTransaction1 = await helper.balance.getSubstrate(alice.address);356    expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;357  });358});359360describe('Collection zero limits (ReFungible)', () => {361  let alice: IKeyringPair;362  let bob: IKeyringPair;363  let charlie: IKeyringPair;364365  before(async function() {366    await usingPlaygrounds(async (helper, privateKey) => {367      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);368369      const donor = privateKey('//Alice');370      [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);371    });372  });373374  itSub.skip('Limits have 0 in tokens per address field, the chain limits are applied', async ({helper}) => {375    const collection = await helper.rft.mintCollection(alice, {});376    await collection.setLimits(alice, {accountTokenOwnershipLimit: 0});377    for(let i = 0; i < 10; i++){378      await collection.mintToken(alice);379    }380    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);381  });382383  itSub('Limits have 0 in sponsor timeout, no limits are applied', async ({helper}) => {384    const collection = await helper.rft.mintCollection(alice, {});385    await collection.setLimits(alice, {sponsorTransferTimeout: 0});386    const token = await collection.mintToken(alice, 3n);387388    await collection.setSponsor(alice, alice.address);389    await collection.confirmSponsorship(alice);390    391    await token.transfer(alice, {Substrate: bob.address}, 2n);392    const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);393394    // check setting SponsorTimeout = 0, success with next block395    await helper.wait.newBlocks(1);396    await token.transfer(bob, {Substrate: charlie.address});397    const aliceBalanceAfterSponsoredTransaction1 = await helper.balance.getSubstrate(alice.address);398    expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;399  });400});401402describe('Effective collection limits (NFT)', () => {403  let alice: IKeyringPair;404405  before(async () => {406    await usingPlaygrounds(async (helper, privateKey) => {407      const donor = privateKey('//Alice');408      [alice] = await helper.arrange.createAccounts([10n], donor);409    });410  });411  412  itSub('Effective collection limits', async ({helper}) => {413    const collection = await helper.nft.mintCollection(alice, {});414    await collection.setLimits(alice, {ownerCanTransfer: true});    415    416    { 417      // Check that limits are undefined418      const collectionInfo = await collection.getData();419      const limits = collectionInfo?.raw.limits;420      expect(limits).to.be.any;421      422      expect(limits.accountTokenOwnershipLimit).to.be.null;423      expect(limits.sponsoredDataSize).to.be.null;424      expect(limits.sponsoredDataRateLimit).to.be.null;425      expect(limits.tokenLimit).to.be.null;426      expect(limits.sponsorTransferTimeout).to.be.null;427      expect(limits.sponsorApproveTimeout).to.be.null;428      expect(limits.ownerCanTransfer).to.be.true;429      expect(limits.ownerCanDestroy).to.be.null;430      expect(limits.transfersEnabled).to.be.null;431    }432433    { // Check that limits is undefined for non-existent collection434      const limits = await helper.collection.getEffectiveLimits(999999);435      expect(limits).to.be.null;436    }437438    { // Check that default values defined for collection limits439      const limits = await collection.getEffectiveLimits();440441      expect(limits.accountTokenOwnershipLimit).to.be.eq(100000);442      expect(limits.sponsoredDataSize).to.be.eq(2048);443      expect(limits.sponsoredDataRateLimit).to.be.deep.eq({sponsoringDisabled: null});444      expect(limits.tokenLimit).to.be.eq(4294967295);445      expect(limits.sponsorTransferTimeout).to.be.eq(5);446      expect(limits.sponsorApproveTimeout).to.be.eq(5);447      expect(limits.ownerCanTransfer).to.be.true;448      expect(limits.ownerCanDestroy).to.be.true;449      expect(limits.transfersEnabled).to.be.true;450    }451452    { 453      // Check the values for collection limits454      await collection.setLimits(alice, {455        accountTokenOwnershipLimit: 99_999,456        sponsoredDataSize: 1024,457        tokenLimit: 123,458        transfersEnabled: false,459      });460461      const limits = await collection.getEffectiveLimits();462463      expect(limits.accountTokenOwnershipLimit).to.be.eq(99999);464      expect(limits.sponsoredDataSize).to.be.eq(1024);465      expect(limits.sponsoredDataRateLimit).to.be.deep.eq({sponsoringDisabled: null});466      expect(limits.tokenLimit).to.be.eq(123);467      expect(limits.sponsorTransferTimeout).to.be.eq(5);468      expect(limits.sponsorApproveTimeout).to.be.eq(5);469      expect(limits.ownerCanTransfer).to.be.true;470      expect(limits.ownerCanDestroy).to.be.true;471      expect(limits.transfersEnabled).to.be.false;472    }473  });474});
modifiedtests/src/nextSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/nextSponsoring.test.ts
+++ b/tests/src/nextSponsoring.test.ts
@@ -14,100 +14,84 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-import {ApiPromise} from '@polkadot/api';
 import {IKeyringPair} from '@polkadot/types/types';
-import chai from 'chai';
-import chaiAsPromised from 'chai-as-promised';
-import {default as usingApi} from './substrate/substrate-api';
-import {
-  createCollectionExpectSuccess,
-  setCollectionSponsorExpectSuccess,
-  confirmSponsorshipExpectSuccess,
-  createItemExpectSuccess,
-  transferExpectSuccess,
-  normalizeAccountId,
-  getNextSponsored,
-  requirePallets,
-  Pallets,
-} from './util/helpers';
-
-chai.use(chaiAsPromised);
-const expect = chai.expect;
+import {expect, itSub, Pallets, usingPlaygrounds} from './util/playgrounds';
 
+const SPONSORING_TIMEOUT = 5;
 
-
 describe('Integration Test getNextSponsored(collection_id, owner, item_id):', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice, bob] = await helper.arrange.createAccounts([20n, 10n], donor);
     });
   });
 
-  it('NFT', async () => {
-    await usingApi(async (api: ApiPromise) => {
+  itSub('NFT', async ({helper}) => {
+    // Non-existing collection
+    expect(await helper.collection.getTokenNextSponsored(0, 0, {Substrate: alice.address})).to.be.null;
 
-      // Not existing collection 
-      expect(await getNextSponsored(api, 0, normalizeAccountId(alice), 0)).to.be.equal(-1);
+    const collection = await helper.nft.mintCollection(alice, {});
+    const token = await collection.mintToken(alice);
 
-      const collectionId = await createCollectionExpectSuccess();
-      const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', alice.address);
+    // Check with Disabled sponsoring state
+    expect(await token.getNextSponsored({Substrate: alice.address})).to.be.null;
+    
+    // Check with Unconfirmed sponsoring state
+    await collection.setSponsor(alice, bob.address);
+    expect(await token.getNextSponsored({Substrate: alice.address})).to.be.null;
 
-      // Check with Disabled sponsoring state
-      expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId)).to.be.equal(-1);
-      await setCollectionSponsorExpectSuccess(collectionId, bob.address);
+    // Check with Confirmed sponsoring state
+    await collection.confirmSponsorship(bob);
+    expect(await token.getNextSponsored({Substrate: alice.address})).to.be.equal(0);
 
-      // Check with Unconfirmed sponsoring state
-      expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId)).to.be.equal(-1);
-      await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
+    // Check after transfer
+    await token.transfer(alice, {Substrate: bob.address});
+    expect(await token.getNextSponsored({Substrate: alice.address})).to.be.lessThanOrEqual(SPONSORING_TIMEOUT);
 
-      // Check with Confirmed sponsoring state
-      expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId)).to.be.equal(0);
+    // Non-existing token 
+    expect(await collection.getTokenNextSponsored(0, {Substrate: alice.address})).to.be.null;
+  });
 
-      // After transfer
-      await transferExpectSuccess(collectionId, itemId, alice, bob, 1);
-      expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId)).to.be.lessThanOrEqual(5);
+  itSub('Fungible', async ({helper}) => {
+    const collection = await helper.ft.mintCollection(alice, {});
+    await collection.mint(alice, 10n);
 
-      // Not existing token 
-      expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId+1)).to.be.equal(-1);
-    });
-  });
+    // Check with Disabled sponsoring state
+    expect(await collection.getTokenNextSponsored(0, {Substrate: alice.address})).to.be.null;
 
-  it('Fungible', async () => {
-    await usingApi(async (api: ApiPromise) => {
-
-      const createMode = 'Fungible';
-      const funCollectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});
-      await createItemExpectSuccess(alice, funCollectionId, createMode);
-      await setCollectionSponsorExpectSuccess(funCollectionId, bob.address);
-      await confirmSponsorshipExpectSuccess(funCollectionId, '//Bob');
-      expect(await getNextSponsored(api, funCollectionId, normalizeAccountId(alice), 0)).to.be.equal(0);
+    await collection.setSponsor(alice, bob.address);
+    await collection.confirmSponsorship(bob);
+    
+    // Check with Confirmed sponsoring state
+    expect(await collection.getTokenNextSponsored(0, {Substrate: alice.address})).to.be.equal(0);
 
-      await transferExpectSuccess(funCollectionId, 0, alice, bob, 10, 'Fungible');
-      expect(await getNextSponsored(api, funCollectionId, normalizeAccountId(alice), 0)).to.be.lessThanOrEqual(5);
-    });
+    // Check after transfer
+    await collection.transfer(alice, {Substrate: bob.address});
+    expect(await collection.getTokenNextSponsored(0, {Substrate: alice.address})).to.be.lessThanOrEqual(SPONSORING_TIMEOUT);
   });
 
-  it('ReFungible', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
+  itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice, {});
+    const token = await collection.mintToken(alice, 10n);
 
-    await usingApi(async (api: ApiPromise) => {
+    // Check with Disabled sponsoring state
+    expect(await token.getNextSponsored({Substrate: alice.address})).to.be.null;
 
-      const createMode = 'ReFungible';
-      const refunCollectionId = await createCollectionExpectSuccess({mode: {type: createMode}});
-      const refunItemId = await createItemExpectSuccess(alice, refunCollectionId, createMode);
-      await setCollectionSponsorExpectSuccess(refunCollectionId, bob.address);
-      await confirmSponsorshipExpectSuccess(refunCollectionId, '//Bob');
-      expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId)).to.be.equal(0);
+    await collection.setSponsor(alice, bob.address);
+    await collection.confirmSponsorship(bob);
+
+    // Check with Confirmed sponsoring state
+    expect(await token.getNextSponsored({Substrate: alice.address})).to.be.equal(0);
 
-      await transferExpectSuccess(refunCollectionId, refunItemId, alice, bob, 10, 'ReFungible');
-      expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId)).to.be.lessThanOrEqual(5);
+    // Check after transfer
+    await token.transfer(alice, {Substrate: bob.address});
+    expect(await token.getNextSponsored({Substrate: alice.address})).to.be.lessThanOrEqual(SPONSORING_TIMEOUT);
 
-      // Not existing token 
-      expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId+1)).to.be.equal(-1);
-    });
+    // Non-existing token 
+    expect(await collection.getTokenNextSponsored(0, {Substrate: alice.address})).to.be.null;
   });
 });
modifiedtests/src/refungible.test.tsdiffbeforeafterboth
--- a/tests/src/refungible.test.ts
+++ b/tests/src/refungible.test.ts
@@ -35,7 +35,7 @@
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
 
     const itemCountBefore = await collection.getLastTokenId();
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 100n);
+    const token = await collection.mintToken(alice, 100n);
     
     const itemCountAfter = await collection.getLastTokenId();
     
@@ -48,7 +48,7 @@
   itSub('Checking RPC methods when interacting with maximum allowed values (MAX_REFUNGIBLE_PIECES)', async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
     
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, MAX_REFUNGIBLE_PIECES);
+    const token = await collection.mintToken(alice, MAX_REFUNGIBLE_PIECES);
     
     expect(await collection.getTokenBalance(token.tokenId, {Substrate: alice.address})).to.be.equal(MAX_REFUNGIBLE_PIECES);
     
@@ -56,7 +56,7 @@
     expect(await collection.getTokenBalance(token.tokenId, {Substrate: bob.address})).to.be.equal(MAX_REFUNGIBLE_PIECES);
     expect(await token.getTotalPieces()).to.be.equal(MAX_REFUNGIBLE_PIECES);
     
-    await expect(collection.mintToken(alice, {Substrate: alice.address}, MAX_REFUNGIBLE_PIECES + 1n))
+    await expect(collection.mintToken(alice, MAX_REFUNGIBLE_PIECES + 1n))
       .to.eventually.be.rejectedWith(/refungible\.WrongRefungiblePieces/);
   });
   
@@ -66,7 +66,7 @@
 
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
 
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 10_000n);
+    const token = await collection.mintToken(alice, 10_000n);
 
     await token.transfer(alice, {Substrate: bob.address}, 1000n);
     await token.transfer(alice, ethAcc, 900n);
@@ -88,7 +88,7 @@
   
   itSub('Transfer token pieces', async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 100n);
+    const token = await collection.mintToken(alice, 100n);
 
     expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);
     expect(await token.transfer(alice, {Substrate: bob.address}, 60n)).to.be.true;
@@ -120,7 +120,7 @@
 
   itSub('Burn some pieces', async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 100n);
+    const token = await collection.mintToken(alice, 100n);
     expect(await collection.isTokenExists(token.tokenId)).to.be.true;
     expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);
     expect((await token.burn(alice, 99n)).success).to.be.true;
@@ -130,7 +130,7 @@
 
   itSub('Burn all pieces', async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 100n);
+    const token = await collection.mintToken(alice, 100n);
     
     expect(await collection.isTokenExists(token.tokenId)).to.be.true;
     expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);
@@ -141,7 +141,7 @@
 
   itSub('Burn some pieces for multiple users', async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 100n);
+    const token = await collection.mintToken(alice, 100n);
 
     expect(await collection.isTokenExists(token.tokenId)).to.be.true;
     
@@ -168,7 +168,7 @@
 
   itSub('Set allowance for token', async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 100n);
+    const token = await collection.mintToken(alice, 100n);
     
     expect(await token.getBalance({Substrate: alice.address})).to.be.equal(100n);
 
@@ -183,7 +183,7 @@
 
   itSub('Repartition', async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 100n);
+    const token = await collection.mintToken(alice, 100n);
 
     expect(await token.repartition(alice, 200n)).to.be.true;
     expect(await token.getBalance({Substrate: alice.address})).to.be.equal(200n);
@@ -207,7 +207,7 @@
 
   itSub('Repartition with increased amount', async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 100n);
+    const token = await collection.mintToken(alice, 100n);
     await token.repartition(alice, 200n);
     const chainEvents = helper.chainLog.slice(-1)[0].events.map((x: any) => x.event);
     expect(chainEvents).to.include.deep.members([{
@@ -225,7 +225,7 @@
 
   itSub('Repartition with decreased amount', async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
-    const token = await collection.mintToken(alice, {Substrate: alice.address}, 100n);
+    const token = await collection.mintToken(alice, 100n);
     await token.repartition(alice, 50n);
     const chainEvents = helper.chainLog.slice(-1)[0].events.map((x: any) => x.event);
     expect(chainEvents).to.include.deep.members([{
modifiedtests/src/rpc.test.tsdiffbeforeafterboth
--- a/tests/src/rpc.test.ts
+++ b/tests/src/rpc.test.ts
@@ -44,7 +44,7 @@
     
     const collection = await helper.ft.mintCollection(alice, {name: 'RPC-2', tokenPrefix: 'RPC'});
     // mint some maximum (u128) amounts of tokens possible
-    await collection.mint(alice, {Substrate: alice.address}, (1n << 128n) - 1n);
+    await collection.mint(alice, (1n << 128n) - 1n);
     
     await collection.transfer(alice, {Substrate: bob.address}, 1000n);
     await collection.transfer(alice, ethAcc, 900n);
modifiedtests/src/transfer.test.tsdiffbeforeafterboth
--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -54,7 +54,7 @@
 
   itSub('[nft] User can transfer owned token', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'Transfer-1-NFT', description: '', tokenPrefix: 'T'});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
 
     await nft.transfer(alice, {Substrate: bob.address});
     expect(await nft.getOwner()).to.be.deep.equal({Substrate: bob.address});
@@ -62,7 +62,7 @@
 
   itSub('[fungible] User can transfer owned token', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'Transfer-1-FT', description: '', tokenPrefix: 'T'});
-    await collection.mint(alice, {Substrate: alice.address}, 10n);
+    await collection.mint(alice, 10n);
 
     await collection.transfer(alice, {Substrate: bob.address}, 9n);
     expect(await collection.getBalance({Substrate: bob.address})).to.be.equal(9n);
@@ -71,7 +71,7 @@
 
   itSub.ifWithPallets('[refungible] User can transfer owned token', [Pallets.ReFungible], async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'Transfer-1-RFT', description: '', tokenPrefix: 'T'});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);
+    const rft = await collection.mintToken(alice, 10n);
 
     await rft.transfer(alice, {Substrate: bob.address}, 9n);
     expect(await rft.getBalance({Substrate: bob.address})).to.be.equal(9n);
@@ -92,7 +92,7 @@
     const collection = await helper.ft.mintCollection(alice, {name: 'Transfer-2-FT', description: '', tokenPrefix: 'T'});
     await collection.addAdmin(alice, {Substrate: bob.address});
 
-    await collection.mint(bob, {Substrate: bob.address}, 10n);
+    await collection.mint(bob, 10n, {Substrate: bob.address});
     await collection.transfer(bob, {Substrate: alice.address}, 1n);
 
     expect(await collection.getBalance({Substrate: bob.address})).to.be.equal(9n);
@@ -103,7 +103,7 @@
     const collection = await helper.rft.mintCollection(alice, {name: 'Transfer-2-RFT', description: '', tokenPrefix: 'T'});
     await collection.addAdmin(alice, {Substrate: bob.address});
 
-    const rft = await collection.mintToken(bob, {Substrate: bob.address}, 10n);
+    const rft = await collection.mintToken(bob, 10n, {Substrate: bob.address});
     await rft.transfer(bob, {Substrate: alice.address}, 1n);
 
     expect(await rft.getBalance({Substrate: bob.address})).to.be.equal(9n);
@@ -142,7 +142,7 @@
 
   itSub('[nft] Transfer with deleted collection_id', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'Transfer-Neg-1-NFT', description: '', tokenPrefix: 'T'});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
 
     await nft.burn(alice);
     await collection.burn(alice);
@@ -153,7 +153,7 @@
 
   itSub('[fungible] Transfer with deleted collection_id', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'Transfer-Neg-1-FT', description: '', tokenPrefix: 'T'});
-    await collection.mint(alice, {Substrate: alice.address}, 10n);
+    await collection.mint(alice, 10n);
 
     await collection.burnTokens(alice, 10n);
     await collection.burn(alice);
@@ -164,7 +164,7 @@
   
   itSub.ifWithPallets('[refungible] Transfer with deleted collection_id', [Pallets.ReFungible], async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'Transfer-Neg-1-RFT', description: '', tokenPrefix: 'T'});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);
+    const rft = await collection.mintToken(alice, 10n);
 
     await rft.burn(alice, 10n);
     await collection.burn(alice);
@@ -193,7 +193,7 @@
 
   itSub('[nft] Transfer with deleted item_id', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'Transfer-Neg-3-NFT', description: '', tokenPrefix: 'T'});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
 
     await nft.burn(alice);
 
@@ -203,7 +203,7 @@
 
   itSub('[fungible] Transfer with deleted item_id', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'Transfer-Neg-3-FT', description: '', tokenPrefix: 'T'});
-    await collection.mint(alice, {Substrate: alice.address}, 10n);
+    await collection.mint(alice, 10n);
 
     await collection.burnTokens(alice, 10n);
 
@@ -213,7 +213,7 @@
 
   itSub.ifWithPallets('[refungible] Transfer with deleted item_id', [Pallets.ReFungible], async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'Transfer-Neg-3-RFT', description: '', tokenPrefix: 'T'});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);
+    const rft = await collection.mintToken(alice, 10n);
 
     await rft.burn(alice, 10n);
 
@@ -223,7 +223,7 @@
 
   itSub('[nft] Transfer with recipient that is not owner', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'Transfer-Neg-4-NFT', description: '', tokenPrefix: 'T'});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
 
     await expect(nft.transfer(bob, {Substrate: bob.address}))
       .to.be.rejectedWith(/common\.NoPermission/);
@@ -232,7 +232,7 @@
 
   itSub('[fungible] Transfer with recipient that is not owner', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'Transfer-Neg-4-FT', description: '', tokenPrefix: 'T'});
-    await collection.mint(alice, {Substrate: alice.address}, 10n);
+    await collection.mint(alice, 10n);
 
     await expect(collection.transfer(bob, {Substrate: bob.address}, 9n))
       .to.be.rejectedWith(/common\.TokenValueTooLow/);
@@ -242,7 +242,7 @@
 
   itSub.ifWithPallets('[refungible] Transfer with recipient that is not owner', [Pallets.ReFungible], async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'Transfer-1-RFT', description: '', tokenPrefix: 'T'});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);
+    const rft = await collection.mintToken(alice, 10n);
 
     await expect(rft.transfer(bob, {Substrate: bob.address}, 9n))
       .to.be.rejectedWith(/common\.TokenValueTooLow/);
@@ -263,7 +263,7 @@
   itEth('Transfers to self. In case of same frontend', async ({helper}) => {
     const [owner] = await helper.arrange.createAccounts([10n], donor);
     const collection = await helper.ft.mintCollection(owner, {});
-    await collection.mint(owner, {Substrate: owner.address}, 100n);
+    await collection.mint(owner, 100n);
 
     const ownerProxy = helper.address.substrateToEth(owner.address);
 
@@ -281,7 +281,7 @@
   itEth('Transfers to self. In case of substrate-evm boundary', async ({helper}) => {
     const [owner] = await helper.arrange.createAccounts([10n], donor);
     const collection = await helper.ft.mintCollection(owner, {});
-    await collection.mint(owner, {Substrate: owner.address}, 100n);
+    await collection.mint(owner, 100n);
 
     const ownerProxy = helper.address.substrateToEth(owner.address);
 
@@ -299,7 +299,7 @@
   itEth('Transfers to self. In case of inside substrate-evm', async ({helper}) => {
     const [owner] = await helper.arrange.createAccounts([10n], donor);
     const collection = await helper.ft.mintCollection(owner, {});
-    await collection.mint(owner, {Substrate: owner.address}, 100n);
+    await collection.mint(owner, 100n);
 
     // transfer to self again
     await collection.transfer(owner, {Substrate: owner.address}, 10n);
@@ -313,7 +313,7 @@
   itEth('Transfers to self. In case of inside substrate-evm when not enought "Fungibles"', async ({helper}) => {
     const [owner] = await helper.arrange.createAccounts([10n], donor);
     const collection = await helper.ft.mintCollection(owner, {});
-    await collection.mint(owner, {Substrate: owner.address}, 10n);
+    await collection.mint(owner, 10n);
 
     // transfer to self again
     await expect(collection.transfer(owner, {Substrate: owner.address}, 11n))
modifiedtests/src/transferFrom.test.tsdiffbeforeafterboth
--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -31,7 +31,7 @@
 
   itSub('[nft] Execute the extrinsic and check nftItemList - owner of token', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-1', description: '', tokenPrefix: 'TF'});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
     await nft.approve(alice, {Substrate: bob.address});
     expect(await nft.isApproved({Substrate: bob.address})).to.be.true;
 
@@ -41,7 +41,7 @@
 
   itSub('[fungible] Execute the extrinsic and check nftItemList - owner of token', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-2', description: '', tokenPrefix: 'TF'});
-    await collection.mint(alice, {Substrate: alice.address}, 10n);
+    await collection.mint(alice, 10n);
     await collection.approveTokens(alice, {Substrate: bob.address}, 7n);
     expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(7n);
     
@@ -53,7 +53,7 @@
 
   itSub.ifWithPallets('[refungible] Execute the extrinsic and check nftItemList - owner of token', [Pallets.ReFungible], async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-3', description: '', tokenPrefix: 'TF'});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);
+    const rft = await collection.mintToken(alice, 10n);
     await rft.approve(alice, {Substrate: bob.address}, 7n);
     expect(await rft.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(7n);
     
@@ -66,7 +66,7 @@
   itSub('Should reduce allowance if value is big', async ({helper}) => {
     // fungible
     const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-4', description: '', tokenPrefix: 'TF'});
-    await collection.mint(alice, {Substrate: alice.address}, 500000n);
+    await collection.mint(alice, 500000n);
 
     await collection.approveTokens(alice, {Substrate: bob.address}, 500000n);
     expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(500000n);
@@ -118,7 +118,7 @@
 
   itSub('[nft] transferFrom for not approved address', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-1', description: '', tokenPrefix: 'TF'});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
 
     await expect(nft.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}))
       .to.be.rejectedWith(/common\.ApprovedValueTooLow/);
@@ -127,7 +127,7 @@
 
   itSub('[fungible] transferFrom for not approved address', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-1', description: '', tokenPrefix: 'TF'});
-    await collection.mint(alice, {Substrate: alice.address}, 10n);
+    await collection.mint(alice, 10n);
 
     await expect(collection.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}, 5n))
       .to.be.rejectedWith(/common\.ApprovedValueTooLow/);
@@ -138,7 +138,7 @@
 
   itSub.ifWithPallets('[refungible] transferFrom for not approved address', [Pallets.ReFungible], async({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-3', description: '', tokenPrefix: 'TF'});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);
+    const rft = await collection.mintToken(alice, 10n);
 
     await expect(rft.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}))
       .to.be.rejectedWith(/common\.ApprovedValueTooLow/);
@@ -149,7 +149,7 @@
 
   itSub('[nft] transferFrom incorrect token count', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-4', description: '', tokenPrefix: 'TF'});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
 
     await nft.approve(alice, {Substrate: bob.address});
     expect(await nft.isApproved({Substrate: bob.address})).to.be.true;
@@ -167,7 +167,7 @@
 
   itSub('[fungible] transferFrom incorrect token count', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-5', description: '', tokenPrefix: 'TF'});
-    await collection.mint(alice, {Substrate: alice.address}, 10n);
+    await collection.mint(alice, 10n);
 
     await collection.approveTokens(alice, {Substrate: bob.address}, 2n);
     expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(2n);
@@ -181,7 +181,7 @@
 
   itSub.ifWithPallets('[refungible] transferFrom incorrect token count', [Pallets.ReFungible], async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-6', description: '', tokenPrefix: 'TF'});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);
+    const rft = await collection.mintToken(alice, 10n);
 
     await rft.approve(alice, {Substrate: bob.address}, 5n);
     expect(await rft.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(5n);
@@ -195,7 +195,7 @@
 
   itSub('[nft] execute transferFrom from account that is not owner of collection', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-7', description: '', tokenPrefix: 'TF'});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
 
     await expect(nft.approve(charlie, {Substrate: bob.address})).to.be.rejectedWith(/common\.CantApproveMoreThanOwned/);
     expect(await nft.isApproved({Substrate: bob.address})).to.be.false;
@@ -210,7 +210,7 @@
 
   itSub('[fungible] execute transferFrom from account that is not owner of collection', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-8', description: '', tokenPrefix: 'TF'});
-    await collection.mint(alice, {Substrate: alice.address}, 10000n);
+    await collection.mint(alice, 10000n);
 
     await expect(collection.approveTokens(charlie, {Substrate: bob.address}, 1n)).to.be.rejectedWith(/common\.CantApproveMoreThanOwned/);
     expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(0n);
@@ -228,7 +228,7 @@
 
   itSub.ifWithPallets('[refungible] execute transferFrom from account that is not owner of collection', [Pallets.ReFungible], async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-9', description: '', tokenPrefix: 'TF'});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10000n);
+    const rft = await collection.mintToken(alice, 10000n);
 
     await expect(rft.approve(charlie, {Substrate: bob.address}, 1n)).to.be.rejectedWith(/common\.CantApproveMoreThanOwned/);
     expect(await rft.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(0n);
@@ -247,7 +247,7 @@
   itSub('transferFrom burnt token before approve NFT', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-10', description: '', tokenPrefix: 'TF'});
     await collection.setLimits(alice, {ownerCanTransfer: true});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
 
     await nft.burn(alice);
     await expect(nft.approve(alice, {Substrate: bob.address})).to.be.rejectedWith(/common\.TokenNotFound/);
@@ -262,7 +262,7 @@
   itSub('transferFrom burnt token before approve Fungible', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-11', description: '', tokenPrefix: 'TF'});
     await collection.setLimits(alice, {ownerCanTransfer: true});
-    await collection.mint(alice, {Substrate: alice.address}, 10n);
+    await collection.mint(alice, 10n);
 
     await collection.burnTokens(alice, 10n);
     await expect(collection.approveTokens(alice, {Substrate: bob.address})).to.be.not.rejected;
@@ -277,7 +277,7 @@
   itSub.ifWithPallets('transferFrom burnt token before approve ReFungible', [Pallets.ReFungible], async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-12', description: '', tokenPrefix: 'TF'});
     await collection.setLimits(alice, {ownerCanTransfer: true});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);
+    const rft = await collection.mintToken(alice, 10n);
 
     await rft.burn(alice, 10n);
     await expect(rft.approve(alice, {Substrate: bob.address})).to.be.rejectedWith(/common\.CantApproveMoreThanOwned/);
@@ -291,7 +291,7 @@
 
   itSub('transferFrom burnt token after approve NFT', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-13', description: '', tokenPrefix: 'TF'});
-    const nft = await collection.mintToken(alice, {Substrate: alice.address});
+    const nft = await collection.mintToken(alice);
 
     await nft.approve(alice, {Substrate: bob.address});
     expect(await nft.isApproved({Substrate: bob.address})).to.be.true;
@@ -307,7 +307,7 @@
 
   itSub('transferFrom burnt token after approve Fungible', async ({helper}) => {
     const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-14', description: '', tokenPrefix: 'TF'});
-    await collection.mint(alice, {Substrate: alice.address}, 10n);
+    await collection.mint(alice, 10n);
 
     await collection.approveTokens(alice, {Substrate: bob.address});
     expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(1n);
@@ -323,7 +323,7 @@
 
   itSub.ifWithPallets('transferFrom burnt token after approve ReFungible', [Pallets.ReFungible], async ({helper}) => {
     const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-15', description: '', tokenPrefix: 'TF'});
-    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);
+    const rft = await collection.mintToken(alice, 10n);
 
     await rft.approve(alice, {Substrate: bob.address}, 10n);
     expect(await rft.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(10n);
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -1678,7 +1678,7 @@
    * @example mintTokens(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq"}, 1000n);
    * @returns ```true``` if extrinsic success, otherwise ```false``` 
    */
-  async mintTokens(signer: TSigner, collectionId: number, owner: ICrossAccountId | string, amount: bigint): Promise<boolean> {
+  async mintTokens(signer: TSigner, collectionId: number, amount: bigint, owner: ICrossAccountId | string): Promise<boolean> {
     const creationResult = await this.helper.executeExtrinsic(
       signer,
       'api.tx.unique.createItem', [collectionId, (typeof owner === 'string') ? {Substrate: owner} : owner, {
@@ -1699,7 +1699,7 @@
    * @param tokens array of tokens with properties and pieces
    * @returns ```true``` if extrinsic success, otherwise ```false``` 
    */
-  async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {value: bigint}[]): Promise<boolean> {
+  async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, tokens: {value: bigint}[], owner: ICrossAccountId): Promise<boolean> {
     const rawTokens = [];
     for (const token of tokens) {
       const raw = {Fungible: {Value: token.value}};
@@ -2211,7 +2211,7 @@
     return await this.helper.nft.isTokenApproved(this.collectionId, tokenId, toAddressObj);
   }
 
-  async mintToken(signer: TSigner, owner: ICrossAccountId, properties?: IProperty[]) {
+  async mintToken(signer: TSigner, owner: ICrossAccountId = {Substrate: signer.address}, properties?: IProperty[]) {
     return await this.helper.nft.mintToken(signer, {collectionId: this.collectionId, owner, properties});
   }
 
@@ -2286,11 +2286,11 @@
     return await this.helper.rft.repartitionToken(signer, this.collectionId, tokenId, amount);
   }
 
-  async mintToken(signer: TSigner, owner: ICrossAccountId, pieces=100n, properties?: IProperty[]) {
+  async mintToken(signer: TSigner, pieces=1n, owner: ICrossAccountId = {Substrate: signer.address}, properties?: IProperty[]) {
     return await this.helper.rft.mintToken(signer, {collectionId: this.collectionId, owner, pieces, properties});
   }
 
-  async mintMultipleTokens(signer: TSigner, tokens: {owner: ICrossAccountId, pieces: bigint, properties?: IProperty[]}[]) {
+  async mintMultipleTokens(signer: TSigner, tokens: {pieces: bigint, owner: ICrossAccountId, properties?: IProperty[]}[]) {
     return await this.helper.rft.mintMultipleTokens(signer, this.collectionId, tokens);
   }
 
@@ -2313,12 +2313,12 @@
 
 
 class UniqueFTCollection extends UniqueCollectionBase {
-  async mint(signer: TSigner, owner: ICrossAccountId, amount: bigint) {
-    return await this.helper.ft.mintTokens(signer, this.collectionId, owner, amount);
+  async mint(signer: TSigner, amount=1n, owner: ICrossAccountId = {Substrate: signer.address}) {
+    return await this.helper.ft.mintTokens(signer, this.collectionId, amount, owner);
   }
 
-  async mintWithOneOwner(signer: TSigner, owner: ICrossAccountId, tokens: {value: bigint}[]) {
-    return await this.helper.ft.mintMultipleTokensWithOneOwner(signer, this.collectionId, owner, tokens);
+  async mintWithOneOwner(signer: TSigner, tokens: {value: bigint}[], owner: ICrossAccountId = {Substrate: signer.address}) {
+    return await this.helper.ft.mintMultipleTokensWithOneOwner(signer, this.collectionId, tokens, owner);
   }
 
   async getBalance(addressObj: ICrossAccountId) {