Skip to content

getRecentBlockhash RPC method is deprecated in Solana 1.9+, recommend switching to getLatestBlockhash #111

@itflyll

Description

@itflyll

Hi Solana-Swift Team,

I noticed that the JSONRPCAPIClient.getRecentBlockhash method in this library still uses the getRecentBlockhash RPC method:

public func getRecentBlockhash(commitment: Commitment? = nil) async throws -> String { let result: Rpc<Fee> = try await get(method: "getRecentBlockhash", params: [RequestConfiguration(commitment: commitment)]) guard let blockhash = result.value.blockhash else { throw APIClientError.blockhashNotFound } return blockhash }

However, according to the Solana official documentation:

The getRecentBlockhash RPC method is only available for solana-core v1.8 and below. For solana-core v1.9 and later, please use getLatestBlockhash.

This means that projects using newer Solana nodes may encounter deprecated RPC calls or unexpected failures.

It would be great if the library could:

Update the method to use getLatestBlockhash for Solana v1.9+ nodes.

Optionally provide backward compatibility for v1.8 and below, perhaps via a fallback mechanism.

This will ensure the library works correctly with the current Solana versions and prevents deprecation issues.

Thanks for your attention and for maintaining this library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions