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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: Add async to anchor-client #2488

Merged
merged 10 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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