Skip to content

Commit

Permalink
fix(createTransfer): use getLatestBlockhash instead of deprecated `…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
melonges authored Oct 13, 2024
1 parent 3ca5cc8 commit 4384655
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/createTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*/
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4384655

Please sign in to comment.