Browse Source

Adds confirmationStrategy to confirmTransaction

Update SendOneLamportToRandomAddress to use the new confirmationStrategy in confirmTransaction. This replaces the current deprecated function call.
Sven Anders Robbestad 3 years ago
parent
commit
68eb962a28
1 changed files with 7 additions and 1 deletions
  1. 7 1
      README.md

+ 7 - 1
README.md

@@ -121,7 +121,13 @@ export const SendOneLamportToRandomAddress: FC = () => {
 
         const signature = await sendTransaction(transaction, connection);
 
-        await connection.confirmTransaction(signature, 'processed');
+        const latestBlockHash = await connection.getLatestBlockhash();
+
+        await connection.confirmTransaction({
+                blockhash: latestBlockHash.blockhash,
+                lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
+                signature: signature,
+        });
     }, [publicKey, sendTransaction, connection]);
 
     return (