import { isSignature } from '@solana/keys';
if (isSignature(signature)) {
// At this point, `signature` has been refined to a
// `Signature` that can be used with the RPC.
const {
value: [status],
} = await rpc.getSignatureStatuses([signature]).send();
setSignatureStatus(status);
} else {
setError(`${signature} is not a transaction signature`);
}
A type guard that accepts a string as input. It will both return
trueif the string conforms to the Signature type and will refine the type for use in your program.