git.delta.rocks / unique-network / refs/commits / 0f7bb4adb180

difftreelog

source

tests/src/createMultipleItems.test.ts24.8 KiBsourcehistory
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 {ApiPromise} from '@polkadot/api';18import {IKeyringPair} from '@polkadot/types/types';19import chai from 'chai';20import chaiAsPromised from 'chai-as-promised';21import privateKey from './substrate/privateKey';22import {default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync, executeTransaction} from './substrate/substrate-api';23import {24  createCollectionExpectSuccess,25  destroyCollectionExpectSuccess,26  getGenericResult,27  normalizeAccountId,28  setCollectionLimitsExpectSuccess,29  addCollectionAdminExpectSuccess,30  getBalance,31  getTokenOwner,32  getLastTokenId,33  getCreatedCollectionCount,34  createCollectionWithPropsExpectSuccess,35  createMultipleItemsWithPropsExpectSuccess,36  getTokenProperties,37} from './util/helpers';3839chai.use(chaiAsPromised);40const expect = chai.expect;4142describe('Integration Test createMultipleItems(collection_id, owner, items_data):', () => {43  it('Create 0x31, 0x32, 0x33 items in active NFT collection and verify tokens data in chain', async () => {44    await usingApi(async (api: ApiPromise) => {45      const collectionId = await createCollectionExpectSuccess();46      const itemsListIndexBefore = await getLastTokenId(api, collectionId);47      expect(itemsListIndexBefore).to.be.equal(0);4849      const alice = privateKey('//Alice');50      await submitTransactionAsync(51        alice, 52        api.tx.unique.setPropertyPermissions(collectionId, [{key: 'data', permission: {tokenOwner: true}}]),53      );54      55      const args = [56        {NFT: {properties: [{key: 'data', value: '1'}]}},57        {NFT: {properties: [{key: 'data', value: '2'}]}},58        {NFT: {properties: [{key: 'data', value: '3'}]}},59      ];60      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);61      await submitTransactionAsync(alice, createMultipleItemsTx);62      const itemsListIndexAfter = await getLastTokenId(api, collectionId);63      expect(itemsListIndexAfter).to.be.equal(3);6465      expect(await getTokenOwner(api, collectionId, 1)).to.be.deep.equal(normalizeAccountId(alice.address));66      expect(await getTokenOwner(api, collectionId, 2)).to.be.deep.equal(normalizeAccountId(alice.address));67      expect(await getTokenOwner(api, collectionId, 3)).to.be.deep.equal(normalizeAccountId(alice.address));6869      expect((await getTokenProperties(api, collectionId, 1, ['data']))[0].value).to.be.equal('1');70      expect((await getTokenProperties(api, collectionId, 2, ['data']))[0].value).to.be.equal('2');71      expect((await getTokenProperties(api, collectionId, 3, ['data']))[0].value).to.be.equal('3');72    });73  });7475  it('Create 0x01, 0x02, 0x03 items in active Fungible collection and verify tokens data in chain', async () => {76    await usingApi(async (api: ApiPromise) => {77      const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});78      const itemsListIndexBefore = await getLastTokenId(api, collectionId);79      expect(itemsListIndexBefore).to.be.equal(0);80      const alice = privateKey('//Alice');81      const args = [82        {Fungible: {value: 1}},83        {Fungible: {value: 2}},84        {Fungible: {value: 3}},85      ];86      const createMultipleItemsTx = api.tx.unique87        .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);88      await submitTransactionAsync(alice, createMultipleItemsTx);89      const token1Data = await getBalance(api, collectionId, alice.address, 0);9091      expect(token1Data).to.be.equal(6n); // 1 + 2 + 392    });93  });9495  it('Create 0x31, 0x32, 0x33 items in active ReFungible collection and verify tokens data in chain', async () => {96    await usingApi(async (api: ApiPromise) => {97      const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});98      const itemsListIndexBefore = await getLastTokenId(api, collectionId);99      expect(itemsListIndexBefore).to.be.equal(0);100      const alice = privateKey('//Alice');101      const args = [102        {ReFungible: {pieces: 1}},103        {ReFungible: {pieces: 2}},104        {ReFungible: {pieces: 3}},105      ];106      const createMultipleItemsTx = api.tx.unique107        .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);108      await submitTransactionAsync(alice, createMultipleItemsTx);109      const itemsListIndexAfter = await getLastTokenId(api, collectionId);110      expect(itemsListIndexAfter).to.be.equal(3);111112      expect(await getBalance(api, collectionId, alice.address, 1)).to.be.equal(1n);113      expect(await getBalance(api, collectionId, alice.address, 2)).to.be.equal(2n);114      expect(await getBalance(api, collectionId, alice.address, 3)).to.be.equal(3n);115    });116  });117118  it('Can mint amount of items equals to collection limits', async () => {119    await usingApi(async (api) => {120      const alice = privateKey('//Alice');121122      const collectionId = await createCollectionExpectSuccess();123      await setCollectionLimitsExpectSuccess(alice, collectionId, {124        tokenLimit: 2,125      });126      const args = [127        {NFT: {}},128        {NFT: {}},129      ];130      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);131      const events = await submitTransactionAsync(alice, createMultipleItemsTx);132      const result = getGenericResult(events);133      expect(result.success).to.be.true;134    });135  });136137  it('Create 0x31, 0x32, 0x33 items in active NFT with property Admin', async () => {138    await usingApi(async (api: ApiPromise) => {139      const collectionId = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: false}}]});140      const itemsListIndexBefore = await getLastTokenId(api, collectionId);141      expect(itemsListIndexBefore).to.be.equal(0);142      const alice = privateKey('//Alice');143      const args = [144        {NFT: {properties: [{key: 'k', value: 'v1'}]}},145        {NFT: {properties: [{key: 'k', value: 'v2'}]}},146        {NFT: {properties: [{key: 'k', value: 'v3'}]}},147      ];148149      await createMultipleItemsWithPropsExpectSuccess(alice, collectionId, args);150      const itemsListIndexAfter = await getLastTokenId(api, collectionId);151      expect(itemsListIndexAfter).to.be.equal(3);152153      expect(await getTokenOwner(api, collectionId, 1)).to.be.deep.equal(normalizeAccountId(alice.address));154      expect(await getTokenOwner(api, collectionId, 2)).to.be.deep.equal(normalizeAccountId(alice.address));155      expect(await getTokenOwner(api, collectionId, 3)).to.be.deep.equal(normalizeAccountId(alice.address));156157      expect((await getTokenProperties(api, collectionId, 1, ['k']))[0].value).to.be.equal('v1');158      expect((await getTokenProperties(api, collectionId, 2, ['k']))[0].value).to.be.equal('v2');159      expect((await getTokenProperties(api, collectionId, 3, ['k']))[0].value).to.be.equal('v3');160    });161  });162163  it('Create 0x31, 0x32, 0x33 items in active NFT with property AdminConst', async () => {164    await usingApi(async (api: ApiPromise) => {165      const collectionId = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'k', permission: {mutable: false, collectionAdmin: true, tokenOwner: false}}]});166      const itemsListIndexBefore = await getLastTokenId(api, collectionId);167      expect(itemsListIndexBefore).to.be.equal(0);168      const alice = privateKey('//Alice');169      const bob = privateKey('//Bob');170      await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);171      const args = [172        {NFT: {properties: [{key: 'k', value: 'v1'}]}},173        {NFT: {properties: [{key: 'k', value: 'v2'}]}},174        {NFT: {properties: [{key: 'k', value: 'v3'}]}},175      ];176177      await createMultipleItemsWithPropsExpectSuccess(alice, collectionId, args);178      const itemsListIndexAfter = await getLastTokenId(api, collectionId);179      expect(itemsListIndexAfter).to.be.equal(3);180181      expect(await getTokenOwner(api, collectionId, 1)).to.be.deep.equal(normalizeAccountId(alice.address));182      expect(await getTokenOwner(api, collectionId, 2)).to.be.deep.equal(normalizeAccountId(alice.address));183      expect(await getTokenOwner(api, collectionId, 3)).to.be.deep.equal(normalizeAccountId(alice.address));184185      expect((await getTokenProperties(api, collectionId, 1, ['k']))[0].value).to.be.equal('v1');186      expect((await getTokenProperties(api, collectionId, 2, ['k']))[0].value).to.be.equal('v2');187      expect((await getTokenProperties(api, collectionId, 3, ['k']))[0].value).to.be.equal('v3');188    });189  });190191  it('Create 0x31, 0x32, 0x33 items in active NFT with property itemOwnerOrAdmin', async () => {192    await usingApi(async (api: ApiPromise) => {193      const collectionId = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]});194      const itemsListIndexBefore = await getLastTokenId(api, collectionId);195      expect(itemsListIndexBefore).to.be.equal(0);196      const alice = privateKey('//Alice');197      const args = [198        {NFT: {properties: [{key: 'k', value: 'v1'}]}},199        {NFT: {properties: [{key: 'k', value: 'v2'}]}},200        {NFT: {properties: [{key: 'k', value: 'v3'}]}},201      ];202203      await createMultipleItemsWithPropsExpectSuccess(alice, collectionId, args);204      const itemsListIndexAfter = await getLastTokenId(api, collectionId);205      expect(itemsListIndexAfter).to.be.equal(3);206207      expect(await getTokenOwner(api, collectionId, 1)).to.be.deep.equal(normalizeAccountId(alice.address));208      expect(await getTokenOwner(api, collectionId, 2)).to.be.deep.equal(normalizeAccountId(alice.address));209      expect(await getTokenOwner(api, collectionId, 3)).to.be.deep.equal(normalizeAccountId(alice.address));210211      expect((await getTokenProperties(api, collectionId, 1, ['k']))[0].value).to.be.equal('v1');212      expect((await getTokenProperties(api, collectionId, 2, ['k']))[0].value).to.be.equal('v2');213      expect((await getTokenProperties(api, collectionId, 3, ['k']))[0].value).to.be.equal('v3');214    });215  });216});217218describe('Integration Test createMultipleItems(collection_id, owner, items_data) with collection admin permissions:', () => {219  let alice: IKeyringPair;220  let bob: IKeyringPair;221222  before(async () => {223    await usingApi(async () => {224      alice = privateKey('//Alice');225      bob = privateKey('//Bob');226    });227  });228229  it('Create 0x31, 0x32, 0x33 items in active NFT collection and verify tokens data in chain', async () => {230    await usingApi(async (api: ApiPromise) => {231      const collectionId = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'data', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]});232      const itemsListIndexBefore = await getLastTokenId(api, collectionId);233      expect(itemsListIndexBefore).to.be.equal(0);234      await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);235      const args = [236        {NFT: {properties: [{key: 'data', value: 'v1'}]}},237        {NFT: {properties: [{key: 'data', value: 'v2'}]}},238        {NFT: {properties: [{key: 'data', value: 'v3'}]}},239      ];240      const createMultipleItemsTx = api.tx.unique241        .createMultipleItems(collectionId, normalizeAccountId(bob.address), args);242      await submitTransactionAsync(bob, createMultipleItemsTx);243      const itemsListIndexAfter = await getLastTokenId(api, collectionId);244      expect(itemsListIndexAfter).to.be.equal(3);245246      expect(await getTokenOwner(api, collectionId, 1)).to.be.deep.equal(normalizeAccountId(bob.address));247      expect(await getTokenOwner(api, collectionId, 2)).to.be.deep.equal(normalizeAccountId(bob.address));248      expect(await getTokenOwner(api, collectionId, 3)).to.be.deep.equal(normalizeAccountId(bob.address));249250      expect((await getTokenProperties(api, collectionId, 1, ['data']))[0].value).to.be.equal('v1');251      expect((await getTokenProperties(api, collectionId, 2, ['data']))[0].value).to.be.equal('v2');252      expect((await getTokenProperties(api, collectionId, 3, ['data']))[0].value).to.be.equal('v3');253    });254  });255256  it('Create 0x01, 0x02, 0x03 items in active Fungible collection and verify tokens data in chain', async () => {257    await usingApi(async (api: ApiPromise) => {258      const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});259      const itemsListIndexBefore = await getLastTokenId(api, collectionId);260      expect(itemsListIndexBefore).to.be.equal(0);261      await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);262      const args = [263        {Fungible: {value: 1}},264        {Fungible: {value: 2}},265        {Fungible: {value: 3}},266      ];267      const createMultipleItemsTx = api.tx.unique268        .createMultipleItems(collectionId, normalizeAccountId(bob.address), args);269      await submitTransactionAsync(bob, createMultipleItemsTx);270      const token1Data = await getBalance(api, collectionId, bob.address, 0);271272      expect(token1Data).to.be.equal(6n); // 1 + 2 + 3273    });274  });275276  it('Create 0x31, 0x32, 0x33 items in active ReFungible collection and verify tokens data in chain', async () => {277    await usingApi(async (api: ApiPromise) => {278      const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});279      const itemsListIndexBefore = await getLastTokenId(api, collectionId);280      expect(itemsListIndexBefore).to.be.equal(0);281      await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);282      const args = [283        {ReFungible: {pieces: 1}},284        {ReFungible: {pieces: 2}},285        {ReFungible: {pieces: 3}},286      ];287      const createMultipleItemsTx = api.tx.unique288        .createMultipleItems(collectionId, normalizeAccountId(bob.address), args);289      await submitTransactionAsync(bob, createMultipleItemsTx);290      const itemsListIndexAfter = await getLastTokenId(api, collectionId);291      expect(itemsListIndexAfter).to.be.equal(3);292293      expect(await getBalance(api, collectionId, bob.address, 1)).to.be.equal(1n);294      expect(await getBalance(api, collectionId, bob.address, 2)).to.be.equal(2n);295      expect(await getBalance(api, collectionId, bob.address, 3)).to.be.equal(3n);296    });297  });298});299300describe('Negative Integration Test createMultipleItems(collection_id, owner, items_data):', () => {301  let alice: IKeyringPair;302  let bob: IKeyringPair;303304  before(async () => {305    await usingApi(async () => {306      alice = privateKey('//Alice');307      bob = privateKey('//Bob');308    });309  });310311  it('Regular user cannot create items in active NFT collection', async () => {312    await usingApi(async (api: ApiPromise) => {313      const collectionId = await createCollectionExpectSuccess();314      const itemsListIndexBefore = await getLastTokenId(api, collectionId);315      expect(itemsListIndexBefore).to.be.equal(0);316      const args = [{NFT: {}},317        {NFT: {}},318        {NFT: {}}];319      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);320      await expect(executeTransaction(api, bob, createMultipleItemsTx)).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);321    });322  });323324  it('Regular user cannot create items in active Fungible collection', async () => {325    await usingApi(async (api: ApiPromise) => {326      const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});327      const itemsListIndexBefore = await getLastTokenId(api, collectionId);328      expect(itemsListIndexBefore).to.be.equal(0);329      const args = [330        {Fungible: {value: 1}},331        {Fungible: {value: 2}},332        {Fungible: {value: 3}},333      ];334      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);335      await expect(executeTransaction(api, bob, createMultipleItemsTx)).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);336    });337  });338339  it('Regular user cannot create items in active ReFungible collection', async () => {340    await usingApi(async (api: ApiPromise) => {341      const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});342      const itemsListIndexBefore = await getLastTokenId(api, collectionId);343      expect(itemsListIndexBefore).to.be.equal(0);344      const args = [345        {ReFungible: {pieces: 1}},346        {ReFungible: {pieces: 1}},347        {ReFungible: {pieces: 1}},348      ];349      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);350      await expect(executeTransaction(api, bob, createMultipleItemsTx)).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);351    });352  });353354  it('Create token in not existing collection', async () => {355    await usingApi(async (api: ApiPromise) => {356      const collectionId = await getCreatedCollectionCount(api) + 1;357      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'NFT', 'NFT']);358      await expect(executeTransaction(api, alice, createMultipleItemsTx)).to.be.rejectedWith(/common\.CollectionNotFound/);359    });360  });361362  it('Create NFT and Re-fungible tokens that has reached the maximum data limit', async () => {363    await usingApi(async (api: ApiPromise) => {364      // NFT365      const collectionId = await createCollectionWithPropsExpectSuccess({366        propPerm: [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}],367      });368      const alice = privateKey('//Alice');369      const args = [370        {NFT: {properties: [{key: 'key', value: 'A'.repeat(32769)}]}},371        {NFT: {properties: [{key: 'key', value: 'B'.repeat(32769)}]}},372        {NFT: {properties: [{key: 'key', value: 'C'.repeat(32769)}]}},373      ];374      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);375      await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;376377      // ReFungible378      const collectionIdReFungible =379        await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});380      const argsReFungible = [381        {ReFungible: ['1'.repeat(2049), 10]},382        {ReFungible: ['2'.repeat(2049), 10]},383        {ReFungible: ['3'.repeat(2049), 10]},384      ];385      const createMultipleItemsTxFungible = api.tx.unique386        .createMultipleItems(collectionIdReFungible, normalizeAccountId(alice.address), argsReFungible);387      await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTxFungible)).to.be.rejected;388    });389  });390391  it('Create tokens with different types', async () => {392    await usingApi(async (api: ApiPromise) => {393      const collectionId = await createCollectionExpectSuccess();394      const createMultipleItemsTx = api.tx.unique395        .createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'Fungible', 'ReFungible']);396      await expect(executeTransaction(api, alice, createMultipleItemsTx)).to.be.rejectedWith(/nonfungible\.NotNonfungibleDataUsedToMintFungibleCollectionToken/);397      // garbage collection :-D // lol398      await destroyCollectionExpectSuccess(collectionId);399    });400  });401402  it('Create tokens with different data limits <> maximum data limit', async () => {403    await usingApi(async (api: ApiPromise) => {404      const collectionId = await createCollectionWithPropsExpectSuccess({405        propPerm: [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}],406      });407      const args = [408        {NFT: {properties: [{key: 'key', value: 'A'}]}},409        {NFT: {properties: [{key: 'key', value: 'B'.repeat(32769)}]}},410      ];411      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);412      await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;413    });414  });415416  it('Fails when minting tokens exceeds collectionLimits amount', async () => {417    await usingApi(async (api) => {418      const collectionId = await createCollectionExpectSuccess();419      await setCollectionLimitsExpectSuccess(alice, collectionId, {420        tokenLimit: 1,421      });422      const args = [423        {NFT: {}},424        {NFT: {}},425      ];426      const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);427      await expect(executeTransaction(api, alice, createMultipleItemsTx)).to.be.rejectedWith(/common\.CollectionTokenLimitExceeded/);428    });429  });430431  it('User doesnt have editing rights', async () => {432    await usingApi(async (api: ApiPromise) => {433      const collectionId = await createCollectionWithPropsExpectSuccess({434        propPerm: [{key: 'key1', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}],435      });436      const itemsListIndexBefore = await getLastTokenId(api, collectionId);437      expect(itemsListIndexBefore).to.be.equal(0);438      await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);439      const args = [440        {NFT: {properties: [{key: 'key1', value: 'v2'}]}},441        {NFT: {}},442        {NFT: {}},443      ];444445      const tx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(bob.address), args);446      await expect(executeTransaction(api, bob, tx)).to.be.rejectedWith(/common\.NoPermission/);447    });448  });449450  it('Adding property without access rights', async () => {451    await usingApi(async (api: ApiPromise) => {452      const collectionId = await createCollectionWithPropsExpectSuccess({properties: [{key: 'k', value: 'v1'}]});453      const itemsListIndexBefore = await getLastTokenId(api, collectionId);454      await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);455      expect(itemsListIndexBefore).to.be.equal(0);456      const args = [{NFT: {properties: [{key: 'k', value: 'v'}]}},457        {NFT: {}},458        {NFT: {}}];459460      const tx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(bob.address), args);461      await expect(executeTransaction(api, bob, tx)).to.be.rejectedWith(/common\.NoPermission/);462    });463  });464465  it('Adding more than 64 prps', async () => {466    await usingApi(async (api: ApiPromise) => {467      const propPerms = [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}];468      for (let i = 0; i < 65; i++) {469        propPerms.push({key: `key${i}`, permission: {mutable: true, collectionAdmin: true, tokenOwner: true}});470      }471472      const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});473474      const tx1 = api.tx.unique.setPropertyPermissions(collectionId, propPerms);475      await expect(executeTransaction(api, alice, tx1)).to.be.rejectedWith(/common\.PropertyLimitReached/);476477      const itemsListIndexBefore = await getLastTokenId(api, collectionId);478      expect(itemsListIndexBefore).to.be.equal(0);479      await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);480481      const prps = [];482483      for (let i = 0; i < 65; i++) {484        prps.push({key: `key${i}`, value: `value${i}`});485      }486487      const args = [488        {NFT: {properties: prps}},489        {NFT: {properties: prps}},490        {NFT: {properties: prps}},491      ];492493      // there are no permissions, but will fail anyway because of too much weight for a block494      const tx2 = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);495      await expect(submitTransactionExpectFailAsync(alice, tx2)).to.be.rejected;496    });497  });498499  it('Trying to add bigger property than allowed', async () => {500    await usingApi(async (api: ApiPromise) => {501      const collectionId = await createCollectionWithPropsExpectSuccess({502        propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}],503      });504      const itemsListIndexBefore = await getLastTokenId(api, collectionId);505      expect(itemsListIndexBefore).to.be.equal(0);506      const args = [{NFT: {properties: [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]}},507        {NFT: {properties: [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]}},508        {NFT: {properties: [{key: 'k', value: 'vvvvvv'.repeat(5000)}, {key: 'k2', value: 'vvv'.repeat(5000)}]}}];509510      const tx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);511      await expect(executeTransaction(api, alice, tx)).to.be.rejectedWith(/common\.NoPermission/);512    });513  });514});