findSolanaPayTransaction method

Future<TransactionId?> findSolanaPayTransaction({
  1. required Ed25519HDPublicKey reference,
  2. Commitment commitment = Commitment.finalized,
})

Finds the oldest transaction signature referencing a given public key.

Implementation

Future<TransactionId?> findSolanaPayTransaction({
  required Ed25519HDPublicKey reference,
  Commitment commitment = Commitment.finalized,
}) async {
  final signatures = await rpcClient.getSignaturesForAddress(
    reference.toBase58(),
    commitment: commitment,
  );

  if (signatures.isEmpty) return null;

  // TODO(KB): Support cases when there are more than [limit] signatures.

  return signatures.last.signature;
}