Эх сурвалжийг харах

update `AnchorWallet` interface with versioned txs (#750)

* update AnchorWallet interface with versioned txs

* add changeset

---------

Co-authored-by: Jordan Sexton <jordan@jordansexton.com>
Matthew Callens 2 жил өмнө
parent
commit
61d62efa

+ 5 - 0
.changeset/quiet-eagles-rhyme.md

@@ -0,0 +1,5 @@
+---
+'@solana/wallet-adapter-react': patch
+---
+
+Add VersionedTransaction support to AnchorWallet interface and useAnchorWallet hook

+ 3 - 3
packages/core/react/src/useAnchorWallet.ts

@@ -1,11 +1,11 @@
-import { type PublicKey, type Transaction } from '@solana/web3.js';
+import { type PublicKey, type Transaction, type VersionedTransaction } from '@solana/web3.js';
 import { useMemo } from 'react';
 import { useWallet } from './useWallet.js';
 
 export interface AnchorWallet {
     publicKey: PublicKey;
-    signTransaction(transaction: Transaction): Promise<Transaction>;
-    signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
+    signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T>;
+    signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
 }
 
 export function useAnchorWallet(): AnchorWallet | undefined {