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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Client Side Await for Aleo Futures #779

Open
3 tasks
iamalwaysuncomfortable opened this issue Oct 16, 2023 · 0 comments
Open
3 tasks

[Feature] Client Side Await for Aleo Futures #779

iamalwaysuncomfortable opened this issue Oct 16, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@iamalwaysuncomfortable
Copy link
Collaborator

馃殌 Feature - Client Side Await for Aleo Futures

Motivation

Futures have been introduced into Aleo Instructions. However on the client side, currently the client would have to implement their own logic in order to check if a future leading to a finalize scope was successful. Optimally, if an Aleo instructions function leads returns a future type it should return a promise that resolves when the future has completed executing on chain.

This will allow users to allow their apps to react directly to on-chain state

Implementation

  • If a function return type is of type future, create javascript promise that polls the for a finalize transaction matching the transaction id on chain. The future resolves when it detects a succcess, rejection, or a timeout.
  • Add the inputs the finalize block was called on to the promise. If the inputs were also futures, add those to the data in the promise
  • Add a typescript interface in order to allow SDK users to extend this promise type to enable custom behavior (i.e. like checking the resulting mapping, or triggering another action, etc.) so that users have an interface to reacting to updates in on-chain state
@iamalwaysuncomfortable iamalwaysuncomfortable added the enhancement New feature or request label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant