git.delta.rocks / unique-network / refs/commits / 5401624d5b22

difftreelog

change signAndSend to signTransaction

rkv2022-09-09parent: #a041946.patch.diff
in: master

1 file changed

modifiedtests/src/approve.test.tsdiffbeforeafterboth
84 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});84 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
85 await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});85 await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
86 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;86 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
87 await helper.api?.tx.unique.approve({Substrate: bob.address}, collectionId, tokenId, 0).signAndSend(alice);87 await helper.signTransaction(alice, helper.api?.tx.unique.approve({Substrate: bob.address}, collectionId, tokenId, 0));
88 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;88 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
89 });89 });
90 });90 });
262 await usingPlaygrounds(async (helper) => {262 await usingPlaygrounds(async (helper) => {
263 const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});263 const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
264 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});264 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});
265 await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});265 await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
266 const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});266 const before = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
267 await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 100n);267 await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 100n);
268 const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});268 const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
322 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});322 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
323 await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});323 await helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
324 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;324 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
325 await helper.api?.tx.unique.approve({Substrate: bob.address}, collectionId, tokenId, 0).signAndSend(alice);325 await helper.signTransaction(alice, helper.api?.tx.unique.approve({Substrate: bob.address}, collectionId, tokenId, 0));
326 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;326 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
327 const transferTokenFromTx = async () => helper.nft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: bob.address});327 const transferTokenFromTx = async () => helper.nft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: bob.address});
328 await expect(transferTokenFromTx()).to.be.rejected;328 await expect(transferTokenFromTx()).to.be.rejected;
380 await usingPlaygrounds(async (helper) => {380 await usingPlaygrounds(async (helper) => {
381 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});381 const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
382 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});382 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
383 await helper.api?.tx.unique.approve({Substrate: charlie.address}, collectionId, tokenId, 2).signAndSend(bob);383 const approveTx = async () => helper.signTransaction(bob, helper.api?.tx.unique.approve({Substrate: charlie.address}, collectionId, tokenId, 2));
384 await expect(approveTx()).to.be.rejected;
384 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.false;385 expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.false;
385 });386 });
386 });387 });