Skip to content

Commit

Permalink
client: Add async to anchor-client (#2488)
Browse files Browse the repository at this point in the history
Co-authored-by: acheron <[email protected]>
  • Loading branch information
Aursen and acheroncrypto authored Jun 6, 2023
1 parent b8eda69 commit 65c9d6e
Show file tree
Hide file tree
Showing 13 changed files with 1,090 additions and 454 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The minor version will be incremented upon a breaking change and the patch versi

### Features

- client: Add `async` feature flag to use an asynchronous anchor-client ([#2488](https://github.com/coral-xyz/anchor/pull/2488)).
- spl: Add metadata wrappers `approve_collection_authority`, `bubblegum_set_collection_size`, `burn_edition_nft`, `burn_nft`, `revoke_collection_authority`, `set_token_standard`, `utilize`, `unverify_sized_collection_item`, `unverify_collection` ([#2430](https://github.com/coral-xyz/anchor/pull/2430))
- spl: Add `token_program` constraint to `Token`, `Mint`, and `AssociatedToken` accounts in order to override required `token_program` fields and use different token interface implementations in the same instruction ([#2460](https://github.com/coral-xyz/anchor/pull/2460))
- cli: Add support for Solidity programs. `anchor init` and `anchor new` take an option `--solidity` which creates solidity code rather than rust. `anchor build` and `anchor test` work accordingly ([#2421](https://github.com/coral-xyz/anchor/pull/2421))
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ description = "Rust client for Anchor programs"

[features]
debug = []
async = []

[dependencies]
anchor-lang = { path = "../lang", version = "0.27.0" }
Expand All @@ -20,3 +21,5 @@ solana-sdk = "<1.17.0"
solana-account-decoder = "<1.17.0"
thiserror = "1.0.20"
url = "2.2.2"
tokio = { version = "1", features = ["rt", "sync"] }
futures = { version = "0.3.28" }
4 changes: 4 additions & 0 deletions client/example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ edition = "2021"

[workspace]

[features]
async = ["anchor-client/async"]

[dependencies]
anchor-client = { path = "../", features = ["debug"] }
basic-2 = { path = "../../examples/tutorial/basic-2/programs/basic-2", features = ["no-entrypoint"] }
Expand All @@ -17,4 +20,5 @@ events = { path = "../../tests/events/programs/events", features = ["no-entrypoi
shellexpand = "2.1.0"
anyhow = "1.0.32"
clap = { version = "4.2.4", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
solana-sdk = "<1.17.0"
24 changes: 24 additions & 0 deletions client/example/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,30 @@ main() {
--optional-pid $optional_pid \
--multithreaded

#
# Restart validator for async test
#
cleanup
solana-test-validator -r \
--bpf-program $composite_pid ../../tests/composite/target/deploy/composite.so \
--bpf-program $basic_2_pid ../../examples/tutorial/basic-2/target/deploy/basic_2.so \
--bpf-program $basic_4_pid ../../examples/tutorial/basic-4/target/deploy/basic_4.so \
--bpf-program $events_pid ../../tests/events/target/deploy/events.so \
--bpf-program $optional_pid ../../tests/optional/target/deploy/optional.so \
> test-validator.log &
sleep 5

#
# Run async test.
#
cargo run --features async -- \
--composite-pid $composite_pid \
--basic-2-pid $basic_2_pid \
--basic-4-pid $basic_4_pid \
--events-pid $events_pid \
--optional-pid $optional_pid \
--multithreaded

}

cleanup() {
Expand Down
Loading

1 comment on commit 65c9d6e

@vercel
Copy link

@vercel vercel bot commented on 65c9d6e Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

anchor-docs – ./

anchor-docs-git-master-200ms.vercel.app
anchor-docs-200ms.vercel.app
anchor-lang.com
www.anchor-lang.com

Please sign in to comment.