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

difftreelog

wip migrating confirmSponsorship

rkv2022-09-09parent: #ad65cb1.patch.diff
in: master

2 files changed

modifiedtests/package.jsondiffbeforeafterboth
before · tests/package.json
1{2  "name": "unique-tests",3  "version": "1.0.0",4  "description": "Unique Chain Tests",5  "main": "",6  "devDependencies": {7    "@polkadot/ts": "0.4.22",8    "@polkadot/typegen": "9.2.2",9    "@types/chai": "^4.3.1",10    "@types/chai-as-promised": "^7.1.5",11    "@types/chai-like": "^1.1.1",12    "@types/mocha": "^9.1.1",13    "@types/node": "^17.0.35",14    "@typescript-eslint/eslint-plugin": "^5.26.0",15    "@typescript-eslint/parser": "^5.26.0",16    "chai": "^4.3.6",17    "eslint": "^8.16.0",18    "mocha": "^10.0.0",19    "ts-node": "^10.8.0",20    "typescript": "^4.7.2"21  },22  "mocha": {23    "timeout": 9999999,24    "require": "ts-node/register"25  },26  "scripts": {27    "lint": "eslint --ext .ts,.js src/",28    "fix": "eslint --ext .ts,.js src/ --fix",29    "test": "mocha --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",30    "testEth": "mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.test.ts'",31    "testEthMarketplace": "mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.test.ts'",32    "testEthNesting": "mocha --timeout 9999999 -r ts-node/register './**/eth/nesting/**/*.test.ts'",33    "testEthPayable": "mocha --timeout 9999999 -r ts-node/register './**/eth/payable.test.ts'",34    "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",35    "loadTransfer": "ts-node src/transfer.nload.ts",36    "testCollision": "mocha --timeout 9999999 -r ts-node/register ./src/collision-tests/*.test.ts",37    "testEvent": "mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.test.ts",38    "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",39    "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",40    "testStructure": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/**.test.ts",41    "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts",42    "testMigration": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",43    "testRmrk": "mocha --timeout 9999999 -r ts-node/register ./**/rmrk/**.test.ts",44    "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",45    "testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",46    "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",47    "testSetCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionSponsor.test.ts",48    "testConfirmSponsorship": "mocha --timeout 9999999 -r ts-node/register ./**/confirmSponsorship.test.ts",49    "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",50    "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",51    "testRemoveFromAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromAllowList.test.ts",52    "testAllowLists": "mocha --timeout 9999999 -r ts-node/register ./**/allowLists.test.ts",53    "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",54    "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",55    "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",56    "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",57    "testCreateMultipleItemsEx": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItemsEx.test.ts",58    "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",59    "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",60    "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",61    "testDestroyCollection": "mocha --timeout 9999999 -r ts-node/register ./**/destroyCollection.test.ts",62    "testToggleContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractAllowList.test.ts",63    "testAddToContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractAllowList.test.ts",64    "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",65    "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts",66    "testAdminTransferAndBurn": "mocha --timeout 9999999 -r ts-node/register ./**/adminTransferAndBurn.test.ts",67    "testSetMintPermission": "mocha --timeout 9999999 -r ts-node/register ./**/setMintPermission.test.ts",68    "testSetPublicAccessMode": "mocha --timeout 9999999 -r ts-node/register ./**/setPublicAccessMode.test.ts",69    "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.test.ts",70    "testContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/contractSponsoring.test.ts",71    "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",72    "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",73    "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",74    "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",75    "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",76    "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.test.ts",77    "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.test.ts",78    "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",79    "testXcmTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/xcmTransfer.test.ts",80    "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",81    "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",82    "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",83    "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",84    "testEthCreateNFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createNFTCollection.test.ts",85    "testEthCreateRFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createRFTCollection.test.ts",86    "testRFT": "mocha --timeout 9999999 -r ts-node/register ./**/refungible.test.ts",87    "testFT": "mocha --timeout 9999999 -r ts-node/register ./**/fungible.test.ts",88    "testRPC": "mocha --timeout 9999999 -r ts-node/register ./**/rpc.test.ts",89    "testPromotion": "mocha --timeout 9999999 -r ts-node/register ./**/app-promotion.test.ts",90    "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",91    "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",92    "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",93    "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"94  },95  "author": "",96  "license": "SEE LICENSE IN ../LICENSE",97  "homepage": "",98  "dependencies": {99    "@polkadot/api": "9.2.2",100    "@polkadot/api-contract": "9.2.2",101    "@polkadot/util-crypto": "10.1.1",102    "bignumber.js": "^9.0.2",103    "chai-as-promised": "^7.1.1",104    "chai-like": "^1.1.1",105    "find-process": "^1.4.7",106    "solc": "0.8.14-fixed",107    "web3": "^1.7.3"108  },109  "standard": {110    "globals": [111      "it",112      "assert",113      "beforeEach",114      "afterEach",115      "describe",116      "contract",117      "artifacts"118    ]119  },120  "resolutions": {121    "simple-get": "^4.0.1"122  }123}
after · tests/package.json
1{2  "name": "unique-tests",3  "version": "1.0.0",4  "description": "Unique Chain Tests",5  "main": "",6  "devDependencies": {7    "@polkadot/ts": "0.4.22",8    "@polkadot/typegen": "9.2.2",9    "@types/chai": "^4.3.1",10    "@types/chai-as-promised": "^7.1.5",11    "@types/chai-like": "^1.1.1",12    "@types/mocha": "^9.1.1",13    "@types/node": "^17.0.35",14    "@typescript-eslint/eslint-plugin": "^5.26.0",15    "@typescript-eslint/parser": "^5.26.0",16    "chai": "^4.3.6",17    "eslint": "^8.16.0",18    "mocha": "^10.0.0",19    "ts-node": "^10.8.0",20    "typescript": "^4.7.2"21  },22  "mocha": {23    "timeout": 9999999,24    "require": "ts-node/register"25  },26  "scripts": {27    "lint": "eslint --ext .ts,.js src/",28    "fix": "eslint --ext .ts,.js src/ --fix",29    "test": "mocha --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",30    "testEth": "mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.test.ts'",31    "testEthMarketplace": "mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.test.ts'",32    "testEthNesting": "mocha --timeout 9999999 -r ts-node/register './**/eth/nesting/**/*.test.ts'",33    "testEthPayable": "mocha --timeout 9999999 -r ts-node/register './**/eth/payable.test.ts'",34    "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",35    "loadTransfer": "ts-node src/transfer.nload.ts",36    "testCollision": "mocha --timeout 9999999 -r ts-node/register ./src/collision-tests/*.test.ts",37    "testEvent": "mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.test.ts",38    "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",39    "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",40    "testStructure": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/**.test.ts",41    "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts",42    "testMigration": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",43    "testRmrk": "mocha --timeout 9999999 -r ts-node/register ./**/rmrk/**.test.ts",44    "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",45    "testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",46    "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",47    "testChangeCollectionOwner": "mocha --timeout 9999999 -r ts-node/register ./**/change-collection-owner.test.ts",48    "testSetCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionSponsor.test.ts",49    "testConfirmSponsorship": "mocha --timeout 9999999 -r ts-node/register ./**/confirmSponsorship.test.ts",50    "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",51    "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",52    "testRemoveFromAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromAllowList.test.ts",53    "testAllowLists": "mocha --timeout 9999999 -r ts-node/register ./**/allowLists.test.ts",54    "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",55    "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",56    "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",57    "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",58    "testCreateMultipleItemsEx": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItemsEx.test.ts",59    "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",60    "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",61    "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",62    "testDestroyCollection": "mocha --timeout 9999999 -r ts-node/register ./**/destroyCollection.test.ts",63    "testToggleContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractAllowList.test.ts",64    "testAddToContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractAllowList.test.ts",65    "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",66    "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts",67    "testAdminTransferAndBurn": "mocha --timeout 9999999 -r ts-node/register ./**/adminTransferAndBurn.test.ts",68    "testSetMintPermission": "mocha --timeout 9999999 -r ts-node/register ./**/setMintPermission.test.ts",69    "testSetPublicAccessMode": "mocha --timeout 9999999 -r ts-node/register ./**/setPublicAccessMode.test.ts",70    "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.test.ts",71    "testContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/contractSponsoring.test.ts",72    "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",73    "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",74    "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",75    "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",76    "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",77    "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.test.ts",78    "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.test.ts",79    "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",80    "testXcmTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/xcmTransfer.test.ts",81    "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",82    "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",83    "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",84    "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",85    "testEthCreateNFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createNFTCollection.test.ts",86    "testEthCreateRFTCollection": "mocha --timeout 9999999 -r ts-node/register ./**/eth/createRFTCollection.test.ts",87    "testRFT": "mocha --timeout 9999999 -r ts-node/register ./**/refungible.test.ts",88    "testFT": "mocha --timeout 9999999 -r ts-node/register ./**/fungible.test.ts",89    "testRPC": "mocha --timeout 9999999 -r ts-node/register ./**/rpc.test.ts",90    "testPromotion": "mocha --timeout 9999999 -r ts-node/register ./**/app-promotion.test.ts",91    "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",92    "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",93    "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",94    "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"95  },96  "author": "",97  "license": "SEE LICENSE IN ../LICENSE",98  "homepage": "",99  "dependencies": {100    "@polkadot/api": "9.2.2",101    "@polkadot/api-contract": "9.2.2",102    "@polkadot/util-crypto": "10.1.1",103    "bignumber.js": "^9.0.2",104    "chai-as-promised": "^7.1.1",105    "chai-like": "^1.1.1",106    "find-process": "^1.4.7",107    "solc": "0.8.14-fixed",108    "web3": "^1.7.3"109  },110  "standard": {111    "globals": [112      "it",113      "assert",114      "beforeEach",115      "afterEach",116      "describe",117      "contract",118      "artifacts"119    ]120  },121  "resolutions": {122    "simple-get": "^4.0.1"123  }124}
modifiedtests/src/confirmSponsorship.test.tsdiffbeforeafterboth
--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -37,10 +37,19 @@
   Pallets,
 } from './util/helpers';
 import {IKeyringPair} from '@polkadot/types/types';
+import {usingPlaygrounds} from './util/playgrounds';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
 
+let donor: IKeyringPair;
+
+before(async () => {
+  await usingPlaygrounds(async (_, privateKey) => {
+    donor = privateKey('//Alice');
+  });
+});
+
 let alice: IKeyringPair;
 let bob: IKeyringPair;
 let charlie: IKeyringPair;
@@ -48,289 +57,162 @@
 describe('integration test: ext. confirmSponsorship():', () => {
 
   before(async () => {
-    await usingApi(async (api, privateKeyWrapper) => {
-      alice = privateKeyWrapper('//Alice');
-      bob = privateKeyWrapper('//Bob');
-      charlie = privateKeyWrapper('//Charlie');
+    await usingPlaygrounds(async (helper) => {
+      [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 0n], donor);
     });
   });
 
   it('Confirm collection sponsorship', async () => {
-    const collectionId = await createCollectionExpectSuccess();
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
+    });
   });
+
   it('Add sponsor to a collection after the same sponsor was already added and confirmed', async () => {
-    const collectionId = await createCollectionExpectSuccess();
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
+      await collection.setSponsor(alice, bob.address);
+    });
   });
   it('Add new sponsor to a collection after another sponsor was already added and confirmed', async () => {
-    const collectionId = await createCollectionExpectSuccess();
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-    await setCollectionSponsorExpectSuccess(collectionId, charlie.address);
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(charlie);
+    });
   });
 
   it('NFT: Transfer fees are paid by the sponsor after confirmation', async () => {
-    const collectionId = await createCollectionExpectSuccess();
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-
-    await usingApi(async (api, privateKeyWrapper) => {
-      const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      // Find unused address
-      const zeroBalance = await findUnusedAddress(api, privateKeyWrapper);
-
-      // Mint token for unused address
-      const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', zeroBalance.address);
-
-      // Transfer this tokens from unused address to Alice
-      const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 0);
-      const events = await submitTransactionAsync(zeroBalance, zeroToAlice);
-      const result = getGenericResult(events);
-      expect(result.success).to.be.true;
-
-      const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
+      const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
+      const token = await collection.mintToken(alice, {Substrate: charlie.address});
+      await token.transfer(charlie, {Substrate: alice.address});
+      const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
+      expect(bobBalanceAfter < bobBalanceBefore).to.be.true;
     });
-
   });
 
   it('Fungible: Transfer fees are paid by the sponsor after confirmation', async () => {
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-
-    await usingApi(async (api, privateKeyWrapper) => {
-      const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      // Find unused address
-      const zeroBalance = await findUnusedAddress(api, privateKeyWrapper);
-
-      // Mint token for unused address
-      const itemId = await createItemExpectSuccess(alice, collectionId, 'Fungible', zeroBalance.address);
-
-      // Transfer this tokens from unused address to Alice
-      const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);
-      const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);
-      const result1 = getGenericResult(events1);
-      expect(result1.success).to.be.true;
-
-      const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
+      const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
+      await collection.mint(alice, {Substrate: charlie.address}, 100n);
+      await collection.transfer(charlie, {Substrate: alice.address}, 1n);
+      const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
+      expect(bobBalanceAfter < bobBalanceBefore).to.be.true;
     });
   });
 
   it('ReFungible: Transfer fees are paid by the sponsor after confirmation', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
-
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-
-    await usingApi(async (api, privateKeyWrapper) => {
-      const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      // Find unused address
-      const zeroBalance = await findUnusedAddress(api, privateKeyWrapper);
-
-      // Mint token for unused address
-      const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', zeroBalance.address);
-
-      // Transfer this tokens from unused address to Alice
-      const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);
-      const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);
-      const result1 = getGenericResult(events1);
-
-      const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      expect(result1.success).to.be.true;
-      expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
+      const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
+      const token = await collection.mintToken(alice, {Substrate: charlie.address}, 100n);
+      await token.transfer(charlie, {Substrate: alice.address}, 1n);
+      const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
+      expect(bobBalanceAfter < bobBalanceBefore).to.be.true;
     });
   });
 
   it('CreateItem fees are paid by the sponsor after confirmation', async () => {
-    const collectionId = await createCollectionExpectSuccess();
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
+      await collection.setPermissions(alice, {access: 'AllowList', mintMode: true});
+      await collection.addToAllowList(alice, {Substrate: charlie.address});
 
-    // Enable collection allow list
-    await enableAllowListExpectSuccess(alice, collectionId);
-
-    // Enable public minting
-    await enablePublicMintingExpectSuccess(alice, collectionId);
-
-    // Create Item
-    await usingApi(async (api, privateKeyWrapper) => {
-      const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      // Find unused address
-      const zeroBalance = await findUnusedAddress(api, privateKeyWrapper);
+      const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
+      await collection.mintToken(charlie, {Substrate: charlie.address});
+      const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
 
-      // Add zeroBalance address to allow list
-      await addToAllowListExpectSuccess(alice, collectionId, zeroBalance.address);
-
-      // Mint token using unused address as signer
-      await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);
-
-      const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      expect(sponsorBalanceAfter < sponsorBalanceBefore).to.be.true;
+      expect(bobBalanceAfter < bobBalanceBefore).to.be.true;
     });
   });
 
   it('NFT: Sponsoring of transfers is rate limited', async () => {
-    const collectionId = await createCollectionExpectSuccess();
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-
-    await usingApi(async (api, privateKeyWrapper) => {
-      // Find unused address
-      const zeroBalance = await findUnusedAddress(api, privateKeyWrapper);
-
-      // Mint token for alice
-      const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', alice.address);
-
-      // Transfer this token from Alice to unused address and back
-      // Alice to Zero gets sponsored
-      const aliceToZero = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 0);
-      const events1 = await submitTransactionAsync(alice, aliceToZero);
-      const result1 = getGenericResult(events1);
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
 
-      // Second transfer should fail
-      const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
-      const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0);
-      const badTransaction = async function () {
-        await submitTransactionExpectFailAsync(zeroBalance, zeroToAlice);
-      };
-      await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees');
-      const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
+      const token = await collection.mintToken(alice, {Substrate: alice.address});
+      await token.transfer(alice, {Substrate: charlie.address});
+      const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
 
-      // Try again after Zero gets some balance - now it should succeed
-      const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
-      await submitTransactionAsync(alice, balancetx);
-      const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);
-      const result2 = getGenericResult(events2);
+      const transferTx = async () => token.transfer(charlie, {Substrate: alice.address});
+      await expect(transferTx()).to.be.rejectedWith('Inability to pay some fees');
+      const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
 
-      expect(result1.success).to.be.true;
-      expect(result2.success).to.be.true;
-      expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);
+      expect(bobBalanceAfter === bobBalanceBefore).to.be.true;
     });
   });
 
   it('Fungible: Sponsoring is rate limited', async () => {
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
 
-    await usingApi(async (api, privateKeyWrapper) => {
-      // Find unused address
-      const zeroBalance = await findUnusedAddress(api, privateKeyWrapper);
+      await collection.mint(alice, {Substrate: charlie.address}, 100n);
+      await collection.transfer(charlie, {Substrate: charlie.address}, 1n);
+      const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
 
-      // Mint token for unused address
-      const itemId = await createItemExpectSuccess(alice, collectionId, 'Fungible', zeroBalance.address);
-
-      // Transfer this tokens in parts from unused address to Alice
-      const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(zeroBalance.address), collectionId, itemId, 1);
-      const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);
-      const result1 = getGenericResult(events1);
-      expect(result1.success).to.be.true;
-
-      const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
-      await expect(submitTransactionExpectFailAsync(zeroBalance, zeroToAlice)).to.be.rejected;
-      const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
+      const transferTx = async () => collection.transfer(charlie, {Substrate: charlie.address});
+      await expect(transferTx()).to.be.rejected;
+      const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
 
-      // Try again after Zero gets some balance - now it should succeed
-      const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
-      await submitTransactionAsync(alice, balancetx);
-      const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);
-      const result2 = getGenericResult(events2);
-      expect(result2.success).to.be.true;
-
-      expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);
+      expect(bobBalanceAfter === bobBalanceBefore).to.be.true;
     });
   });
 
   it('ReFungible: Sponsoring is rate limited', async function() {
-    await requirePallets(this, [Pallets.ReFungible]);
-
-    const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
 
-    await usingApi(async (api, privateKeyWrapper) => {
-      // Find unused address
-      const zeroBalance = await findUnusedAddress(api, privateKeyWrapper);
+      const token = await collection.mintToken(alice, {Substrate: charlie.address}, 100n);
+      await token.transfer(charlie, {Substrate: alice.address});
 
-      // Mint token for alice
-      const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', zeroBalance.address);
+      const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
+      const transferTx = async () => token.transfer(charlie, {Substrate: alice.address});
+      await expect(transferTx()).to.be.rejectedWith('Inability to pay some fees');
+      const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
 
-      const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 1);
-
-      // Zero to alice gets sponsored
-      const events1 = await submitTransactionAsync(zeroBalance, zeroToAlice);
-      const result1 = getGenericResult(events1);
-      expect(result1.success).to.be.true;
-
-      // Second transfer should fail
-      const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
-      await expect(submitTransactionExpectFailAsync(zeroBalance, zeroToAlice)).to.be.rejectedWith('Inability to pay some fees');
-      const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
-      expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);
-
-      // Try again after Zero gets some balance - now it should succeed
-      const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
-      await submitTransactionAsync(alice, balancetx);
-      const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);
-      const result2 = getGenericResult(events2);
-      expect(result2.success).to.be.true;
+      expect(bobBalanceAfter === bobBalanceBefore).to.be.true;
     });
   });
 
   it('NFT: Sponsoring of createItem is rate limited', async () => {
-    const collectionId = await createCollectionExpectSuccess();
-    await setCollectionSponsorExpectSuccess(collectionId, bob.address);
-    await confirmSponsorshipExpectSuccess(collectionId, '//Bob');
-
-    // Enable collection allow list
-    await enableAllowListExpectSuccess(alice, collectionId);
+    await usingPlaygrounds(async (helper) => {
+      const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
+      await collection.setSponsor(alice, bob.address);
+      await collection.confirmSponsorship(bob);
+      await collection.setPermissions(alice, {mintMode: true, access: 'AllowList'});
+      await collection.addToAllowList(alice, {Substrate: charlie.address});
 
-    // Enable public minting
-    await enablePublicMintingExpectSuccess(alice, collectionId);
+      await collection.mintToken(charlie, {Substrate: charlie.address});
 
-    await usingApi(async (api, privateKeyWrapper) => {
-      // Find unused address
-      const zeroBalance = await findUnusedAddress(api, privateKeyWrapper);
+      const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
+      const mintTx = async () => collection.mintToken(charlie, {Substrate: charlie.address});
+      await expect(mintTx()).to.be.rejectedWith('Inability to pay some fees');
+      const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
 
-      // Add zeroBalance address to allow list
-      await addToAllowListExpectSuccess(alice, collectionId, zeroBalance.address);
-
-      // Mint token using unused address as signer - gets sponsored
-      await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);
-
-      // Second mint should fail
-      const sponsorBalanceBefore = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      const badTransaction = async function () {
-        await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);
-      };
-      await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees');
-      const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
-
-      // Try again after Zero gets some balance - now it should succeed
-      const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
-      await submitTransactionAsync(alice, balancetx);
-      await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);
-
-      expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);
+      expect(bobBalanceAfter === bobBalanceBefore).to.be.true;
     });
   });
-
 });
 
 describe('(!negative test!) integration test: ext. confirmSponsorship():', () => {