Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
a232036
cleaned up commits
Hallmane Mar 26, 2025
860c2b4
Format Rust code using rustfmt
github-actions[bot] Mar 26, 2025
ba0d7c8
base tx works
Hallmane Mar 28, 2025
397a77c
f5
Hallmane Apr 1, 2025
e4fd3e6
er20_X works
Hallmane Apr 1, 2025
13b47f0
token address resolution
Hallmane Apr 1, 2025
517056e
bla
Hallmane Apr 2, 2025
063e805
merged latest main
Hallmane Apr 2, 2025
0aad3c8
removed cursor shit
Hallmane Apr 3, 2025
98e5aad
untested stuff that i've used in gotland wallet app
Hallmane Apr 8, 2025
f51e27a
merged main into wh/wallet-signer
Hallmane Apr 8, 2025
cace061
Format Rust code using rustfmt
github-actions[bot] Apr 8, 2025
8159f2d
removed eth_utils
Hallmane Apr 8, 2025
78e58f8
Merge branch 'wh/wallet-signer' of github.com:hyperware-ai/process_li…
Hallmane Apr 8, 2025
98a012d
removed non-existing eth_utils dependency from lib.rs
Hallmane Apr 8, 2025
8281514
proxy execute w tba wip
Hallmane Apr 30, 2025
a235fe8
Format Rust code using rustfmt
github-actions[bot] Apr 30, 2025
a237fad
access-list getter
Hallmane Apr 30, 2025
04ad71f
Merge branch 'wh/wallet-signer' of github.com:hyperware-ai/process_li…
Hallmane Apr 30, 2025
09d0e56
Format Rust code using rustfmt
github-actions[bot] Apr 30, 2025
2393f6e
added erc6551 5 call method w gas param
Hallmane May 1, 2025
17627e1
Format Rust code using rustfmt
github-actions[bot] May 1, 2025
20c1f80
merged new hypermap cacher into wh/wallet-signer
Hallmane Jun 3, 2025
8e90e36
Format Rust code using rustfmt
github-actions[bot] Jun 3, 2025
3fa844f
Merge branch 'main' into wh/wallet-signer
Hallmane Jun 9, 2025
cfb8d2b
4337 wip
Hallmane Jul 9, 2025
49638ca
Format Rust code using rustfmt
github-actions[bot] Jul 9, 2025
c9edb5f
gas from ZERO to something
Hallmane Jul 10, 2025
08a6dd3
v0.8.0 entrypoint
Hallmane Jul 10, 2025
38ed079
v0.8.0 structs...
Hallmane Jul 10, 2025
ae41238
Format Rust code using rustfmt
github-actions[bot] Jul 10, 2025
9bb25e5
wip
Hallmane Jul 10, 2025
d1a0815
Merge branch 'wh/wallet-signer' of github.com:hyperware-ai/process_li…
Hallmane Jul 10, 2025
ce71719
wup
Hallmane Jul 10, 2025
12843be
wip
Hallmane Jul 10, 2025
aa42c9f
Format Rust code using rustfmt
github-actions[bot] Jul 10, 2025
4658f09
wip
Hallmane Jul 10, 2025
daf3d17
wipwip
Hallmane Jul 10, 2025
140f94b
blawpi
Hallmane Jul 10, 2025
9f445a5
Format Rust code using rustfmt
github-actions[bot] Jul 10, 2025
a4b8535
wip 2612 permit data
Hallmane Jul 11, 2025
ecee219
2612 wip
Hallmane Jul 11, 2025
7fabf09
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
22e7e14
wip
Hallmane Jul 11, 2025
e17d41a
wip
Hallmane Jul 11, 2025
b5833e3
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
aa7ffcf
wip
Hallmane Jul 11, 2025
a3766ef
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
5c2825f
wip
Hallmane Jul 11, 2025
0a7fd70
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
017d332
wip
Hallmane Jul 11, 2025
a7d198d
Merge branch 'wh/wallet-signer' of github.com:hyperware-ai/process_li…
Hallmane Jul 11, 2025
6847852
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
041c7be
wip
Hallmane Jul 11, 2025
921684b
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
333c792
wip
Hallmane Jul 11, 2025
e6ba986
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
ca26d85
wip
Hallmane Jul 11, 2025
580e9f8
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
dfd3ac7
wip
Hallmane Jul 11, 2025
a5e1e27
wip
Hallmane Jul 11, 2025
3995139
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
f6c17b3
wip
Hallmane Jul 11, 2025
199cb19
Merge branch 'wh/wallet-signer' of github.com:hyperware-ai/process_li…
Hallmane Jul 11, 2025
66fb6b8
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
0ef160e
wip
Hallmane Jul 11, 2025
f486363
wip
Hallmane Jul 11, 2025
eaf7222
wip
Hallmane Jul 11, 2025
5d138fe
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
b0cd538
wip
Hallmane Jul 11, 2025
5043506
wip
Hallmane Jul 11, 2025
81ab046
Format Rust code using rustfmt
github-actions[bot] Jul 11, 2025
96d95f8
initial version of hyperwallet_client
Hallmane Jul 25, 2025
6057b48
Format Rust code using rustfmt
github-actions[bot] Jul 25, 2025
c773d9f
lol
Hallmane Jul 25, 2025
845d1f7
dev library for hyperwallet
Hallmane Jul 28, 2025
9ed6908
Format Rust code using rustfmt
github-actions[bot] Jul 28, 2025
bf2ac9a
nope
Hallmane Jul 28, 2025
77de47e
nope2
Hallmane Jul 28, 2025
a7c93af
Format Rust code using rustfmt
github-actions[bot] Jul 28, 2025
a90a3c7
nope3
Hallmane Jul 28, 2025
366f9ea
Merge branch 'hyperwallet-client_lib' of github.com:hyperware-ai/proc…
Hallmane Jul 28, 2025
dc4abb1
Format Rust code using rustfmt
github-actions[bot] Jul 28, 2025
812c999
yes1
Hallmane Jul 28, 2025
3e5ec41
shoveling complexity upwards
Hallmane Jul 29, 2025
d46c887
Format Rust code using rustfmt
github-actions[bot] Jul 29, 2025
7e43a65
even more, before removing the superfluous metadata from hyperwallet
Hallmane Jul 29, 2025
da319b2
fmt..
Hallmane Jul 29, 2025
e7ed1ae
Format Rust code using rustfmt
github-actions[bot] Jul 29, 2025
7bb1164
u128
Hallmane Jul 29, 2025
770be64
u128
Hallmane Jul 29, 2025
a4ed98d
fmt
Hallmane Jul 29, 2025
38c4736
cleaning w typing
Hallmane Jul 29, 2025
bbbde5f
Format Rust code using rustfmt
github-actions[bot] Jul 29, 2025
97e19e6
thinner api
Hallmane Jul 29, 2025
800724e
thinning too early, reverting
Hallmane Jul 30, 2025
49b709f
added some extra errors
Hallmane Jul 30, 2025
e2da495
not needed
Hallmane Jul 30, 2025
8d0b289
oops
Hallmane Jul 30, 2025
d402194
Address
Hallmane Jul 30, 2025
f934133
response enum
Hallmane Jul 31, 2025
f22a643
wrong handshake step
Hallmane Jul 31, 2025
f89fb35
pre-pr
Hallmane Jul 31, 2025
91b4bf4
Delete Cargo.lock
Hallmane Jul 31, 2025
4fbdb38
hyperwallet: change types to remove generics
nick1udwig Aug 5, 2025
3243620
hyperwallet: wit-ify
nick1udwig Aug 5, 2025
ac4d308
hyperwallet: gate behind a feature flag
nick1udwig Aug 5, 2025
4764ce3
hyperwallet: consolidate wit file
nick1udwig Aug 5, 2025
1500de2
hyperware pm tested unsuccessfully
Hallmane Aug 6, 2025
1b26075
:zyzz
Hallmane Aug 6, 2025
fb37552
fixed request/response serde (without diff.diff)
Hallmane Aug 7, 2025
a75f550
fixed a bunch of ser-and-deserialization errors in requests and respo…
Hallmane Aug 8, 2025
eaa9799
spending limits added to wit
Hallmane Aug 9, 2025
9a546cf
no
Hallmane Aug 11, 2025
7bfebe3
Merge branch 'hyperwallet-client_lib' into hf/hyperwallet-wit
nick1udwig Aug 13, 2025
9d66f39
Merge pull request #156 from hyperware-ai/hf/hyperwallet-wit
nick1udwig Aug 13, 2025
b94ec3d
Merge branch 'develop' into hyperwallet-client_lib
nick1udwig Aug 13, 2025
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
118 changes: 72 additions & 46 deletions src/hyperwallet_client/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,20 +380,20 @@ pub fn build_and_sign_user_operation_for_payment(
"call_data": call_data,
"use_paymaster": use_paymaster,
});

if let Some(v) = value {
params["value"] = serde_json::Value::String(v.to_string());
}

if let Some(pwd) = password {
params["password"] = serde_json::Value::String(pwd.to_string());
}

// Pass metadata through to hyperwallet
if let Some(meta) = metadata {
params["metadata"] = serde_json::Value::Object(meta);
}

let request = build_request(
our,
session_info,
Expand Down Expand Up @@ -425,37 +425,43 @@ pub fn build_and_sign_user_operation(
"call_data": call_data,
"use_paymaster": use_paymaster,
});

if let Some(v) = value {
params["value"] = serde_json::Value::String(v.to_string());
}

if let Some(pwd) = password {
params["password"] = serde_json::Value::String(pwd.to_string());
}

// Create metadata with Circle paymaster configuration if using paymaster
if use_paymaster {
let mut metadata = serde_json::Map::new();

// Always add Circle paymaster metadata for gasless transactions
// These constants should be defined somewhere accessible
metadata.insert("paymaster_address".to_string(),
serde_json::json!("0x2Ac3c1d3e24b45c6C310534Bc2Dd84B5ed576335")); // Base Circle paymaster
metadata.insert(
"paymaster_address".to_string(),
serde_json::json!("0x2Ac3c1d3e24b45c6C310534Bc2Dd84B5ed576335"),
); // Base Circle paymaster
metadata.insert("is_circle_paymaster".to_string(), serde_json::json!(true));
metadata.insert("paymaster_verification_gas".to_string(),
serde_json::json!("0x30000")); // 196608
metadata.insert("paymaster_post_op_gas".to_string(),
serde_json::json!("0x20000")); // 131072

metadata.insert(
"paymaster_verification_gas".to_string(),
serde_json::json!("0x30000"),
); // 196608
metadata.insert(
"paymaster_post_op_gas".to_string(),
serde_json::json!("0x20000"),
); // 131072

// Add TBA address if provided - tells hyperwallet to use TBA as sender
if let Some(tba) = tba_address {
metadata.insert("tba_address".to_string(), serde_json::json!(tba));
}

params["metadata"] = serde_json::Value::Object(metadata);
}

let request = build_request(
our,
session_info,
Expand Down Expand Up @@ -538,7 +544,7 @@ pub fn execute_gasless_payment(
) -> Result<serde_json::Value, HyperwalletClientError> {
// Step 1: Initialize session if needed (you might want to cache this)
let session = super::initialize(our, super::HandshakeConfig::new())?;

// Step 2: Build and sign UserOperation
let signed_data = build_and_sign_user_operation(
our,
Expand All @@ -552,20 +558,26 @@ pub fn execute_gasless_payment(
password,
chain_id,
)?;

// Step 3: Extract signed UserOperation and entry point
let signed_user_op = signed_data.get("signed_user_operation")
.ok_or_else(|| HyperwalletClientError::ServerError(
super::types::OperationError::internal_error("Missing signed_user_operation in response")
))?
let signed_user_op = signed_data
.get("signed_user_operation")
.ok_or_else(|| {
HyperwalletClientError::ServerError(super::types::OperationError::internal_error(
"Missing signed_user_operation in response",
))
})?
.clone();

let entry_point = signed_data.get("entry_point")

let entry_point = signed_data
.get("entry_point")
.and_then(|e| e.as_str())
.ok_or_else(|| HyperwalletClientError::ServerError(
super::types::OperationError::internal_error("Missing entry_point in response")
))?;

.ok_or_else(|| {
HyperwalletClientError::ServerError(super::types::OperationError::internal_error(
"Missing entry_point in response",
))
})?;

// Step 4: Submit UserOperation
let user_op_hash = submit_user_operation(
our,
Expand All @@ -575,10 +587,10 @@ pub fn execute_gasless_payment(
None, // Use default bundler
chain_id,
)?;

// Step 5: Get receipt (you might want to add polling with timeout)
let receipt = get_user_operation_receipt(our, &session, &user_op_hash, chain_id)?;

Ok(receipt)
}

Expand All @@ -604,7 +616,7 @@ pub fn build_and_sign_gasless_payment(
"paymaster_post_op_gas": "0x493e0"
}
});

let request = build_request(
our,
session_info,
Expand All @@ -625,20 +637,33 @@ pub fn submit_gasless_payment(
chain_id: Option<u64>,
) -> Result<String, HyperwalletClientError> {
// Extract signed UserOperation and entry point from the build response
let signed_user_op = signed_user_op_response.get("signed_user_operation")
.ok_or_else(|| HyperwalletClientError::ServerError(
super::types::OperationError::internal_error("Missing signed_user_operation in response")
))?
let signed_user_op = signed_user_op_response
.get("signed_user_operation")
.ok_or_else(|| {
HyperwalletClientError::ServerError(super::types::OperationError::internal_error(
"Missing signed_user_operation in response",
))
})?
.clone();

let entry_point = signed_user_op_response.get("entry_point")

let entry_point = signed_user_op_response
.get("entry_point")
.and_then(|e| e.as_str())
.ok_or_else(|| HyperwalletClientError::ServerError(
super::types::OperationError::internal_error("Missing entry_point in response")
))?;

.ok_or_else(|| {
HyperwalletClientError::ServerError(super::types::OperationError::internal_error(
"Missing entry_point in response",
))
})?;

// Submit using the extracted data
submit_user_operation(our, session_info, signed_user_op, entry_point, None, chain_id)
submit_user_operation(
our,
session_info,
signed_user_op,
entry_point,
None,
chain_id,
)
}

/// Get receipt with proper transaction hash extraction.
Expand All @@ -649,14 +674,15 @@ pub fn get_payment_receipt(
chain_id: Option<u64>,
) -> Result<(String, serde_json::Value), HyperwalletClientError> {
let receipt = get_user_operation_receipt(our, session_info, user_op_hash, chain_id)?;

// Extract transaction hash if available
let tx_hash = receipt.get("receipt")
let tx_hash = receipt
.get("receipt")
.and_then(|r| r.get("transactionHash"))
.and_then(|h| h.as_str())
.unwrap_or(user_op_hash) // Fallback to user op hash
.to_string();

Ok((tx_hash, receipt))
}

Expand Down
Loading