When I try to run the pin function that takes an integer, i keep getting this error
invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
frontend code:
const abi = [
"function pinGem(uint256 tokenId, string memory latitude, string memory longitude) public"
];
const contract = new ethers.Contract(contractAddress, abi, signer);
try {
const latitude = pinnedPosition.lat.toString();
const longitude = pinnedPosition.lng.toString();
const tx = await contract.pinGem(nft.tokenId, latitude, longitude);
contract:
i tried using uint256, but kept getting the same error then switched to strings and still got the same error.
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
struct Gem {
uint256 id;
string latitude;
string longitude;
}
function pin(uint256 tokenId, string memory latitude, string memory longitude) public {
require(ownerOf(tokenId) != address(0), "Token ID does not exist");
pins[tokenId] = Pin(tokenId, latitude, longitude);
}