safeTransferFrom is not a function

I am doing transfers from a dApp built with hardhat, ethers and React. it works perfectly using:

    async function transfer() {

      const [accountUser] = await window.ethereum.request({ method: 'eth_requestAccounts' });
      const provider = new ethers.providers.Web3Provider(window.ethereum);
      const signer = provider.getSigner();
      const contract = new ethers.Contract(nftContract, NFT.abi, signer);
      let transaction; 
      try {
        transaction = await contract.transferFrom(accountUser, newOwner, idNFT);
...

But if I use the function safeTransferFrom I get the error ``` safeTransferFrom is not a function``.
Why is that? Evidently the contract has in its ABI this standard function.


    async function transfer() {

      const [accountUser] = await window.ethereum.request({ method: 'eth_requestAccounts' });
      const provider = new ethers.providers.Web3Provider(window.ethereum);
      const signer = provider.getSigner();
      const contract = new ethers.Contract(nftContract, NFT.abi, signer);
      let transaction; 
      try {
        transaction = await contract.safeTransferFrom(accountUser, newOwner, idNFT);

Well look at your code. Is safeTransferFrom a public function or even there? Is it public and NOT from any imports/interfaces?

ABI of contract:

{
      "inputs": [
        {
          "internalType": "address",
          "name": "from",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "to",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "tokenId",
          "type": "uint256"
        }
      ],
      "name": "safeTransferFrom",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    }

@Team_X
Both transferFrom and safeTransferFrom functions are inherited from the same contract. It makes no sense for one to fail and the other to work.

Try this:

await contract['safeTransferFrom(address,address,uint256)'](accountUser, newOwner, idNFT)

And FYI, https://github.com/ethers-io/ethers.js/issues/1160

Wow, It seems that we put the interface of the function in square brackets. Is this what we do @swkim109 ? It works perfectly thank you very much. I will keep this in mind in future functions with duplicate name.