difftreelog
fix skip refungible and scheduler tests on qtz/unq
in: master
43 files changed
tests/src/approve.test.tsdiffbeforeafterboth32 getCreatedCollectionCount,32 getCreatedCollectionCount,33 transferFromExpectSuccess,33 transferFromExpectSuccess,34 transferFromExpectFail,34 transferFromExpectFail,35 requirePallets,36 Pallets35} from './util/helpers';37} from './util/helpers';363837chai.use(chaiAsPromised);39chai.use(chaiAsPromised);49 });51 });50 });52 });5354 it('[nft] Execute the extrinsic and check approvedList', async () => {55 const nftCollectionId = await createCollectionExpectSuccess();56 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');57 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address);58 });5960 it('[fungible] Execute the extrinsic and check approvedList', async () => {61 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});62 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');63 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address);64 });6566 it('[refungible] Execute the extrinsic and check approvedList', async function() {67 await requirePallets(this, [Pallets.ReFungible]);6869 const reFungibleCollectionId =70 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});71 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');72 await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, alice, bob.address);73 });7475 it('[nft] Remove approval by using 0 amount', async () => {76 const nftCollectionId = await createCollectionExpectSuccess();77 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');78 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address, 1);79 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address, 0);80 });518152 it('Execute the extrinsic and check approvedList', async () => {82 it('[fungible] Remove approval by using 0 amount', async () => {53 const nftCollectionId = await createCollectionExpectSuccess();54 // nft55 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');56 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address);57 // fungible58 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});83 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});59 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');84 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');60 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address);85 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address, 1);61 // reFungible62 const reFungibleCollectionId =63 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});64 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');65 await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, alice, bob.address);86 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address, 0);66 });87 });678868 it('Remove approval by using 0 amount', async () => {89 it('[refungible] Remove approval by using 0 amount', async function() {69 const nftCollectionId = await createCollectionExpectSuccess();70 // nft71 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');72 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address, 1);90 await requirePallets(this, [Pallets.ReFungible]);73 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address, 0);9174 // fungible75 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});76 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');77 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address, 1);78 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address, 0);79 // reFungible80 const reFungibleCollectionId =92 const reFungibleCollectionId =81 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});93 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});82 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');94 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');117 await approveExpectSuccess(collectionId, itemId, bob, charlie.address);129 await approveExpectSuccess(collectionId, itemId, bob, charlie.address);118 });130 });119131120 it('ReFungible up to an approved amount', async () => {132 it('ReFungible up to an approved amount', async function() {133 await requirePallets(this, [Pallets.ReFungible]);134121 const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});135 const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});122 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', bob.address);136 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', bob.address);151 await transferFromExpectSuccess(collectionId, itemId, charlie, bob, alice, 1, 'Fungible');165 await transferFromExpectSuccess(collectionId, itemId, charlie, bob, alice, 1, 'Fungible');152 });166 });153167154 it('ReFungible up to an approved amount', async () => {168 it('ReFungible up to an approved amount', async function() {169 await requirePallets(this, [Pallets.ReFungible]);170155 const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});171 const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});156 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', bob.address);172 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', bob.address);188 await transferFromExpectFail(collectionId, itemId, charlie, bob, alice, 1);204 await transferFromExpectFail(collectionId, itemId, charlie, bob, alice, 1);189 });205 });190206191 it('ReFungible up to an approved amount', async () => {207 it('ReFungible up to an approved amount', async function() {208 await requirePallets(this, [Pallets.ReFungible]);209192 const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});210 const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});193 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', bob.address);211 const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', bob.address);250 await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, bob, bob, charlie, 1);268 await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, bob, bob, charlie, 1);251 });269 });252270253 it('ReFungible', async () => {271 it('ReFungible', async function() {272 await requirePallets(this, [Pallets.ReFungible]);273254 const reFungibleCollectionId =274 const reFungibleCollectionId =255 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});275 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});285 await approveExpectFail(fungibleCollectionId, newFungibleTokenId, bob, charlie, 11);305 await approveExpectFail(fungibleCollectionId, newFungibleTokenId, bob, charlie, 11);286 });306 });287307288 it('ReFungible', async () => {308 it('ReFungible', async function() {309 await requirePallets(this, [Pallets.ReFungible]);310289 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});311 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});290 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');312 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');325 await transferFromExpectSuccess(collectionId, itemId, bob, dave, alice, 1, 'Fungible');347 await transferFromExpectSuccess(collectionId, itemId, bob, dave, alice, 1, 'Fungible');326 });348 });327349328 it('ReFungible up to an approved amount', async () => {350 it('ReFungible up to an approved amount', async function() {351 await requirePallets(this, [Pallets.ReFungible]);352329 const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});353 const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});330 await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});354 await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});422 });446 });423 });447 });424448425 it('Approve for a collection that does not exist', async () => {449 it('[nft] Approve for a collection that does not exist', async () => {426 await usingApi(async (api: ApiPromise) => {450 await usingApi(async (api: ApiPromise) => {427 // nft428 const nftCollectionCount = await getCreatedCollectionCount(api);451 const nftCollectionCount = await getCreatedCollectionCount(api);429 await approveExpectFail(nftCollectionCount + 1, 1, alice, bob);452 await approveExpectFail(nftCollectionCount + 1, 1, alice, bob);430 // fungible431 const fungibleCollectionCount = await getCreatedCollectionCount(api);432 await approveExpectFail(fungibleCollectionCount + 1, 0, alice, bob);433 // reFungible434 const reFungibleCollectionCount = await getCreatedCollectionCount(api);435 await approveExpectFail(reFungibleCollectionCount + 1, 1, alice, bob);436 });453 });437 });454 });455456 it('[fungible] Approve for a collection that does not exist', async () => {457 await usingApi(async (api: ApiPromise) => {458 const fungibleCollectionCount = await getCreatedCollectionCount(api);459 await approveExpectFail(fungibleCollectionCount + 1, 0, alice, bob);460 });461 });462463 it('[refungible] Approve for a collection that does not exist', async function() {464 await requirePallets(this, [Pallets.ReFungible]);465466 await usingApi(async (api: ApiPromise) => {467 const reFungibleCollectionCount = await getCreatedCollectionCount(api);468 await approveExpectFail(reFungibleCollectionCount + 1, 1, alice, bob);469 });470 });471472 it('[nft] Approve for a collection that was destroyed', async () => {473 const nftCollectionId = await createCollectionExpectSuccess();474 await destroyCollectionExpectSuccess(nftCollectionId);475 await approveExpectFail(nftCollectionId, 1, alice, bob);476 });438477439 it('Approve for a collection that was destroyed', async () => {478 it('Approve for a collection that was destroyed', async () => {440 // nft441 const nftCollectionId = await createCollectionExpectSuccess();442 await destroyCollectionExpectSuccess(nftCollectionId);443 await approveExpectFail(nftCollectionId, 1, alice, bob);444 // fungible445 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});479 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});446 await destroyCollectionExpectSuccess(fungibleCollectionId);480 await destroyCollectionExpectSuccess(fungibleCollectionId);447 await approveExpectFail(fungibleCollectionId, 0, alice, bob);481 await approveExpectFail(fungibleCollectionId, 0, alice, bob);448 // reFungible449 const reFungibleCollectionId =450 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});451 await destroyCollectionExpectSuccess(reFungibleCollectionId);452 await approveExpectFail(reFungibleCollectionId, 1, alice, bob);453 });482 });483484 it('[refungible] Approve for a collection that was destroyed', async function() {485 await requirePallets(this, [Pallets.ReFungible]);486487 const reFungibleCollectionId =488 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});489 await destroyCollectionExpectSuccess(reFungibleCollectionId);490 await approveExpectFail(reFungibleCollectionId, 1, alice, bob);491 });492493 it('[nft] Approve transfer of a token that does not exist', async () => {494 const nftCollectionId = await createCollectionExpectSuccess();495 await approveExpectFail(nftCollectionId, 2, alice, bob);496 });454497455 it('Approve transfer of a token that does not exist', async () => {498 it('[refungible] Approve transfer of a token that does not exist', async function() {456 // nft457 const nftCollectionId = await createCollectionExpectSuccess();458 await approveExpectFail(nftCollectionId, 2, alice, bob);499 await requirePallets(this, [Pallets.ReFungible]);459 // reFungible500460 const reFungibleCollectionId =501 const reFungibleCollectionId =461 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});502 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});462 await approveExpectFail(reFungibleCollectionId, 2, alice, bob);503 await approveExpectFail(reFungibleCollectionId, 2, alice, bob);463 });504 });505506 it('[nft] Approve using the address that does not own the approved token', async () => {507 const nftCollectionId = await createCollectionExpectSuccess();508 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');509 await approveExpectFail(nftCollectionId, newNftTokenId, bob, alice);510 });511512 it('[fungible] Approve using the address that does not own the approved token', async () => {513 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});514 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');515 await approveExpectFail(fungibleCollectionId, newFungibleTokenId, bob, alice);516 });464517465 it('Approve using the address that does not own the approved token', async () => {518 it('[refungible] Approve using the address that does not own the approved token', async function() {466 const nftCollectionId = await createCollectionExpectSuccess();467 // nft468 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');469 await approveExpectFail(nftCollectionId, newNftTokenId, bob, alice);470 // fungible471 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});519 await requirePallets(this, [Pallets.ReFungible]);472 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');520473 await approveExpectFail(fungibleCollectionId, newFungibleTokenId, bob, alice);474 // reFungible475 const reFungibleCollectionId =521 const reFungibleCollectionId =476 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});522 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});477 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');523 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');478 await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, bob, alice);524 await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, bob, alice);479 });525 });480526481 it('should fail if approved more ReFungibles than owned', async () => {527 it('should fail if approved more ReFungibles than owned', async function() {528 await requirePallets(this, [Pallets.ReFungible]);529482 const nftCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});530 const nftCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});483 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'ReFungible');531 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'ReFungible');tests/src/burnItem.test.tsdiffbeforeafterboth25 getBalance,25 getBalance,26 setCollectionLimitsExpectSuccess,26 setCollectionLimitsExpectSuccess,27 isTokenExists,27 isTokenExists,28 requirePallets,29 Pallets28} from './util/helpers';30} from './util/helpers';293130import chai from 'chai';32import chai from 'chai';80 });82 });81 });83 });828483 it('Burn item in ReFungible collection', async () => {85 it('Burn item in ReFungible collection', async function() {86 await requirePallets(this, [Pallets.ReFungible]);8784 const createMode = 'ReFungible';88 const createMode = 'ReFungible';85 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});89 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});99 });103 });100 });104 });101105102 it('Burn owned portion of item in ReFungible collection', async () => {106 it('Burn owned portion of item in ReFungible collection', async function() {107 await requirePallets(this, [Pallets.ReFungible]);108103 const createMode = 'ReFungible';109 const createMode = 'ReFungible';104 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});110 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});189 });195 });190196191 // TODO: burnFrom197 // TODO: burnFrom192 it('Burn item in ReFungible collection', async () => {198 it('Burn item in ReFungible collection', async function() {199 await requirePallets(this, [Pallets.ReFungible]);200193 const createMode = 'ReFungible';201 const createMode = 'ReFungible';194 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});202 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});tests/src/confirmSponsorship.test.tsdiffbeforeafterboth33 addCollectionAdminExpectSuccess,33 addCollectionAdminExpectSuccess,34 getCreatedCollectionCount,34 getCreatedCollectionCount,35 UNIQUE,35 UNIQUE,36 requirePallets,37 Pallets36} from './util/helpers';38} from './util/helpers';37import {IKeyringPair} from '@polkadot/types/types';39import {IKeyringPair} from '@polkadot/types/types';3840124 });126 });125 });127 });126128127 it('ReFungible: Transfer fees are paid by the sponsor after confirmation', async () => {129 it('ReFungible: Transfer fees are paid by the sponsor after confirmation', async function() {130 await requirePallets(this, [Pallets.ReFungible]);131128 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});132 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});129 await setCollectionSponsorExpectSuccess(collectionId, bob.address);133 await setCollectionSponsorExpectSuccess(collectionId, bob.address);252 });256 });253 });257 });254258255 it('ReFungible: Sponsoring is rate limited', async () => {259 it('ReFungible: Sponsoring is rate limited', async function() {260 await requirePallets(this, [Pallets.ReFungible]);261256 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});262 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});257 await setCollectionSponsorExpectSuccess(collectionId, bob.address);263 await setCollectionSponsorExpectSuccess(collectionId, bob.address);tests/src/createCollection.test.tsdiffbeforeafterboth161617import {expect} from 'chai';17import {expect} from 'chai';18import usingApi, {executeTransaction, submitTransactionAsync} from './substrate/substrate-api';18import usingApi, {executeTransaction, submitTransactionAsync} from './substrate/substrate-api';19import {createCollectionWithPropsExpectFailure, createCollectionExpectFailure, createCollectionExpectSuccess, getCreateCollectionResult, getDetailedCollectionInfo, createCollectionWithPropsExpectSuccess} from './util/helpers';19import {createCollectionWithPropsExpectFailure, createCollectionExpectFailure, createCollectionExpectSuccess, getCreateCollectionResult, getDetailedCollectionInfo, createCollectionWithPropsExpectSuccess, requirePallets, Pallets} from './util/helpers';202021describe('integration test: ext. createCollection():', () => {21describe('integration test: ext. createCollection():', () => {22 it('Create new NFT collection', async () => {22 it('Create new NFT collection', async () => {34 it('Create new Fungible collection', async () => {34 it('Create new Fungible collection', async () => {35 await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});35 await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});36 });36 });37 it('Create new ReFungible collection', async () => {37 it('Create new ReFungible collection', async function() {38 await requirePallets(this, [Pallets.ReFungible]);3938 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});40 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});39 });41 });tests/src/createItem.test.tsdiffbeforeafterboth29 itApi,29 itApi,30 normalizeAccountId,30 normalizeAccountId,31 getCreateItemResult,31 getCreateItemResult,32 requirePallets,33 Pallets32} from './util/helpers';34} from './util/helpers';333534const expect = chai.expect;36const expect = chai.expect;79 }81 }808281 });83 });82 it('Create new item in ReFungible collection', async () => {84 it('Create new item in ReFungible collection', async function() {85 await requirePallets(this, [Pallets.ReFungible]);8683 const createMode = 'ReFungible';87 const createMode = 'ReFungible';84 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});88 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});96 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);100 await addCollectionAdminExpectSuccess(alice, newCollectionID, bob.address);97 await createItemExpectSuccess(bob, newCollectionID, createMode);101 await createItemExpectSuccess(bob, newCollectionID, createMode);98 });102 });99 it('Create new item in ReFungible collection with collection admin permissions', async () => {103 it('Create new item in ReFungible collection with collection admin permissions', async function() {104 await requirePallets(this, [Pallets.ReFungible]);105100 const createMode = 'ReFungible';106 const createMode = 'ReFungible';101 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});107 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});175 });181 });176 });182 });177183178 it('Check total pieces of ReFungible token', async () => {184 it('Check total pieces of ReFungible token', async function() {185 await requirePallets(this, [Pallets.ReFungible]);186179 await usingApi(async api => {187 await usingApi(async api => {180 const createMode = 'ReFungible';188 const createMode = 'ReFungible';219 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});227 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});220 await expect(createItemExpectSuccess(bob, newCollectionID, createMode)).to.be.rejected;228 await expect(createItemExpectSuccess(bob, newCollectionID, createMode)).to.be.rejected;221 });229 });222 it('Regular user cannot create new item in ReFungible collection', async () => {230 it('Regular user cannot create new item in ReFungible collection', async function() {231 await requirePallets(this, [Pallets.ReFungible]);232223 const createMode = 'ReFungible';233 const createMode = 'ReFungible';224 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});234 const newCollectionID = await createCollectionExpectSuccess({mode: {type: createMode}});296 });306 });297 });307 });298308299 it('Check total pieces for invalid Refungible token', async () => {309 it('Check total pieces for invalid Refungible token', async function() {310 await requirePallets(this, [Pallets.ReFungible]);311300 await usingApi(async api => {312 await usingApi(async api => {301 const createCollectionResult = await createCollection(api, alice, {mode: {type: 'ReFungible'}});313 const createCollectionResult = await createCollection(api, alice, {mode: {type: 'ReFungible'}});tests/src/createMultipleItems.test.tsdiffbeforeafterboth33 createCollectionWithPropsExpectSuccess,33 createCollectionWithPropsExpectSuccess,34 createMultipleItemsWithPropsExpectSuccess,34 createMultipleItemsWithPropsExpectSuccess,35 getTokenProperties,35 getTokenProperties,36 requirePallets,37 Pallets,38 checkPalletsPresence36} from './util/helpers';39} from './util/helpers';374038chai.use(chaiAsPromised);41chai.use(chaiAsPromised);91 });94 });92 });95 });939694 it('Create 0x31, 0x32, 0x33 items in active ReFungible collection and verify tokens data in chain', async () => {97 it('Create 0x31, 0x32, 0x33 items in active ReFungible collection and verify tokens data in chain', async function() {98 await requirePallets(this, [Pallets.ReFungible]);9995 await usingApi(async (api, privateKeyWrapper) => {100 await usingApi(async (api, privateKeyWrapper) => {96 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});101 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});272 });277 });273 });278 });274279275 it('Create 0x31, 0x32, 0x33 items in active ReFungible collection and verify tokens data in chain', async () => {280 it('Create 0x31, 0x32, 0x33 items in active ReFungible collection and verify tokens data in chain', async function() {281 await requirePallets(this, [Pallets.ReFungible]);282276 await usingApi(async (api: ApiPromise) => {283 await usingApi(async (api: ApiPromise) => {277 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});284 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});335 });342 });336 });343 });337344338 it('Regular user cannot create items in active ReFungible collection', async () => {345 it('Regular user cannot create items in active ReFungible collection', async function() {346 await requirePallets(this, [Pallets.ReFungible]);347339 await usingApi(async (api: ApiPromise) => {348 await usingApi(async (api: ApiPromise) => {340 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});349 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});358 });367 });359 });368 });369370 it('Create NFTs that has reached the maximum data limit', async function() {371 await usingApi(async (api, privateKeyWrapper) => {372 const collectionId = await createCollectionWithPropsExpectSuccess({373 propPerm: [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}],374 });375 const alice = privateKeyWrapper('//Alice');376 const args = [377 {NFT: {properties: [{key: 'key', value: 'A'.repeat(32769)}]}},378 {NFT: {properties: [{key: 'key', value: 'B'.repeat(32769)}]}},379 {NFT: {properties: [{key: 'key', value: 'C'.repeat(32769)}]}},380 ];381 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);382 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;383 });384 });360385361 it('Create NFT and Re-fungible tokens that has reached the maximum data limit', async () => {386 it('Create Refungible tokens that has reached the maximum data limit', async function() {387 await requirePallets(this, [Pallets.ReFungible]);388362 await usingApi(async (api, privateKeyWrapper) => {389 await usingApi(async api => {363 // NFT364 const collectionId = await createCollectionWithPropsExpectSuccess({365 propPerm: [{key: 'key', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}}],366 });367 const alice = privateKeyWrapper('//Alice');368 const args = [369 {NFT: {properties: [{key: 'key', value: 'A'.repeat(32769)}]}},370 {NFT: {properties: [{key: 'key', value: 'B'.repeat(32769)}]}},371 {NFT: {properties: [{key: 'key', value: 'C'.repeat(32769)}]}},372 ];373 const createMultipleItemsTx = api.tx.unique.createMultipleItems(collectionId, normalizeAccountId(alice.address), args);374 await expect(submitTransactionExpectFailAsync(alice, createMultipleItemsTx)).to.be.rejected;375376 // ReFungible377 const collectionIdReFungible =390 const collectionIdReFungible =378 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});391 await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});379 {392 {403 await usingApi(async (api: ApiPromise) => {416 await usingApi(async (api: ApiPromise) => {404 const collectionId = await createCollectionExpectSuccess();417 const collectionId = await createCollectionExpectSuccess();418419 let types = ['NFT', 'Fungible'];420421 if (await checkPalletsPresence([Pallets.ReFungible])) {422 types.push('ReFungible');423 }424405 const createMultipleItemsTx = api.tx.unique425 const createMultipleItemsTx = api.tx.unique406 .createMultipleItems(collectionId, normalizeAccountId(alice.address), ['NFT', 'Fungible', 'ReFungible']);426 .createMultipleItems(collectionId, normalizeAccountId(alice.address), types);407 await expect(executeTransaction(api, alice, createMultipleItemsTx)).to.be.rejectedWith(/nonfungible\.NotNonfungibleDataUsedToMintFungibleCollectionToken/);427 await expect(executeTransaction(api, alice, createMultipleItemsTx)).to.be.rejectedWith(/nonfungible\.NotNonfungibleDataUsedToMintFungibleCollectionToken/);408 // garbage collection :-D // lol428 // garbage collection :-D // lol409 await destroyCollectionExpectSuccess(collectionId);429 await destroyCollectionExpectSuccess(collectionId);tests/src/createMultipleItemsEx.test.tsdiffbeforeafterboth161617import {expect} from 'chai';17import {expect} from 'chai';18import usingApi, {executeTransaction} from './substrate/substrate-api';18import usingApi, {executeTransaction} from './substrate/substrate-api';19import {addCollectionAdminExpectSuccess, createCollectionExpectSuccess, createCollectionWithPropsExpectSuccess, getBalance, getLastTokenId, getTokenProperties} from './util/helpers';19import {addCollectionAdminExpectSuccess, createCollectionExpectSuccess, createCollectionWithPropsExpectSuccess, getBalance, getLastTokenId, getTokenProperties, requirePallets, Pallets} from './util/helpers';202021describe.only('Integration Test: createMultipleItemsEx', () => {21describe.only('Integration Test: createMultipleItemsEx', () => {22 it('can initialize multiple NFT with different owners', async () => {22 it('can initialize multiple NFT with different owners', async () => {146 });146 });147 });147 });148148149 it('can initialize an RFT with multiple owners', async () => {149 it('can initialize an RFT with multiple owners', async function() {150 await requirePallets(this, [Pallets.ReFungible]);151150 await usingApi(async (api, privateKeyWrapper) => {152 await usingApi(async (api, privateKeyWrapper) => {151 const alice = privateKeyWrapper('//Alice');153 const alice = privateKeyWrapper('//Alice');178 });180 });179 });181 });180182181 it('can initialize multiple RFTs with the same owner', async () => {183 it('can initialize multiple RFTs with the same owner', async function() {184 await requirePallets(this, [Pallets.ReFungible]);185182 await usingApi(async (api, privateKeyWrapper) => {186 await usingApi(async (api, privateKeyWrapper) => {183 const alice = privateKeyWrapper('//Alice');187 const alice = privateKeyWrapper('//Alice');389 });393 });390 });394 });391395392 it('fails when trying to set multiple owners when creating multiple refungibles', async () => {396 it('fails when trying to set multiple owners when creating multiple refungibles', async function() {397 await requirePallets(this, [Pallets.ReFungible]);398393 const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});399 const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});394400tests/src/destroyCollection.test.tsdiffbeforeafterboth25 addCollectionAdminExpectSuccess,25 addCollectionAdminExpectSuccess,26 getCreatedCollectionCount,26 getCreatedCollectionCount,27 createItemExpectSuccess,27 createItemExpectSuccess,28 requirePallets,29 Pallets28} from './util/helpers';30} from './util/helpers';293130chai.use(chaiAsPromised);32chai.use(chaiAsPromised);38 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});40 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});39 await destroyCollectionExpectSuccess(collectionId);41 await destroyCollectionExpectSuccess(collectionId);40 });42 });41 it('ReFungible collection can be destroyed', async () => {43 it('ReFungible collection can be destroyed', async function() {44 await requirePallets(this, [Pallets.ReFungible]);4542 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});46 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});43 await destroyCollectionExpectSuccess(collectionId);47 await destroyCollectionExpectSuccess(collectionId);tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth161617import {evmToAddress} from '@polkadot/util-crypto';17import {evmToAddress} from '@polkadot/util-crypto';18import {expect} from 'chai';18import {expect} from 'chai';19import {getCreatedCollectionCount, getDetailedCollectionInfo} from '../util/helpers';19import {getCreatedCollectionCount, getDetailedCollectionInfo, requirePallets, Pallets} from '../util/helpers';20import {20import {21 evmCollectionHelpers,21 evmCollectionHelpers,22 collectionIdToAddress,22 collectionIdToAddress,28} from './util/helpers';28} from './util/helpers';292930describe('Create RFT collection from EVM', () => {30describe('Create RFT collection from EVM', () => {31 before(async function() {32 await requirePallets(this, [Pallets.ReFungible]);33 });3431 itWeb3('Create collection', async ({api, web3, privateKeyWrapper}) => {35 itWeb3('Create collection', async ({api, web3, privateKeyWrapper}) => {32 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);36 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);146});150});147151148describe('(!negative tests!) Create RFT collection from EVM', () => {152describe('(!negative tests!) Create RFT collection from EVM', () => {153 before(async function() {154 await requirePallets(this, [Pallets.ReFungible]);155 });156149 itWeb3('(!negative test!) Create collection (bad lengths)', async ({api, web3, privateKeyWrapper}) => {157 itWeb3('(!negative test!) Create collection (bad lengths)', async ({api, web3, privateKeyWrapper}) => {150 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);158 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);tests/src/eth/reFungible.test.tsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617import {createCollectionExpectSuccess, UNIQUE} from '../util/helpers';17import {createCollectionExpectSuccess, UNIQUE, requirePallets, Pallets} from '../util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, tokenIdToAddress} from './util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, tokenIdToAddress} from './util/helpers';19import reFungibleTokenAbi from './reFungibleTokenAbi.json';19import reFungibleTokenAbi from './reFungibleTokenAbi.json';20import {expect} from 'chai';20import {expect} from 'chai';212122describe('Refungible: Information getting', () => {22describe('Refungible: Information getting', () => {23 before(async function() {24 await requirePallets(this, [Pallets.ReFungible]);25 });2623 itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {27 itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {24 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);28 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);120});124});121125122describe('Refungible: Plain calls', () => {126describe('Refungible: Plain calls', () => {127 before(async function() {128 await requirePallets(this, [Pallets.ReFungible]);129 });130123 itWeb3('Can perform mint()', async ({web3, api, privateKeyWrapper}) => {131 itWeb3('Can perform mint()', async ({web3, api, privateKeyWrapper}) => {124 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);132 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);399});407});400408401describe('RFT: Fees', () => {409describe('RFT: Fees', () => {410 before(async function() {411 await requirePallets(this, [Pallets.ReFungible]);412 });413402 itWeb3('transferFrom() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {414 itWeb3('transferFrom() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {403 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);415 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);435});447});436448437describe('Common metadata', () => {449describe('Common metadata', () => {450 before(async function() {451 await requirePallets(this, [Pallets.ReFungible]);452 });453438 itWeb3('Returns collection name', async ({api, web3, privateKeyWrapper}) => {454 itWeb3('Returns collection name', async ({api, web3, privateKeyWrapper}) => {439 const collection = await createCollectionExpectSuccess({455 const collection = await createCollectionExpectSuccess({tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617import {approve, createCollection, createRefungibleToken, transfer, transferFrom, UNIQUE} from '../util/helpers';17import {approve, createCollection, createRefungibleToken, transfer, transferFrom, UNIQUE, requirePallets, Pallets} from '../util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth} from './util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, tokenIdToAddress, transferBalanceToEth} from './util/helpers';19import reFungibleTokenAbi from './reFungibleTokenAbi.json';19import reFungibleTokenAbi from './reFungibleTokenAbi.json';202024const expect = chai.expect;24const expect = chai.expect;252526describe('Refungible token: Information getting', () => {26describe('Refungible token: Information getting', () => {27 before(async function() {28 await requirePallets(this, [Pallets.ReFungible]);29 });3027 itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {31 itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {28 const alice = privateKeyWrapper('//Alice');32 const alice = privateKeyWrapper('//Alice');757976// FIXME: Need erc721 for ReFubgible.80// FIXME: Need erc721 for ReFubgible.77describe('Check ERC721 token URI for ReFungible', () => {81describe('Check ERC721 token URI for ReFungible', () => {82 before(async function() {83 await requirePallets(this, [Pallets.ReFungible]);84 });8578 itWeb3('Empty tokenURI', async ({web3, api, privateKeyWrapper}) => {86 itWeb3('Empty tokenURI', async ({web3, api, privateKeyWrapper}) => {79 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);87 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);216});224});217225218describe('Refungible: Plain calls', () => {226describe('Refungible: Plain calls', () => {227 before(async function() {228 await requirePallets(this, [Pallets.ReFungible]);229 });230219 itWeb3('Can perform approve()', async ({web3, api, privateKeyWrapper}) => {231 itWeb3('Can perform approve()', async ({web3, api, privateKeyWrapper}) => {220 const alice = privateKeyWrapper('//Alice');232 const alice = privateKeyWrapper('//Alice');477});489});478490479describe('Refungible: Fees', () => {491describe('Refungible: Fees', () => {492 before(async function() {493 await requirePallets(this, [Pallets.ReFungible]);494 });495480 itWeb3('approve() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {496 itWeb3('approve() call fee is less than 0.2UNQ', async ({web3, api, privateKeyWrapper}) => {481 const alice = privateKeyWrapper('//Alice');497 const alice = privateKeyWrapper('//Alice');532});548});533549534describe('Refungible: Substrate calls', () => {550describe('Refungible: Substrate calls', () => {551 before(async function() {552 await requirePallets(this, [Pallets.ReFungible]);553 });554535 itWeb3('Events emitted for approve()', async ({web3, api, privateKeyWrapper}) => {555 itWeb3('Events emitted for approve()', async ({web3, api, privateKeyWrapper}) => {536 const alice = privateKeyWrapper('//Alice');556 const alice = privateKeyWrapper('//Alice');tests/src/eth/scheduling.test.tsdiffbeforeafterboth161617import {expect} from 'chai';17import {expect} from 'chai';18import {createEthAccountWithBalance, deployFlipper, GAS_ARGS, itWeb3, subToEth, transferBalanceToEth} from './util/helpers';18import {createEthAccountWithBalance, deployFlipper, GAS_ARGS, itWeb3, subToEth, transferBalanceToEth} from './util/helpers';19import {scheduleExpectSuccess, waitNewBlocks} from '../util/helpers';19import {scheduleExpectSuccess, waitNewBlocks, requirePallets, Pallets} from '../util/helpers';202021describe('Scheduing EVM smart contracts', () => {21describe('Scheduing EVM smart contracts', () => {22 before(async function() {23 await requirePallets(this, [Pallets.Scheduler]);24 });2522 itWeb3('Successfully schedules and periodically executes an EVM contract', async ({api, web3, privateKeyWrapper}) => {26 itWeb3('Successfully schedules and periodically executes an EVM contract', async ({api, web3, privateKeyWrapper}) => {23 const deployer = await createEthAccountWithBalance(api, web3, privateKeyWrapper);27 const deployer = await createEthAccountWithBalance(api, web3, privateKeyWrapper);tests/src/limits.test.tsdiffbeforeafterboth27 transferExpectSuccess,27 transferExpectSuccess,28 getFreeBalance,28 getFreeBalance,29 waitNewBlocks, burnItemExpectSuccess,29 waitNewBlocks, burnItemExpectSuccess,30 requirePallets,31 Pallets30} from './util/helpers';32} from './util/helpers';31import {expect} from 'chai';33import {expect} from 'chai';323467describe('Number of tokens per address (ReFungible)', () => {69describe('Number of tokens per address (ReFungible)', () => {68 let alice: IKeyringPair;70 let alice: IKeyringPair;697170 before(async () => {72 before(async function() {73 await requirePallets(this, [Pallets.ReFungible]);7471 await usingApi(async (api, privateKeyWrapper) => {75 await usingApi(async (api, privateKeyWrapper) => {72 alice = privateKeyWrapper('//Alice');76 alice = privateKeyWrapper('//Alice');367 let bob: IKeyringPair;371 let bob: IKeyringPair;368 let charlie: IKeyringPair;372 let charlie: IKeyringPair;369373370 before(async () => {374 before(async function() {375 await requirePallets(this, [Pallets.ReFungible]);376371 await usingApi(async (api, privateKeyWrapper) => {377 await usingApi(async (api, privateKeyWrapper) => {372 alice = privateKeyWrapper('//Alice');378 alice = privateKeyWrapper('//Alice');tests/src/nesting/nest.test.tsdiffbeforeafterboth17 transferExpectSuccess,17 transferExpectSuccess,18 transferFromExpectSuccess,18 transferFromExpectSuccess,19 setCollectionLimitsExpectSuccess,19 setCollectionLimitsExpectSuccess,20 requirePallets,21 Pallets20} from '../util/helpers';22} from '../util/helpers';21import {IKeyringPair} from '@polkadot/types/types';23import {IKeyringPair} from '@polkadot/types/types';2224311313312 // ---------- Re-Fungible ----------314 // ---------- Re-Fungible ----------313315314 it('ReFungible: allows an Owner to nest/unnest their token', async () => {316 it('ReFungible: allows an Owner to nest/unnest their token', async function() {317 await requirePallets(this, [Pallets.ReFungible]);318315 await usingApi(async api => {319 await usingApi(async api => {316 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});320 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});333 });337 });334 });338 });335339336 it('ReFungible: allows an Owner to nest/unnest their token (Restricted nesting)', async () => {340 it('ReFungible: allows an Owner to nest/unnest their token (Restricted nesting)', async function() {341 await requirePallets(this, [Pallets.ReFungible]);342337 await usingApi(async api => {343 await usingApi(async api => {338 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});344 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});715721716 // ---------- Re-Fungible ----------722 // ---------- Re-Fungible ----------717723718 it('ReFungible: disallows to nest token if nesting is disabled', async () => {724 it('ReFungible: disallows to nest token if nesting is disabled', async function() {725 await requirePallets(this, [Pallets.ReFungible]);726719 await usingApi(async api => {727 await usingApi(async api => {720 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});728 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});745 });753 });746 });754 });747755748 it('ReFungible: disallows a non-Owner to nest someone else\'s token', async () => {756 it('ReFungible: disallows a non-Owner to nest someone else\'s token', async function() {757 await requirePallets(this, [Pallets.ReFungible]);758749 await usingApi(async api => {759 await usingApi(async api => {750 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});760 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});773 });783 });774 });784 });775785776 it('ReFungible: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async () => {786 it('ReFungible: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async function() {787 await requirePallets(this, [Pallets.ReFungible]);788777 await usingApi(async api => {789 await usingApi(async api => {778 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});790 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});800 });812 });801 });813 });802814803 it('ReFungible: disallows to nest token to an unlisted collection', async () => {815 it('ReFungible: disallows to nest token to an unlisted collection', async function() {816 await requirePallets(this, [Pallets.ReFungible]);817804 await usingApi(async api => {818 await usingApi(async api => {805 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});819 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});tests/src/nesting/properties.test.tsdiffbeforeafterboth8 createItemExpectSuccess,8 createItemExpectSuccess,9 getCreateCollectionResult,9 getCreateCollectionResult,10 transferExpectSuccess,10 transferExpectSuccess,11 requirePallets,12 Pallets11} from '../util/helpers';13} from '../util/helpers';12import {IKeyringPair} from '@polkadot/types/types';14import {IKeyringPair} from '@polkadot/types/types';13import {tokenIdToAddress} from '../eth/util/helpers';15import {tokenIdToAddress} from '../eth/util/helpers';64 await testMakeSureSuppliesRequired({type: 'NFT'});66 await testMakeSureSuppliesRequired({type: 'NFT'});65 });67 });666867 it('Makes sure collectionById supplies required fields for ReFungible', async () => {69 it('Makes sure collectionById supplies required fields for ReFungible', async function() {70 await requirePallets(this, [Pallets.ReFungible]);7168 await testMakeSureSuppliesRequired({type: 'ReFungible'});72 await testMakeSureSuppliesRequired({type: 'ReFungible'});69 });73 });120 it('Sets properties for a NFT collection', async () => {124 it('Sets properties for a NFT collection', async () => {121 await testSetsPropertiesForCollection('NFT');125 await testSetsPropertiesForCollection('NFT');122 });126 });123 it('Sets properties for a ReFungible collection', async () => {127 it('Sets properties for a ReFungible collection', async function() {128 await requirePallets(this, [Pallets.ReFungible]);129124 await testSetsPropertiesForCollection('ReFungible');130 await testSetsPropertiesForCollection('ReFungible');125 });131 });178 it('Check valid names for NFT collection properties keys', async () => {184 it('Check valid names for NFT collection properties keys', async () => {179 await testCheckValidNames('NFT');185 await testCheckValidNames('NFT');180 });186 });181 it('Check valid names for ReFungible collection properties keys', async () => {187 it('Check valid names for ReFungible collection properties keys', async function() {188 await requirePallets(this, [Pallets.ReFungible]);189182 await testCheckValidNames('ReFungible');190 await testCheckValidNames('ReFungible');183 });191 });209 it('Changes properties of a NFT collection', async () => {217 it('Changes properties of a NFT collection', async () => {210 await testChangesProperties({type: 'NFT'});218 await testChangesProperties({type: 'NFT'});211 });219 });212 it('Changes properties of a ReFungible collection', async () => {220 it('Changes properties of a ReFungible collection', async function() {221 await requirePallets(this, [Pallets.ReFungible]);222213 await testChangesProperties({type: 'ReFungible'});223 await testChangesProperties({type: 'ReFungible'});214 });224 });238 it('Deletes properties of a NFT collection', async () => {248 it('Deletes properties of a NFT collection', async () => {239 await testDeleteProperties({type: 'NFT'});249 await testDeleteProperties({type: 'NFT'});240 });250 });241 it('Deletes properties of a ReFungible collection', async () => {251 it('Deletes properties of a ReFungible collection', async function() {252 await requirePallets(this, [Pallets.ReFungible]);253242 await testDeleteProperties({type: 'ReFungible'});254 await testDeleteProperties({type: 'ReFungible'});243 });255 });269 it('Fails to set properties in a NFT collection if not its onwer/administrator', async () => {281 it('Fails to set properties in a NFT collection if not its onwer/administrator', async () => {270 await testFailsSetPropertiesIfNotOwnerOrAdmin({type: 'NFT'});282 await testFailsSetPropertiesIfNotOwnerOrAdmin({type: 'NFT'});271 });283 });272 it('Fails to set properties in a ReFungible collection if not its onwer/administrator', async () => {284 it('Fails to set properties in a ReFungible collection if not its onwer/administrator', async function() {285 await requirePallets(this, [Pallets.ReFungible]);286273 await testFailsSetPropertiesIfNotOwnerOrAdmin({type: 'ReFungible'});287 await testFailsSetPropertiesIfNotOwnerOrAdmin({type: 'ReFungible'});274 });288 });307 it('Fails to set properties that exceed the limits (NFT)', async () => {321 it('Fails to set properties that exceed the limits (NFT)', async () => {308 await testFailsSetPropertiesThatExeedLimits({type: 'NFT'});322 await testFailsSetPropertiesThatExeedLimits({type: 'NFT'});309 });323 });310 it('Fails to set properties that exceed the limits (ReFungible)', async () => {324 it('Fails to set properties that exceed the limits (ReFungible)', async function() {325 await requirePallets(this, [Pallets.ReFungible]);326311 await testFailsSetPropertiesThatExeedLimits({type: 'ReFungible'});327 await testFailsSetPropertiesThatExeedLimits({type: 'ReFungible'});312 });328 });337 it('Fails to set more properties than it is allowed (NFT)', async () => {353 it('Fails to set more properties than it is allowed (NFT)', async () => {338 await testFailsSetMorePropertiesThanAllowed({type: 'NFT'});354 await testFailsSetMorePropertiesThanAllowed({type: 'NFT'});339 });355 });340 it('Fails to set more properties than it is allowed (ReFungible)', async () => {356 it('Fails to set more properties than it is allowed (ReFungible)', async function() {357 await requirePallets(this, [Pallets.ReFungible]);358341 await testFailsSetMorePropertiesThanAllowed({type: 'ReFungible'});359 await testFailsSetMorePropertiesThanAllowed({type: 'ReFungible'});342 });360 });392 it('Fails to set properties with invalid names (NFT)', async () => {410 it('Fails to set properties with invalid names (NFT)', async () => {393 await testFailsSetPropertiesWithInvalidNames({type: 'NFT'});411 await testFailsSetPropertiesWithInvalidNames({type: 'NFT'});394 });412 });395 it('Fails to set properties with invalid names (ReFungible)', async () => {413 it('Fails to set properties with invalid names (ReFungible)', async function() {414 await requirePallets(this, [Pallets.ReFungible]);415396 await testFailsSetPropertiesWithInvalidNames({type: 'ReFungible'});416 await testFailsSetPropertiesWithInvalidNames({type: 'ReFungible'});397 });417 });443 it('Sets access rights to properties of a collection (NFT)', async () => {463 it('Sets access rights to properties of a collection (NFT)', async () => {444 await testSetsAccessRightsToProperties({type: 'NFT'});464 await testSetsAccessRightsToProperties({type: 'NFT'});445 });465 });446 it('Sets access rights to properties of a collection (ReFungible)', async () => {466 it('Sets access rights to properties of a collection (ReFungible)', async function() {467 await requirePallets(this, [Pallets.ReFungible]);468447 await testSetsAccessRightsToProperties({type: 'ReFungible'});469 await testSetsAccessRightsToProperties({type: 'ReFungible'});448 });470 });472 it('Changes access rights to properties of a NFT collection', async () => {494 it('Changes access rights to properties of a NFT collection', async () => {473 await testChangesAccessRightsToProperty({type: 'NFT'});495 await testChangesAccessRightsToProperty({type: 'NFT'});474 });496 });475 it('Changes access rights to properties of a ReFungible collection', async () => {497 it('Changes access rights to properties of a ReFungible collection', async function() {498 await requirePallets(this, [Pallets.ReFungible]);499476 await testChangesAccessRightsToProperty({type: 'ReFungible'});500 await testChangesAccessRightsToProperty({type: 'ReFungible'});477 });501 });502 it('Prevents from setting access rights to properties of a NFT collection if not an onwer/admin', async () => {526 it('Prevents from setting access rights to properties of a NFT collection if not an onwer/admin', async () => {503 await testPreventsFromSettingAccessRightsNotAdminOrOwner({type: 'NFT'});527 await testPreventsFromSettingAccessRightsNotAdminOrOwner({type: 'NFT'});504 });528 });505 it('Prevents from setting access rights to properties of a ReFungible collection if not an onwer/admin', async () => {529 it('Prevents from setting access rights to properties of a ReFungible collection if not an onwer/admin', async function() {530 await requirePallets(this, [Pallets.ReFungible]);531506 await testPreventsFromSettingAccessRightsNotAdminOrOwner({type: 'ReFungible'});532 await testPreventsFromSettingAccessRightsNotAdminOrOwner({type: 'ReFungible'});507 });533 });531 it('Prevents from adding too many possible properties (NFT)', async () => {557 it('Prevents from adding too many possible properties (NFT)', async () => {532 await testPreventFromAddingTooManyPossibleProperties({type: 'NFT'});558 await testPreventFromAddingTooManyPossibleProperties({type: 'NFT'});533 });559 });534 it('Prevents from adding too many possible properties (ReFungible)', async () => {560 it('Prevents from adding too many possible properties (ReFungible)', async function() {561 await requirePallets(this, [Pallets.ReFungible]);562535 await testPreventFromAddingTooManyPossibleProperties({type: 'ReFungible'});563 await testPreventFromAddingTooManyPossibleProperties({type: 'ReFungible'});536 });564 });560 it('Prevents access rights to be modified if constant (NFT)', async () => {588 it('Prevents access rights to be modified if constant (NFT)', async () => {561 await testPreventAccessRightsModifiedIfConstant({type: 'NFT'});589 await testPreventAccessRightsModifiedIfConstant({type: 'NFT'});562 });590 });563 it('Prevents access rights to be modified if constant (ReFungible)', async () => {591 it('Prevents access rights to be modified if constant (ReFungible)', async function() {592 await requirePallets(this, [Pallets.ReFungible]);593564 await testPreventAccessRightsModifiedIfConstant({type: 'ReFungible'});594 await testPreventAccessRightsModifiedIfConstant({type: 'ReFungible'});565 });595 });608 it('Prevents adding properties with invalid names (NFT)', async () => {638 it('Prevents adding properties with invalid names (NFT)', async () => {609 await testPreventsAddingPropertiesWithInvalidNames({type: 'NFT'});639 await testPreventsAddingPropertiesWithInvalidNames({type: 'NFT'});610 });640 });611 it('Prevents adding properties with invalid names (ReFungible)', async () => {641 it('Prevents adding properties with invalid names (ReFungible)', async function() {642 await requirePallets(this, [Pallets.ReFungible]);643612 await testPreventsAddingPropertiesWithInvalidNames({type: 'ReFungible'});644 await testPreventsAddingPropertiesWithInvalidNames({type: 'ReFungible'});613 });645 });651 it('Reads yet empty properties of a token (NFT)', async () => {683 it('Reads yet empty properties of a token (NFT)', async () => {652 await testReadsYetEmptyProperties({type: 'NFT'});684 await testReadsYetEmptyProperties({type: 'NFT'});653 });685 });654 it('Reads yet empty properties of a token (ReFungible)', async () => {686 it('Reads yet empty properties of a token (ReFungible)', async function() {687 await requirePallets(this, [Pallets.ReFungible]);688655 await testReadsYetEmptyProperties({type: 'ReFungible'});689 await testReadsYetEmptyProperties({type: 'ReFungible'});656 });690 });696 it('Assigns properties to a token according to permissions (NFT)', async () => {730 it('Assigns properties to a token according to permissions (NFT)', async () => {697 await testAssignPropertiesAccordingToPermissions({type: 'NFT'}, 1);731 await testAssignPropertiesAccordingToPermissions({type: 'NFT'}, 1);698 });732 });699 it('Assigns properties to a token according to permissions (ReFungible)', async () => {733 it('Assigns properties to a token according to permissions (ReFungible)', async function() {734 await requirePallets(this, [Pallets.ReFungible]);735700 await testAssignPropertiesAccordingToPermissions({type: 'ReFungible'}, 100);736 await testAssignPropertiesAccordingToPermissions({type: 'ReFungible'}, 100);701 });737 });749 it('Changes properties of a token according to permissions (NFT)', async () => {785 it('Changes properties of a token according to permissions (NFT)', async () => {750 await testChangesPropertiesAccordingPermission({type: 'NFT'}, 1);786 await testChangesPropertiesAccordingPermission({type: 'NFT'}, 1);751 });787 });752 it('Changes properties of a token according to permissions (ReFungible)', async () => {788 it('Changes properties of a token according to permissions (ReFungible)', async function() {789 await requirePallets(this, [Pallets.ReFungible]);790753 await testChangesPropertiesAccordingPermission({type: 'ReFungible'}, 100);791 await testChangesPropertiesAccordingPermission({type: 'ReFungible'}, 100);754 });792 });802 it('Deletes properties of a token according to permissions (NFT)', async () => {840 it('Deletes properties of a token according to permissions (NFT)', async () => {803 await testDeletePropertiesAccordingPermission({type: 'NFT'}, 1);841 await testDeletePropertiesAccordingPermission({type: 'NFT'}, 1);804 });842 });805 it('Deletes properties of a token according to permissions (ReFungible)', async () => {843 it('Deletes properties of a token according to permissions (ReFungible)', async function() {844 await requirePallets(this, [Pallets.ReFungible]);845806 await testDeletePropertiesAccordingPermission({type: 'ReFungible'}, 100);846 await testDeletePropertiesAccordingPermission({type: 'ReFungible'}, 100);807 });847 });1029 it('Forbids changing/deleting properties of a token if the user is outside of permissions (NFT)', async () => {1069 it('Forbids changing/deleting properties of a token if the user is outside of permissions (NFT)', async () => {1030 await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions({type: 'NFT'}, 1);1070 await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions({type: 'NFT'}, 1);1031 });1071 });1032 it('Forbids changing/deleting properties of a token if the user is outside of permissions (ReFungible)', async () => {1072 it('Forbids changing/deleting properties of a token if the user is outside of permissions (ReFungible)', async function() {1073 await requirePallets(this, [Pallets.ReFungible]);10741033 await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions({type: 'ReFungible'}, 100);1075 await testForbidsChangingDeletingPropertiesUserOutsideOfPermissions({type: 'ReFungible'}, 100);1034 });1076 });1062 it('Forbids changing/deleting properties of a token if the property is permanent (immutable) (NFT)', async () => {1104 it('Forbids changing/deleting properties of a token if the property is permanent (immutable) (NFT)', async () => {1063 await testForbidsChangingDeletingPropertiesIfPropertyImmutable({type: 'NFT'}, 1);1105 await testForbidsChangingDeletingPropertiesIfPropertyImmutable({type: 'NFT'}, 1);1064 });1106 });1065 it('Forbids changing/deleting properties of a token if the property is permanent (immutable) (ReFungible)', async () => {1107 it('Forbids changing/deleting properties of a token if the property is permanent (immutable) (ReFungible)', async function() {1108 await requirePallets(this, [Pallets.ReFungible]);11091066 await testForbidsChangingDeletingPropertiesIfPropertyImmutable({type: 'ReFungible'}, 100);1110 await testForbidsChangingDeletingPropertiesIfPropertyImmutable({type: 'ReFungible'}, 100);1067 });1111 });1096 it('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (NFT)', async () => {1140 it('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (NFT)', async () => {1097 await testForbidsAddingPropertiesIfPropertyNotDeclared({type: 'NFT'}, 1);1141 await testForbidsAddingPropertiesIfPropertyNotDeclared({type: 'NFT'}, 1);1098 });1142 });1099 it('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (ReFungible)', async () => {1143 it('Forbids adding properties to a token if the property is not declared / forbidden with the \'None\' permission (ReFungible)', async function() {1144 await requirePallets(this, [Pallets.ReFungible]);11451100 await testForbidsAddingPropertiesIfPropertyNotDeclared({type: 'ReFungible'}, 100);1146 await testForbidsAddingPropertiesIfPropertyNotDeclared({type: 'ReFungible'}, 100);1101 });1147 });1140 it('Forbids adding too many properties to a token (NFT)', async () => {1186 it('Forbids adding too many properties to a token (NFT)', async () => {1141 await testForbidsAddingTooManyProperties({type: 'NFT'}, 1);1187 await testForbidsAddingTooManyProperties({type: 'NFT'}, 1);1142 });1188 });1143 it('Forbids adding too many properties to a token (ReFungible)', async () => {1189 it('Forbids adding too many properties to a token (ReFungible)', async function() {1190 await requirePallets(this, [Pallets.ReFungible]);11911144 await testForbidsAddingTooManyProperties({type: 'ReFungible'}, 100);1192 await testForbidsAddingTooManyProperties({type: 'ReFungible'}, 100);1145 });1193 });1149 let collection: number;1197 let collection: number;1150 let token: number;1198 let token: number;115111991152 before(async () => {1200 before(async function() {1201 await requirePallets(this, [Pallets.ReFungible]);12021153 await usingApi(async (api, privateKeyWrapper) => {1203 await usingApi(async (api, privateKeyWrapper) => {1154 alice = privateKeyWrapper('//Alice');1204 alice = privateKeyWrapper('//Alice');tests/src/nesting/rules-smoke.test.tsdiffbeforeafterboth1import {expect} from 'chai';1import {expect} from 'chai';2import {tokenIdToAddress} from '../eth/util/helpers';2import {tokenIdToAddress} from '../eth/util/helpers';3import usingApi, {executeTransaction} from '../substrate/substrate-api';3import usingApi, {executeTransaction} from '../substrate/substrate-api';4import {createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, CrossAccountId, getCreateCollectionResult} from '../util/helpers';4import {createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, CrossAccountId, getCreateCollectionResult, requirePallets, Pallets} from '../util/helpers';5import {IKeyringPair} from '@polkadot/types/types';5import {IKeyringPair} from '@polkadot/types/types';667describe('nesting check', () => {7describe('nesting check', () => {47 });47 });48 });48 });494950 it('called for refungible', async () => {50 it('called for refungible', async function() {51 await requirePallets(this, [Pallets.ReFungible]);5251 await usingApi(async api => {53 await usingApi(async api => {52 const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});54 const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});tests/src/nesting/unnest.test.tsdiffbeforeafterboth10 setCollectionPermissionsExpectSuccess,10 setCollectionPermissionsExpectSuccess,11 transferExpectSuccess,11 transferExpectSuccess,12 transferFromExpectSuccess,12 transferFromExpectSuccess,13 requirePallets,14 Pallets13} from '../util/helpers';15} from '../util/helpers';14import {IKeyringPair} from '@polkadot/types/types';16import {IKeyringPair} from '@polkadot/types/types';151780 });82 });81 });83 });828483 it('ReFungible: allows the owner to successfully unnest a token', async () => {85 it('ReFungible: allows the owner to successfully unnest a token', async function() {86 await requirePallets(this, [Pallets.ReFungible]);8784 await usingApi(async api => {88 await usingApi(async api => {85 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});89 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});tests/src/nextSponsoring.test.tsdiffbeforeafterboth27 transferExpectSuccess,27 transferExpectSuccess,28 normalizeAccountId,28 normalizeAccountId,29 getNextSponsored,29 getNextSponsored,30 requirePallets,31 Pallets30} from './util/helpers';32} from './util/helpers';313332chai.use(chaiAsPromised);34chai.use(chaiAsPromised);89 });91 });90 });92 });919392 it('ReFungible', async () => {94 it('ReFungible', async function() {95 await requirePallets(this, [Pallets.ReFungible]);9693 await usingApi(async (api: ApiPromise) => {97 await usingApi(async (api: ApiPromise) => {9498tests/src/pallet-presence.test.tsdiffbeforeafterboth49 'inflation',49 'inflation',50 'unique',50 'unique',51 'nonfungible',51 'nonfungible',52 'refungible',53 'scheduler',54 'charging',52 'charging',55];53];565466 await usingApi(async api => {64 await usingApi(async api => {67 const chain = await api.rpc.system.chain();65 const chain = await api.rpc.system.chain();6667 const refungible = 'refungible';68 const scheduler = 'scheduler';69 const rmrkPallets = ['rmrkcore', 'rmrkequip'];687069 if (!chain.eq('UNIQUE')) {71 if (chain.eq('OPAL by UNIQUE')) {70 requiredPallets.push(...['rmrkcore', 'rmrkequip']);72 requiredPallets.push(refungible, scheduler, ...rmrkPallets);71 }73 } else if (chain.eq('QUARTZ by UNIQUE')) {74 // Insert Quartz additional pallets here75 } else if (chain.eq('UNIQUE')) {76 // Insert Unique additional pallets here77 }72 });78 });73 });79 });7480tests/src/refungible.test.tsdiffbeforeafterboth38 getDestroyItemsResult,38 getDestroyItemsResult,39 getModuleNames,39 getModuleNames,40 Pallets,40 Pallets,41 requirePallets41} from './util/helpers';42} from './util/helpers';424343import chai from 'chai';44import chai from 'chai';525353describe('integration test: Refungible functionality:', async () => {54describe('integration test: Refungible functionality:', async () => {54 before(async function() {55 before(async function() {56 await requirePallets(this, [Pallets.ReFungible]);5755 await usingApi(async (api, privateKeyWrapper) => {58 await usingApi(async (api, privateKeyWrapper) => {56 alice = privateKeyWrapper('//Alice');59 alice = privateKeyWrapper('//Alice');tests/src/rmrk/acceptNft.test.tsdiffbeforeafterboth14 let api: any;14 let api: any;15 before(async function() {15 before(async function() {16 api = await getApiConnection();16 api = await getApiConnection();17 requirePallets(this, api, [Pallets.RmrkCore]);17 await requirePallets(this, [Pallets.RmrkCore]);18 });18 });19 19 20 20 tests/src/rmrk/addResource.test.tsdiffbeforeafterboth27 let api: any;27 let api: any;28 before(async function() {28 before(async function() {29 api = await getApiConnection();29 api = await getApiConnection();30 requirePallets(this, api, [Pallets.RmrkCore]);30 await requirePallets(this, [Pallets.RmrkCore]);31 });31 });323233 it('add resource', async () => {33 it('add resource', async () => {tests/src/rmrk/addTheme.test.tsdiffbeforeafterboth9 let api: any;9 let api: any;10 before(async function() {10 before(async function() {11 api = await getApiConnection();11 api = await getApiConnection();12 requirePallets(this, api, [Pallets.RmrkEquip]);12 await requirePallets(this, [Pallets.RmrkEquip]);13 });13 });141415 const alice = '//Alice';15 const alice = '//Alice';tests/src/rmrk/burnNft.test.tsdiffbeforeafterboth17 let api: any;17 let api: any;18 before(async function() {18 before(async function() {19 api = await getApiConnection();19 api = await getApiConnection();20 requirePallets(this, api, [Pallets.RmrkCore]);20 await requirePallets(this, [Pallets.RmrkCore]);21 });21 });22222323tests/src/rmrk/changeCollectionIssuer.test.tsdiffbeforeafterboth13 let api: any;13 let api: any;14 before(async function() {14 before(async function() {15 api = await getApiConnection();15 api = await getApiConnection();16 requirePallets(this, api, [Pallets.RmrkCore]);16 await requirePallets(this, [Pallets.RmrkCore]);17 });17 });18181919tests/src/rmrk/createBase.test.tsdiffbeforeafterboth6 let api: any;6 let api: any;7 before(async function() {7 before(async function() {8 api = await getApiConnection();8 api = await getApiConnection();9 requirePallets(this, api, [Pallets.RmrkCore, Pallets.RmrkEquip]);9 await requirePallets(this, [Pallets.RmrkCore, Pallets.RmrkEquip]);10 });10 });111112 const alice = '//Alice';12 const alice = '//Alice';tests/src/rmrk/createCollection.test.tsdiffbeforeafterboth6 let api: any;6 let api: any;7 before(async function () {7 before(async function () {8 api = await getApiConnection();8 api = await getApiConnection();9 requirePallets(this, api, [Pallets.RmrkCore]);9 await requirePallets(this, [Pallets.RmrkCore]);10 });10 });11111212tests/src/rmrk/deleteCollection.test.tsdiffbeforeafterboth7 let api: any;7 let api: any;8 before(async function () {8 before(async function () {9 api = await getApiConnection();9 api = await getApiConnection();10 requirePallets(this, api, [Pallets.RmrkCore]);10 await requirePallets(this, [Pallets.RmrkCore]);11 });11 });121213 const Alice = '//Alice';13 const Alice = '//Alice';tests/src/rmrk/equipNft.test.tsdiffbeforeafterboth126 126 127 before(async function () {127 before(async function () {128 api = await getApiConnection();128 api = await getApiConnection();129 requirePallets(this, api, [Pallets.RmrkCore, Pallets.RmrkEquip]);129 await requirePallets(this, [Pallets.RmrkCore, Pallets.RmrkEquip]);130 });130 });131131132 it('equip nft', async () => {132 it('equip nft', async () => {tests/src/rmrk/getOwnedNfts.test.tsdiffbeforeafterboth9 9 10 before(async function () {10 before(async function () {11 api = await getApiConnection();11 api = await getApiConnection();12 requirePallets(this, api, [Pallets.RmrkCore]);12 await requirePallets(this, [Pallets.RmrkCore]);13 });13 });14141515tests/src/rmrk/lockCollection.test.tsdiffbeforeafterboth11 let api: any;11 let api: any;12 before(async function () {12 before(async function () {13 api = await getApiConnection();13 api = await getApiConnection();14 requirePallets(this, api, [Pallets.RmrkCore]);14 await requirePallets(this, [Pallets.RmrkCore]);15 });15 });161617 it('lock collection', async () => {17 it('lock collection', async () => {tests/src/rmrk/mintNft.test.tsdiffbeforeafterboth10 10 11 before(async function () {11 before(async function () {12 api = await getApiConnection();12 api = await getApiConnection();13 requirePallets(this, api, [Pallets.RmrkCore]);13 await requirePallets(this, [Pallets.RmrkCore]);14 });14 });15151616tests/src/rmrk/rejectNft.test.tsdiffbeforeafterboth14 let api: any;14 let api: any;15 before(async function () {15 before(async function () {16 api = await getApiConnection();16 api = await getApiConnection();17 requirePallets(this, api, [Pallets.RmrkCore]);17 await requirePallets(this, [Pallets.RmrkCore]);18 });18 });19192020tests/src/rmrk/removeResource.test.tsdiffbeforeafterboth20 before(async function() {20 before(async function() {21 api = await getApiConnection();21 api = await getApiConnection();22 ss58Format = api.registry.getChainProperties()!.toJSON().ss58Format;22 ss58Format = api.registry.getChainProperties()!.toJSON().ss58Format;23 requirePallets(this, api, [Pallets.RmrkCore]);23 await requirePallets(this, [Pallets.RmrkCore]);24 });24 });252526 const Alice = '//Alice';26 const Alice = '//Alice';tests/src/rmrk/rmrkIsolation.test.tsdiffbeforeafterboth64 before(async function() {64 before(async function() {65 await usingApi(async (api, privateKeyWrapper) => {65 await usingApi(async (api, privateKeyWrapper) => {66 alice = privateKeyWrapper('//Alice');66 alice = privateKeyWrapper('//Alice');67 requirePallets(this, api, [Pallets.RmrkCore]);67 await requirePallets(this, [Pallets.RmrkCore]);68 });68 });69 });69 });7070tests/src/rmrk/sendNft.test.tsdiffbeforeafterboth9 let api: any;9 let api: any;10 before(async function () {10 before(async function () {11 api = await getApiConnection();11 api = await getApiConnection();12 requirePallets(this, api, [Pallets.RmrkCore]);12 await requirePallets(this, [Pallets.RmrkCore]);13 });13 });141415 const maxNftId = 0xFFFFFFFF;15 const maxNftId = 0xFFFFFFFF;tests/src/rmrk/setCollectionProperty.test.tsdiffbeforeafterboth10 let api: any;10 let api: any;11 before(async function () {11 before(async function () {12 api = await getApiConnection();12 api = await getApiConnection();13 requirePallets(this, api, [Pallets.RmrkCore]);13 await requirePallets(this, [Pallets.RmrkCore]);14 });14 });151516 it('set collection property', async () => {16 it('set collection property', async () => {tests/src/rmrk/setEquippableList.test.tsdiffbeforeafterboth7 let api: any;7 let api: any;8 before(async function () {8 before(async function () {9 api = await getApiConnection();9 api = await getApiConnection();10 requirePallets(this, api, [Pallets.RmrkCore]);10 await requirePallets(this, [Pallets.RmrkCore]);11 });11 });121213 const alice = '//Alice';13 const alice = '//Alice';tests/src/rmrk/setNftProperty.test.tsdiffbeforeafterboth8 let api: any;8 let api: any;9 before(async function () {9 before(async function () {10 api = await getApiConnection();10 api = await getApiConnection();11 requirePallets(this, api, [Pallets.RmrkCore]);11 await requirePallets(this, [Pallets.RmrkCore]);12 });12 });131314 const alice = '//Alice';14 const alice = '//Alice';tests/src/rmrk/setResourcePriorities.test.tsdiffbeforeafterboth7 let api: any;7 let api: any;8 before(async function () {8 before(async function () {9 api = await getApiConnection();9 api = await getApiConnection();10 requirePallets(this, api, [Pallets.RmrkCore]);10 await requirePallets(this, [Pallets.RmrkCore]);11 });11 });121213 const alice = '//Alice';13 const alice = '//Alice';tests/src/setCollectionSponsor.test.tsdiffbeforeafterboth23 setCollectionSponsorExpectFailure,23 setCollectionSponsorExpectFailure,24 addCollectionAdminExpectSuccess,24 addCollectionAdminExpectSuccess,25 getCreatedCollectionCount,25 getCreatedCollectionCount,26 requirePallets,27 Pallets26} from './util/helpers';28} from './util/helpers';27import {IKeyringPair} from '@polkadot/types/types';29import {IKeyringPair} from '@polkadot/types/types';283050 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});52 const collectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});51 await setCollectionSponsorExpectSuccess(collectionId, bob.address);53 await setCollectionSponsorExpectSuccess(collectionId, bob.address);52 });54 });53 it('Set ReFungible collection sponsor', async () => {55 it('Set ReFungible collection sponsor', async function() {56 await requirePallets(this, [Pallets.ReFungible]);5754 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});58 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});55 await setCollectionSponsorExpectSuccess(collectionId, bob.address);59 await setCollectionSponsorExpectSuccess(collectionId, bob.address);tests/src/transfer.test.tsdiffbeforeafterboth35 getBalance as getTokenBalance,35 getBalance as getTokenBalance,36 transferFromExpectSuccess,36 transferFromExpectSuccess,37 transferFromExpectFail,37 transferFromExpectFail,38 requirePallets,39 Pallets,38} from './util/helpers';40} from './util/helpers';39import {41import {40 subToEth,42 subToEth,41 itWeb3, 43 itWeb3, 42} from './eth/util/helpers';44} from './eth/util/helpers';45import { request } from 'https';434644let alice: IKeyringPair;47let alice: IKeyringPair;45let bob: IKeyringPair;48let bob: IKeyringPair;89 });92 });90 });93 });9495 it('[nft] User can transfer owned token', async () => {96 const nftCollectionId = await createCollectionExpectSuccess();97 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');98 await transferExpectSuccess(nftCollectionId, newNftTokenId, alice, bob, 1, 'NFT');99 });9110092 it('User can transfer owned token', async () => {101 it('[fungible] User can transfer owned token', async () => {93 await usingApi(async (api, privateKeyWrapper) => {94 // nft95 const nftCollectionId = await createCollectionExpectSuccess();96 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');97 await transferExpectSuccess(nftCollectionId, newNftTokenId, alice, bob, 1, 'NFT');98 // fungible99 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});102 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});100 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');103 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');101 await transferExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob, 1, 'Fungible');104 await transferExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob, 1, 'Fungible');102 // reFungible103 const reFungibleCollectionId = await104 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});105 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');106 await transferExpectSuccess(107 reFungibleCollectionId,108 newReFungibleTokenId,109 alice,110 bob,111 100,112 'ReFungible',113 );114 });115 });105 });106107 it('[refungible] User can transfer owned token', async function() {108 await requirePallets(this, [Pallets.ReFungible]);109110 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});111 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');112 await transferExpectSuccess(113 reFungibleCollectionId,114 newReFungibleTokenId,115 alice,116 bob,117 100,118 'ReFungible',119 );120 });121122 it('[nft] Collection admin can transfer owned token', async () => {123 const nftCollectionId = await createCollectionExpectSuccess();124 await addCollectionAdminExpectSuccess(alice, nftCollectionId, bob.address);125 const newNftTokenId = await createItemExpectSuccess(bob, nftCollectionId, 'NFT', bob.address);126 await transferExpectSuccess(nftCollectionId, newNftTokenId, bob, alice, 1, 'NFT');127 });116128117 it('Collection admin can transfer owned token', async () => {129 it('[fungible] Collection admin can transfer owned token', async () => {118 await usingApi(async (api, privateKeyWrapper) => {119 // nft120 const nftCollectionId = await createCollectionExpectSuccess();121 await addCollectionAdminExpectSuccess(alice, nftCollectionId, bob.address);122 const newNftTokenId = await createItemExpectSuccess(bob, nftCollectionId, 'NFT', bob.address);123 await transferExpectSuccess(nftCollectionId, newNftTokenId, bob, alice, 1, 'NFT');124 // fungible125 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});130 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});126 await addCollectionAdminExpectSuccess(alice, fungibleCollectionId, bob.address);131 await addCollectionAdminExpectSuccess(alice, fungibleCollectionId, bob.address);127 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible', bob.address);132 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible', bob.address);128 await transferExpectSuccess(fungibleCollectionId, newFungibleTokenId, bob, alice, 1, 'Fungible');133 await transferExpectSuccess(fungibleCollectionId, newFungibleTokenId, bob, alice, 1, 'Fungible');129 // reFungible130 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});131 await addCollectionAdminExpectSuccess(alice, reFungibleCollectionId, bob.address);132 const newReFungibleTokenId = await createItemExpectSuccess(bob, reFungibleCollectionId, 'ReFungible', bob.address);133 await transferExpectSuccess(134 reFungibleCollectionId,135 newReFungibleTokenId,136 bob,137 alice,138 100,139 'ReFungible',140 );141 });142 });134 });135136 it('[refungible] Collection admin can transfer owned token', async function() {137 await requirePallets(this, [Pallets.ReFungible]);138139 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});140 await addCollectionAdminExpectSuccess(alice, reFungibleCollectionId, bob.address);141 const newReFungibleTokenId = await createItemExpectSuccess(bob, reFungibleCollectionId, 'ReFungible', bob.address);142 await transferExpectSuccess(143 reFungibleCollectionId,144 newReFungibleTokenId,145 bob,146 alice,147 100,148 'ReFungible',149 );150 });143});151});144152145describe('Negative Integration Test Transfer(recipient, collection_id, item_id, value)', () => {153describe('Negative Integration Test Transfer(recipient, collection_id, item_id, value)', () => {151 });159 });152 });160 });161153 it('Transfer with not existed collection_id', async () => {162 it('[nft] Transfer with not existed collection_id', async () => {154 await usingApi(async (api) => {163 await usingApi(async (api) => {155 // nft156 const nftCollectionCount = await getCreatedCollectionCount(api);164 const nftCollectionCount = await getCreatedCollectionCount(api);157 await transferExpectFailure(nftCollectionCount + 1, 1, alice, bob, 1);165 await transferExpectFailure(nftCollectionCount + 1, 1, alice, bob, 1);158 // fungible159 const fungibleCollectionCount = await getCreatedCollectionCount(api);160 await transferExpectFailure(fungibleCollectionCount + 1, 0, alice, bob, 1);161 // reFungible162 const reFungibleCollectionCount = await getCreatedCollectionCount(api);163 await transferExpectFailure(reFungibleCollectionCount + 1, 1, alice, bob, 1);164 });166 });165 });167 });166 it('Transfer with deleted collection_id', async () => {168167 // nft169 it('[fungible] Transfer with not existed collection_id', async () => {170 await usingApi(async (api) => {171 const fungibleCollectionCount = await getCreatedCollectionCount(api);172 await transferExpectFailure(fungibleCollectionCount + 1, 0, alice, bob, 1);173 });174 });175176 it('[refungible] Transfer with not existed collection_id', async function() {177 await requirePallets(this, [Pallets.ReFungible]);178179 await usingApi(async (api) => {180 const reFungibleCollectionCount = await getCreatedCollectionCount(api);181 await transferExpectFailure(reFungibleCollectionCount + 1, 1, alice, bob, 1);182 });168 const nftCollectionId = await createCollectionExpectSuccess();183 });169 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');184170 await burnItemExpectSuccess(alice, nftCollectionId, newNftTokenId);185 it('[nft] Transfer with deleted collection_id', async () => {171 await destroyCollectionExpectSuccess(nftCollectionId);186 const nftCollectionId = await createCollectionExpectSuccess();172 await transferExpectFailure(nftCollectionId, newNftTokenId, alice, bob, 1);187 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');173 // fungible188 await burnItemExpectSuccess(alice, nftCollectionId, newNftTokenId);189 await destroyCollectionExpectSuccess(nftCollectionId);190 await transferExpectFailure(nftCollectionId, newNftTokenId, alice, bob, 1);191 });192193 it('[fungible] Transfer with deleted collection_id', async () => {174 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});194 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});175 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');195 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');176 await burnItemExpectSuccess(alice, fungibleCollectionId, newFungibleTokenId, 10);196 await burnItemExpectSuccess(alice, fungibleCollectionId, newFungibleTokenId, 10);177 await destroyCollectionExpectSuccess(fungibleCollectionId);197 await destroyCollectionExpectSuccess(fungibleCollectionId);178 await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, alice, bob, 1);198 await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, alice, bob, 1);179 // reFungible199 });200201 it('[refungible] Transfer with deleted collection_id', async function() {202 await requirePallets(this, [Pallets.ReFungible]);203180 const reFungibleCollectionId = await204 const reFungibleCollectionId = await181 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});205 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});189 bob,213 bob,190 1,214 1,191 );215 );192 });216 });217218 it('[nft] Transfer with not existed item_id', async () => {219 const nftCollectionId = await createCollectionExpectSuccess();220 await transferExpectFailure(nftCollectionId, 2, alice, bob, 1);221 });222223 it('[fungible] Transfer with not existed item_id', async () => {224 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});225 await transferExpectFailure(fungibleCollectionId, 2, alice, bob, 1);226 });227228 it('[refungible] Transfer with not existed item_id', async function() {229 await requirePallets(this, [Pallets.ReFungible]);230231 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});232 await transferExpectFailure(233 reFungibleCollectionId,234 2,235 alice,236 bob,237 1,238 );239 });240241 it('[nft] Transfer with deleted item_id', async () => {242 const nftCollectionId = await createCollectionExpectSuccess();243 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');244 await burnItemExpectSuccess(alice, nftCollectionId, newNftTokenId, 1);245 await transferExpectFailure(nftCollectionId, newNftTokenId, alice, bob, 1);246 });247193 it('Transfer with not existed item_id', async () => {248 it('[fungible] Transfer with deleted item_id', async () => {194 // nft195 const nftCollectionId = await createCollectionExpectSuccess();196 await transferExpectFailure(nftCollectionId, 2, alice, bob, 1);197 // fungible198 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});249 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});199 await transferExpectFailure(fungibleCollectionId, 2, alice, bob, 1);250 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');200 // reFungible201 const reFungibleCollectionId = await251 await burnItemExpectSuccess(alice, fungibleCollectionId, newFungibleTokenId, 10);202 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});203 await transferExpectFailure(252 await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, alice, bob, 1);204 reFungibleCollectionId,205 2,206 alice,207 bob,208 1,209 );210 });253 });254211 it('Transfer with deleted item_id', async () => {255 it('[refungible] Transfer with deleted item_id', async function() {212 // nft213 const nftCollectionId = await createCollectionExpectSuccess();214 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');215 await burnItemExpectSuccess(alice, nftCollectionId, newNftTokenId, 1);216 await transferExpectFailure(nftCollectionId, newNftTokenId, alice, bob, 1);217 // fungible218 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});256 await requirePallets(this, [Pallets.ReFungible]);219 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');257220 await burnItemExpectSuccess(alice, fungibleCollectionId, newFungibleTokenId, 10);221 await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, alice, bob, 1);222 // reFungible223 const reFungibleCollectionId = await258 const reFungibleCollectionId = await224 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});259 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});225 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');260 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');233 );268 );234 });269 });270271 it('[nft] Transfer with recipient that is not owner', async () => {272 const nftCollectionId = await createCollectionExpectSuccess();273 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');274 await transferExpectFailure(nftCollectionId, newNftTokenId, charlie, bob, 1);275 });276277 it('[fungible] Transfer with recipient that is not owner', async () => {278 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});279 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');280 await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, charlie, bob, 1);281 });282235 it('Transfer with recipient that is not owner', async () => {283 it('[refungible] Transfer with recipient that is not owner', async function() {236 // nft237 const nftCollectionId = await createCollectionExpectSuccess();238 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');239 await transferExpectFailure(nftCollectionId, newNftTokenId, charlie, bob, 1);240 // fungible241 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});284 await requirePallets(this, [Pallets.ReFungible]);242 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');285243 await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, charlie, bob, 1);244 // reFungible245 const reFungibleCollectionId = await286 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});246 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});247 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');287 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');276 });316 });277 });317 });278318279 it('RFT', async () => {319 it('RFT', async function() {320 await requirePallets(this, [Pallets.ReFungible]);321280 await usingApi(async (api: ApiPromise) => {322 await usingApi(async (api: ApiPromise) => {281 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});323 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});tests/src/transferFrom.test.tsdiffbeforeafterboth31 burnItemExpectSuccess,31 burnItemExpectSuccess,32 setCollectionLimitsExpectSuccess,32 setCollectionLimitsExpectSuccess,33 getCreatedCollectionCount,33 getCreatedCollectionCount,34 requirePallets,35 Pallets34} from './util/helpers';36} from './util/helpers';353736chai.use(chaiAsPromised);38chai.use(chaiAsPromised);49 });51 });50 });52 });5354 it('[nft] Execute the extrinsic and check nftItemList - owner of token', async () => {55 const nftCollectionId = await createCollectionExpectSuccess();56 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');57 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address);5859 await transferFromExpectSuccess(nftCollectionId, newNftTokenId, bob, alice, charlie, 1, 'NFT');60 });516152 it('Execute the extrinsic and check nftItemList - owner of token', async () => {62 it('[fungible] Execute the extrinsic and check nftItemList - owner of token', async () => {53 await usingApi(async () => {54 // nft55 const nftCollectionId = await createCollectionExpectSuccess();56 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');57 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address);5859 await transferFromExpectSuccess(nftCollectionId, newNftTokenId, bob, alice, charlie, 1, 'NFT');6061 // fungible62 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});63 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});63 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');64 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');64 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address);65 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address);65 await transferFromExpectSuccess(fungibleCollectionId, newFungibleTokenId, bob, alice, charlie, 1, 'Fungible');66 await transferFromExpectSuccess(fungibleCollectionId, newFungibleTokenId, bob, alice, charlie, 1, 'Fungible');6667 // reFungible68 const reFungibleCollectionId = await69 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});70 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');71 await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, alice, bob.address, 100);72 await transferFromExpectSuccess(73 reFungibleCollectionId,74 newReFungibleTokenId,75 bob,76 alice,77 charlie,78 100,79 'ReFungible',80 );81 });82 });67 });6869 it('[refungible] Execute the extrinsic and check nftItemList - owner of token', async function() {70 await requirePallets(this, [Pallets.ReFungible]);7172 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});73 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');74 await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, alice, bob.address, 100);75 await transferFromExpectSuccess(76 reFungibleCollectionId,77 newReFungibleTokenId,78 bob,79 alice,80 charlie,81 100,82 'ReFungible',83 );84 });838584 it('Should reduce allowance if value is big', async () => {86 it('Should reduce allowance if value is big', async () => {85 await usingApi(async (api, privateKeyWrapper) => {87 await usingApi(async (api, privateKeyWrapper) => {119 });121 });120 });122 });121123122 it('transferFrom for a collection that does not exist', async () => {124 it('[nft] transferFrom for a collection that does not exist', async () => {123 await usingApi(async (api: ApiPromise) => {125 await usingApi(async (api: ApiPromise) => {124 // nft125 const nftCollectionCount = await getCreatedCollectionCount(api);126 const nftCollectionCount = await getCreatedCollectionCount(api);126 await approveExpectFail(nftCollectionCount + 1, 1, alice, bob);127 await approveExpectFail(nftCollectionCount + 1, 1, alice, bob);127128128 await transferFromExpectFail(nftCollectionCount + 1, 1, bob, alice, charlie, 1);129 await transferFromExpectFail(nftCollectionCount + 1, 1, bob, alice, charlie, 1);129130 // fungible131 const fungibleCollectionCount = await getCreatedCollectionCount(api);132 await approveExpectFail(fungibleCollectionCount + 1, 0, alice, bob);133134 await transferFromExpectFail(fungibleCollectionCount + 1, 0, bob, alice, charlie, 1);135 // reFungible136 const reFungibleCollectionCount = await getCreatedCollectionCount(api);137 await approveExpectFail(reFungibleCollectionCount + 1, 1, alice, bob);138139 await transferFromExpectFail(reFungibleCollectionCount + 1, 1, bob, alice, charlie, 1);140 });130 });141 });131 });132133 it('[fungible] transferFrom for a collection that does not exist', async () => {134 await usingApi(async (api: ApiPromise) => {135 const fungibleCollectionCount = await getCreatedCollectionCount(api);136 await approveExpectFail(fungibleCollectionCount + 1, 0, alice, bob);137138 await transferFromExpectFail(fungibleCollectionCount + 1, 0, bob, alice, charlie, 1);139 });140 });141142 it('[refungible] transferFrom for a collection that does not exist', async function() {143 await requirePallets(this, [Pallets.ReFungible]);144145 await usingApi(async (api: ApiPromise) => {146 const reFungibleCollectionCount = await getCreatedCollectionCount(api);147 await approveExpectFail(reFungibleCollectionCount + 1, 1, alice, bob);148149 await transferFromExpectFail(reFungibleCollectionCount + 1, 1, bob, alice, charlie, 1);150 });151 });142152143 /* it('transferFrom for a collection that was destroyed', async () => {153 /* it('transferFrom for a collection that was destroyed', async () => {144 await usingApi(async (api: ApiPromise) => {154 await usingApi(async (api: ApiPromise) => {158 });168 });159 }); */169 }); */170171 it('[nft] transferFrom for not approved address', async () => {172 const nftCollectionId = await createCollectionExpectSuccess();173 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');174175 await transferFromExpectFail(nftCollectionId, newNftTokenId, bob, alice, charlie, 1);176 });160177161 it('transferFrom for not approved address', async () => {178 it('[fungible] transferFrom for not approved address', async () => {162 await usingApi(async () => {163 // nft164 const nftCollectionId = await createCollectionExpectSuccess();165 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');166167 await transferFromExpectFail(nftCollectionId, newNftTokenId, bob, alice, charlie, 1);168169 // fungible170 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});179 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});171 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');180 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');172 await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, bob, alice, charlie, 1);181 await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, bob, alice, charlie, 1);173 // reFungible174 const reFungibleCollectionId = await175 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});176 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');177 await transferFromExpectFail(178 reFungibleCollectionId,179 newReFungibleTokenId,180 bob,181 alice,182 charlie,183 1,184 );185 });186 });182 });183184 it('[refungible] transferFrom for not approved address', async function() {185 await requirePallets(this, [Pallets.ReFungible]);186187 const reFungibleCollectionId = await188 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});189 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');190 await transferFromExpectFail(191 reFungibleCollectionId,192 newReFungibleTokenId,193 bob,194 alice,195 charlie,196 1,197 );198 });199200 it('[nft] transferFrom incorrect token count', async () => {201 const nftCollectionId = await createCollectionExpectSuccess();202 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');203 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address);204205 await transferFromExpectFail(nftCollectionId, newNftTokenId, bob, alice, charlie, 2);206 });187207188 it('transferFrom incorrect token count', async () => {208 it('[fungible] transferFrom incorrect token count', async () => {189 await usingApi(async () => {190 // nft191 const nftCollectionId = await createCollectionExpectSuccess();192 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');193 await approveExpectSuccess(nftCollectionId, newNftTokenId, alice, bob.address);194195 await transferFromExpectFail(nftCollectionId, newNftTokenId, bob, alice, charlie, 2);196197 // fungible198 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});209 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});199 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');210 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');200 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address);211 await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address);201 await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, bob, alice, charlie, 2);212 await transferFromExpectFail(fungibleCollectionId, newFungibleTokenId, bob, alice, charlie, 2);202 // reFungible203 const reFungibleCollectionId = await204 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});205 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');206 await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, alice, bob.address);207 await transferFromExpectFail(208 reFungibleCollectionId,209 newReFungibleTokenId,210 bob,211 alice,212 charlie,213 2,214 );215 });216 });213 });214215 it('[refungible] transferFrom incorrect token count', async function() {216 await requirePallets(this, [Pallets.ReFungible]);217218 const reFungibleCollectionId = await219 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});220 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');221 await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, alice, bob.address);222 await transferFromExpectFail(223 reFungibleCollectionId,224 newReFungibleTokenId,225 bob,226 alice,227 charlie,228 2,229 );230 });231232 it('[nft] execute transferFrom from account that is not owner of collection', async () => {233 await usingApi(async (api, privateKeyWrapper) => {234 const dave = privateKeyWrapper('//Dave');235 const nftCollectionId = await createCollectionExpectSuccess();236 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');237 try {238 await approveExpectFail(nftCollectionId, newNftTokenId, dave, bob);239 await transferFromExpectFail(nftCollectionId, newNftTokenId, dave, alice, charlie, 1);240 } catch (e) {241 // tslint:disable-next-line:no-unused-expression242 expect(e).to.be.exist;243 }244245 // await transferFromExpectFail(nftCollectionId, newNftTokenId, Dave, Alice, Charlie, 1);246 });247 });217248218 it('execute transferFrom from account that is not owner of collection', async () => {249 it('[fungible] execute transferFrom from account that is not owner of collection', async () => {219 await usingApi(async (api, privateKeyWrapper) => {250 await usingApi(async (api, privateKeyWrapper) => {220 const dave = privateKeyWrapper('//Dave');251 const dave = privateKeyWrapper('//Dave');221 // nft252222 const nftCollectionId = await createCollectionExpectSuccess();223 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');224 try {225 await approveExpectFail(nftCollectionId, newNftTokenId, dave, bob);226 await transferFromExpectFail(nftCollectionId, newNftTokenId, dave, alice, charlie, 1);227 } catch (e) {228 // tslint:disable-next-line:no-unused-expression229 expect(e).to.be.exist;230 }231232 // await transferFromExpectFail(nftCollectionId, newNftTokenId, Dave, Alice, Charlie, 1);233234 // fungible235 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});253 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});236 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');254 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');237 try {255 try {241 // tslint:disable-next-line:no-unused-expression259 // tslint:disable-next-line:no-unused-expression242 expect(e).to.be.exist;260 expect(e).to.be.exist;243 }261 }244 // reFungible245 const reFungibleCollectionId = await246 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});247 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');248 try {249 await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, dave, bob);250 await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, dave, alice, charlie, 1);251 } catch (e) {252 // tslint:disable-next-line:no-unused-expression253 expect(e).to.be.exist;254 }255 });262 });256 });263 });264265 it('[refungible] execute transferFrom from account that is not owner of collection', async function() {266 await requirePallets(this, [Pallets.ReFungible]);267268 await usingApi(async (api, privateKeyWrapper) => {269 const dave = privateKeyWrapper('//Dave');270 const reFungibleCollectionId = await271 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});272 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');273 try {274 await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, dave, bob);275 await transferFromExpectFail(reFungibleCollectionId, newReFungibleTokenId, dave, alice, charlie, 1);276 } catch (e) {277 // tslint:disable-next-line:no-unused-expression278 expect(e).to.be.exist;279 }280 });281 });257 it('transferFrom burnt token before approve NFT', async () => {282 it('transferFrom burnt token before approve NFT', async () => {258 await usingApi(async () => {283 await usingApi(async () => {259 // nft284 // nft276301277 });302 });278 });303 });279 it('transferFrom burnt token before approve ReFungible', async () => {304 it('transferFrom burnt token before approve ReFungible', async function() {305 await requirePallets(this, [Pallets.ReFungible]);306280 await usingApi(async () => {307 await usingApi(async () => {281 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});308 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});308335309 });336 });310 });337 });311 it('transferFrom burnt token after approve ReFungible', async () => {338 it('transferFrom burnt token after approve ReFungible', async function() {339 await requirePallets(this, [Pallets.ReFungible]);340312 await usingApi(async () => {341 await usingApi(async () => {313 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});342 const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});