feat: add requestId parameter and relevant validation #62
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.
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.