Skip to content

Commit 9d577f7

Browse files
Merge pull request #2 from thirdweb-dev/joaquim/iaw
Support IAW auth tokens for EOA signing
2 parents 30cf2ce + f79ee1b commit 9d577f7

File tree

25 files changed

+1062
-90
lines changed

25 files changed

+1062
-90
lines changed

Cargo.lock

Lines changed: 80 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[workspace]
2-
members = ["aa-core", "core", "executors", "server", "thirdweb-core", "twmq"]
2+
members = ["aa-types", "aa-core", "core", "executors", "server", "thirdweb-core", "twmq"]
33
resolver = "2"

aa-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2024"
66
[dependencies]
77
alloy = { version = "1.0.8", features = ["serde"] }
88
tokio = "1.44.2"
9+
engine-aa-types = { path = "../aa-types" }
910
engine-core = { path = "../core" }
1011
vault-types = { version = "0.1.0", git = "ssh://git@github.com/thirdweb-dev/vault.git", branch = "main" }
1112
vault-sdk = { version = "0.1.0", git = "ssh://git@github.com/thirdweb-dev/vault.git", branch = "main" }

aa-core/src/userop/builder.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ use alloy::{
66
providers::Provider,
77
rpc::types::{PackedUserOperation, UserOperation},
88
};
9+
use engine_aa_types::VersionedUserOp;
910
use engine_core::{
1011
chain::Chain,
1112
credentials::SigningCredential,
1213
error::{AlloyRpcErrorToEngineError, EngineError},
1314
execution_options::aa::{EntrypointAndFactoryDetails, EntrypointVersion},
14-
userop::{UserOpSigner, UserOpSignerParams, UserOpVersion},
15+
userop::{UserOpSigner, UserOpSignerParams},
1516
};
1617

1718
pub struct UserOpBuilderConfig<'a, C: Chain> {
@@ -40,7 +41,7 @@ impl<'a, C: Chain> UserOpBuilder<'a, C> {
4041
Self { config }
4142
}
4243

43-
pub async fn build(self) -> Result<UserOpVersion, EngineError> {
44+
pub async fn build(self) -> Result<VersionedUserOp, EngineError> {
4445
let mut userop = match self.config.entrypoint_and_factory.version {
4546
EntrypointVersion::V0_6 => UserOpBuilderV0_6::new(&self.config).build().await?,
4647
EntrypointVersion::V0_7 => UserOpBuilderV0_7::new(&self.config).build().await?,
@@ -61,10 +62,10 @@ impl<'a, C: Chain> UserOpBuilder<'a, C> {
6162
.await?;
6263

6364
match &mut userop {
64-
UserOpVersion::V0_6(userop) => {
65+
VersionedUserOp::V0_6(userop) => {
6566
userop.signature = signature;
6667
}
67-
UserOpVersion::V0_7(userop) => {
68+
VersionedUserOp::V0_7(userop) => {
6869
userop.signature = signature;
6970
}
7071
}
@@ -114,7 +115,7 @@ impl<'a, C: Chain> UserOpBuilderV0_6<'a, C> {
114115
}
115116
}
116117

117-
async fn build(mut self) -> Result<UserOpVersion, EngineError> {
118+
async fn build(mut self) -> Result<VersionedUserOp, EngineError> {
118119
let prices = self
119120
.chain
120121
.provider()
@@ -153,7 +154,7 @@ impl<'a, C: Chain> UserOpBuilderV0_6<'a, C> {
153154
.chain
154155
.bundler_client()
155156
.estimate_user_op_gas(
156-
&UserOpVersion::V0_6(self.userop.clone()),
157+
&VersionedUserOp::V0_6(self.userop.clone()),
157158
self.entrypoint,
158159
None,
159160
)
@@ -172,7 +173,7 @@ impl<'a, C: Chain> UserOpBuilderV0_6<'a, C> {
172173
self.userop.verification_gas_limit = verification_gas_limit;
173174
self.userop.pre_verification_gas = pre_verification_gas;
174175

175-
Ok(UserOpVersion::V0_6(self.userop))
176+
Ok(VersionedUserOp::V0_6(self.userop))
176177
}
177178
}
178179

@@ -219,7 +220,7 @@ impl<'a, C: Chain> UserOpBuilderV0_7<'a, C> {
219220
}
220221
}
221222

222-
async fn build(mut self) -> Result<UserOpVersion, EngineError> {
223+
async fn build(mut self) -> Result<VersionedUserOp, EngineError> {
223224
// Get gas prices, same as v0.6
224225
let prices = self
225226
.chain
@@ -272,7 +273,7 @@ impl<'a, C: Chain> UserOpBuilderV0_7<'a, C> {
272273
.chain
273274
.bundler_client()
274275
.estimate_user_op_gas(
275-
&UserOpVersion::V0_7(self.userop.clone()),
276+
&VersionedUserOp::V0_7(self.userop.clone()),
276277
self.entrypoint,
277278
None,
278279
)
@@ -300,6 +301,6 @@ impl<'a, C: Chain> UserOpBuilderV0_7<'a, C> {
300301
self.userop.paymaster_verification_gas_limit = Some(paymaster_verification_gas_limit);
301302
self.userop.paymaster_post_op_gas_limit = Some(paymaster_post_op_gas_limit);
302303

303-
Ok(UserOpVersion::V0_7(self.userop))
304+
Ok(VersionedUserOp::V0_7(self.userop))
304305
}
305306
}

aa-types/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "engine-aa-types"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
alloy = { version = "1.0.8", features = ["serde"] }
8+
serde = { version = "1.0.219", features = ["derive"] }
9+
serde_json = "1.0.140"
10+
thiserror = "2.0.12"
11+
schemars = "0.8.22"
12+
utoipa = "5.4.0"

aa-types/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod userop;
2+
3+
pub use userop::*;

0 commit comments

Comments
 (0)