Skip to content

Commit

Permalink
Add replacementBlockhash to the simulation return type, in preparat…
Browse files Browse the repository at this point in the history
…ion for Agave 2.0 (#2870)

# Summary

When you ask the simulator to `replaceRecentBlockhash`, you may like to know what the replacement blockhash was. Agave 2.0 will return it in the simulation result.

It would have been nice to _only_ include this property when `replaceRecentBlockhash` is explicitly `true`, but I would have had to duplicate all of the overloads for the purpose, yielding 32 in total.
  • Loading branch information
steveluscher authored Jun 28, 2024
1 parent 91fb1f3 commit bcfead5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/rpc-api/src/simulateTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
AccountInfoWithJsonData,
Base58EncodedBytes,
Base64EncodedDataResponse,
Blockhash,
Commitment,
Slot,
SolanaRpcResponse,
Expand Down Expand Up @@ -91,6 +92,11 @@ type SimulateTransactionApiResponseBase = SolanaRpcResponse<{
err: TransactionError | null;
/** Array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure) */
logs: string[] | null;
// TODO(https://github.com/solana-labs/solana-web3.js/issues/2869): Make it so that
// `replacementBlockhash` only appears on the return type when `replaceRecentBlockhash` is set
// to `true` in the call to `simulateTransaction`.
/** The blockhash that was used to simulate the transaction when `replaceRecentBlockhash` is `true` */
replacementBlockhash?: Blockhash;
/** The most-recent return data generated by an instruction in the transaction */
returnData: Readonly<{
/** The return data itself, as base-64 encoded binary data */
Expand Down

0 comments on commit bcfead5

Please sign in to comment.