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

chore: bump alloy to 0.3.5 and add script to run all examples #136

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 1 addition & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,27 +146,7 @@ cargo run --example $YOUR_EXAMPLE_NAME
To run all (runnable) examples:

```sh
cargo run --example 2>&1 \
| grep -E '^ ' \
| grep -v \
-e 'trezor_signer' \
-e 'ledger_signer' \
-e 'yubi_signer' \
-e 'builtin' \
-e 'ipc' \
-e 'ws' \
-e 'ws_auth' \
-e 'subscribe_logs' \
-e 'subscribe_all_logs' \
-e 'subscribe_pending_transactions' \
-e 'trace_call' \
-e 'trace_transaction' \
| xargs -I {} sh -c 'if cargo run --example {} --quiet 1>/dev/null; then \
echo "Successfully ran: {}"; \
else \
echo "Failed to run: {}"; \
cargo run --example {}; \
fi'
./scripts/run.sh
```

### Tests
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ significant_drop_in_scrutinee = "allow"
significant_drop_tightening = "allow"

[workspace.dependencies]
alloy = { version = "0.3.1", features = [
alloy = { version = "0.3.5", features = [
"full",
"node-bindings",
"rpc-types-debug",
Expand All @@ -111,7 +111,7 @@ alloy = { version = "0.3.1", features = [

# async
futures-util = "0.3"
tokio = "1.38"
tokio = "1.40"

# misc
eyre = "0.6"
Expand Down
4 changes: 2 additions & 2 deletions examples/transactions/examples/send_eip7702_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use alloy::{
eips::eip7702::Authorization,
network::TxSignerSync,
node_bindings::Anvil,
primitives::{TxKind, U256},
primitives::U256,
providers::{Provider, ProviderBuilder},
signers::{local::LocalSigner, SignerSync},
sol,
Expand Down Expand Up @@ -61,7 +61,7 @@ async fn main() -> Result<()> {

// Build the transaction
let mut tx = TxEip7702 {
to: TxKind::Call(authority.address()),
to: authority.address(),
authorization_list: vec![auth],
input: emit_hello_calldata.to_owned(),
nonce: provider.get_transaction_count(sender.address()).await?,
Expand Down
36 changes: 36 additions & 0 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

# Exit if anything fails
set -eo pipefail

# This script will do the following:
#
# 1. Run all examples with some exceptions.
function main () {
cargo run --example 2>&1 \
| grep -E '^ ' \
| grep -v \
-e 'any_network' \
-e 'trezor_signer' \
-e 'ledger_signer' \
-e 'yubi_signer' \
-e 'builtin' \
-e 'ipc' \
-e 'ws' \
-e 'ws_auth' \
-e 'subscribe_logs' \
-e 'subscribe_all_logs' \
-e 'subscribe_pending_transactions' \
-e 'trace_call' \
-e 'trace_transaction' \
| xargs -I {} sh -c 'if cargo run --example {} --quiet 1>/dev/null; then \
echo "Successfully ran: {}"; \
else \
echo "Failed to run: {}"; \
cargo run --example {}; \
fi'
}

# Run the main function
# This prevents partial execution in case of incomplete downloads
main
Loading