Brings the v2 line up to parity with v1.27.0. No module-path changes since v2.3.0, and no new breaking changes: v2 still differs from v1 only by the changes listed under "Staying on v1?" below.
Install
go get github.com/solana-foundation/solana-go/v2@v2.4.0
What's changed
Features
- Lifetime-aware transaction confirmation: new
confirmationpackage, used byrpc/sendAndConfirmTransaction(#526) - Transaction introspection package (#523)
- p-token (SIMD-0266) and missing SPL Token instructions (#366)
- Caller-supplied v1 sanitize limits (SIMD-0596) (#517)
GetAccountInfoMaybefor optional account lookups (#473)GetVatActiveSetRankMap(#536)blockRewardAmounton inflation rewards and theBlockRevenueSharingreward type (#534)- Exported
jsonrpc.UseFixedID(#527) - ws:
WaitSubscribed, and subscriptions that share a server id no longer overwrite each other (#525)
Fixes
- message: honor resolved lookups in
checkPreconditions(#522) - token-2022: send
num_token_accountsinWithdrawWithheldTokensFromAccounts(#518) - transaction: keep read-only signers after merged writable signers (#519)
- vote: bound decoded counts against remaining data (#529)
- ws: return
json2.ErrNullResultfor notifications without a result instead of panicking (#531) - jsonrpc: match integer ids by value in
RPCResponses.GetByID(#532)
Behavior changes in ws (#525)
- After a subscription is closed,
Recvfirst returns any notifications that were already buffered, then returns an error that matchesws.ErrSubscriptionClosedviaerrors.Isand wraps the underlying cause. - Subscribing on a client whose read loop has already exited now fails immediately instead of blocking forever.
Note on lifetime-aware confirmation (#526)
rpc/sendAndConfirmTransaction searches transaction history only when the status cache can no longer cover the transaction. If the node runs without --enable-rpc-transaction-history (RPC error -32011), it returns an error that wraps both sendAndConfirmTransaction.ErrTransactionHistoryNotAvailable and the original *jsonrpc.RPCError. On v2 the signature strategy reads the v2 ws.SignatureResult shape (Value.IsReceived / Value.Processed).
Staying on v1?
The v1 line continues from main (github.com/gagliardetto/solana-go, latest v1.27.0) and carries everything above. v2 differs from v1 only by the module path and the breaking changes listed in the v2.0.0 release notes, plus the VoteAccountsResult.EpochCredits type change from v2.1.0.
Full changelog: v2.3.0...v2.4.0