Creating an spl-transfer transaction:

const transaction = new Transaction().add(
    // Pretend this is filled in

const signature = await sendAndConfirmRawTransaction(..)

Assuming I only have access to signature, how can I confirm the transaction's sender, recipient, token transfer amount, and the token's public key?

1 Answer 1


You can use the getTransaction method on the connection class to get details on the transaction with a signature.

async function getTransactionFromSignature() {
  // setup code for example
  const connection = new web3.Connection(
  // end setup code

  const signature =

  const response = await connection.getTransaction(signature);
  const message = response.transaction.message;
  const meta = response.meta;

  console.log(message, meta);

From the meta and/or message you can make the assertions you want.

There's a full example in the Solana Pay code on how we validate transfers for SOL or SPL tokens

Your Answer

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

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