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.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -1085,13 +1085,13 @@
pub fn get_allowance(
collection: &NonfungibleHandle<T>,
- token: TokenId,
+ token_id: TokenId,
) -> Result<Option<T::CrossAccountId>, DispatchError> {
ensure!(
- <TokenData<T>>::get((collection.id, token)).is_some(),
+ <TokenData<T>>::get((collection.id, token_id)).is_some(),
<CommonError<T>>::TokenNotFound
);
- Ok(<Allowance<T>>::get((collection.id, token)))
+ Ok(<Allowance<T>>::get((collection.id, token_id)))
}
/// Set allowance for the spender to `transfer` or `burn` sender's token.
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -230,7 +230,7 @@
const contract = await helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
{
- const badTokenId = 1234567;
+ const badTokenId = await contract.methods.nextTokenId().call() + 1;
await expect(contract.methods.getApproved(badTokenId).call()).to.be.rejectedWith('revert TokenNotFound');
}
{