solana-labs / solana-web3.js

Solana JavaScript SDK
https://solana-labs.github.io/solana-web3.js
MIT License
1.97k stars 791 forks source link

Only include `replacementBlockhash` in the simulation result type when `replaceRecentBlockhash` is `true` #2869

Open steveluscher opened 1 week ago

steveluscher commented 1 week ago

In SimulateTransactionApi we only return innerInstructions in the response when the innerInstructions config property is true. It would be nice to do the same for replacementBlockhash so that you don't have to null-check it.

To do so with the current design of the types would require all of the overloads to be duplicated to handle that case, as they were in #2868. That would yield 32 overloads and require that we increase this number. That, in turn, would harm performance, so in #2870 we decided not to do it.

The job is to find a way to make this happen.