Add back in Protocol 22 non-breaking changes for a transition period #317
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This PR smooths out the breaking changes to Stellar RPC's API to make it possible for users to upgrade SDKs without experiencing breakage. Namely,
getTransaction
would encodecreatedAt
as astring
instead ofnumber
. This change has been reverted. We will continue to encode it as anumber
(specifically, auint32
).getEvents
replacedpagingToken
withcursor
within each event for pagination. This change is now additive, and the response schema will now include both fields.getVersionInfo
would now use camelCasing over snake_case. This change is now additive. The response schema will contain both variants:Why
When a user upgrades to the latest version of your SDK, their code will now only be compatible with a v22.* version of the backend services they're connected to. This means they can only upgrade exactly when their RPC/Horizon provider upgrades, which is a violation of the previous compatibility guarantees we provide the ecosystem.
A concrete example: someone with an existing codebase may have code written that uses the
createdAt
field returned byrpc.getTransaction
. If they upgrade to the latest version, their code will break because the field is now strictly typed as a string. And yet, if they were to update their code accordingly, their code would not function unless they pointed at a v22 RPC. This is the lockstep upgrade we are trying to avoid. This is in contrast to a change likecost
being removed, because they can write code that works on both v21 and v22 RPCs by using the existingtransactionData
field to migrate.This PR smooths those things out.