Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(modules): cover x402 authorization and isolate rpc env

Steven Enamakelbe6f55c91346
diff --git a/crates/openhuman-core/src/modules/host_tests.rs b/crates/openhuman-core/src/modules/host_tests.rs
index a2d8500c36..194e2a23cc 100644
--- a/crates/openhuman-core/src/modules/host_tests.rs
+++ b/crates/openhuman-core/src/modules/host_tests.rs
@@ -39,11 +39,21 @@ async fn wallet_host_callback_is_served_before_the_module_is_loaded() {
.expect("wallet callback contract names are valid");
let response: tinywallet_bus::wire::HostResponse = proxy
- .call(tinywallet_bus::names::host_methods::WALLET_ACCOUNTS, ())
+ .call(
+ tinywallet_bus::names::host_methods::AUTHORIZE_X402_PAYMENT,
+ tinywallet_bus::wire::AuthorizeX402PaymentRequest {
+ url: "https://resource.example/".into(),
+ network: "eip155:1".into(),
+ asset: "0x0000000000000000000000000000000000000001".into(),
+ recipient: "0x0000000000000000000000000000000000000002".into(),
+ amount_atomic: 1,
+ owner: None,
+ },
+ )
.await
.expect("the host must serve callbacks before resolving the wallet module");
assert!(matches!(
response,
- tinywallet_bus::wire::HostResponse::WalletAccounts(_)
+ tinywallet_bus::wire::HostResponse::Authorization(result) if !result.approved
));
}
diff --git a/crates/openhuman-core/src/modules/wallet_service_tests.rs b/crates/openhuman-core/src/modules/wallet_service_tests.rs
index 0f992035ec..86c10f1133 100644
--- a/crates/openhuman-core/src/modules/wallet_service_tests.rs
+++ b/crates/openhuman-core/src/modules/wallet_service_tests.rs
@@ -44,6 +44,7 @@ fn shutdown_hook_guard_allows_registration_after_hooks_are_drained() {
#[tokio::test]
async fn explicit_close_retains_state_for_retry_then_releases_user_state_once() {
+ let _rpc_env = crate::web3::wallet::test_support::UnreachableRpcGuard::set();
let mut active = Some(service());
active
.as_mut()