@@ -199,41 +199,76 @@ function NonceInfo({ address }: { address: string }) {
199199
200200``` tsx
201201import type { TransactionInstructionInput } from " @solana/client" ;
202- import { useTransactionPool } from " @solana/react-hooks" ;
202+ import { useTransactionPool , useWalletSession } from " @solana/react-hooks" ;
203203
204204function TransactionFlow({ ix }: { ix: TransactionInstructionInput }) {
205- const pool = useTransactionPool ();
205+ const session = useWalletSession ();
206+ const {
207+ addInstruction,
208+ prepareAndSend,
209+ isSending,
210+ sendSignature,
211+ sendError,
212+ latestBlockhash,
213+ } = useTransactionPool ();
214+
206215 return (
207216 <div >
208- <button onClick = { () => pool .addInstruction (ix )} >Add instruction</button >
209- <button disabled = { pool .isSending } onClick = { () => pool .prepareAndSend ()} >
210- { pool .isSending ? " Sending…" : " Prepare & Send" }
217+ <button onClick = { () => addInstruction (ix )} >Add instruction</button >
218+ <button
219+ disabled = { isSending || ! session }
220+ onClick = { () => prepareAndSend ({ authority: session })}
221+ >
222+ { isSending ? " Sending…" : " Prepare & Send" }
211223 </button >
212- <p >Blockhash: { pool .latestBlockhash .blockhash ?? " loading…" } </p >
224+ <p >Blockhash: { latestBlockhash .blockhash ?? " loading…" } </p >
225+ { sendSignature ? <p >Signature: { sendSignature } </p > : null }
226+ { sendError ? <p role = " alert" >{ String (sendError )} </p > : null }
213227 </div >
214228 );
215229}
216230```
217231
232+ ** Available properties:**
233+ - ` addInstruction(ix) ` / ` addInstructions(ixs) ` — queue instructions
234+ - ` removeInstruction(index) ` / ` clearInstructions() ` / ` replaceInstructions(ixs) ` — manage queue
235+ - ` instructions ` — current instruction queue
236+ - ` prepare(opts) ` / ` prepareAndSend(opts) ` — build and optionally send
237+ - ` send(opts) ` / ` sign(opts) ` — send or sign prepared transaction
238+ - ` isPreparing ` / ` prepareStatus ` / ` prepareError ` — prepare state
239+ - ` isSending ` / ` sendStatus ` / ` sendError ` / ` sendSignature ` — send state
240+ - ` latestBlockhash ` — current blockhash for lifetime
241+ - ` prepared ` / ` toWire() ` — access prepared transaction
242+ - ` reset() ` — clear all state
243+
218244### Simple mutation helper (when you already have instructions)
219245
220246``` tsx
221247import { useSendTransaction } from " @solana/react-hooks" ;
222248
223249function SendPrepared({ instructions }) {
224- const { send, isSending, signature, error } = useSendTransaction ();
250+ const { send, isSending, status, signature, error } = useSendTransaction ();
225251 return (
226252 <div >
227253 <button disabled = { isSending } onClick = { () => send ({ instructions })} >
228254 { isSending ? " Submitting…" : " Send transaction" }
229255 </button >
256+ <p >Status: { status } </p >
230257 { signature ? <p >Signature: { signature } </p > : null }
231258 { error ? <p role = " alert" >{ String (error )} </p > : null }
232259 </div >
233260 );
234261}
235262```
236263
264+ > ** Note:** This hook automatically uses the connected wallet session — no need to pass ` authority ` explicitly.
265+
266+ ** Available properties:**
267+ - ` send(request, opts?) ` — build and send transaction
268+ - ` sendPrepared(prepared, opts?) ` — send already-prepared transaction
269+ - ` isSending ` / ` status ` / ` signature ` / ` error ` — transaction state
270+ - ` reset() ` — clear state for new transaction
271+
237272### Track confirmations for a signature
238273
239274``` tsx
0 commit comments