From 438465507efa6abd67f5d13af95b29a388604613 Mon Sep 17 00:00:00 2001 From: melonges Date: Sun, 13 Oct 2024 17:22:33 +0300 Subject: [PATCH] fix(createTransfer): use `getLatestBlockhash` instead of deprecated `getRecentBlockhash` this method [has been removed](https://solana.com/docs/rpc/deprecated/getrecentblockhash) from the new version of Solana RPC and is no longer available --- core/src/createTransfer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/createTransfer.ts b/core/src/createTransfer.ts index 27c518b7..2df459f4 100644 --- a/core/src/createTransfer.ts +++ b/core/src/createTransfer.ts @@ -34,7 +34,7 @@ export interface CreateTransferFields { * @param connection - A connection to the cluster. * @param sender - Account that will send the transfer. * @param fields - Fields of a Solana Pay transfer request URL. - * @param options - Options for `getRecentBlockhash`. + * @param options - Options for `getLatestBlockhash`. * * @throws {CreateTransferError} */ @@ -70,7 +70,7 @@ export async function createTransfer( // Create the transaction const transaction = new Transaction(); transaction.feePayer = sender; - transaction.recentBlockhash = (await connection.getRecentBlockhash(commitment)).blockhash; + transaction.recentBlockhash = (await connection.getLatestBlockhash(commitment)).blockhash; // If a memo is provided, add it to the transaction before adding the transfer instruction if (memo != null) {