浏览代码

update readme; fixes #553

Jordan Sexton 3 年之前
父节点
当前提交
f73814c44a
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      README.md

+ 6 - 3
README.md

@@ -105,18 +105,21 @@ import { useConnection, useWallet } from '@solana/wallet-adapter-react';
 import { Keypair, SystemProgram, Transaction } from '@solana/web3.js';
 import React, { FC, useCallback } from 'react';
 
-export const SendOneLamportToRandomAddress: FC = () => {
+export const SendSOLToRandomAddress: FC = () => {
     const { connection } = useConnection();
     const { publicKey, sendTransaction } = useWallet();
 
     const onClick = useCallback(async () => {
         if (!publicKey) throw new WalletNotConnectedError();
 
+        // 890880 lamports as of 2022-09-01
+        const lamports = await connection.getMinimumBalanceForRentExemption(0);
+
         const transaction = new Transaction().add(
             SystemProgram.transfer({
                 fromPubkey: publicKey,
                 toPubkey: Keypair.generate().publicKey,
-                lamports: 1,
+                lamports,
             })
         );
 
@@ -132,7 +135,7 @@ export const SendOneLamportToRandomAddress: FC = () => {
 
     return (
         <button onClick={onClick} disabled={!publicKey}>
-            Send 1 lamport to a random address!
+            Send SOL to a random address!
         </button>
     );
 };