1

safeTransferFrom function doesn't return any value:

function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId
) public virtual override {
    safeTransferFrom(from, to, tokenId, "");
}

How can I check that it worked correctly before proceeding with another task?

1 Answer 1

1

By listening to Transfer(from, to, tokenId) event.

https://docs.openzeppelin.com/contracts/2.x/api/token/erc721#IERC721-Transfer-address-address-uint256-

Or

contract.safeTransferFrom(params
  .then(transaction => {
    console.log(`Transaction hash: ${transaction.hash}`);
    return transaction.wait();
  })
  .then(receipt => {
    console.log(`Transaction mined in block ${receipt.blockNumber}`);
  })
  .catch(console.error);
`` 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.