Reputation: 215
I'm having a function that return a promise expected to return a u128 value from another contract. How can I get this value from this promise?
Here is my codes:
I tried async await in future/rust but it didn't work
Upvotes: 1
Views: 131
Reputation: 1094
The value is baked into the call_result
variable you have there. The promise will be scheduled after query_staked_amount
finishes and then once the promise finishes executing, the callback query_staked_amount_callback
is invoked.
In this callback, the result of the original promise (get_staked_amount
) will be available in that variable you have call_result
.
Hope that answers your question.
Upvotes: 1