git.delta.rocks / unique-network / refs/commits / a041946b9df3

difftreelog

approve fixes

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

1 file changed

modifiedtests/src/approve.test.tsdiffbeforeafterboth
73 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});73 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
74 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});74 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
75 const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});75 const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
76 expect(amount).to.be.equal(BigInt(100));76 expect(amount).to.be.equal(BigInt(1));
77 });77 });
78 });78 });
7979
110 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});110 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
111 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});111 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
112 const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});112 const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
113 expect(amountBefore).to.be.equal(BigInt(100));113 expect(amountBefore).to.be.equal(BigInt(1));
114114
115 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);115 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
116 const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});116 const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
163 await usingPlaygrounds(async (helper) => {163 await usingPlaygrounds(async (helper) => {
164 const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});164 const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
165 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});165 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: bob.address, pieces: 100n});
166 await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});166 await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address}, 100n);
167 const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, {Substrate: bob.address});167 const amount = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: charlie.address}, {Substrate: bob.address});
168 expect(amount).to.be.equal(BigInt(100));168 expect(amount).to.be.equal(BigInt(100n));
169 });169 });
170 });170 });
171});171});
353 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});353 const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
354 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});354 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address});
355 const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});355 const amountBefore = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
356 expect(amountBefore).to.be.equal(BigInt(100));356 expect(amountBefore).to.be.equal(BigInt(1));
357357
358 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);358 await helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 0n);
359 const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});359 const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});