From af2257a8e26fc99ff615ebefbbb9c4d15637bc93 Mon Sep 17 00:00:00 2001 From: Jordan Sexton Date: Tue, 13 Sep 2022 15:54:10 -0500 Subject: [PATCH] add type guard for versioned txs --- packages/core/base/src/types.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/base/src/types.ts b/packages/core/base/src/types.ts index 65247a098..24aa5b327 100644 --- a/packages/core/base/src/types.ts +++ b/packages/core/base/src/types.ts @@ -12,3 +12,9 @@ export enum WalletAdapterNetwork { export type TransactionOrVersionedTransaction | null> = SupportedTransactionVersions extends null ? Transaction : Transaction | VersionedTransaction; + +export function isVersionedTransaction( + transaction: Transaction | VersionedTransaction +): transaction is VersionedTransaction { + return 'message' in transaction; +}