diff --git a/src/components/RequestAirdrop.tsx b/src/components/RequestAirdrop.tsx index 686b979b7..ac45e9773 100644 --- a/src/components/RequestAirdrop.tsx +++ b/src/components/RequestAirdrop.tsx @@ -19,12 +19,13 @@ export const RequestAirdrop: FC = () => { let signature: TransactionSignature = ''; try { - signature = await connection.requestAirdrop(publicKey, LAMPORTS_PER_SOL); - - // Get the lates block hash to use on our transaction and confirmation - let latestBlockhash = await connection.getLatestBlockhash() - await connection.confirmTransaction({ signature, ...latestBlockhash }, 'confirmed'); - + const signature = await connection.requestAirdrop(publicKey, LAMPORTS_PER_SOL); + const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(); + await connection.confirmTransaction({ + blockhash, + lastValidBlockHeight, + signature + }); notify({ type: 'success', message: 'Airdrop successful!', txid: signature }); getUserSOLBalance(publicKey, connection); diff --git a/src/components/SendTransaction.tsx b/src/components/SendTransaction.tsx index 5e6aa10d6..d026f3922 100644 --- a/src/components/SendTransaction.tsx +++ b/src/components/SendTransaction.tsx @@ -45,7 +45,13 @@ export const SendTransaction: FC = () => { // Send transaction and await for signature await connection.confirmTransaction({ signature, ...latestBlockhash }, 'confirmed'); - console.log(signature); + const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(); + await connection.confirmTransaction({ + blockhash, + lastValidBlockHeight, + signature + }); + console.log('Transaction Signature:', signature); notify({ type: 'success', message: 'Transaction successful!', txid: signature }); } catch (error: any) { notify({ type: 'error', message: `Transaction failed!`, description: error?.message, txid: signature }); @@ -66,11 +72,11 @@ export const SendTransaction: FC = () => {