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
--- a/tests/src/limits.test.ts
+++ b/tests/src/limits.test.ts
@@ -15,54 +15,41 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 import {IKeyringPair} from '@polkadot/types/types';
-import usingApi from './substrate/substrate-api';
-import {
-  createCollectionExpectSuccess,
-  destroyCollectionExpectSuccess,
-  setCollectionLimitsExpectSuccess,
-  setCollectionSponsorExpectSuccess,
-  confirmSponsorshipExpectSuccess,
-  createItemExpectSuccess,
-  createItemExpectFailure,
-  transferExpectSuccess,
-  getFreeBalance,
-  waitNewBlocks, burnItemExpectSuccess,
-  requirePallets,
-  Pallets,
-} from './util/helpers';
-import {expect} from 'chai';
+import {expect, itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds} from './util/playgrounds';
 
 describe('Number of tokens per address (NFT)', () => {
   let alice: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice] = await helper.arrange.createAccounts([10n], donor);
     });
   });
 
-  it.skip('Collection limits allow greater number than chain limits, chain limits are enforced', async () => {
-
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 20});
+  itSub.skip('Collection limits allow greater number than chain limits, chain limits are enforced', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {});
+    await collection.setLimits(alice, {accountTokenOwnershipLimit: 20});
+    
     for(let i = 0; i < 10; i++){
-      await createItemExpectSuccess(alice, collectionId, 'NFT');
+      await expect(collection.mintToken(alice)).to.be.not.rejected;
     }
-    await createItemExpectFailure(alice, collectionId, 'NFT');
+    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);
     for(let i = 1; i < 11; i++) {
-      await burnItemExpectSuccess(alice, collectionId, i);
+      await expect(collection.burnToken(alice, i)).to.be.not.rejected;
     }
-    await destroyCollectionExpectSuccess(collectionId);
+    await collection.burn(alice);
   });
-
-  it('Collection limits allow lower number than chain limits, collection limits are enforced', async () => {
+  
+  itSub('Collection limits allow lower number than chain limits, collection limits are enforced', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {});
+    await collection.setLimits(alice, {accountTokenOwnershipLimit: 1});
 
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});
-    await createItemExpectSuccess(alice, collectionId, 'NFT');
-    await createItemExpectFailure(alice, collectionId, 'NFT');
-    await burnItemExpectSuccess(alice, collectionId, 1);
-    await destroyCollectionExpectSuccess(collectionId);
+    await collection.mintToken(alice);
+    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);
+    
+    await collection.burnToken(alice, 1);
+    await expect(collection.burn(alice)).to.be.not.rejected;
   });
 });
 
@@ -70,38 +57,43 @@
   let alice: IKeyringPair;
 
   before(async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
+    await usingPlaygrounds(async (helper, privateKey) => {
+      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
 
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
+      const donor = privateKey('//Alice');
+      [alice] = await helper.arrange.createAccounts([10n], donor);
     });
   });
 
-  it.skip('Collection limits allow greater number than chain limits, chain limits are enforced', async () => {
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 20});
+  itSub.skip('Collection limits allow greater number than chain limits, chain limits are enforced', async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice, {});
+    await collection.setLimits(alice, {accountTokenOwnershipLimit: 20});
+    
     for(let i = 0; i < 10; i++){
-      await createItemExpectSuccess(alice, collectionId, 'ReFungible');
+      await expect(collection.mintToken(alice, 10n)).to.be.not.rejected;
     }
-    await createItemExpectFailure(alice, collectionId, 'ReFungible');
+    await expect(collection.mintToken(alice, 10n)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);
     for(let i = 1; i < 11; i++) {
-      await burnItemExpectSuccess(alice, collectionId, i, 100);
+      await expect(collection.burnToken(alice, i, 10n)).to.be.not.rejected;
     }
-    await destroyCollectionExpectSuccess(collectionId);
+    await collection.burn(alice);
   });
 
-  it('Collection limits allow lower number than chain limits, collection limits are enforced', async () => {
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});
-    await createItemExpectSuccess(alice, collectionId, 'ReFungible');
-    await createItemExpectFailure(alice, collectionId, 'ReFungible');
-    await burnItemExpectSuccess(alice, collectionId, 1, 100);
-    await destroyCollectionExpectSuccess(collectionId);
+  itSub('Collection limits allow lower number than chain limits, collection limits are enforced', async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice, {});
+    await collection.setLimits(alice, {accountTokenOwnershipLimit: 1});
+
+    await collection.mintToken(alice);
+    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);
+    
+    await collection.burnToken(alice, 1);
+    await expect(collection.burn(alice)).to.be.not.rejected;
   });
 });
 
+// todo:playgrounds skipped ~ postponed
 describe.skip('Sponsor timeout (NFT) (only for special chain limits test)', () => {
-  let alice: IKeyringPair;
+  /*let alice: IKeyringPair;
   let bob: IKeyringPair;
   let charlie: IKeyringPair;
 
@@ -113,7 +105,7 @@
     });
   });
 
-  it.skip('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {
+  itSub.skip('Collection limits have greater timeout value than chain limits, collection limits are enforced', async ({helper}) => {
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
     await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});
     const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
@@ -137,7 +129,7 @@
     await destroyCollectionExpectSuccess(collectionId);
   });
 
-  it('Collection limits have lower timeout value than chain limits, chain limits are enforced', async () => {
+  itSub('Collection limits have lower timeout value than chain limits, chain limits are enforced', async ({helper}) => {
 
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
     await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 1});
@@ -176,7 +168,7 @@
     });
   });
 
-  it('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {
+  itSub('Collection limits have greater timeout value than chain limits, collection limits are enforced', async ({helper}) => {
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
     await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});
     const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible');
@@ -202,7 +194,7 @@
     await destroyCollectionExpectSuccess(collectionId);
   });
 
-  it('Collection limits have lower timeout value than chain limits, chain limits are enforced', async () => {
+  itSub('Collection limits have lower timeout value than chain limits, chain limits are enforced', async ({helper}) => {
 
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
     await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 1});
@@ -243,7 +235,7 @@
     });
   });
 
-  it('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {
+  itSub('Collection limits have greater timeout value than chain limits, collection limits are enforced', async ({helper}) => {
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
     await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});
     const tokenId = await createItemExpectSuccess(alice, collectionId, 'ReFungible');
@@ -267,7 +259,7 @@
     await destroyCollectionExpectSuccess(collectionId);
   });
 
-  it('Collection limits have lower timeout value than chain limits, chain limits are enforced', async () => {
+  itSub('Collection limits have lower timeout value than chain limits, chain limits are enforced', async ({helper}) => {
 
     const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
     await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 1});
@@ -290,7 +282,7 @@
     expect(aliceBalanceAfterSponsoredTransaction < aliceBalanceBefore).to.be.true;
     //expect(aliceBalanceAfterSponsoredTransaction).to.be.lessThan(aliceBalanceBefore);
     await destroyCollectionExpectSuccess(collectionId);
-  });
+  });*/
 });
 
 describe('Collection zero limits (NFT)', () => {
@@ -299,38 +291,38 @@
   let charlie: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
-      charlie = privateKeyWrapper('//Charlie');
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
     });
   });
 
-  it.skip('Limits have 0 in tokens per address field, the chain limits are applied', async () => {
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 0});
+  itSub.skip('Limits have 0 in tokens per address field, the chain limits are applied', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {});
+    await collection.setLimits(alice, {accountTokenOwnershipLimit: 0});
+
     for(let i = 0; i < 10; i++){
-      await createItemExpectSuccess(alice, collectionId, 'NFT');
+      await collection.mintToken(alice);
     }
-    await createItemExpectFailure(alice, collectionId, 'NFT');
+    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);
   });
 
-  it('Limits have 0 in sponsor timeout, no limits are applied', async () => {
+  itSub('Limits have 0 in sponsor timeout, no limits are applied', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {});
+    await collection.setLimits(alice, {sponsorTransferTimeout: 0});
+    const token = await collection.mintToken(alice);
 
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 0});
-    const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
-    await setCollectionSponsorExpectSuccess(collectionId, alice.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');
-    await transferExpectSuccess(collectionId, tokenId, alice, bob);
-    const aliceBalanceBefore = await getFreeBalance(alice);
+    await collection.setSponsor(alice, alice.address);
+    await collection.confirmSponsorship(alice);
+    
+    await token.transfer(alice, {Substrate: bob.address});
+    const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
 
     // check setting SponsorTimeout = 0, success with next block
-    await waitNewBlocks(1);
-    await transferExpectSuccess(collectionId, tokenId, bob, charlie);
-    const aliceBalanceAfterSponsoredTransaction1 = await getFreeBalance(alice);
+    await helper.wait.newBlocks(1);
+    await token.transfer(bob, {Substrate: charlie.address});
+    const aliceBalanceAfterSponsoredTransaction1 = await helper.balance.getSubstrate(alice.address);
     expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;
-    //expect(aliceBalanceAfterSponsoredTransaction1).to.be.lessThan(aliceBalanceBefore);
   });
 });
 
@@ -340,29 +332,28 @@
   let charlie: IKeyringPair;
 
   before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
-      charlie = privateKeyWrapper('//Charlie');
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
     });
   });
 
-  it('Limits have 0 in sponsor timeout, no limits are applied', async () => {
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
-    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 0});
-    const tokenId = await createItemExpectSuccess(alice, collectionId, 'Fungible');
-    await setCollectionSponsorExpectSuccess(collectionId, alice.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');
-    await transferExpectSuccess(collectionId, tokenId, alice, bob, 10, 'Fungible');
-    const aliceBalanceBefore = await getFreeBalance(alice);
-    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');
+  itSub('Limits have 0 in sponsor timeout, no limits are applied', async ({helper}) => {
+    const collection = await helper.ft.mintCollection(alice, {});
+    await collection.setLimits(alice, {sponsorTransferTimeout: 0});
+    await collection.mint(alice, 3n);
+
+    await collection.setSponsor(alice, alice.address);
+    await collection.confirmSponsorship(alice);
+    
+    await collection.transfer(alice, {Substrate: bob.address}, 2n);
+    const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
 
     // check setting SponsorTimeout = 0, success with next block
-    await waitNewBlocks(1);
-    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 2, 'Fungible');
-    const aliceBalanceAfterSponsoredTransaction1 = await getFreeBalance(alice);
+    await helper.wait.newBlocks(1);
+    await collection.transfer(bob, {Substrate: charlie.address});
+    const aliceBalanceAfterSponsoredTransaction1 = await helper.balance.getSubstrate(alice.address);
     expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;
-    //expect(aliceBalanceAfterSponsoredTransaction1).to.be.lessThan(aliceBalanceBefore);
   });
 });
 
@@ -372,110 +363,112 @@
   let charlie: IKeyringPair;
 
   before(async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
+    await usingPlaygrounds(async (helper, privateKey) => {
+      requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
 
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
-      charlie = privateKeyWrapper('//Charlie');
+      const donor = privateKey('//Alice');
+      [alice, bob, charlie] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
     });
   });
 
-  it.skip('Limits have 0 in tokens per address field, the chain limits are applied', async () => {
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-    await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 0});
+  itSub.skip('Limits have 0 in tokens per address field, the chain limits are applied', async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice, {});
+    await collection.setLimits(alice, {accountTokenOwnershipLimit: 0});
     for(let i = 0; i < 10; i++){
-      await createItemExpectSuccess(alice, collectionId, 'ReFungible');
+      await collection.mintToken(alice);
     }
-    await createItemExpectFailure(alice, collectionId, 'ReFungible');
+    await expect(collection.mintToken(alice)).to.be.rejectedWith(/common\.AccountTokenLimitExceeded/);
   });
 
-  it('Limits have 0 in sponsor timeout, no limits are applied', async () => {
+  itSub('Limits have 0 in sponsor timeout, no limits are applied', async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice, {});
+    await collection.setLimits(alice, {sponsorTransferTimeout: 0});
+    const token = await collection.mintToken(alice, 3n);
 
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-    await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 0});
-    const tokenId = await createItemExpectSuccess(alice, collectionId, 'ReFungible');
-    await setCollectionSponsorExpectSuccess(collectionId, alice.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Alice');
-    await transferExpectSuccess(collectionId, tokenId, alice, bob, 100, 'ReFungible');
-    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');
-    const aliceBalanceBefore = await getFreeBalance(alice);
+    await collection.setSponsor(alice, alice.address);
+    await collection.confirmSponsorship(alice);
+    
+    await token.transfer(alice, {Substrate: bob.address}, 2n);
+    const aliceBalanceBefore = await helper.balance.getSubstrate(alice.address);
 
     // check setting SponsorTimeout = 0, success with next block
-    await waitNewBlocks(1);
-    await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');
-    const aliceBalanceAfterSponsoredTransaction1 = await getFreeBalance(alice);
+    await helper.wait.newBlocks(1);
+    await token.transfer(bob, {Substrate: charlie.address});
+    const aliceBalanceAfterSponsoredTransaction1 = await helper.balance.getSubstrate(alice.address);
     expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;
-    //expect(aliceBalanceAfterSponsoredTransaction1).to.be.lessThan(aliceBalanceBefore);
   });
-  
-  it('Effective collection limits', async () => {
-    await usingApi(async (api) => {
-      const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
-      
-      { // Check that limits is undefined
-        const collection = await api.rpc.unique.collectionById(collectionId);
-        expect(collection.isSome).to.be.true;
-        const limits = collection.unwrap().limits;
-        expect(limits).to.be.any;
-        
-        expect(limits.accountTokenOwnershipLimit.toHuman()).to.be.null;
-        expect(limits.sponsoredDataSize.toHuman()).to.be.null;
-        expect(limits.sponsoredDataRateLimit.toHuman()).to.be.null;
-        expect(limits.tokenLimit.toHuman()).to.be.null;
-        expect(limits.sponsorTransferTimeout.toHuman()).to.be.null;
-        expect(limits.sponsorApproveTimeout.toHuman()).to.be.null;
-        expect(limits.ownerCanTransfer.toHuman()).to.be.true;
-        expect(limits.ownerCanDestroy.toHuman()).to.be.null;
-        expect(limits.transfersEnabled.toHuman()).to.be.null;
-      }
-  
-      { // Check that limits is undefined for non-existent collection
-        const limits = await api.rpc.unique.effectiveCollectionLimits(11111);
-        expect(limits.toHuman()).to.be.null;
-      }
-  
-      { // Check that default values defined for collection limits
-        const limitsOpt = await api.rpc.unique.effectiveCollectionLimits(collectionId);
-        expect(limitsOpt.isNone).to.be.false;
-        const limits = limitsOpt.unwrap();
-  
-        expect(limits.accountTokenOwnershipLimit.toHuman()).to.be.eq('100,000');
-        expect(limits.sponsoredDataSize.toHuman()).to.be.eq('2,048');
-        expect(limits.sponsoredDataRateLimit.toHuman()).to.be.eq('SponsoringDisabled');
-        expect(limits.tokenLimit.toHuman()).to.be.eq('4,294,967,295');
-        expect(limits.sponsorTransferTimeout.toHuman()).to.be.eq('5');
-        expect(limits.sponsorApproveTimeout.toHuman()).to.be.eq('5');
-        expect(limits.ownerCanTransfer.toHuman()).to.be.true;
-        expect(limits.ownerCanDestroy.toHuman()).to.be.true;
-        expect(limits.transfersEnabled.toHuman()).to.be.true;
-      }
+});
 
-      { //Check the values for collection limits
-        await setCollectionLimitsExpectSuccess(alice, collectionId, {
-          accountTokenOwnershipLimit: 99_999,
-          sponsoredDataSize: 1024,
-          tokenLimit: 123,
-          transfersEnabled: false,
-        });
+describe('Effective collection limits (NFT)', () => {
+  let alice: IKeyringPair;
 
-        const limitsOpt = await api.rpc.unique.effectiveCollectionLimits(collectionId);
-        expect(limitsOpt.isNone).to.be.false;
-        const limits = limitsOpt.unwrap();
-  
-        expect(limits.accountTokenOwnershipLimit.toHuman()).to.be.eq('99,999');
-        expect(limits.sponsoredDataSize.toHuman()).to.be.eq('1,024');
-        expect(limits.sponsoredDataRateLimit.toHuman()).to.be.eq('SponsoringDisabled');
-        expect(limits.tokenLimit.toHuman()).to.be.eq('123');
-        expect(limits.sponsorTransferTimeout.toHuman()).to.be.eq('5');
-        expect(limits.sponsorApproveTimeout.toHuman()).to.be.eq('5');
-        expect(limits.ownerCanTransfer.toHuman()).to.be.true;
-        expect(limits.ownerCanDestroy.toHuman()).to.be.true;
-        expect(limits.transfersEnabled.toHuman()).to.be.false;
-      }
+  before(async () => {
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice] = await helper.arrange.createAccounts([10n], donor);
     });
   });
-});
+  
+  itSub('Effective collection limits', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {});
+    await collection.setLimits(alice, {ownerCanTransfer: true});    
+    
+    { 
+      // Check that limits are undefined
+      const collectionInfo = await collection.getData();
+      const limits = collectionInfo?.raw.limits;
+      expect(limits).to.be.any;
+      
+      expect(limits.accountTokenOwnershipLimit).to.be.null;
+      expect(limits.sponsoredDataSize).to.be.null;
+      expect(limits.sponsoredDataRateLimit).to.be.null;
+      expect(limits.tokenLimit).to.be.null;
+      expect(limits.sponsorTransferTimeout).to.be.null;
+      expect(limits.sponsorApproveTimeout).to.be.null;
+      expect(limits.ownerCanTransfer).to.be.true;
+      expect(limits.ownerCanDestroy).to.be.null;
+      expect(limits.transfersEnabled).to.be.null;
+    }
+
+    { // Check that limits is undefined for non-existent collection
+      const limits = await helper.collection.getEffectiveLimits(999999);
+      expect(limits).to.be.null;
+    }
 
+    { // Check that default values defined for collection limits
+      const limits = await collection.getEffectiveLimits();
 
+      expect(limits.accountTokenOwnershipLimit).to.be.eq(100000);
+      expect(limits.sponsoredDataSize).to.be.eq(2048);
+      expect(limits.sponsoredDataRateLimit).to.be.deep.eq({sponsoringDisabled: null});
+      expect(limits.tokenLimit).to.be.eq(4294967295);
+      expect(limits.sponsorTransferTimeout).to.be.eq(5);
+      expect(limits.sponsorApproveTimeout).to.be.eq(5);
+      expect(limits.ownerCanTransfer).to.be.true;
+      expect(limits.ownerCanDestroy).to.be.true;
+      expect(limits.transfersEnabled).to.be.true;
+    }
+
+    { 
+      // Check the values for collection limits
+      await collection.setLimits(alice, {
+        accountTokenOwnershipLimit: 99_999,
+        sponsoredDataSize: 1024,
+        tokenLimit: 123,
+        transfersEnabled: false,
+      });
+
+      const limits = await collection.getEffectiveLimits();
+
+      expect(limits.accountTokenOwnershipLimit).to.be.eq(99999);
+      expect(limits.sponsoredDataSize).to.be.eq(1024);
+      expect(limits.sponsoredDataRateLimit).to.be.deep.eq({sponsoringDisabled: null});
+      expect(limits.tokenLimit).to.be.eq(123);
+      expect(limits.sponsorTransferTimeout).to.be.eq(5);
+      expect(limits.sponsorApproveTimeout).to.be.eq(5);
+      expect(limits.ownerCanTransfer).to.be.true;
+      expect(limits.ownerCanDestroy).to.be.true;
+      expect(limits.transfersEnabled).to.be.false;
+    }
+  });
+});
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
before · tests/src/transferFrom.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 {itSub, Pallets, usingPlaygrounds, expect} from './util/playgrounds';1920describe('Integration Test transferFrom(from, recipient, collection_id, item_id, value):', () => {21  let alice: IKeyringPair;22  let bob: IKeyringPair;23  let charlie: IKeyringPair;2425  before(async () => {26    await usingPlaygrounds(async (helper, privateKey) => {27      const donor = privateKey('//Alice');28      [alice, bob, charlie] = await helper.arrange.createAccounts([20n, 10n, 10n], donor);29    });30  });3132  itSub('[nft] Execute the extrinsic and check nftItemList - owner of token', async ({helper}) => {33    const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-1', description: '', tokenPrefix: 'TF'});34    const nft = await collection.mintToken(alice, {Substrate: alice.address});35    await nft.approve(alice, {Substrate: bob.address});36    expect(await nft.isApproved({Substrate: bob.address})).to.be.true;3738    await nft.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address});39    expect(await nft.getOwner()).to.be.deep.equal({Substrate: charlie.address});40  });4142  itSub('[fungible] Execute the extrinsic and check nftItemList - owner of token', async ({helper}) => {43    const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-2', description: '', tokenPrefix: 'TF'});44    await collection.mint(alice, {Substrate: alice.address}, 10n);45    await collection.approveTokens(alice, {Substrate: bob.address}, 7n);46    expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(7n);47    48    await collection.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}, 6n);49    expect(await collection.getBalance({Substrate: charlie.address})).to.be.equal(6n);50    expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(4n);51    expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(1n);52  });5354  itSub.ifWithPallets('[refungible] Execute the extrinsic and check nftItemList - owner of token', [Pallets.ReFungible], async ({helper}) => {55    const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-3', description: '', tokenPrefix: 'TF'});56    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);57    await rft.approve(alice, {Substrate: bob.address}, 7n);58    expect(await rft.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(7n);59    60    await rft.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}, 6n);61    expect(await rft.getBalance({Substrate: charlie.address})).to.be.equal(6n);62    expect(await rft.getBalance({Substrate: alice.address})).to.be.equal(4n);63    expect(await rft.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(1n);64  });6566  itSub('Should reduce allowance if value is big', async ({helper}) => {67    // fungible68    const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-4', description: '', tokenPrefix: 'TF'});69    await collection.mint(alice, {Substrate: alice.address}, 500000n);7071    await collection.approveTokens(alice, {Substrate: bob.address}, 500000n);72    expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(500000n);73    await collection.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}, 500000n);74    expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.equal(0n);75  });7677  itSub('can be called by collection owner on non-owned item when OwnerCanTransfer == true', async ({helper}) => {78    const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-5', description: '', tokenPrefix: 'TF'});79    await collection.setLimits(alice, {ownerCanTransfer: true});8081    const nft = await collection.mintToken(alice, {Substrate: bob.address});82    await nft.transferFrom(alice, {Substrate: bob.address}, {Substrate: charlie.address});83    expect(await nft.getOwner()).to.be.deep.equal({Substrate: charlie.address});84  });85});8687describe('Negative Integration Test transferFrom(from, recipient, collection_id, item_id, value):', () => {88  let alice: IKeyringPair;89  let bob: IKeyringPair;90  let charlie: IKeyringPair;9192  before(async () => {93    await usingPlaygrounds(async (helper, privateKey) => {94      const donor = privateKey('//Alice');95      [alice, bob, charlie] = await helper.arrange.createAccounts([50n, 10n, 10n], donor);96    });97  });9899  itSub('transferFrom for a collection that does not exist', async ({helper}) => {100    const collectionId = (1 << 32) - 1;101    await expect(helper.collection.approveToken(alice, collectionId, 0, {Substrate: bob.address}, 1n))102      .to.be.rejectedWith(/common\.CollectionNotFound/);103    await expect(helper.collection.transferTokenFrom(bob, collectionId, 0, {Substrate: alice.address}, {Substrate: bob.address}, 1n))104      .to.be.rejectedWith(/common\.CollectionNotFound/);105  });106107  /* itSub('transferFrom for a collection that was destroyed', async ({helper}) => {108      this test copies approve negative test109  }); */110111  /* itSub('transferFrom a token that does not exist', async ({helper}) => {112    this test copies approve negative test113  }); */114115  /* itSub('transferFrom a token that was deleted', async ({helper}) => {116    this test copies approve negative test117  }); */118119  itSub('[nft] transferFrom for not approved address', async ({helper}) => {120    const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-1', description: '', tokenPrefix: 'TF'});121    const nft = await collection.mintToken(alice, {Substrate: alice.address});122123    await expect(nft.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}))124      .to.be.rejectedWith(/common\.ApprovedValueTooLow/);125    expect(await nft.getOwner()).to.be.deep.equal({Substrate: alice.address});126  });127128  itSub('[fungible] transferFrom for not approved address', async ({helper}) => {129    const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-1', description: '', tokenPrefix: 'TF'});130    await collection.mint(alice, {Substrate: alice.address}, 10n);131132    await expect(collection.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}, 5n))133      .to.be.rejectedWith(/common\.ApprovedValueTooLow/);134    expect(await collection.getBalance({Substrate: alice.address})).to.be.deep.equal(10n);135    expect(await collection.getBalance({Substrate: bob.address})).to.be.deep.equal(0n);136    expect(await collection.getBalance({Substrate: charlie.address})).to.be.deep.equal(0n);137  });138139  itSub.ifWithPallets('[refungible] transferFrom for not approved address', [Pallets.ReFungible], async({helper}) => {140    const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-3', description: '', tokenPrefix: 'TF'});141    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);142143    await expect(rft.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}))144      .to.be.rejectedWith(/common\.ApprovedValueTooLow/);145    expect(await rft.getBalance({Substrate: alice.address})).to.be.deep.equal(10n);146    expect(await rft.getBalance({Substrate: bob.address})).to.be.deep.equal(0n);147    expect(await rft.getBalance({Substrate: charlie.address})).to.be.deep.equal(0n);148  });149150  itSub('[nft] transferFrom incorrect token count', async ({helper}) => {151    const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-4', description: '', tokenPrefix: 'TF'});152    const nft = await collection.mintToken(alice, {Substrate: alice.address});153154    await nft.approve(alice, {Substrate: bob.address});155    expect(await nft.isApproved({Substrate: bob.address})).to.be.true;156157    await expect(helper.collection.transferTokenFrom(158      bob, 159      collection.collectionId, 160      nft.tokenId, 161      {Substrate: alice.address}, 162      {Substrate: charlie.address}, 163      2n,164    )).to.be.rejectedWith(/nonfungible\.NonfungibleItemsHaveNoAmount/);165    expect(await nft.getOwner()).to.be.deep.equal({Substrate: alice.address});166  });167168  itSub('[fungible] transferFrom incorrect token count', async ({helper}) => {169    const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-5', description: '', tokenPrefix: 'TF'});170    await collection.mint(alice, {Substrate: alice.address}, 10n);171172    await collection.approveTokens(alice, {Substrate: bob.address}, 2n);173    expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(2n);174175    await expect(collection.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}, 5n))176      .to.be.rejectedWith(/common\.ApprovedValueTooLow/);177    expect(await collection.getBalance({Substrate: alice.address})).to.be.deep.equal(10n);178    expect(await collection.getBalance({Substrate: bob.address})).to.be.deep.equal(0n);179    expect(await collection.getBalance({Substrate: charlie.address})).to.be.deep.equal(0n);180  });181182  itSub.ifWithPallets('[refungible] transferFrom incorrect token count', [Pallets.ReFungible], async ({helper}) => {183    const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-6', description: '', tokenPrefix: 'TF'});184    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);185186    await rft.approve(alice, {Substrate: bob.address}, 5n);187    expect(await rft.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(5n);188189    await expect(rft.transferFrom(bob, {Substrate: alice.address}, {Substrate: charlie.address}, 7n))190      .to.be.rejectedWith(/common\.ApprovedValueTooLow/);191    expect(await rft.getBalance({Substrate: alice.address})).to.be.deep.equal(10n);192    expect(await rft.getBalance({Substrate: bob.address})).to.be.deep.equal(0n);193    expect(await rft.getBalance({Substrate: charlie.address})).to.be.deep.equal(0n);194  });195196  itSub('[nft] execute transferFrom from account that is not owner of collection', async ({helper}) => {197    const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-7', description: '', tokenPrefix: 'TF'});198    const nft = await collection.mintToken(alice, {Substrate: alice.address});199200    await expect(nft.approve(charlie, {Substrate: bob.address})).to.be.rejectedWith(/common\.CantApproveMoreThanOwned/);201    expect(await nft.isApproved({Substrate: bob.address})).to.be.false;202203    await expect(nft.transferFrom(204      charlie,205      {Substrate: alice.address}, 206      {Substrate: charlie.address},207    )).to.be.rejectedWith(/common\.ApprovedValueTooLow/);208    expect(await nft.getOwner()).to.be.deep.equal({Substrate: alice.address});209  });210211  itSub('[fungible] execute transferFrom from account that is not owner of collection', async ({helper}) => {212    const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-8', description: '', tokenPrefix: 'TF'});213    await collection.mint(alice, {Substrate: alice.address}, 10000n);214215    await expect(collection.approveTokens(charlie, {Substrate: bob.address}, 1n)).to.be.rejectedWith(/common\.CantApproveMoreThanOwned/);216    expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(0n);217    expect(await collection.getApprovedTokens({Substrate: charlie.address}, {Substrate: bob.address})).to.be.eq(0n);218219    await expect(collection.transferFrom(220      charlie,221      {Substrate: alice.address}, 222      {Substrate: charlie.address},223    )).to.be.rejectedWith(/common\.ApprovedValueTooLow/);224    expect(await collection.getBalance({Substrate: alice.address})).to.be.deep.equal(10000n);225    expect(await collection.getBalance({Substrate: bob.address})).to.be.deep.equal(0n);226    expect(await collection.getBalance({Substrate: charlie.address})).to.be.deep.equal(0n);227  });228229  itSub.ifWithPallets('[refungible] execute transferFrom from account that is not owner of collection', [Pallets.ReFungible], async ({helper}) => {230    const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-9', description: '', tokenPrefix: 'TF'});231    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10000n);232233    await expect(rft.approve(charlie, {Substrate: bob.address}, 1n)).to.be.rejectedWith(/common\.CantApproveMoreThanOwned/);234    expect(await rft.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(0n);235    expect(await rft.getApprovedPieces({Substrate: charlie.address}, {Substrate: bob.address})).to.be.eq(0n);236237    await expect(rft.transferFrom(238      charlie,239      {Substrate: alice.address}, 240      {Substrate: charlie.address},241    )).to.be.rejectedWith(/common\.ApprovedValueTooLow/);242    expect(await rft.getBalance({Substrate: alice.address})).to.be.deep.equal(10000n);243    expect(await rft.getBalance({Substrate: bob.address})).to.be.deep.equal(0n);244    expect(await rft.getBalance({Substrate: charlie.address})).to.be.deep.equal(0n);245  });246247  itSub('transferFrom burnt token before approve NFT', async ({helper}) => {248    const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-10', description: '', tokenPrefix: 'TF'});249    await collection.setLimits(alice, {ownerCanTransfer: true});250    const nft = await collection.mintToken(alice, {Substrate: alice.address});251252    await nft.burn(alice);253    await expect(nft.approve(alice, {Substrate: bob.address})).to.be.rejectedWith(/common\.TokenNotFound/);254255    await expect(nft.transferFrom(256      bob,257      {Substrate: alice.address}, 258      {Substrate: charlie.address},259    )).to.be.rejectedWith(/common\.ApprovedValueTooLow/);260  });261262  itSub('transferFrom burnt token before approve Fungible', async ({helper}) => {263    const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-11', description: '', tokenPrefix: 'TF'});264    await collection.setLimits(alice, {ownerCanTransfer: true});265    await collection.mint(alice, {Substrate: alice.address}, 10n);266267    await collection.burnTokens(alice, 10n);268    await expect(collection.approveTokens(alice, {Substrate: bob.address})).to.be.not.rejected;269270    await expect(collection.transferFrom(271      alice,272      {Substrate: alice.address}, 273      {Substrate: charlie.address},274    )).to.be.rejectedWith(/common\.TokenValueTooLow/);275  });276277  itSub.ifWithPallets('transferFrom burnt token before approve ReFungible', [Pallets.ReFungible], async ({helper}) => {278    const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-12', description: '', tokenPrefix: 'TF'});279    await collection.setLimits(alice, {ownerCanTransfer: true});280    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);281282    await rft.burn(alice, 10n);283    await expect(rft.approve(alice, {Substrate: bob.address})).to.be.rejectedWith(/common\.CantApproveMoreThanOwned/);284285    await expect(rft.transferFrom(286      alice,287      {Substrate: alice.address}, 288      {Substrate: charlie.address},289    )).to.be.rejectedWith(/common\.TokenValueTooLow/);290  });291292  itSub('transferFrom burnt token after approve NFT', async ({helper}) => {293    const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-13', description: '', tokenPrefix: 'TF'});294    const nft = await collection.mintToken(alice, {Substrate: alice.address});295296    await nft.approve(alice, {Substrate: bob.address});297    expect(await nft.isApproved({Substrate: bob.address})).to.be.true;298299    await nft.burn(alice);300301    await expect(nft.transferFrom(302      bob,303      {Substrate: alice.address}, 304      {Substrate: charlie.address},305    )).to.be.rejectedWith(/common\.ApprovedValueTooLow/);306  });307308  itSub('transferFrom burnt token after approve Fungible', async ({helper}) => {309    const collection = await helper.ft.mintCollection(alice, {name: 'TransferFrom-Neg-14', description: '', tokenPrefix: 'TF'});310    await collection.mint(alice, {Substrate: alice.address}, 10n);311312    await collection.approveTokens(alice, {Substrate: bob.address});313    expect(await collection.getApprovedTokens({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(1n);314315    await collection.burnTokens(alice, 10n);316317    await expect(collection.transferFrom(318      bob,319      {Substrate: alice.address}, 320      {Substrate: charlie.address},321    )).to.be.rejectedWith(/common\.TokenValueTooLow/);322  });323324  itSub.ifWithPallets('transferFrom burnt token after approve ReFungible', [Pallets.ReFungible], async ({helper}) => {325    const collection = await helper.rft.mintCollection(alice, {name: 'TransferFrom-Neg-15', description: '', tokenPrefix: 'TF'});326    const rft = await collection.mintToken(alice, {Substrate: alice.address}, 10n);327328    await rft.approve(alice, {Substrate: bob.address}, 10n);329    expect(await rft.getApprovedPieces({Substrate: alice.address}, {Substrate: bob.address})).to.be.eq(10n);330331    await rft.burn(alice, 10n);332333    await expect(rft.transferFrom(334      bob,335      {Substrate: alice.address}, 336      {Substrate: charlie.address},337    )).to.be.rejectedWith(/common\.ApprovedValueTooLow/);338  });339340  itSub('fails when called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {341    const collection = await helper.nft.mintCollection(alice, {name: 'TransferFrom-Neg-16', description: '', tokenPrefix: 'TF'});342    const nft = await collection.mintToken(alice, {Substrate: bob.address});343344    await collection.setLimits(alice, {ownerCanTransfer: false});345346    await expect(nft.transferFrom(347      alice,348      {Substrate: bob.address}, 349      {Substrate: charlie.address},350    )).to.be.rejectedWith(/common\.ApprovedValueTooLow/);351  });352});
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) {