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
base: master
Are you sure you want to change the base?
Conversation
Size Change: +9.92 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!
src/soroban/parsers.ts
Outdated
before: !!entryChange.before ? xdr.LedgerEntry.fromXDR(entryChange.before, 'base64') : undefined, | ||
after: !!entryChange.after ? xdr.LedgerEntry.fromXDR(entryChange.after, 'base64') : undefined, |
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.
if you want before
and after
to be omitted when they aren't present you'll need to use the spread operator (check in this file for examples, I think it's something like
key: xdr.LedgerKey.fromXDR(entryChange.key, 'base64'),
...(entryChange.before && { before: xdr.LedgerEntry.fromXDR(entryChange.before, 'base64') },
and you want this for stateChanges
too. Alternatively you can use delete
(much easier to read lol).
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 think now there is no need to omit as these are required fields. so spread operator wont be needed here
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.
What I mean is that maybe we want to omit them at the SDK level since the API choice of making them null
is odd (imo).
@@ -6,6 +6,10 @@ A breaking change will get clearly marked in this log. | |||
|
|||
## Unreleased | |||
|
|||
Added: | |||
|
|||
- Add stateChanges in SimulateTransaction API response ([#963](https://github.com/stellar/js-stellar-sdk/pull/963)) |
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.
This should have a bit more detail, e.g. at least the schema change and mention rpc.Server.simulateTransaction
@@ -175,8 +168,21 @@ export namespace Api { | |||
value: string; | |||
} | |||
|
|||
export interface RequestAirdropResponse { | |||
transaction_id: string; | |||
export interface RawLedgerEntryChange { |
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 think we can get away with not exporting this one?
}, | ||
{ | ||
type: 3, | ||
key: "example-key-3", |
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.
wait shouldn't this fail to decode to a LedgerKey
?
Fixes #936
This Diff has following changes: