difftreelog
wip migrating createMultipleItems
in: master
1 file changed
tests/src/createMultipleItems.test.tsdiffbeforeafterboth37 Pallets,37 Pallets,38 checkPalletsPresence,38 checkPalletsPresence,39} from './util/helpers';39} from './util/helpers';40import {usingPlaygrounds} from './util/playgrounds';404141chai.use(chaiAsPromised);42chai.use(chaiAsPromised);42const expect = chai.expect;43const expect = chai.expect;434445let donor: IKeyringPair;4647before(async () => {48 await usingPlaygrounds(async (_, privateKey) => {49 donor = privateKey('//Alice');50 });51});5253let alice: IKeyringPair;54let bob: IKeyringPair;5544describe('Integration Test createMultipleItems(collection_id, owner, items_data):', () => {56describe('Integration Test createMultipleItems(collection_id, owner, items_data):', () => {45 it('Create 0x31, 0x32, 0x33 items in active NFT collection and verify tokens data in chain', async () => {57 before(async () => {46 await usingApi(async (api, privateKeyWrapper) => {58 await usingPlaygrounds(async (helper) => {47 const collectionId = await createCollectionExpectSuccess();59 [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);48 const itemsListIndexBefore = await getLastTokenId(api, collectionId);60 });49 expect(itemsListIndexBefore).to.be.equal(0);61 });506251 const alice = privateKeyWrapper('//Alice');63 it('Create 0x31, 0x32, 0x33 items in active NFT collection and verify tokens data in chain', async () => {64 await usingPlaygrounds(async (helper) => {52 await submitTransactionAsync(65 const collection = await helper.nft.mintCollection(alice, {53 alice, 66 name: 'name',67 description: 'descr',54 api.tx.unique.setTokenPropertyPermissions(collectionId, [{key: 'data', permission: {tokenOwner: true}}]),68 tokenPrefix: 'COL',69 tokenPropertyPermissions: [70 {key: 'data', permission: {tokenOwner: true, mutable: false, collectionAdmin: false}},55 );71 ],56 72 });57 const args = [73 const args = [58 {NFT: {properties: [{key: 'data', value: '1'}]}},74 {properties: [{key: 'data', value: '1'}]},59 {NFT: {properties: [{key: 'data', value: '2'}]}},75 {properties: [{key: 'data', value: '2'}]},60 {NFT: {properties: [{key: 'data', value: '3'}]}},76 {properties: [{key: 'data', value: '3'}]},61 ];77 ];62 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);78 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);63 await submitTransactionAsync(alice, createMultipleItemsTx);79 for (const [i, token] of tokens.entries()) {64 const itemsListIndexAfter = await getLastTokenId(api, collectionId);65 expect(itemsListIndexAfter).to.be.equal(3);80 const tokenData = await token.getData();6667 expect(await getTokenOwner(api, collectionId, 1)).to.be.deep.equal(normalizeAccountId(alice.address));68 expect(await getTokenOwner(api, collectionId, 2)).to.be.deep.equal(normalizeAccountId(alice.address));81 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});69 expect(await getTokenOwner(api, collectionId, 3)).to.be.deep.equal(normalizeAccountId(alice.address));7071 expect((await getTokenProperties(api, collectionId, 1, ['data']))[0].value).to.be.equal('1');82 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);72 expect((await getTokenProperties(api, collectionId, 2, ['data']))[0].value).to.be.equal('2');73 expect((await getTokenProperties(api, collectionId, 3, ['data']))[0].value).to.be.equal('3');83 }74 });84 });75 });85 });768677 it('Create 0x01, 0x02, 0x03 items in active Fungible collection and verify tokens data in chain', async () => {87 it('Create 0x01, 0x02, 0x03 items in active Fungible collection and verify tokens data in chain', async () => {78 await usingApi(async (api, privateKeyWrapper) => {88 await usingPlaygrounds(async (helper) => {79 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});89 const collection = await helper.ft.mintCollection(alice, {90 name: 'name',80 const itemsListIndexBefore = await getLastTokenId(api, collectionId);91 description: 'descr',81 expect(itemsListIndexBefore).to.be.equal(0);92 tokenPrefix: 'COL',82 const alice = privateKeyWrapper('//Alice');93 });83 const args = [94 const args = [84 {Fungible: {value: 1}},95 {value: 1n},85 {Fungible: {value: 2}},96 {value: 2n},86 {Fungible: {value: 3}},97 {value: 3n},87 ];98 ];88 const createMultipleItemsTx = api.tx.unique99 await helper.ft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);89 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);90 await submitTransactionAsync(alice, createMultipleItemsTx);100 expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(6n);91 const token1Data = await getBalance(api, collectionId, alice.address, 0);9293 expect(token1Data).to.be.equal(6n); // 1 + 2 + 394 });101 });95 });102 });9610397 it('Create 0x31, 0x32, 0x33 items in active ReFungible collection and verify tokens data in chain', async function() {104 it('Create 0x31, 0x32, 0x33 items in active ReFungible collection and verify tokens data in chain', async function() {98 await requirePallets(this, [Pallets.ReFungible]);105 await usingPlaygrounds(async (helper) => {99100 await usingApi(async (api, privateKeyWrapper) => {101 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});106 const collection = await helper.rft.mintCollection(alice, {107 name: 'name',102 const itemsListIndexBefore = await getLastTokenId(api, collectionId);108 description: 'descr',103 expect(itemsListIndexBefore).to.be.equal(0);109 tokenPrefix: 'COL',104 const alice = privateKeyWrapper('//Alice');110 });105 const args = [111 const args = [106 {ReFungible: {pieces: 1}},112 {pieces: 1n},107 {ReFungible: {pieces: 2}},113 {pieces: 2n},108 {ReFungible: {pieces: 3}},114 {pieces: 3n},109 ];115 ];110 const createMultipleItemsTx = api.tx.unique116 const tokens = await helper.rft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);111 .createMultipleItems(collectionId, normalizeAccountId(alice.address), args);112 await submitTransactionAsync(alice, createMultipleItemsTx);113 const itemsListIndexAfter = await getLastTokenId(api, collectionId);114 expect(itemsListIndexAfter).to.be.equal(3);115117116 expect(await getBalance(api, collectionId, alice.address, 1)).to.be.equal(1n);118 for (const [i, token] of tokens.entries()) {117 expect(await getBalance(api, collectionId, alice.address, 2)).to.be.equal(2n);119 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(BigInt(i + 1));118 expect(await getBalance(api, collectionId, alice.address, 3)).to.be.equal(3n);120 }119 });121 });120 });122 });121123122 it('Can mint amount of items equals to collection limits', async () => {124 it('Can mint amount of items equals to collection limits', async () => {123 await usingApi(async (api, privateKeyWrapper) => {125 await usingPlaygrounds(async (helper) => {124 const alice = privateKeyWrapper('//Alice');126 const collection = await helper.nft.mintCollection(alice, {125127 name: 'name',126 const collectionId = await createCollectionExpectSuccess();128 description: 'descr',127 await setCollectionLimitsExpectSuccess(alice, collectionId, {129 tokenPrefix: 'COL',130 limits: {128 tokenLimit: 2,131 tokenLimit: 2,132 },129 });133 });130 const args = [134 const args = [{}, {}];131 {NFT: {}},132 {NFT: {}},133 ];134 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);135 await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);135 const events = await submitTransactionAsync(alice, createMultipleItemsTx);136 const result = getGenericResult(events);137 expect(result.success).to.be.true;138 });136 });139 });137 });140138141 it('Create 0x31, 0x32, 0x33 items in active NFT with property Admin', async () => {139 it('Create 0x31, 0x32, 0x33 items in active NFT with property Admin', async () => {142 await usingApi(async (api, privateKeyWrapper) => {140 await usingPlaygrounds(async (helper) => {143 const collectionId = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: false}}]});141 const collection = await helper.nft.mintCollection(alice, {142 name: 'name',143 description: 'descr',144 tokenPrefix: 'COL',145 tokenPropertyPermissions: [144 const itemsListIndexBefore = await getLastTokenId(api, collectionId);146 {key: 'data', permission: {tokenOwner: false, mutable: true, collectionAdmin: true}},145 expect(itemsListIndexBefore).to.be.equal(0);146 const alice = privateKeyWrapper('//Alice');147 ],148 });147 const args = [149 const args = [148 {NFT: {properties: [{key: 'k', value: 'v1'}]}},150 {properties: [{key: 'data', value: '1'}]},149 {NFT: {properties: [{key: 'k', value: 'v2'}]}},151 {properties: [{key: 'data', value: '2'}]},150 {NFT: {properties: [{key: 'k', value: 'v3'}]}},152 {properties: [{key: 'data', value: '3'}]},151 ];153 ];152153 await createMultipleItemsWithPropsExpectSuccess(alice, collectionId, args);154 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);154 const itemsListIndexAfter = await getLastTokenId(api, collectionId);155 for (const [i, token] of tokens.entries()) {155 expect(itemsListIndexAfter).to.be.equal(3);156 const tokenData = await token.getData();156157 expect(await getTokenOwner(api, collectionId, 1)).to.be.deep.equal(normalizeAccountId(alice.address));158 expect(await getTokenOwner(api, collectionId, 2)).to.be.deep.equal(normalizeAccountId(alice.address));157 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});159 expect(await getTokenOwner(api, collectionId, 3)).to.be.deep.equal(normalizeAccountId(alice.address));160161 expect((await getTokenProperties(api, collectionId, 1, ['k']))[0].value).to.be.equal('v1');158 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);162 expect((await getTokenProperties(api, collectionId, 2, ['k']))[0].value).to.be.equal('v2');163 expect((await getTokenProperties(api, collectionId, 3, ['k']))[0].value).to.be.equal('v3');159 }164 });160 });165 });161 });166162167 it('Create 0x31, 0x32, 0x33 items in active NFT with property AdminConst', async () => {163 it('Create 0x31, 0x32, 0x33 items in active NFT with property AdminConst', async () => {168 await usingApi(async (api, privateKeyWrapper) => {164 await usingPlaygrounds(async (helper) => {169 const collectionId = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'k', permission: {mutable: false, collectionAdmin: true, tokenOwner: false}}]});165 const collection = await helper.nft.mintCollection(alice, {166 name: 'name',167 description: 'descr',170 const itemsListIndexBefore = await getLastTokenId(api, collectionId);168 tokenPrefix: 'COL',171 expect(itemsListIndexBefore).to.be.equal(0);169 tokenPropertyPermissions: [172 const alice = privateKeyWrapper('//Alice');170 {key: 'data', permission: {tokenOwner: false, mutable: false, collectionAdmin: true}},173 const bob = privateKeyWrapper('//Bob');174 await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);171 ],172 });175 const args = [173 const args = [176 {NFT: {properties: [{key: 'k', value: 'v1'}]}},174 {properties: [{key: 'data', value: '1'}]},177 {NFT: {properties: [{key: 'k', value: 'v2'}]}},175 {properties: [{key: 'data', value: '2'}]},178 {NFT: {properties: [{key: 'k', value: 'v3'}]}},176 {properties: [{key: 'data', value: '3'}]},179 ];177 ];180181 await createMultipleItemsWithPropsExpectSuccess(alice, collectionId, args);178 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);182 const itemsListIndexAfter = await getLastTokenId(api, collectionId);179 for (const [i, token] of tokens.entries()) {183 expect(itemsListIndexAfter).to.be.equal(3);180 const tokenData = await token.getData();184185 expect(await getTokenOwner(api, collectionId, 1)).to.be.deep.equal(normalizeAccountId(alice.address));186 expect(await getTokenOwner(api, collectionId, 2)).to.be.deep.equal(normalizeAccountId(alice.address));181 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});187 expect(await getTokenOwner(api, collectionId, 3)).to.be.deep.equal(normalizeAccountId(alice.address));188189 expect((await getTokenProperties(api, collectionId, 1, ['k']))[0].value).to.be.equal('v1');182 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);190 expect((await getTokenProperties(api, collectionId, 2, ['k']))[0].value).to.be.equal('v2');191 expect((await getTokenProperties(api, collectionId, 3, ['k']))[0].value).to.be.equal('v3');183 }192 });184 });193 });185 });194186195 it('Create 0x31, 0x32, 0x33 items in active NFT with property itemOwnerOrAdmin', async () => {187 it('Create 0x31, 0x32, 0x33 items in active NFT with property itemOwnerOrAdmin', async () => {196 await usingApi(async (api, privateKeyWrapper) => {188 await usingPlaygrounds(async (helper) => {197 const collectionId = await createCollectionWithPropsExpectSuccess({propPerm: [{key: 'k', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}]});189 const collection = await helper.nft.mintCollection(alice, {190 name: 'name',191 description: 'descr',192 tokenPrefix: 'COL',193 tokenPropertyPermissions: [194 {key: 'data', permission: {tokenOwner: true, mutable: true, collectionAdmin: true}},198 const itemsListIndexBefore = await getLastTokenId(api, collectionId);195 ],199 expect(itemsListIndexBefore).to.be.equal(0);196 });200 const alice = privateKeyWrapper('//Alice');201 const args = [197 const args = [202 {NFT: {properties: [{key: 'k', value: 'v1'}]}},198 {properties: [{key: 'data', value: '1'}]},203 {NFT: {properties: [{key: 'k', value: 'v2'}]}},199 {properties: [{key: 'data', value: '2'}]},204 {NFT: {properties: [{key: 'k', value: 'v3'}]}},200 {properties: [{key: 'data', value: '3'}]},205 ];201 ];206207 await createMultipleItemsWithPropsExpectSuccess(alice, collectionId, args);202 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);208 const itemsListIndexAfter = await getLastTokenId(api, collectionId);203 for (const [i, token] of tokens.entries()) {209 expect(itemsListIndexAfter).to.be.equal(3);204 const tokenData = await token.getData();210211 expect(await getTokenOwner(api, collectionId, 1)).to.be.deep.equal(normalizeAccountId(alice.address));212 expect(await getTokenOwner(api, collectionId, 2)).to.be.deep.equal(normalizeAccountId(alice.address));205 expect(tokenData?.normalizedOwner).to.be.deep.equal({Substrate: alice.address});213 expect(await getTokenOwner(api, collectionId, 3)).to.be.deep.equal(normalizeAccountId(alice.address));214215 expect((await getTokenProperties(api, collectionId, 1, ['k']))[0].value).to.be.equal('v1');206 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);216 expect((await getTokenProperties(api, collectionId, 2, ['k']))[0].value).to.be.equal('v2');217 expect((await getTokenProperties(api, collectionId, 3, ['k']))[0].value).to.be.equal('v3');207 }218 });208 });219 });209 });220});210});308 let bob: IKeyringPair;298 let bob: IKeyringPair;309299310 before(async () => {300 before(async () => {311 await usingApi(async (api, privateKeyWrapper) => {301 await usingPlaygrounds(async (helper) => {312 alice = privateKeyWrapper('//Alice');302 [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);313 bob = privateKeyWrapper('//Bob');314 });303 });315 });304 });316305317 it('Regular user cannot create items in active NFT collection', async () => {306 it('Regular user cannot create items in active NFT collection', async () => {318 await usingApi(async (api: ApiPromise) => {307 await usingPlaygrounds(async (helper) => {319 const collectionId = await createCollectionExpectSuccess();308 const collection = await helper.nft.mintCollection(alice, {320 const itemsListIndexBefore = await getLastTokenId(api, collectionId);309 name: 'name',310 description: 'descr',311 tokenPrefix: 'COL',321 expect(itemsListIndexBefore).to.be.equal(0);312 });322 const args = [{NFT: {}},313 const args = [314 {},323 {NFT: {}},315 {},324 {NFT: {}}];316 ];325 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);317 const mintTx = async () => helper.nft.mintMultipleTokensWithOneOwner(bob, collection.collectionId, {Substrate: alice.address}, args);326 await expect(executeTransaction(api, bob, createMultipleItemsTx)).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);318 await expect(mintTx()).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);327 });319 });328 });320 });329321330 it('Regular user cannot create items in active Fungible collection', async () => {322 it('Regular user cannot create items in active Fungible collection', async () => {331 await usingApi(async (api: ApiPromise) => {323 await usingPlaygrounds(async (helper) => {332 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});324 const collection = await helper.ft.mintCollection(alice, {325 name: 'name',326 description: 'descr',333 const itemsListIndexBefore = await getLastTokenId(api, collectionId);327 tokenPrefix: 'COL',334 expect(itemsListIndexBefore).to.be.equal(0);328 });335 const args = [329 const args = [336 {Fungible: {value: 1}},330 {value: 1n},337 {Fungible: {value: 2}},331 {value: 2n},338 {Fungible: {value: 3}},332 {value: 3n},339 ];333 ];340 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);334 const mintTx = async () => helper.ft.mintMultipleTokensWithOneOwner(bob, collection.collectionId, {Substrate: alice.address}, args);341 await expect(executeTransaction(api, bob, createMultipleItemsTx)).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);335 await expect(mintTx()).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);342 });336 });343 });337 });344338345 it('Regular user cannot create items in active ReFungible collection', async function() {339 it('Regular user cannot create items in active ReFungible collection', async function() {346 await requirePallets(this, [Pallets.ReFungible]);340 await usingPlaygrounds(async (helper) => {347348 await usingApi(async (api: ApiPromise) => {349 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});341 const collection = await helper.rft.mintCollection(alice, {342 name: 'name',350 const itemsListIndexBefore = await getLastTokenId(api, collectionId);343 description: 'descr',344 tokenPrefix: 'COL',351 expect(itemsListIndexBefore).to.be.equal(0);345 });352 const args = [346 const args = [353 {ReFungible: {pieces: 1}},347 {pieces: 1n},354 {ReFungible: {pieces: 1}},348 {pieces: 1n},355 {ReFungible: {pieces: 1}},349 {pieces: 1n},356 ];350 ];357 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);351 const mintTx = async () => helper.rft.mintMultipleTokensWithOneOwner(bob, collection.collectionId, {Substrate: alice.address}, args);358 await expect(executeTransaction(api, bob, createMultipleItemsTx)).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);352 await expect(mintTx()).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);359 });353 });360 });354 });361355362 it('Create token in not existing collection', async () => {356 it('Create token in not existing collection', async () => {363 await usingApi(async (api: ApiPromise) => {357 await usingPlaygrounds(async (helper) => {364 const collectionId = await getCreatedCollectionCount(api) + 1;358 const collectionId = 1_000_000;359 const args = [360 {},361 {},362 ];365 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'NFT', 'NFT']);363 const mintTx = async () => helper.nft.mintMultipleTokensWithOneOwner(bob, collectionId, {Substrate: alice.address}, args);366 await expect(executeTransaction(api, alice, createMultipleItemsTx)).to.be.rejectedWith(/common\.CollectionNotFound/);364 await expect(mintTx()).to.be.rejectedWith(/common\.CollectionNotFound/);367 });365 });368 });366 });369367370 it('Create NFTs that has reached the maximum data limit', async function() {368 it('Create NFTs that has reached the maximum data limit', async function() {371 await usingApi(async (api, privateKeyWrapper) => {369 await usingPlaygrounds(async (helper) => {372 const collectionId = await createCollectionWithPropsExpectSuccess({370 const collection = await helper.nft.mintCollection(alice, {373 propPerm: [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}],371 name: 'name',372 description: 'descr',373 tokenPrefix: 'COL',374 tokenPropertyPermissions: [375 {key: 'data', permission: {tokenOwner: true, mutable: true, collectionAdmin: true}},376 ],374 });377 });375 const alice = privateKeyWrapper('//Alice');376 const args = [378 const args = [377 {NFT: {properties: [{key: 'key', value: 'A'.repeat(32769)}]}},379 {properties: [{key: 'data', value: 'A'.repeat(32769)}]},378 {NFT: {properties: [{key: 'key', value: 'B'.repeat(32769)}]}},380 {properties: [{key: 'data', value: 'B'.repeat(32769)}]},379 {NFT: {properties: [{key: 'key', value: 'C'.repeat(32769)}]}},381 {properties: [{key: 'data', value: 'C'.repeat(32769)}]},380 ];382 ];381 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);383 const mintTx = async () => helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);382 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;384 await expect(mintTx()).to.be.rejected;383 });385 });384 });386 });385387386 it('Create Refungible tokens that has reached the maximum data limit', async function() {388 it('Create Refungible tokens that has reached the maximum data limit', async function() {387 await requirePallets(this, [Pallets.ReFungible]);389 await usingPlaygrounds(async (helper) => {388389 await usingApi(async api => {390 const collectionIdReFungible =390 const collection = await helper.rft.mintCollection(alice, {391 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});392 {391 name: 'name',393 const argsReFungible = [394 {ReFungible: [10, [['key', 'A'.repeat(32769)]]]},395 {ReFungible: [10, [['key', 'B'.repeat(32769)]]]},392 description: 'descr',396 {ReFungible: [10, [['key', 'C'.repeat(32769)]]]},393 tokenPrefix: 'COL',397 ];394 tokenPropertyPermissions: [398 const createMultipleItemsTxFungible = api.tx.unique395 {key: 'data', permission: {tokenOwner: true, mutable: true, collectionAdmin: true}},399 .createMultipleItems(collectionIdReFungible, normalizeAccountId(alice.address), argsReFungible);400 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTxFungible)).to.be.rejected;396 ],401 }397 });402 {398 const args = [403 const argsReFungible = [404 {ReFungible: {properties: [{key: 'key', value: 'A'.repeat(32769)}]}},399 {pieces: 10n, properties: [{key: 'data', value: 'A'.repeat(32769)}]},405 {ReFungible: {properties: [{key: 'key', value: 'B'.repeat(32769)}]}},400 {pieces: 10n, properties: [{key: 'data', value: 'B'.repeat(32769)}]},406 {ReFungible: {properties: [{key: 'key', value: 'C'.repeat(32769)}]}},401 {pieces: 10n, properties: [{key: 'data', value: 'C'.repeat(32769)}]},407 ];402 ];408 const createMultipleItemsTxFungible = api.tx.unique403 const mintTx = async () => helper.rft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);409 .createMultipleItems(collectionIdReFungible, normalizeAccountId(alice.address), argsReFungible);410 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTxFungible)).to.be.rejected;404 await expect(mintTx()).to.be.rejected;411 }412 });405 });413 });406 });414407415 it('Create tokens with different types', async () => {408 it('Create tokens with different types', async () => {416 await usingApi(async (api: ApiPromise) => {409 await usingPlaygrounds(async (helper) => {417 const collectionId = await createCollectionExpectSuccess();410 const {collectionId} = await helper.nft.mintCollection(alice, {411 name: 'name',412 description: 'descr',413 tokenPrefix: 'COL',414 });418415419 const types = ['NFT', 'Fungible'];416 //FIXME:420421 if (await checkPalletsPresence([Pallets.ReFungible])) {417 const types = ['NFT', 'Fungible', 'ReFungible'];422 types.push('ReFungible');423 }418 const mintTx = helper.api?.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), types);424425 const createMultipleItemsTx = api.tx.unique426 .createMultipleItems(collectionId, normalizeAccountId(alice.address), types);427 await expect(executeTransaction(api, alice, createMultipleItemsTx)).to.be.rejectedWith(/nonfungible\.NotNonfungibleDataUsedToMintFungibleCollectionToken/);419 await expect(helper.signTransaction(alice, mintTx)).to.be.rejected;428 // garbage collection :-D // lol429 await destroyCollectionExpectSuccess(collectionId);430 });420 });431 });421 });432422