0

After I create my own token program I am thne minting some supply into another tokenaccount.

I notice the mintTo is a void function, is there any easy way to get the associated transaction signature ?

const token = new splToken.Token(
      connection,
      new web3.PublicKey(token_type.token_address),
      splToken.TOKEN_PROGRAM_ID,
      mint_authority_wallet
    );

const destinationTokenAccount = await token.getOrCreateAssociatedAccountInfo(
      new web3.PublicKey(to_public_address)
    );


console.log("destinationTokenAccount>>", destinationTokenAccount);

const test = await token.mintTo(
      destinationTokenAccount.address,
      mint_authority_wallet.publicKey,
      [],
      100
    );

console.log("test>>",test)
1977
  • 2,580
  • 6
  • 26
  • 37

1 Answers1

0

The fix for this is quite simple: you just need to return the result from sendAndConfirmTransaction. Check out the source code at https://github.com/solana-labs/solana-program-library/blob/ab05e4e597c0b538d855c18da3850df84ad6a49a/token/js/client/token.js#L1027

You could always hack your version to return the signature. Better yet, PRs are always welcome!

Jon C
  • 7,019
  • 10
  • 17
  • ah I see, so instead of calling mintTo, I just instead put together my own ` await sendAndConfirmTransaction('MintTo'..(` right ? btw what is best forum for Solana questions ? – 1977 Feb 02 '22 at 09:59
  • Yep that'l do it, but as I mentioned, PRs are always welcome! Otherwise, the other good place to ask tech questions is in the #developer-support channel in the Solana Discord https://discord.gg/solana – Jon C Feb 02 '22 at 10:29