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
--- a/tests/src/rmrk/addResource.test.ts
+++ b/tests/src/rmrk/addResource.test.ts
@@ -1,7 +1,7 @@
 import {expect} from 'chai';
 import {getApiConnection} from '../substrate/substrate-api';
 import {NftIdTuple} from './util/fetch';
-import {expectTxFailure, getResourceById} from './util/helpers';
+import {expectTxFailure, getResourceById, requirePallets, Pallets} from './util/helpers';
 import {
   addNftBasicResource,
   acceptNftResource,
@@ -12,7 +12,6 @@
   addNftComposableResource,
 } from './util/tx';
 import {RmrkTraitsResourceResourceInfo as ResourceInfo} from '@polkadot/types/lookup';
-import {requirePallets, Pallets} from '../deprecated-helpers/helpers';
 
 describe('integration test: add NFT resource', () => {
   const Alice = '//Alice';
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
before · tests/src/rmrk/equipNft.test.ts
1import {ApiPromise} from '@polkadot/api';2import {expect} from 'chai';3import {getApiConnection} from '../substrate/substrate-api';4import {requirePallets, Pallets} from '../deprecated-helpers/helpers';5import {getNft, getParts, NftIdTuple} from './util/fetch';6import {expectTxFailure} from './util/helpers';7import {8  addNftComposableResource,9  addNftSlotResource,10  createBase,11  createCollection,12  equipNft,13  mintNft,14  sendNft,15  unequipNft,16} from './util/tx';1718const Alice = '//Alice';19const Bob = '//Bob';2021const composableParts: number[] = [5, 2, 7];22const composableSrc = 'test-cmp-src';23const composableMetadata = 'test-cmp-metadata';24const composableLicense = 'test-comp-license';25const composableThumb = 'test-comp-thumb';2627const slotSrc = 'test-slot-src';28const slotLicense = 'test-slot-license';29const slotMetadata = 'test-slot-metadata';30const slotThumb = 'test-slot-thumb';3132const slotId = 1;3334async function createTestCollection(api: ApiPromise): Promise<number> {35  return createCollection(36    api,37    Alice,38    'test-metadata',39    null,40    'test-symbol',41  );42}4344async function mintTestNft(api: ApiPromise, collectionId: number): Promise<number> {45  return await mintNft(46    api,47    Alice,48    Alice,49    collectionId,50    'nft-metadata',51  );52}5354async function mintChildNft(api: ApiPromise, collectionId: number, parentNftId: number): Promise<number> {55  const nftChildId = await mintTestNft(api, collectionId);5657  const parentNFT: NftIdTuple = [collectionId, parentNftId];5859  await sendNft(api, 'sent', Alice, collectionId, nftChildId, parentNFT);6061  return nftChildId;62}6364async function createTestBase(api: ApiPromise): Promise<number> {65  return createBase(api, Alice, 'test-base', 'DTBase', [66    {67      SlotPart: {68        id: slotId,69        equippable: 'All',70        z: 1,71        src: slotSrc,72      },73    },74  ]);75}7677async function addTestComposable(api: ApiPromise, collectionId: number, nftId: number, baseId: number) {78  await addNftComposableResource(79    api,80    Alice,81    'added',82    collectionId,83    nftId,84    composableParts,85    baseId,86    composableSrc,87    composableMetadata,88    composableLicense,89    composableThumb,90  );91}9293async function addTestSlot(api: ApiPromise, collectionId: number, nftId: number, baseId: number, slotId: number): Promise<number> {94  return await addNftSlotResource(95    api,96    Alice,97    'added',98    collectionId,99    nftId,100    baseId,101    slotId,102    slotSrc,103    slotMetadata,104    slotLicense,105    slotThumb,106  );107}108109async function checkEquipStatus(110  api: ApiPromise,111  expectedStatus: 'equipped' | 'unequipped',112  collectionId: number,113  nftId: number,114) {115  const itemNftDataOpt = await getNft(api, collectionId, nftId);116  expect(itemNftDataOpt.isSome, 'Error: unable to fetch item NFT data');117118  const itemNftData = itemNftDataOpt.unwrap();119  expect(itemNftData.equipped.isTrue, `Error: item NFT should be ${expectedStatus}`)120    .to.be.equal(expectedStatus === 'equipped');121}122123describe.skip('integration test: Equip NFT', () => {124125  let api: any;126  127  before(async function () {128    api = await getApiConnection();129    await requirePallets(this, [Pallets.RmrkCore, Pallets.RmrkEquip]);130  });131132  it('equip nft', async () => {133    const collectionId = await createTestCollection(api);134    const nftParentId = await mintTestNft(api, collectionId);135    const nftChildId = await mintChildNft(api, collectionId, nftParentId);136137    const baseId = await createTestBase(api);138139    await addTestComposable(api, collectionId, nftParentId, baseId);140    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);141142    const equipperNFT: NftIdTuple = [collectionId, nftParentId];143    const itemNFT: NftIdTuple = [collectionId, nftChildId];144145    await equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);146147    await checkEquipStatus(api, 'equipped', collectionId, nftChildId);148  });149150  it('unequip nft', async () => {151    const collectionId = await createTestCollection(api);152    const nftParentId = await mintTestNft(api, collectionId);153    const nftChildId = await mintChildNft(api, collectionId, nftParentId);154155    const baseId = await createTestBase(api);156157    await addTestComposable(api, collectionId, nftParentId, baseId);158    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);159160    const equipperNFT: NftIdTuple = [collectionId, nftParentId];161    const itemNFT: NftIdTuple = [collectionId, nftChildId];162163    await equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);164165    await checkEquipStatus(api, 'equipped', collectionId, nftChildId);166167    await unequipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);168    await checkEquipStatus(api, 'unequipped', collectionId, nftChildId);169  });170171  it('[negative] equip NFT onto non-existing NFT', async () => {172    const collectionId = await createTestCollection(api);173174    const nftChildId = await mintNft(175      api,176      Alice,177      Alice,178      collectionId,179      'nft-metadata',180    );181182    const itemNFT: NftIdTuple = [collectionId, nftChildId];183    const invalidEquipperNFT: NftIdTuple = [collectionId, 9999999];184185    const baseId = 0;186    const resourceId = 0;187188    const tx = equipNft(api, Alice, itemNFT, invalidEquipperNFT, resourceId, baseId, slotId);189    await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);190  });191192  it('[negative] equip non-existing NFT', async () => {193    const collectionId = await createTestCollection(api);194    const nftParentId = await mintNft(195      api,196      Alice,197      Alice,198      collectionId,199      'nft-metadata',200    );201202    const baseId = await createTestBase(api);203204    await addTestComposable(api, collectionId, nftParentId, baseId);205206    const equipperNFT: NftIdTuple = [collectionId, nftParentId];207    const invalidItemNFT: NftIdTuple = [collectionId, 99999999];208209    const resourceId = 0;210211    const tx = equipNft(api, Alice, invalidItemNFT, equipperNFT, resourceId, baseId, slotId);212    await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);213  });214215  it('[negative] equip NFT by a not-an-owner user', async () => {216    const collectionId = await createTestCollection(api);217    const nftParentId = await mintTestNft(api, collectionId);218    const nftChildId = await mintChildNft(api, collectionId, nftParentId);219220    const baseId = await createTestBase(api);221222    await addTestComposable(api, collectionId, nftParentId, baseId);223224    const equipperNFT: NftIdTuple = [collectionId, nftParentId];225    const itemNFT: NftIdTuple = [collectionId, nftChildId];226227    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);228229    const tx = equipNft(api, Bob, itemNFT, equipperNFT, resourceId, baseId, slotId);230    await expectTxFailure(/rmrkEquip\.PermissionError/, tx);231  });232233  it('[negative] unable to equip NFT onto indirect parent NFT', async () => {234    const collectionId = await createTestCollection(api);235    const nftParentId = await mintTestNft(api, collectionId);236    const nftChildId = await mintChildNft(api, collectionId, nftParentId);237    const nftGrandchildId = await mintChildNft(api, collectionId, nftChildId);238239    const baseId = await createTestBase(api);240241    await addTestComposable(api, collectionId, nftParentId, baseId);242    const resourceId = await addTestSlot(api, collectionId, nftGrandchildId, baseId, slotId);243244    const equipperNFT: NftIdTuple = [collectionId, nftParentId];245    const itemNFT: NftIdTuple = [collectionId, nftGrandchildId];246247    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);248    await expectTxFailure(/rmrkEquip\.MustBeDirectParent/, tx);249  });250251  it('[negative] unable to equip NFT onto parent NFT with another base', async () => {252    const collectionId = await createTestCollection(api);253    const nftParentId = await mintTestNft(api, collectionId);254    const nftChildId = await mintChildNft(api, collectionId, nftParentId);255256    const baseId = await createTestBase(api);257258    await addTestComposable(api, collectionId, nftParentId, baseId);259    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);260261    const equipperNFT: NftIdTuple = [collectionId, nftParentId];262    const itemNFT: NftIdTuple = [collectionId, nftChildId];263264    const invalidBaseId = 99999;265266    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, invalidBaseId, slotId);267    await expectTxFailure(/rmrkEquip\.NoResourceForThisBaseFoundOnNft/, tx);268  });269270  it('[negative] unable to equip NFT into slot with another id', async () => {271    const collectionId = await createTestCollection(api);272    const nftParentId = await mintTestNft(api, collectionId);273    const nftChildId = await mintChildNft(api, collectionId, nftParentId);274275    const baseId = await createTestBase(api);276277    await addTestComposable(api, collectionId, nftParentId, baseId);278    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);279280    const equipperNFT: NftIdTuple = [collectionId, nftParentId];281    const itemNFT: NftIdTuple = [collectionId, nftChildId];282283    const incorrectSlotId = slotId + 1;284    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, incorrectSlotId);285    await expectTxFailure(/rmrkEquip\.ItemHasNoResourceToEquipThere/, tx);286  });287288  it('[negative] unable to equip NFT with incorrect slot (fixed part)', async () => {289    const collectionId = await createTestCollection(api);290    const nftParentId = await mintTestNft(api, collectionId);291    const nftChildId = await mintChildNft(api, collectionId, nftParentId);292293    const baseId = await createBase(api, Alice, 'test-base', 'DTBase', [294      {295        FixedPart: {296          id: slotId,297          equippable: 'All',298          z: 1,299          src: slotSrc,300        },301      },302    ]);303304    await addTestComposable(api, collectionId, nftParentId, baseId);305    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);306307    const equipperNFT: NftIdTuple = [collectionId, nftParentId];308    const itemNFT: NftIdTuple = [collectionId, nftChildId];309310    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);311    await expectTxFailure(/rmrkEquip\.CantEquipFixedPart/, tx);312  });313314  it('[negative] unable to equip NFT from a collection that is not allowed by the slot', async () => {315    const collectionId = await createTestCollection(api);316    const nftParentId = await mintTestNft(api, collectionId);317    const nftChildId = await mintChildNft(api, collectionId, nftParentId);318319    const baseId = await createBase(api, Alice, 'test-base', 'DTBase', [320      {321        SlotPart: {322          id: 1,323          z: 1,324          equippable: 'Empty',325          src: slotSrc,326        },327      },328    ]);329330    await addTestComposable(api, collectionId, nftParentId, baseId);331    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);332333    const equipperNFT: NftIdTuple = [collectionId, nftParentId];334    const itemNFT: NftIdTuple = [collectionId, nftChildId];335336    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);337    await expectTxFailure(/rmrkEquip\.CollectionNotEquippable/, tx);338  });339340  after(() => {341    api.disconnect();342  });343});
after · tests/src/rmrk/equipNft.test.ts
1import {ApiPromise} from '@polkadot/api';2import {expect} from 'chai';3import {getApiConnection} from '../substrate/substrate-api';4import {getNft, getParts, NftIdTuple} from './util/fetch';5import {expectTxFailure, requirePallets, Pallets} from './util/helpers';6import {7  addNftComposableResource,8  addNftSlotResource,9  createBase,10  createCollection,11  equipNft,12  mintNft,13  sendNft,14  unequipNft,15} from './util/tx';1617const Alice = '//Alice';18const Bob = '//Bob';1920const composableParts: number[] = [5, 2, 7];21const composableSrc = 'test-cmp-src';22const composableMetadata = 'test-cmp-metadata';23const composableLicense = 'test-comp-license';24const composableThumb = 'test-comp-thumb';2526const slotSrc = 'test-slot-src';27const slotLicense = 'test-slot-license';28const slotMetadata = 'test-slot-metadata';29const slotThumb = 'test-slot-thumb';3031const slotId = 1;3233async function createTestCollection(api: ApiPromise): Promise<number> {34  return createCollection(35    api,36    Alice,37    'test-metadata',38    null,39    'test-symbol',40  );41}4243async function mintTestNft(api: ApiPromise, collectionId: number): Promise<number> {44  return await mintNft(45    api,46    Alice,47    Alice,48    collectionId,49    'nft-metadata',50  );51}5253async function mintChildNft(api: ApiPromise, collectionId: number, parentNftId: number): Promise<number> {54  const nftChildId = await mintTestNft(api, collectionId);5556  const parentNFT: NftIdTuple = [collectionId, parentNftId];5758  await sendNft(api, 'sent', Alice, collectionId, nftChildId, parentNFT);5960  return nftChildId;61}6263async function createTestBase(api: ApiPromise): Promise<number> {64  return createBase(api, Alice, 'test-base', 'DTBase', [65    {66      SlotPart: {67        id: slotId,68        equippable: 'All',69        z: 1,70        src: slotSrc,71      },72    },73  ]);74}7576async function addTestComposable(api: ApiPromise, collectionId: number, nftId: number, baseId: number) {77  await addNftComposableResource(78    api,79    Alice,80    'added',81    collectionId,82    nftId,83    composableParts,84    baseId,85    composableSrc,86    composableMetadata,87    composableLicense,88    composableThumb,89  );90}9192async function addTestSlot(api: ApiPromise, collectionId: number, nftId: number, baseId: number, slotId: number): Promise<number> {93  return await addNftSlotResource(94    api,95    Alice,96    'added',97    collectionId,98    nftId,99    baseId,100    slotId,101    slotSrc,102    slotMetadata,103    slotLicense,104    slotThumb,105  );106}107108async function checkEquipStatus(109  api: ApiPromise,110  expectedStatus: 'equipped' | 'unequipped',111  collectionId: number,112  nftId: number,113) {114  const itemNftDataOpt = await getNft(api, collectionId, nftId);115  expect(itemNftDataOpt.isSome, 'Error: unable to fetch item NFT data');116117  const itemNftData = itemNftDataOpt.unwrap();118  expect(itemNftData.equipped.isTrue, `Error: item NFT should be ${expectedStatus}`)119    .to.be.equal(expectedStatus === 'equipped');120}121122describe.skip('integration test: Equip NFT', () => {123124  let api: any;125  126  before(async function () {127    api = await getApiConnection();128    await requirePallets(this, [Pallets.RmrkCore, Pallets.RmrkEquip]);129  });130131  it('equip nft', async () => {132    const collectionId = await createTestCollection(api);133    const nftParentId = await mintTestNft(api, collectionId);134    const nftChildId = await mintChildNft(api, collectionId, nftParentId);135136    const baseId = await createTestBase(api);137138    await addTestComposable(api, collectionId, nftParentId, baseId);139    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);140141    const equipperNFT: NftIdTuple = [collectionId, nftParentId];142    const itemNFT: NftIdTuple = [collectionId, nftChildId];143144    await equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);145146    await checkEquipStatus(api, 'equipped', collectionId, nftChildId);147  });148149  it('unequip nft', async () => {150    const collectionId = await createTestCollection(api);151    const nftParentId = await mintTestNft(api, collectionId);152    const nftChildId = await mintChildNft(api, collectionId, nftParentId);153154    const baseId = await createTestBase(api);155156    await addTestComposable(api, collectionId, nftParentId, baseId);157    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);158159    const equipperNFT: NftIdTuple = [collectionId, nftParentId];160    const itemNFT: NftIdTuple = [collectionId, nftChildId];161162    await equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);163164    await checkEquipStatus(api, 'equipped', collectionId, nftChildId);165166    await unequipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);167    await checkEquipStatus(api, 'unequipped', collectionId, nftChildId);168  });169170  it('[negative] equip NFT onto non-existing NFT', async () => {171    const collectionId = await createTestCollection(api);172173    const nftChildId = await mintNft(174      api,175      Alice,176      Alice,177      collectionId,178      'nft-metadata',179    );180181    const itemNFT: NftIdTuple = [collectionId, nftChildId];182    const invalidEquipperNFT: NftIdTuple = [collectionId, 9999999];183184    const baseId = 0;185    const resourceId = 0;186187    const tx = equipNft(api, Alice, itemNFT, invalidEquipperNFT, resourceId, baseId, slotId);188    await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);189  });190191  it('[negative] equip non-existing NFT', async () => {192    const collectionId = await createTestCollection(api);193    const nftParentId = await mintNft(194      api,195      Alice,196      Alice,197      collectionId,198      'nft-metadata',199    );200201    const baseId = await createTestBase(api);202203    await addTestComposable(api, collectionId, nftParentId, baseId);204205    const equipperNFT: NftIdTuple = [collectionId, nftParentId];206    const invalidItemNFT: NftIdTuple = [collectionId, 99999999];207208    const resourceId = 0;209210    const tx = equipNft(api, Alice, invalidItemNFT, equipperNFT, resourceId, baseId, slotId);211    await expectTxFailure(/rmrkCore\.NoAvailableNftId/, tx);212  });213214  it('[negative] equip NFT by a not-an-owner user', async () => {215    const collectionId = await createTestCollection(api);216    const nftParentId = await mintTestNft(api, collectionId);217    const nftChildId = await mintChildNft(api, collectionId, nftParentId);218219    const baseId = await createTestBase(api);220221    await addTestComposable(api, collectionId, nftParentId, baseId);222223    const equipperNFT: NftIdTuple = [collectionId, nftParentId];224    const itemNFT: NftIdTuple = [collectionId, nftChildId];225226    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);227228    const tx = equipNft(api, Bob, itemNFT, equipperNFT, resourceId, baseId, slotId);229    await expectTxFailure(/rmrkEquip\.PermissionError/, tx);230  });231232  it('[negative] unable to equip NFT onto indirect parent NFT', async () => {233    const collectionId = await createTestCollection(api);234    const nftParentId = await mintTestNft(api, collectionId);235    const nftChildId = await mintChildNft(api, collectionId, nftParentId);236    const nftGrandchildId = await mintChildNft(api, collectionId, nftChildId);237238    const baseId = await createTestBase(api);239240    await addTestComposable(api, collectionId, nftParentId, baseId);241    const resourceId = await addTestSlot(api, collectionId, nftGrandchildId, baseId, slotId);242243    const equipperNFT: NftIdTuple = [collectionId, nftParentId];244    const itemNFT: NftIdTuple = [collectionId, nftGrandchildId];245246    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);247    await expectTxFailure(/rmrkEquip\.MustBeDirectParent/, tx);248  });249250  it('[negative] unable to equip NFT onto parent NFT with another base', async () => {251    const collectionId = await createTestCollection(api);252    const nftParentId = await mintTestNft(api, collectionId);253    const nftChildId = await mintChildNft(api, collectionId, nftParentId);254255    const baseId = await createTestBase(api);256257    await addTestComposable(api, collectionId, nftParentId, baseId);258    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);259260    const equipperNFT: NftIdTuple = [collectionId, nftParentId];261    const itemNFT: NftIdTuple = [collectionId, nftChildId];262263    const invalidBaseId = 99999;264265    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, invalidBaseId, slotId);266    await expectTxFailure(/rmrkEquip\.NoResourceForThisBaseFoundOnNft/, tx);267  });268269  it('[negative] unable to equip NFT into slot with another id', async () => {270    const collectionId = await createTestCollection(api);271    const nftParentId = await mintTestNft(api, collectionId);272    const nftChildId = await mintChildNft(api, collectionId, nftParentId);273274    const baseId = await createTestBase(api);275276    await addTestComposable(api, collectionId, nftParentId, baseId);277    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);278279    const equipperNFT: NftIdTuple = [collectionId, nftParentId];280    const itemNFT: NftIdTuple = [collectionId, nftChildId];281282    const incorrectSlotId = slotId + 1;283    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, incorrectSlotId);284    await expectTxFailure(/rmrkEquip\.ItemHasNoResourceToEquipThere/, tx);285  });286287  it('[negative] unable to equip NFT with incorrect slot (fixed part)', async () => {288    const collectionId = await createTestCollection(api);289    const nftParentId = await mintTestNft(api, collectionId);290    const nftChildId = await mintChildNft(api, collectionId, nftParentId);291292    const baseId = await createBase(api, Alice, 'test-base', 'DTBase', [293      {294        FixedPart: {295          id: slotId,296          equippable: 'All',297          z: 1,298          src: slotSrc,299        },300      },301    ]);302303    await addTestComposable(api, collectionId, nftParentId, baseId);304    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);305306    const equipperNFT: NftIdTuple = [collectionId, nftParentId];307    const itemNFT: NftIdTuple = [collectionId, nftChildId];308309    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);310    await expectTxFailure(/rmrkEquip\.CantEquipFixedPart/, tx);311  });312313  it('[negative] unable to equip NFT from a collection that is not allowed by the slot', async () => {314    const collectionId = await createTestCollection(api);315    const nftParentId = await mintTestNft(api, collectionId);316    const nftChildId = await mintChildNft(api, collectionId, nftParentId);317318    const baseId = await createBase(api, Alice, 'test-base', 'DTBase', [319      {320        SlotPart: {321          id: 1,322          z: 1,323          equippable: 'Empty',324          src: slotSrc,325        },326      },327    ]);328329    await addTestComposable(api, collectionId, nftParentId, baseId);330    const resourceId = await addTestSlot(api, collectionId, nftChildId, baseId, slotId);331332    const equipperNFT: NftIdTuple = [collectionId, nftParentId];333    const itemNFT: NftIdTuple = [collectionId, nftChildId];334335    const tx = equipNft(api, Alice, itemNFT, equipperNFT, resourceId, baseId, slotId);336    await expectTxFailure(/rmrkEquip\.CollectionNotEquippable/, tx);337  });338339  after(() => {340    api.disconnect();341  });342});
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');