-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle new RPC simulation response variations #132
Conversation
Removed dependencies detected. Learn more about Socket for GitHub ↗︎ 🚮 Removed packages: @types/[email protected], @types/[email protected] |
Note that this is targeting the |
const coalesced = parseRawSimulation(simulation); | ||
if (!coalesced.result) { | ||
throw new Error(`simulation incorrect: ${JSON.stringify(coalesced)}`); | ||
let success = parseRawSimulation(simulation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit, your call, it's not success yet, maybe simulationResponse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it should be! heh. slightly more annoying to read later lines if it's something like parsed
, and reassigning after the if (!isSuccess...)
check is also slightly more annoying 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, left minor suggestions for consideration.
* Upgrade the codebase to work with testnet XDR (#135) * Using [email protected] * Prepare `v1.0.0-beta.0` for release (#143) * Handle new RPC simulation response variations (#132) * Add Core build reference to changelog for clarity
This aligns with stellar/stellar-cli#865 and stellar/stellar-cli#878. The new behavior is documented here. In summary:
The
id
andlatestLedger
fields always exist. Then, there are branching variations:error
always existstransactionData
,minResourceFee
, andcost
always existresults
only exists IF the simulation was for an invocation oprestorePreamble
only exists IF the simulation required expired entriesevents
may exist but we will make it always exist (maybe empty)Our transformations are as follows:
events
always exists (but may be empty)results?[]
is coalesced into a singleresult?