-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Expose
transact async
for asynchronous transactions (#222)
* Initial into_future working * Moved over to generic impl * Cleanup and fixing ViewFunction * Added ViewFunction impls and FunctionOwned/Args type * Cleanup usage of futures::TryFutureExt * Some more cleanup * Updated view_code and view_state to use new async builder * Added view async builder to API surface * Removed view_latest_block for view_block instead * view_account async builder now apart of the API surface * Got rid of unused client.view_{code, state} * Sort imports * Added Finality type * Added doc * Expose access keys * Expose access keys list * Rename QueryMethod => Method * Added gas price * Rename Queryable methods * Rename Queryable to ProcessQuery * Addressed comments * Addressed comments * Addressed comments (TM) * AccessKey info should be public * Addressed comments * Added transact_async * Update docs * Added test for transact_async * Addressed comments * Rebase from async builders * Update workspaces/src/operations.rs Co-authored-by: Austin Abell <austinabell8@gmail.com> * Added TransactionPoll::Error * Added test for nonce * Status Result<Poll> * Fix tests Co-authored-by: Austin Abell <austinabell8@gmail.com>
- Loading branch information
1 parent
fdd2864
commit 0b80d06
Showing
6 changed files
with
263 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const STATUS_MSG_WASM_FILEPATH: &str = "./examples/res/status_message.wasm"; | ||
|
||
#[tokio::main] | ||
async fn main() -> anyhow::Result<()> { | ||
let worker = workspaces::sandbox().await?; | ||
let wasm = std::fs::read(STATUS_MSG_WASM_FILEPATH)?; | ||
let contract = worker.dev_deploy(&wasm).await?; | ||
|
||
let status = contract | ||
.call("set_status") | ||
.args_json(serde_json::json!({ | ||
"message": "hello_world", | ||
})) | ||
.transact_async() | ||
.await?; | ||
|
||
let outcome = status.await; | ||
println!( | ||
"Async transaction result from setting hello world: {:#?}", | ||
outcome | ||
); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters