Summary
agent-wallet send returns only {"payment_hash":"..."} on success, but does not include the preimage (proof of payment). This makes it impossible for agents to complete L402 flows without parsing daemon logs.
Context
When an AI agent pays an L402-protected endpoint, the flow is:
- Request resource → get 402 with invoice + token
- Pay the invoice → get preimage
- Replay request with
Authorization: L402 <token>:<preimage>
Step 2 fails because agent-wallet send doesn't return the preimage. The preimage is available internally — it appears in ~/.mdk-wallet/daemon.log:
Successfully sent payment of 37898000msat (fee 0 msat) from payment hash "d7ae..." with preimage "dc76..."
wait_for_payment_outcome saw event: PaymentSuccessful { payment_preimage: Some(dc76...) }
But the CLI output is just:
{"payment_hash":"d7ae9346c431c00e7e92f9210fb7b1e0cb89f3d52ec17414ec4f5a41fb50a8cf"}
Expected behavior
agent-wallet send should return the preimage on successful payment:
{
"payment_hash": "d7ae...",
"preimage": "dc76...",
"amount_sats": 37898,
"fee_msat": 0
}
This would also fix the amount_sats: 0 issue in payments.json for outbound payments.
Environment
@moneydevkit/agent-wallet@0.11.0-beta.1
- macOS (arm64), Node v25.5.0
Additional context
Discovered while attempting to buy coffee from unhuman.coffee using the L402 protocol. The agent-wallet docs mention L402 compatibility ("pay the invoice and return the token and preimage to unlock the API") but the CLI doesn't surface the preimage needed to do this.
Workaround: parse ~/.mdk-wallet/daemon.log for the preimage, but this is fragile and not suitable for production agent workflows.
Summary
agent-wallet sendreturns only{"payment_hash":"..."}on success, but does not include the preimage (proof of payment). This makes it impossible for agents to complete L402 flows without parsing daemon logs.Context
When an AI agent pays an L402-protected endpoint, the flow is:
Authorization: L402 <token>:<preimage>Step 2 fails because
agent-wallet senddoesn't return the preimage. The preimage is available internally — it appears in~/.mdk-wallet/daemon.log:But the CLI output is just:
{"payment_hash":"d7ae9346c431c00e7e92f9210fb7b1e0cb89f3d52ec17414ec4f5a41fb50a8cf"}Expected behavior
agent-wallet sendshould return the preimage on successful payment:{ "payment_hash": "d7ae...", "preimage": "dc76...", "amount_sats": 37898, "fee_msat": 0 }This would also fix the
amount_sats: 0issue inpayments.jsonfor outbound payments.Environment
@moneydevkit/agent-wallet@0.11.0-beta.1Additional context
Discovered while attempting to buy coffee from unhuman.coffee using the L402 protocol. The agent-wallet docs mention L402 compatibility ("pay the invoice and return the token and preimage to unlock the API") but the CLI doesn't surface the preimage needed to do this.
Workaround: parse
~/.mdk-wallet/daemon.logfor the preimage, but this is fragile and not suitable for production agent workflows.