Expand description
§remitmd - Rust SDK for the remit.md universal AI payment protocol
remit.md enables AI agents to send and receive USDC payments on Base (EVM L2) with support for direct payments, escrow, streaming, payment channels (tabs), bounties, and security deposits.
§Quick start
use remitmd::Wallet;
use rust_decimal_macros::dec;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// From environment: export REMITMD_KEY=0x...
let wallet = Wallet::from_env()?;
// Direct payment
let tx = wallet.pay("0xRecipient...", dec!(1.50)).await?;
println!("paid {:?} USDC in {}", tx.amount, tx.tx_hash);
// Escrow for high-value work
let escrow = wallet.create_escrow("0xAgent...", dec!(100.00)).await?;
// ... agent completes work ...
wallet.release_escrow(&escrow.id, None).await?;
Ok(())
}§Testing
Use MockRemit for unit tests - zero network, zero latency, deterministic:
use remitmd::MockRemit;
use rust_decimal_macros::dec;
#[tokio::test]
async fn agent_pays_for_service() {
let mock = MockRemit::new();
let wallet = mock.wallet();
wallet.pay("0xService000000000000000000000000000000001", dec!(0.003)).await.unwrap();
assert!(mock.was_paid("0xService000000000000000000000000000000001", dec!(0.003)).await);
}§Error handling
All SDK methods return Result<T, RemitError>. Errors are structured with a
stable machine-readable code, an actionable message, and a documentation link.
ⓘ
use remitmd::error::codes;
match wallet.pay(addr, amount).await {
Ok(tx) => println!("paid: {}", tx.tx_hash),
Err(e) if e.code == codes::INVALID_ADDRESS => {
eprintln!("fix the address: {}", e.message);
}
Err(e) if e.code == codes::INSUFFICIENT_BALANCE => {
eprintln!("top up your wallet: {}", e.message);
}
Err(e) => eprintln!("payment error: {e}"),
}Re-exports§
pub use cli_signer::CliSigner;pub use error::RemitError;
Modules§
- a2a
- A2A / AP2 - agent card discovery and A2A JSON-RPC task client.
- cli_
signer - CLI signer adapter for the
remit signsubprocess. - error
- x402
- x402 client and paywall for HTTP 402 Payment Required flows.
Structs§
- Balance
- Current USDC balance of a wallet.
- Bounty
- A task with a USDC reward for completion.
- Bounty
Submission - A bounty submission from a submitter.
- Budget
- Remaining spending capacity under operator-set limits.
- ChainId
- EVM chain IDs supported by remit.md.
- Contract
Addresses - On-chain contract addresses for the current deployment.
- Deposit
- Security deposit held as collateral.
- Escrow
- Holds USDC until conditions are met.
- Intent
- A proposed payment awaiting negotiation.
- Milestone
- A partial payment condition within an escrow.
- Mint
Response - Result of a testnet mint operation.
- Mock
Remit - In-memory mock for testing agents that use remit.md.
- Permit
Signature - ERC-2612 permit signature for gasless USDC approvals.
- Private
KeySigner - Signs API requests using an in-memory ECDSA private key.
- Reputation
- An agent’s on-chain payment reputation score (0–1000).
- Spending
Summary - Spending analytics for a wallet.
- Split
- Distributes an escrow payment among multiple recipients.
- Stream
- Time-based payment stream (pay-per-second).
- Tab
- Off-chain payment channel for batched micro-payments.
- TabCharge
- A charge against a Tab (on-chain signed by provider).
- TabDebit
- A single debit against a Tab (legacy).
- TopRecipient
- A top recipient entry within SpendingSummary.
- Transaction
- Result of any payment operation.
- Transaction
List - Paginated list of transactions.
- Wallet
- Primary remit.md client for AI agents that send and receive payments.
- Wallet
Builder - Builder for
Wallet. UseWallet::new(key)orWallet::with_signer(signer). - Wallet
Status - Wallet status returned by
/api/v1/status/{address}. - WithKey
- Typestate for WalletBuilder: key-based construction.
- With
Signer - Typestate for WalletBuilder: custom signer construction.
Enums§
- Bounty
Status - Status of a bounty.
- Deposit
Status - Status of a security deposit.
- Escrow
Status - Status of an escrow payment.
- Stream
Status - Status of a payment stream.
- TabStatus
- Status of a payment channel (tab).
Traits§
- Signer
- Signs EIP-712 typed data for authenticating API requests.