anza-xyz / solana-pay

A new standard for decentralized payments.
https://solanapay.com
Apache License 2.0
1.32k stars 461 forks source link

Error: Failed to get recent blockhash #242

Open jude98 opened 2 months ago

jude98 commented 2 months ago

I’ve integrated Solana Pay into my application, and it has been working smoothly until recently. However, I’ve started encountering the following error:

Error: failed to get recent blockhash: SolanaJSONRPCError: failed to get recent blockhash: Method not found
    at Connection.getRecentBlockhash

This issue arises when calling the createTransfer method:

 const transaction = await createTransfer(
  connection,
  provider.publicKey,
  {
    recipient,
    amount,
    splToken,
    reference,
  },
  { commitment: "confirmed" }
);

Environment

It appears that getRecentBlockhash has been deprecated, and this method is still being used internally when creating a transfer transaction. This may be leading to compatibility issues, particularly with newer RPC providers like Helius.

Majidrazaee commented 2 months ago

دوست من هم به همین مشکل خوردم از پشتیبانی کمک خواستم

در تاریخ چهارشنبه ۴ سپتامبر ۲۰۲۴،‏ ۰۹:۵۳ Judith George < @.***> نوشت:

I’ve integrated Solana Pay into my application, and it has been working smoothly until recently. However, I’ve started encountering the following error:

Error: failed to get recent blockhash: SolanaJSONRPCError: failed to get recent blockhash: Method not found at Connection.getRecentBlockhash

This issue arises when calling the createTransfer method:

const transaction = await createTransfer( connection, provider.publicKey, { recipient, amount, splToken, reference, }, { commitment: "confirmed" });

Environment

  • Network: Devnet
  • RPC Provider: Helius RPC
  • Commitment Level: confirmed
  • Library: Solana Pay @.***/pay": "^0.2.5")

It appears that getRecentBlockhash has been deprecated, and this method is still being used internally when creating a transfer transaction. This may be leading to compatibility issues, particularly with newer RPC providers like Helius.

— Reply to this email directly, view it on GitHub https://github.com/anza-xyz/solana-pay/issues/242, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXBABQU2I3LHCFAKAQZO25DZU2RNRAVCNFSM6AAAAABNTSJED6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGUYDINBRGM2DSNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

0x2539 commented 2 months ago

Hey @jude98 I've added a PR that fixes this issue, if you need this urgently, change the version in your package.json to: "@solana/pay": "https://gitpkg.vercel.app/0x2539/solana-pay/core?fix/latest-blockhash-build"