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

feat: add requestId parameter and relevant validation #62

Merged
merged 2 commits into from
Jun 27, 2024
Merged

Conversation

emmachase
Copy link
Member

Adds a new requestId parameter to the makeTransaction APIs. This id is used to ensure that even if the request is re-sent by the client, so long as the id stays consistent, it is guaranteed that at most 1 transaction will be created.

For now, the requestId is not populated into the model returned by the transaction APIs as it shouldn't be necessary for any consumers to know a particular transactions requestId, as well as to keep the change simple and backwards-compatible. This may change in the future if a good use-case is found for this.

If a request is made with a requestId that has been used previously, but any of the transaction details differ from the original, (e.g. from, to, amount, metadata) then the request will fail with error code transaction_conflict. If clients receive this error, they should pick a new requestId.

@Lemmmy Lemmmy merged commit 5030c6c into master Jun 27, 2024
2 checks passed
@Lemmmy Lemmmy deleted the requestId branch June 27, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants