difftreelog
Add reaffirm approved address test
in: master
1 file changed
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth339 expect(await helper.nft.getTokenOwner(collection.collectionId, token2.tokenId)).to.deep.eq({Ethereum: receiverEth.toLowerCase()});339 expect(await helper.nft.getTokenOwner(collection.collectionId, token2.tokenId)).to.deep.eq({Ethereum: receiverEth.toLowerCase()});340 });340 });341342 itEth('Can reaffirm approved address', async ({helper}) => {343 const owner = await helper.eth.createAccountWithBalance(donor, 100n);344 const [receiver1, receiver2] = await helper.arrange.createAccounts([100n, 100n], donor);345 const receiver1Cross = helper.ethCrossAccount.fromKeyringPair(receiver1);346 const receiver2Cross = helper.ethCrossAccount.fromKeyringPair(receiver2);347 const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});348 const token1 = await collection.mintToken(minter, {Ethereum: owner});349 const token2 = await collection.mintToken(minter, {Ethereum: owner});350 const collectionEvm = helper.ethNativeContract.collection(helper.ethAddress.fromCollectionId(collection.collectionId), 'nft');351352 // Can approve and reaffirm approved address:353 await collectionEvm.methods.approveCross(receiver1Cross, token1.tokenId).send({from: owner});354 await collectionEvm.methods.approveCross(receiver2Cross, token1.tokenId).send({from: owner});355356 // receiver1 cannot transferFrom:357 await expect(helper.nft.transferTokenFrom(receiver1, collection.collectionId, token1.tokenId, {Ethereum: owner}, {Substrate: receiver1.address})).to.be.rejected;358 // receiver2 can transferFrom:359 await helper.nft.transferTokenFrom(receiver2, collection.collectionId, token1.tokenId, {Ethereum: owner}, {Substrate: receiver2.address});360361 // can set approved address to zero address:362 await collectionEvm.methods.approveCross(receiver1Cross, token2.tokenId).send({from: owner});363364 // FIXME how to remove approval?:365 await collectionEvm.methods.approveCross({eth: '0x0000000000000000000000000000000000000000', sub: '0'}, token2.tokenId).call({from: owner});366 await collectionEvm.methods.approve('0x0000000000000000000000000000000000000000', token2.tokenId).call({from: owner});367368 // receiver1 cannot transfer token anymore:369 await expect(helper.nft.transferTokenFrom(receiver1, collection.collectionId, token2.tokenId, {Ethereum: owner}, {Substrate: receiver1.address})).to.be.rejected;370 });341371342 itEth('Can perform transferFrom()', async ({helper}) => {372 itEth('Can perform transferFrom()', async ({helper}) => {343 const owner = await helper.eth.createAccountWithBalance(donor);373 const owner = await helper.eth.createAccountWithBalance(donor);