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

difftreelog

Merge pull request #607 from UniqueNetwork/tests/nesting

ut-akuznetsov2022-09-27parents: #644729e #77e366b.patch.diff
in: master

11 files changed

modifiedtests/src/eth/util/playgrounds/index.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/index.ts
+++ b/tests/src/eth/util/playgrounds/index.ts
@@ -12,7 +12,7 @@
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import { requirePalletsOrSkip } from '../../../util/playgrounds';
+import {requirePalletsOrSkip} from '../../../util/playgrounds';
 chai.use(chaiAsPromised);
 export const expect = chai.expect;
 
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -240,7 +240,7 @@
   }
 
   fromTokenId(collectionId: number, tokenId: number): string  {
-    return this.helper.util.getNestingTokenAddress(collectionId, tokenId);
+    return this.helper.util.getTokenAddress({collectionId, tokenId});
   }
 
   normalizeAddress(address: string): string {
modifiedtests/src/nesting/graphs.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -1,9 +1,22 @@
-import {ApiPromise} from '@polkadot/api';
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// 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 {IKeyringPair} from '@polkadot/types/types';
-import {expect} from 'chai';
-import {tokenIdToCross} from '../eth/util/helpers';
-import usingApi, {executeTransaction} from '../substrate/substrate-api';
-import {getCreateCollectionResult, transferExpectSuccess, setCollectionLimitsExpectSuccess} from '../util/helpers';
+import {expect, itSub, usingPlaygrounds} from '../util/playgrounds';
+import {UniqueHelper, UniqueNFToken} from '../util/playgrounds/unique';
 
 /**
  * ```dot
@@ -12,46 +25,47 @@
  * 8 -> 5
  * ```
  */
-async function buildComplexObjectGraph(api: ApiPromise, sender: IKeyringPair): Promise<number> {
-  const events = await executeTransaction(api, sender, api.tx.unique.createCollectionEx({mode: 'NFT', permissions: {nesting: {tokenOwner: true}}}));
-  const {collectionId} = getCreateCollectionResult(events);
+async function buildComplexObjectGraph(helper: UniqueHelper, sender: IKeyringPair): Promise<UniqueNFToken[]> {
+  const collection = await helper.nft.mintCollection(sender, {permissions: {nesting: {tokenOwner: true}}});
+  const tokens = await collection.mintMultipleTokens(sender, Array(8).fill({owner: {Substrate: sender.address}}));
 
-  await executeTransaction(api, sender, api.tx.unique.createMultipleItemsEx(collectionId, {NFT: Array(8).fill({owner: {Substrate: sender.address}})}));
-
-  await transferExpectSuccess(collectionId, 8, sender, tokenIdToCross(collectionId, 5));
-
-  await transferExpectSuccess(collectionId, 7, sender, tokenIdToCross(collectionId, 6));
-  await transferExpectSuccess(collectionId, 6, sender, tokenIdToCross(collectionId, 5));
-  await transferExpectSuccess(collectionId, 5, sender, tokenIdToCross(collectionId, 2));
+  await tokens[7].nest(sender, tokens[4]);
+  await tokens[6].nest(sender, tokens[5]);
+  await tokens[5].nest(sender, tokens[4]);
+  await tokens[4].nest(sender, tokens[1]);
+  await tokens[3].nest(sender, tokens[2]);
+  await tokens[2].nest(sender, tokens[1]);
+  await tokens[1].nest(sender, tokens[0]);
 
-  await transferExpectSuccess(collectionId, 4, sender, tokenIdToCross(collectionId, 3));
-  await transferExpectSuccess(collectionId, 3, sender, tokenIdToCross(collectionId, 2));
-  await transferExpectSuccess(collectionId, 2, sender, tokenIdToCross(collectionId, 1));
-
-  return collectionId;
+  return tokens;
 }
 
 describe('Graphs', () => {
-  it('Ouroboros can\'t be created in a complex graph', async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      const alice = privateKeyWrapper('//Alice');
-      const collection = await buildComplexObjectGraph(api, alice);
-      const tokenTwoParent = tokenIdToCross(collection, 1);
+  let alice: IKeyringPair;
 
-      // to self
-      await expect(
-        executeTransaction(api, alice, api.tx.unique.transfer(tokenIdToCross(collection, 1), collection, 1, 1)),
-        'first transaction',  
-      ).to.be.rejectedWith(/structure\.OuroborosDetected/);
-      // to nested part of graph
-      await expect(
-        executeTransaction(api, alice, api.tx.unique.transfer(tokenIdToCross(collection, 5), collection, 1, 1)),
-        'second transaction',
-      ).to.be.rejectedWith(/structure\.OuroborosDetected/);
-      await expect(
-        executeTransaction(api, alice, api.tx.unique.transferFrom(tokenTwoParent, tokenIdToCross(collection, 8), collection, 2, 1)),
-        'third transaction',
-      ).to.be.rejectedWith(/structure\.OuroborosDetected/);
+  before(async () => {
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice] = await helper.arrange.createAccounts([10n], donor);
     });
   });
+
+  itSub('Ouroboros can\'t be created in a complex graph', async ({helper}) => {
+    const tokens = await buildComplexObjectGraph(helper, alice);
+
+    // to self
+    await expect(
+      tokens[0].nest(alice, tokens[0]),
+      'first transaction',  
+    ).to.be.rejectedWith(/structure\.OuroborosDetected/);
+    // to nested part of graph
+    await expect(
+      tokens[0].nest(alice, tokens[4]),
+      'second transaction',
+    ).to.be.rejectedWith(/structure\.OuroborosDetected/);
+    await expect(
+      tokens[1].transferFrom(alice, tokens[0].nestingAccount(), tokens[7].nestingAccount()),
+      'third transaction',
+    ).to.be.rejectedWith(/structure\.OuroborosDetected/);
+  });
 });
modifiedtests/src/nesting/migration-check.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/migration-check.test.ts
+++ b/tests/src/nesting/migration-check.test.ts
@@ -8,7 +8,8 @@
 import find from 'find-process';
 
 // todo un-skip for migrations
-describe.skip('Migration testing', () => {
+// todo:playgrounds skipped, this one is outdated. Probably to be deleted/replaced.
+describe.skip('Migration testing: Properties', () => {
   let alice: IKeyringPair;
 
   before(async() => {
modifiedtests/src/nesting/nest.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/nest.test.ts
+++ b/tests/src/nesting/nest.test.ts
@@ -1,840 +1,667 @@
-import {expect} from 'chai';
-import {tokenIdToAddress} from '../eth/util/helpers';
-import usingApi, {executeTransaction} from '../substrate/substrate-api';
-import {
-  addCollectionAdminExpectSuccess,
-  addToAllowListExpectSuccess,
-  createCollectionExpectSuccess,
-  createItemExpectSuccess,
-  enableAllowListExpectSuccess,
-  enablePublicMintingExpectSuccess,
-  getTokenChildren,
-  getTokenOwner,
-  getTopmostTokenOwner,
-  normalizeAccountId,
-  setCollectionPermissionsExpectSuccess,
-  transferExpectFailure,
-  transferExpectSuccess,
-  transferFromExpectSuccess,
-  setCollectionLimitsExpectSuccess,
-  requirePallets,
-  Pallets,
-} from '../util/helpers';
-import {IKeyringPair} from '@polkadot/types/types';
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
 
-let alice: IKeyringPair;
-let bob: IKeyringPair;
-let charlie: IKeyringPair;
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
 
+// 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 {IKeyringPair} from '@polkadot/types/types';
+import {expect, itSub, Pallets, usingPlaygrounds} from '../util/playgrounds';
+
 describe('Integration Test: Composite nesting tests', () => {
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
+
   before(async () => {
-    await usingApi(async (_, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
     });
   });
 
-  it('Performs the full suite: bundles a token, transfers, and unnests', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
+  itSub('Performs the full suite: bundles a token, transfers, and unnests', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const targetToken = await collection.mintToken(alice);
 
-      // Create a nested token
-      const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, targetToken)});
-      expect(await getTopmostTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Substrate: alice.address});
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
+    // Create an immediately nested token
+    const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
+    expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: alice.address});
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
+    
+    // Create a token to be nested
+    const newToken = await collection.mintToken(alice);
 
-      // Create a token to be nested
-      const newToken = await createItemExpectSuccess(alice, collection, 'NFT');
-
-      // Nest
-      await transferExpectSuccess(collection, newToken, alice, {Ethereum: tokenIdToAddress(collection, targetToken)});
-      expect(await getTopmostTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: alice.address});
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
+    // Nest
+    await newToken.nest(alice, targetToken);
+    expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: alice.address});
+    expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
 
-      // Move bundle to different user
-      await transferExpectSuccess(collection, targetToken, alice, {Substrate: bob.address});
-      expect(await getTopmostTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Substrate: bob.address});
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
+    // Move bundle to different user
+    await targetToken.transfer(alice, {Substrate: bob.address});
+    expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: bob.address});
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
+    expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: bob.address});
+    expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
 
-      // Unnest
-      await transferFromExpectSuccess(collection, newToken, bob, {Ethereum: tokenIdToAddress(collection, targetToken)}, {Substrate: bob.address});
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: bob.address});
-    });
+    // Unnest
+    await newToken.unnest(bob, targetToken, {Substrate: bob.address});
+    expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: bob.address});
+    expect(await newToken.getOwner()).to.be.deep.equal({Substrate: bob.address});
   });
-
-  it('Transfers an already bundled token', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
 
-      const tokenA = await createItemExpectSuccess(alice, collection, 'NFT');
-      const tokenB = await createItemExpectSuccess(alice, collection, 'NFT');
-
-      // Create a nested token
-      const tokenC = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, tokenA)});
-      expect(await getTopmostTokenOwner(api, collection, tokenC)).to.be.deep.equal({Substrate: alice.address});
-      expect(await getTokenOwner(api, collection, tokenC)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, tokenA).toLowerCase()});
+  itSub('Transfers an already bundled token', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const tokenA = await collection.mintToken(alice);
+    const tokenB = await collection.mintToken(alice);
 
-      // Transfer the nested token to another token
-      await expect(executeTransaction(
-        api,
-        alice,
-        api.tx.unique.transferFrom(
-          normalizeAccountId({Ethereum: tokenIdToAddress(collection, tokenA)}),
-          normalizeAccountId({Ethereum: tokenIdToAddress(collection, tokenB)}),
-          collection,
-          tokenC,
-          1,
-        ),
-      )).to.not.be.rejected;
-      expect(await getTopmostTokenOwner(api, collection, tokenC)).to.be.deep.equal({Substrate: alice.address});
-      expect(await getTokenOwner(api, collection, tokenC)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, tokenB).toLowerCase()});
-    });
+    // Create a nested token
+    const tokenC = await collection.mintToken(alice, tokenA.nestingAccount());
+    expect(await tokenC.getOwner()).to.be.deep.equal(tokenA.nestingAccountInLowerCase());
+    
+    // Transfer the nested token to another token
+    await expect(tokenC.transferFrom(alice, tokenA.nestingAccount(), tokenB.nestingAccount())).to.be.fulfilled;
+    expect(await tokenC.getTopmostOwner()).to.be.deep.equal({Substrate: alice.address});
+    expect(await tokenC.getOwner()).to.be.deep.equal(tokenB.nestingAccountInLowerCase());
   });
 
-  it('Checks token children', async () => {
-    await usingApi(async api => {
-      const collectionA = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collectionA, {ownerCanTransfer: true});
-      await setCollectionPermissionsExpectSuccess(alice, collectionA, {nesting: {tokenOwner: true}});
-      const collectionB = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
+  itSub('Checks token children', async ({helper}) => {
+    const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const collectionB = await helper.ft.mintCollection(alice);
+    
+    const targetToken = await collectionA.mintToken(alice);
+    expect((await targetToken.getChildren()).length).to.be.equal(0, 'Children length check at creation');
 
-      const targetToken = await createItemExpectSuccess(alice, collectionA, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionA, targetToken)};
-      let children = await getTokenChildren(api, collectionA, targetToken);
-      expect(children.length).to.be.equal(0, 'Children length check at creation');
+    // Create a nested NFT token
+    const tokenA = await collectionA.mintToken(alice, targetToken.nestingAccount());
+    expect(await targetToken.getChildren()).to.have.deep.members([
+      {tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
+    ], 'Children contents check at nesting #1').and.be.length(1, 'Children length check at nesting #1');
 
-      // Create a nested NFT token
-      const tokenA = await createItemExpectSuccess(alice, collectionA, 'NFT', targetAddress);
-      children = await getTokenChildren(api, collectionA, targetToken);
-      expect(children.length).to.be.equal(1, 'Children length check at nesting #1');
-      expect(children).to.have.deep.members([
-        {token: tokenA, collection: collectionA},
-      ], 'Children contents check at nesting #1');
+    // Create then nest
+    const tokenB = await collectionA.mintToken(alice);
+    await tokenB.nest(alice, targetToken);
+    expect(await targetToken.getChildren()).to.have.deep.members([
+      {tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
+      {tokenId: tokenB.tokenId, collectionId: collectionA.collectionId},
+    ], 'Children contents check at nesting #2').and.be.length(2, 'Children length check at nesting #2');
 
-      // Create then nest
-      const tokenB = await createItemExpectSuccess(alice, collectionA, 'NFT');
-      await transferExpectSuccess(collectionA, tokenB, alice, targetAddress);
-      children = await getTokenChildren(api, collectionA, targetToken);
-      expect(children.length).to.be.equal(2, 'Children length check at nesting #2');
-      expect(children).to.have.deep.members([
-        {token: tokenA, collection: collectionA},
-        {token: tokenB, collection: collectionA},
-      ], 'Children contents check at nesting #2');
+    // Move token B to a different user outside the nesting tree
+    await tokenB.unnest(alice, targetToken, {Substrate: bob.address});
+    expect(await targetToken.getChildren()).to.be.have.deep.members([
+      {tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
+    ], 'Children contents check at nesting #3 (unnesting)').and.be.length(1, 'Children length check at nesting #3 (unnesting)');
 
-      // Move token B to a different user outside the nesting tree
-      await transferFromExpectSuccess(collectionA, tokenB, alice, targetAddress, bob);
-      children = await getTokenChildren(api, collectionA, targetToken);
-      expect(children.length).to.be.equal(1, 'Children length check at unnesting');
-      expect(children).to.be.have.deep.members([
-        {token: tokenA, collection: collectionA},
-      ], 'Children contents check at unnesting');
+    // Create a fungible token in another collection and then nest
+    await collectionB.mint(alice, 10n);
+    await collectionB.transfer(alice, targetToken.nestingAccount(), 2n);
+    expect(await targetToken.getChildren()).to.be.have.deep.members([
+      {tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
+      {tokenId: 0, collectionId: collectionB.collectionId},
+    ], 'Children contents check at nesting #4 (from another collection)')
+      .and.be.length(2, 'Children length check at nesting #4 (from another collection)');
+    
+    // Move part of the fungible token inside token A deeper in the nesting tree
+    await collectionB.transferFrom(alice, targetToken.nestingAccount(), tokenA.nestingAccount(), 1n);
+    expect(await targetToken.getChildren()).to.be.have.deep.members([
+      {tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
+      {tokenId: 0, collectionId: collectionB.collectionId},
+    ], 'Children contents check at nesting #5 (deeper)').and.be.length(2, 'Children length check at nesting #5 (deeper)');
+    expect(await tokenA.getChildren()).to.be.have.deep.members([
+      {tokenId: 0, collectionId: collectionB.collectionId},
+    ], 'Children contents check at nesting #5.5 (deeper)').and.be.length(1, 'Children length check at nesting #5.5 (deeper)');
 
-      // Create a fungible token in another collection and then nest
-      const tokenC = await createItemExpectSuccess(alice, collectionB, 'Fungible');
-      await transferExpectSuccess(collectionB, tokenC, alice, targetAddress, 1, 'Fungible');
-      children = await getTokenChildren(api, collectionA, targetToken);
-      expect(children.length).to.be.equal(2, 'Children length check at nesting #3 (from another collection)');
-      expect(children).to.be.have.deep.members([
-        {token: tokenA, collection: collectionA},
-        {token: tokenC, collection: collectionB},
-      ], 'Children contents check at nesting #3 (from another collection)');
-
-      // Move the fungible token inside token A deeper in the nesting tree
-      await transferFromExpectSuccess(collectionB, tokenC, alice, targetAddress, {Ethereum: tokenIdToAddress(collectionA, tokenA)}, 1, 'Fungible');
-      children = await getTokenChildren(api, collectionA, targetToken);
-      expect(children.length).to.be.equal(1, 'Children length check at deeper nesting');
-      expect(children).to.be.have.deep.members([
-        {token: tokenA, collection: collectionA},
-      ], 'Children contents check at deeper nesting');
-    });
+    // Move the remaining part of the fungible token inside token A deeper in the nesting tree
+    await collectionB.transferFrom(alice, targetToken.nestingAccount(), tokenA.nestingAccount(), 1n);
+    expect(await targetToken.getChildren()).to.be.have.deep.members([
+      {tokenId: tokenA.tokenId, collectionId: collectionA.collectionId},
+    ], 'Children contents check at nesting #6 (deeper)').and.be.length(1, 'Children length check at nesting #6 (deeper)');
+    expect(await tokenA.getChildren()).to.be.have.deep.members([
+      {tokenId: 0, collectionId: collectionB.collectionId},
+    ], 'Children contents check at nesting #6.5 (deeper)').and.be.length(1, 'Children length check at nesting #6.5 (deeper)');
   });
 });
 
-describe('Integration Test: Various token type nesting', async () => {
+describe('Integration Test: Various token type nesting', () => {
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
+  let charlie: IKeyringPair;
+
   before(async () => {
-    await usingApi(async (_, 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([50n, 10n, 10n], donor);
     });
   });
 
-  it('Admin (NFT): allows an Admin to nest a token', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {collectionAdmin: true}});
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT', charlie.address);
+  itSub('Admin (NFT): allows an Admin to nest a token', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {collectionAdmin: true}}});
+    await collection.addAdmin(alice, {Substrate: bob.address});
+    const targetToken = await collection.mintToken(alice, {Substrate: charlie.address});
 
-      // Create a nested token
-      const nestedToken = await createItemExpectSuccess(bob, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, targetToken)});
-      expect(await getTopmostTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Substrate: charlie.address});
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
+    // Create an immediately nested token
+    const nestedToken = await collection.mintToken(bob, targetToken.nestingAccount());
+    expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
 
-      // Create a token to be nested and nest
-      const newToken = await createItemExpectSuccess(bob, collection, 'NFT');
-      await transferExpectSuccess(collection, newToken, bob, {Ethereum: tokenIdToAddress(collection, targetToken)});
-      expect(await getTopmostTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: charlie.address});
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
-    });
+    // Create a token to be nested and nest
+    const newToken = await collection.mintToken(bob);
+    await newToken.nest(bob, targetToken);
+    expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
   });
 
-  it('Admin (NFT): Admin and Token Owner can operate together', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true, collectionAdmin: true}});
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT', charlie.address);
+  itSub('Admin (NFT): Admin and Token Owner can operate together', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {collectionAdmin: true, tokenOwner: true}}});
+    await collection.addAdmin(alice, {Substrate: bob.address});
+    const targetToken = await collection.mintToken(alice, {Substrate: charlie.address});
 
-      // Create a nested token by an administrator
-      const nestedToken = await createItemExpectSuccess(bob, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, targetToken)});
-      expect(await getTopmostTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Substrate: charlie.address});
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
+    // Create an immediately nested token by an administrator
+    const nestedToken = await collection.mintToken(bob, targetToken.nestingAccount());
+    expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
 
-      // Create a token and allow the owner to nest too
-      const newToken = await createItemExpectSuccess(alice, collection, 'NFT', charlie.address);
-      await transferExpectSuccess(collection, newToken, charlie, {Ethereum: tokenIdToAddress(collection, nestedToken)});
-      expect(await getTopmostTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: charlie.address});
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, nestedToken).toLowerCase()});
-    });
+    // Create a token to be nested and nest
+    const newToken = await collection.mintToken(alice, {Substrate: charlie.address});
+    await newToken.nest(charlie, targetToken);
+    expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
   });
 
-  it('Admin (NFT): allows an Admin to nest a token (Restricted nesting)', async () => {
-    await usingApi(async api => {
-      const collectionA = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await addCollectionAdminExpectSuccess(alice, collectionA, bob.address);
-      const collectionB = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await addCollectionAdminExpectSuccess(alice, collectionB, bob.address);
-      await setCollectionPermissionsExpectSuccess(alice, collectionA, {nesting: {collectionAdmin: true, restricted:[collectionA, collectionB]}});
-      const targetToken = await createItemExpectSuccess(alice, collectionA, 'NFT', charlie.address);
+  itSub('Admin (NFT): allows an Admin to nest a token (Restricted nesting)', async ({helper}) => {
+    const collectionA = await helper.nft.mintCollection(alice);
+    await collectionA.addAdmin(alice, {Substrate: bob.address});
+    const collectionB = await helper.nft.mintCollection(alice);
+    await collectionB.addAdmin(alice, {Substrate: bob.address});
+    await collectionA.setPermissions(alice, {nesting: {collectionAdmin: true, restricted:[collectionB.collectionId]}});
+    const targetToken = await collectionA.mintToken(alice, {Substrate: charlie.address});
 
-      // Create a nested token
-      const nestedToken = await createItemExpectSuccess(bob, collectionB, 'NFT', {Ethereum: tokenIdToAddress(collectionA, targetToken)});
-      expect(await getTopmostTokenOwner(api, collectionB, nestedToken)).to.be.deep.equal({Substrate: charlie.address});
-      expect(await getTokenOwner(api, collectionB, nestedToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collectionA, targetToken).toLowerCase()});
+    // Create an immediately nested token
+    const nestedToken = await collectionB.mintToken(bob, targetToken.nestingAccount());
+    expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
 
-      // Create a token to be nested and nest
-      const newToken = await createItemExpectSuccess(bob, collectionB, 'NFT');
-      await transferExpectSuccess(collectionB, newToken, bob, {Ethereum: tokenIdToAddress(collectionA, targetToken)});
-      expect(await getTopmostTokenOwner(api, collectionB, newToken)).to.be.deep.equal({Substrate: charlie.address});
-      expect(await getTokenOwner(api, collectionB, newToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collectionA, targetToken).toLowerCase()});
-    });
+    // Create a token to be nested and nest
+    const newToken = await collectionB.mintToken(bob);
+    await newToken.nest(bob, targetToken);
+    expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
   });
 
   // ---------- Non-Fungible ----------
 
-  it('NFT: allows an Owner to nest/unnest their token', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
+  itSub('NFT: allows an Owner to nest/unnest their token', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}}});
+    await collection.addToAllowList(alice, {Substrate: charlie.address});
+    const targetToken = await collection.mintToken(charlie);
+    await collection.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Create a nested token
-      const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, targetToken)});
-      expect(await getTopmostTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Substrate: alice.address});
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
+    // Create an immediately nested token
+    const nestedToken = await collection.mintToken(charlie, targetToken.nestingAccount());
+    expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
 
-      // Create a token to be nested and nest
-      const newToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      await transferExpectSuccess(collection, newToken, alice, {Ethereum: tokenIdToAddress(collection, targetToken)});
-      expect(await getTopmostTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: alice.address});
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
-    });
+    // Create a token to be nested and nest
+    const newToken = await collection.mintToken(charlie);
+    await newToken.nest(charlie, targetToken);
+    expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
   });
 
-  it('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true, restricted:[collection]}});
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
+  itSub('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {
+    const collectionA = await helper.nft.mintCollection(alice);
+    const collectionB = await helper.nft.mintCollection(alice);
+    //await collectionB.addAdmin(alice, {Substrate: bob.address});
+    const targetToken = await collectionA.mintToken(alice, {Substrate: charlie.address});
 
-      // Create a nested token
-      const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, targetToken)});
-      expect(await getTopmostTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Substrate: alice.address});
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
+    await collectionA.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true, restricted:[collectionB.collectionId]}});
+    await collectionA.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionA.addToAllowList(alice, targetToken.nestingAccount());
+
+    await collectionB.setPermissions(alice, {access: 'AllowList', mintMode: true});
+    await collectionB.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionB.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Create a token to be nested and nest
-      const newToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      await transferExpectSuccess(collection, newToken, alice, {Ethereum: tokenIdToAddress(collection, targetToken)});
-      expect(await getTopmostTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: alice.address});
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
-    });
+    // Create an immediately nested token
+    const nestedToken = await collectionB.mintToken(charlie, targetToken.nestingAccount());
+    expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
+
+    // Create a token to be nested and nest
+    const newToken = await collectionB.mintToken(charlie);
+    await newToken.nest(charlie, targetToken);
+    expect(await newToken.getTopmostOwner()).to.be.deep.equal({Substrate: charlie.address});
+    expect(await newToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
   });
 
   // ---------- Fungible ----------
 
-  it('Fungible: allows an Owner to nest/unnest their token', async () => {
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true}});
-      const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
+  itSub('Fungible: allows an Owner to nest/unnest their token', async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice, {permissions: {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}}});
+    const collectionFT = await helper.ft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice, {Substrate: charlie.address});
 
-      const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
+    await collectionNFT.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Create a nested token
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionFT,
-        targetAddress,
-        {Fungible: {Value: 10}},
-      ))).to.not.be.rejected;
+    await collectionFT.setPermissions(alice, {access: 'AllowList', mintMode: true});
+    await collectionFT.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Nest a new token
-      const newToken = await createItemExpectSuccess(alice, collectionFT, 'Fungible');
-      await transferExpectSuccess(collectionFT, newToken, alice, targetAddress, 1, 'Fungible');
-    });
+    // Create an immediately nested token
+    await collectionFT.mint(charlie, 5n, targetToken.nestingAccount());
+    expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
+
+    // Create a token to be nested and nest
+    await collectionFT.mint(charlie, 5n);
+    await collectionFT.transfer(charlie, targetToken.nestingAccount(), 2n);
+    expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(7n);
   });
 
-  it('Fungible: allows an Owner to nest/unnest their token (Restricted nesting)', async () => {
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
+  itSub('Fungible: allows an Owner to nest/unnest their token (Restricted nesting)', async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice);
+    const collectionFT = await helper.ft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice, {Substrate: charlie.address});
 
-      const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
+    await collectionNFT.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true, restricted:[collectionFT.collectionId]}});
+    await collectionNFT.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true, restricted: [collectionFT]}});
+    await collectionFT.setPermissions(alice, {access: 'AllowList', mintMode: true});
+    await collectionFT.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Create a nested token
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionFT,
-        targetAddress,
-        {Fungible: {Value: 10}},
-      ))).to.not.be.rejected;
+    // Create an immediately nested token
+    await collectionFT.mint(charlie, 5n, targetToken.nestingAccount());
+    expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
 
-      // Nest a new token
-      const newToken = await createItemExpectSuccess(alice, collectionFT, 'Fungible');
-      await transferExpectSuccess(collectionFT, newToken, alice, targetAddress, 1, 'Fungible');
-    });
+    // Create a token to be nested and nest
+    await collectionFT.mint(charlie, 5n);
+    await collectionFT.transfer(charlie, targetToken.nestingAccount(), 2n);
+    expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(7n);
   });
 
   // ---------- Re-Fungible ----------
 
-  it('ReFungible: allows an Owner to nest/unnest their token', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
+  itSub.ifWithPallets('ReFungible: allows an Owner to nest/unnest their token', [Pallets.ReFungible], async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice, {permissions: {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}}});
+    const collectionRFT = await helper.rft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice, {Substrate: charlie.address});
 
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true}});
-      const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
+    await collectionNFT.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+    await collectionRFT.setPermissions(alice, {access: 'AllowList', mintMode: true});
+    await collectionRFT.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionRFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Create a nested token
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionRFT,
-        targetAddress,
-        {ReFungible: {pieces: 100}},
-      ))).to.not.be.rejected;
+    // Create an immediately nested token
+    const nestedToken = await collectionRFT.mintToken(charlie, 5n, targetToken.nestingAccount());
+    expect(await nestedToken.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
 
-      // Nest a new token
-      const newToken = await createItemExpectSuccess(alice, collectionRFT, 'ReFungible');
-      await transferExpectSuccess(collectionRFT, newToken, alice, targetAddress, 100, 'ReFungible');
-    });
+    // Create a token to be nested and nest
+    const newToken = await collectionRFT.mintToken(charlie, 5n);
+    await newToken.transfer(charlie, targetToken.nestingAccount(), 2n);
+    expect(await newToken.getBalance(targetToken.nestingAccount())).to.be.equal(2n);
   });
 
-  it('ReFungible: allows an Owner to nest/unnest their token (Restricted nesting)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
+  itSub.ifWithPallets('ReFungible: allows an Owner to nest/unnest their token (Restricted nesting)', [Pallets.ReFungible], async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice);
+    const collectionRFT = await helper.rft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice, {Substrate: charlie.address});
 
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
+    await collectionNFT.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true, restricted:[collectionRFT.collectionId]}});
+    await collectionNFT.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+    await collectionRFT.setPermissions(alice, {access: 'AllowList', mintMode: true});
+    await collectionRFT.addToAllowList(alice, {Substrate: charlie.address});
+    await collectionRFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true, restricted:[collectionRFT]}});
+    // Create an immediately nested token
+    const nestedToken = await collectionRFT.mintToken(charlie, 5n, targetToken.nestingAccount());
+    expect(await nestedToken.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
 
-      // Create a nested token
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionRFT,
-        targetAddress,
-        {ReFungible: {pieces: 100}},
-      ))).to.not.be.rejected;
-
-      // Nest a new token
-      const newToken = await createItemExpectSuccess(alice, collectionRFT, 'ReFungible');
-      await transferExpectSuccess(collectionRFT, newToken, alice, targetAddress, 100, 'ReFungible');
-    });
+    // Create a token to be nested and nest
+    const newToken = await collectionRFT.mintToken(charlie, 5n);
+    await newToken.transfer(charlie, targetToken.nestingAccount(), 2n);
+    expect(await newToken.getBalance(targetToken.nestingAccount())).to.be.equal(2n);
   });
 });
 
-describe('Negative Test: Nesting', async() => {
+describe('Negative Test: Nesting', () => {
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
+
   before(async () => {
-    await usingApi(async (_, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice, bob] = await helper.arrange.createAccounts([100n, 50n], donor);
     });
   });
 
-  it('Disallows excessive token nesting', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
-
-      const maxNestingLevel = 5;
-      let prevToken = targetToken;
+  itSub('Disallows excessive token nesting', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    let token = await collection.mintToken(alice);
 
-      // Create a nested-token matryoshka
-      for (let i = 0; i < maxNestingLevel; i++) {
-        const nestedToken = await createItemExpectSuccess(
-          alice,
-          collection,
-          'NFT',
-          {Ethereum: tokenIdToAddress(collection, prevToken)},
-        );
+    const maxNestingLevel = 5;
 
-        prevToken = nestedToken;
-      }
-
-      // The nesting depth is limited by `maxNestingLevel`
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collection,
-        {Ethereum: tokenIdToAddress(collection, prevToken)},
-          {nft: {}} as any,
-      )), 'while creating nested token').to.be.rejectedWith(/^structure\.DepthLimit$/);
+    // Create a nested-token matryoshka
+    for (let i = 0; i < maxNestingLevel; i++) {
+      token = await collection.mintToken(alice, token.nestingAccount());
+    }
 
-      expect(await getTopmostTokenOwner(api, collection, prevToken)).to.be.deep.equal({Substrate: alice.address});
-    });
+    // The nesting depth is limited by `maxNestingLevel`
+    await expect(collection.mintToken(alice, token.nestingAccount()))
+      .to.be.rejectedWith(/structure\.DepthLimit/);
+    expect(await token.getTopmostOwner()).to.be.deep.equal({Substrate: alice.address});
+    expect(await token.getChildren()).to.be.length(0);
   });
 
   // ---------- Admin ------------
 
-  it('Admin (NFT): disallows an Admin to operate nesting when only TokenOwner is allowed', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
+  itSub('Admin (NFT): disallows an Admin to operate nesting when only TokenOwner is allowed', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    await collection.addAdmin(alice, {Substrate: bob.address});
+    const targetToken = await collection.mintToken(alice);
 
-      // Try to create a nested token as collection admin when it's disallowed
-      await expect(executeTransaction(api, bob, api.tx.unique.createItem(
-        collection,
-        {Ethereum: tokenIdToAddress(collection, targetToken)},
-          {nft: {}} as any,
-      )), 'while creating nested token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    // Try to create an immediately nested token as collection admin when it's disallowed
+    await expect(collection.mintToken(bob, targetToken.nestingAccount()))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
 
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(bob, collection, 'NFT');
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.transfer({Ethereum: tokenIdToAddress(collection, targetToken)}, collection, newToken, 1),
-      ), 'while nesting new token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: bob.address});
-    });
+    // Try to create a token to be nested and nest
+    const newToken = await collection.mintToken(bob);
+    await expect(newToken.nest(bob, targetToken))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+
+    expect(await targetToken.getChildren()).to.be.length(0);
+    expect(await newToken.getOwner()).to.be.deep.equal({Substrate: bob.address});
   });
 
-  it('Admin (NFT): disallows a Token Owner to operate nesting when only Admin is allowed', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {collectionAdmin: true}});
-      await addToAllowListExpectSuccess(alice, collection, bob.address);
-      await enableAllowListExpectSuccess(alice, collection);
-      await enablePublicMintingExpectSuccess(alice, collection);
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
+  itSub('Admin (NFT): disallows a Token Owner to operate nesting when only Admin is allowed', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {access: 'AllowList', mintMode: true, nesting: {collectionAdmin: true}}});
+    const targetToken = await collection.mintToken(alice, {Substrate: bob.address});
+    await collection.addToAllowList(alice, {Substrate: bob.address});
+    await collection.addToAllowList(alice, targetToken.nestingAccount());
+
+    // Try to create a nested token as token owner when it's disallowed
+    await expect(collection.mintToken(bob, targetToken.nestingAccount()))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
 
-      // Try to create a nested token as collection admin when it's disallowed
-      await expect(executeTransaction(api, bob, api.tx.unique.createItem(
-        collection,
-        {Ethereum: tokenIdToAddress(collection, targetToken)},
-          {nft: {}} as any,
-      )), 'while creating nested token').to.be.rejectedWith(/common\.AddressNotInAllowlist/); 
+    // Try to create a token to be nested and nest
+    const newToken = await collection.mintToken(bob);
+    await expect(newToken.nest(bob, targetToken))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
 
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(bob, collection, 'NFT');
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.transfer({Ethereum: tokenIdToAddress(collection, targetToken)}, collection, newToken, 1),
-      ), 'while nesting new token').to.be.rejectedWith(/common\.AddressNotInAllowlist/);
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: bob.address});
-    });
+    expect(await targetToken.getChildren()).to.be.length(0);
+    expect(await newToken.getOwner()).to.be.deep.equal({Substrate: bob.address});
   });
 
-  it('Admin (NFT): disallows an Admin to nest and unnest someone else\'s token', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {collectionAdmin: true}});
+  itSub('Admin (NFT): disallows an Admin to unnest someone else\'s token', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {limits: {ownerCanTransfer: true}, permissions: {access: 'AllowList', mintMode: true, nesting: {collectionAdmin: true}}});
+    //await collection.addAdmin(alice, {Substrate: bob.address});
+    const targetToken = await collection.mintToken(alice, {Substrate: bob.address});
+    await collection.addToAllowList(alice, {Substrate: bob.address});
+    await collection.addToAllowList(alice, targetToken.nestingAccount());
 
-      await addToAllowListExpectSuccess(alice, collection, bob.address);
-      await enableAllowListExpectSuccess(alice, collection);
-      await enablePublicMintingExpectSuccess(alice, collection);
-
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(bob, collection, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()};
+    // Try to nest somebody else's token
+    const newToken = await collection.mintToken(bob);
+    await expect(newToken.nest(alice, targetToken))
+      .to.be.rejectedWith(/common\.NoPermission/);
 
-      // Try to nest somebody else's token
-      const newToken = await createItemExpectSuccess(bob, collection, 'NFT');
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.transferFrom(targetAddress, {Substrate: bob.address}, collection, newToken, 1),
-      ), 'while nesting another\'s token token').to.be.rejectedWith(/common\.AddressNotInAllowlist/);
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: bob.address});
+    // Try to unnest a token belonging to someone else as collection admin
+    const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
+    await expect(nestedToken.unnest(alice, targetToken, {Substrate: bob.address}))
+      .to.be.rejectedWith(/common\.AddressNotInAllowlist/);
 
-      // Nest a token as admin and try to unnest it, now belonging to someone else
-      const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', targetAddress);
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.transferFrom(targetAddress, normalizeAccountId(alice), collection, nestedToken, 1),
-      ), 'while unnesting another\'s token').to.be.rejectedWith(/common\.AddressNotInAllowlist/);
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal(targetAddress);
-      expect(await getTopmostTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Substrate: bob.address});
-    });
+    expect(await targetToken.getChildren()).to.be.length(1);
+    expect(await nestedToken.getTopmostOwner()).to.be.deep.equal({Substrate: bob.address});
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
   });
 
-  it('Admin (NFT): disallows an Admin to nest a token from an unlisted collection (Restricted nesting)', async () => {
-    await usingApi(async api => {
-      const collectionA = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      const collectionB = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionA, {nesting: {collectionAdmin: true, restricted:[collectionA]}});
+  itSub('Admin (NFT): disallows an Admin to nest a token from an unlisted collection (Restricted nesting)', async ({helper}) => {
+    const collectionA = await helper.nft.mintCollection(alice);
+    const collectionB = await helper.nft.mintCollection(alice);
+    await collectionA.setPermissions(alice, {nesting: {collectionAdmin: true, restricted: [collectionA.collectionId]}});
+    const targetToken = await collectionA.mintToken(alice);
 
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(alice, collectionA, 'NFT');
+    // Try to create a nested token from another collection
+    await expect(collectionB.mintToken(alice, targetToken.nestingAccount()))
+      .to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
 
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collectionB, 'NFT');
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.transfer({Ethereum: tokenIdToAddress(collectionA, targetToken)}, collectionB, newToken, 1),
-      ), 'while nesting a foreign token').to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
-      expect(await getTokenOwner(api, collectionB, newToken)).to.be.deep.equal({Substrate: alice.address});
-    });
+    // Create a token in another collection yet to be nested and try to nest
+    const newToken = await collectionB.mintToken(alice);
+    await expect(newToken.nest(alice, targetToken))
+      .to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
+
+    expect(await targetToken.getChildren()).to.be.length(0);
+    expect(await newToken.getOwner()).to.be.deep.equal({Substrate: alice.address});
   });
 
   // ---------- Non-Fungible ----------
 
-  it('NFT: disallows to nest token if nesting is disabled', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {}});
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
+  itSub('NFT: disallows to nest token if nesting is disabled', async ({helper}) => {
+    // Collection is implicitly not allowed nesting at creation
+    const collection = await helper.nft.mintCollection(alice);
+    const targetToken = await collection.mintToken(alice);
 
-      // Try to create a nested token
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collection,
-        {Ethereum: tokenIdToAddress(collection, targetToken)},
-          {nft: {}} as any,
-      )), 'while creating nested token').to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
+    // Try to create a nested token as token owner when it's disallowed
+    await expect(collection.mintToken(alice, targetToken.nestingAccount()))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
 
-      // Create a token to be nested
-      const newToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      // Try to nest
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer({Ethereum: tokenIdToAddress(collection, targetToken)}, collection, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
-      expect(await getTopmostTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: alice.address});
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: alice.address});
-    });
+    // Try to create a token to be nested and nest
+    const newToken = await collection.mintToken(alice);
+    await expect(newToken.nest(alice, targetToken))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+
+    expect(await targetToken.getChildren()).to.be.length(0);
+    expect(await newToken.getOwner()).to.be.deep.equal({Substrate: alice.address});
   });
 
-  it('NFT: disallows a non-Owner to nest someone else\'s token', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
+  itSub('NFT: disallows a non-Owner to nest someone else\'s token', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice);
+    const targetToken = await collection.mintToken(alice);
 
-      await addToAllowListExpectSuccess(alice, collection, bob.address);
-      await enableAllowListExpectSuccess(alice, collection);
-      await enablePublicMintingExpectSuccess(alice, collection);
-
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(bob, collection, 'NFT');
+    await collection.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}});
+    await collection.addToAllowList(alice, {Substrate: bob.address});
+    await collection.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Try to create a nested token in the wrong collection
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collection,
-        {Ethereum: tokenIdToAddress(collection, targetToken)},
-          {nft: {}} as any,
-      )), 'while creating nested token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    // Try to create a token to be nested and nest
+    const newToken = await collection.mintToken(alice);
+    await expect(newToken.nest(bob, targetToken)).to.be.rejectedWith(/common\.NoPermission/);
 
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer({Ethereum: tokenIdToAddress(collection, targetToken)}, collection, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.AddressNotInAllowlist/);
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: alice.address});
-    });
+    expect(await targetToken.getChildren()).to.be.length(0);
+    expect(await newToken.getOwner()).to.be.deep.equal({Substrate: alice.address});
   });
 
-  it('NFT: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true, restricted:[collection]}});
+  itSub('NFT: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice);
+    const targetToken = await collection.mintToken(alice);
 
-      await addToAllowListExpectSuccess(alice, collection, bob.address);
-      await enableAllowListExpectSuccess(alice, collection);
-      await enablePublicMintingExpectSuccess(alice, collection);
+    await collection.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}});
+    await collection.addToAllowList(alice, {Substrate: bob.address});
+    await collection.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(bob, collection, 'NFT');
+    const collectionB = await helper.nft.mintCollection(alice, {permissions: {access: 'AllowList', mintMode: true}});
+    await collectionB.addToAllowList(alice, {Substrate: bob.address});
+    await collectionB.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Try to create a nested token in the wrong collection
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collection,
-        {Ethereum: tokenIdToAddress(collection, targetToken)},
-          {nft: {}} as any,
-      )), 'while creating nested token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    // Try to create a token to be nested and nest
+    const newToken = await collectionB.mintToken(alice);
+    await expect(newToken.nest(bob, targetToken)).to.be.rejectedWith(/common\.NoPermission/);
 
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer({Ethereum: tokenIdToAddress(collection, targetToken)}, collection, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.AddressNotInAllowlist/);
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: alice.address});
-    });
+    expect(await targetToken.getChildren()).to.be.length(0);
+    expect(await newToken.getOwner()).to.be.deep.equal({Substrate: alice.address});
   });
 
-  it('NFT: disallows to nest token in an unlisted collection', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true, restricted:[]}});
+  itSub('NFT: disallows to nest token in an unlisted collection', async ({helper}) => {
+    // Create collection with restricted nesting -- even self is not allowed
+    const collection = await helper.nft.mintCollection(alice, {permissions: {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true, restricted: []}}});
+    const targetToken = await collection.mintToken(alice, {Substrate: bob.address});
 
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
+    await collection.addToAllowList(alice, {Substrate: bob.address});
+    await collection.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Try to create a nested token in the wrong collection
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collection,
-        {Ethereum: tokenIdToAddress(collection, targetToken)},
-          {nft: {}} as any,
-      )), 'while creating nested token').to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
-
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer({Ethereum: tokenIdToAddress(collection, targetToken)}, collection, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
-      expect(await getTokenOwner(api, collection, newToken)).to.be.deep.equal({Substrate: alice.address});
-    });
+    // Try to mint in own collection after allowlisting the accounts
+    await expect(collection.mintToken(bob, targetToken.nestingAccount()))
+      .to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
   });
 
   // ---------- Fungible ----------
-
-  it('Fungible: disallows to nest token if nesting is disabled', async () => {
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {}});
-      const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
-
-      const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
 
-      // Try to create a nested token
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionFT,
-        targetAddress,
-        {Fungible: {Value: 10}},
-      )), 'while creating nested token').to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
+  itSub('Fungible: disallows to nest token if nesting is disabled', async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice);
+    const collectionFT = await helper.ft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice);
 
-      // Create a token to be nested
-      const newToken = await createItemExpectSuccess(alice, collectionFT, 'Fungible');
-      // Try to nest
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(targetAddress, collectionFT, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    // Try to create an immediately nested token
+    await expect(collectionFT.mint(alice, 5n, targetToken.nestingAccount()))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
 
-      // Create another token to be nested
-      const newToken2 = await createItemExpectSuccess(alice, collectionFT, 'Fungible');
-      // Try to nest inside a fungible token
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer({Ethereum: tokenIdToAddress(collectionFT, newToken)}, collectionFT, newToken2, 1)), 'while nesting new token inside fungible').to.be.rejectedWith(/fungible\.FungibleDisallowsNesting/);
-    });
+    // Try to create a token to be nested and nest
+    await collectionFT.mint(alice, 5n);
+    await expect(collectionFT.transfer(alice, targetToken.nestingAccount(), 2n))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    expect(await collectionFT.getBalance({Substrate: alice.address})).to.be.equal(5n);
   });
 
-  it('Fungible: disallows a non-Owner to nest someone else\'s token', async () => {
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true}});
+  itSub('Fungible: disallows a non-Owner to unnest someone else\'s token', async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice, {permissions: {nesting: {collectionAdmin: true, tokenOwner: true}}});
+    const collectionFT = await helper.ft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice, {Substrate: bob.address});
 
-      await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);
-      await enableAllowListExpectSuccess(alice, collectionNFT);
-      await enablePublicMintingExpectSuccess(alice, collectionNFT);
+    // Nest some tokens as Alice into Bob's token
+    await collectionFT.mint(alice, 5n, targetToken.nestingAccount());
 
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(bob, collectionNFT, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
-
-      const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
-
-      // Try to create a nested token in the wrong collection
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionFT,
-        targetAddress,
-        {Fungible: {Value: 10}},
-      )), 'while creating nested token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
-
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collectionFT, 'Fungible');
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(targetAddress, collectionFT, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
-    });
+    // Try to pull it out
+    await expect(collectionFT.transferFrom(alice, targetToken.nestingAccount(), {Substrate: bob.address}, 1n))
+      .to.be.rejectedWith(/common\.ApprovedValueTooLow/);
+    expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
   });
 
-  it('Fungible: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async () => {
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);
-      await enableAllowListExpectSuccess(alice, collectionNFT);
-      await enablePublicMintingExpectSuccess(alice, collectionNFT);
-
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(bob, collectionNFT, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
+  itSub('Fungible: disallows a non-Owner to unnest someone else\'s token (Restricted nesting)', async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice);
+    const collectionFT = await helper.ft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice, {Substrate: bob.address});
 
-      const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true, restricted:[collectionFT]}});
+    await collectionNFT.setPermissions(alice, {nesting: {collectionAdmin: true, tokenOwner: true, restricted: [collectionFT.collectionId]}});
 
-      // Try to create a nested token in the wrong collection
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionFT,
-        targetAddress,
-        {Fungible: {Value: 10}},
-      )), 'while creating nested token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    // Nest some tokens as Alice into Bob's token
+    await collectionFT.mint(alice, 5n, targetToken.nestingAccount());
 
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collectionFT, 'Fungible');
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(targetAddress, collectionFT, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
-    });
+    // Try to pull it out as Alice still
+    await expect(collectionFT.transferFrom(alice, targetToken.nestingAccount(), {Substrate: bob.address}, 1n))
+      .to.be.rejectedWith(/common\.ApprovedValueTooLow/);
+    expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(5n);
   });
 
-  it('Fungible: disallows to nest token in an unlisted collection', async () => {
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true, restricted:[]}});
-
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
+  itSub('Fungible: disallows to nest token in an unlisted collection', async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice, {permissions: {nesting: {collectionAdmin: true, tokenOwner: true, restricted: []}}});
+    const collectionFT = await helper.ft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice);
 
-      const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
+    // Try to mint an immediately nested token
+    await expect(collectionFT.mint(alice, 5n, targetToken.nestingAccount()))
+      .to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
 
-      // Try to create a nested token in the wrong collection
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionFT,
-        targetAddress,
-        {Fungible: {Value: 10}},
-      )), 'while creating a nested token').to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
+    // Mint a token and try to nest it
+    await collectionFT.mint(alice, 5n);
+    await expect(collectionFT.transfer(alice, targetToken.nestingAccount(), 1n))
+      .to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
 
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collectionFT, 'Fungible');
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(targetAddress, collectionFT, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
-    });
+    expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(0n);
+    expect(await collectionFT.getBalance({Substrate: alice.address})).to.be.equal(5n);
   });
 
   // ---------- Re-Fungible ----------
-
-  it('ReFungible: disallows to nest token if nesting is disabled', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {}});
-      const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
-
-      const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-
-      // Create a nested token
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionRFT,
-        targetAddress,
-        {ReFungible: {pieces: 100}},
-      )), 'while creating a nested token').to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
+  itSub.ifWithPallets('ReFungible: disallows to nest token if nesting is disabled', [Pallets.ReFungible], async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice);
+    const collectionRFT = await helper.rft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice);
 
-      // Create a token to be nested
-      const newToken = await createItemExpectSuccess(alice, collectionRFT, 'ReFungible');
-      // Try to nest
-      await transferExpectFailure(collectionRFT, newToken, alice, targetAddress, 100);
-      // Try to nest
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(targetAddress, collectionRFT, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    // Try to create an immediately nested token
+    await expect(collectionRFT.mintToken(alice, 5n, targetToken.nestingAccount()))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
 
-      // Create another token to be nested
-      const newToken2 = await createItemExpectSuccess(alice, collectionRFT, 'ReFungible');
-      // Try to nest inside a fungible token
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer({Ethereum: tokenIdToAddress(collectionRFT, newToken)}, collectionRFT, newToken2, 1)), 'while nesting new token inside refungible').to.be.rejectedWith(/refungible\.RefungibleDisallowsNesting/);
-    });
+    // Try to create a token to be nested and nest
+    const token = await collectionRFT.mintToken(alice, 5n);
+    await expect(token.transfer(alice, targetToken.nestingAccount(), 2n))
+      .to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    expect(await token.getBalance({Substrate: alice.address})).to.be.equal(5n);
   });
-
-  it('ReFungible: disallows a non-Owner to nest someone else\'s token', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true}});
+  itSub.ifWithPallets('ReFungible: disallows a non-Owner to nest someone else\'s token', [Pallets.ReFungible], async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice);
+    const collectionRFT = await helper.rft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice);
 
-      await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);
-      await enableAllowListExpectSuccess(alice, collectionNFT);
-      await enablePublicMintingExpectSuccess(alice, collectionNFT);
+    await collectionNFT.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true}});
+    await collectionNFT.addToAllowList(alice, {Substrate: bob.address});
+    await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(bob, collectionNFT, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
+    // Try to create a token to be nested and nest
+    const newToken = await collectionRFT.mintToken(alice);
+    await expect(newToken.transfer(bob, targetToken.nestingAccount())).to.be.rejectedWith(/common\.TokenValueTooLow/);
 
-      const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+    expect(await targetToken.getChildren()).to.be.length(0);
+    expect(await newToken.getBalance({Substrate: alice.address})).to.be.equal(1n);
 
-      // Try to create a nested token in the wrong collection
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionRFT,
-        targetAddress,
-        {ReFungible: {pieces: 100}},
-      )), 'while creating a nested token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    // Nest some tokens as Alice into Bob's token
+    await newToken.transfer(alice, targetToken.nestingAccount());
 
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collectionRFT, 'ReFungible');
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(targetAddress, collectionRFT, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
-    });
+    // Try to pull it out
+    await expect(newToken.transferFrom(bob, targetToken.nestingAccount(), {Substrate: alice.address}, 1n))
+      .to.be.rejectedWith(/common\.ApprovedValueTooLow/);
+    expect(await newToken.getBalance(targetToken.nestingAccount())).to.be.equal(1n);
   });
 
-  it('ReFungible: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
+  itSub.ifWithPallets('ReFungible: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', [Pallets.ReFungible], async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice);
+    const collectionRFT = await helper.rft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice);
 
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);
-      await enableAllowListExpectSuccess(alice, collectionNFT);
-      await enablePublicMintingExpectSuccess(alice, collectionNFT);
+    await collectionNFT.setPermissions(alice, {access: 'AllowList', mintMode: true, nesting: {tokenOwner: true, restricted: [collectionRFT.collectionId]}});
+    await collectionNFT.addToAllowList(alice, {Substrate: bob.address});
+    await collectionNFT.addToAllowList(alice, targetToken.nestingAccount());
 
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(bob, collectionNFT, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
+    // Try to create a token to be nested and nest
+    const newToken = await collectionRFT.mintToken(alice);
+    await expect(newToken.transfer(bob, targetToken.nestingAccount())).to.be.rejectedWith(/common\.TokenValueTooLow/);
 
-      const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true, restricted:[collectionRFT]}});
+    expect(await targetToken.getChildren()).to.be.length(0);
+    expect(await newToken.getBalance({Substrate: alice.address})).to.be.equal(1n);
 
-      // Try to create a nested token in the wrong collection
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionRFT,
-        targetAddress,
-        {ReFungible: {pieces: 100}},
-      )), 'while creating a nested token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
+    // Nest some tokens as Alice into Bob's token
+    await newToken.transfer(alice, targetToken.nestingAccount());
 
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collectionRFT, 'ReFungible');
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(targetAddress, collectionRFT, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.UserIsNotAllowedToNest/);
-    });
+    // Try to pull it out
+    await expect(newToken.transferFrom(bob, targetToken.nestingAccount(), {Substrate: alice.address}, 1n))
+      .to.be.rejectedWith(/common\.ApprovedValueTooLow/);
+    expect(await newToken.getBalance(targetToken.nestingAccount())).to.be.equal(1n);
   });
 
-  it('ReFungible: disallows to nest token to an unlisted collection', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
+  itSub.ifWithPallets('ReFungible: disallows to nest token to an unlisted collection', [Pallets.ReFungible], async ({helper}) => {
+    const collectionNFT = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true, restricted: []}}});
+    const collectionRFT = await helper.rft.mintCollection(alice);
+    const targetToken = await collectionNFT.mintToken(alice);
 
-    await usingApi(async api => {
-      const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collectionNFT, {nesting: {tokenOwner: true, restricted:[]}});
+    // Try to create an immediately nested token
+    await expect(collectionRFT.mintToken(alice, 5n, targetToken.nestingAccount()))
+      .to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
 
-      // Create a token to attempt to be nested into
-      const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};
-
-      const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-
-      // Try to create a nested token in the wrong collection
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(
-        collectionRFT,
-        targetAddress,
-        {ReFungible: {pieces: 100}},
-      )), 'while creating a nested token').to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
-
-      // Try to create and nest a token in the wrong collection
-      const newToken = await createItemExpectSuccess(alice, collectionRFT, 'ReFungible');
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(targetAddress, collectionRFT, newToken, 1)), 'while nesting new token').to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
-    });
+    // Try to create a token to be nested and nest
+    const token = await collectionRFT.mintToken(alice, 5n);
+    await expect(token.transfer(alice, targetToken.nestingAccount(), 2n))
+      .to.be.rejectedWith(/common\.SourceCollectionIsNotAllowedToNest/);
+    expect(await token.getBalance({Substrate: alice.address})).to.be.equal(5n);
   });
 });
modifiedtests/src/nesting/properties.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/properties.test.ts
+++ b/tests/src/nesting/properties.test.ts
@@ -1,1004 +1,788 @@
-import {expect} from 'chai';
-import usingApi, {executeTransaction} from '../substrate/substrate-api';
-import {
-  addCollectionAdminExpectSuccess,
-  CollectionMode,
-  createCollectionExpectSuccess,
-  setCollectionPermissionsExpectSuccess,
-  createItemExpectSuccess,
-  getCreateCollectionResult,
-  transferExpectSuccess,
-  requirePallets,
-  Pallets,
-} from '../util/helpers';
-import {IKeyringPair} from '@polkadot/types/types';
-import {tokenIdToAddress} from '../eth/util/helpers';
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
 
-let alice: IKeyringPair;
-let bob: IKeyringPair;
-let charlie: IKeyringPair;
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
 
-describe('Composite Properties Test', () => {
-  before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
-    });
-  });
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
 
-  async function testMakeSureSuppliesRequired(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collectionId = await createCollectionExpectSuccess({mode: mode});
+// You should have received a copy of the GNU General Public License
+// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-      const collectionOption = await api.rpc.unique.collectionById(collectionId);
-      expect(collectionOption.isSome).to.be.true;
-      let collection = collectionOption.unwrap();
-      expect(collection.tokenPropertyPermissions.toHuman()).to.be.empty;
-      expect(collection.properties.toHuman()).to.be.empty;
+import {IKeyringPair} from '@polkadot/types/types';
+import {itSub, Pallets, requirePalletsOrSkip, usingPlaygrounds, expect} from '../util/playgrounds';
+import {UniqueHelper, UniqueBaseCollection, UniqueNFTCollection, UniqueNFToken, UniqueRFTCollection, UniqueRFToken} from '../util/playgrounds/unique';
 
-      const propertyPermissions = [
-        {key: 'mindgame', permission: {collectionAdmin: true, mutable: false, tokenOwner: true}},
-        {key: 'skullduggery', permission: {collectionAdmin: false, mutable: true, tokenOwner: false}},
-      ];
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collectionId, propertyPermissions), 
-      )).to.not.be.rejected;
+// ---------- COLLECTION PROPERTIES
 
-      const collectionProperties = [
-        {key: 'black_hole', value: 'LIGO'},
-        {key: 'electron', value: 'come bond'}, 
-      ];
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setCollectionProperties(collectionId, collectionProperties), 
-      )).to.not.be.rejected;
+describe('Integration Test: Collection Properties', () => {
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
 
-      collection = (await api.rpc.unique.collectionById(collectionId)).unwrap();
-      expect(collection.tokenPropertyPermissions.toHuman()).to.be.deep.equal(propertyPermissions);
-      expect(collection.properties.toHuman()).to.be.deep.equal(collectionProperties);
+  before(async () => {
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice, bob] = await helper.arrange.createAccounts([50n, 10n], donor);
     });
-  }
+  });
 
-  it('Makes sure collectionById supplies required fields for NFT', async () => {
-    await testMakeSureSuppliesRequired({type: 'NFT'});
+  itSub('Properties are initially empty', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice);
+    expect(await collection.getProperties()).to.be.empty;
   });
 
-  it('Makes sure collectionById supplies required fields for ReFungible', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
+  async function testSetsPropertiesForCollection(collection: UniqueBaseCollection) {
+    // As owner
+    await expect(collection.setProperties(alice, [{key: 'electron', value: 'come bond'}])).to.be.fulfilled;
+
+    await collection.addAdmin(alice, {Substrate: bob.address});
 
-    await testMakeSureSuppliesRequired({type: 'ReFungible'});
-  });
-});
+    // As administrator
+    await expect(collection.setProperties(bob, [{key: 'black_hole'}])).to.be.fulfilled;
 
-// ---------- COLLECTION PROPERTIES
+    const properties = await collection.getProperties();
+    expect(properties).to.include.deep.members([
+      {key: 'electron', value: 'come bond'},
+      {key: 'black_hole', value: ''},
+    ]);
+  }
 
-describe('Integration Test: Collection Properties', () => {
-  before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
-    });
+  itSub('Sets properties for a NFT collection', async ({helper}) =>  {
+    await testSetsPropertiesForCollection(await helper.nft.mintCollection(alice));
   });
 
-  it('Reads properties from a collection', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess();
-      const properties = (await api.query.common.collectionProperties(collection)).toJSON();
-      expect(properties.map).to.be.empty;
-      expect(properties.consumedSpace).to.equal(0);
-    });
+  itSub.ifWithPallets('Sets properties for a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
+    await testSetsPropertiesForCollection(await helper.rft.mintCollection(alice));
   });
 
+  async function testCheckValidNames(collection: UniqueBaseCollection) {
+    // alpha symbols
+    await expect(collection.setProperties(alice, [{key: 'answer'}])).to.be.fulfilled;
 
-  async function testSetsPropertiesForCollection(mode: string) {
-    await usingApi(async api => {
-      const events = await executeTransaction(api, bob, api.tx.unique.createCollectionEx({mode: mode}));
-      const {collectionId} = getCreateCollectionResult(events);
+    // numeric symbols
+    await expect(collection.setProperties(alice, [{key: '451'}])).to.be.fulfilled;
 
-      // As owner
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setCollectionProperties(collectionId, [{key: 'electron', value: 'come bond'}]), 
-      )).to.not.be.rejected;
+    // underscore symbol
+    await expect(collection.setProperties(alice, [{key: 'black_hole'}])).to.be.fulfilled;
 
-      await addCollectionAdminExpectSuccess(bob, collectionId, alice.address);
+    // dash symbol
+    await expect(collection.setProperties(alice, [{key: '-'}])).to.be.fulfilled;
 
-      // As administrator
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setCollectionProperties(collectionId, [{key: 'black_hole'}]), 
-      )).to.not.be.rejected;
+    // dot symbol
+    await expect(collection.setProperties(alice, [{key: 'once.in.a.long.long.while...', value: 'you get a little lost'}])).to.be.fulfilled;
 
-      const properties = (await api.rpc.unique.collectionProperties(collectionId, ['electron', 'black_hole'])).toHuman();
-      expect(properties).to.be.deep.equal([
-        {key: 'electron', value: 'come bond'},
-        {key: 'black_hole', value: ''},
-      ]);
-    });
+    const properties = await collection.getProperties();
+    expect(properties).to.include.deep.members([
+      {key: 'answer', value: ''},
+      {key: '451', value: ''},
+      {key: 'black_hole', value: ''},
+      {key: '-', value: ''},
+      {key: 'once.in.a.long.long.while...', value: 'you get a little lost'},
+    ]);
   }
-  it('Sets properties for a NFT collection', async () => {
-    await testSetsPropertiesForCollection('NFT');
-  });
-  it('Sets properties for a ReFungible collection', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testSetsPropertiesForCollection('ReFungible');
+  itSub('Check valid names for NFT collection properties keys', async ({helper}) =>  {
+    await testCheckValidNames(await helper.nft.mintCollection(alice));
   });
 
-  async function testCheckValidNames(mode: string) {
-    await usingApi(async api => {
-      const events = await executeTransaction(api, bob, api.tx.unique.createCollectionEx({mode: mode}));
-      const {collectionId} = getCreateCollectionResult(events);
-  
-      // alpha symbols
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setCollectionProperties(collectionId, [{key: 'alpha'}]), 
-      )).to.not.be.rejected;
-  
-      // numeric symbols
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setCollectionProperties(collectionId, [{key: '123'}]), 
-      )).to.not.be.rejected;
-  
-      // underscore symbol
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setCollectionProperties(collectionId, [{key: 'black_hole'}]), 
-      )).to.not.be.rejected;
-  
-      // dash symbol
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setCollectionProperties(collectionId, [{key: 'semi-automatic'}]), 
-      )).to.not.be.rejected;
-  
-      // underscore symbol
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setCollectionProperties(collectionId, [{key: 'build.rs'}]), 
-      )).to.not.be.rejected;
-  
-      const propertyKeys = ['alpha', '123', 'black_hole', 'semi-automatic', 'build.rs'];
-      const properties = (await api.rpc.unique.collectionProperties(collectionId, propertyKeys)).toHuman();
-      expect(properties).to.be.deep.equal([
-        {key: 'alpha', value: ''},
-        {key: '123', value: ''},
-        {key: 'black_hole', value: ''},
-        {key: 'semi-automatic', value: ''},
-        {key: 'build.rs', value: ''},
-      ]);
-    });
-  }
-  it('Check valid names for NFT collection properties keys', async () => {
-    await testCheckValidNames('NFT');
+  itSub.ifWithPallets('Check valid names for ReFungible collection properties keys', [Pallets.ReFungible], async ({helper}) => {
+    await testCheckValidNames(await helper.rft.mintCollection(alice));
   });
-  it('Check valid names for ReFungible collection properties keys', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testCheckValidNames('ReFungible');
-  });
+  async function testChangesProperties(collection: UniqueBaseCollection) {
+    await expect(collection.setProperties(alice, [{key: 'electron', value: 'come bond'}, {key: 'black_hole', value: ''}])).to.be.fulfilled;
 
-  async function testChangesProperties(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setCollectionProperties(collection, [{key: 'electron', value: 'come bond'}, {key: 'black_hole'}]), 
-      )).to.not.be.rejected;
-  
-      // Mutate the properties
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setCollectionProperties(collection, [{key: 'electron', value: 'bonded'}, {key: 'black_hole', value: 'LIGO'}]), 
-      )).to.not.be.rejected;
-  
-      const properties = (await api.rpc.unique.collectionProperties(collection, ['electron', 'black_hole'])).toHuman();
-      expect(properties).to.be.deep.equal([
-        {key: 'electron', value: 'bonded'},
-        {key: 'black_hole', value: 'LIGO'},
-      ]);
-    });
+    // Mutate the properties
+    await expect(collection.setProperties(alice, [{key: 'black_hole', value: 'LIGO'}])).to.be.fulfilled;
+
+    const properties = await collection.getProperties();
+    expect(properties).to.include.deep.members([
+      {key: 'electron', value: 'come bond'},
+      {key: 'black_hole', value: 'LIGO'},
+    ]);
   }
-  it('Changes properties of a NFT collection', async () => {
-    await testChangesProperties({type: 'NFT'});
+
+  itSub('Changes properties of a NFT collection', async ({helper}) =>  {
+    await testChangesProperties(await helper.nft.mintCollection(alice));
   });
-  it('Changes properties of a ReFungible collection', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testChangesProperties({type: 'ReFungible'});
+  itSub.ifWithPallets('Changes properties of a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
+    await testChangesProperties(await helper.rft.mintCollection(alice));
   });
 
-  async function testDeleteProperties(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setCollectionProperties(collection, [{key: 'electron', value: 'come bond'}, {key: 'black_hole', value: 'LIGO'}]), 
-      )).to.not.be.rejected;
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.deleteCollectionProperties(collection, ['electron']), 
-      )).to.not.be.rejected;
-  
-      const properties = (await api.rpc.unique.collectionProperties(collection, ['electron', 'black_hole'])).toHuman();
-      expect(properties).to.be.deep.equal([
-        {key: 'black_hole', value: 'LIGO'},
-      ]);
-    });  
+  async function testDeleteProperties(collection: UniqueBaseCollection) {
+    await expect(collection.setProperties(alice, [{key: 'electron', value: 'come bond'}, {key: 'black_hole', value: 'LIGO'}])).to.be.fulfilled;
+
+    await expect(collection.deleteProperties(alice, ['electron'])).to.be.fulfilled;
+
+    const properties = await collection.getProperties(['black_hole', 'electron']);
+    expect(properties).to.be.deep.equal([
+      {key: 'black_hole', value: 'LIGO'},
+    ]);
   }
-  it('Deletes properties of a NFT collection', async () => {
-    await testDeleteProperties({type: 'NFT'});
+
+  itSub('Deletes properties of a NFT collection', async ({helper}) =>  {
+    await testDeleteProperties(await helper.nft.mintCollection(alice));
   });
-  it('Deletes properties of a ReFungible collection', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testDeleteProperties({type: 'ReFungible'});
+  itSub.ifWithPallets('Deletes properties of a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
+    await testDeleteProperties(await helper.rft.mintCollection(alice));
   });
 });
 
 describe('Negative Integration Test: Collection Properties', () => {
+  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([100n, 10n], donor);
     });
   });
-  
-  async function testFailsSetPropertiesIfNotOwnerOrAdmin(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
   
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setCollectionProperties(collection, [{key: 'electron', value: 'come bond'}, {key: 'black_hole', value: 'LIGO'}]), 
-      )).to.be.rejectedWith(/common\.NoPermission/);
-  
-      const properties = (await api.query.common.collectionProperties(collection)).toJSON();
-      expect(properties.map).to.be.empty;
-      expect(properties.consumedSpace).to.equal(0);
-    });  
+  async function testFailsSetPropertiesIfNotOwnerOrAdmin(collection: UniqueBaseCollection) {  
+    await expect(collection.setProperties(bob, [{key: 'electron', value: 'come bond'}, {key: 'black_hole', value: 'LIGO'}]))
+      .to.be.rejectedWith(/common\.NoPermission/);
+
+    expect(await collection.getProperties()).to.be.empty;
   }
-  it('Fails to set properties in a NFT collection if not its onwer/administrator', async () => {
-    await testFailsSetPropertiesIfNotOwnerOrAdmin({type: 'NFT'});
+
+  itSub('Fails to set properties in a NFT collection if not its onwer/administrator', async ({helper}) =>  {
+    await testFailsSetPropertiesIfNotOwnerOrAdmin(await helper.nft.mintCollection(alice));
   });
-  it('Fails to set properties in a ReFungible collection if not its onwer/administrator', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testFailsSetPropertiesIfNotOwnerOrAdmin({type: 'ReFungible'});
+  itSub.ifWithPallets('Fails to set properties in a ReFungible collection if not its onwer/administrator', [Pallets.ReFungible], async ({helper}) => {
+    await testFailsSetPropertiesIfNotOwnerOrAdmin(await helper.rft.mintCollection(alice));
   });
   
-  async function testFailsSetPropertiesThatExeedLimits(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-      const spaceLimit = (await api.query.common.collectionProperties(collection)).toJSON().spaceLimit as number; 
+  async function testFailsSetPropertiesThatExeedLimits(collection: UniqueBaseCollection) {
+    const spaceLimit = (await (collection.helper!.api! as any).query.common.collectionProperties(collection.collectionId)).spaceLimit.toNumber();
   
-      // Mute the general tx parsing error, too many bytes to process
-      {
-        console.error = () => {};
-        await expect(executeTransaction(
-          api, 
-          alice, 
-          api.tx.unique.setCollectionProperties(collection, [{key: 'electron', value: 'low high '.repeat(Math.ceil(spaceLimit! / 9))}]), 
-        )).to.be.rejected;
-      }
-  
-      let properties = (await api.rpc.unique.collectionProperties(collection, ['electron'])).toJSON();
-      expect(properties).to.be.empty;
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setCollectionProperties(collection, [
-          {key: 'electron', value: 'low high '.repeat(Math.ceil(spaceLimit! / 18))}, 
-          {key: 'black_hole', value: '0'.repeat(Math.ceil(spaceLimit! / 2))}, 
-        ]), 
-      )).to.be.rejectedWith(/common\.NoSpaceForProperty/);
-  
-      properties = (await api.rpc.unique.collectionProperties(collection, ['electron', 'black hole'])).toJSON();
-      expect(properties).to.be.empty;
-    });  
+    // Mute the general tx parsing error, too many bytes to process
+    {
+      console.error = () => {};
+      await expect(collection.setProperties(alice, [
+        {key: 'electron', value: 'low high '.repeat(Math.ceil(spaceLimit! / 9))},
+      ])).to.be.rejected;
+    }
+
+    expect(await collection.getProperties(['electron'])).to.be.empty;
+
+    await expect(collection.setProperties(alice, [
+      {key: 'electron', value: 'low high '.repeat(Math.ceil(spaceLimit! / 18))}, 
+      {key: 'black_hole', value: '0'.repeat(Math.ceil(spaceLimit! / 2))}, 
+    ])).to.be.rejectedWith(/common\.NoSpaceForProperty/);
+
+    expect(await collection.getProperties(['electron', 'black_hole'])).to.be.empty;
   }
-  it('Fails to set properties that exceed the limits (NFT)', async () => {
-    await testFailsSetPropertiesThatExeedLimits({type: 'NFT'});
+
+  itSub('Fails to set properties that exceed the limits (NFT)', async ({helper}) =>  {
+    await testFailsSetPropertiesThatExeedLimits(await helper.nft.mintCollection(alice));
   });
-  it('Fails to set properties that exceed the limits (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testFailsSetPropertiesThatExeedLimits({type: 'ReFungible'});
+  itSub.ifWithPallets('Fails to set properties that exceed the limits (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    await testFailsSetPropertiesThatExeedLimits(await helper.rft.mintCollection(alice));
   });
   
-  async function testFailsSetMorePropertiesThanAllowed(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-  
-      const propertiesToBeSet = [];
-      for (let i = 0; i < 65; i++) {
-        propertiesToBeSet.push({
-          key: 'electron_' + i,
-          value: Math.random() > 0.5 ? 'high' : 'low',
-        });
-      }
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setCollectionProperties(collection, propertiesToBeSet), 
-      )).to.be.rejectedWith(/common\.PropertyLimitReached/);
-  
-      const properties = (await api.query.common.collectionProperties(collection)).toJSON();
-      expect(properties.map).to.be.empty;
-      expect(properties.consumedSpace).to.equal(0);
-    });  
+  async function testFailsSetMorePropertiesThanAllowed(collection: UniqueBaseCollection) {
+    const propertiesToBeSet = [];
+    for (let i = 0; i < 65; i++) {
+      propertiesToBeSet.push({
+        key: 'electron_' + i,
+        value: Math.random() > 0.5 ? 'high' : 'low',
+      });
+    }
+
+    await expect(collection.setProperties(alice, propertiesToBeSet)).
+      to.be.rejectedWith(/common\.PropertyLimitReached/);
+
+    expect(await collection.getProperties()).to.be.empty;
   }
-  it('Fails to set more properties than it is allowed (NFT)', async () => {
-    await testFailsSetMorePropertiesThanAllowed({type: 'NFT'});
+
+  itSub('Fails to set more properties than it is allowed (NFT)', async ({helper}) =>  {
+    await testFailsSetMorePropertiesThanAllowed(await helper.nft.mintCollection(alice));
   });
-  it('Fails to set more properties than it is allowed (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testFailsSetMorePropertiesThanAllowed({type: 'ReFungible'});
+  itSub.ifWithPallets('Fails to set more properties than it is allowed (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    await testFailsSetMorePropertiesThanAllowed(await helper.rft.mintCollection(alice));
   });
-  
-  async function testFailsSetPropertiesWithInvalidNames(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-  
-      const invalidProperties = [
-        [{key: 'electron', value: 'negative'}, {key: 'string theory', value: 'understandable'}],
-        [{key: 'Mr/Sandman', value: 'Bring me a gene'}],
-        [{key: 'déjà vu', value: 'hmm...'}],
-      ];
   
-      for (let i = 0; i < invalidProperties.length; i++) {
-        await expect(executeTransaction(
-          api, 
-          alice, 
-          api.tx.unique.setCollectionProperties(collection, invalidProperties[i]), 
-        ), `on rejecting the new badly-named property #${i}`).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
-      }
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setCollectionProperties(collection, [{key: '', value: 'nothing must not exist'}]), 
-      ), 'on rejecting an unnamed property').to.be.rejectedWith(/common\.EmptyPropertyKey/);
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setCollectionProperties(collection, [
-          {key: 'CRISPR-Cas9', value: 'rewriting nature!'},
-        ]), 
-      ), 'on setting the correctly-but-still-badly-named property').to.not.be.rejected;
-  
-      const keys = invalidProperties.flatMap(propertySet => propertySet.map(property => property.key)).concat('CRISPR-Cas9').concat('');
-  
-      const properties = (await api.rpc.unique.collectionProperties(collection, keys)).toHuman();
-      expect(properties).to.be.deep.equal([
-        {key: 'CRISPR-Cas9', value: 'rewriting nature!'},
-      ]);
-  
-      for (let i = 0; i < invalidProperties.length; i++) {
-        await expect(executeTransaction(
-          api, 
-          alice, 
-          api.tx.unique.deleteCollectionProperties(collection, invalidProperties[i].map(propertySet => propertySet.key)), 
-        ), `on trying to delete the non-existent badly-named property #${i}`).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
-      }
-    });
+  async function testFailsSetPropertiesWithInvalidNames(collection: UniqueBaseCollection) {
+    const invalidProperties = [
+      [{key: 'electron', value: 'negative'}, {key: 'string theory', value: 'understandable'}],
+      [{key: 'Mr/Sandman', value: 'Bring me a gene'}],
+      [{key: 'déjà vu', value: 'hmm...'}],
+    ];
+
+    for (let i = 0; i < invalidProperties.length; i++) {
+      await expect(
+        collection.setProperties(alice, invalidProperties[i]), 
+        `on rejecting the new badly-named property #${i}`,
+      ).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
+    }
+
+    await expect(
+      collection.setProperties(alice, [{key: '', value: 'nothing must not exist'}]), 
+      'on rejecting an unnamed property',
+    ).to.be.rejectedWith(/common\.EmptyPropertyKey/);
+
+    await expect(
+      collection.setProperties(alice, [{key: 'CRISPR-Cas9', value: 'rewriting nature!'}]), 
+      'on setting the correctly-but-still-badly-named property',
+    ).to.be.fulfilled;
+
+    const keys = invalidProperties.flatMap(propertySet => propertySet.map(property => property.key)).concat('CRISPR-Cas9').concat('');
+
+    const properties = await collection.getProperties(keys);
+    expect(properties).to.be.deep.equal([
+      {key: 'CRISPR-Cas9', value: 'rewriting nature!'},
+    ]);
+
+    for (let i = 0; i < invalidProperties.length; i++) {
+      await expect(
+        collection.deleteProperties(alice, invalidProperties[i].map(propertySet => propertySet.key)), 
+        `on trying to delete the non-existent badly-named property #${i}`,
+      ).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
+    }
   }
-  it('Fails to set properties with invalid names (NFT)', async () => {
-    await testFailsSetPropertiesWithInvalidNames({type: 'NFT'});
+
+  itSub('Fails to set properties with invalid names (NFT)', async ({helper}) =>  {
+    await testFailsSetPropertiesWithInvalidNames(await helper.nft.mintCollection(alice));
   });
-  it('Fails to set properties with invalid names (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testFailsSetPropertiesWithInvalidNames({type: 'ReFungible'});
+  itSub.ifWithPallets('Fails to set properties with invalid names (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    await testFailsSetPropertiesWithInvalidNames(await helper.rft.mintCollection(alice));
   });
 });
 
 // ---------- ACCESS RIGHTS
 
 describe('Integration Test: Access Rights to Token Properties', () => {
+  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([100n, 10n], donor);
     });
   });
   
-  it('Reads access rights to properties of a collection', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess();
-      const propertyRights = (await api.query.common.collectionPropertyPermissions(collection)).toJSON();
-      expect(propertyRights).to.be.empty;
-    });
+  itSub('Reads access rights to properties of a collection', async ({helper}) =>  {
+    const collection = await helper.nft.mintCollection(alice);
+    const propertyRights = (await helper.api!.query.common.collectionPropertyPermissions(collection.collectionId)).toJSON();
+    expect(propertyRights).to.be.empty;
   });
   
-  async function testSetsAccessRightsToProperties(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true}}]), 
-      )).to.not.be.rejected;
-  
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'mindgame', permission: {collectionAdmin: true, tokenOwner: false}}]), 
-      )).to.not.be.rejected;
-  
-      const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery', 'mindgame'])).toHuman();
-      expect(propertyRights).to.be.deep.equal([
-        {key: 'skullduggery', permission: {'mutable': true, 'collectionAdmin': false, 'tokenOwner': false}},
-        {key: 'mindgame', permission: {'mutable': false, 'collectionAdmin': true, 'tokenOwner': false}},
-      ]);
-    });  
+  async function testSetsAccessRightsToProperties(collection: UniqueNFTCollection | UniqueRFTCollection) {  
+    await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: true}}]))
+      .to.be.fulfilled;
+
+    await collection.addAdmin(alice, {Substrate: bob.address});
+
+    await expect(collection.setTokenPropertyPermissions(bob, [{key: 'mindgame', permission: {collectionAdmin: true, tokenOwner: false}}]))
+      .to.be.fulfilled;
+
+    const propertyRights = await collection.getPropertyPermissions(['skullduggery', 'mindgame']);
+    expect(propertyRights).to.include.deep.members([
+      {key: 'skullduggery', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}},
+      {key: 'mindgame', permission: {mutable: false, collectionAdmin: true, tokenOwner: false}},
+    ]);
   }
-  it('Sets access rights to properties of a collection (NFT)', async () => {
-    await testSetsAccessRightsToProperties({type: 'NFT'});
+
+  itSub('Sets access rights to properties of a collection (NFT)', async ({helper}) =>  {
+    await testSetsAccessRightsToProperties(await helper.nft.mintCollection(alice));
   });
-  it('Sets access rights to properties of a collection (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testSetsAccessRightsToProperties({type: 'ReFungible'});
+  itSub.ifWithPallets('Sets access rights to properties of a collection (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    await testSetsAccessRightsToProperties(await helper.rft.mintCollection(alice));
   });
-  
-  async function testChangesAccessRightsToProperty(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
   
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, collectionAdmin: true}}]), 
-      )).to.not.be.rejected;
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]), 
-      )).to.not.be.rejected;
-  
-      const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toHuman();
-      expect(propertyRights).to.be.deep.equal([
-        {key: 'skullduggery', permission: {'mutable': false, 'collectionAdmin': false, 'tokenOwner': true}},
-      ]);
-    });
+  async function testChangesAccessRightsToProperty(collection: UniqueNFTCollection | UniqueRFTCollection) {
+    await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: true, collectionAdmin: true}}]))
+      .to.be.fulfilled;
+
+    await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]))
+      .to.be.fulfilled;
+
+    const propertyRights = await collection.getPropertyPermissions();
+    expect(propertyRights).to.be.deep.equal([
+      {key: 'skullduggery', permission: {'mutable': false, 'collectionAdmin': false, 'tokenOwner': true}},
+    ]);
   }
-  it('Changes access rights to properties of a NFT collection', async () => {
-    await testChangesAccessRightsToProperty({type: 'NFT'});
+
+  itSub('Changes access rights to properties of a NFT collection', async ({helper}) =>  {
+    await testChangesAccessRightsToProperty(await helper.nft.mintCollection(alice));
   });
-  it('Changes access rights to properties of a ReFungible collection', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testChangesAccessRightsToProperty({type: 'ReFungible'});
+  itSub.ifWithPallets('Changes access rights to properties of a ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
+    await testChangesAccessRightsToProperty(await helper.rft.mintCollection(alice));
   });
 });
 
 describe('Negative Integration Test: Access Rights to Token Properties', () => {
+  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([50n, 10n], donor);
     });
   });
 
-  async function testPreventsFromSettingAccessRightsNotAdminOrOwner(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-  
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, tokenOwner: true}}]), 
-      )).to.be.rejectedWith(/common\.NoPermission/);
-  
-      const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toJSON();
-      expect(propertyRights).to.be.empty;
-    });
+  async function testPreventsFromSettingAccessRightsNotAdminOrOwner(collection: UniqueNFTCollection | UniqueRFTCollection) {
+    await expect(collection.setTokenPropertyPermissions(bob, [{key: 'skullduggery', permission: {mutable: true, tokenOwner: true}}]))
+      .to.be.rejectedWith(/common\.NoPermission/);
+
+    const propertyRights = await collection.getPropertyPermissions(['skullduggery']);
+    expect(propertyRights).to.be.empty;
   }
-  it('Prevents from setting access rights to properties of a NFT collection if not an onwer/admin', async () => {
-    await testPreventsFromSettingAccessRightsNotAdminOrOwner({type: 'NFT'});
+
+  itSub('Prevents from setting access rights to properties of a NFT collection if not an onwer/admin', async ({helper}) =>  {
+    await testPreventsFromSettingAccessRightsNotAdminOrOwner(await helper.nft.mintCollection(alice));
   });
-  it('Prevents from setting access rights to properties of a ReFungible collection if not an onwer/admin', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testPreventsFromSettingAccessRightsNotAdminOrOwner({type: 'ReFungible'});
+  itSub.ifWithPallets('Prevents from setting access rights to properties of a ReFungible collection if not an onwer/admin', [Pallets.ReFungible], async ({helper}) => {
+    await testPreventsFromSettingAccessRightsNotAdminOrOwner(await helper.rft.mintCollection(alice));
   });
 
-  async function testPreventFromAddingTooManyPossibleProperties(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-  
-      const constitution = [];
-      for (let i = 0; i < 65; i++) {
-        constitution.push({
-          key: 'property_' + i,
-          permission: Math.random() > 0.5 ? {mutable: true, collectionAdmin: true, tokenOwner: true} : {},
-        });
-      }
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, constitution), 
-      )).to.be.rejectedWith(/common\.PropertyLimitReached/);
-  
-      const propertyRights = (await api.query.common.collectionPropertyPermissions(collection)).toJSON();
-      expect(propertyRights).to.be.empty;
-    });  
+  async function testPreventFromAddingTooManyPossibleProperties(collection: UniqueNFTCollection | UniqueRFTCollection) {  
+    const constitution = [];
+    for (let i = 0; i < 65; i++) {
+      constitution.push({
+        key: 'property_' + i,
+        permission: Math.random() > 0.5 ? {mutable: true, collectionAdmin: true, tokenOwner: true} : {},
+      });
+    }
+
+    await expect(collection.setTokenPropertyPermissions(alice, constitution))
+      .to.be.rejectedWith(/common\.PropertyLimitReached/);
+
+    const propertyRights = await collection.getPropertyPermissions();
+    expect(propertyRights).to.be.empty;
   }
-  it('Prevents from adding too many possible properties (NFT)', async () => {
-    await testPreventFromAddingTooManyPossibleProperties({type: 'NFT'});
+
+  itSub('Prevents from adding too many possible properties (NFT)', async ({helper}) =>  {
+    await testPreventFromAddingTooManyPossibleProperties(await helper.nft.mintCollection(alice));
   });
-  it('Prevents from adding too many possible properties (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testPreventFromAddingTooManyPossibleProperties({type: 'ReFungible'});
+  itSub.ifWithPallets('Prevents from adding too many possible properties (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    await testPreventFromAddingTooManyPossibleProperties(await helper.rft.mintCollection(alice));
   });
 
-  async function testPreventAccessRightsModifiedIfConstant(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]), 
-      )).to.not.be.rejected;
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {}}]), 
-      )).to.be.rejectedWith(/common\.NoPermission/);
-  
-      const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toHuman();
-      expect(propertyRights).to.deep.equal([
-        {key: 'skullduggery', permission: {'mutable': false, 'collectionAdmin': false, 'tokenOwner': true}},
-      ]);
-    });  
+  async function testPreventAccessRightsModifiedIfConstant(collection: UniqueNFTCollection | UniqueRFTCollection) {
+    await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]))
+      .to.be.fulfilled;
+
+    await expect(collection.setTokenPropertyPermissions(alice, [{key: 'skullduggery', permission: {collectionAdmin: true}}]))
+      .to.be.rejectedWith(/common\.NoPermission/);
+
+    const propertyRights = await collection.getPropertyPermissions(['skullduggery']);
+    expect(propertyRights).to.deep.equal([
+      {key: 'skullduggery', permission: {'mutable': false, 'collectionAdmin': false, 'tokenOwner': true}},
+    ]);
   }
-  it('Prevents access rights to be modified if constant (NFT)', async () => {
-    await testPreventAccessRightsModifiedIfConstant({type: 'NFT'});
+
+  itSub('Prevents access rights to be modified if constant (NFT)', async ({helper}) =>  {
+    await testPreventAccessRightsModifiedIfConstant(await helper.nft.mintCollection(alice));
   });
-  it('Prevents access rights to be modified if constant (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testPreventAccessRightsModifiedIfConstant({type: 'ReFungible'});
+  itSub.ifWithPallets('Prevents access rights to be modified if constant (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    await testPreventAccessRightsModifiedIfConstant(await helper.rft.mintCollection(alice));
   });
 
-  async function testPreventsAddingPropertiesWithInvalidNames(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-  
-      const invalidProperties = [
-        [{key: 'skullduggery', permission: {tokenOwner: true}}, {key: 'im possible', permission: {collectionAdmin: true}}],
-        [{key: 'G#4', permission: {tokenOwner: true}}],
-        [{key: 'HÆMILTON', permission: {mutable: false, collectionAdmin: true, tokenOwner: true}}],
-      ];
-  
-      for (let i = 0; i < invalidProperties.length; i++) {
-        await expect(executeTransaction(
-          api, 
-          alice, 
-          api.tx.unique.setTokenPropertyPermissions(collection, invalidProperties[i]), 
-        ), `on setting the new badly-named property #${i}`).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
-      }
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: '', permission: {}}]), 
-      ), 'on rejecting an unnamed property').to.be.rejectedWith(/common\.EmptyPropertyKey/);
-  
-      const correctKey = '--0x03116e387820CA05'; // PolkadotJS would parse this as an already encoded hex-string
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [
-          {key: correctKey, permission: {collectionAdmin: true}},
-        ]), 
-      ), 'on setting the correctly-but-still-badly-named property').to.not.be.rejected;
-  
-      const keys = invalidProperties.flatMap(propertySet => propertySet.map(property => property.key)).concat(correctKey).concat('');
-  
-      const propertyRights = (await api.rpc.unique.propertyPermissions(collection, keys)).toHuman();
-      expect(propertyRights).to.be.deep.equal([
-        {key: correctKey, permission: {mutable: false, collectionAdmin: true, tokenOwner: false}},
-      ]);
-    });
+  async function testPreventsAddingPropertiesWithInvalidNames(collection: UniqueNFTCollection | UniqueRFTCollection) {
+    const invalidProperties = [
+      [{key: 'skullduggery', permission: {tokenOwner: true}}, {key: 'im possible', permission: {collectionAdmin: true}}],
+      [{key: 'G#4', permission: {tokenOwner: true}}],
+      [{key: 'HÆMILTON', permission: {mutable: false, collectionAdmin: true, tokenOwner: true}}],
+    ];
+
+    for (let i = 0; i < invalidProperties.length; i++) {
+      await expect(
+        collection.setTokenPropertyPermissions(alice, invalidProperties[i]), 
+        `on setting the new badly-named property #${i}`,
+      ).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
+    }
+
+    await expect(
+      collection.setTokenPropertyPermissions(alice, [{key: '', permission: {}}]), 
+      'on rejecting an unnamed property',
+    ).to.be.rejectedWith(/common\.EmptyPropertyKey/);
+
+    const correctKey = '--0x03116e387820CA05'; // PolkadotJS would parse this as an already encoded hex-string
+    await expect(
+      collection.setTokenPropertyPermissions(alice, [
+        {key: correctKey, permission: {collectionAdmin: true}},
+      ]), 
+      'on setting the correctly-but-still-badly-named property',
+    ).to.be.fulfilled;
+
+    const keys = invalidProperties.flatMap(propertySet => propertySet.map(property => property.key)).concat(correctKey).concat('');
+
+    const propertyRights = await collection.getPropertyPermissions(keys);
+    expect(propertyRights).to.be.deep.equal([
+      {key: correctKey, permission: {mutable: false, collectionAdmin: true, tokenOwner: false}},
+    ]);
   }
-  it('Prevents adding properties with invalid names (NFT)', async () => {
-    await testPreventsAddingPropertiesWithInvalidNames({type: 'NFT'});
+
+  itSub('Prevents adding properties with invalid names (NFT)', async ({helper}) =>  {
+    await testPreventsAddingPropertiesWithInvalidNames(await helper.nft.mintCollection(alice));
   });
-  it('Prevents adding properties with invalid names (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testPreventsAddingPropertiesWithInvalidNames({type: 'ReFungible'});
+  itSub.ifWithPallets('Prevents adding properties with invalid names (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    await testPreventsAddingPropertiesWithInvalidNames(await helper.rft.mintCollection(alice));
   });
 });
 
 // ---------- TOKEN PROPERTIES
 
 describe('Integration Test: Token Properties', () => {
+  let alice: IKeyringPair; // collection owner
+  let bob: IKeyringPair; // collection admin
+  let charlie: IKeyringPair; // token owner
+
   let permissions: {permission: any, signers: IKeyringPair[]}[];
 
   before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice'); // collection owner
-      bob = privateKeyWrapper('//Bob'); // collection admin
-      charlie = privateKeyWrapper('//Charlie'); // token owner
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
+    });
 
-      permissions = [
-        {permission: {mutable: true, collectionAdmin: true}, signers: [alice, bob]},
-        {permission: {mutable: false, collectionAdmin: true}, signers: [alice, bob]},
-        {permission: {mutable: true, tokenOwner: true}, signers: [charlie]},
-        {permission: {mutable: false, tokenOwner: true}, signers: [charlie]},
-        {permission: {mutable: true, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie]},
-        {permission: {mutable: false, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie]},
-      ];
-    });
+    // todo:playgrounds probably separate these tests later
+    permissions = [
+      {permission: {mutable: true, collectionAdmin: true}, signers: [alice, bob]},
+      {permission: {mutable: false, collectionAdmin: true}, signers: [alice, bob]},
+      {permission: {mutable: true, tokenOwner: true}, signers: [charlie]},
+      {permission: {mutable: false, tokenOwner: true}, signers: [charlie]},
+      {permission: {mutable: true, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie]},
+      {permission: {mutable: false, collectionAdmin: true, tokenOwner: true}, signers: [alice, bob, charlie]},
+    ];
   });
   
-  async function testReadsYetEmptyProperties(mode: CollectionMode) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-      const token = await createItemExpectSuccess(alice, collection, mode.type);
-  
-      const properties = (await api.query.nonfungible.tokenProperties(collection, token)).toJSON();
-      expect(properties.map).to.be.empty;
-      expect(properties.consumedSpace).to.be.equal(0);
-  
-      const tokenData = (await api.rpc.unique.tokenData(collection, token, ['anything'])).toJSON().properties;
-      expect(tokenData).to.be.empty;
-    });
+  async function testReadsYetEmptyProperties(token: UniqueNFToken | UniqueRFToken) {
+    const properties = await token.getProperties();
+    expect(properties).to.be.empty;
+
+    const tokenData = await token.getData();
+    expect(tokenData!.properties).to.be.empty;
   }
-  it('Reads yet empty properties of a token (NFT)', async () => {
-    await testReadsYetEmptyProperties({type: 'NFT'});
-  });
-  it('Reads yet empty properties of a token (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testReadsYetEmptyProperties({type: 'ReFungible'});
+  itSub('Reads yet empty properties of a token (NFT)', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice);
+    const token = await collection.mintToken(alice);
+    await testReadsYetEmptyProperties(token);
   });
 
-  async function testAssignPropertiesAccordingToPermissions(mode: CollectionMode, pieces: number) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-      const token = await createItemExpectSuccess(alice, collection, mode.type);
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-      await transferExpectSuccess(collection, token, alice, charlie, pieces, mode.type);
+  itSub.ifWithPallets('Reads yet empty properties of a token (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice);
+    const token = await collection.mintToken(alice);
+    await testReadsYetEmptyProperties(token);
+  });
 
-      const propertyKeys: string[] = [];
-      let i = 0;
-      for (const permission of permissions) {
-        for (const signer of permission.signers) {
-          const key = i + '_' + signer.address;
-          propertyKeys.push(key);
+  async function testAssignPropertiesAccordingToPermissions(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+    await token.collection.addAdmin(alice, {Substrate: bob.address});
+    await token.transfer(alice, {Substrate: charlie.address}, pieces);
 
-          await expect(executeTransaction(
-            api, 
-            alice, 
-            api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 
-          ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
+    const propertyKeys: string[] = [];
+    let i = 0;
+    for (const permission of permissions) {
+      i++;
+      let j = 0;
+      for (const signer of permission.signers) {
+        j++;
+        const key = i + '_' + signer.address;
+        propertyKeys.push(key);
 
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.setTokenProperties(collection, token, [{key: key, value: 'Serotonin increase'}]), 
-          ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;
-        }
+        await expect(
+          token.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]), 
+          `on setting permission #${i} by alice`,
+        ).to.be.fulfilled;
 
-        i++;
+        await expect(
+          token.setProperties(signer, [{key: key, value: 'Serotonin increase'}]), 
+          `on adding property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
       }
+    }
 
-      const properties = (await api.rpc.unique.tokenProperties(collection, token, propertyKeys)).toHuman() as any[];
-      const tokensData = (await api.rpc.unique.tokenData(collection, token, propertyKeys)).toHuman().properties as any[];
-      for (let i = 0; i < properties.length; i++) {
-        expect(properties[i].value).to.be.equal('Serotonin increase');
-        expect(tokensData[i].value).to.be.equal('Serotonin increase');
-      }
-    });
+    const properties = await token.getProperties(propertyKeys);
+    const tokenData = await token.getData();
+    for (let i = 0; i < properties.length; i++) {
+      expect(properties[i].value).to.be.equal('Serotonin increase');
+      expect(tokenData!.properties[i].value).to.be.equal('Serotonin increase');
+    }
   }
-  it('Assigns properties to a token according to permissions (NFT)', async () => {
-    await testAssignPropertiesAccordingToPermissions({type: 'NFT'}, 1);
+
+  itSub('Assigns properties to a token according to permissions (NFT)', async ({helper}) =>  {
+    const collection = await helper.nft.mintCollection(alice);
+    const token = await collection.mintToken(alice);
+    await testAssignPropertiesAccordingToPermissions(token, 1n);
   });
-  it('Assigns properties to a token according to permissions (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testAssignPropertiesAccordingToPermissions({type: 'ReFungible'}, 100);
+  itSub.ifWithPallets('Assigns properties to a token according to permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice);
+    const token = await collection.mintToken(alice, 100n);
+    await testAssignPropertiesAccordingToPermissions(token, 100n);
   });
 
-  async function testChangesPropertiesAccordingPermission(mode: CollectionMode, pieces: number) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-      const token = await createItemExpectSuccess(alice, collection, mode.type);
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-      await transferExpectSuccess(collection, token, alice, charlie, pieces, mode.type);
+  async function testChangesPropertiesAccordingPermission(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+    await token.collection.addAdmin(alice, {Substrate: bob.address});
+    await token.transfer(alice, {Substrate: charlie.address}, pieces);
+
+    const propertyKeys: string[] = [];
+    let i = 0;
+    for (const permission of permissions) {
+      i++;
+      if (!permission.permission.mutable) continue;
+      
+      let j = 0;
+      for (const signer of permission.signers) {
+        j++;
+        const key = i + '_' + signer.address;
+        propertyKeys.push(key);
+
+        await expect(
+          token.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]), 
+          `on setting permission #${i} by alice`,
+        ).to.be.fulfilled;
+
+        await expect(
+          token.setProperties(signer, [{key, value: 'Serotonin increase'}]), 
+          `on adding property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
 
-      const propertyKeys: string[] = [];
-      let i = 0;
-      for (const permission of permissions) {
-        if (!permission.permission.mutable) continue;
-        
-        for (const signer of permission.signers) {
-          const key = i + '_' + signer.address;
-          propertyKeys.push(key);
-  
-          await expect(executeTransaction(
-            api, 
-            alice, 
-            api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 
-          ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
-  
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.setTokenProperties(collection, token, [{key: key, value: 'Serotonin increase'}]), 
-          ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;
-  
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.setTokenProperties(collection, token, [{key: key, value: 'Serotonin stable'}]), 
-          ), `on changing property ${i} by ${signer.address}`).to.not.be.rejected;
-        }
-  
-        i++;
+        await expect(
+          token.setProperties(signer, [{key, value: 'Serotonin stable'}]), 
+          `on changing property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
       }
-  
-      const properties = (await api.rpc.unique.tokenProperties(collection, token, propertyKeys)).toHuman() as any[];
-      const tokensData = (await api.rpc.unique.tokenData(collection, token, propertyKeys)).toHuman().properties as any[];
-      for (let i = 0; i < properties.length; i++) {
-        expect(properties[i].value).to.be.equal('Serotonin stable');
-        expect(tokensData[i].value).to.be.equal('Serotonin stable');
-      }
-    });
+    }
+
+    const properties = await token.getProperties(propertyKeys);
+    const tokenData = await token.getData();
+    for (let i = 0; i < properties.length; i++) {
+      expect(properties[i].value).to.be.equal('Serotonin stable');
+      expect(tokenData!.properties[i].value).to.be.equal('Serotonin stable');
+    }
   }
-  it('Changes properties of a token according to permissions (NFT)', async () => {
-    await testChangesPropertiesAccordingPermission({type: 'NFT'}, 1);
+
+  itSub('Changes properties of a token according to permissions (NFT)', async ({helper}) =>  {
+    const collection = await helper.nft.mintCollection(alice);
+    const token = await collection.mintToken(alice);
+    await testChangesPropertiesAccordingPermission(token, 1n);
   });
-  it('Changes properties of a token according to permissions (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testChangesPropertiesAccordingPermission({type: 'ReFungible'}, 100);
+  itSub.ifWithPallets('Changes properties of a token according to permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice);
+    const token = await collection.mintToken(alice, 100n);
+    await testChangesPropertiesAccordingPermission(token, 100n);
   });
 
-  async function testDeletePropertiesAccordingPermission(mode: CollectionMode, pieces: number) {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: mode});
-      const token = await createItemExpectSuccess(alice, collection, mode.type);
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-      await transferExpectSuccess(collection, token, alice, charlie, pieces, mode.type);
+  async function testDeletePropertiesAccordingPermission(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+    await token.collection.addAdmin(alice, {Substrate: bob.address});
+    await token.transfer(alice, {Substrate: charlie.address}, pieces);
+
+    const propertyKeys: string[] = [];
+    let i = 0;
+
+    for (const permission of permissions) {
+      i++;
+      if (!permission.permission.mutable) continue;
+      
+      let j = 0;
+      for (const signer of permission.signers) {
+        j++;
+        const key = i + '_' + signer.address;
+        propertyKeys.push(key);
+
+        await expect(
+          token.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]), 
+          `on setting permission #${i} by alice`,
+        ).to.be.fulfilled;
 
-      const propertyKeys: string[] = [];
-      let i = 0;
-  
-      for (const permission of permissions) {
-        if (!permission.permission.mutable) continue;
-        
-        for (const signer of permission.signers) {
-          const key = i + '_' + signer.address;
-          propertyKeys.push(key);
-  
-          await expect(executeTransaction(
-            api, 
-            alice, 
-            api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 
-          ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
-  
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.setTokenProperties(collection, token, [{key: key, value: 'Serotonin increase'}]), 
-          ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;
-  
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.deleteTokenProperties(collection, token, [key]), 
-          ), `on deleting property ${i} by ${signer.address}`).to.not.be.rejected;
-        }
-        
-        i++;
+        await expect(
+          token.setProperties(signer, [{key, value: 'Serotonin increase'}]), 
+          `on adding property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
+
+        await expect(
+          token.deleteProperties(signer, [key]), 
+          `on deleting property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
       }
-  
-      const properties = (await api.rpc.unique.tokenProperties(collection, token, propertyKeys)).toJSON() as any[];
-      expect(properties).to.be.empty;
-      const tokensData = (await api.rpc.unique.tokenData(collection, token, propertyKeys)).toJSON().properties as any[];
-      expect(tokensData).to.be.empty;
-      expect((await api.query.nonfungible.tokenProperties(collection, token)).toJSON().consumedSpace).to.be.equal(0);
-    });
+    }
+
+    expect(await token.getProperties(propertyKeys)).to.be.empty;
+    expect((await token.getData())!.properties).to.be.empty;
   }
-  it('Deletes properties of a token according to permissions (NFT)', async () => {
-    await testDeletePropertiesAccordingPermission({type: 'NFT'}, 1);
+  
+  itSub('Deletes properties of a token according to permissions (NFT)', async ({helper}) =>  {
+    const collection = await helper.nft.mintCollection(alice);
+    const token = await collection.mintToken(alice);
+    await testDeletePropertiesAccordingPermission(token, 1n);
   });
-  it('Deletes properties of a token according to permissions (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testDeletePropertiesAccordingPermission({type: 'ReFungible'}, 100);
+  itSub.ifWithPallets('Deletes properties of a token according to permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice);
+    const token = await collection.mintToken(alice, 100n);
+    await testDeletePropertiesAccordingPermission(token, 100n);
   });
 
-  it('Assigns properties to a nested token according to permissions', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const token = await createItemExpectSuccess(alice, collection, 'NFT');
-      const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, token)});
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-      await transferExpectSuccess(collection, token, alice, charlie);
+  itSub('Assigns properties to a nested token according to permissions', async ({helper}) =>  {
+    const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const collectionB = await helper.nft.mintCollection(alice);
+    const targetToken = await collectionA.mintToken(alice);
+    const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAccount());
 
-      const propertyKeys: string[] = [];
-      let i = 0;
-      for (const permission of permissions) {
-        for (const signer of permission.signers) {
-          const key = i + '_' + signer.address;
-          propertyKeys.push(key);
+    await collectionB.addAdmin(alice, {Substrate: bob.address});
+    await targetToken.transfer(alice, {Substrate: charlie.address});
 
-          await expect(executeTransaction(
-            api, 
-            alice, 
-            api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 
-          ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
+    const propertyKeys: string[] = [];
+    let i = 0;
+    for (const permission of permissions) {
+      i++;
+      let j = 0;
+      for (const signer of permission.signers) {
+        j++;
+        const key = i + '_' + signer.address;
+        propertyKeys.push(key);
+        
+        await expect(
+          nestedToken.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]), 
+          `on setting permission #${i} by alice`,
+        ).to.be.fulfilled;
 
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin increase'}]), 
-          ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;
-        }
-
-        i++;
+        await expect(
+          nestedToken.setProperties(signer, [{key, value: 'Serotonin increase'}]), 
+          `on adding property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
       }
 
-      const properties = (await api.rpc.unique.tokenProperties(collection, nestedToken, propertyKeys)).toHuman() as any[];
-      const tokensData = (await api.rpc.unique.tokenData(collection, nestedToken, propertyKeys)).toHuman().properties as any[];
-      for (let i = 0; i < properties.length; i++) {
-        expect(properties[i].value).to.be.equal('Serotonin increase');
-        expect(tokensData[i].value).to.be.equal('Serotonin increase');
-      }
-    });
+    }
+
+    const properties = await nestedToken.getProperties(propertyKeys);
+    const tokenData = await nestedToken.getData();
+    for (let i = 0; i < properties.length; i++) {
+      expect(properties[i].value).to.be.equal('Serotonin increase');
+      expect(tokenData!.properties[i].value).to.be.equal('Serotonin increase');
+    }
+    expect(await targetToken.getProperties()).to.be.empty;
   });
 
-  it('Changes properties of a nested token according to permissions', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const token = await createItemExpectSuccess(alice, collection, 'NFT');
-      const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, token)});
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-      await transferExpectSuccess(collection, token, alice, charlie);
+  itSub('Changes properties of a nested token according to permissions', async ({helper}) =>  {
+    const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const collectionB = await helper.nft.mintCollection(alice);
+    const targetToken = await collectionA.mintToken(alice);
+    const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAccount());
 
-      const propertyKeys: string[] = [];
-      let i = 0;
-      for (const permission of permissions) {
-        if (!permission.permission.mutable) continue;
-        
-        for (const signer of permission.signers) {
-          const key = i + '_' + signer.address;
-          propertyKeys.push(key);
+    await collectionB.addAdmin(alice, {Substrate: bob.address});
+    await targetToken.transfer(alice, {Substrate: charlie.address});
 
-          await expect(executeTransaction(
-            api, 
-            alice, 
-            api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 
-          ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
+    const propertyKeys: string[] = [];
+    let i = 0;
+    for (const permission of permissions) {
+      i++;
+      if (!permission.permission.mutable) continue;
+      
+      let j = 0;
+      for (const signer of permission.signers) {
+        j++;
+        const key = i + '_' + signer.address;
+        propertyKeys.push(key);
 
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin increase'}]), 
-          ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;
+        await expect(
+          nestedToken.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]), 
+          `on setting permission #${i} by alice`,
+        ).to.be.fulfilled;
 
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin stable'}]), 
-          ), `on changing property ${i} by ${signer.address}`).to.not.be.rejected;
-        }
+        await expect(
+          nestedToken.setProperties(signer, [{key, value: 'Serotonin increase'}]), 
+          `on adding property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
 
-        i++;
+        await expect(
+          nestedToken.setProperties(signer, [{key, value: 'Serotonin stable'}]), 
+          `on changing property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
       }
+    }
 
-      const properties = (await api.rpc.unique.tokenProperties(collection, nestedToken, propertyKeys)).toHuman() as any[];
-      const tokensData = (await api.rpc.unique.tokenData(collection, nestedToken, propertyKeys)).toHuman().properties as any[];
-      for (let i = 0; i < properties.length; i++) {
-        expect(properties[i].value).to.be.equal('Serotonin stable');
-        expect(tokensData[i].value).to.be.equal('Serotonin stable');
-      }
-    });
+    const properties = await nestedToken.getProperties(propertyKeys);
+    const tokenData = await nestedToken.getData();
+    for (let i = 0; i < properties.length; i++) {
+      expect(properties[i].value).to.be.equal('Serotonin stable');
+      expect(tokenData!.properties[i].value).to.be.equal('Serotonin stable');
+    }
+    expect(await targetToken.getProperties()).to.be.empty;
   });
 
-  it('Deletes properties of a nested token according to permissions', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const token = await createItemExpectSuccess(alice, collection, 'NFT');
-      const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, token)});
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-      await transferExpectSuccess(collection, token, alice, charlie);
+  itSub('Deletes properties of a nested token according to permissions', async ({helper}) =>  {
+    const collectionA = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const collectionB = await helper.nft.mintCollection(alice);
+    const targetToken = await collectionA.mintToken(alice);
+    const nestedToken = await collectionB.mintToken(alice, targetToken.nestingAccount());
 
-      const propertyKeys: string[] = [];
-      let i = 0;
+    await collectionB.addAdmin(alice, {Substrate: bob.address});
+    await targetToken.transfer(alice, {Substrate: charlie.address});
 
-      for (const permission of permissions) {
-        if (!permission.permission.mutable) continue;
-        
-        for (const signer of permission.signers) {
-          const key = i + '_' + signer.address;
-          propertyKeys.push(key);
+    const propertyKeys: string[] = [];
+    let i = 0;
+    for (const permission of permissions) {
+      i++;
+      if (!permission.permission.mutable) continue;
+      
+      let j = 0;
+      for (const signer of permission.signers) {
+        j++;
+        const key = i + '_' + signer.address;
+        propertyKeys.push(key);
 
-          await expect(executeTransaction(
-            api, 
-            alice, 
-            api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 
-          ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
+        await expect(
+          nestedToken.collection.setTokenPropertyPermissions(alice, [{key: key, permission: permission.permission}]), 
+          `on setting permission #${i} by alice`,
+        ).to.be.fulfilled;
 
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin increase'}]), 
-          ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;
+        await expect(
+          nestedToken.setProperties(signer, [{key, value: 'Serotonin increase'}]), 
+          `on adding property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
 
-          await expect(executeTransaction(
-            api, 
-            signer, 
-            api.tx.unique.deleteTokenProperties(collection, nestedToken, [key]), 
-          ), `on deleting property ${i} by ${signer.address}`).to.not.be.rejected;
-        }
-        
-        i++;
+        await expect(
+          nestedToken.deleteProperties(signer, [key]), 
+          `on deleting property #${i} by signer #${j}`,
+        ).to.be.fulfilled;
       }
+    }
 
-      const properties = (await api.rpc.unique.tokenProperties(collection, nestedToken, propertyKeys)).toJSON() as any[];
-      expect(properties).to.be.empty;
-      const tokensData = (await api.rpc.unique.tokenData(collection, nestedToken, propertyKeys)).toJSON().properties as any[];
-      expect(tokensData).to.be.empty;
-      expect((await api.query.nonfungible.tokenProperties(collection, nestedToken)).toJSON().consumedSpace).to.be.equal(0);
-    });
+    expect(await nestedToken.getProperties(propertyKeys)).to.be.empty;
+    expect((await nestedToken.getData())!.properties).to.be.empty;
+    expect(await targetToken.getProperties()).to.be.empty;
   });
 });
 
 describe('Negative Integration Test: Token Properties', () => {
-  let collection: number;
-  let token: number;
-  let originalSpace: number;
+  let alice: IKeyringPair; // collection owner
+  let bob: IKeyringPair; // collection admin
+  let charlie: IKeyringPair; // token owner
+
   let constitution: {permission: any, signers: IKeyringPair[], sinner: IKeyringPair}[];
 
   before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
-      charlie = privateKeyWrapper('//Charlie');
-      const dave = privateKeyWrapper('//Dave');
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      let dave: IKeyringPair;
+      [alice, bob, charlie, dave] = await helper.arrange.createAccounts([100n, 100n, 100n, 100n], donor);
 
+      // todo:playgrounds probably separate these tests later
       constitution = [
         {permission: {mutable: true, collectionAdmin: true}, signers: [alice, bob], sinner: charlie},
         {permission: {mutable: false, collectionAdmin: true}, signers: [alice, bob], sinner: charlie},
@@ -1010,278 +794,255 @@
     });
   });
 
-  async function prepare(mode: CollectionMode, pieces: number) {
-    collection = await createCollectionExpectSuccess({mode: mode});
-    token = await createItemExpectSuccess(alice, collection, mode.type);
-    await addCollectionAdminExpectSuccess(alice, collection, bob.address);
-    await transferExpectSuccess(collection, token, alice, charlie, pieces, mode.type);
-        
-    await usingApi(async api => {
-      let i = 0;
-      for (const passage of constitution) {
-        const signer = passage.signers[0];
-        
-        await expect(executeTransaction(
-          api, 
-          alice, 
-          api.tx.unique.setTokenPropertyPermissions(collection, [{key: `${i}`, permission: passage.permission}]), 
-        ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
-  
-        await expect(executeTransaction(
-          api, 
-          signer, 
-          api.tx.unique.setTokenProperties(collection, token, [{key: `${i}`, value: 'Serotonin increase'}]), 
-        ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;
-  
-        i++;
-      }
-  
-      originalSpace = (await api.query.nonfungible.tokenProperties(collection, token)).toJSON().consumedSpace as number;
-    }); 
+  async function getConsumedSpace(api: any, collectionId: number, tokenId: number, mode: 'NFT' | 'RFT'): Promise<number> {
+    return (await (mode == 'NFT' ? api.query.nonfungible : api.query.refungible).tokenProperties(collectionId, tokenId)).toJSON().consumedSpace;
+  }
+
+  async function prepare(token: UniqueNFToken | UniqueRFToken, pieces: bigint): Promise<number> {
+    await token.collection.addAdmin(alice, {Substrate: bob.address});
+    await token.transfer(alice, {Substrate: charlie.address}, pieces);
+
+    let i = 0;
+    for (const passage of constitution) {
+      i++;
+      const signer = passage.signers[0];
+      
+      await expect(
+        token.collection.setTokenPropertyPermissions(alice, [{key: `${i}`, permission: passage.permission}]), 
+        `on setting permission ${i} by alice`,
+      ).to.be.fulfilled;
+
+      await expect(
+        token.setProperties(signer, [{key: `${i}`, value: 'Serotonin increase'}]), 
+        `on adding property ${i} by ${signer.address}`,
+      ).to.be.fulfilled;
+    }
+
+    const originalSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    return originalSpace;
   }
 
-  async function testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(mode: CollectionMode, pieces: number) {
-    await prepare(mode, pieces);
-  
-    await usingApi(async api => {
-      let i = -1;
-      for (const forbiddance of constitution) {
-        i++;
-        if (!forbiddance.permission.mutable) continue;
-  
-        await expect(executeTransaction(
-          api, 
-          forbiddance.sinner, 
-          api.tx.unique.setTokenProperties(collection, token, [{key: `${i}`, value: 'Serotonin down'}]), 
-        ), `on failing to change property ${i} by ${forbiddance.sinner.address}`).to.be.rejectedWith(/common\.NoPermission/);
-  
-        await expect(executeTransaction(
-          api, 
-          forbiddance.sinner, 
-          api.tx.unique.deleteTokenProperties(collection, token, [`${i}`]), 
-        ), `on failing to delete property ${i} by ${forbiddance.sinner.address}`).to.be.rejectedWith(/common\.NoPermission/);
-      }
-  
-      const properties = (await api.query.nonfungible.tokenProperties(collection, token)).toJSON();
-      expect(properties.consumedSpace).to.be.equal(originalSpace);
-    });
+  async function testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+    const originalSpace = await prepare(token, pieces);
+
+    let i = 0;
+    for (const forbiddance of constitution) {
+      i++;
+      if (!forbiddance.permission.mutable) continue;
+
+      await expect(
+        token.setProperties(forbiddance.sinner, [{key: `${i}`, value: 'Serotonin down'}]), 
+        `on failing to change property ${i} by the malefactor`,
+      ).to.be.rejectedWith(/common\.NoPermission/);
+
+      await expect(
+        token.deleteProperties(forbiddance.sinner, [`${i}`]), 
+        `on failing to delete property ${i} by the malefactor`,
+      ).to.be.rejectedWith(/common\.NoPermission/);
+    }
+
+    const consumedSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    expect(consumedSpace).to.be.equal(originalSpace);
   }
-  it('Forbids changing/deleting properties of a token if the user is outside of permissions (NFT)', async () => {
-    await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions({type: 'NFT'}, 1);
+
+  itSub('Forbids changing/deleting properties of a token if the user is outside of permissions (NFT)', async ({helper}) =>  {
+    const collection = await helper.nft.mintCollection(alice);
+    const token = await collection.mintToken(alice);
+    await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token, 1n);
   });
-  it('Forbids changing/deleting properties of a token if the user is outside of permissions (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions({type: 'ReFungible'}, 100);
+  itSub.ifWithPallets('Forbids changing/deleting properties of a token if the user is outside of permissions (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice);
+    const token = await collection.mintToken(alice, 100n);
+    await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions(token, 100n);
   });
 
-  async function testForbidsChangingDeletingPropertiesIfPropertyImmutable(mode: CollectionMode, pieces: number) {
-    await prepare(mode, pieces);
-    
-    await usingApi(async api => {
-      let i = -1;
-      for (const permission of constitution) {
-        i++;
-        if (permission.permission.mutable) continue;
+  async function testForbidsChangingDeletingPropertiesIfPropertyImmutable(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+    const originalSpace = await prepare(token, pieces);
+
+    let i = 0;
+    for (const permission of constitution) {
+      i++;
+      if (permission.permission.mutable) continue;
+
+      await expect(
+        token.setProperties(permission.signers[0], [{key: `${i}`, value: 'Serotonin down'}]), 
+        `on failing to change property ${i} by signer #0`,
+      ).to.be.rejectedWith(/common\.NoPermission/);
+
+      await expect(
+        token.deleteProperties(permission.signers[0], [i.toString()]), 
+        `on failing to delete property ${i} by signer #0`,
+      ).to.be.rejectedWith(/common\.NoPermission/);
+    }
   
-        await expect(executeTransaction(
-          api, 
-          permission.signers[0], 
-          api.tx.unique.setTokenProperties(collection, token, [{key: `${i}`, value: 'Serotonin down'}]), 
-        ), `on failing to change property ${i} by ${permission.signers[0].address}`).to.be.rejectedWith(/common\.NoPermission/);
-  
-        await expect(executeTransaction(
-          api, 
-          permission.signers[0], 
-          api.tx.unique.deleteTokenProperties(collection, token, [i.toString()]), 
-        ), `on failing to delete property ${i} by ${permission.signers[0].address}`).to.be.rejectedWith(/common\.NoPermission/);
-      }
-  
-      const properties = (await api.query.nonfungible.tokenProperties(collection, token)).toJSON();
-      expect(properties.consumedSpace).to.be.equal(originalSpace);
-    });  
+    const consumedSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    expect(consumedSpace).to.be.equal(originalSpace);
   }
-  it('Forbids changing/deleting properties of a token if the property is permanent (immutable) (NFT)', async () => {
-    await testForbidsChangingDeletingPropertiesIfPropertyImmutable({type: 'NFT'}, 1);
+
+  itSub('Forbids changing/deleting properties of a token if the property is permanent (immutable) (NFT)', async ({helper}) =>  {
+    const collection = await helper.nft.mintCollection(alice);
+    const token = await collection.mintToken(alice);
+    await testForbidsChangingDeletingPropertiesIfPropertyImmutable(token, 1n);
   });
-  it('Forbids changing/deleting properties of a token if the property is permanent (immutable) (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testForbidsChangingDeletingPropertiesIfPropertyImmutable({type: 'ReFungible'}, 100);
+  itSub.ifWithPallets('Forbids changing/deleting properties of a token if the property is permanent (immutable) (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice);
+    const token = await collection.mintToken(alice, 100n);
+    await testForbidsChangingDeletingPropertiesIfPropertyImmutable(token, 100n);
   });
 
-  async function testForbidsAddingPropertiesIfPropertyNotDeclared(mode: CollectionMode, pieces: number) {
-    await prepare(mode, pieces);
+  async function testForbidsAddingPropertiesIfPropertyNotDeclared(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+    const originalSpace = await prepare(token, pieces);
+
+    await expect(
+      token.setProperties(alice, [{key: 'non-existent', value: 'I exist!'}]), 
+      'on failing to add a previously non-existent property',
+    ).to.be.rejectedWith(/common\.NoPermission/);
+      
+    await expect(
+      token.collection.setTokenPropertyPermissions(alice, [{key: 'now-existent', permission: {}}]), 
+      'on setting a new non-permitted property',
+    ).to.be.fulfilled;
+
+    await expect(
+      token.setProperties(alice, [{key: 'now-existent', value: 'I exist!'}]), 
+      'on failing to add a property forbidden by the \'None\' permission',
+    ).to.be.rejectedWith(/common\.NoPermission/);
 
-    await usingApi(async api => {
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenProperties(collection, token, [{key: 'non-existent', value: 'I exist!'}]), 
-      ), 'on failing to add a previously non-existent property').to.be.rejectedWith(/common\.NoPermission/);
-        
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'now-existent', permission: {}}]), 
-      ), 'on setting a new non-permitted property').to.not.be.rejected;
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenProperties(collection, token, [{key: 'now-existent', value: 'I exist!'}]), 
-      ), 'on failing to add a property forbidden by the \'None\' permission').to.be.rejectedWith(/common\.NoPermission/);
-  
-      expect((await api.rpc.unique.tokenProperties(collection, token, ['non-existent', 'now-existent'])).toJSON()).to.be.empty;
-      const properties = (await api.query.nonfungible.tokenProperties(collection, token)).toJSON();
-      expect(properties.consumedSpace).to.be.equal(originalSpace);
-    });
+    expect(await token.getProperties(['non-existent', 'now-existent'])).to.be.empty;
+      
+    const consumedSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    expect(consumedSpace).to.be.equal(originalSpace);
   }
-  it('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (NFT)', async () => {
-    await testForbidsAddingPropertiesIfPropertyNotDeclared({type: 'NFT'}, 1);
+
+  itSub('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (NFT)', async ({helper}) =>  {
+    const collection = await helper.nft.mintCollection(alice);
+    const token = await collection.mintToken(alice);
+    await testForbidsAddingPropertiesIfPropertyNotDeclared(token, 1n);
   });
-  it('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testForbidsAddingPropertiesIfPropertyNotDeclared({type: 'ReFungible'}, 100);
+  itSub.ifWithPallets('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice);
+    const token = await collection.mintToken(alice, 100n);
+    await testForbidsAddingPropertiesIfPropertyNotDeclared(token, 100n);
   });
 
-  async function testForbidsAddingTooManyProperties(mode: CollectionMode, pieces: number) {
-    await prepare(mode, pieces);
+  async function testForbidsAddingTooManyProperties(token: UniqueNFToken | UniqueRFToken, pieces: bigint) {
+    const originalSpace = await prepare(token, pieces);
+
+    await expect(
+      token.collection.setTokenPropertyPermissions(alice, [
+        {key: 'a_holy_book', permission: {collectionAdmin: true, tokenOwner: true}}, 
+        {key: 'young_years', permission: {collectionAdmin: true, tokenOwner: true}},
+      ]), 
+      'on setting new permissions for properties',
+    ).to.be.fulfilled;
+
+    // Mute the general tx parsing error
+    {
+      console.error = () => {};
+      await expect(token.setProperties(alice, [{key: 'a_holy_book', value: 'word '.repeat(6554)}]))
+        .to.be.rejected;
+    }
 
-    await usingApi(async api => {
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [
-          {key: 'a_holy_book', permission: {collectionAdmin: true, tokenOwner: true}}, 
-          {key: 'young_years', permission: {collectionAdmin: true, tokenOwner: true}},
-        ]), 
-      ), 'on setting a new non-permitted property').to.not.be.rejected;
+    await expect(token.setProperties(alice, [
+      {key: 'a_holy_book', value: 'word '.repeat(3277)}, 
+      {key: 'young_years', value: 'neverending'.repeat(1490)},
+    ])).to.be.rejectedWith(/common\.NoSpaceForProperty/);
   
-      // Mute the general tx parsing error
-      {
-        console.error = () => {};
-        await expect(executeTransaction(
-          api, 
-          alice, 
-          api.tx.unique.setCollectionProperties(collection, [{key: 'a_holy_book', value: 'word '.repeat(6554)}]), 
-        )).to.be.rejected;
-      }
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenProperties(collection, token, [
-          {key: 'a_holy_book', value: 'word '.repeat(3277)}, 
-          {key: 'young_years', value: 'neverending'.repeat(1490)},
-        ]), 
-      )).to.be.rejectedWith(/common\.NoSpaceForProperty/);
-  
-      expect((await api.rpc.unique.tokenProperties(collection, token, ['a_holy_book', 'young_years'])).toJSON()).to.be.empty;
-      const propertiesMap = (await api.query.nonfungible.tokenProperties(collection, token)).toJSON();
-      expect(propertiesMap.consumedSpace).to.be.equal(originalSpace);
-    });
+    expect(await token.getProperties(['a_holy_book', 'young_years'])).to.be.empty;
+    const consumedSpace = await getConsumedSpace(token.collection.helper.api, token.collectionId, token.tokenId, pieces == 1n ? 'NFT' : 'RFT'); 
+    expect(consumedSpace).to.be.equal(originalSpace);
   }
-  it('Forbids adding too many properties to a token (NFT)', async () => {
-    await testForbidsAddingTooManyProperties({type: 'NFT'}, 1);
+
+  itSub('Forbids adding too many properties to a token (NFT)', async ({helper}) =>  {
+    const collection = await helper.nft.mintCollection(alice);
+    const token = await collection.mintToken(alice);
+    await testForbidsAddingTooManyProperties(token, 1n);
   });
-  it('Forbids adding too many properties to a token (ReFungible)', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
 
-    await testForbidsAddingTooManyProperties({type: 'ReFungible'}, 100);
+  itSub.ifWithPallets('Forbids adding too many properties to a token (ReFungible)', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.rft.mintCollection(alice);
+    const token = await collection.mintToken(alice, 100n);
+    await testForbidsAddingTooManyProperties(token, 100n);
   });
 });
 
 describe('ReFungible token properties permissions tests', () => {
-  let collection: number;
-  let token: number;
+  let alice: IKeyringPair;
+  let bob: IKeyringPair;
+  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([100n, 100n, 100n], donor);
     });
   });
 
-  beforeEach(async () => {
-    await usingApi(async api => {
-      collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-      token = await createItemExpectSuccess(alice, collection, 'ReFungible');
-      await addCollectionAdminExpectSuccess(alice, collection, bob.address);
+  async function prepare(helper: UniqueHelper): Promise<UniqueRFToken> {
+    const collection = await helper.rft.mintCollection(alice);
+    const token = await collection.mintToken(alice, 100n);
+    
+    await collection.addAdmin(alice, {Substrate: bob.address});
+    await collection.setTokenPropertyPermissions(alice, [{key: 'fractals', permission: {mutable: true, tokenOwner: true}}]);
+    
+    return token;
+  }
+
+  itSub('Forbids adding token property with tokenOwner==true when signer doesn\'t have all pieces', async ({helper}) =>  {
+    const token = await prepare(helper);
+
+    await token.transfer(alice, {Substrate: charlie.address}, 33n);
 
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'key', permission: {mutable:true, tokenOwner: true}}]), 
-      )).to.not.be.rejected;
-    });
+    await expect(token.setProperties(alice, [
+      {key: 'fractals', value: 'multiverse'}, 
+    ])).to.be.rejectedWith(/common\.NoPermission/);
   });
 
-  it('Forbids add token property with tokenOwher==true but signer have\'t all pieces', async () => {
-    await usingApi(async api => {
-      await transferExpectSuccess(collection, token, alice, charlie, 33, 'ReFungible');
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenProperties(collection, token, [
-          {key: 'key', value: 'word'}, 
-        ]), 
-      )).to.be.rejectedWith(/common\.NoPermission/);
-    });
+  itSub('Forbids mutating token property with tokenOwher==true when signer doesn\'t have all pieces', async ({helper}) =>  {
+    const token = await prepare(helper);
+
+    await expect(token.collection.setTokenPropertyPermissions(alice, [{key: 'fractals', permission: {mutable:true, tokenOwner: true}}]))
+      .to.be.fulfilled;
+
+    await expect(token.setProperties(alice, [
+      {key: 'fractals', value: 'multiverse'}, 
+    ])).to.be.fulfilled;
+
+    await token.transfer(alice, {Substrate: charlie.address}, 33n);
+
+    await expect(token.setProperties(alice, [
+      {key: 'fractals', value: 'want to rule the world'}, 
+    ])).to.be.rejectedWith(/common\.NoPermission/);
   });
 
-  it('Forbids mutate token property with tokenOwher==true but signer have\'t all pieces', async () => {
-    await usingApi(async api => {
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'key', permission: {mutable:true, tokenOwner: true}}]), 
-      )).to.not.be.rejected;
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenProperties(collection, token, [
-          {key: 'key', value: 'word'}, 
-        ]), 
-      )).to.be.not.rejected;
+  itSub('Forbids deleting token property with tokenOwner==true when signer doesn\'t have all pieces', async ({helper}) =>  {
+    const token = await prepare(helper);
+
+    await expect(token.setProperties(alice, [
+      {key: 'fractals', value: 'one headline - why believe it'}, 
+    ])).to.be.fulfilled;
+
+    await token.transfer(alice, {Substrate: charlie.address}, 33n);
 
-      await transferExpectSuccess(collection, token, alice, charlie, 33, 'ReFungible');
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenProperties(collection, token, [
-          {key: 'key', value: 'bad word'}, 
-        ]), 
-      )).to.be.rejectedWith(/common\.NoPermission/);
-    });
+    await expect(token.deleteProperties(alice, ['fractals'])).
+      to.be.rejectedWith(/common\.NoPermission/);
   });
 
-  it('Forbids delete token property with tokenOwher==true but signer have\'t all pieces', async () => {
-    await usingApi(async api => {
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenProperties(collection, token, [
-          {key: 'key', value: 'word'}, 
-        ]), 
-      )).to.be.not.rejected;
+  itSub('Allows token property mutation with collectionOwner==true when admin doesn\'t have all pieces', async ({helper}) =>  {
+    const token = await prepare(helper);
 
-      await transferExpectSuccess(collection, token, alice, charlie, 33, 'ReFungible');
-  
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.deleteTokenProperties(collection, token, [
-          'key',
-        ]), 
-      )).to.be.rejectedWith(/common\.NoPermission/);
-    });
+    await token.transfer(alice, {Substrate: charlie.address}, 33n);
+
+    await expect(token.collection.setTokenPropertyPermissions(alice, [{key: 'fractals', permission: {mutable:true, collectionAdmin: true}}]))
+      .to.be.fulfilled;
+
+    await expect(token.setProperties(alice, [
+      {key: 'fractals', value: 'multiverse'}, 
+    ])).to.be.fulfilled;
   });
 });
deletedtests/src/nesting/rules-smoke.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/rules-smoke.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import {expect} from 'chai';
-import {tokenIdToAddress} from '../eth/util/helpers';
-import usingApi, {executeTransaction} from '../substrate/substrate-api';
-import {createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, CrossAccountId, getCreateCollectionResult, requirePallets, Pallets} from '../util/helpers';
-import {IKeyringPair} from '@polkadot/types/types';
-
-describe('nesting check', () => {
-  let alice!: IKeyringPair;
-  let nestTarget!: CrossAccountId;
-  before(async() => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      const bob = privateKeyWrapper('//Bob');
-      const events = await executeTransaction(api, alice, api.tx.unique.createCollectionEx({
-        mode: 'NFT',
-        permissions: {
-          nesting: {tokenOwner: true, restricted: []},
-        },
-      }));
-      const collection = getCreateCollectionResult(events).collectionId;
-      const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: bob.address});
-      nestTarget = {Ethereum: tokenIdToAddress(collection, token)};
-    });
-  });
-
-  it('called for fungible', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'Fungible',decimalPoints:0}});
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {Fungible: {Value: 1}})))
-        .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
-
-      await createFungibleItemExpectSuccess(alice, collection, {Value:1n}, {Substrate: alice.address});
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, 0, 1n)))
-        .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
-    });
-  });
-
-  it('called for nonfungible', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {NFT: {properties: []}})))
-        .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
-
-      const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))
-        .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
-    });
-  });
-
-  it('called for refungible', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
-
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-      await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {ReFungible: {}})))
-        .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
-
-      const token = await createItemExpectSuccess(alice, collection, 'ReFungible', {Substrate: alice.address});
-      await expect(executeTransaction(api, alice, api.tx.unique.transfer(nestTarget, collection, token, 1n)))
-        .to.be.rejectedWith(/^common\.UserIsNotAllowedToNest$/);
-    });
-  });
-});
modifiedtests/src/nesting/unnest.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/unnest.test.ts
+++ b/tests/src/nesting/unnest.test.ts
@@ -1,162 +1,126 @@
-import {expect} from 'chai';
-import {tokenIdToAddress} from '../eth/util/helpers';
-import usingApi, {executeTransaction} from '../substrate/substrate-api';
-import {
-  createCollectionExpectSuccess,
-  createItemExpectSuccess,
-  getBalance,
-  getTokenOwner,
-  normalizeAccountId,
-  setCollectionPermissionsExpectSuccess,
-  transferExpectSuccess,
-  transferFromExpectSuccess,
-  requirePallets,
-  Pallets,
-} from '../util/helpers';
+// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
+// This file is part of Unique Network.
+
+// Unique Network is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Unique Network is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// 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 {IKeyringPair} from '@polkadot/types/types';
+import {expect, itSub, Pallets, usingPlaygrounds} from '../util/playgrounds';
 
-let alice: IKeyringPair;
-let bob: IKeyringPair;
+describe('Integration Test: Unnesting', () => {
+  let alice: IKeyringPair;
 
-describe('Integration Test: Unnesting', () => {
   before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
+    await usingPlaygrounds(async (helper, privateKey) => {
+      const donor = privateKey('//Alice');
+      [alice] = await helper.arrange.createAccounts([50n], donor);
     });
   });
 
-  it('NFT: allows the owner to successfully unnest a token', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
-
-      // Create a nested token
-      const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', targetAddress);
+  itSub('NFT: allows the owner to successfully unnest a token', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const targetToken = await collection.mintToken(alice);
+    
+    // Create a nested token
+    const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
 
-      // Unnest
-      await expect(executeTransaction(
-        api,
-        alice,
-        api.tx.unique.transferFrom(normalizeAccountId(targetAddress), normalizeAccountId(alice), collection, nestedToken, 1),
-      ), 'while unnesting').to.not.be.rejected;
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Substrate: alice.address});
+    // Unnest
+    await expect(nestedToken.transferFrom(alice, targetToken.nestingAccount(), {Substrate: alice.address}), 'while unnesting').to.be.fulfilled;
+    expect(await nestedToken.getOwner()).to.be.deep.equal({Substrate: alice.address});
 
-      // Nest and burn
-      await transferExpectSuccess(collection, nestedToken, alice, targetAddress);
-      await expect(executeTransaction(
-        api,
-        alice,
-        api.tx.unique.burnFrom(collection, normalizeAccountId(targetAddress), nestedToken, 1),
-      ), 'while burning').to.not.be.rejected;
-      await expect(getTokenOwner(api, collection, nestedToken)).to.be.rejected;
-    });
+    // Nest and burn
+    await nestedToken.nest(alice, targetToken);
+    await expect(nestedToken.burnFrom(alice, targetToken.nestingAccount()), 'while burning').to.be.fulfilled;
+    await expect(nestedToken.getOwner()).to.be.rejected;
   });
 
-  it('Fungible: allows the owner to successfully unnest a token', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
+  itSub('Fungible: allows the owner to successfully unnest a token', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const targetToken = await collection.mintToken(alice);
 
-      const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
-      const nestedToken = await createItemExpectSuccess(alice, collectionFT, 'Fungible');
+    const collectionFT = await helper.ft.mintCollection(alice);
+    
+    // Nest and unnest
+    await collectionFT.mint(alice, 10n, targetToken.nestingAccount());
+    await expect(collectionFT.transferFrom(alice, targetToken.nestingAccount(), {Substrate: alice.address}, 9n), 'while unnesting').to.be.fulfilled;
+    expect(await collectionFT.getBalance({Substrate: alice.address})).to.be.equal(9n);
+    expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(1n);
 
-      // Nest and unnest
-      await transferExpectSuccess(collectionFT, nestedToken, alice, targetAddress, 1, 'Fungible');
-      await transferFromExpectSuccess(collectionFT, nestedToken, alice, targetAddress, alice, 1, 'Fungible');
-
-      // Nest and burn
-      await transferExpectSuccess(collectionFT, nestedToken, alice, targetAddress, 1, 'Fungible');
-      const balanceBefore = await getBalance(api, collectionFT, normalizeAccountId(targetAddress), nestedToken);
-      await expect(executeTransaction(
-        api,
-        alice,
-        api.tx.unique.burnFrom(collectionFT, normalizeAccountId(targetAddress), nestedToken, 1),
-      ), 'while burning').to.not.be.rejected;
-      const balanceAfter = await getBalance(api, collectionFT, normalizeAccountId(targetAddress), nestedToken);
-      expect(balanceAfter + BigInt(1)).to.be.equal(balanceBefore);
-    });
+    // Nest and burn
+    await collectionFT.transfer(alice, targetToken.nestingAccount(), 5n);
+    await expect(collectionFT.burnTokensFrom(alice, targetToken.nestingAccount(), 6n), 'while burning').to.be.fulfilled;
+    expect(await collectionFT.getBalance({Substrate: alice.address})).to.be.equal(4n);
+    expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(0n);
+    expect(await targetToken.getChildren()).to.be.length(0);
   });
 
-  it('ReFungible: allows the owner to successfully unnest a token', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
+  itSub.ifWithPallets('ReFungible: allows the owner to successfully unnest a token', [Pallets.ReFungible], async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const targetToken = await collection.mintToken(alice);
 
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
-
-      const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-      const nestedToken = await createItemExpectSuccess(alice, collectionRFT, 'ReFungible');
-
-      // Nest and unnest
-      await transferExpectSuccess(collectionRFT, nestedToken, alice, targetAddress, 1, 'ReFungible');
-      await transferFromExpectSuccess(collectionRFT, nestedToken, alice, targetAddress, alice, 1, 'ReFungible');
+    const collectionRFT = await helper.rft.mintCollection(alice);
+    
+    // Nest and unnest
+    const token = await collectionRFT.mintToken(alice, 10n, targetToken.nestingAccount());
+    await expect(token.transferFrom(alice, targetToken.nestingAccount(), {Substrate: alice.address}, 9n), 'while unnesting').to.be.fulfilled;
+    expect(await token.getBalance({Substrate: alice.address})).to.be.equal(9n);
+    expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(1n);
 
-      // Nest and burn
-      await transferExpectSuccess(collectionRFT, nestedToken, alice, targetAddress, 1, 'ReFungible');
-      await expect(executeTransaction(
-        api,
-        alice,
-        api.tx.unique.burnFrom(collectionRFT, normalizeAccountId(targetAddress), nestedToken, 1),
-      ), 'while burning').to.not.be.rejected;
-      const balance = await getBalance(api, collectionRFT, normalizeAccountId(targetAddress), nestedToken);
-      expect(balance).to.be.equal(0n);
-    });
+    // Nest and burn
+    await token.transfer(alice, targetToken.nestingAccount(), 5n);
+    await expect(token.burnFrom(alice, targetToken.nestingAccount(), 6n), 'while burning').to.be.fulfilled;
+    expect(await token.getBalance({Substrate: alice.address})).to.be.equal(4n);
+    expect(await token.getBalance(targetToken.nestingAccount())).to.be.equal(0n);
+    expect(await targetToken.getChildren()).to.be.length(0);
   });
 });
 
 describe('Negative Test: Unnesting', () => {
+  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([50n, 10n], donor);
     });
   });
 
-  it('Disallows a non-owner to unnest/burn a token', async () => {
-    await usingApi(async api => {
-      const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-      await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-      const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
-      const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
+  itSub('Disallows a non-owner to unnest/burn a token', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const targetToken = await collection.mintToken(alice);
 
-      // Create a nested token
-      const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', targetAddress);
+    // Create a nested token
+    const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
 
-      // Try to unnest
-      await expect(executeTransaction(
-        api,
-        bob,
-        api.tx.unique.transferFrom(normalizeAccountId(targetAddress), normalizeAccountId(bob), collection, nestedToken, 1),
-      ), 'while unnesting').to.be.rejectedWith(/^common\.ApprovedValueTooLow$/);
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
+    // Try to unnest
+    await expect(nestedToken.unnest(bob, targetToken, {Substrate: alice.address})).to.be.rejectedWith(/common\.ApprovedValueTooLow/);
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
 
-      // Try to burn
-      await expect(executeTransaction(
-        api,
-        bob,
-        api.tx.unique.burnFrom(collection, normalizeAccountId(bob.address), nestedToken, 1),
-      ), 'while burning').to.not.be.rejectedWith(/^common\.ApprovedValueTooLow$/);
-      expect(await getTokenOwner(api, collection, nestedToken)).to.be.deep.equal({Ethereum: tokenIdToAddress(collection, targetToken).toLowerCase()});
-    });
+    // Try to burn
+    await expect(nestedToken.burnFrom(bob, targetToken.nestingAccount())).to.be.rejectedWith(/common\.ApprovedValueTooLow/);
+    expect(await nestedToken.getOwner()).to.be.deep.equal(targetToken.nestingAccountInLowerCase());
   });
 
   // todo another test for creating excessive depth matryoshka with Ethereum?
 
   // Recursive nesting
-  it('Prevents Ouroboros creation', async () => {
-    const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
-    await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});
-    const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
+  itSub('Prevents Ouroboros creation', async ({helper}) => {
+    const collection = await helper.nft.mintCollection(alice, {permissions: {nesting: {tokenOwner: true}}});
+    const targetToken = await collection.mintToken(alice);
 
-    // Create a nested token ouroboros
-    const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, targetToken)});
-    await expect(transferExpectSuccess(collection, targetToken, alice, {Ethereum: tokenIdToAddress(collection, nestedToken)})).to.be.rejectedWith(/^structure\.OuroborosDetected$/);
+    // Fail to create a nested token ouroboros
+    const nestedToken = await collection.mintToken(alice, targetToken.nestingAccount());
+    await expect(targetToken.nest(alice, nestedToken)).to.be.rejectedWith(/^structure\.OuroborosDetected$/);
   });
 });
modifiedtests/src/util/playgrounds/index.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/index.ts
+++ b/tests/src/util/playgrounds/index.ts
@@ -9,7 +9,6 @@
 import '../../interfaces/augment-api-events';
 import {DevUniqueHelper, SilentLogger, SilentConsole} from './unique.dev';
 
-
 chai.use(chaiAsPromised);
 export const expect = chai.expect;
 
modifiedtests/src/util/playgrounds/types.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -94,15 +94,15 @@
 
 export interface IProperty {
   key: string;
-  value: string;
+  value?: string;
 }
 
 export interface ITokenPropertyPermission {
   key: string;
   permission: {
-    mutable: boolean;
-    tokenOwner: boolean;
-    collectionAdmin: boolean;
+    mutable?: boolean;
+    tokenOwner?: boolean;
+    collectionAdmin?: boolean;
   }
 }
 
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
55 RPC: 'rpc',55 RPC: 'rpc',
56 };56 };
5757
58 static getNestingTokenAddress(collectionId: number, tokenId: number) {58 static getTokenAccount(token: IToken): ICrossAccountId {
59 return nesting.tokenIdToAddress(collectionId, tokenId);59 return {Ethereum: this.getTokenAddress(token)};
60 }60 }
6161
62 static getTokenAccountInLowerCase(token: IToken): ICrossAccountId {
63 return {Ethereum: this.getTokenAddress(token).toLowerCase()};
64 }
65
66 static getTokenAddress(token: IToken): string {
67 return nesting.tokenIdToAddress(token.collectionId, token.tokenId);
68 }
69
62 static getDefaultLogger(): ILogger {70 static getDefaultLogger(): ILogger {
63 return {71 return {
64 log(msg: any, level = 'INFO') {72 log(msg: any, level = 'INFO') {
592 const admins = (await this.helper.callRpc('api.rpc.unique.adminlist', [collectionId])).toHuman();600 const admins = (await this.helper.callRpc('api.rpc.unique.adminlist', [collectionId])).toHuman();
593601
594 return normalize602 return normalize
595 ? admins.map((address: any) => {603 ? admins.map((address: any) => this.helper.address.normalizeCrossAccountIfSubstrate(address))
596 return address.Substrate
597 ? {Substrate: this.helper.address.normalizeSubstrate(address.Substrate)}
598 : address;
599 })
600 : admins;604 : admins;
601 }605 }
602606
610 async getAllowList(collectionId: number, normalize = false): Promise<ICrossAccountId[]> {614 async getAllowList(collectionId: number, normalize = false): Promise<ICrossAccountId[]> {
611 const allowListed = (await this.helper.callRpc('api.rpc.unique.allowlist', [collectionId])).toHuman();615 const allowListed = (await this.helper.callRpc('api.rpc.unique.allowlist', [collectionId])).toHuman();
612 return normalize616 return normalize
613 ? allowListed.map((address: any) => {617 ? allowListed.map((address: any) => this.helper.address.normalizeCrossAccountIfSubstrate(address))
614 return address.Substrate
615 ? {Substrate: this.helper.address.normalizeSubstrate(address.Substrate)}
616 : address;
617 })
618 : allowListed;618 : allowListed;
619 }619 }
620620
897 }897 }
898898
899 /**899 /**
900 * Get collection properties.
901 *
902 * @param collectionId ID of collection
903 * @param propertyKeys optionally filter the returned properties to only these keys
904 * @example getProperties(1219, ['location', 'date', 'time', 'isParadise']);
905 * @returns array of key-value pairs
906 */
907 async getProperties(collectionId: number, propertyKeys: string[] | null = null): Promise<IProperty[]> {
908 return (await this.helper.callRpc('api.rpc.unique.collectionProperties', [collectionId, ...(propertyKeys === null ? [] : [propertyKeys])])).toHuman();
909 }
910
911 /**
900 * Deletes onchain properties from the collection.912 * Deletes onchain properties from the collection.
901 *913 *
902 * @param signer keyring of signer914 * @param signer keyring of signer
988 *1000 *
989 * @param signer keyring of signer1001 * @param signer keyring of signer
990 * @param collectionId ID of collection1002 * @param collectionId ID of collection
1003 * @param tokenId ID of token
991 * @param fromAddressObj address on behalf of which the token will be burnt1004 * @param fromAddressObj address on behalf of which the token will be burnt
992 * @param tokenId ID of token
993 * @param amount amount of tokens to be burned. For NFT must be set to 1n1005 * @param amount amount of tokens to be burned. For NFT must be set to 1n
994 * @example burnTokenFrom(aliceKeyring, 10, {Substrate: "5DyN4Y92vZCjv38fg..."}, 5, {Ethereum: "0x9F0583DbB85..."})1006 * @example burnTokenFrom(aliceKeyring, 10, {Substrate: "5DyN4Y92vZCjv38fg..."}, 5, {Ethereum: "0x9F0583DbB85..."})
995 * @returns ```true``` if extrinsic success, otherwise ```false```1007 * @returns ```true``` if extrinsic success, otherwise ```false```
996 */1008 */
997 async burnTokenFrom(signer: TSigner, collectionId: number, fromAddressObj: ICrossAccountId, tokenId: number, amount=1n): Promise<boolean> {1009 async burnTokenFrom(signer: TSigner, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {
998 const burnResult = await this.helper.executeExtrinsic(1010 const burnResult = await this.helper.executeExtrinsic(
999 signer,1011 signer,
1000 'api.tx.unique.burnFrom', [collectionId, fromAddressObj, tokenId, amount],1012 'api.tx.unique.burnFrom', [collectionId, fromAddressObj, tokenId, amount],
1106 if (tokenData === null || tokenData.owner === null) return null;1118 if (tokenData === null || tokenData.owner === null) return null;
1107 const owner = {} as any;1119 const owner = {} as any;
1108 for (const key of Object.keys(tokenData.owner)) {1120 for (const key of Object.keys(tokenData.owner)) {
1109 owner[key.toLocaleLowerCase()] = key.toLocaleLowerCase() === 'substrate' ? this.helper.address.normalizeSubstrate(tokenData.owner[key]) : tokenData.owner[key];1121 owner[key.toLocaleLowerCase()] = this.helper.address.normalizeCrossAccountIfSubstrate(tokenData.owner[key]);
1110 }1122 }
1111 tokenData.normalizedOwner = crossAccountIdFromLower(owner);1123 tokenData.normalizedOwner = crossAccountIdFromLower(owner);
1112 return tokenData;1124 return tokenData;
1117 *1129 *
1118 * @param signer keyring of signer1130 * @param signer keyring of signer
1119 * @param collectionId ID of collection1131 * @param collectionId ID of collection
1120 * @param permissions permissions to change a property by the collection owner or admin1132 * @param permissions permissions to change a property by the collection admin or token owner
1121 * @example setTokenPropertyPermissions(1133 * @example setTokenPropertyPermissions(
1122 * aliceKeyring, 10, [{key: "gender", permission: {tokenOwner: true, mutable: true, collectionAdmin: true}}]1134 * aliceKeyring, 10, [{key: "gender", permission: {tokenOwner: true, mutable: true, collectionAdmin: true}}]
1123 * )1135 * )
1134 }1146 }
11351147
1136 /**1148 /**
1149 * Get token property permissions.
1150 *
1151 * @param collectionId ID of collection
1152 * @param propertyKeys optionally filter the returned property permissions to only these keys
1153 * @example getPropertyPermissions(1219, ['location', 'date', 'time', 'isParadise']);
1154 * @returns array of key-permission pairs
1155 */
1156 async getPropertyPermissions(collectionId: number, propertyKeys: string[] | null = null): Promise<ITokenPropertyPermission[]> {
1157 return (await this.helper.callRpc('api.rpc.unique.propertyPermissions', [collectionId, ...(propertyKeys === null ? [] : [propertyKeys])])).toHuman();
1158 }
1159
1160 /**
1137 * Set token properties1161 * Set token properties
1138 *1162 *
1139 * @param signer keyring of signer1163 * @param signer keyring of signer
1154 }1178 }
11551179
1156 /**1180 /**
1181 * Get properties, metadata assigned to a token.
1182 *
1183 * @param collectionId ID of collection
1184 * @param tokenId ID of token
1185 * @param propertyKeys optionally filter the returned properties to only these keys
1186 * @example getTokenProperties(1219, ['location', 'date', 'time', 'isParadise']);
1187 * @returns array of key-value pairs
1188 */
1189 async getTokenProperties(collectionId: number, tokenId: number, propertyKeys: string[] | null = null): Promise<IProperty[]> {
1190 return (await this.helper.callRpc('api.rpc.unique.tokenProperties', [collectionId, tokenId, ...(propertyKeys === null ? [] : [propertyKeys])])).toHuman();
1191 }
1192
1193 /**
1157 * Delete the provided properties of a token1194 * Delete the provided properties of a token
1158 * @param signer keyring of signer1195 * @param signer keyring of signer
1159 * @param collectionId ID of collection1196 * @param collectionId ID of collection
1181 * @example mintCollection(aliceKeyring, {name: 'New', description: "New collection", tokenPrefix: "NEW"}, "NFT")1218 * @example mintCollection(aliceKeyring, {name: 'New', description: "New collection", tokenPrefix: "NEW"}, "NFT")
1182 * @returns object of the created collection1219 * @returns object of the created collection
1183 */1220 */
1184 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions, mode: 'NFT' | 'RFT'): Promise<UniqueCollectionBase> {1221 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions, mode: 'NFT' | 'RFT'): Promise<UniqueBaseCollection> {
1185 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object1222 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object
1186 collectionOptions.mode = (mode === 'NFT') ? {nft: null} : {refungible: null};1223 collectionOptions.mode = (mode === 'NFT') ? {nft: null} : {refungible: null};
1187 for (const key of ['name', 'description', 'tokenPrefix']) {1224 for (const key of ['name', 'description', 'tokenPrefix']) {
1223 * @example getTokenObject(10, 5);1260 * @example getTokenObject(10, 5);
1224 * @returns instance of UniqueNFTToken1261 * @returns instance of UniqueNFTToken
1225 */1262 */
1226 getTokenObject(collectionId: number, tokenId: number): UniqueNFTToken {1263 getTokenObject(collectionId: number, tokenId: number): UniqueNFToken {
1227 return new UniqueNFTToken(tokenId, this.getCollectionObject(collectionId));1264 return new UniqueNFToken(tokenId, this.getCollectionObject(collectionId));
1228 }1265 }
12291266
1230 /**1267 /**
13041341
1305 if (owner === null) return null;1342 if (owner === null) return null;
13061343
1307 owner = owner.toHuman();1344 return owner.toHuman();
1308
1309 return owner.Substrate ? {Substrate: this.helper.address.normalizeSubstrate(owner.Substrate)} : owner;
1310 }1345 }
13111346
1312 /**1347 /**
1339 * @returns ```true``` if extrinsic success, otherwise ```false```1374 * @returns ```true``` if extrinsic success, otherwise ```false```
1340 */1375 */
1341 async nestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken): Promise<boolean> {1376 async nestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken): Promise<boolean> {
1342 const rootTokenAddress = {Ethereum: this.helper.util.getNestingTokenAddress(rootTokenObj.collectionId, rootTokenObj.tokenId)};1377 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);
1343 const result = await this.transferToken(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress);1378 const result = await this.transferToken(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress);
1344 if(!result) {1379 if(!result) {
1345 throw Error('Unable to nest token!');1380 throw Error('Unable to nest token!');
1357 * @returns ```true``` if extrinsic success, otherwise ```false```1392 * @returns ```true``` if extrinsic success, otherwise ```false```
1358 */1393 */
1359 async unnestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken, toAddressObj: ICrossAccountId): Promise<boolean> {1394 async unnestToken(signer: TSigner, tokenObj: IToken, rootTokenObj: IToken, toAddressObj: ICrossAccountId): Promise<boolean> {
1360 const rootTokenAddress = {Ethereum: this.helper.util.getNestingTokenAddress(rootTokenObj.collectionId, rootTokenObj.tokenId)};1395 const rootTokenAddress = this.helper.util.getTokenAccount(rootTokenObj);
1361 const result = await this.transferTokenFrom(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress, toAddressObj);1396 const result = await this.transferTokenFrom(signer, tokenObj.collectionId, tokenObj.tokenId, rootTokenAddress, toAddressObj);
1362 if(!result) {1397 if(!result) {
1363 throw Error('Unable to unnest token!');1398 throw Error('Unable to unnest token!');
1377 * })1412 * })
1378 * @returns object of the created collection1413 * @returns object of the created collection
1379 */1414 */
1380 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions): Promise<UniqueNFTCollection> {1415 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions = {}): Promise<UniqueNFTCollection> {
1381 return await super.mintCollection(signer, collectionOptions, 'NFT') as UniqueNFTCollection;1416 return await super.mintCollection(signer, collectionOptions, 'NFT') as UniqueNFTCollection;
1382 }1417 }
13831418
1387 * @param data token data1422 * @param data token data
1388 * @returns created token object1423 * @returns created token object
1389 */1424 */
1390 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; properties?: IProperty[]; }): Promise<UniqueNFTToken> {1425 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; properties?: IProperty[]; }): Promise<UniqueNFToken> {
1391 const creationResult = await this.helper.executeExtrinsic(1426 const creationResult = await this.helper.executeExtrinsic(
1392 signer,1427 signer,
1393 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1428 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {
1418 * }]);1453 * }]);
1419 * @returns ```true``` if extrinsic success, otherwise ```false```1454 * @returns ```true``` if extrinsic success, otherwise ```false```
1420 */1455 */
1421 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, properties?: IProperty[]}[]): Promise<UniqueNFTToken[]> {1456 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, properties?: IProperty[]}[]): Promise<UniqueNFToken[]> {
1422 const creationResult = await this.helper.executeExtrinsic(1457 const creationResult = await this.helper.executeExtrinsic(
1423 signer,1458 signer,
1424 'api.tx.unique.createMultipleItemsEx', [collectionId, {NFT: tokens}],1459 'api.tx.unique.createMultipleItemsEx', [collectionId, {NFT: tokens}],
1446 * }]);1481 * }]);
1447 * @returns array of newly created tokens1482 * @returns array of newly created tokens
1448 */1483 */
1449 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {properties?: IProperty[]}[]): Promise<UniqueNFTToken[]> {1484 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {properties?: IProperty[]}[]): Promise<UniqueNFToken[]> {
1450 const rawTokens = [];1485 const rawTokens = [];
1451 for (const token of tokens) {1486 for (const token of tokens) {
1452 const raw = {NFT: {properties: token.properties}};1487 const raw = {NFT: {properties: token.properties}};
1495 * @example getTokenObject(10, 5);1530 * @example getTokenObject(10, 5);
1496 * @returns instance of UniqueNFTToken1531 * @returns instance of UniqueNFTToken
1497 */1532 */
1498 getTokenObject(collectionId: number, tokenId: number): UniqueRFTToken {1533 getTokenObject(collectionId: number, tokenId: number): UniqueRFToken {
1499 return new UniqueRFTToken(tokenId, this.getCollectionObject(collectionId));1534 return new UniqueRFToken(tokenId, this.getCollectionObject(collectionId));
1500 }1535 }
15011536
1502 /**1537 /**
1563 * })1598 * })
1564 * @returns object of the created collection1599 * @returns object of the created collection
1565 */1600 */
1566 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions): Promise<UniqueRFTCollection> {1601 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions = {}): Promise<UniqueRFTCollection> {
1567 return await super.mintCollection(signer, collectionOptions, 'RFT') as UniqueRFTCollection;1602 return await super.mintCollection(signer, collectionOptions, 'RFT') as UniqueRFTCollection;
1568 }1603 }
15691604
1574 * @example mintToken(aliceKeyring, {collectionId: 10, owner: {Substrate: '5GHoZe9c73RYbVzq...'}, pieces: 10000n});1609 * @example mintToken(aliceKeyring, {collectionId: 10, owner: {Substrate: '5GHoZe9c73RYbVzq...'}, pieces: 10000n});
1575 * @returns created token object1610 * @returns created token object
1576 */1611 */
1577 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; pieces: bigint; properties?: IProperty[]; }): Promise<UniqueRFTToken> {1612 async mintToken(signer: TSigner, data: { collectionId: number; owner: ICrossAccountId | string; pieces: bigint; properties?: IProperty[]; }): Promise<UniqueRFToken> {
1578 const creationResult = await this.helper.executeExtrinsic(1613 const creationResult = await this.helper.executeExtrinsic(
1579 signer,1614 signer,
1580 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {1615 'api.tx.unique.createItem', [data.collectionId, (typeof data.owner === 'string') ? {Substrate: data.owner} : data.owner, {
1591 return this.getTokenObject(data.collectionId, createdTokens.tokens[0].tokenId);1626 return this.getTokenObject(data.collectionId, createdTokens.tokens[0].tokenId);
1592 }1627 }
15931628
1594 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFTToken[]> {1629 async mintMultipleTokens(signer: TSigner, collectionId: number, tokens: {owner: ICrossAccountId, pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFToken[]> {
1595 throw Error('Not implemented');1630 throw Error('Not implemented');
1596 const creationResult = await this.helper.executeExtrinsic(1631 const creationResult = await this.helper.executeExtrinsic(
1597 signer,1632 signer,
1611 * @example mintMultipleTokensWithOneOwner(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, [{pieces: 100000n, properties: [{key: "gender", value: "male"}]}]);1646 * @example mintMultipleTokensWithOneOwner(aliceKeyring, 10, {Substrate: "5GHoZe9c73RYbVzq..."}, [{pieces: 100000n, properties: [{key: "gender", value: "male"}]}]);
1612 * @returns array of newly created RFT tokens1647 * @returns array of newly created RFT tokens
1613 */1648 */
1614 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFTToken[]> {1649 async mintMultipleTokensWithOneOwner(signer: TSigner, collectionId: number, owner: ICrossAccountId, tokens: {pieces: bigint, properties?: IProperty[]}[]): Promise<UniqueRFToken[]> {
1615 const rawTokens = [];1650 const rawTokens = [];
1616 for (const token of tokens) {1651 for (const token of tokens) {
1617 const raw = {ReFungible: {pieces: token.pieces, properties: token.properties}};1652 const raw = {ReFungible: {pieces: token.pieces, properties: token.properties}};
1633 * @param tokenId ID of token1668 * @param tokenId ID of token
1634 * @param amount number of pieces to be burnt1669 * @param amount number of pieces to be burnt
1635 * @example burnToken(aliceKeyring, 10, 5);1670 * @example burnToken(aliceKeyring, 10, 5);
1636 * @returns ```true``` and burnt token number is extrinsic success. Otherwise ```false``` and ```null```1671 * @returns ```true``` and burnt token number, if extrinsic is successful. Otherwise ```false``` and ```null```
1637 */1672 */
1638 async burnToken(signer: IKeyringPair, collectionId: number, tokenId: number, amount=1n): Promise<{ success: boolean; token: number | null; }> {1673 async burnToken(signer: IKeyringPair, collectionId: number, tokenId: number, amount=1n): Promise<{ success: boolean; token: number | null; }> {
1639 return await super.burnToken(signer, collectionId, tokenId, amount);1674 return await super.burnToken(signer, collectionId, tokenId, amount);
1640 }1675 }
16411676
1642 /**1677 /**
1678 * Destroys a concrete instance of RFT on behalf of the owner.
1679 * @param signer keyring of signer
1680 * @param collectionId ID of collection
1681 * @param tokenId ID of token
1682 * @param fromAddressObj address on behalf of which the token will be burnt
1683 * @param amount number of pieces to be burnt
1684 * @example burnTokenFrom(aliceKeyring, 10, 5, {Substrate: "5DyN4Y92vZCjv38fg..."}, 2n)
1685 * @returns ```true``` if extrinsic success, otherwise ```false```
1686 */
1687 async burnTokenFrom(signer: IKeyringPair, collectionId: number, tokenId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {
1688 return await super.burnTokenFrom(signer, collectionId, tokenId, fromAddressObj, amount);
1689 }
1690
1691 /**
1643 * Set, change, or remove approved address to transfer the ownership of the RFT.1692 * Set, change, or remove approved address to transfer the ownership of the RFT.
1644 *1693 *
1645 * @param signer keyring of signer1694 * @param signer keyring of signer
1711 * }, 18)1760 * }, 18)
1712 * @returns newly created fungible collection1761 * @returns newly created fungible collection
1713 */1762 */
1714 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions, decimalPoints = 0): Promise<UniqueFTCollection> {1763 async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions = {}, decimalPoints = 0): Promise<UniqueFTCollection> {
1715 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object1764 collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object
1716 if(collectionOptions.tokenPropertyPermissions) throw Error('Fungible collections has no tokenPropertyPermissions');1765 if(collectionOptions.tokenPropertyPermissions) throw Error('Fungible collections has no tokenPropertyPermissions');
1717 collectionOptions.mode = {fungible: decimalPoints};1766 collectionOptions.mode = {fungible: decimalPoints};
1840 * @returns ```true``` if extrinsic success, otherwise ```false```1889 * @returns ```true``` if extrinsic success, otherwise ```false```
1841 */1890 */
1842 async burnTokensFrom(signer: IKeyringPair, collectionId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {1891 async burnTokensFrom(signer: IKeyringPair, collectionId: number, fromAddressObj: ICrossAccountId, amount=1n): Promise<boolean> {
1843 return await super.burnTokenFrom(signer, collectionId, fromAddressObj, 0, amount);1892 return await super.burnTokenFrom(signer, collectionId, 0, fromAddressObj, amount);
1844 }1893 }
18451894
1846 /**1895 /**
19361985
1937class BalanceGroup extends HelperGroup {1986class BalanceGroup extends HelperGroup {
1938 /**1987 /**
1939 * Representation of the native token in the smallest unit1988 * Representation of the native token in the smallest unit - one OPAL (OPL), QUARTZ (QTZ), or UNIQUE (UNQ).
1940 * @example getOneTokenNominal()1989 * @example getOneTokenNominal()
1941 * @returns ```BigInt``` representation of the native token in the smallest unit, e.g. ```1_000_000_000_000_000_000n``` for QTZ.1990 * @returns ```BigInt``` representation of the native token in the smallest unit, e.g. ```1_000_000_000_000_000_000n``` for QTZ.
1942 */1991 */
2017 }2066 }
20182067
2019 /**2068 /**
2069 * Normalizes the address of an account ONLY if it's Substrate to the specified ss58 format, by default ```42```.
2070 * @param account account of either Substrate type or Ethereum, but only Substrate will be changed
2071 * @param ss58Format format for address conversion, by default ```42```
2072 * @example normalizeCrossAccountIfSubstrate({Substrate: "unjKJQJrRd238pkUZZvzDQrfKuM39zBSnQ5zjAGAGcdRhaJTx"}) // returns 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
2073 * @returns untouched ethereum account or substrate account converted to normalized (i.e., starting with 5) or specified explicitly representation
2074 */
2075 normalizeCrossAccountIfSubstrate(account: ICrossAccountId, ss58Format = 42): ICrossAccountId {
2076 return account.Substrate
2077 ? {Substrate: this.normalizeSubstrate(account.Substrate, ss58Format)}
2078 : account;
2079 }
2080
2081 /**
2020 * Get address in the connected chain format2082 * Get address in the connected chain format
2021 * @param address substrate address2083 * @param address substrate address
2022 * @example normalizeSubstrateToChainFormat("5GrwvaEF5zXb26Fz...") // returns unjKJQJrRd238pkUZZ... for Unique Network2084 * @example normalizeSubstrateToChainFormat("5GrwvaEF5zXb26Fz...") // returns unjKJQJrRd238pkUZZ... for Unique Network
2161}2223}
21622224
21632225
2164class UniqueCollectionBase {2226export class UniqueBaseCollection {
2165 helper: UniqueHelper;2227 helper: UniqueHelper;
2166 collectionId: number;2228 collectionId: number;
21672229
2194 return await this.helper.collection.getEffectiveLimits(this.collectionId);2256 return await this.helper.collection.getEffectiveLimits(this.collectionId);
2195 }2257 }
21962258
2259 async getProperties(propertyKeys: string[] | null = null) {
2260 return await this.helper.collection.getProperties(this.collectionId, propertyKeys);
2261 }
2262
2263 async getTokenNextSponsored(tokenId: number, addressObj: ICrossAccountId) {
2264 return await this.helper.collection.getTokenNextSponsored(this.collectionId, tokenId, addressObj);
2265 }
2266
2197 async setSponsor(signer: TSigner, sponsorAddress: TSubstrateAccount) {2267 async setSponsor(signer: TSigner, sponsorAddress: TSubstrateAccount) {
2198 return await this.helper.collection.setSponsor(signer, this.collectionId, sponsorAddress);2268 return await this.helper.collection.setSponsor(signer, this.collectionId, sponsorAddress);
2199 }2269 }
2238 return await this.helper.collection.deleteProperties(signer, this.collectionId, propertyKeys);2308 return await this.helper.collection.deleteProperties(signer, this.collectionId, propertyKeys);
2239 }2309 }
22402310
2241 async getTokenNextSponsored(tokenId: number, addressObj: ICrossAccountId) {
2242 return await this.helper.collection.getTokenNextSponsored(this.collectionId, tokenId, addressObj);
2243 }
2244
2245 async setPermissions(signer: TSigner, permissions: ICollectionPermissions) {2311 async setPermissions(signer: TSigner, permissions: ICollectionPermissions) {
2246 return await this.helper.collection.setPermissions(signer, this.collectionId, permissions);2312 return await this.helper.collection.setPermissions(signer, this.collectionId, permissions);
2247 }2313 }
2260}2326}
22612327
22622328
2263class UniqueNFTCollection extends UniqueCollectionBase {2329export class UniqueNFTCollection extends UniqueBaseCollection {
2264 getTokenObject(tokenId: number) {2330 getTokenObject(tokenId: number) {
2265 return new UniqueNFTToken(tokenId, this);2331 return new UniqueNFToken(tokenId, this);
2266 }2332 }
22672333
2268 async getTokensByAddress(addressObj: ICrossAccountId) {2334 async getTokensByAddress(addressObj: ICrossAccountId) {
2285 return await this.helper.nft.getTokenChildren(this.collectionId, tokenId, blockHashAt);2351 return await this.helper.nft.getTokenChildren(this.collectionId, tokenId, blockHashAt);
2286 }2352 }
22872353
2354 async getPropertyPermissions(propertyKeys: string[] | null = null) {
2355 return await this.helper.nft.getPropertyPermissions(this.collectionId, propertyKeys);
2356 }
2357
2358 async getTokenProperties(tokenId: number, propertyKeys: string[] | null = null) {
2359 return await this.helper.nft.getTokenProperties(this.collectionId, tokenId, propertyKeys);
2360 }
2361
2288 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {2362 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {
2289 return await this.helper.nft.transferToken(signer, this.collectionId, tokenId, addressObj);2363 return await this.helper.nft.transferToken(signer, this.collectionId, tokenId, addressObj);
2290 }2364 }
2313 return await this.helper.nft.burnToken(signer, this.collectionId, tokenId);2387 return await this.helper.nft.burnToken(signer, this.collectionId, tokenId);
2314 }2388 }
23152389
2390 async burnTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId) {
2391 return await this.helper.nft.burnTokenFrom(signer, this.collectionId, tokenId, fromAddressObj);
2392 }
2393
2316 async setTokenProperties(signer: TSigner, tokenId: number, properties: IProperty[]) {2394 async setTokenProperties(signer: TSigner, tokenId: number, properties: IProperty[]) {
2317 return await this.helper.nft.setTokenProperties(signer, this.collectionId, tokenId, properties);2395 return await this.helper.nft.setTokenProperties(signer, this.collectionId, tokenId, properties);
2318 }2396 }
2335}2413}
23362414
23372415
2338class UniqueRFTCollection extends UniqueCollectionBase {2416export class UniqueRFTCollection extends UniqueBaseCollection {
2339 getTokenObject(tokenId: number) {2417 getTokenObject(tokenId: number) {
2340 return new UniqueRFTToken(tokenId, this);2418 return new UniqueRFToken(tokenId, this);
2341 }2419 }
23422420
2421 async getToken(tokenId: number, blockHashAt?: string) {
2422 return await this.helper.rft.getToken(this.collectionId, tokenId, [], blockHashAt);
2423 }
2424
2343 async getTokensByAddress(addressObj: ICrossAccountId) {2425 async getTokensByAddress(addressObj: ICrossAccountId) {
2344 return await this.helper.rft.getTokensByAddress(this.collectionId, addressObj);2426 return await this.helper.rft.getTokensByAddress(this.collectionId, addressObj);
2345 }2427 }
2356 return await this.helper.rft.getTokenTotalPieces(this.collectionId, tokenId);2438 return await this.helper.rft.getTokenTotalPieces(this.collectionId, tokenId);
2357 }2439 }
23582440
2441 async getTokenApprovedPieces(tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {
2442 return await this.helper.rft.getTokenApprovedPieces(this.collectionId, tokenId, toAddressObj, fromAddressObj);
2443 }
2444
2445 async getPropertyPermissions(propertyKeys: string[] | null = null) {
2446 return await this.helper.rft.getPropertyPermissions(this.collectionId, propertyKeys);
2447 }
2448
2449 async getTokenProperties(tokenId: number, propertyKeys: string[] | null = null) {
2450 return await this.helper.rft.getTokenProperties(this.collectionId, tokenId, propertyKeys);
2451 }
2452
2359 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount=1n) {2453 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount=1n) {
2360 return await this.helper.rft.transferToken(signer, this.collectionId, tokenId, addressObj, amount);2454 return await this.helper.rft.transferToken(signer, this.collectionId, tokenId, addressObj, amount);
2361 }2455 }
2368 return await this.helper.rft.approveToken(signer, this.collectionId, tokenId, toAddressObj, amount);2462 return await this.helper.rft.approveToken(signer, this.collectionId, tokenId, toAddressObj, amount);
2369 }2463 }
23702464
2371 async getTokenApprovedPieces(tokenId: number, fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {
2372 return await this.helper.rft.getTokenApprovedPieces(this.collectionId, tokenId, toAddressObj, fromAddressObj);
2373 }
2374
2375 async repartitionToken(signer: TSigner, tokenId: number, amount: bigint) {2465 async repartitionToken(signer: TSigner, tokenId: number, amount: bigint) {
2376 return await this.helper.rft.repartitionToken(signer, this.collectionId, tokenId, amount);2466 return await this.helper.rft.repartitionToken(signer, this.collectionId, tokenId, amount);
2377 }2467 }
2388 return await this.helper.rft.burnToken(signer, this.collectionId, tokenId, amount);2478 return await this.helper.rft.burnToken(signer, this.collectionId, tokenId, amount);
2389 }2479 }
23902480
2481 async burnTokenFrom(signer: TSigner, tokenId: number, fromAddressObj: ICrossAccountId, amount=1n) {
2482 return await this.helper.rft.burnTokenFrom(signer, this.collectionId, tokenId, fromAddressObj, amount);
2483 }
2484
2391 async setTokenProperties(signer: TSigner, tokenId: number, properties: IProperty[]) {2485 async setTokenProperties(signer: TSigner, tokenId: number, properties: IProperty[]) {
2392 return await this.helper.rft.setTokenProperties(signer, this.collectionId, tokenId, properties);2486 return await this.helper.rft.setTokenProperties(signer, this.collectionId, tokenId, properties);
2393 }2487 }
2402}2496}
24032497
24042498
2405class UniqueFTCollection extends UniqueCollectionBase {2499export class UniqueFTCollection extends UniqueBaseCollection {
2406 async mint(signer: TSigner, amount=1n, owner: ICrossAccountId = {Substrate: signer.address}) {2500 async getBalance(addressObj: ICrossAccountId) {
2407 return await this.helper.ft.mintTokens(signer, this.collectionId, amount, owner);2501 return await this.helper.ft.getBalance(this.collectionId, addressObj);
2408 }2502 }
24092503
2410 async mintWithOneOwner(signer: TSigner, tokens: {value: bigint}[], owner: ICrossAccountId = {Substrate: signer.address}) {2504 async getTotalPieces() {
2411 return await this.helper.ft.mintMultipleTokensWithOneOwner(signer, this.collectionId, tokens, owner);2505 return await this.helper.ft.getTotalPieces(this.collectionId);
2412 }2506 }
24132507
2414 async getBalance(addressObj: ICrossAccountId) {2508 async getApprovedTokens(fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {
2415 return await this.helper.ft.getBalance(this.collectionId, addressObj);2509 return await this.helper.ft.getApprovedTokens(this.collectionId, fromAddressObj, toAddressObj);
2416 }2510 }
24172511
2418 async getTop10Owners() {2512 async getTop10Owners() {
2419 return await this.helper.ft.getTop10Owners(this.collectionId);2513 return await this.helper.ft.getTop10Owners(this.collectionId);
2420 }2514 }
24212515
2516 async mint(signer: TSigner, amount=1n, owner: ICrossAccountId = {Substrate: signer.address}) {
2517 return await this.helper.ft.mintTokens(signer, this.collectionId, amount, owner);
2518 }
2519
2520 async mintWithOneOwner(signer: TSigner, tokens: {value: bigint}[], owner: ICrossAccountId = {Substrate: signer.address}) {
2521 return await this.helper.ft.mintMultipleTokensWithOneOwner(signer, this.collectionId, tokens, owner);
2522 }
2523
2422 async transfer(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {2524 async transfer(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {
2423 return await this.helper.ft.transfer(signer, this.collectionId, toAddressObj, amount);2525 return await this.helper.ft.transfer(signer, this.collectionId, toAddressObj, amount);
2424 }2526 }
2435 return await this.helper.ft.burnTokensFrom(signer, this.collectionId, fromAddressObj, amount);2537 return await this.helper.ft.burnTokensFrom(signer, this.collectionId, fromAddressObj, amount);
2436 }2538 }
24372539
2438 async getTotalPieces() {
2439 return await this.helper.ft.getTotalPieces(this.collectionId);
2440 }
2441
2442 async approveTokens(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {2540 async approveTokens(signer: TSigner, toAddressObj: ICrossAccountId, amount=1n) {
2443 return await this.helper.ft.approveTokens(signer, this.collectionId, toAddressObj, amount);2541 return await this.helper.ft.approveTokens(signer, this.collectionId, toAddressObj, amount);
2444 }2542 }
2445
2446 async getApprovedTokens(fromAddressObj: ICrossAccountId, toAddressObj: ICrossAccountId) {
2447 return await this.helper.ft.getApprovedTokens(this.collectionId, fromAddressObj, toAddressObj);
2448 }
2449}2543}
24502544
24512545
2452class UniqueTokenBase implements IToken {2546export class UniqueBaseToken {
2453 collection: UniqueNFTCollection | UniqueRFTCollection;2547 collection: UniqueNFTCollection | UniqueRFTCollection;
2454 collectionId: number;2548 collectionId: number;
2455 tokenId: number;2549 tokenId: number;
2464 return await this.collection.getTokenNextSponsored(this.tokenId, addressObj);2558 return await this.collection.getTokenNextSponsored(this.tokenId, addressObj);
2465 }2559 }
24662560
2561 async getProperties(propertyKeys: string[] | null = null) {
2562 return await this.collection.getTokenProperties(this.tokenId, propertyKeys);
2563 }
2564
2467 async setProperties(signer: TSigner, properties: IProperty[]) {2565 async setProperties(signer: TSigner, properties: IProperty[]) {
2468 return await this.collection.setTokenProperties(signer, this.tokenId, properties);2566 return await this.collection.setTokenProperties(signer, this.tokenId, properties);
2469 }2567 }
24702568
2471 async deleteProperties(signer: TSigner, propertyKeys: string[]) {2569 async deleteProperties(signer: TSigner, propertyKeys: string[]) {
2472 return await this.collection.deleteTokenProperties(signer, this.tokenId, propertyKeys);2570 return await this.collection.deleteTokenProperties(signer, this.tokenId, propertyKeys);
2473 }2571 }
2572
2573 nestingAccount() {
2574 return this.collection.helper.util.getTokenAccount(this);
2575 }
2576
2577 nestingAccountInLowerCase() {
2578 return this.collection.helper.util.getTokenAccountInLowerCase(this);
2579 }
2474}2580}
24752581
24762582
2477class UniqueNFTToken extends UniqueTokenBase {2583export class UniqueNFToken extends UniqueBaseToken {
2478 collection: UniqueNFTCollection;2584 collection: UniqueNFTCollection;
24792585
2480 constructor(tokenId: number, collection: UniqueNFTCollection) {2586 constructor(tokenId: number, collection: UniqueNFTCollection) {
2525 async burn(signer: TSigner) {2631 async burn(signer: TSigner) {
2526 return await this.collection.burnToken(signer, this.tokenId);2632 return await this.collection.burnToken(signer, this.tokenId);
2527 }2633 }
2634
2635 async burnFrom(signer: TSigner, fromAddressObj: ICrossAccountId) {
2636 return await this.collection.burnTokenFrom(signer, this.tokenId, fromAddressObj);
2637 }
2528}2638}
25292639
2530class UniqueRFTToken extends UniqueTokenBase {2640export class UniqueRFToken extends UniqueBaseToken {
2531 collection: UniqueRFTCollection;2641 collection: UniqueRFTCollection;
25322642
2533 constructor(tokenId: number, collection: UniqueRFTCollection) {2643 constructor(tokenId: number, collection: UniqueRFTCollection) {
2534 super(tokenId, collection);2644 super(tokenId, collection);
2535 this.collection = collection;2645 this.collection = collection;
2536 }2646 }
25372647
2648 async getData(blockHashAt?: string) {
2649 return await this.collection.getToken(this.tokenId, blockHashAt);
2650 }
2651
2538 async getTop10Owners() {2652 async getTop10Owners() {
2539 return await this.collection.getTop10TokenOwners(this.tokenId);2653 return await this.collection.getTop10TokenOwners(this.tokenId);
2540 }2654 }
2547 return await this.collection.getTokenTotalPieces(this.tokenId);2661 return await this.collection.getTokenTotalPieces(this.tokenId);
2548 }2662 }
25492663
2664 async getApprovedPieces(fromAddressObj: ICrossAccountId, toAccountObj: ICrossAccountId) {
2665 return await this.collection.getTokenApprovedPieces(this.tokenId, fromAddressObj, toAccountObj);
2666 }
2667
2550 async transfer(signer: TSigner, addressObj: ICrossAccountId, amount=1n) {2668 async transfer(signer: TSigner, addressObj: ICrossAccountId, amount=1n) {
2551 return await this.collection.transferToken(signer, this.tokenId, addressObj, amount);2669 return await this.collection.transferToken(signer, this.tokenId, addressObj, amount);
2552 }2670 }
2559 return await this.collection.approveToken(signer, this.tokenId, toAddressObj, amount);2677 return await this.collection.approveToken(signer, this.tokenId, toAddressObj, amount);
2560 }2678 }
25612679
2562 async getApprovedPieces(fromAddressObj: ICrossAccountId, toAccountObj: ICrossAccountId) {
2563 return await this.collection.getTokenApprovedPieces(this.tokenId, fromAddressObj, toAccountObj);
2564 }
2565
2566 async repartition(signer: TSigner, amount: bigint) {2680 async repartition(signer: TSigner, amount: bigint) {
2567 return await this.collection.repartitionToken(signer, this.tokenId, amount);2681 return await this.collection.repartitionToken(signer, this.tokenId, amount);
2568 }2682 }
25692683
2570 async burn(signer: TSigner, amount=1n) {2684 async burn(signer: TSigner, amount=1n) {
2571 return await this.collection.burnToken(signer, this.tokenId, amount);2685 return await this.collection.burnToken(signer, this.tokenId, amount);
2686 }
2687
2688 async burnFrom(signer: TSigner, fromAddressObj: ICrossAccountId, amount=1n) {
2689 return await this.collection.burnTokenFrom(signer, this.tokenId, fromAddressObj, amount);
2572 }2690 }
2573}2691}
25742692