git.delta.rocks / unique-network / refs/commits / 698c51fd21a7

difftreelog

fix move RMRK needed parts of deprecated helpers

Daniel Shiposha2022-10-11parent: #681fe40.patch.diff
in: master

20 files changed

modifiedtests/src/rmrk/acceptNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/acceptNft.test.ts
+++ b/tests/src/rmrk/acceptNft.test.ts
@@ -7,8 +7,7 @@
   acceptNft,
 } from './util/tx';
 import {NftIdTuple} from './util/fetch';
-import {isNftChildOfAnother, expectTxFailure} from './util/helpers';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
+import {isNftChildOfAnother, expectTxFailure, requirePallets, Pallets} from './util/helpers';
 
 describe('integration test: accept NFT', () => {
   let api: any;
modifiedtests/src/rmrk/addResource.test.tsdiffbeforeafterboth
before · tests/src/rmrk/addResource.test.ts
1import {expect} from 'chai';2import {getApiConnection} from '../substrate/substrate-api';3import {NftIdTuple} from './util/fetch';4import {expectTxFailure, getResourceById} from './util/helpers';5import {6  addNftBasicResource,7  acceptNftResource,8  createCollection,9  mintNft,10  sendNft,11  addNftSlotResource,12  addNftComposableResource,13} from './util/tx';14import {RmrkTraitsResourceResourceInfo as ResourceInfo} from '@polkadot/types/lookup';15import {requirePallets, Pallets} from '../deprecated-helpers/helpers';1617describe('integration test: add NFT resource', () => {18  const Alice = '//Alice';19  const Bob = '//Bob';20  const src = 'test-res-src';21  const metadata = 'test-res-metadata';22  const license = 'test-res-license';23  const thumb = 'test-res-thumb';2425  const nonexistentId = 99999;2627  let api: any;28  before(async function() {29    api = await getApiConnection();30    await requirePallets(this, [Pallets.RmrkCore]);31  });3233  it('add resource', async () => {34    const collectionIdAlice = await createCollection(35      api,36      Alice,37      'test-metadata',38      null,39      'test-symbol',40    );4142    const nftAlice = await mintNft(43      api,44      Alice,45      Alice,46      collectionIdAlice,47      'nft-metadata',48    );4950    await addNftBasicResource(51      api,52      Alice,53      'added',54      collectionIdAlice,55      nftAlice,56      src,57      metadata,58      license,59      thumb,60    );61  });6263  it('add a resource to the nested NFT', async () => {64    const collectionIdAlice = await createCollection(65      api,66      Alice,67      'test-metadata',68      null,69      'test-symbol',70    );7172    const parentNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'parent-nft-metadata');73    const childNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'child-nft-metadata');7475    const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];7677    await sendNft(api, 'sent', Alice, collectionIdAlice, childNftId, newOwnerNFT);7879    await addNftBasicResource(80      api,81      Alice,82      'added',83      collectionIdAlice,84      childNftId,85      src,86      metadata,87      license,88      thumb,89    );90  });9192  it('add multiple resources', async () => {93    const collectionIdAlice = await createCollection(94      api,95      Alice,96      'test-metadata',97      null,98      'test-symbol',99    );100101    const nftAlice = await mintNft(102      api,103      Alice,104      Alice,105      collectionIdAlice,106      'nft-metadata',107    );108109    const baseId = 42;110    const slotId = 10;111    const parts = [0, 5, 2];112113    const resourcesInfo = [];114    const resourceNum = 4;115116    const checkResource = async (resource: ResourceInfo, resType: string, expectedId: number, expected: {117      src: string,118      metadata: string,119      license: string,120      thumb: string121    }) => {122123      // FIXME A workaround. It seems it is a PolkadotJS bug.124      // All of the following are `false`.125      //126      // console.log('>>> basic:', resource.resource.isBasic);127      // console.log('>>> composable:', resource.resource.isComposable);128      // console.log('>>> slot:', resource.resource.isSlot);129      const resourceJson = (resource.resource.toHuman() as any)[resType];130131      expect(resource.id.toNumber(), 'Error: Invalid resource Id')132        .to.be.eq(expectedId);133134      expect(resourceJson.src, 'Error: Invalid resource src')135        .to.be.eq(expected.src);136      expect(resourceJson.metadata, 'Error: Invalid resource metadata')137        .to.be.eq(expected.metadata);138      expect(resourceJson.license, 'Error: Invalid resource license')139        .to.be.eq(expected.license);140      expect(resourceJson.thumb, 'Error: Invalid resource thumb')141        .to.be.eq(expected.thumb);142    };143144    for (let i = 0; i < resourceNum; i++) {145      resourcesInfo.push({146        src: src + 'r-' + i,147        metadata: metadata + 'r-' + i,148        license: license + 'r-' + i,149        thumb: thumb + 'r-' + i,150      });151    }152153    const firstBasicResourceId = await addNftBasicResource(154      api,155      Alice,156      'added',157      collectionIdAlice,158      nftAlice,159      resourcesInfo[0].src,160      resourcesInfo[0].metadata,161      resourcesInfo[0].license,162      resourcesInfo[0].thumb,163    );164165    const secondBasicResourceId = await addNftBasicResource(166      api,167      Alice,168      'added',169      collectionIdAlice,170      nftAlice,171      resourcesInfo[1].src,172      resourcesInfo[1].metadata,173      resourcesInfo[1].license,174      resourcesInfo[1].thumb,175    );176177    const composableResourceId = await addNftComposableResource(178      api,179      Alice,180      'added',181      collectionIdAlice,182      nftAlice,183      parts,184      baseId,185      resourcesInfo[2].src,186      resourcesInfo[2].metadata,187      resourcesInfo[2].license,188      resourcesInfo[2].thumb,189    );190191    const slotResourceId = await addNftSlotResource(192      api,193      Alice,194      'added',195      collectionIdAlice,196      nftAlice,197      baseId,198      slotId,199      resourcesInfo[3].src,200      resourcesInfo[3].metadata,201      resourcesInfo[3].license,202      resourcesInfo[3].thumb,203    );204205    const firstResource = await getResourceById(api, collectionIdAlice, nftAlice, firstBasicResourceId);206    await checkResource(firstResource, 'Basic', firstBasicResourceId, resourcesInfo[0]);207208    const secondResource = await getResourceById(api, collectionIdAlice, nftAlice, secondBasicResourceId);209    await checkResource(secondResource, 'Basic', secondBasicResourceId, resourcesInfo[1]);210211    const composableResource = await getResourceById(api, collectionIdAlice, nftAlice, composableResourceId);212    await checkResource(composableResource, 'Composable', composableResourceId, resourcesInfo[2]);213214    const slotResource = await getResourceById(api, collectionIdAlice, nftAlice, slotResourceId);215    await checkResource(slotResource, 'Slot', slotResourceId, resourcesInfo[3]);216  });217218  it('[negative]: unable to add a resource to the non-existing NFT', async () => {219    const collectionIdAlice = await createCollection(220      api,221      Alice,222      'test-metadata',223      null,224      'test-symbol',225    );226227    const tx = addNftBasicResource(228      api,229      Alice,230      'added',231      collectionIdAlice,232      nonexistentId,233      src,234      metadata,235      license,236      thumb,237    );238  239    await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);240  });241242  it('[negative]: unable to add a resource by a not-an-owner user', async () => {243    const collectionIdAlice = await createCollection(244      api,245      Alice,246      'test-metadata',247      null,248      'test-symbol',249    );250251    const nftAlice = await mintNft(252      api,253      Alice,254      Alice,255      collectionIdAlice,256      'nft-metadata',257    );258259    const tx = addNftBasicResource(260      api,261      Bob,262      'added',263      collectionIdAlice,264      nftAlice,265      src,266      metadata,267      license,268      thumb,269    );270  271    await expectTxFailure(/rmrkCore\.NoPermission/, tx);272  });273274  it('[negative]: unable to add a resource to the nested NFT if it isnt root owned by the caller', async () => {275    const collectionIdAlice = await createCollection(276      api,277      Alice,278      'test-metadata',279      null,280      'test-symbol',281    );282283    const parentNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'parent-nft-metadata');284    const childNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'child-nft-metadata');285286    const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];287288    await sendNft(api, 'sent', Alice, collectionIdAlice, childNftId, newOwnerNFT);289290    const tx = addNftBasicResource(291      api,292      Bob,293      'added',294      collectionIdAlice,295      childNftId,296      src,297      metadata,298      license,299      thumb,300    );301    302    await expectTxFailure(/rmrkCore\.NoPermission/, tx);303  });304305  it('accept resource', async () => {306    const collectionIdBob = await createCollection(307      api,308      Bob,309      'test-metadata',310      null,311      'test-symbol',312    );313314    const nftAlice = await mintNft(315      api,316      Bob,317      Alice,318      collectionIdBob,319      'nft-metadata',320    );321322    const resourceId = await addNftBasicResource(323      api,324      Bob,325      'pending',326      collectionIdBob,327      nftAlice,328      src,329      metadata,330      license,331      thumb,332    );333334    await acceptNftResource(api, Alice, collectionIdBob, nftAlice, resourceId);335  });336337  it('[negative]: unable to accept a non-existing resource', async () => {338    const collectionIdBob = await createCollection(339      api,340      Bob,341      'test-metadata',342      null,343      'test-symbol',344    );345346    const nftAlice = await mintNft(347      api,348      Bob,349      Alice,350      collectionIdBob,351      'nft-metadata',352    );353354    const tx = acceptNftResource(api, Alice, collectionIdBob, nftAlice, nonexistentId);355    await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);356  });357358  it('[negative]: unable to accept a resource by a not-an-NFT-owner user', async () => {359    const collectionIdBob = await createCollection(360      api,361      Bob,362      'test-metadata',363      null,364      'test-symbol',365    );366367    const nftAlice = await mintNft(368      api,369      Bob,370      Alice,371      collectionIdBob,372      'nft-metadata',373    );374375    const resourceId = await addNftBasicResource(376      api,377      Bob,378      'pending',379      collectionIdBob,380      nftAlice,381      src,382      metadata,383      license,384      thumb,385    );386387    const tx = acceptNftResource(api, Bob, collectionIdBob, nftAlice, resourceId);388389    await expectTxFailure(/rmrkCore\.NoPermission/, tx);390  });391392  it('[negative]: unable to accept a resource to a non-target NFT', async () => {393    const collectionIdBob = await createCollection(394      api,395      Bob,396      'test-metadata',397      null,398      'test-symbol',399    );400401    const nftAlice = await mintNft(402      api,403      Bob,404      Alice,405      collectionIdBob,406      'nft-metadata',407    );408409    const wrongNft = await mintNft(410      api,411      Bob,412      Alice,413      collectionIdBob,414      'nft-metadata',415    );416    417    const resourceId = await addNftBasicResource(418      api,419      Bob,420      'pending',421      collectionIdBob,422      nftAlice,423      src,424      metadata,425      license,426      thumb,427    );428429    const tx = acceptNftResource(api, Bob, collectionIdBob, wrongNft, resourceId);430431    await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);432  });433434435  after(() => {436    api.disconnect();437  });438});
after · tests/src/rmrk/addResource.test.ts
1import {expect} from 'chai';2import {getApiConnection} from '../substrate/substrate-api';3import {NftIdTuple} from './util/fetch';4import {expectTxFailure, getResourceById, requirePallets, Pallets} from './util/helpers';5import {6  addNftBasicResource,7  acceptNftResource,8  createCollection,9  mintNft,10  sendNft,11  addNftSlotResource,12  addNftComposableResource,13} from './util/tx';14import {RmrkTraitsResourceResourceInfo as ResourceInfo} from '@polkadot/types/lookup';1516describe('integration test: add NFT resource', () => {17  const Alice = '//Alice';18  const Bob = '//Bob';19  const src = 'test-res-src';20  const metadata = 'test-res-metadata';21  const license = 'test-res-license';22  const thumb = 'test-res-thumb';2324  const nonexistentId = 99999;2526  let api: any;27  before(async function() {28    api = await getApiConnection();29    await requirePallets(this, [Pallets.RmrkCore]);30  });3132  it('add resource', async () => {33    const collectionIdAlice = await createCollection(34      api,35      Alice,36      'test-metadata',37      null,38      'test-symbol',39    );4041    const nftAlice = await mintNft(42      api,43      Alice,44      Alice,45      collectionIdAlice,46      'nft-metadata',47    );4849    await addNftBasicResource(50      api,51      Alice,52      'added',53      collectionIdAlice,54      nftAlice,55      src,56      metadata,57      license,58      thumb,59    );60  });6162  it('add a resource to the nested NFT', async () => {63    const collectionIdAlice = await createCollection(64      api,65      Alice,66      'test-metadata',67      null,68      'test-symbol',69    );7071    const parentNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'parent-nft-metadata');72    const childNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'child-nft-metadata');7374    const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];7576    await sendNft(api, 'sent', Alice, collectionIdAlice, childNftId, newOwnerNFT);7778    await addNftBasicResource(79      api,80      Alice,81      'added',82      collectionIdAlice,83      childNftId,84      src,85      metadata,86      license,87      thumb,88    );89  });9091  it('add multiple resources', async () => {92    const collectionIdAlice = await createCollection(93      api,94      Alice,95      'test-metadata',96      null,97      'test-symbol',98    );99100    const nftAlice = await mintNft(101      api,102      Alice,103      Alice,104      collectionIdAlice,105      'nft-metadata',106    );107108    const baseId = 42;109    const slotId = 10;110    const parts = [0, 5, 2];111112    const resourcesInfo = [];113    const resourceNum = 4;114115    const checkResource = async (resource: ResourceInfo, resType: string, expectedId: number, expected: {116      src: string,117      metadata: string,118      license: string,119      thumb: string120    }) => {121122      // FIXME A workaround. It seems it is a PolkadotJS bug.123      // All of the following are `false`.124      //125      // console.log('>>> basic:', resource.resource.isBasic);126      // console.log('>>> composable:', resource.resource.isComposable);127      // console.log('>>> slot:', resource.resource.isSlot);128      const resourceJson = (resource.resource.toHuman() as any)[resType];129130      expect(resource.id.toNumber(), 'Error: Invalid resource Id')131        .to.be.eq(expectedId);132133      expect(resourceJson.src, 'Error: Invalid resource src')134        .to.be.eq(expected.src);135      expect(resourceJson.metadata, 'Error: Invalid resource metadata')136        .to.be.eq(expected.metadata);137      expect(resourceJson.license, 'Error: Invalid resource license')138        .to.be.eq(expected.license);139      expect(resourceJson.thumb, 'Error: Invalid resource thumb')140        .to.be.eq(expected.thumb);141    };142143    for (let i = 0; i < resourceNum; i++) {144      resourcesInfo.push({145        src: src + 'r-' + i,146        metadata: metadata + 'r-' + i,147        license: license + 'r-' + i,148        thumb: thumb + 'r-' + i,149      });150    }151152    const firstBasicResourceId = await addNftBasicResource(153      api,154      Alice,155      'added',156      collectionIdAlice,157      nftAlice,158      resourcesInfo[0].src,159      resourcesInfo[0].metadata,160      resourcesInfo[0].license,161      resourcesInfo[0].thumb,162    );163164    const secondBasicResourceId = await addNftBasicResource(165      api,166      Alice,167      'added',168      collectionIdAlice,169      nftAlice,170      resourcesInfo[1].src,171      resourcesInfo[1].metadata,172      resourcesInfo[1].license,173      resourcesInfo[1].thumb,174    );175176    const composableResourceId = await addNftComposableResource(177      api,178      Alice,179      'added',180      collectionIdAlice,181      nftAlice,182      parts,183      baseId,184      resourcesInfo[2].src,185      resourcesInfo[2].metadata,186      resourcesInfo[2].license,187      resourcesInfo[2].thumb,188    );189190    const slotResourceId = await addNftSlotResource(191      api,192      Alice,193      'added',194      collectionIdAlice,195      nftAlice,196      baseId,197      slotId,198      resourcesInfo[3].src,199      resourcesInfo[3].metadata,200      resourcesInfo[3].license,201      resourcesInfo[3].thumb,202    );203204    const firstResource = await getResourceById(api, collectionIdAlice, nftAlice, firstBasicResourceId);205    await checkResource(firstResource, 'Basic', firstBasicResourceId, resourcesInfo[0]);206207    const secondResource = await getResourceById(api, collectionIdAlice, nftAlice, secondBasicResourceId);208    await checkResource(secondResource, 'Basic', secondBasicResourceId, resourcesInfo[1]);209210    const composableResource = await getResourceById(api, collectionIdAlice, nftAlice, composableResourceId);211    await checkResource(composableResource, 'Composable', composableResourceId, resourcesInfo[2]);212213    const slotResource = await getResourceById(api, collectionIdAlice, nftAlice, slotResourceId);214    await checkResource(slotResource, 'Slot', slotResourceId, resourcesInfo[3]);215  });216217  it('[negative]: unable to add a resource to the non-existing NFT', async () => {218    const collectionIdAlice = await createCollection(219      api,220      Alice,221      'test-metadata',222      null,223      'test-symbol',224    );225226    const tx = addNftBasicResource(227      api,228      Alice,229      'added',230      collectionIdAlice,231      nonexistentId,232      src,233      metadata,234      license,235      thumb,236    );237  238    await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);239  });240241  it('[negative]: unable to add a resource by a not-an-owner user', async () => {242    const collectionIdAlice = await createCollection(243      api,244      Alice,245      'test-metadata',246      null,247      'test-symbol',248    );249250    const nftAlice = await mintNft(251      api,252      Alice,253      Alice,254      collectionIdAlice,255      'nft-metadata',256    );257258    const tx = addNftBasicResource(259      api,260      Bob,261      'added',262      collectionIdAlice,263      nftAlice,264      src,265      metadata,266      license,267      thumb,268    );269  270    await expectTxFailure(/rmrkCore\.NoPermission/, tx);271  });272273  it('[negative]: unable to add a resource to the nested NFT if it isnt root owned by the caller', async () => {274    const collectionIdAlice = await createCollection(275      api,276      Alice,277      'test-metadata',278      null,279      'test-symbol',280    );281282    const parentNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'parent-nft-metadata');283    const childNftId = await mintNft(api, Alice, Alice, collectionIdAlice, 'child-nft-metadata');284285    const newOwnerNFT: NftIdTuple = [collectionIdAlice, parentNftId];286287    await sendNft(api, 'sent', Alice, collectionIdAlice, childNftId, newOwnerNFT);288289    const tx = addNftBasicResource(290      api,291      Bob,292      'added',293      collectionIdAlice,294      childNftId,295      src,296      metadata,297      license,298      thumb,299    );300    301    await expectTxFailure(/rmrkCore\.NoPermission/, tx);302  });303304  it('accept resource', async () => {305    const collectionIdBob = await createCollection(306      api,307      Bob,308      'test-metadata',309      null,310      'test-symbol',311    );312313    const nftAlice = await mintNft(314      api,315      Bob,316      Alice,317      collectionIdBob,318      'nft-metadata',319    );320321    const resourceId = await addNftBasicResource(322      api,323      Bob,324      'pending',325      collectionIdBob,326      nftAlice,327      src,328      metadata,329      license,330      thumb,331    );332333    await acceptNftResource(api, Alice, collectionIdBob, nftAlice, resourceId);334  });335336  it('[negative]: unable to accept a non-existing resource', async () => {337    const collectionIdBob = await createCollection(338      api,339      Bob,340      'test-metadata',341      null,342      'test-symbol',343    );344345    const nftAlice = await mintNft(346      api,347      Bob,348      Alice,349      collectionIdBob,350      'nft-metadata',351    );352353    const tx = acceptNftResource(api, Alice, collectionIdBob, nftAlice, nonexistentId);354    await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);355  });356357  it('[negative]: unable to accept a resource by a not-an-NFT-owner user', async () => {358    const collectionIdBob = await createCollection(359      api,360      Bob,361      'test-metadata',362      null,363      'test-symbol',364    );365366    const nftAlice = await mintNft(367      api,368      Bob,369      Alice,370      collectionIdBob,371      'nft-metadata',372    );373374    const resourceId = await addNftBasicResource(375      api,376      Bob,377      'pending',378      collectionIdBob,379      nftAlice,380      src,381      metadata,382      license,383      thumb,384    );385386    const tx = acceptNftResource(api, Bob, collectionIdBob, nftAlice, resourceId);387388    await expectTxFailure(/rmrkCore\.NoPermission/, tx);389  });390391  it('[negative]: unable to accept a resource to a non-target NFT', async () => {392    const collectionIdBob = await createCollection(393      api,394      Bob,395      'test-metadata',396      null,397      'test-symbol',398    );399400    const nftAlice = await mintNft(401      api,402      Bob,403      Alice,404      collectionIdBob,405      'nft-metadata',406    );407408    const wrongNft = await mintNft(409      api,410      Bob,411      Alice,412      collectionIdBob,413      'nft-metadata',414    );415    416    const resourceId = await addNftBasicResource(417      api,418      Bob,419      'pending',420      collectionIdBob,421      nftAlice,422      src,423      metadata,424      license,425      thumb,426    );427428    const tx = acceptNftResource(api, Bob, collectionIdBob, wrongNft, resourceId);429430    await expectTxFailure(/rmrkCore\.ResourceDoesntExist/, tx);431  });432433434  after(() => {435    api.disconnect();436  });437});
modifiedtests/src/rmrk/addTheme.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/addTheme.test.ts
+++ b/tests/src/rmrk/addTheme.test.ts
@@ -1,9 +1,8 @@
 import {expect} from 'chai';
 import {getApiConnection} from '../substrate/substrate-api';
 import {createBase, addTheme} from './util/tx';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {getThemeNames} from './util/fetch';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
 
 describe('integration test: add Theme to Base', () => {
   let api: any;
modifiedtests/src/rmrk/burnNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/burnNft.test.ts
+++ b/tests/src/rmrk/burnNft.test.ts
@@ -1,11 +1,10 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {NftIdTuple, getChildren} from './util/fetch';
 import {burnNft, createCollection, sendNft, mintNft} from './util/tx';
 
 import chai from 'chai';
 import chaiAsPromised from 'chai-as-promised';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
modifiedtests/src/rmrk/changeCollectionIssuer.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/changeCollectionIssuer.test.ts
+++ b/tests/src/rmrk/changeCollectionIssuer.test.ts
@@ -1,6 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {
   changeIssuer,
   createCollection,
modifiedtests/src/rmrk/createBase.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/createBase.test.ts
+++ b/tests/src/rmrk/createBase.test.ts
@@ -1,5 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
+import {requirePallets, Pallets} from './util/helpers';
 import {createCollection, createBase} from './util/tx';
 
 describe('integration test: create new Base', () => {
modifiedtests/src/rmrk/createCollection.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/createCollection.test.ts
+++ b/tests/src/rmrk/createCollection.test.ts
@@ -1,5 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
+import {requirePallets, Pallets} from './util/helpers';
 import {createCollection} from './util/tx';
 
 describe('Integration test: create new collection', () => {
modifiedtests/src/rmrk/deleteCollection.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/deleteCollection.test.ts
+++ b/tests/src/rmrk/deleteCollection.test.ts
@@ -1,6 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {createCollection, deleteCollection} from './util/tx';
 
 describe('integration test: delete collection', () => {
modifiedtests/src/rmrk/equipNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/equipNft.test.ts
+++ b/tests/src/rmrk/equipNft.test.ts
@@ -1,9 +1,8 @@
 import {ApiPromise} from '@polkadot/api';
 import {expect} from 'chai';
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
 import {getNft, getParts, NftIdTuple} from './util/fetch';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {
   addNftComposableResource,
   addNftSlotResource,
modifiedtests/src/rmrk/getOwnedNfts.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/getOwnedNfts.test.ts
+++ b/tests/src/rmrk/getOwnedNfts.test.ts
@@ -1,6 +1,6 @@
 import {expect} from 'chai';
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
+import {requirePallets, Pallets} from './util/helpers';
 import {getOwnedNfts} from './util/fetch';
 import {mintNft, createCollection} from './util/tx';
 
modifiedtests/src/rmrk/lockCollection.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/lockCollection.test.ts
+++ b/tests/src/rmrk/lockCollection.test.ts
@@ -1,6 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {createCollection, lockCollection, mintNft} from './util/tx';
 
 describe('integration test: lock collection', () => {
modifiedtests/src/rmrk/mintNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/mintNft.test.ts
+++ b/tests/src/rmrk/mintNft.test.ts
@@ -1,8 +1,7 @@
 import {expect} from 'chai';
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
 import {getNft} from './util/fetch';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {createCollection, mintNft} from './util/tx';
 
 describe('integration test: mint new NFT', () => {
modifiedtests/src/rmrk/rejectNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/rejectNft.test.ts
+++ b/tests/src/rmrk/rejectNft.test.ts
@@ -7,8 +7,7 @@
   rejectNft,
 } from './util/tx';
 import {getChildren, NftIdTuple} from './util/fetch';
-import {isNftChildOfAnother, expectTxFailure} from './util/helpers';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
+import {isNftChildOfAnother, expectTxFailure, requirePallets, Pallets} from './util/helpers';
 
 describe('integration test: reject NFT', () => {
   let api: any;
modifiedtests/src/rmrk/removeResource.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/removeResource.test.ts
+++ b/tests/src/rmrk/removeResource.test.ts
@@ -1,9 +1,8 @@
 import {expect} from 'chai';
 import privateKey from '../substrate/privateKey';
 import {executeTransaction, getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
 import {getNft, NftIdTuple} from './util/fetch';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {
   acceptNft, acceptResourceRemoval, addNftBasicResource,
   createBase,
modifiedtests/src/rmrk/sendNft.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/sendNft.test.ts
+++ b/tests/src/rmrk/sendNft.test.ts
@@ -2,8 +2,7 @@
 import {getApiConnection} from '../substrate/substrate-api';
 import {createCollection, mintNft, sendNft} from './util/tx';
 import {NftIdTuple} from './util/fetch';
-import {isNftChildOfAnother, expectTxFailure} from './util/helpers';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
+import {isNftChildOfAnother, expectTxFailure, requirePallets, Pallets} from './util/helpers';
 
 describe('integration test: send NFT', () => {
   let api: any;
modifiedtests/src/rmrk/setCollectionProperty.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/setCollectionProperty.test.ts
+++ b/tests/src/rmrk/setCollectionProperty.test.ts
@@ -1,6 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {createCollection, setPropertyCollection} from './util/tx';
 
 describe('integration test: set collection property', () => {
modifiedtests/src/rmrk/setEquippableList.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/setEquippableList.test.ts
+++ b/tests/src/rmrk/setEquippableList.test.ts
@@ -1,6 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {createCollection, createBase, setEquippableList} from './util/tx';
 
 describe("integration test: set slot's Equippable List", () => {
modifiedtests/src/rmrk/setNftProperty.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/setNftProperty.test.ts
+++ b/tests/src/rmrk/setNftProperty.test.ts
@@ -1,7 +1,6 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
 import {NftIdTuple} from './util/fetch';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {createCollection, mintNft, sendNft, setNftProperty} from './util/tx';
 
 describe('integration test: set NFT property', () => {
modifiedtests/src/rmrk/setResourcePriorities.test.tsdiffbeforeafterboth
--- a/tests/src/rmrk/setResourcePriorities.test.ts
+++ b/tests/src/rmrk/setResourcePriorities.test.ts
@@ -1,6 +1,5 @@
 import {getApiConnection} from '../substrate/substrate-api';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
-import {expectTxFailure} from './util/helpers';
+import {expectTxFailure, requirePallets, Pallets} from './util/helpers';
 import {mintNft, createCollection, setResourcePriorities} from './util/tx';
 
 describe('integration test: set NFT resource priorities', () => {
modifiedtests/src/rmrk/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/rmrk/util/helpers.ts
+++ b/tests/src/rmrk/util/helpers.ts
@@ -10,6 +10,8 @@
 import {NftIdTuple, getChildren, getOwnedNfts, getCollectionProperties, getNftProperties, getResources} from './fetch';
 import chaiAsPromised from 'chai-as-promised';
 import chai from 'chai';
+import {getApiConnection} from '../../substrate/substrate-api';
+import {Context} from 'mocha';
 
 chai.use(chaiAsPromised);
 const expect = chai.expect;
@@ -19,6 +21,45 @@
     successData: T | null;
 }
 
+export enum Pallets {
+  Inflation = 'inflation',
+  RmrkCore = 'rmrkcore',
+  RmrkEquip = 'rmrkequip',
+  ReFungible = 'refungible',
+  Fungible = 'fungible',
+  NFT = 'nonfungible',
+  Scheduler = 'scheduler',
+  AppPromotion = 'apppromotion',
+}
+
+let modulesNames: any;
+export function getModuleNames(api: ApiPromise): string[] {
+  if (typeof modulesNames === 'undefined')
+    modulesNames = api.runtimeMetadata.asLatest.pallets.map(m => m.name.toString().toLowerCase());
+  return modulesNames;
+}
+
+export async function missingRequiredPallets(requiredPallets: string[]): Promise<string[]> {
+  const api = await getApiConnection();
+  const pallets = getModuleNames(api);
+
+  return requiredPallets.filter(p => !pallets.includes(p));
+}
+
+export async function requirePallets(mocha: Context, requiredPallets: string[]) {
+  const missingPallets = await missingRequiredPallets(requiredPallets);
+
+  if (missingPallets.length > 0) {
+    const skippingTestMsg = `\tSkipping test "${mocha.test?.title}".`;
+    const missingPalletsMsg = `\tThe following pallets are missing:\n\t- ${missingPallets.join('\n\t- ')}`;
+    const skipMsg = `${skippingTestMsg}\n${missingPalletsMsg}`;
+
+    console.error('\x1b[38:5:208m%s\x1b[0m', skipMsg);
+
+    mocha.skip();
+  }
+}
+
 export function makeNftOwner(api: ApiPromise, owner: string | NftIdTuple): NftOwner {
   const isNftSending = (typeof owner !== 'string');