浏览代码

Adds confirmationStrategy to confirmTransaction

Update SendOneLamportToRandomAddress to use the new confirmationStrategy in confirmTransaction. This replaces the current deprecated function call.
Sven Anders Robbestad 3 年之前
父节点
当前提交
68eb962a28
共有 1 个文件被更改,包括 7 次插入1 次删除
  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 (