git.delta.rocks / unique-network / refs/commits / 464a3c1ac005

difftreelog

fix properties have been moved in creation functions

kryadinskii2022-05-20parent: #fc4f875.patch.diff
in: master

5 files changed

modifiedtests/src/createItem.test.tsdiffbeforeafterboth
--- a/tests/src/createItem.test.ts
+++ b/tests/src/createItem.test.ts
@@ -24,6 +24,7 @@
   addCollectionAdminExpectSuccess,
   createCollectionWithPropsExpectSuccess,
   createItemWithPropsExpectSuccess,
+  createItemWithPropsExpectFailure,
 } from './util/helpers';
 
 const expect = chai.expect;
@@ -128,69 +129,47 @@
       const createMode = 'NFT';
       const newCollectionID = await createCollectionWithPropsExpectSuccess({mode: {type: createMode}, 
         propPerm:   [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});
-
-      const token = await createItemExpectSuccess(alice, newCollectionID, 'NFT');
       await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);
 
-      await expect(executeTransaction(
-        api, 
-        alice, 
-        api.tx.unique.setTokenProperties(newCollectionID, token, [{key: 'key1', value: 'v2'}]), 
-      )).to.be.rejected;
+      await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'key1', value: 'v'}]);
     });
   });
 
   it('User doesnt have editing rights', async () => {
     await usingApi(async api => {
       const newCollectionID = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}]});
-      const token = await createItemExpectSuccess(alice, newCollectionID, 'NFT');
-
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setTokenProperties(newCollectionID, token, [{key: 'key1', value: 'v2'}]), 
-      )).to.be.rejected;
+      await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'key1', value: 'v'}]);
     });
   });
 
   it('Adding property without access rights', async () => {
     await usingApi(async api => {
-      const createMode = 'NFT';
-      const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});
-
-      const token = await createItemExpectSuccess(alice, newCollectionID, 'NFT');
+      const newCollectionID = await createCollectionWithPropsExpectSuccess();
       await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);
-      
-      await expect(executeTransaction(
-        api, 
-        bob, 
-        api.tx.unique.setTokenProperties(newCollectionID, token, [{key: 'key1', value: 'v2'}]), 
-      )).to.be.rejected;
+
+      await createItemWithPropsExpectFailure(bob, newCollectionID, 'NFT', [{key: 'k', value: 'v'}]);
     });
   });
 
   it('Adding more than 64 prps', async () => {
     await usingApi(async api => {
-      const createMode = 'NFT';
-
       const prps = [];
 
       for (let i = 0; i < 65; i++) {
         prps.push({key: `key${i}`, value: `value${i}`});
       }
 
-      const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});
+      const newCollectionID = await createCollectionWithPropsExpectSuccess();
       
-      await expect(executeTransaction(api, alice, api.tx.unique.setCollectionProperties(newCollectionID, prps))).to.be.rejectedWith(/common\.PropertyLimitReached/);
+      createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', prps);
     });
   });
 
   it('Trying to add bigger property than allowed', async () => {
     await usingApi(async api => {
-      const createMode = 'NFT';
-      const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});
+      const newCollectionID = await createCollectionWithPropsExpectSuccess();
       
-      await expect(executeTransaction(api, alice, api.tx.unique.setCollectionProperties(newCollectionID, [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]))).to.be.rejectedWith(/common\.NoSpaceForProperty/);
+      createItemWithPropsExpectFailure(alice, newCollectionID, 'NFT', [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]);
     });
   });
 });
modifiedtests/src/createMultipleItems.test.tsdiffbeforeafterboth
--- a/tests/src/createMultipleItems.test.ts
+++ b/tests/src/createMultipleItems.test.ts
@@ -34,7 +34,8 @@
   getCreatedCollectionCount,
   createCollectionWithPropsExpectSuccess,
   getCreateItemsResult,
-  createMultipleItemsWithPropsExpectSuccess
+  createMultipleItemsWithPropsExpectSuccess,
+  createMultipleItemsWithPropsExpectFailure,
 } from './util/helpers';
 
 chai.use(chaiAsPromised);
@@ -432,79 +433,44 @@
   it('No editing rights', async () => {
     await usingApi(async (api: ApiPromise) => {
       const collectionId = await createCollectionWithPropsExpectSuccess({properties: [{key: 'key1', value: 'v'}],
-        propPerm:   [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}]});
+        propPerm:   [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: true}}]});
       const itemsListIndexBefore = await getLastTokenId(api, collectionId);
       expect(itemsListIndexBefore).to.be.equal(0);
       await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
-      const args = [{Nft: {const_data: '0x31'}},
+      const args = [{Nft: {const_data: '0x31', properties: [{key: 'key1', value: 'v2'}]}},
         {Nft: {const_data: '0x32'}},
         {Nft: {const_data: '0x33'}}];
 
-      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
-
-      const events = await submitTransactionAsync(alice, createMultipleItemsTx);
-      const result = getCreateItemsResult(events);
-
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, [{key: 'key1', value: 'v2'}]),
-        )).to.be.rejected;
-      }
-
-      // await expect(submitTransactionAsync(bob, createMultipleItemsTx)).to.be.rejected;
+      await createMultipleItemsWithPropsExpectFailure(bob, collectionId, args);
     });
   });
 
   it('User doesnt have editing rights', async () => {
     await usingApi(async (api: ApiPromise) => {
       const collectionId = await createCollectionWithPropsExpectSuccess({properties: [{key: 'key1', value: 'v'}],
-        propPerm:   [{key: 'key1', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}]});
+        propPerm:   [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}]});
       const itemsListIndexBefore = await getLastTokenId(api, collectionId);
       expect(itemsListIndexBefore).to.be.equal(0);
       await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
-      const args = [{Nft: {const_data: '0x31'}},
+      const args = [{Nft: {const_data: '0x31', properties: [{key: 'key1', value: 'v2'}]}},
         {Nft: {const_data: '0x32'}},
         {Nft: {const_data: '0x33'}}];
 
-      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
-
-      const events = await submitTransactionAsync(alice, createMultipleItemsTx);
-      const result = getCreateItemsResult(events);
-
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, [{key: 'key1', value: 'v2'}]),
-        )).to.be.rejected;
-      }
+      await createMultipleItemsWithPropsExpectFailure(bob, collectionId, args);
     });
   });
 
   it('Adding property without access rights', async () => {
     await usingApi(async (api: ApiPromise) => {
-      const collectionId = await createCollectionWithPropsExpectSuccess({properties: [{key: 'key1', value: 'v'}]});
+      const collectionId = await createCollectionWithPropsExpectSuccess({properties: [{key: 'k', value: 'v1'}]});
       const itemsListIndexBefore = await getLastTokenId(api, collectionId);
       await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
       expect(itemsListIndexBefore).to.be.equal(0);
-      const args = [{Nft: {const_data: '0x31'}},
+      const args = [{Nft: {const_data: '0x31', properties: [{key: 'k', value: 'v'}]}},
         {Nft: {const_data: '0x32'}},
         {Nft: {const_data: '0x33'}}];
 
-      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
-
-      const events = await submitTransactionAsync(alice, createMultipleItemsTx);
-      const result = getCreateItemsResult(events);
-
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, [{key: 'key1', value: 'v2'}]),
-        )).to.be.rejected;
-      }
+      await createMultipleItemsWithPropsExpectFailure(bob, collectionId, args);
     });
   });
 
@@ -515,15 +481,6 @@
       const itemsListIndexBefore = await getLastTokenId(api, collectionId);
       expect(itemsListIndexBefore).to.be.equal(0);
       await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
-
-      const args = [{Nft: {const_data: '0x31'}},
-        {Nft: {const_data: '0x32'}},
-        {Nft: {const_data: '0x33'}}];
-
-      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
-      const events = await submitTransactionAsync(alice, createMultipleItemsTx);
-
-      const result = getCreateItemsResult(events);
 
       const prps = [];
 
@@ -531,43 +488,24 @@
         prps.push({key: `key${i}`, value: `value${i}`});
       }
 
-      await expect(executeTransaction(api, bob, api.tx.unique.setCollectionProperties(collectionId, prps))).to.be.rejectedWith(/common\.PropertyLimitReached/);
+      const args = [{Nft: {const_data: '0x31', properties: prps}},
+        {Nft: {const_data: '0x32', properties: prps}},
+        {Nft: {const_data: '0x33', properties: prps}}];
 
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, prps),
-        )).to.be.rejected;
-      }
+      createMultipleItemsWithPropsExpectFailure(alice, collectionId, args);
     });
   });
 
   it('Trying to add bigger property than allowed', async () => {
     await usingApi(async (api: ApiPromise) => {
-      const collectionId = await createCollectionWithPropsExpectSuccess({properties: [{key: 'key1', value: 'v'}],
-        propPerm:   [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}]});
+      const collectionId = await createCollectionWithPropsExpectSuccess({propPerm:   [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]});
       const itemsListIndexBefore = await getLastTokenId(api, collectionId);
       expect(itemsListIndexBefore).to.be.equal(0);
-      const args = [{Nft: {const_data: '0x31'}},
-        {Nft: {const_data: '0x32'}},
-        {Nft: {const_data: '0x33'}}];
-
-      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);
-
-      const events = await submitTransactionAsync(alice, createMultipleItemsTx);
-      const result = getCreateItemsResult(events);
-
-
-      await expect(executeTransaction(api, alice, api.tx.unique.setCollectionProperties(collectionId, [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]))).to.be.rejectedWith(/common\.NoSpaceForProperty/);
+      const args = [{Nft: {const_data: '0x31', properties: [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]}},
+        {Nft: {const_data: '0x32', properties: [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]}},
+        {Nft: {const_data: '0x33', properties: [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]}}];
 
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]),
-        )).to.be.rejected;
-      }
+      createMultipleItemsWithPropsExpectFailure(alice, collectionId, args);
     });
   });
 });
modifiedtests/src/createMultipleItemsEx.test.tsdiffbeforeafterboth
--- a/tests/src/createMultipleItemsEx.test.ts
+++ b/tests/src/createMultipleItemsEx.test.ts
@@ -16,7 +16,7 @@
 
 import {expect} from 'chai';
 import privateKey from './substrate/privateKey';
-import usingApi, {executeTransaction, submitTransactionAsync} from './substrate/substrate-api';
+import usingApi, {executeTransaction, submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';
 import {createCollectionExpectSuccess, createCollectionWithPropsExpectSuccess, addCollectionAdminExpectSuccess, getCreateItemsResult} from './util/helpers';
 
 describe('createMultipleItemsEx', () => {
@@ -48,7 +48,7 @@
     });
   });
 
-  it.only('createMultipleItemsEx with property Admin', async () => {
+  it('createMultipleItemsEx with property Admin', async () => {
     const collection = await createCollectionWithPropsExpectSuccess({mode: {type: 'NFT'}, propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: false}}]});
     const alice = privateKey('//Alice');
     const bob = privateKey('//Bob');
@@ -152,26 +152,20 @@
       const data = [
         {
           owner: {substrate: alice.address},
+          properties: [{key: 'key1', value: 'v2'}],
         }, {
-          owner: {substrate: bob.address},
+          owner: {substrate: alice.address},
+          properties: [{key: 'key1', value: 'v2'}],
         }, {
-          owner: {substrate: charlie.address},
+          owner: {substrate: alice.address},
+          properties: [{key: 'key1', value: 'v2'}],
         },
       ];
 
       const tx = api.tx.unique.createMultipleItemsEx(collection, {NFT: data});
-      await executeTransaction(api, alice, tx);
-
-      const events = await submitTransactionAsync(alice, tx);
-      const result = getCreateItemsResult(events);
+      // await executeTransaction(api, alice, tx);
 
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, [{key: 'key1', value: 'v2'}]),
-        )).to.be.rejected;
-      }
+      await submitTransactionExpectFailAsync(alice, tx);
     });
   });
 
@@ -186,26 +180,20 @@
       const data = [
         {
           owner: {substrate: alice.address},
+          properties: [{key: 'key1', value: 'v2'}],
         }, {
-          owner: {substrate: bob.address},
+          owner: {substrate: alice.address},
+          properties: [{key: 'key1', value: 'v2'}],
         }, {
-          owner: {substrate: charlie.address},
+          owner: {substrate: alice.address},
+          properties: [{key: 'key1', value: 'v2'}],
         },
       ];
 
       const tx = api.tx.unique.createMultipleItemsEx(collection, {NFT: data});
-      await executeTransaction(api, alice, tx);
-
-      const events = await submitTransactionAsync(alice, tx);
-      const result = getCreateItemsResult(events);
+      // await executeTransaction(api, alice, tx);
 
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, [{key: 'key1', value: 'v2'}]),
-        )).to.be.rejected;
-      }
+      await submitTransactionExpectFailAsync(alice, tx);
     });
   });
 
@@ -219,31 +207,32 @@
       const data = [
         {
           owner: {substrate: alice.address},
+          properties: [{key: 'key1', value: 'v2'}],
         }, {
           owner: {substrate: bob.address},
+          properties: [{key: 'key1', value: 'v2'}],
         }, {
           owner: {substrate: charlie.address},
+          properties: [{key: 'key1', value: 'v2'}],
         },
       ];
 
       const tx = api.tx.unique.createMultipleItemsEx(collection, {NFT: data});
-      await executeTransaction(api, alice, tx);
-
-      const events = await submitTransactionAsync(alice, tx);
-      const result = getCreateItemsResult(events);
 
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, [{key: 'key1', value: 'v2'}]),
-        )).to.be.rejected;
-      }
+      await submitTransactionExpectFailAsync(alice, tx);
     });
   });
 
   it('Adding more than 64 prps', async () => {
-    const collection = await createCollectionWithPropsExpectSuccess();
+    const prps = [{key: 'key', value: 'v'}];
+    const propPerm = [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}];
+
+    for (let i = 0; i < 65; i++) {
+      prps.push({key: `key${i}`, value: `value${i}`});
+      propPerm.push({key: `key${i}`, permission: {mutable: true, collectionAdmin: true, tokenOwner: true}});
+    }
+
+    const collection = await createCollectionWithPropsExpectSuccess({propPerm: propPerm});
     const alice = privateKey('//Alice');
     const bob = privateKey('//Bob');
     const charlie = privateKey('//Charlie');
@@ -252,40 +241,24 @@
       const data = [
         {
           owner: {substrate: alice.address},
+          properties: prps,
         }, {
-          owner: {substrate: bob.address},
+          owner: {substrate: alice.address},
+          properties: prps,
         }, {
-          owner: {substrate: charlie.address},
+          owner: {substrate: alice.address},
+          properties: prps,
         },
       ];
 
       const tx = api.tx.unique.createMultipleItemsEx(collection, {NFT: data});
-      await executeTransaction(api, alice, tx);
 
-      const events = await submitTransactionAsync(alice, tx);
-      const result = getCreateItemsResult(events);
-
-      const prps = [];
-
-      for (let i = 0; i < 65; i++) {
-        prps.push({key: `key${i}`, value: `value${i}`});
-      }
-
-      await expect(executeTransaction(api, bob, api.tx.unique.setCollectionProperties(collection, prps))).to.be.rejectedWith(/common\.PropertyLimitReached/);
-
-
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, prps),
-        )).to.be.rejected;
-      }
+      await submitTransactionExpectFailAsync(alice, tx);
     });
   });
 
   it('Trying to add bigger property than allowed', async () => {
-    const collection = await createCollectionWithPropsExpectSuccess();
+    const collection = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]});
     const alice = privateKey('//Alice');
     const bob = privateKey('//Bob');
     const charlie = privateKey('//Charlie');
@@ -293,32 +266,17 @@
     await usingApi(async (api) => {
       const data = [
         {
-          owner: {substrate: alice.address},
+          owner: {substrate: alice.address}, properties: [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}],
         }, {
-          owner: {substrate: bob.address},
+          owner: {substrate: bob.address}, properties: [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}],
         }, {
-          owner: {substrate: charlie.address},
+          owner: {substrate: charlie.address}, properties: [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}],
         },
       ];
 
       const tx = api.tx.unique.createMultipleItemsEx(collection, {NFT: data});
-      await executeTransaction(api, alice, tx);
 
-      const events = await submitTransactionAsync(alice, tx);
-      const result = getCreateItemsResult(events);
-
-      const prps = [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}];
-
-      await expect(executeTransaction(api, bob, api.tx.unique.setCollectionProperties(collection, prps))).to.be.rejectedWith(/common\.NoSpaceForProperty/);
-
-
-      for (const elem of result) {
-        await expect(executeTransaction(
-          api,
-          bob,
-          api.tx.unique.setTokenProperties(elem.collectionId, elem.itemId, prps),
-        )).to.be.rejected;
-      }
+      await submitTransactionExpectFailAsync(alice, tx);
     });
   });
 
modifiedtests/src/interfaces/rmrk/definitions.tsdiffbeforeafterboth
before · tests/src/interfaces/rmrk/definitions.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import types from '../lookup';1819type RpcParam = {20  name: string;21  type: string;22  isOptional?: true;23};2425const atParam = {name: 'at', type: 'Hash', isOptional: true};26const fn = (description: string, params: RpcParam[], type: string) => ({27    description,28    params: [...params, atParam],29    type,30});3132export default {33    types,34    rpc: {35        lastCollectionIdx: fn('Get the latest created collection id', [], 'u32'),36        collectionById: fn('Get collection by id', [{name: 'id', type: 'u32'}], 'Option<RmrkTypesCollectionInfo>'),37        nftById: fn(38            'Get NFT by collection id and NFT id',39            [40                {name: 'collectionId', type: 'u32'},41                {name: 'nftId', type: 'u32'},42            ],43            'Option<RmrkTypesNftInfo>'44        ),45        accountTokens: fn(46            'Get tokens owned by an account in a collection',47            [48                {name: 'accountId', type: 'AccountId32'},49                {name: 'collectionId', type: 'u32'}50            ],51            'Vec<u32>'52        ),53        nftChildren: fn(54            'Get NFT children',55            [56                {name: 'collectionId', type: 'u32'},57                {name: 'nftId', type: 'u32'},58            ],59            'Vec<RmrkTypesNftChild>'60        ),61        collectionProperties: fn(62            'Get collection properties',63            [{name: 'collectionId', type: 'u32'}],64            'Vec<RmrkTypesPropertyInfo>'65        ),66        nftProperties: fn(67            'Get NFT properties',68            [69                {name: 'collectionId', type: 'u32'},70                {name: 'nftId', type: 'u32'}71            ],72            'Vec<RmrkTypesPropertyInfo>'73        ),74        nftResources: fn(75            'Get NFT resources',76            [77                {name: 'collectionId', type: 'u32'},78                {name: 'nftId', type: 'u32'}79            ],80            'Vec<RmrkTypesResourceInfo>'81        ),82        nftResourcePriorities: fn(83            'Get NFT resource priorities',84            [85                {name: 'collectionId', type: 'u32'},86                {name: 'nftId', type: 'u32'}87            ],88            'Vec<Bytes>'89        ),90        base: fn(91            'Get base info',92            [{name: 'baseId', type: 'u32'}],93            'Option<RmrkTypesBaseInfo>'94        ),95        baseParts: fn(96            'Get all Base\'s parts',97            [{name: 'baseId', type: 'u32'}],98            'Vec<RmrkTypesPartType>'99        ),100        themeNames: fn(101            'Get Base\'s theme names',102            [{name: 'baseId', type: 'u32'}],103            'Vec<Bytes>'104        ),105        themes: fn(106            'Get Theme\'s keys values',107            [108                {name: 'baseId', type: 'u32'},109                {name: 'themeName', type: 'String'},110                {name: 'keys', type: 'Option<Vec<String>>'}111            ],112            'Option<RmrkTypesTheme>'113        )114    }115};
after · tests/src/interfaces/rmrk/definitions.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import types from '../lookup';1819type RpcParam = {20  name: string;21  type: string;22  isOptional?: true;23};2425const atParam = {name: 'at', type: 'Hash', isOptional: true};26const fn = (description: string, params: RpcParam[], type: string) => ({27  description,28  params: [...params, atParam],29  type,30});3132export default {33  types,34  rpc: {35    lastCollectionIdx: fn('Get the latest created collection id', [], 'u32'),36    collectionById: fn('Get collection by id', [{name: 'id', type: 'u32'}], 'Option<RmrkTypesCollectionInfo>'),37    nftById: fn(38      'Get NFT by collection id and NFT id',39      [40        {name: 'collectionId', type: 'u32'},41        {name: 'nftId', type: 'u32'},42      ],43      'Option<RmrkTypesNftInfo>',44    ),45    accountTokens: fn(46      'Get tokens owned by an account in a collection',47      [48        {name: 'accountId', type: 'AccountId32'},49        {name: 'collectionId', type: 'u32'},50      ],51      'Vec<u32>',52    ),53    nftChildren: fn(54      'Get NFT children',55      [56        {name: 'collectionId', type: 'u32'},57        {name: 'nftId', type: 'u32'},58      ],59      'Vec<RmrkTypesNftChild>',60    ),61    collectionProperties: fn(62      'Get collection properties',63      [{name: 'collectionId', type: 'u32'}],64      'Vec<RmrkTypesPropertyInfo>',65    ),66    nftProperties: fn(67      'Get NFT properties',68      [69        {name: 'collectionId', type: 'u32'},70        {name: 'nftId', type: 'u32'},71      ],72      'Vec<RmrkTypesPropertyInfo>',73    ),74    nftResources: fn(75      'Get NFT resources',76      [77        {name: 'collectionId', type: 'u32'},78        {name: 'nftId', type: 'u32'},79      ],80      'Vec<RmrkTypesResourceInfo>',81    ),82    nftResourcePriorities: fn(83      'Get NFT resource priorities',84      [85        {name: 'collectionId', type: 'u32'},86        {name: 'nftId', type: 'u32'},87      ],88      'Vec<Bytes>',89    ),90    base: fn(91      'Get base info',92      [{name: 'baseId', type: 'u32'}],93      'Option<RmrkTypesBaseInfo>',94    ),95    baseParts: fn(96      'Get all Base\'s parts',97      [{name: 'baseId', type: 'u32'}],98      'Vec<RmrkTypesPartType>',99    ),100    themeNames: fn(101      'Get Base\'s theme names',102      [{name: 'baseId', type: 'u32'}],103      'Vec<Bytes>',104    ),105    themes: fn(106      'Get Theme\'s keys values',107      [108        {name: 'baseId', type: 'u32'},109        {name: 'themeName', type: 'String'},110        {name: 'keys', type: 'Option<Vec<String>>'},111      ],112      'Option<RmrkTypesTheme>',113    ),114  },115};
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -1135,7 +1135,32 @@
     const events = await submitTransactionAsync(sender, tx);
     const result = getCreateItemsResult(events);
 
-    for (let res of result) {
+    for (const res of result) {
+      expect(await api.rpc.unique.tokenProperties(collectionId, res.itemId)).not.to.be.empty;
+    }
+  });
+}
+
+export async function createMultipleItemsWithPropsExpectFailure(sender: IKeyringPair, collectionId: number, itemsData: any, owner: CrossAccountId | string = sender.address) {
+  await usingApi(async (api) => {
+    const to = normalizeAccountId(owner);
+    const tx = api.tx.unique.createMultipleItems(collectionId, to, itemsData);
+
+    const events = await expect(await submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
+    const result = getCreateItemsResult(events);
+
+    expect(result).to.be.equal(false);
+  });
+}
+
+export async function createMultipleItemsExWithPropsExpectSuccess(sender: IKeyringPair, collectionId: number, itemsData: any) {
+  await usingApi(async (api) => {
+    const tx = api.tx.unique.createMultipleItemsEx(collectionId, itemsData);
+
+    const events = await submitTransactionAsync(sender, tx);
+    const result = getCreateItemsResult(events);
+
+    for (const res of result) {
       expect(await api.rpc.unique.tokenProperties(collectionId, res.itemId)).not.to.be.empty;
     }
   });
@@ -1156,7 +1181,7 @@
       const createData = {refungible: {const_data: [], pieces: 100}};
       tx = api.tx.unique.createItem(collectionId, to, createData as any);
     } else {
-      const data = api.createType('UpDataStructsCreateItemData', { NFT: { constData: 'test', properties: props}});
+      const data = api.createType('UpDataStructsCreateItemData', {NFT: {constData: 'test', properties: props}});
       tx = api.tx.unique.createItem(collectionId, to, data as UpDataStructsCreateItemData);
     }
 
@@ -1186,6 +1211,25 @@
   return newItemId;
 }
 
+export async function createItemWithPropsExpectFailure(sender: IKeyringPair, collectionId: number, createMode: string, props: Array<Property>, owner: CrossAccountId | string = sender.address) {
+  await usingApi(async (api) => {
+
+    let tx;
+    if (createMode === 'NFT') {
+      const data = api.createType('UpDataStructsCreateItemData', {NFT: {constData: 'test', properties: props}});
+      tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), data);
+    } else {
+      tx = api.tx.unique.createItem(collectionId, normalizeAccountId(owner), createMode);
+    }
+
+
+    const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;
+    const result = getCreateItemResult(events);
+
+    expect(result.success).to.be.false;
+  });
+}
+
 export async function createItemExpectSuccess(sender: IKeyringPair, collectionId: number, createMode: string, owner: CrossAccountId | string = sender.address) {
   let newItemId = 0;
   await usingApi(async (api) => {