difftreelog
fix PR
in: master
3 files changed
pallets/nonfungible/src/erc.rsdiffbeforeafterboth520 /// @param tokenId The NFT to find the approved address for520 /// @param tokenId The NFT to find the approved address for521 /// @return The approved address for this NFT, or the zero address if there is none521 /// @return The approved address for this NFT, or the zero address if there is none522 fn get_approved(&self, token_id: U256) -> Result<Address> {522 fn get_approved(&self, token_id: U256) -> Result<Address> {523 let token = token_id.try_into()?;523 let token_id = token_id.try_into()?;524 let operator = <Pallet<T>>::get_allowance(self, token).map_err(dispatch_to_evm::<T>)?;524 let operator = <Pallet<T>>::get_allowance(self, token_id).map_err(dispatch_to_evm::<T>)?;525 Ok(if let Some(operator) = operator {525 Ok(if let Some(operator) = operator {526 *operator.as_eth()526 *operator.as_eth()527 } else {527 } else {pallets/nonfungible/src/lib.rsdiffbeforeafterboth108510851086 pub fn get_allowance(1086 pub fn get_allowance(1087 collection: &NonfungibleHandle<T>,1087 collection: &NonfungibleHandle<T>,1088 token: TokenId,1088 token_id: TokenId,1089 ) -> Result<Option<T::CrossAccountId>, DispatchError> {1089 ) -> Result<Option<T::CrossAccountId>, DispatchError> {1090 ensure!(1090 ensure!(1091 <TokenData<T>>::get((collection.id, token)).is_some(),1091 <TokenData<T>>::get((collection.id, token_id)).is_some(),1092 <CommonError<T>>::TokenNotFound1092 <CommonError<T>>::TokenNotFound1093 );1093 );1094 Ok(<Allowance<T>>::get((collection.id, token)))1094 Ok(<Allowance<T>>::get((collection.id, token_id)))1095 }1095 }109610961097 /// Set allowance for the spender to `transfer` or `burn` sender's token.1097 /// Set allowance for the spender to `transfer` or `burn` sender's token.tests/src/eth/nonFungible.test.tsdiffbeforeafterboth230 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);230 const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);231231232 {232 {233 const badTokenId = 1234567;233 const badTokenId = await contract.methods.nextTokenId().call() + 1;234 await expect(contract.methods.getApproved(badTokenId).call()).to.be.rejectedWith('revert TokenNotFound');234 await expect(contract.methods.getApproved(badTokenId).call()).to.be.rejectedWith('revert TokenNotFound');235 }235 }236 {236 {