Since createMetadataDetails and mintToken functions are asynchronous, the mintToken function finalizes before the createMetadataDetails. Therefore, creating an Invalid Owner error.
mintToken must be called after createMetadataDetails is finalized.
The below code must fix the issue:
createMetadataDetails().
then(() => {
console.log('successfully crated our metadata accounts')
mintToken()
.then(() => console.log("Successfully minted our Gold Token"))
.catch(err => console.error("error minting the tokens", err))
})
.catch(err => console.error("error minting the tokens", err))
Since createMetadataDetails and mintToken functions are asynchronous, the mintToken function finalizes before the createMetadataDetails. Therefore, creating an Invalid Owner error.
mintToken must be called after createMetadataDetails is finalized.
The below code must fix the issue:
createMetadataDetails().
then(() => {
console.log('successfully crated our metadata accounts')
mintToken()
.then(() => console.log("Successfully minted our Gold Token"))
.catch(err => console.error("error minting the tokens", err))
})
.catch(err => console.error("error minting the tokens", err))