Skip to content

Commit

Permalink
Merge pull request #3 from popzxc/popzxc-fillers
Browse files Browse the repository at this point in the history
feat: Implement Eip712 filler
  • Loading branch information
popzxc authored Oct 15, 2024
2 parents a9d4c29 + 8d09a21 commit 63359d5
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 72 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
- name: Run doc tests
run: cargo test --all-features --doc

- name: Run showcase example
run: cargo run --example showcase

document:
needs:
- test
Expand Down
101 changes: 59 additions & 42 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ tokio = { version = "1", features = ["full"] }
anyhow = "1"
hex = "0.4.3"
assert_matches = "1.5.0"

[patch.crates-io]
# Needed until https://github.com/alloy-rs/alloy/pull/1466 is released
alloy = { git = "https://github.com/alloy-rs/alloy.git", rev = "a5e06ec5e98e877497cbe22557083b6c3e755bc6" }
13 changes: 4 additions & 9 deletions examples/showcase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ use alloy_zksync::{
wallet::ZksyncWallet,
};

use anyhow::Result;

#[tokio::main]
async fn main() -> Result<()> {
async fn main() -> anyhow::Result<()> {
// Spin up a local era-test-node node.
// Ensure `era_test_node` is available in $PATH.
let era_test_node = EraTestNode::new().try_spawn()?;
Expand All @@ -36,8 +34,7 @@ async fn main() -> Result<()> {
// The `from` field is automatically filled to the first signer's address (Alice).
let tx = TransactionRequest::default()
.with_to(address!("d8dA6BF26964aF9D7eEd9e03E53415D37aA96045"))
.with_value(U256::from(100))
.with_gas_per_pubdata(U256::from(1_000_000));
.with_value(U256::from(100));

// Send the transaction and wait for inclusion.
let receipt = provider.send_transaction(tx).await?.get_receipt().await?;
Expand All @@ -49,10 +46,8 @@ async fn main() -> Result<()> {

// Manually deploy contract.
let bytecode = hex::decode("0000008003000039000000400030043f0000000100200190000000120000c13d000000000201001900000009002001980000001a0000613d000000000101043b0000000a011001970000000b0010009c0000001a0000c13d0000000001000416000000000001004b0000001a0000c13d0000002a01000039000000800010043f0000000c010000410000001d0001042e0000000001000416000000000001004b0000001a0000c13d00000020010000390000010000100443000001200000044300000008010000410000001d0001042e00000000010000190000001e000104300000001c000004320000001d0001042e0000001e000104300000000000000000000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000fffffffc000000000000000000000000ffffffff0000000000000000000000000000000000000000000000000000000026121ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000080000000000000000000000000000000000000000000000000000000000000000000000000000000007c0a65e1f13adb4dd4cc7c561a9505c55567c29e53e1576cfddf58b4218e7a9e").unwrap();
let tx = TransactionRequest::default()
.with_gas_limit(100_000_000)
.with_gas_per_pubdata(U256::from(1_000_000)) // Error: server returned an error response: error code 3: Failed to serialize transaction: gas per pub data limit is zero
.zksync_deploy(bytecode, Vec::new(), Vec::new())?;
let tx = TransactionRequest::default().zksync_deploy(bytecode, Vec::new(), Vec::new())?;

let receipt = provider.send_transaction(tx).await?.get_receipt().await?;
println!("Got receipt: {receipt:#?}");

Expand Down
Loading

0 comments on commit 63359d5

Please sign in to comment.