Skip to content

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

chore: rename `tinywallet` to `tinywallet_bus` across all wallet and x402 modules

Steven Enamakel96a6d3431560
diff --git a/src/openhuman/modules/wallet.rs b/src/openhuman/modules/wallet.rs
index 1dcfb6e80d..66f1157ce8 100644
--- a/src/openhuman/modules/wallet.rs
+++ b/src/openhuman/modules/wallet.rs
@@ -66,7 +66,7 @@
//! with which it is, and [`sign_payload`] dispatches on the tag rather than on
//! the chain — so a chain that changes scheme cannot silently sign wrongly.
-use tinywallet::wire::{
+use tinywallet_bus::wire::{
DerivedAccount, ExportRequest, ExportedKey, Scheme, SecretMaterial, SignMessageRequest,
SignRequest, Signature, SignedTransaction, TransactionSpec,
};
diff --git a/src/openhuman/modules/wallet_tests.rs b/src/openhuman/modules/wallet_tests.rs
index f018d0ffe1..126fb4adac 100644
--- a/src/openhuman/modules/wallet_tests.rs
+++ b/src/openhuman/modules/wallet_tests.rs
@@ -7,8 +7,8 @@
//! themselves are covered where they can be honest: `tinywallet`'s own loader
//! E2E, which drives a real module over a real broker.
-use tinywallet::wire::{Scheme, Signature, SigningPayload, TransactionSpec};
-use tinywallet::Chain;
+use tinywallet_bus::wire::{Scheme, Signature, SigningPayload, TransactionSpec};
+use tinywallet_bus::Chain;
use super::{classify, WalletCallError};
use crate::openhuman::config::Config;
@@ -37,8 +37,8 @@ fn failure(name: &str) -> tinybus::Error {
///
/// No key is derived here any more: the module does that. This is the request,
/// not the secret it produces.
-fn evm_signing_secret() -> tinywallet::wire::SecretMaterial {
- tinywallet::wire::SecretMaterial {
+fn evm_signing_secret() -> tinywallet_bus::wire::SecretMaterial {
+ tinywallet_bus::wire::SecretMaterial {
mnemonic: VECTOR.to_string(),
derivation_path: "m/44'/60'/0'/0/0".to_string(),
chain: Chain::Evm,
@@ -196,7 +196,7 @@ mod attestation_guard {
/// These assert the two shapes are genuinely distinct, so the wrapper cannot be
/// dropped again without a test failing.
mod request_shapes {
- use tinywallet::wire::{ExportRequest, SecretMaterial, SignMessageRequest, SignRequest};
+ use tinywallet_bus::wire::{ExportRequest, SecretMaterial, SignMessageRequest, SignRequest};
fn secret() -> SecretMaterial {
super::evm_signing_secret()
@@ -223,14 +223,14 @@ mod request_shapes {
let sign_message = serde_json::to_value(SignMessageRequest {
secret: secret(),
message_hex: "00".repeat(32),
- scheme: tinywallet::wire::Scheme::Secp256k1Prehash,
+ scheme: tinywallet_bus::wire::Scheme::Secp256k1Prehash,
})
.unwrap();
assert!(serde_json::from_value::<SignRequest>(sign_message).is_err());
assert!(serde_json::from_value::<ExportRequest>(
serde_json::to_value(SignRequest {
secret: secret(),
- transaction: tinywallet::wire::TransactionSpec::Evm {
+ transaction: tinywallet_bus::wire::TransactionSpec::Evm {
to: format!("0x{}", "11".repeat(20)),
value_wei: "1".to_string(),
data_hex: "0x".to_string(),
diff --git a/src/openhuman/web3/wallet/abi.rs b/src/openhuman/web3/wallet/abi.rs
index 10a8c3577e..4f9cce9fcb 100644
--- a/src/openhuman/web3/wallet/abi.rs
+++ b/src/openhuman/web3/wallet/abi.rs
@@ -5,7 +5,7 @@
//! grammar, a bignum, and their tails — to produce a four-byte selector
//! followed by two 32-byte words.
//!
-//! `tinywallet::abi` owns that encoding now, over `sha3` alone, and
+//! `tinywallet_bus::abi` owns that encoding now, over `sha3` alone, and
//! deliberately sits outside its `tx` gate: calldata is an *input* to building
//! a transaction, so a host that builds elsewhere still needs it locally rather
//! than paying a bus round trip for keccak over 68 bytes.
@@ -27,14 +27,14 @@
/// amount is not a non-negative integer that fits in 256 bits.
#[allow(unreachable_patterns)]
pub fn encode_erc20_transfer(to_address: &str, amount_raw: &str) -> Result<String, String> {
- tinywallet::abi::encode_erc20_transfer(to_address, amount_raw).map_err(|error| match error {
- tinywallet::abi::Error::InvalidRecipient { .. } => {
+ tinywallet_bus::abi::encode_erc20_transfer(to_address, amount_raw).map_err(|error| match error {
+ tinywallet_bus::abi::Error::InvalidRecipient { .. } => {
format!("invalid EVM recipient address '{to_address}': {error}")
}
// Preserves the wording the previous implementation used, because the
// agent tool's schema documents it and a model reads it to correct
// itself.
- tinywallet::abi::Error::InvalidAmount { .. } => {
+ tinywallet_bus::abi::Error::InvalidAmount { .. } => {
format!("amount '{amount_raw}' is not a valid non-negative integer")
}
_ => error.to_string(),
diff --git a/src/openhuman/web3/wallet/chains/btc.rs b/src/openhuman/web3/wallet/chains/btc.rs
index 31662c0a16..d96466b224 100644
--- a/src/openhuman/web3/wallet/chains/btc.rs
+++ b/src/openhuman/web3/wallet/chains/btc.rs
@@ -56,12 +56,12 @@ pub fn estimated_btc_fee_sats() -> u64 {
/// Used for recipients (we don't care what address type they prefer; the
/// `bitcoin` crate's script_pubkey() will encode P2WPKH/P2TR/P2SH correctly).
///
-/// Delegates to the vendored [`tinywallet`] crate, which owns the address
+/// Delegates to the vendored [`tinywallet_bus`] crate, which owns the address
/// format itself. Nothing about parsing a Bitcoin address is OpenHuman-
/// specific, so the rules live where any host can reach them; what stays here
/// is the `Result<_, String>` shape the rest of this domain speaks.
pub fn validate_btc_address(addr: &str) -> Result<String, String> {
- let result = tinywallet::address::btc::validate(addr).map_err(|e| e.to_string());
+ let result = tinywallet_bus::address::btc::validate(addr).map_err(|e| e.to_string());
debug!(
"{LOG_PREFIX} validate_address role=recipient result={}",
if result.is_ok() {
@@ -81,7 +81,7 @@ pub fn validate_btc_address(addr: &str) -> Result<String, String> {
/// the recipient rule for a sender accepts an address that only fails later,
/// at signing time.
pub fn validate_btc_sender_address(addr: &str) -> Result<String, String> {
- let result = tinywallet::address::btc::validate_sender(addr).map_err(|e| e.to_string());
+ let result = tinywallet_bus::address::btc::validate_sender(addr).map_err(|e| e.to_string());
debug!(
"{LOG_PREFIX} validate_address role=sender result={}",
if result.is_ok() {
@@ -123,7 +123,7 @@ pub async fn broadcast_raw_hex(tx_hex: &str) -> Result<String, String> {
/// Derive the P2WPKH signing key for `derivation_path` from a BIP-39 mnemonic.
///
-/// Delegates to the vendored [`tinywallet`] crate, which owns BIP-32
+/// Delegates to the vendored [`tinywallet_bus`] crate, which owns BIP-32
/// secp256k1 derivation. Custody stays here: the mnemonic is decrypted from
/// the keyring by this crate and handed over as a `&str` that is not retained.
/// Test-only: production derives inside the wallet module.
@@ -206,10 +206,10 @@ pub async fn execute_btc_quote(mut quote: PreparedTransaction) -> Result<Executi
// private key is reassembled here. The phrase travels over a confidential
// call to a module that has proved it is an artifact this build pinned —
// see `modules::wallet::attested_proxy`.
- let signing_secret = tinywallet::wire::SecretMaterial {
+ let signing_secret = tinywallet_bus::wire::SecretMaterial {
mnemonic,
derivation_path: secret.derivation_path.clone(),
- chain: tinywallet::Chain::Btc,
+ chain: tinywallet_bus::Chain::Btc,
};
// Selection stays here — this crate knows the fee policy and the UTXO
@@ -219,14 +219,14 @@ pub async fn execute_btc_quote(mut quote: PreparedTransaction) -> Result<Executi
// in agreement: the module's `select_coins` and `select_utxos` above are
// the same algorithm, down to the 546-sat dust rule, so it reselects
// exactly what was chosen here.
- let transaction = tinywallet::wire::TransactionSpec::Btc {
+ let transaction = tinywallet_bus::wire::TransactionSpec::Btc {
from: from_addr.clone(),
to: to_addr.clone(),
amount_sat: amount_sats,
fee_sat: fee_sats,
utxos: selected
.iter()
- .map(|utxo| tinywallet::wire::Utxo {
+ .map(|utxo| tinywallet_bus::wire::Utxo {
txid: utxo.txid.clone(),
vout: utxo.vout,
value: utxo.value,
diff --git a/src/openhuman/web3/wallet/chains/evm.rs b/src/openhuman/web3/wallet/chains/evm.rs
index 8f115ddfe4..fec242617e 100644
--- a/src/openhuman/web3/wallet/chains/evm.rs
+++ b/src/openhuman/web3/wallet/chains/evm.rs
@@ -58,13 +58,13 @@ async fn sign_and_broadcast(
//
// The module is only sent the phrase once it has proved it is an artifact
// this build pinned — see `modules::wallet::attested_proxy`.
- let signing_secret = tinywallet::wire::SecretMaterial {
+ let signing_secret = tinywallet_bus::wire::SecretMaterial {
mnemonic,
derivation_path: secret.derivation_path.clone(),
- chain: tinywallet::Chain::Evm,
+ chain: tinywallet_bus::Chain::Evm,
};
- let to = tinywallet::address::evm::validate(to)
+ let to = tinywallet_bus::address::evm::validate(to)
.map_err(|e| format!("invalid EVM target address '{to}': {e}"))?;
let chain_id_hex: String = rpc_call_to(&rpc_url, "eth_chainId", json!([])).await?;
@@ -106,7 +106,7 @@ async fn sign_and_broadcast(
let gas_limit = u64::try_from(hex_to_u128(&gas_hex)?)
.map_err(|_| format!("EVM RPC reported an implausible gas limit '{gas_hex}'"))?;
- let transaction = tinywallet::wire::TransactionSpec::Evm {
+ let transaction = tinywallet_bus::wire::TransactionSpec::Evm {
to,
value_wei: value.to_string(),
data_hex: tx_data.unwrap_or_default(),
@@ -141,7 +141,7 @@ pub async fn execute_evm_quote(mut quote: PreparedTransaction) -> Result<Executi
let (tx_to, tx_value, tx_data) = match quote.kind {
// A native transfer pays the recipient directly and carries no data.
PreparedKind::NativeTransfer => (
- tinywallet::address::evm::validate(&quote.to_address).map_err(|e| {
+ tinywallet_bus::address::evm::validate(&quote.to_address).map_err(|e| {
format!("invalid EVM recipient address '{}': {e}", quote.to_address)
})?,
quote.amount_raw.clone(),
@@ -156,7 +156,7 @@ pub async fn execute_evm_quote(mut quote: PreparedTransaction) -> Result<Executi
.ok_or_else(|| "prepared token transfer is missing token_address".to_string())?;
let calldata = encode_erc20_transfer(&quote.to_address, &quote.amount_raw)?;
(
- tinywallet::address::evm::validate(token)
+ tinywallet_bus::address::evm::validate(token)
.map_err(|e| format!("invalid ERC20 token contract address '{token}': {e}"))?,
"0".to_string(),
Some(calldata),
@@ -340,13 +340,13 @@ pub async fn lookup_tx(network: EvmNetwork, hash: &str) -> Result<TxLookupInfo,
/// Validate an EVM address (20 bytes, 40 hex digits, optional `0x`).
///
-/// Delegates to the vendored [`tinywallet`] crate, which owns the address
+/// Delegates to the vendored [`tinywallet_bus`] crate, which owns the address
/// format; this wrapper keeps the `Result<_, String>` shape the rest of the
/// domain speaks. Accepts exactly what the previous `ethers-core` based check
/// accepted — prefixed, unprefixed, and any hex case, but not an uppercase
/// `0X` prefix.
pub fn validate_evm_address(addr: &str) -> Result<String, String> {
- let result = tinywallet::address::evm::validate(addr).map_err(|e| e.to_string());
+ let result = tinywallet_bus::address::evm::validate(addr).map_err(|e| e.to_string());
debug!(
"{LOG_PREFIX} validate_address result={}",
if result.is_ok() {
diff --git a/src/openhuman/web3/wallet/chains/solana.rs b/src/openhuman/web3/wallet/chains/solana.rs
index e523905e12..751be6b5f2 100644
--- a/src/openhuman/web3/wallet/chains/solana.rs
+++ b/src/openhuman/web3/wallet/chains/solana.rs
@@ -63,11 +63,11 @@ struct BlockhashValue {
/// Validate a Solana address (a base58 ed25519 public key).
///
-/// Delegates to the vendored [`tinywallet`] crate, which owns the address
+/// Delegates to the vendored [`tinywallet_bus`] crate, which owns the address
/// format; this wrapper keeps the `Result<_, String>` shape the rest of the
/// domain speaks.
pub fn validate_solana_address(addr: &str) -> Result<String, String> {
- let result = tinywallet::address::solana::validate(addr).map_err(|e| e.to_string());
+ let result = tinywallet_bus::address::solana::validate(addr).map_err(|e| e.to_string());
debug!(
"{LOG_PREFIX} validate_address result={}",
if result.is_ok() {
@@ -92,7 +92,7 @@ pub async fn native_balance(address: &str) -> Result<u128, String> {
/// Derive the Solana signing key for `derivation_path` from a BIP-39 mnemonic.
///
-/// Delegates to the vendored [`tinywallet`] crate, which owns SLIP-0010
+/// Delegates to the vendored [`tinywallet_bus`] crate, which owns SLIP-0010
/// ed25519 derivation. The hand-rolled HMAC walk and path parser that used to
/// live here moved there wholesale — nothing about "derive an ed25519 key at a
/// hardened path" is OpenHuman-specific. Custody stays here: the mnemonic
@@ -254,7 +254,7 @@ fn pubkey_to_b58(pubkey: &[u8; 32]) -> String {
/// the attestation guard. The local branch cannot exist in a shipped binary.
async fn solana_signer(
config: &crate::openhuman::config::Config,
-) -> Result<(tinywallet::wire::SecretMaterial, [u8; 32]), String> {
+) -> Result<(tinywallet_bus::wire::SecretMaterial, [u8; 32]), String> {
let secret = secret_material(WalletChain::Solana).await?;
let mnemonic = crate::openhuman::security::encryption::rpc::decrypt_secret(
config,
@@ -262,10 +262,10 @@ async fn solana_signer(
)
.await?
.value;
- let signing_secret = tinywallet::wire::SecretMaterial {
+ let signing_secret = tinywallet_bus::wire::SecretMaterial {
mnemonic,
derivation_path: secret.derivation_path.clone(),
- chain: tinywallet::Chain::Solana,
+ chain: tinywallet_bus::Chain::Solana,
};
#[cfg(test)]
{
@@ -288,7 +288,7 @@ async fn solana_signer(
/// Sign `message` with the wallet key, inside the module.
async fn solana_sign(
config: &crate::openhuman::config::Config,
- signing_secret: &tinywallet::wire::SecretMaterial,
+ signing_secret: &tinywallet_bus::wire::SecretMaterial,
message: &[u8],
) -> Result<[u8; 64], String> {
#[cfg(test)]
@@ -304,13 +304,13 @@ async fn solana_sign(
config,
signing_secret,
message,
- tinywallet::wire::Scheme::Ed25519,
+ tinywallet_bus::wire::Scheme::Ed25519,
)
.await
.map_err(|e| format!("failed to sign the Solana message: {e}"))?;
#[cfg(not(test))]
{
- let tinywallet::wire::Signature::Ed25519 { signature_hex } = signature else {
+ let tinywallet_bus::wire::Signature::Ed25519 { signature_hex } = signature else {
return Err("the wallet module returned a non-ed25519 Solana signature".to_string());
};
let bytes = hex_to_bytes(&signature_hex)?;
@@ -699,10 +699,10 @@ pub(crate) async fn tinyplace_signer_seed() -> Result<[u8; 32], String> {
)
.await?
.value;
- let signing_secret = tinywallet::wire::SecretMaterial {
+ let signing_secret = tinywallet_bus::wire::SecretMaterial {
mnemonic,
derivation_path: secret.derivation_path.clone(),
- chain: tinywallet::Chain::Solana,
+ chain: tinywallet_bus::Chain::Solana,
};
// The one path that brings a private key back into this process. Every
diff --git a/src/openhuman/web3/wallet/chains/tron.rs b/src/openhuman/web3/wallet/chains/tron.rs
index 1832205f9c..3eaba69004 100644
--- a/src/openhuman/web3/wallet/chains/tron.rs
+++ b/src/openhuman/web3/wallet/chains/tron.rs
@@ -27,11 +27,11 @@ const TRC20_FEE_LIMIT_SUN: u64 = 15_000_000;
/// Validate a Tron mainnet base58check address.
///
-/// Delegates to the vendored [`tinywallet`] crate, which owns the address
+/// Delegates to the vendored [`tinywallet_bus`] crate, which owns the address
/// format; this wrapper keeps the `Result<_, String>` shape the rest of the
/// domain speaks.
pub fn validate_tron_address(addr: &str) -> Result<String, String> {
- let result = tinywallet::address::tron::validate(addr).map_err(|e| e.to_string());
+ let result = tinywallet_bus::address::tron::validate(addr).map_err(|e| e.to_string());
debug!(
"{LOG_PREFIX} validate_address result={}",
if result.is_ok() {
@@ -46,13 +46,13 @@ pub fn validate_tron_address(addr: &str) -> Result<String, String> {
/// Convert a base58check Tron address into the 42-hex-digit form the TronGrid
/// API expects, version prefix included.
///
-/// Delegates to [`tinywallet`]. Note this now validates the address before
+/// Delegates to [`tinywallet_bus`]. Note this now validates the address before
/// converting, where the previous local implementation decoded without a
/// length check — a malformed address that happened to base58check-decode to
/// the wrong length used to produce a short hex string and fail further
/// downstream at the API call.
pub fn tron_address_to_hex(addr: &str) -> Result<String, String> {
- let result = tinywallet::address::tron::to_hex(addr).map_err(|e| e.to_string());
+ let result = tinywallet_bus::address::tron::to_hex(addr).map_err(|e| e.to_string());
debug!(
"{LOG_PREFIX} address_to_hex result={}",
if result.is_ok() {
@@ -92,27 +92,27 @@ struct TriggerSmartContractResponse {
/// What the node was asked to build, for verifying what it returned.
///
-/// [`tinywallet::wire::TronTransfer`] is that type — it is already on the
+/// [`tinywallet_bus::wire::TronTransfer`] is that type — it is already on the
/// host/module wire contract, so a second local mirror of it would be one more
/// thing to keep in step for no gain. The one thing it deliberately does not
/// carry is the fee limit, because only the caller knows what it pinned; that
/// rides alongside as [`verify_contract`]'s last argument.
-type TronTransferVerification = tinywallet::wire::TronTransfer;
+type TronTransferVerification = tinywallet_bus::wire::TronTransfer;
/// Check a node-built Tron transaction, then describe it for the signer.
///
-/// The verification itself lives in [`tinywallet::tx::tron::verify_contract`],
+/// The verification itself lives in [`tinywallet_bus::tx::tron::verify_contract`],
/// which parses `raw_data` structurally. The protobuf reader, the contract
/// unwrapping and the per-contract field checks used to be hand-rolled here;
/// they are the same rules for every host, so they moved into the crate. What
/// stays is the part that is OpenHuman's: the fee limit this client pins, and
-/// the [`tinywallet::wire::TransactionSpec`] handed to the wallet module.
+/// the [`tinywallet_bus::wire::TransactionSpec`] handed to the wallet module.
fn tron_transaction_spec(
raw_tx: &CreateTransactionResponse,
expected_to: String,
transfer: &TronTransferVerification,
-) -> Result<tinywallet::wire::TransactionSpec, String> {
- let recomputed_txid = tinywallet::tx::tron::recompute_txid(&raw_tx.raw_data_hex)
+) -> Result<tinywallet_bus::wire::TransactionSpec, String> {
+ let recomputed_txid = tinywallet_bus::tx::tron::recompute_txid(&raw_tx.raw_data_hex)
.map_err(|error| format!("invalid Tron raw_data_hex: {error}"))?;
// The fee limit is ours, not the crate's: it is what this client pinned in
@@ -122,7 +122,7 @@ fn tron_transaction_spec(
TronTransferVerification::Trc20 { .. } => Some(TRC20_FEE_LIMIT_SUN),
};
- tinywallet::tx::tron::verify_contract(
+ tinywallet_bus::tx::tron::verify_contract(
&raw_tx.raw_data_hex,
&expected_to,
&raw_tx.tx_id,
@@ -131,7 +131,7 @@ fn tron_transaction_spec(
)
.map_err(|error| format!("Tron node response rejected: {error}"))?;
- Ok(tinywallet::wire::TransactionSpec::Tron {
+ Ok(tinywallet_bus::wire::TransactionSpec::Tron {
raw_data_hex: raw_tx.raw_data_hex.clone(),
expected_to,
expected_txid: recomputed_txid,
@@ -143,7 +143,7 @@ fn tron_transaction_spec(
/// Derive the Tron signing key and its base58check address.
///
-/// Delegates to the vendored [`tinywallet`] crate, which owns BIP-32
+/// Delegates to the vendored [`tinywallet_bus`] crate, which owns BIP-32
/// secp256k1 derivation and the Keccak-then-base58check address construction.
/// The hand-rolled BIP-32 walk and path parser that used to live here moved
/// there wholesale. Custody stays here.
@@ -252,10 +252,10 @@ pub async fn execute_tron_quote(mut quote: PreparedTransaction) -> Result<Execut
// this process never holds the key. The phrase goes over a confidential
// call, and only to a module that has proved it is an artifact this build
// pinned — see `modules::wallet::attested_proxy`.
- let signing_secret = tinywallet::wire::SecretMaterial {
+ let signing_secret = tinywallet_bus::wire::SecretMaterial {
mnemonic,
derivation_path: secret.derivation_path.clone(),
- chain: tinywallet::Chain::Tron,
+ chain: tinywallet_bus::Chain::Tron,
};
let derived_addr = crate::openhuman::modules::wallet::derive_account(&config, &signing_secret)
.await
@@ -521,13 +521,13 @@ mod tests {
}
fn push_varint_field(out: &mut Vec<u8>, number: u64, value: u64) {
- out.extend(tinywallet::tx::proto::encode_varint(number << 3));
- out.extend(tinywallet::tx::proto::encode_varint(value));
+ out.extend(tinywallet_bus::tx::proto::encode_varint(number << 3));
+ out.extend(tinywallet_bus::tx::proto::encode_varint(value));
}
fn push_bytes_field(out: &mut Vec<u8>, number: u64, value: &[u8]) {
- out.extend(tinywallet::tx::proto::encode_varint((number << 3) | 2));
- out.extend(tinywallet::tx::proto::encode_varint(value.len() as u64));
+ out.extend(tinywallet_bus::tx::proto::encode_varint((number << 3) | 2));
+ out.extend(tinywallet_bus::tx::proto::encode_varint(value.len() as u64));
out.extend(value);
}
@@ -599,7 +599,7 @@ mod tests {
let recipient = payload["to_address"].as_str().unwrap();
let amount = payload["amount"].as_u64().unwrap();
let raw = native_raw(recipient, amount);
- let txid = tinywallet::tx::tron::recompute_txid(&raw).unwrap();
+ let txid = tinywallet_bus::tx::tron::recompute_txid(&raw).unwrap();
create.lock().push(payload);
axum::Json(json!({
"txID": txid,
@@ -617,7 +617,7 @@ mod tests {
let contract = payload["contract_address"].as_str().unwrap();
let parameter = payload["parameter"].as_str().unwrap();
let raw = trc20_raw(contract, parameter);
- let txid = tinywallet::tx::tron::recompute_txid(&raw).unwrap();
+ let txid = tinywallet_bus::tx::tron::recompute_txid(&raw).unwrap();
trigger.lock().push(payload);
axum::Json(json!({
"transaction": {
@@ -658,7 +658,7 @@ mod tests {
let contract_hex = tron_address_to_hex(contract).unwrap();
let native_raw_hex = native_raw(&recipient_hex, 1_000_000);
- let native_txid = tinywallet::tx::tron::recompute_txid(&native_raw_hex).unwrap();
+ let native_txid = tinywallet_bus::tx::tron::recompute_txid(&native_raw_hex).unwrap();
let native_tx = CreateTransactionResponse {
tx_id: native_txid.clone(),
raw_data: json!({}),
@@ -674,7 +674,7 @@ mod tests {
.unwrap();
assert_eq!(
native,
- tinywallet::wire::TransactionSpec::Tron {
+ tinywallet_bus::wire::TransactionSpec::Tron {
raw_data_hex: native_raw_hex,
expected_to: recipient.to_string(),
expected_txid: native_txid,
@@ -688,7 +688,7 @@ mod tests {
let parameter = "01".repeat(64);
let token_raw = trc20_raw(&contract_hex, &parameter);
- let token_txid = tinywallet::tx::tron::recompute_txid(&token_raw).unwrap();
+ let token_txid = tinywallet_bus::tx::tron::recompute_txid(&token_raw).unwrap();
let token_tx = CreateTransactionResponse {
tx_id: token_txid.clone(),
raw_data: json!({}),
@@ -704,7 +704,7 @@ mod tests {
.unwrap();
assert_eq!(
token,
- tinywallet::wire::TransactionSpec::Tron {
+ tinywallet_bus::wire::TransactionSpec::Tron {
raw_data_hex: token_raw,
expected_to: contract.to_string(),
expected_txid: token_txid,
@@ -753,7 +753,7 @@ mod tests {
),
] {
let altered_tx = CreateTransactionResponse {
- tx_id: tinywallet::tx::tron::recompute_txid(&raw_data_hex).unwrap(),
+ tx_id: tinywallet_bus::tx::tron::recompute_txid(&raw_data_hex).unwrap(),
raw_data: json!({}),
raw_data_hex,
};
@@ -772,11 +772,11 @@ mod tests {
// satisfy validation when the selected contract pays something else.
let mut spoofed_raw = hex::decode(native_raw(&contract_hex, 2)).unwrap();
let mut decoy = hex::decode(&recipient_hex).unwrap();
- decoy.extend(tinywallet::tx::proto::encode_varint(1_000_000));
+ decoy.extend(tinywallet_bus::tx::proto::encode_varint(1_000_000));
push_bytes_field(&mut spoofed_raw, 10, &decoy);
let spoofed_raw = hex::encode(spoofed_raw);
let spoofed_tx = CreateTransactionResponse {
- tx_id: tinywallet::tx::tron::recompute_txid(&spoofed_raw).unwrap(),
+ tx_id: tinywallet_bus::tx::tron::recompute_txid(&spoofed_raw).unwrap(),
raw_data: json!({}),
raw_data_hex: spoofed_raw,
};
@@ -942,7 +942,7 @@ mod tests {
let recipient = payload["to_address"].as_str().unwrap();
let amount = payload["amount"].as_u64().unwrap();
let raw = native_raw(recipient, amount);
- let txid = tinywallet::tx::tron::recompute_txid(&raw).unwrap();
+ let txid = tinywallet_bus::tx::tron::recompute_txid(&raw).unwrap();
axum::Json(json!({
"txID": txid,
"raw_data": {"contract": []},
diff --git a/src/openhuman/web3/wallet/execution.rs b/src/openhuman/web3/wallet/execution.rs
index 8527718438..a7e48870b0 100644
--- a/src/openhuman/web3/wallet/execution.rs
+++ b/src/openhuman/web3/wallet/execution.rs
@@ -346,10 +346,10 @@ pub(crate) fn validate_amount(raw: &str) -> Result<u128, String> {
/// Validate `addr` for `chain`, returning it trimmed.
///
-/// Every arm delegates to the vendored [`tinywallet`] crate, which owns the
+/// Every arm delegates to the vendored [`tinywallet_bus`] crate, which owns the
/// four address formats. The dispatch stays here rather than calling
-/// `tinywallet::address::validate` directly because [`WalletChain`] is
-/// OpenHuman's enum, and mapping it onto `tinywallet::Chain` here keeps that
+/// `tinywallet_bus::address::validate` directly because [`WalletChain`] is
+/// OpenHuman's enum, and mapping it onto `tinywallet_bus::Chain` here keeps that
/// translation in one place.
///
/// For Bitcoin this is the **recipient** rule — any well-formed mainnet
@@ -358,13 +358,13 @@ pub(crate) fn validate_amount(raw: &str) -> Result<u128, String> {
/// the other three chains, so it cannot be expressed through this entry point.
fn validate_address(chain: WalletChain, addr: &str) -> Result<String, String> {
let tw_chain = match chain {
- WalletChain::Evm => tinywallet::Chain::Evm,
- WalletChain::Btc => tinywallet::Chain::Btc,
- WalletChain::Solana => tinywallet::Chain::Solana,
- WalletChain::Tron => tinywallet::Chain::Tron,
+ WalletChain::Evm => tinywallet_bus::Chain::Evm,
+ WalletChain::Btc => tinywallet_bus::Chain::Btc,
+ WalletChain::Solana => tinywallet_bus::Chain::Solana,
+ WalletChain::Tron => tinywallet_bus::Chain::Tron,
};
debug!("{LOG_PREFIX} validate_address chain={chain:?} role=recipient dispatch=tinywallet");
- let result = tinywallet::address::validate(tw_chain, addr).map_err(|e| e.to_string());
+ let result = tinywallet_bus::address::validate(tw_chain, addr).map_err(|e| e.to_string());
debug!(
"{LOG_PREFIX} validate_address chain={chain:?} role=recipient result={}",
if result.is_ok() {
diff --git a/src/openhuman/web3/wallet/transport.rs b/src/openhuman/web3/wallet/transport.rs
index 3dba7ede1e..85138cbcb9 100644
--- a/src/openhuman/web3/wallet/transport.rs
+++ b/src/openhuman/web3/wallet/transport.rs
@@ -1,8 +1,8 @@
-//! OpenHuman's implementation of the [`tinywallet::rpc::Transport`] seam.
+//! OpenHuman's implementation of the [`tinywallet_bus::rpc::Transport`] seam.
//!
//! `tinywallet` performs no I/O and takes no URLs: it names a
-//! [`NetworkId`](tinywallet::rpc::NetworkId) and asks a host to reach it. This
-//! module is that host side — the adapter that lets `tinywallet::rpc` and
+//! [`NetworkId`](tinywallet_bus::rpc::NetworkId) and asks a host to reach it. This
+//! module is that host side — the adapter that lets `tinywallet_bus::rpc` and
//! the chain modules run against OpenHuman's existing RPC layer.
//!
//! Everything the crate deliberately refused to own lives on this side of the
@@ -32,7 +32,7 @@
use async_trait::async_trait;
use log::debug;
use serde_json::Value;
-use tinywallet::rpc::{NetworkId, Transport, TransportError, TransportResult};
+use tinywallet_bus::rpc::{NetworkId, Transport, TransportError, TransportResult};
use super::defaults::{rpc_url_for_chain, rpc_url_for_evm_network, EvmNetwork};
use super::ops::WalletChain;
@@ -57,7 +57,7 @@ impl OpenHumanTransport {
#[allow(unreachable_patterns)]
fn resolve(network: NetworkId) -> Result<String, TransportError> {
match network.chain {
- tinywallet::Chain::Evm => {
+ tinywallet_bus::Chain::Evm => {
// An EVM request names its EIP-155 chain id; resolving it here is
// what keeps `tinywallet` free of OpenHuman's network enum.
let chain_id = network.evm_chain_id.ok_or_else(|| TransportError::Rpc {
@@ -74,10 +74,10 @@ fn resolve(network: NetworkId) -> Result<String, TransportError> {
})?;
Ok(rpc_url_for_evm_network(evm))
}
- tinywallet::Chain::Btc => Ok(rpc_url_for_chain(WalletChain::Btc)),
- tinywallet::Chain::Solana => Ok(rpc_url_for_chain(WalletChain::Solana)),
- tinywallet::Chain::Tron => Ok(rpc_url_for_chain(WalletChain::Tron)),
- // `tinywallet::Chain` is `#[non_exhaustive]`, so a future variant must
+ tinywallet_bus::Chain::Btc => Ok(rpc_url_for_chain(WalletChain::Btc)),
+ tinywallet_bus::Chain::Solana => Ok(rpc_url_for_chain(WalletChain::Solana)),
+ tinywallet_bus::Chain::Tron => Ok(rpc_url_for_chain(WalletChain::Tron)),
+ // `tinywallet_bus::Chain` is `#[non_exhaustive]`, so a future variant must
// be handled. Reporting it as authoritative is correct: no endpoint is
// configured for it, and retrying elsewhere cannot change that.
other => Err(TransportError::Rpc {
@@ -238,7 +238,7 @@ mod tests {
#[test]
fn an_evm_request_without_a_chain_id_is_authoritative_not_retryable() {
- let err = resolve(NetworkId::chain(tinywallet::Chain::Evm)).unwrap_err();
+ let err = resolve(NetworkId::chain(tinywallet_bus::Chain::Evm)).unwrap_err();
assert!(!err.is_retryable(), "{err}");
}
@@ -253,9 +253,9 @@ mod tests {
#[test]
fn every_non_evm_chain_resolves() {
for chain in [
- tinywallet::Chain::Btc,
- tinywallet::Chain::Solana,
- tinywallet::Chain::Tron,
+ tinywallet_bus::Chain::Btc,
+ tinywallet_bus::Chain::Solana,
+ tinywallet_bus::Chain::Tron,
] {
assert!(resolve(NetworkId::chain(chain)).is_ok(), "{chain}");
}
@@ -265,7 +265,7 @@ mod tests {
fn transport_failures_are_retryable_and_everything_else_is_not() {
// The conservative direction: only what this layer knows to be a
// transport failure may drive a failover.
- let network = NetworkId::chain(tinywallet::Chain::Btc);
+ let network = NetworkId::chain(tinywallet_bus::Chain::Btc);
assert!(
classify(network, "wallet RPC transport failed for x: refused".into()).is_retryable()
);
diff --git a/src/openhuman/web3/x402/ops.rs b/src/openhuman/web3/x402/ops.rs
index a3b1cbfa8f..85544e1aa5 100644
--- a/src/openhuman/web3/x402/ops.rs
+++ b/src/openhuman/web3/x402/ops.rs
@@ -308,7 +308,7 @@ pub async fn handle_402_and_pay(
async fn wallet_signer() -> Result<
(
crate::openhuman::config::Config,
- tinywallet::wire::SecretMaterial,
+ tinywallet_bus::wire::SecretMaterial,
[u8; 32],
),
X402Error,
@@ -331,10 +331,10 @@ async fn wallet_signer() -> Result<
.map_err(|e| X402Error::Wallet(format!("decrypt mnemonic: {e}")))?
.value;
- let signing_secret = tinywallet::wire::SecretMaterial {
+ let signing_secret = tinywallet_bus::wire::SecretMaterial {
mnemonic,
derivation_path: secret.derivation_path.clone(),
- chain: tinywallet::Chain::Solana,
+ chain: tinywallet_bus::Chain::Solana,
};
let account = crate::openhuman::modules::wallet::derive_account(&config, &signing_secret)
.await
@@ -453,7 +453,7 @@ fn parse_settlement_response(b64_str: &str) -> Result<SettlementResponse, String
/// 3. Memo (if extra.memo set, otherwise random 16-byte hex nonce)
async fn build_solana_payment(
config: &crate::openhuman::config::Config,
- signing_secret: &tinywallet::wire::SecretMaterial,
+ signing_secret: &tinywallet_bus::wire::SecretMaterial,
our_pubkey: [u8; 32],
challenge: &PaymentRequired,
req: &PaymentRequirements,
@@ -531,11 +531,11 @@ async fn build_solana_payment(
config,
signing_secret,
&message,
- tinywallet::wire::Scheme::Ed25519,
+ tinywallet_bus::wire::Scheme::Ed25519,
)
.await
.map_err(|e| X402Error::Wallet(format!("sign payment: {e}")))?;
- let tinywallet::wire::Signature::Ed25519 { signature_hex } = signature else {
+ let tinywallet_bus::wire::Signature::Ed25519 { signature_hex } = signature else {
return Err(X402Error::Wallet(
"the wallet module returned a non-ed25519 signature".to_string(),
));
@@ -582,11 +582,11 @@ async fn build_evm_payment(
&config,
&signing_secret,
&authorization.digest,
- tinywallet::wire::Scheme::Secp256k1Prehash,
+ tinywallet_bus::wire::Scheme::Secp256k1Prehash,
)
.await
.map_err(|e| X402Error::Wallet(format!("sign EIP-3009: {e}")))?;
- let tinywallet::wire::Signature::Secp256k1 {
+ let tinywallet_bus::wire::Signature::Secp256k1 {
rs_hex,
recovery_id,
} = signature
@@ -631,7 +631,7 @@ pub(crate) fn evm_payment_authorization(
from_address: &str,
req: &PaymentRequirements,
) -> Result<EvmPaymentAuthorization, X402Error> {
- use tinywallet::eip712;
+ use tinywallet_bus::eip712;
let chain_id = req
.evm_chain_id()
@@ -745,13 +745,13 @@ pub(crate) fn evm_payment_payload(
/// Derive the wallet's EVM signing key from the encrypted mnemonic.
///
/// Returns the raw secret and the checksummed address it controls. Derivation
-/// goes through `tinywallet::key` — the same BIP-32 walk the wallet domain uses,
+/// goes through `tinywallet_bus::key` — the same BIP-32 walk the wallet domain uses,
/// so an x402 payment is signed by exactly the account the wallet reports — and
/// the key stays in this process.
async fn evm_signer() -> Result<
(
crate::openhuman::config::Config,
- tinywallet::wire::SecretMaterial,
+ tinywallet_bus::wire::SecretMaterial,
String,
),
X402Error,
@@ -774,10 +774,10 @@ async fn evm_signer() -> Result<
.map_err(|e| X402Error::Wallet(format!("decrypt mnemonic: {e}")))?
.value;
- let signing_secret = tinywallet::wire::SecretMaterial {
+ let signing_secret = tinywallet_bus::wire::SecretMaterial {
mnemonic,
derivation_path: secret.derivation_path.clone(),
- chain: tinywallet::Chain::Evm,
+ chain: tinywallet_bus::Chain::Evm,
};
let account = crate::openhuman::modules::wallet::derive_account(&config, &signing_secret)
.await
@@ -823,7 +823,7 @@ pub(crate) fn build_evm_payment_with_signer(
/// The 20 raw bytes of an EVM address.
fn evm_address_bytes(address: &str) -> Result<[u8; 20], X402Error> {
- let validated = tinywallet::address::evm::validate(address)
+ let validated = tinywallet_bus::address::evm::validate(address)
.map_err(|e| X402Error::Protocol(format!("invalid EVM address '{address}': {e}")))?;
let body = validated.strip_prefix("0x").unwrap_or(&validated);
let decoded = hex::decode(body)
diff --git a/src/openhuman/web3/x402/x402_tests.rs b/src/openhuman/web3/x402/x402_tests.rs
index a0e3ad8147..446a187801 100644
--- a/src/openhuman/web3/x402/x402_tests.rs
+++ b/src/openhuman/web3/x402/x402_tests.rs
@@ -394,11 +394,11 @@ fn solana_payment_proof_serializes_correctly() {
#[test]
fn eip712_domain_separator_is_deterministic() {
- // Now `tinywallet::eip712`; the crate's own suite pins its hashes against
+ // Now `tinywallet_bus::eip712`; the crate's own suite pins its hashes against
// the published EIP-712/EIP-3009 vectors. What this test checks is the
// property that matters at this layer: the separator is deterministic and
// binds the chain, so an authorization cannot be replayed on another one.
- use tinywallet::eip712::domain_separator;
+ use tinywallet_bus::eip712::domain_separator;
let contract = base_usdc();
let sep1 = domain_separator(contract, 8453, "USD Coin", "2");
@@ -411,7 +411,7 @@ fn eip712_domain_separator_is_deterministic() {
/// The BIP-39 vector mnemonic's EVM account: raw secret and its address.
///
-/// Derived through `tinywallet::key`, which is what the production path uses,
+/// Derived through `tinywallet_bus::key`, which is what the production path uses,
/// so the test signs as exactly the account the wallet would.
fn test_signer() -> (Vec<u8>, String) {
let test_mnemonic = "abandon abandon abandon abandon abandon abandon \
@@ -436,7 +436,7 @@ fn address_bytes(hex: &str) -> [u8; 20] {
#[test]
fn eip3009_struct_hash_is_deterministic() {
- use tinywallet::eip712::{transfer_with_authorization_hash, u256_from_u64};
+ use tinywallet_bus::eip712::{transfer_with_authorization_hash, u256_from_u64};
let from = address_bytes(&"aa".repeat(20));
let to = address_bytes(&"bb".repeat(20));
@@ -532,7 +532,7 @@ fn build_evm_payment_with_test_key_produces_valid_payload() {
assert_eq!(evm.authorization.value, "2500");
assert_eq!(evm.authorization.valid_after, "0");
assert!(evm.authorization.nonce.starts_with("0x"));
- // Checksummed, as `tinywallet::address::evm` renders it, and as
+ // Checksummed, as `tinywallet_bus::address::evm` renders it, and as
// the requirement itself carried it.
assert_eq!(
evm.authorization.to,
@@ -541,7 +541,7 @@ fn build_evm_payment_with_test_key_produces_valid_payload() {
assert_eq!(evm.authorization.from, from_address);
use k256::ecdsa::{RecoveryId, Signature, VerifyingKey};
- use tinywallet::eip712;
+ use tinywallet_bus::eip712;
let raw = hex::decode(evm.signature.trim_start_matches("0x")).unwrap();
assert!(matches!(raw[64], 27 | 28), "invalid recovery byte");