difftreelog
Use executeExtrinsic
in: master
3 files changed
tests/src/burnItem.test.tsdiffbeforeafterboth--- a/tests/src/burnItem.test.ts
+++ b/tests/src/burnItem.test.ts
@@ -182,17 +182,16 @@
});
itSub('Zero burn NFT', async ({helper}) => {
- const api = helper.getApi();
const collection = await helper.nft.mintCollection(alice, {name: 'Coll', description: 'Desc', tokenPrefix: 'T'});
const tokenAlice = await collection.mintToken(alice, {Substrate: alice.address});
const tokenBob = await collection.mintToken(alice, {Substrate: bob.address});
// 1. Zero burn of own tokens allowed:
- await helper.signTransaction(alice, api.tx.unique.burnItem(collection.collectionId, tokenAlice.tokenId, 0));
+ await helper.executeExtrinsic(alice, 'api.tx.unique.burnItem', [collection.collectionId, tokenAlice.tokenId, 0]);
// 2. Zero burn of non-owned tokens not allowed:
- await expect(helper.signTransaction(alice, api.tx.unique.burnItem(collection.collectionId, tokenBob.tokenId, 0))).to.be.rejectedWith('common.NoPermission');
+ await expect(helper.executeExtrinsic(alice, 'api.tx.unique.burnItem', [collection.collectionId, tokenBob.tokenId, 0])).to.be.rejectedWith('common.NoPermission');
// 3. Zero burn of non-existing tokens not allowed:
- await expect(helper.signTransaction(alice, api.tx.unique.burnItem(collection.collectionId, 9999, 0))).to.be.rejectedWith('common.TokenNotFound');
+ await expect(helper.executeExtrinsic(alice, 'api.tx.unique.burnItem', [collection.collectionId, 9999, 0])).to.be.rejectedWith('common.TokenNotFound');
expect(await tokenAlice.doesExist()).to.be.true;
expect(await tokenAlice.getOwner()).to.deep.eq({Substrate: alice.address});
expect(await tokenBob.getOwner()).to.deep.eq({Substrate: bob.address});
@@ -211,11 +210,11 @@
await approvedNft.approve(bob, {Substrate: alice.address});
// 1. Zero burnFrom of non-existing tokens not allowed:
- await expect(helper.signTransaction(alice, api.tx.unique.burnFrom(collection.collectionId, {Substrate: bob.address}, 9999, 0))).to.be.rejectedWith('common.ApprovedValueTooLow');
+ await expect(helper.executeExtrinsic(alice, 'api.tx.unique.burnFrom', [collection.collectionId, {Substrate: bob.address}, 9999, 0])).to.be.rejectedWith('common.ApprovedValueTooLow');
// 2. Zero burnFrom of not approved tokens not allowed:
- await expect(helper.signTransaction(alice, api.tx.unique.burnFrom(collection.collectionId, {Substrate: bob.address}, notApprovedNft.tokenId, 0))).to.be.rejectedWith('common.NoPermission');
+ await expect(helper.executeExtrinsic(alice, 'api.tx.unique.burnFrom', [collection.collectionId, {Substrate: bob.address}, notApprovedNft.tokenId, 0])).to.be.rejectedWith('common.NoPermission');
// 3. Zero burnFrom of approved tokens allowed:
- await helper.signTransaction(alice, api.tx.unique.burnFrom(collection.collectionId, {Substrate: bob.address}, approvedNft.tokenId, 0));
+ await helper.executeExtrinsic(alice, 'api.tx.unique.burnFrom', [collection.collectionId, {Substrate: bob.address}, approvedNft.tokenId, 0]);
// 4.1 approvedNft still approved:
expect(await approvedNft.isApproved({Substrate: alice.address})).to.be.true;
tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -193,16 +193,15 @@
});
itSub('Zero transfer NFT', async ({helper}) => {
- const api = helper.getApi();
const collection = await helper.nft.mintCollection(alice, {name: 'Transfer-Neg-3-NFT', description: '', tokenPrefix: 'T'});
const tokenAlice = await collection.mintToken(alice, {Substrate: alice.address});
const tokenBob = await collection.mintToken(alice, {Substrate: bob.address});
// 1. Zero transfer of own tokens allowed:
- await helper.signTransaction(alice, api.tx.unique.transfer({Substrate: bob.address}, collection.collectionId, tokenAlice.tokenId, 0));
+ await helper.executeExtrinsic(alice, 'api.tx.unique.transfer', [{Substrate: bob.address}, collection.collectionId, tokenAlice.tokenId, 0]);
// 2. Zero transfer of non-owned tokens not allowed:
- await expect(helper.signTransaction(alice, api.tx.unique.transfer({Substrate: alice.address}, collection.collectionId, tokenBob.tokenId, 0))).to.be.rejectedWith('common.NoPermission');
+ await expect(helper.executeExtrinsic(alice, 'api.tx.unique.transfer', [{Substrate: alice.address}, collection.collectionId, tokenBob.tokenId, 0])).to.be.rejectedWith('common.NoPermission');
// 3. Zero transfer of non-existing tokens not allowed:
- await expect(helper.signTransaction(alice, api.tx.unique.transfer({Substrate: alice.address}, collection.collectionId, 10, 0))).to.be.rejectedWith('common.TokenNotFound');
+ await expect(helper.executeExtrinsic(alice, 'api.tx.unique.transfer', [{Substrate: alice.address}, collection.collectionId, 10, 0])).to.be.rejectedWith('common.TokenNotFound');
expect(await tokenAlice.getOwner()).to.deep.eq({Substrate: alice.address});
expect(await tokenBob.getOwner()).to.deep.eq({Substrate: bob.address});
// 4. Storage is not corrupted:
tests/src/transferFrom.test.tsdiffbeforeafterboth351 });351 });352352353 itSub('zero transfer NFT', async ({helper}) => {353 itSub('zero transfer NFT', async ({helper}) => {354 const api = helper.getApi();355 const collection = await helper.nft.mintCollection(alice, {name: 'Zero', description: 'Zero transfer', tokenPrefix: 'TF'});354 const collection = await helper.nft.mintCollection(alice, {name: 'Zero', description: 'Zero transfer', tokenPrefix: 'TF'});356 const notApprovedNft = await collection.mintToken(alice, {Substrate: bob.address});355 const notApprovedNft = await collection.mintToken(alice, {Substrate: bob.address});357 const approvedNft = await collection.mintToken(alice, {Substrate: bob.address});356 const approvedNft = await collection.mintToken(alice, {Substrate: bob.address});358 await approvedNft.approve(bob, {Substrate: alice.address});357 await approvedNft.approve(bob, {Substrate: alice.address});359358360 // 1. Cannot zero transferFrom (non-existing token)359 // 1. Cannot zero transferFrom (non-existing token)361 await expect(helper.signTransaction(alice, api.tx.unique.transferFrom({Substrate: bob.address}, {Substrate: alice.address}, collection.collectionId, 9999, 0))).to.be.rejectedWith('common.ApprovedValueTooLow');360 await expect(helper.executeExtrinsic(alice, 'api.tx.unique.transferFrom', [{Substrate: bob.address}, {Substrate: alice.address}, collection.collectionId, 9999, 0])).to.be.rejectedWith('common.ApprovedValueTooLow');362 // 2. Cannot zero transferFrom (not approved token)361 // 2. Cannot zero transferFrom (not approved token)363 await expect(helper.signTransaction(alice, api.tx.unique.transferFrom({Substrate: bob.address}, {Substrate: alice.address}, collection.collectionId, notApprovedNft.tokenId, 0))).to.be.rejectedWith('common.NoPermission');362 await expect(helper.executeExtrinsic(alice, 'api.tx.unique.transferFrom', [{Substrate: bob.address}, {Substrate: alice.address}, collection.collectionId, notApprovedNft.tokenId, 0])).to.be.rejectedWith('common.NoPermission');364 // 3. Can zero transferFrom (approved token):363 // 3. Can zero transferFrom (approved token):365 await helper.signTransaction(alice, api.tx.unique.transferFrom({Substrate: bob.address}, {Substrate: alice.address}, collection.collectionId, approvedNft.tokenId, 0));364 await helper.executeExtrinsic(alice, 'api.tx.unique.transferFrom', [{Substrate: bob.address}, {Substrate: alice.address}, collection.collectionId, approvedNft.tokenId, 0]);366365367 // 4.1 approvedNft still approved:366 // 4.1 approvedNft still approved:368 expect(await approvedNft.isApproved({Substrate: alice.address})).to.be.true;367 expect(await approvedNft.isApproved({Substrate: alice.address})).to.be.true;