--- a/pallets/nonfungible/src/erc.rs +++ b/pallets/nonfungible/src/erc.rs @@ -520,8 +520,8 @@ /// @param tokenId The NFT to find the approved address for /// @return The approved address for this NFT, or the zero address if there is none fn get_approved(&self, token_id: U256) -> Result
{ - let token = token_id.try_into()?; - let operator = >::get_allowance(self, token).map_err(dispatch_to_evm::)?; + let token_id = token_id.try_into()?; + let operator = >::get_allowance(self, token_id).map_err(dispatch_to_evm::)?; Ok(if let Some(operator) = operator { *operator.as_eth() } else { --- a/pallets/nonfungible/src/lib.rs +++ b/pallets/nonfungible/src/lib.rs @@ -1085,13 +1085,13 @@ pub fn get_allowance( collection: &NonfungibleHandle, - token: TokenId, + token_id: TokenId, ) -> Result, DispatchError> { ensure!( - >::get((collection.id, token)).is_some(), + >::get((collection.id, token_id)).is_some(), >::TokenNotFound ); - Ok(>::get((collection.id, token))) + Ok(>::get((collection.id, token_id))) } /// Set allowance for the spender to `transfer` or `burn` sender's token. --- 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'); } {