How to transfer nft token from one wallet to another wallet?

I have been using this contract

  function transfer(
   address from,

    address to,

    uint256 tokenId

) external payable {

    _transfer(from, to, tokenId);

}

and this script to run

const hre = require("hardhat");

async function main() {

  const NFT = await hre.ethers.getContractFactory("TorNFT");  

  const WALLET_ADDRESS = "0x6ECE888Cd5968cb8894C988CE6a7369f4eD74feC";

  const RECIEVER_ADDRESS = "0x5C58db838e0f7db34d9566a95EE4D8Cde0e10160";

  const CONTRACT_ADDRESS = "0xA564F1fC08571C77858ff8dE62075E70094a4789";

  const TOKENID = "1";

  const contract = NFT.attach(RECIEVER_ADDRESS,);

  const result = await contract.transfer(WALLET_ADDRESS,RECIEVER_ADDRESS, TOKENID);

  console.log("NFT transferred:", result);  

  

}

main().then(() => process.exit(0)).catch(error => {

  console.error(error);

  process.exit(1);

});

Please help me out anyone!!

I think this should use the contract address because you are attaching an implementation to an address const contract = NFT.attach(CONTRACT_ADDRESS,);

Please try that and include the error message you are getting if you get any this time.

Thanks for the reply ...Actually there is no error but the nft token which i have minted to a specific contract cant be transferred to another wallet.

please help me with a the code to work this out of nft transfer..

This was the log i am getting after this execution.

{ hash:
   '0xf6e13fe498ebf333ea9be9d1aeea7163d4722a1bca201f9b1c91d0d0372182b1',
  type: 0,
  accessList: null,
  blockHash: null,
  blockNumber: null,
  transactionIndex: null,
  confirmations: 0,
  from: '0x6ECE888Cd5968cb8894C988CE6a7369f4eD74feC',
  gasPrice: BigNumber { _hex: '0x01dcd65000', _isBigNumber: true },
  gasLimit: BigNumber { _hex: '0x1127b8', _isBigNumber: true },
  to: '0xA564F1fC08571C77858ff8dE62075E70094a4789',
  value: BigNumber { _hex: '0x00', _isBigNumber: true },
  nonce: 45,
  data:
   '0x23b872dd000000000000000000000000b705730cdddb2af877a92b8d21bee30a61c0a416000000000000000000000000cc3677ae33d235b21d7388490aa07d4fb98ad0d30000000000000000000000000000000000000000000000000000000000000001',
  r:
   '0x5eea9093b529713920eb70c30e5f02f8c03e31d3b2c049c9b510a765b864f0ef',
  s:
   '0x77ab09a3202a36f32ce1968127d4b298eca196cd1cef7963315610046cdffa1e',
  v: 160037,
  creates: null,
  chainId: 80001,
  wait: [Function] }

Help me were i could find to transfer nft from one wallet to other.

This was the log I'm getting when I started executing the contract I don't know whether this is the correct way to transfer a NFT from one wallet to other.. If not please help me where I can find to solve this problem

{ hash:
   '0xf6e13fe498ebf333ea9be9d1aeea7163d4722a1bca201f9b1c91d0d0372182b1',
  type: 0,
  accessList: null,
  blockHash: null,
  blockNumber: null,
  transactionIndex: null,
  confirmations: 0,
  from: '0x6ECE888Cd5968cb8894C988CE6a7369f4eD74feC',
  gasPrice: BigNumber { _hex: '0x01dcd65000', _isBigNumber: true },
  gasLimit: BigNumber { _hex: '0x1127b8', _isBigNumber: true },
  to: '0xA564F1fC08571C77858ff8dE62075E70094a4789',
  value: BigNumber { _hex: '0x00', _isBigNumber: true },
  nonce: 45,
  data:
   '0x23b872dd000000000000000000000000b705730cdddb2af877a92b8d21bee30a61c0a416000000000000000000000000cc3677ae33d235b21d7388490aa07d4fb98ad0d30000000000000000000000000000000000000000000000000000000000000001',
  r:
   '0x5eea9093b529713920eb70c30e5f02f8c03e31d3b2c049c9b510a765b864f0ef',
  s:
   '0x77ab09a3202a36f32ce1968127d4b298eca196cd1cef7963315610046cdffa1e',
  v: 160037,
  creates: null,
  chainId: 80001,
  wait: [Function] }```

just replace your above code "const result" one with this code and it will work 100%.... thank me later!!!

const result = await contract.transfer(CONTRACT_ADDRESS,RECIEVER_ADDRESS, TOKENID);