Format when passing an argument to motoko function

Thank you so much @peterparker, both your suggestion were right!!

  1. I wrongly assumed that the metadata tag was optional, when actually it is the metadata argument that is optional.

  2. Reworking how to print the error allowed me to receive an error that was solved by adding “agent.fetchRootKey()”, see this post: Fail to verify certificate in development update calls

For people stumbling on this post, the final code looks like this:
api.mintNFT(({“to”: {“address” : “123456789123456789”}, “metadata”: })).then(res => {
console.log(“success”);
resolve(true);
}).catch(reject =>{
console.log(“The error is :”, reject);
});

Much gratitude for your help and the community!

6 Likes