-
Notifications
You must be signed in to change notification settings - Fork 75
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
.awaitRequiredOperationStatus cannot await on both speculative status #472
Comments
@gregLibert We can start the discussion here. |
From what I understand, this is heavily impairing the developer experience and should be solved asap. |
One quick solution would be to accept an array of status and return if one of them is reached. |
Let's focus on building something robust. @damip we should also discuss about the priority, ASAP is misleading I think. |
Here is a preliminary specification on how to make things cleanly: After emitting an operation:
|
Just for information. We can do that try {
const specSuccess = client
.smartContracts()
.awaitRequiredOperationStatus(opId, EOperationStatus.SPECULATIVE_SUCCESS);
const specError = client
.smartContracts()
.awaitRequiredOperationStatus(opId, EOperationStatus.SPECULATIVE_ERROR);
const finalSuccess = client
.smartContracts()
.awaitRequiredOperationStatus(opId, EOperationStatus.FINAL_SUCCESS);
const finalError = client
.smartContracts()
.awaitRequiredOperationStatus(opId, EOperationStatus.FINAL_ERROR);
const specResult = await Promise.race([specSuccess, specError]);
console.log(EOperationStatus[specResult]);
const finalResult = await Promise.race([finalSuccess, finalError]);
console.log(EOperationStatus[finalResult]);
} catch (error) {
console.error("An error occurred:", error);
} |
Cannot await on both:
The text was updated successfully, but these errors were encountered: