Skip to content

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

docs(web3): rewrite dapp and swap readmes around the module boundary

Steven Enamakelae31a572b5fe
diff --git a/crates/openhuman-core/src/web3/dapp/README.md b/crates/openhuman-core/src/web3/dapp/README.md
index 9171e99675..8a62331852 100644
--- a/crates/openhuman-core/src/web3/dapp/README.md
+++ b/crates/openhuman-core/src/web3/dapp/README.md
@@ -1,53 +1,20 @@
-# web3/dapp
+# web3_dapp
-Generic EVM contract calls from caller-supplied calldata, one of the three
-families under [`web3`](../README.md) alongside `swap` and `bridge`. Unlike
-those two, `dapp` does not call the backend at quote time: the caller
-provides the target contract and pre-encoded calldata directly, and this
-module only validates and stores the prepared transaction for the normal
-confirm-then-execute flow.
+Generic EVM contract calls accept a target contract and pre-encoded calldata.
+The compiled TinyWallet module validates the request, prepares and stores the
+quote, and later signs and broadcasts after explicit approval. OpenHuman keeps
+the `web3_dapp` RPC schemas and the typed module adapter.
-## What it does
-
-`Web3Service::prepare_dapp_call` (in the vendored `tinywallet-web3` crate) validates the contract
-address and calldata (must be `0x`-prefixed, even-length hex), confirms the
-wallet has an EVM account on the requested network, and stores an
-`UnsignedTx::Evm` quote. This module owns the RPC controllers ([`schemas.rs`](./schemas.rs))
-for the `web3_dapp` namespace; the validation and storage logic lives in the
-crate's `crypto::service`, shared with `swap` and `bridge`, and the agent tools
-in `tinywallet_web3::tools::web3`.
-
-## Key files
-
-| File | Role |
-| --- | --- |
-| [`mod.rs`](./mod.rs) | Module docs. |
-| [`schemas.rs`](./schemas.rs) | `web3_dapp` RPC controller schemas and handlers: `call`, `execute`. Handlers deserialize params and delegate to the process-wide `Web3Service` (`prepare_dapp_call` / `execute_quote`), wrapping the result in `Outcome`. |
-
-## RPC / controllers
-
-Namespace `web3_dapp` (method form `openhuman.web3_dapp_<function>`):
+## Operations
| Function | Purpose |
| --- | --- |
-| `call` | Prepare a generic EVM contract call. Params: `contractAddress`, `calldata` (0x-prefixed hex), and optional `valueRaw` (default `"0"`), `evmNetwork` (default `ethereum_mainnet`). Returns a prepared quote with a `quoteId`. |
-| `execute` | Confirm and execute a prepared quote (`quoteId`, `confirmed: true`). Signs the contract call in-core and broadcasts it. |
-
-## Agent tools
-
-`web3_dapp_call`, `web3_dapp_execute`. The `evmNetwork` argument accepts
-`ethereum_mainnet`, `base_mainnet`, `arbitrum_one`, `optimism_mainnet`,
-`polygon_mainnet`, `bsc_mainnet`.
-
-## Notes
-
-- No backend call is involved in preparing a dapp call; deBridge is only used by `swap` and `bridge`. Signing and broadcast still go through the wallet's crate-internal `sign_and_broadcast_evm`, same as the other two families.
-- The quote id returned by `call` is bound to the chat thread that prepared it, TTL'd at 5 minutes, and restored with a refreshed TTL on a failed broadcast; see the parent [README](../README.md) for the shared quote store.
-- BTC and Solana are out of scope here. `dapp` is EVM-only.
+| `call` | Prepare an EVM contract call with `contractAddress`, `calldata`, and optional `valueRaw` / `evmNetwork`. |
+| `execute` | Execute a stored quote with `confirmed: true`; the host approves the exact transaction intent before module signing. |
-## Further reading
+No backend call is needed to prepare a dapp call. Quotes are module-owned and
+bound to the preparing chat thread and client. The host does not validate or
+encode chain transactions locally.
-- [Parent module (`web3`)](../README.md)
-- [Wallet](../../../../../gitbooks/features/wallet.md)
-- [tinywallet submodule](../../../../../vendor/tinywallet/README.md)
-- [Loadable modules](../../../../../gitbooks/developing/loadable-modules.md)
+The host controller schemas are in [`schemas.rs`](./schemas.rs). See the
+[parent Web3 architecture](../README.md) for the module/host boundary.
diff --git a/crates/openhuman-core/src/web3/swap/README.md b/crates/openhuman-core/src/web3/swap/README.md
index f70c5dd8de..db6f3a1ec9 100644
--- a/crates/openhuman-core/src/web3/swap/README.md
+++ b/crates/openhuman-core/src/web3/swap/README.md
@@ -1,52 +1,22 @@
-# web3/swap
+# web3_swap
-Single-chain token swaps via the deBridge proxy, one of the three families
-under [`web3`](../README.md) alongside `bridge` and `dapp`. See the parent
-README for the shared quote store, chain-id mapping, and signing path; this
-file only covers what is specific to swaps.
+Single-chain token swaps use the TinyWallet module for provider parsing, quote
+construction, module-owned quote storage, transaction encoding, approval-bound
+signing, and broadcast. OpenHuman keeps the `web3_swap` RPC controllers and
+agent-tool adapters, and supplies authenticated access to the backend
+deBridge proxy plus generic, guarded chain transport.
-## What it does
-
-A swap quote asks deBridge for a route to exchange one token for another on
-the same chain. Cross-chain requests are rejected here with a pointer to
-`web3_bridge`, since deBridge's `/swap` endpoint is single-chain only. The
-actual quote logic (address defaulting, the backend call, unsigned-tx
-extraction) lives in `Web3Service::quote_swap` in the vendored `tinywallet-web3`
-crate; this module only owns the RPC controllers ([`schemas.rs`](./schemas.rs)) for the
-`web3_swap` namespace. The agent tools are in
-`tinywallet_web3::tools::web3`.
-
-## Key files
-
-| File | Role |
-| --- | --- |
-| [`mod.rs`](./mod.rs) | Module docs. |
-| [`schemas.rs`](./schemas.rs) | `web3_swap` RPC controller schemas and handlers: `quote`, `execute`, `routes`. Handlers deserialize params and delegate to the process-wide `Web3Service` (`web3::seams::service()`): `quote_swap` / `execute_quote` / `routes`, wrapping the result in `Outcome`. |
-
-## RPC / controllers
-
-Namespace `web3_swap` (method form `openhuman.web3_swap_<function>`):
+## Operations
| Function | Purpose |
| --- | --- |
-| `quote` | Prepare a single-chain swap. Params: `chainId`, `tokenIn`, `tokenInAmount`, `tokenOut`, and optional `tokenOutRecipient`, `senderAddress`, `slippage` (default `"auto"`). Returns a prepared quote with a `quoteId`. |
-| `execute` | Confirm and execute a prepared quote (`quoteId`, `confirmed: true`). Signs and broadcasts. |
-| `routes` | List the chains deBridge can swap and bridge between. No params. |
-
-## Agent tools
-
-`web3_swap_quote`, `web3_swap_execute`, `web3_swap_routes`. They call the
-backend per invocation and return a tool error, rather than being hidden,
-when the caller is not signed in.
-
-## Notes
-
-- Recipient and sender addresses default to the wallet's own derived address for the chain family when omitted.
-- The quote id returned by `quote` is bound to the chat thread that prepared it; see the parent [README](../README.md) for the quote store's TTL and ownership rules, which this module shares with `bridge` and `dapp`.
+| `quote` | Prepare a single-chain swap quote. Cross-chain requests are routed to `web3_bridge`. |
+| `execute` | Execute a stored quote after `confirmed: true` and host approval of the exact intent. |
+| `routes` | List provider-supported routes through the module/backend boundary. |
-## Further reading
+Quotes are bound to their preparing chat thread and client. Module absence,
+ownership mismatch, expiry, and provider errors fail closed; there is no local
+quote or signing fallback.
-- [Parent module (`web3`)](../README.md)
-- [Wallet](../../../../../gitbooks/features/wallet.md)
-- [tinywallet submodule](../../../../../vendor/tinywallet/README.md)
-- [Loadable modules](../../../../../gitbooks/developing/loadable-modules.md)
+The host controller schemas are in [`schemas.rs`](./schemas.rs). See the
+[parent Web3 architecture](../README.md) for the module/host boundary.