Skip to content
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

SEP-31: make destination address & memo optional in POST /transactions response #1294

Merged
merged 8 commits into from
Aug 16, 2022

Conversation

JakeUrban
Copy link
Contributor

resolves #1290

See the issue description for details.

cc @gaclaudiu

@JakeUrban
Copy link
Contributor Author

@lijamie98, can you update the status diagram to show pending_receiver as a valid initial status?

Comment on lines 457 to 460
`stellar_account_id` | string | (optional) The Stellar account to send payment to.
`stellar_memo_type` | string | (optional) The type of memo to attach to the Stellar payment (`text`, `hash`, or `id`).
`stellar_memo` | string | (optional) The memo to attach to the Stellar payment.
`status` | string | (optional) The initial status of the transaction, either `pending_sender` or `pending_receiver`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're making a breaking change and going to v2.0.0, what do you think of changing the response body of POST /transactions to the same response body of GET /transactions/:id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes a lot of sense. We’ll have to be intentional about adding more guidance in the SEP and documentation though so it’s clear which attributes are useful immediately after transaction creation.

`stellar_account_id` | string | (optional) The Stellar account to send payment to.
`stellar_memo_type` | string | (optional) The type of memo to attach to the Stellar payment (`text`, `hash`, or `id`).
`stellar_memo` | string | (optional) The memo to attach to the Stellar payment.
`status` | string | (optional) The initial status of the transaction, either `pending_sender` or `pending_receiver`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate that we have four optional parameters that are bound together, i.e. not individually optional, they're only optional together.

A status that isn't present is interesting, would it make sense do you think to add a status to represent this moment? It would mean the state machine always has a status, rather than this unknown status period.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added status as optional because existing implementations don't return it, not because there isn't a status value that represents the moment. pending_receiver would represent the moment if the address & memo fields are not returned, otherwise pending_sender would be appropriate.

If we go with @marcelosalloum's suggestion to return the same response body as the GET /transactions/:id, then status would be required.

So I think we just need to decide how big of a breaking change we want to make. Making previously required response attributes optional is less impactful to existing implementations than making previously absent fields required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting. I wonder if breaking this change into two changes in the changelog will help people understand it clearer. i.e. add status as optional, then make other changes. It doesn't improve the resulting situation though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I do think there are two breaking changes here

  1. Make stellar_account_id, stellar_memo, & stellar_memo_type optional in POST /transactions & GET /transactions/:id responses
  2. Replace current POST /transactions response body with the response body of GET /transactions/:id

It just pains me to bump the major version twice. Making 1 breaking change per major version bump makes things clearer, but I see other pieces of software make many breaking changes per major version bump.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, we don't want to bump it twice. Breaking changes in software is one thing, in standards it creates more work, as how do clients interoperate with all of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.. then @marcelosalloum I think we should just go with breaking change 1 and not do 2. It would make the API cleaner and more RESTful but its not worth making current implementations out of date.

@JakeUrban
Copy link
Contributor Author

Ok, I removed the status attribute from the POST /transactions response. This minimizes the changes to the POST /transactions response.

JakeUrban and others added 2 commits August 16, 2022 09:50
Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com>
Copy link
Contributor

@marcelosalloum marcelosalloum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change LGTM!

There's just a small typo in the state diagram that should be updated from pre-payemnt to pre-payment.

Copy link
Contributor

@marcelosalloum marcelosalloum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@JakeUrban JakeUrban merged commit aa3f665 into master Aug 16, 2022
@JakeUrban JakeUrban deleted the sep31-post-transactions branch August 16, 2022 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SEP-31: make POST /transactions payment-related response attributes optional
3 participants