Skip to content

feat: add requestId parameter and relevant validation#62

Merged
Lemmmy merged 2 commits intomasterfrom
requestId
Jun 27, 2024
Merged

feat: add requestId parameter and relevant validation#62
Lemmmy merged 2 commits intomasterfrom
requestId

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
@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