I'm trying to transfer an NFT, that I just minted to someone without them paying for it (just like an exchange). Here is the function I created on smartpy:
@sp.entry_point
def transferTest(self, params):
sp.verify(self.data.data[params.token_id].collectable, "NotCollectable")
sp.verify(self.data.data[params.token_id].author != sp.sender, "SenderNotAuthor")
self.data.data[params.token_id].collectable = True
self.data.data[params.token_id].holder = sp.sender
The code in the test function:
marketplace.transferTest(token_id=1).run(sender=elon.address)
Here is the complete smart contract: https://legacy.smartpy.io/ide?cid=QmSGKqymMBSLHADF5GC9nzqSNikwuFYcT2ZUwjaTzsyxWP&k=893cdae17d61921e246b
On smartpy everything works fine, now when I want to call the function in React JS:
export const transferTokens = ({ Tezos, id, to }) => {
return async (dispatch) => {
try {
const contract = await Tezos.wallet.at(config.contractAddress);
const operation = await contract.methods.transferTest(id)
.send({ sender: to });
await operation.confirmation();
dispatch(fetchData());
} catch (e) {
console.log(e);
}
};
};
I get this error:
{
"error":[
0:{
"errors":[...]
"errorDetails":"Error occurred during estimation"
"name":"TezosOperationError"
"id":"proto.016-PtMumbai.michelson_v1.scri..."
"kind":"temporary"
"message":"SenderNotAuthor"
"isError":true
}
1:{
"errors":[...]
"errorDetails":"Error occurred during estimation"
"name":"TezosOperationError"
"id":"proto.016-PtMumbai.michelson_v1.scri..."
"kind":"temporary"
"message":"SenderNotAuthor"
"isError":true
}
]
"contents":undefined
}
I hope you could help me! THANKS