-
Notifications
You must be signed in to change notification settings - Fork 313
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
Add StateChanges in SimulateTransaction API response #963
Conversation
Size Change: +9.12 kB (+0.08%) Total Size: 12 MB
|
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.
Don't forget a CHANGELOG.md
entry!
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.
One last comment. Great test coverage btw! 👏
src/rpc/parsers.ts
Outdated
}) | ||
}), | ||
|
||
stateChanges: sim.stateChanges?.length ?? 0 > 0 |
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.
Doing it this way means stateChanges
is always present, and might be set as stateChanges: undefined
. We want to omit the property altogether. This is why we need the spread operator. Observe the differences:
$ node
> {
value: [].length > 0 ? "hello" : undefined
}
{ value: undefined }
> // vs.
> {
...([].length > 0 ?? { value: "hello" })
}
{}
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.
Yes I think we are on same page for stateChanges
, I thought you were proposing the same for before
and after
property which seemed wrong but gotchu now :)
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.
I was but I changed my mind - we should stick to the RPC API 👍
Fixes #936
This Diff has following changes: