envoy-pay 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +99 -0
- package/LICENSE +200 -0
- package/README.md +529 -0
- package/dist/cjs/adapters/base.js +174 -0
- package/dist/cjs/adapters/base.js.map +1 -0
- package/dist/cjs/adapters/evm.js +339 -0
- package/dist/cjs/adapters/evm.js.map +1 -0
- package/dist/cjs/adapters/index.js +15 -0
- package/dist/cjs/adapters/index.js.map +1 -0
- package/dist/cjs/adapters/ows.js +204 -0
- package/dist/cjs/adapters/ows.js.map +1 -0
- package/dist/cjs/adapters/solana.js +210 -0
- package/dist/cjs/adapters/solana.js.map +1 -0
- package/dist/cjs/adapters/stellar.js +173 -0
- package/dist/cjs/adapters/stellar.js.map +1 -0
- package/dist/cjs/adapters/stripe.js +338 -0
- package/dist/cjs/adapters/stripe.js.map +1 -0
- package/dist/cjs/adapters/types.js +3 -0
- package/dist/cjs/adapters/types.js.map +1 -0
- package/dist/cjs/client.js +309 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/contracts/abis/EnvoyFacilitator.js +197 -0
- package/dist/cjs/contracts/abis/EnvoyFacilitator.js.map +1 -0
- package/dist/cjs/contracts/addresses.js +42 -0
- package/dist/cjs/contracts/addresses.js.map +1 -0
- package/dist/cjs/contracts/facilitator.js +225 -0
- package/dist/cjs/contracts/facilitator.js.map +1 -0
- package/dist/cjs/contracts/index.js +21 -0
- package/dist/cjs/contracts/index.js.map +1 -0
- package/dist/cjs/facilitator/facilitator-service.js +305 -0
- package/dist/cjs/facilitator/facilitator-service.js.map +1 -0
- package/dist/cjs/facilitator/fee-calculator.js +134 -0
- package/dist/cjs/facilitator/fee-calculator.js.map +1 -0
- package/dist/cjs/facilitator/index.js +12 -0
- package/dist/cjs/facilitator/index.js.map +1 -0
- package/dist/cjs/facilitator/types.js +99 -0
- package/dist/cjs/facilitator/types.js.map +1 -0
- package/dist/cjs/identity/agent-card.js +143 -0
- package/dist/cjs/identity/agent-card.js.map +1 -0
- package/dist/cjs/identity/agent-identity.js +166 -0
- package/dist/cjs/identity/agent-identity.js.map +1 -0
- package/dist/cjs/identity/did-resolver.js +149 -0
- package/dist/cjs/identity/did-resolver.js.map +1 -0
- package/dist/cjs/identity/erc8004/abis.js +218 -0
- package/dist/cjs/identity/erc8004/abis.js.map +1 -0
- package/dist/cjs/identity/erc8004/identity.js +268 -0
- package/dist/cjs/identity/erc8004/identity.js.map +1 -0
- package/dist/cjs/identity/erc8004/index.js +36 -0
- package/dist/cjs/identity/erc8004/index.js.map +1 -0
- package/dist/cjs/identity/erc8004/reputation.js +110 -0
- package/dist/cjs/identity/erc8004/reputation.js.map +1 -0
- package/dist/cjs/identity/erc8004/types.js +3 -0
- package/dist/cjs/identity/erc8004/types.js.map +1 -0
- package/dist/cjs/identity/index.js +61 -0
- package/dist/cjs/identity/index.js.map +1 -0
- package/dist/cjs/identity/owner-registry.js +140 -0
- package/dist/cjs/identity/owner-registry.js.map +1 -0
- package/dist/cjs/identity/reputation.js +193 -0
- package/dist/cjs/identity/reputation.js.map +1 -0
- package/dist/cjs/identity/types.js +16 -0
- package/dist/cjs/identity/types.js.map +1 -0
- package/dist/cjs/index.js +72 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/logger.js +7 -0
- package/dist/cjs/logger.js.map +1 -0
- package/dist/cjs/monitor/evm-watcher.js +165 -0
- package/dist/cjs/monitor/evm-watcher.js.map +1 -0
- package/dist/cjs/monitor/index.js +32 -0
- package/dist/cjs/monitor/index.js.map +1 -0
- package/dist/cjs/monitor/multi-watcher.js +94 -0
- package/dist/cjs/monitor/multi-watcher.js.map +1 -0
- package/dist/cjs/monitor/solana-watcher.js +172 -0
- package/dist/cjs/monitor/solana-watcher.js.map +1 -0
- package/dist/cjs/monitor/stellar-watcher.js +125 -0
- package/dist/cjs/monitor/stellar-watcher.js.map +1 -0
- package/dist/cjs/mpp.js +187 -0
- package/dist/cjs/mpp.js.map +1 -0
- package/dist/cjs/policy.js +71 -0
- package/dist/cjs/policy.js.map +1 -0
- package/dist/cjs/providers/bridge.js +323 -0
- package/dist/cjs/providers/bridge.js.map +1 -0
- package/dist/cjs/providers/onchainos.js +210 -0
- package/dist/cjs/providers/onchainos.js.map +1 -0
- package/dist/cjs/requests/eip681.js +77 -0
- package/dist/cjs/requests/eip681.js.map +1 -0
- package/dist/cjs/requests/index.js +18 -0
- package/dist/cjs/requests/index.js.map +1 -0
- package/dist/cjs/requests/sep7.js +61 -0
- package/dist/cjs/requests/sep7.js.map +1 -0
- package/dist/cjs/requests/solana-pay.js +51 -0
- package/dist/cjs/requests/solana-pay.js.map +1 -0
- package/dist/cjs/requests/universal.js +40 -0
- package/dist/cjs/requests/universal.js.map +1 -0
- package/dist/cjs/server/index.js +35 -0
- package/dist/cjs/server/index.js.map +1 -0
- package/dist/cjs/server/mpp-gate.js +118 -0
- package/dist/cjs/server/mpp-gate.js.map +1 -0
- package/dist/cjs/server/payment-gate.js +92 -0
- package/dist/cjs/server/payment-gate.js.map +1 -0
- package/dist/cjs/server/receipt.js +52 -0
- package/dist/cjs/server/receipt.js.map +1 -0
- package/dist/cjs/server/webhook.js +122 -0
- package/dist/cjs/server/webhook.js.map +1 -0
- package/dist/cjs/server/x402-gate.js +103 -0
- package/dist/cjs/server/x402-gate.js.map +1 -0
- package/dist/cjs/solana.js +14 -0
- package/dist/cjs/solana.js.map +1 -0
- package/dist/cjs/stellar.js +14 -0
- package/dist/cjs/stellar.js.map +1 -0
- package/dist/cjs/wallet/balance-aggregator.js +149 -0
- package/dist/cjs/wallet/balance-aggregator.js.map +1 -0
- package/dist/cjs/wallet/chain-router.js +254 -0
- package/dist/cjs/wallet/chain-router.js.map +1 -0
- package/dist/cjs/wallet/index.js +15 -0
- package/dist/cjs/wallet/index.js.map +1 -0
- package/dist/cjs/wallet/intent-resolver.js +145 -0
- package/dist/cjs/wallet/intent-resolver.js.map +1 -0
- package/dist/cjs/wallet/session-manager.js +170 -0
- package/dist/cjs/wallet/session-manager.js.map +1 -0
- package/dist/cjs/wallet/types.js +14 -0
- package/dist/cjs/wallet/types.js.map +1 -0
- package/dist/cjs/wallet/unified-wallet.js +253 -0
- package/dist/cjs/wallet/unified-wallet.js.map +1 -0
- package/dist/esm/adapters/base.js +170 -0
- package/dist/esm/adapters/base.js.map +1 -0
- package/dist/esm/adapters/evm.js +334 -0
- package/dist/esm/adapters/evm.js.map +1 -0
- package/dist/esm/adapters/index.js +6 -0
- package/dist/esm/adapters/index.js.map +1 -0
- package/dist/esm/adapters/ows.js +194 -0
- package/dist/esm/adapters/ows.js.map +1 -0
- package/dist/esm/adapters/solana.js +206 -0
- package/dist/esm/adapters/solana.js.map +1 -0
- package/dist/esm/adapters/stellar.js +136 -0
- package/dist/esm/adapters/stellar.js.map +1 -0
- package/dist/esm/adapters/stripe.js +334 -0
- package/dist/esm/adapters/stripe.js.map +1 -0
- package/dist/esm/adapters/types.js +2 -0
- package/dist/esm/adapters/types.js.map +1 -0
- package/dist/esm/client.js +302 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/contracts/abis/EnvoyFacilitator.js +194 -0
- package/dist/esm/contracts/abis/EnvoyFacilitator.js.map +1 -0
- package/dist/esm/contracts/addresses.js +38 -0
- package/dist/esm/contracts/addresses.js.map +1 -0
- package/dist/esm/contracts/facilitator.js +218 -0
- package/dist/esm/contracts/facilitator.js.map +1 -0
- package/dist/esm/contracts/index.js +8 -0
- package/dist/esm/contracts/index.js.map +1 -0
- package/dist/esm/facilitator/facilitator-service.js +301 -0
- package/dist/esm/facilitator/facilitator-service.js.map +1 -0
- package/dist/esm/facilitator/fee-calculator.js +130 -0
- package/dist/esm/facilitator/fee-calculator.js.map +1 -0
- package/dist/esm/facilitator/index.js +5 -0
- package/dist/esm/facilitator/index.js.map +1 -0
- package/dist/esm/facilitator/types.js +96 -0
- package/dist/esm/facilitator/types.js.map +1 -0
- package/dist/esm/identity/agent-card.js +139 -0
- package/dist/esm/identity/agent-card.js.map +1 -0
- package/dist/esm/identity/agent-identity.js +162 -0
- package/dist/esm/identity/agent-identity.js.map +1 -0
- package/dist/esm/identity/did-resolver.js +145 -0
- package/dist/esm/identity/did-resolver.js.map +1 -0
- package/dist/esm/identity/erc8004/abis.js +215 -0
- package/dist/esm/identity/erc8004/abis.js.map +1 -0
- package/dist/esm/identity/erc8004/identity.js +250 -0
- package/dist/esm/identity/erc8004/identity.js.map +1 -0
- package/dist/esm/identity/erc8004/index.js +13 -0
- package/dist/esm/identity/erc8004/index.js.map +1 -0
- package/dist/esm/identity/erc8004/reputation.js +105 -0
- package/dist/esm/identity/erc8004/reputation.js.map +1 -0
- package/dist/esm/identity/erc8004/types.js +2 -0
- package/dist/esm/identity/erc8004/types.js.map +1 -0
- package/dist/esm/identity/index.js +19 -0
- package/dist/esm/identity/index.js.map +1 -0
- package/dist/esm/identity/owner-registry.js +136 -0
- package/dist/esm/identity/owner-registry.js.map +1 -0
- package/dist/esm/identity/reputation.js +189 -0
- package/dist/esm/identity/reputation.js.map +1 -0
- package/dist/esm/identity/types.js +15 -0
- package/dist/esm/identity/types.js.map +1 -0
- package/dist/esm/index.js +37 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.js +3 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/monitor/evm-watcher.js +162 -0
- package/dist/esm/monitor/evm-watcher.js.map +1 -0
- package/dist/esm/monitor/index.js +25 -0
- package/dist/esm/monitor/index.js.map +1 -0
- package/dist/esm/monitor/multi-watcher.js +91 -0
- package/dist/esm/monitor/multi-watcher.js.map +1 -0
- package/dist/esm/monitor/solana-watcher.js +169 -0
- package/dist/esm/monitor/solana-watcher.js.map +1 -0
- package/dist/esm/monitor/stellar-watcher.js +122 -0
- package/dist/esm/monitor/stellar-watcher.js.map +1 -0
- package/dist/esm/mpp.js +175 -0
- package/dist/esm/mpp.js.map +1 -0
- package/dist/esm/policy.js +67 -0
- package/dist/esm/policy.js.map +1 -0
- package/dist/esm/providers/bridge.js +319 -0
- package/dist/esm/providers/bridge.js.map +1 -0
- package/dist/esm/providers/onchainos.js +172 -0
- package/dist/esm/providers/onchainos.js.map +1 -0
- package/dist/esm/requests/eip681.js +74 -0
- package/dist/esm/requests/eip681.js.map +1 -0
- package/dist/esm/requests/index.js +11 -0
- package/dist/esm/requests/index.js.map +1 -0
- package/dist/esm/requests/sep7.js +58 -0
- package/dist/esm/requests/sep7.js.map +1 -0
- package/dist/esm/requests/solana-pay.js +48 -0
- package/dist/esm/requests/solana-pay.js.map +1 -0
- package/dist/esm/requests/universal.js +37 -0
- package/dist/esm/requests/universal.js.map +1 -0
- package/dist/esm/server/index.js +27 -0
- package/dist/esm/server/index.js.map +1 -0
- package/dist/esm/server/mpp-gate.js +115 -0
- package/dist/esm/server/mpp-gate.js.map +1 -0
- package/dist/esm/server/payment-gate.js +89 -0
- package/dist/esm/server/payment-gate.js.map +1 -0
- package/dist/esm/server/receipt.js +48 -0
- package/dist/esm/server/receipt.js.map +1 -0
- package/dist/esm/server/webhook.js +119 -0
- package/dist/esm/server/webhook.js.map +1 -0
- package/dist/esm/server/x402-gate.js +100 -0
- package/dist/esm/server/x402-gate.js.map +1 -0
- package/dist/esm/solana.js +8 -0
- package/dist/esm/solana.js.map +1 -0
- package/dist/esm/stellar.js +8 -0
- package/dist/esm/stellar.js.map +1 -0
- package/dist/esm/wallet/balance-aggregator.js +145 -0
- package/dist/esm/wallet/balance-aggregator.js.map +1 -0
- package/dist/esm/wallet/chain-router.js +250 -0
- package/dist/esm/wallet/chain-router.js.map +1 -0
- package/dist/esm/wallet/index.js +7 -0
- package/dist/esm/wallet/index.js.map +1 -0
- package/dist/esm/wallet/intent-resolver.js +141 -0
- package/dist/esm/wallet/intent-resolver.js.map +1 -0
- package/dist/esm/wallet/session-manager.js +166 -0
- package/dist/esm/wallet/session-manager.js.map +1 -0
- package/dist/esm/wallet/types.js +13 -0
- package/dist/esm/wallet/types.js.map +1 -0
- package/dist/esm/wallet/unified-wallet.js +249 -0
- package/dist/esm/wallet/unified-wallet.js.map +1 -0
- package/dist/types/adapters/base.d.ts +53 -0
- package/dist/types/adapters/base.d.ts.map +1 -0
- package/dist/types/adapters/evm.d.ts +93 -0
- package/dist/types/adapters/evm.d.ts.map +1 -0
- package/dist/types/adapters/index.d.ts +7 -0
- package/dist/types/adapters/index.d.ts.map +1 -0
- package/dist/types/adapters/ows.d.ts +123 -0
- package/dist/types/adapters/ows.d.ts.map +1 -0
- package/dist/types/adapters/solana.d.ts +77 -0
- package/dist/types/adapters/solana.d.ts.map +1 -0
- package/dist/types/adapters/stellar.d.ts +67 -0
- package/dist/types/adapters/stellar.d.ts.map +1 -0
- package/dist/types/adapters/stripe.d.ts +206 -0
- package/dist/types/adapters/stripe.d.ts.map +1 -0
- package/dist/types/adapters/types.d.ts +110 -0
- package/dist/types/adapters/types.d.ts.map +1 -0
- package/dist/types/client.d.ts +89 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/contracts/abis/EnvoyFacilitator.d.ts +296 -0
- package/dist/types/contracts/abis/EnvoyFacilitator.d.ts.map +1 -0
- package/dist/types/contracts/addresses.d.ts +24 -0
- package/dist/types/contracts/addresses.d.ts.map +1 -0
- package/dist/types/contracts/facilitator.d.ts +172 -0
- package/dist/types/contracts/facilitator.d.ts.map +1 -0
- package/dist/types/contracts/index.d.ts +6 -0
- package/dist/types/contracts/index.d.ts.map +1 -0
- package/dist/types/facilitator/facilitator-service.d.ts +69 -0
- package/dist/types/facilitator/facilitator-service.d.ts.map +1 -0
- package/dist/types/facilitator/fee-calculator.d.ts +48 -0
- package/dist/types/facilitator/fee-calculator.d.ts.map +1 -0
- package/dist/types/facilitator/index.d.ts +5 -0
- package/dist/types/facilitator/index.d.ts.map +1 -0
- package/dist/types/facilitator/types.d.ts +221 -0
- package/dist/types/facilitator/types.d.ts.map +1 -0
- package/dist/types/identity/agent-card.d.ts +83 -0
- package/dist/types/identity/agent-card.d.ts.map +1 -0
- package/dist/types/identity/agent-identity.d.ts +102 -0
- package/dist/types/identity/agent-identity.d.ts.map +1 -0
- package/dist/types/identity/did-resolver.d.ts +70 -0
- package/dist/types/identity/did-resolver.d.ts.map +1 -0
- package/dist/types/identity/erc8004/abis.d.ts +336 -0
- package/dist/types/identity/erc8004/abis.d.ts.map +1 -0
- package/dist/types/identity/erc8004/identity.d.ts +109 -0
- package/dist/types/identity/erc8004/identity.d.ts.map +1 -0
- package/dist/types/identity/erc8004/index.d.ts +15 -0
- package/dist/types/identity/erc8004/index.d.ts.map +1 -0
- package/dist/types/identity/erc8004/reputation.d.ts +52 -0
- package/dist/types/identity/erc8004/reputation.d.ts.map +1 -0
- package/dist/types/identity/erc8004/types.d.ts +31 -0
- package/dist/types/identity/erc8004/types.d.ts.map +1 -0
- package/dist/types/identity/index.d.ts +10 -0
- package/dist/types/identity/index.d.ts.map +1 -0
- package/dist/types/identity/owner-registry.d.ts +68 -0
- package/dist/types/identity/owner-registry.d.ts.map +1 -0
- package/dist/types/identity/reputation.d.ts +66 -0
- package/dist/types/identity/reputation.d.ts.map +1 -0
- package/dist/types/identity/types.d.ts +182 -0
- package/dist/types/identity/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/logger.d.ts +10 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/monitor/evm-watcher.d.ts +40 -0
- package/dist/types/monitor/evm-watcher.d.ts.map +1 -0
- package/dist/types/monitor/index.d.ts +25 -0
- package/dist/types/monitor/index.d.ts.map +1 -0
- package/dist/types/monitor/multi-watcher.d.ts +48 -0
- package/dist/types/monitor/multi-watcher.d.ts.map +1 -0
- package/dist/types/monitor/solana-watcher.d.ts +36 -0
- package/dist/types/monitor/solana-watcher.d.ts.map +1 -0
- package/dist/types/monitor/stellar-watcher.d.ts +34 -0
- package/dist/types/monitor/stellar-watcher.d.ts.map +1 -0
- package/dist/types/mpp.d.ts +153 -0
- package/dist/types/mpp.d.ts.map +1 -0
- package/dist/types/policy.d.ts +40 -0
- package/dist/types/policy.d.ts.map +1 -0
- package/dist/types/providers/bridge.d.ts +162 -0
- package/dist/types/providers/bridge.d.ts.map +1 -0
- package/dist/types/providers/onchainos.d.ts +128 -0
- package/dist/types/providers/onchainos.d.ts.map +1 -0
- package/dist/types/requests/eip681.d.ts +51 -0
- package/dist/types/requests/eip681.d.ts.map +1 -0
- package/dist/types/requests/index.d.ts +11 -0
- package/dist/types/requests/index.d.ts.map +1 -0
- package/dist/types/requests/sep7.d.ts +56 -0
- package/dist/types/requests/sep7.d.ts.map +1 -0
- package/dist/types/requests/solana-pay.d.ts +50 -0
- package/dist/types/requests/solana-pay.d.ts.map +1 -0
- package/dist/types/requests/universal.d.ts +28 -0
- package/dist/types/requests/universal.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +27 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/mpp-gate.d.ts +66 -0
- package/dist/types/server/mpp-gate.d.ts.map +1 -0
- package/dist/types/server/payment-gate.d.ts +33 -0
- package/dist/types/server/payment-gate.d.ts.map +1 -0
- package/dist/types/server/receipt.d.ts +52 -0
- package/dist/types/server/receipt.d.ts.map +1 -0
- package/dist/types/server/webhook.d.ts +46 -0
- package/dist/types/server/webhook.d.ts.map +1 -0
- package/dist/types/server/x402-gate.d.ts +70 -0
- package/dist/types/server/x402-gate.d.ts.map +1 -0
- package/dist/types/solana.d.ts +7 -0
- package/dist/types/solana.d.ts.map +1 -0
- package/dist/types/stellar.d.ts +7 -0
- package/dist/types/stellar.d.ts.map +1 -0
- package/dist/types/wallet/balance-aggregator.d.ts +51 -0
- package/dist/types/wallet/balance-aggregator.d.ts.map +1 -0
- package/dist/types/wallet/chain-router.d.ts +44 -0
- package/dist/types/wallet/chain-router.d.ts.map +1 -0
- package/dist/types/wallet/index.d.ts +7 -0
- package/dist/types/wallet/index.d.ts.map +1 -0
- package/dist/types/wallet/intent-resolver.d.ts +39 -0
- package/dist/types/wallet/intent-resolver.d.ts.map +1 -0
- package/dist/types/wallet/session-manager.d.ts +57 -0
- package/dist/types/wallet/session-manager.d.ts.map +1 -0
- package/dist/types/wallet/types.d.ts +161 -0
- package/dist/types/wallet/types.d.ts.map +1 -0
- package/dist/types/wallet/unified-wallet.d.ts +122 -0
- package/dist/types/wallet/unified-wallet.d.ts.map +1 -0
- package/package.json +194 -0
package/README.md
ADDED
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# envoy
|
|
4
|
+
|
|
5
|
+
### The payment layer for autonomous AI agents.
|
|
6
|
+
### Give every agent an on-chain financial identity — in one line of code.
|
|
7
|
+
|
|
8
|
+
<sub>Celo-first · Dual protocol (x402 + MPP) · ERC-8004 identity · On-chain settlement · Spending policy · 12 EVM chains + Solana + Stellar + Stripe</sub>
|
|
9
|
+
|
|
10
|
+
<p>
|
|
11
|
+
<a href="https://github.com/envoy-pay/envoy-pay/actions/workflows/ci.yml"><img src="https://github.com/envoy-pay/envoy-pay/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/envoy-pay"><img src="https://img.shields.io/npm/v/envoy-pay?style=flat-square&color=2e7d32&label=npm" alt="npm version" /></a>
|
|
13
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square" alt="Apache 2.0" /></a>
|
|
14
|
+
<img src="https://img.shields.io/badge/built%20on-Celo-FCFF52?style=flat-square&labelColor=000000" alt="Built on Celo" />
|
|
15
|
+
<img src="https://img.shields.io/badge/ERC--8004-identity-635bff?style=flat-square" alt="ERC-8004" />
|
|
16
|
+
<img src="https://img.shields.io/badge/TypeScript-strict-3178c6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" />
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p>
|
|
20
|
+
<a href="#quickstart">Quickstart</a> ·
|
|
21
|
+
<a href="#what-is-envoy">What is envoy</a> ·
|
|
22
|
+
<a href="#how-does-envoy-work">How it works</a> ·
|
|
23
|
+
<a href="#the-on-chain-layer">On-chain layer</a> ·
|
|
24
|
+
<a href="#networks">Networks</a> ·
|
|
25
|
+
<a href="#live-on-celo-mainnet">Live on Celo</a> ·
|
|
26
|
+
<a href="#faq">FAQ</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## What is envoy?
|
|
34
|
+
|
|
35
|
+
**envoy** is open-source payment infrastructure that gives any AI agent an **on-chain financial identity** and the ability to **pay for itself**. It unifies the two machine-payment protocols — [x402](https://x402.org) (Coinbase) and [MPP](https://mpp.dev) (Stripe) — behind a single client, settles on **Celo** (plus 11 other EVM chains, Solana, Stellar, and Stripe fiat), and backs every agent with a canonical **ERC-8004** identity and an on-chain spending policy enforced by the `EnvoyFacilitator` contract.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install envoy-pay viem
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
> **Who should use envoy?** Any developer building AI agents or machine-to-machine workflows that need to send or receive payments. If your agent hits `HTTP 402 Payment Required`, envoy handles it automatically — detects the protocol, checks the spending policy, settles on-chain, and retries. Your agent code never touches a payment.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Why do AI agents need envoy?
|
|
46
|
+
|
|
47
|
+
AI agents are the new workforce, but payments are built for humans. An agent can't open a bank account, fill out a checkout form, or click "pay now." When it hits `402 Payment Required`, it stops dead — and even if it could pay, nothing proves *which* agent paid, or stops it from draining its wallet.
|
|
48
|
+
|
|
49
|
+
| Problem | How envoy solves it |
|
|
50
|
+
|---|---|
|
|
51
|
+
| **Agents can't pay for APIs** | Auto-settles x402 and MPP `402` challenges on-chain (or via Stripe) — zero payment code. |
|
|
52
|
+
| **Agents have no verifiable identity** | Every agent is a first-class **ERC-8004 NFT** on Celo, indexed by [8004scan](https://8004scan.io). No bespoke identity contract. |
|
|
53
|
+
| **Agents overspend** | A spending policy is enforced **twice** — in the client (budget, per-tx cap, allow/deny) *and* on-chain by `EnvoyFacilitator` (per-agent, per-token rolling caps). |
|
|
54
|
+
| **No trust between agents** | `EnvoyFacilitator.pay()` settles an EIP-712-authorized payment, splits net/fee, and emits a verifiable `Settled` receipt — the merchant checks it on-chain before serving. |
|
|
55
|
+
|
|
56
|
+
> **envoy is Stripe for machines, settled on-chain.** Your agent calls `performTask()`; envoy handles wallet, protocol detection, settlement, policy, and receipt verification.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
### Install
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install envoy-pay viem
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Node 18+. Tree-shakable ESM + CJS dual build. Every non-Celo rail (Stripe, Solana, Stellar) is an **optional peer dependency**, pulled in only when you import its subpath.
|
|
69
|
+
|
|
70
|
+
### Make an agent pay for an API — Celo + cUSD
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { EnvoyClient, EvmPaymentAdapter } from 'envoy-pay';
|
|
74
|
+
|
|
75
|
+
const agent = new EnvoyClient({
|
|
76
|
+
baseURL: 'https://api.example.com',
|
|
77
|
+
adapter: new EvmPaymentAdapter({
|
|
78
|
+
chain: 'celo',
|
|
79
|
+
asset: 'cUSD',
|
|
80
|
+
privateKey: process.env.AGENT_PRIVATE_KEY as `0x${string}`,
|
|
81
|
+
}),
|
|
82
|
+
policy: {
|
|
83
|
+
monthlyBudget: 100, // never spend more than $100 / month
|
|
84
|
+
maxAmountPerTransaction: 5, // never spend more than $5 in one tx
|
|
85
|
+
},
|
|
86
|
+
logger: console.log,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// envoy handles the 402 → settle → retry loop transparently.
|
|
90
|
+
const data = await agent.performTask('/premium-data', { prompt: '…' });
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**What happens:** agent sends request → API returns `402 Payment Required` → envoy auto-detects the protocol (x402 or MPP) → checks the policy → settles on Celo → retries with the payment proof → `200 OK`. Your agent never sees the payment.
|
|
94
|
+
|
|
95
|
+
<details>
|
|
96
|
+
<summary><strong>💳 Stripe MPP (fiat + stablecoin)</strong> — <code>envoy-pay/stripe</code></summary>
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { EnvoyClient } from 'envoy-pay';
|
|
100
|
+
import { StripePaymentAdapter } from 'envoy-pay/stripe';
|
|
101
|
+
|
|
102
|
+
const agent = new EnvoyClient({
|
|
103
|
+
baseURL: 'https://api.example.com',
|
|
104
|
+
adapter: new StripePaymentAdapter({
|
|
105
|
+
stripeSecretKey: process.env.STRIPE_SECRET_KEY!,
|
|
106
|
+
networkId: 'my-network',
|
|
107
|
+
}),
|
|
108
|
+
policy: { monthlyBudget: 200, maxAmountPerTransaction: 10 },
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Manages the full Stripe Shared Payment Token lifecycle, including crypto deposits via Tempo.
|
|
113
|
+
|
|
114
|
+
</details>
|
|
115
|
+
|
|
116
|
+
<details>
|
|
117
|
+
<summary><strong>◎ Solana (SOL / USDC)</strong> — <code>envoy-pay/solana</code></summary>
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import { EnvoyClient } from 'envoy-pay';
|
|
121
|
+
import { SolanaPaymentAdapter } from 'envoy-pay/solana';
|
|
122
|
+
|
|
123
|
+
const agent = new EnvoyClient({
|
|
124
|
+
baseURL: 'https://api.example.com',
|
|
125
|
+
adapter: new SolanaPaymentAdapter({
|
|
126
|
+
secretKey: myKeypair.secretKey,
|
|
127
|
+
network: 'mainnet-beta',
|
|
128
|
+
asset: 'USDC',
|
|
129
|
+
}),
|
|
130
|
+
policy: { monthlyBudget: 50, maxAmountPerTransaction: 2 },
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Creates Associated Token Accounts automatically. SOL + Circle USDC on mainnet-beta and devnet.
|
|
135
|
+
|
|
136
|
+
</details>
|
|
137
|
+
|
|
138
|
+
<details>
|
|
139
|
+
<summary><strong>🌟 Stellar (XLM / USDC)</strong> — <code>envoy-pay/stellar</code></summary>
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
import { EnvoyClient } from 'envoy-pay';
|
|
143
|
+
import { StellarPaymentAdapter } from 'envoy-pay/stellar';
|
|
144
|
+
|
|
145
|
+
const agent = new EnvoyClient({
|
|
146
|
+
baseURL: 'https://api.example.com',
|
|
147
|
+
adapter: new StellarPaymentAdapter({
|
|
148
|
+
secretKey: process.env.STELLAR_SECRET!,
|
|
149
|
+
network: 'mainnet',
|
|
150
|
+
asset: 'USDC',
|
|
151
|
+
}),
|
|
152
|
+
policy: { monthlyBudget: 50, maxAmountPerTransaction: 2 },
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Handles Stellar trustline management automatically. XLM + Circle USDC on mainnet and testnet.
|
|
157
|
+
|
|
158
|
+
</details>
|
|
159
|
+
|
|
160
|
+
<details>
|
|
161
|
+
<summary><strong>⛓️ On-chain settlement via <code>EnvoyFacilitator</code></strong> — <code>envoy-pay/contracts</code></summary>
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
import { createEnvoyFacilitator, signPaymentAuth } from 'envoy-pay/contracts';
|
|
165
|
+
|
|
166
|
+
// Sign an EIP-712 PaymentAuth from the agent's wallet and settle it through the
|
|
167
|
+
// EnvoyFacilitator on Celo — net to the merchant, fee to the treasury, one Settled event.
|
|
168
|
+
const facilitator = createEnvoyFacilitator({ chainId: 42220, walletClient, publicClient });
|
|
169
|
+
const auth = await signPaymentAuth(account, { /* agentId, to, token, amount, challengeId, … */ });
|
|
170
|
+
const { txHash } = await facilitator.pay(auth);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
This is the bridge the [autonomous-loop example](examples/autonomous-loop/) drops into a stock `EnvoyClient` so the whole 402 loop settles on-chain with no human in the loop.
|
|
174
|
+
|
|
175
|
+
</details>
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## How does envoy work?
|
|
180
|
+
|
|
181
|
+
The core `EnvoyClient` handles protocol detection and the retry loop; pluggable `PaymentAdapter` implementations handle chain-specific settlement.
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
┌───────────────┐ ┌─────────────────┐ ┌──────────────┐
|
|
185
|
+
│ AI Agent │ HTTP │ Paid API / │ │ Celo │
|
|
186
|
+
│ (your code) ├────────►│ Agent service │ │ Mainnet │
|
|
187
|
+
└───────┬───────┘ └────────┬────────┘ └──────▲───────┘
|
|
188
|
+
│ │ │
|
|
189
|
+
│ ▼ 402 Payment Required │
|
|
190
|
+
│ ┌───────────────┐ │
|
|
191
|
+
│ │ x402 / MPP │ │
|
|
192
|
+
│ │ challenge │ │
|
|
193
|
+
│ └───────┬───────┘ │
|
|
194
|
+
▼ ▼ │
|
|
195
|
+
┌────────────────────────────────────────────────┐ │
|
|
196
|
+
│ EnvoyClient │ │
|
|
197
|
+
│ ┌────────────┐ ┌──────────────┐ ┌───────┐ │ │
|
|
198
|
+
│ │ detect ├─►│ PolicyEngine ├─►│ pay() │───┼───cUSD/USDC───┘
|
|
199
|
+
│ │ protocol │ │ budget gate │ │ on- │ │
|
|
200
|
+
│ └────────────┘ └──────────────┘ │ chain │ │
|
|
201
|
+
│ └───┬───┘ │
|
|
202
|
+
│ ◄── retry with X-PAYMENT proof ────┘ │
|
|
203
|
+
└────────────────────────────────────────────────┘
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Components
|
|
207
|
+
|
|
208
|
+
| Module | Import | What it does |
|
|
209
|
+
|---|---|---|
|
|
210
|
+
| [`EnvoyClient`](src/client.ts) | `envoy-pay` | Dual-protocol HTTP client — intercepts `402`, auto-detects x402 vs MPP, settles, retries. |
|
|
211
|
+
| [`EvmPaymentAdapter`](src/adapters/evm.ts) | `envoy-pay` | One class for Celo + 11 EVM chains. Native token + every stablecoin (cUSD, cEUR, cREAL, USDC, USDT). |
|
|
212
|
+
| [`PolicyEngine`](src/policy.ts) | `envoy-pay` | Monthly budget, per-tx cap, allow/deny lists. Rejects by default. |
|
|
213
|
+
| [`AgentIdentity`](src/identity/agent-identity.ts) | `envoy-pay` · `/identity` | W3C DID + ERC-8004 identity, optionally backed by the on-chain registry. |
|
|
214
|
+
| [`EnvoyFacilitator` client](src/contracts/facilitator.ts) | `envoy-pay` · `/contracts` | Sign EIP-712 `PaymentAuth`, call `pay()`, read limits, decode `Settled`. |
|
|
215
|
+
| [`StripePaymentAdapter`](src/adapters/stripe.ts) | `envoy-pay/stripe` | MPP via Stripe Shared Payment Tokens (fiat + stablecoins). |
|
|
216
|
+
| [`SolanaPaymentAdapter`](src/adapters/solana.ts) · [`StellarPaymentAdapter`](src/adapters/stellar.ts) | `envoy-pay/solana` · `/stellar` | Non-EVM settlement + watchers + request URIs. |
|
|
217
|
+
| [`UnifiedWallet`](src/wallet/unified-wallet.ts) | `envoy-pay/wallet` | Cross-chain wallet with intent resolution + chain routing. |
|
|
218
|
+
| [`FacilitatorService`](src/facilitator/facilitator-service.ts) | `envoy-pay/facilitator` | Hosted facilitator with fee calculation + receipts. |
|
|
219
|
+
| [402 gates](src/server/) | `envoy-pay/server` | Server-side x402 / MPP gating, webhook + receipt verification. |
|
|
220
|
+
| [Watchers](src/monitor/) | `envoy-pay/monitor` | EVM, Solana, Stellar payment monitoring (the EVM watcher ships in core). |
|
|
221
|
+
|
|
222
|
+
> **Extensible:** add any rail by implementing the [`PaymentAdapter`](src/adapters/types.ts) interface.
|
|
223
|
+
|
|
224
|
+
### Charge agents for *your* API (Pay In)
|
|
225
|
+
|
|
226
|
+
```ts
|
|
227
|
+
import { createX402Gate } from 'envoy-pay/server';
|
|
228
|
+
|
|
229
|
+
app.post('/api/premium', createX402Gate({
|
|
230
|
+
payTo: '0xYOUR_TREASURY',
|
|
231
|
+
amount: '500000', // 0.50 in 6-decimal stablecoin units
|
|
232
|
+
asset: 'cUSD',
|
|
233
|
+
network: 'eip155:42220', // Celo
|
|
234
|
+
}), (req, res) => {
|
|
235
|
+
res.json({ data: 'premium content' });
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Server returns `402` + challenge → agent pays on-chain → retries with proof → the gate verifies and serves `200 OK`. MPP gating (`createMppGate`) works the same way.
|
|
240
|
+
|
|
241
|
+
### Generate payment-request URIs
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
import { buildEip681Uri } from 'envoy-pay'; // EIP-681 (Celo / EVM)
|
|
245
|
+
import { buildSep7Uri } from 'envoy-pay/stellar'; // SEP-7 (Stellar)
|
|
246
|
+
import { buildSolanaPayUri } from 'envoy-pay/solana'; // Solana Pay
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
For QR codes, deep links, or agent-to-agent payment requests across any supported chain.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## The on-chain layer
|
|
254
|
+
|
|
255
|
+
This is what makes envoy **trust-minimized** rather than just a payment client. The on-chain layer lives in [`contracts/`](contracts/) (Hardhat, Solidity 0.8.27, OpenZeppelin 5) and ships **one** payment contract — identity and reputation are delegated to Celo's canonical **ERC-8004** registries.
|
|
256
|
+
|
|
257
|
+
| Contract | What it does | Source |
|
|
258
|
+
|---|---|---|
|
|
259
|
+
| **`EnvoyFacilitator`** | One `pay()` consumes an EIP-712 auth from the agent's wallet, validates the signer against canonical ERC-8004 `getAgentWallet(agentId)`, enforces per-(agent, token) rolling-window spending limits, splits the amount into net (→ merchant) and fee (→ treasury), and emits a `Settled` event keyed by `challengeId`. Strict CEI, ERC-1271 fallback for smart-wallet agents, zero internal balance. | [`EnvoyFacilitator.sol`](contracts/src/EnvoyFacilitator.sol) |
|
|
260
|
+
|
|
261
|
+
### Canonical ERC-8004 (Celo)
|
|
262
|
+
|
|
263
|
+
| Registry | Mainnet | Sepolia |
|
|
264
|
+
|---|---|---|
|
|
265
|
+
| Identity | `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` | `0x8004A818BFB912233c491871b3d84c89A494BD9e` |
|
|
266
|
+
| Reputation | `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63` | `0x8004B663056A597Dffe9eCcC1965A193B7388713` |
|
|
267
|
+
|
|
268
|
+
Agents are first-class ERC-8004 NFTs, so [8004scan](https://8004scan.io) indexes them automatically — no Envoy-specific identity contract.
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
cd contracts && npm install
|
|
272
|
+
npx hardhat compile && npx hardhat test # 23 specs
|
|
273
|
+
npx hardhat run scripts/deploy.ts --network celo # mainnet (celoSepolia for testnet)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Live on Celo Mainnet
|
|
279
|
+
|
|
280
|
+
`EnvoyFacilitator` is deployed and verified on Celo Mainnet — every payment is a real, sub-cent on-chain settlement.
|
|
281
|
+
|
|
282
|
+
| | |
|
|
283
|
+
|---|---|
|
|
284
|
+
| **EnvoyFacilitator** | [`0xE268B6fE16319b49D22562C93c0d2395F65FCAcC`](https://celoscan.io/address/0xE268B6fE16319b49D22562C93c0d2395F65FCAcC) |
|
|
285
|
+
| **Chain** | Celo Mainnet (`42220`) — sub-cent fees, ~5s finality, native stablecoins |
|
|
286
|
+
| **Identity** | Canonical ERC-8004 NFTs, [8004scan](https://8004scan.io)-indexed |
|
|
287
|
+
| **Demo** | [`examples/autonomous-loop/`](examples/autonomous-loop/) — `npm run demo` |
|
|
288
|
+
|
|
289
|
+
The **autonomous loop** is envoy's whole thesis, runnable in one command: an `EnvoyClient` agent hits a 402-gated API, settles through `EnvoyFacilitator` with an EIP-712 auth, retries, and gets the data — while the merchant verifies the on-chain `Settled` event, the agent's ERC-8004 capability, and (optionally) a **Self Agent ID proof-of-human** before serving. **No human co-signs a single step.** It ships with a zero-spend dry run; see its [walkthrough](examples/autonomous-loop/README.md).
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Import surface
|
|
294
|
+
|
|
295
|
+
The default `envoy-pay` import is a **lean Celo core**; every other rail and capability is opt-in via a subpath, so your bundle only carries what you use — and adding a rail never means giving one up.
|
|
296
|
+
|
|
297
|
+
| Subpath | Ships |
|
|
298
|
+
|---|---|
|
|
299
|
+
| `envoy-pay` | Core — `EnvoyClient`, `PolicyEngine`, x402/MPP, `EvmPaymentAdapter`, EVM watcher, EIP-681, ERC-8004 identity, `EnvoyFacilitator` client |
|
|
300
|
+
| `envoy-pay/stripe` | `StripePaymentAdapter` — Stripe MPP (fiat + stablecoins) |
|
|
301
|
+
| `envoy-pay/solana` · `/stellar` | Solana / Stellar adapters + watchers + request URIs |
|
|
302
|
+
| `envoy-pay/server` | Server-side 402 gates (x402, MPP), webhook + receipt verification |
|
|
303
|
+
| `envoy-pay/wallet` | `UnifiedWallet` — cross-chain wallet, intent resolution, chain routing |
|
|
304
|
+
| `envoy-pay/facilitator` | Hosted `FacilitatorService` + fee engine |
|
|
305
|
+
| `envoy-pay/contracts` · `/identity` | Typed `EnvoyFacilitator` client + ABI · ERC-8004 helpers |
|
|
306
|
+
| `envoy-pay/monitor` · `/requests` | Every chain watcher · every request-URI builder |
|
|
307
|
+
| `envoy-pay/ows` · `/okx` · `/bridge` | Open Wallet Standard · OnchainOS (OKX DEX) · cross-chain USDC bridge |
|
|
308
|
+
|
|
309
|
+
The heavy rail SDKs (`stripe`, `@solana/web3.js`, `@stellar/stellar-sdk`) are optional peer dependencies — declared, never bundled. A Celo-only agent installs nothing extra.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## What protocols does envoy support?
|
|
314
|
+
|
|
315
|
+
envoy speaks both major machine-payment protocols and auto-detects which one a server uses on every `402`.
|
|
316
|
+
|
|
317
|
+
<table>
|
|
318
|
+
<tr>
|
|
319
|
+
<td width="50%">
|
|
320
|
+
|
|
321
|
+
### x402
|
|
322
|
+
<sub>Coinbase · Cloudflare · Base</sub>
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
Server → 402 + JSON body
|
|
326
|
+
{ x402Version: 1, accepts: [...] }
|
|
327
|
+
|
|
328
|
+
Agent → On-chain tx
|
|
329
|
+
→ X-PAYMENT: <base64 proof>
|
|
330
|
+
|
|
331
|
+
Server → 200 OK ✅
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
</td>
|
|
335
|
+
<td width="50%">
|
|
336
|
+
|
|
337
|
+
### MPP
|
|
338
|
+
<sub>Stripe · Tempo</sub>
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
Server → 402
|
|
342
|
+
→ WWW-Authenticate: Payment
|
|
343
|
+
id="ch1", method="..."
|
|
344
|
+
|
|
345
|
+
Agent → settle (on-chain / SPT)
|
|
346
|
+
→ Authorization: Payment <cred>
|
|
347
|
+
|
|
348
|
+
Server → 200 OK + Payment-Receipt ✅
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
</td>
|
|
352
|
+
</tr>
|
|
353
|
+
</table>
|
|
354
|
+
|
|
355
|
+
> Your agent code doesn't change — `EnvoyClient` detects the protocol and dispatches to the right handler.
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Networks
|
|
360
|
+
|
|
361
|
+
Celo is the first-class chain (ranked first in the router scorer). envoy settles across **12 EVM chains plus Solana, Stellar, and Stripe fiat**.
|
|
362
|
+
|
|
363
|
+
<table>
|
|
364
|
+
<tr><td valign="top">
|
|
365
|
+
|
|
366
|
+
### EVM
|
|
367
|
+
|
|
368
|
+
| Chain | Chain ID | Stablecoins |
|
|
369
|
+
|---|---|---|
|
|
370
|
+
| **Celo** ⭐ | `42220` | cUSD, cEUR, cREAL, USDC, USDT |
|
|
371
|
+
| Celo Sepolia | `11142220` | cUSD, cKES, USDC |
|
|
372
|
+
| Base | `8453` | USDC |
|
|
373
|
+
| Arbitrum | `42161` | USDC |
|
|
374
|
+
| Optimism | `10` | USDC |
|
|
375
|
+
| Ethereum | `1` | USDC |
|
|
376
|
+
| Polygon | `137` | USDC |
|
|
377
|
+
| X Layer | `196` | USDC |
|
|
378
|
+
|
|
379
|
+
</td><td valign="top">
|
|
380
|
+
|
|
381
|
+
### Non-EVM
|
|
382
|
+
|
|
383
|
+
| Network | Assets |
|
|
384
|
+
|---|---|
|
|
385
|
+
| **Solana** | SOL, USDC |
|
|
386
|
+
| Solana Devnet | SOL, USDC |
|
|
387
|
+
| **Stellar** | XLM, USDC |
|
|
388
|
+
| Stellar Testnet | XLM, USDC |
|
|
389
|
+
| **Stripe MPP** | USD (fiat) |
|
|
390
|
+
|
|
391
|
+
⭐ Celo: default, sub-cent fees, ~5s finality, native stablecoins.
|
|
392
|
+
|
|
393
|
+
</td></tr>
|
|
394
|
+
</table>
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## How does the spending policy work?
|
|
399
|
+
|
|
400
|
+
Every payment is gated **twice** — defense in depth no client-only SDK can offer:
|
|
401
|
+
|
|
402
|
+
1. **In the client** — `PolicyEngine` rejects by default and only lets a payment through if it passes every check: positive amount, under the per-transaction cap, within the rolling monthly budget, and to an allowed destination.
|
|
403
|
+
2. **On-chain** — `EnvoyFacilitator` independently enforces per-(agent, token) rolling-window limits in Solidity. Even a compromised client cannot exceed the caps written on-chain.
|
|
404
|
+
|
|
405
|
+
```ts
|
|
406
|
+
policy: {
|
|
407
|
+
monthlyBudget: 100, // rolling 30-day ceiling
|
|
408
|
+
maxAmountPerTransaction: 5, // per-tx cap
|
|
409
|
+
// optional allow / deny lists for destinations
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## How does envoy compare?
|
|
416
|
+
|
|
417
|
+
| Capability | **envoy** | Stripe (MPP) | Coinbase (x402) | Generic x402 lib |
|
|
418
|
+
|---|:---:|:---:|:---:|:---:|
|
|
419
|
+
| x402 protocol | ✅ | ❌ | ✅ (Base) | ✅ |
|
|
420
|
+
| MPP protocol | ✅ | ✅ | ❌ | ❌ |
|
|
421
|
+
| **Dual protocol (x402 + MPP)** | ✅ | ❌ | ❌ | ❌ |
|
|
422
|
+
| On-chain settlement contract | ✅ `EnvoyFacilitator` | ❌ | ❌ | ❌ |
|
|
423
|
+
| **Canonical ERC-8004 identity** | ✅ | ❌ | ❌ | ❌ |
|
|
424
|
+
| On-chain enforced spending caps | ✅ | ❌ | ❌ | ❌ |
|
|
425
|
+
| Celo-first (sub-cent, native stablecoins) | ✅ | ❌ | ❌ | varies |
|
|
426
|
+
| Multi-chain (12 EVM + Solana + Stellar + fiat) | ✅ | ❌ | Base only | varies |
|
|
427
|
+
| Modular subpath imports | ✅ | — | — | — |
|
|
428
|
+
| Open source (Apache-2.0) | ✅ | ❌ | partial | varies |
|
|
429
|
+
|
|
430
|
+
> envoy is the only stack that pairs **dual-protocol HTTP settlement** with a **deployed on-chain facilitator** and **canonical ERC-8004 identity** — agents are verifiable on-chain entities, not anonymous wallets.
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## FAQ
|
|
435
|
+
|
|
436
|
+
### Is envoy free and open-source?
|
|
437
|
+
Yes — Apache-2.0. The SDK and contracts are free; you pay only blockchain gas (sub-cent on Celo) or Stripe fees.
|
|
438
|
+
|
|
439
|
+
### Does it work with LangChain, CrewAI, or custom agents?
|
|
440
|
+
Yes. envoy is a plain TypeScript SDK — import it, configure an adapter + policy, and any JS/TS agent framework handles payments automatically.
|
|
441
|
+
|
|
442
|
+
### Can I do agent-to-agent payments?
|
|
443
|
+
Yes. Use an adapter to pay out, the `envoy-pay/server` gates to charge, and the request-URI builders for payment requests. On-chain, `EnvoyFacilitator` settles agent→agent with verifiable receipts.
|
|
444
|
+
|
|
445
|
+
### Why Celo?
|
|
446
|
+
Sub-cent fees, ~5s finality, and native stablecoins (cUSD/cEUR/cREAL) make micropayments viable — and Celo hosts the canonical ERC-8004 registries envoy uses for identity.
|
|
447
|
+
|
|
448
|
+
### What is ERC-8004?
|
|
449
|
+
A standard for on-chain agent identity. envoy registers each agent as an ERC-8004 NFT in Celo's canonical registry, so any party can verify who an agent is — and `EnvoyFacilitator` checks the signer against `getAgentWallet(agentId)` before settling.
|
|
450
|
+
|
|
451
|
+
### How do I add a new chain or rail?
|
|
452
|
+
Implement the [`PaymentAdapter`](src/adapters/types.ts) interface. See the EVM, Solana, Stellar, and Stripe adapters as references.
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
## Testing
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
npm install
|
|
460
|
+
npm run typecheck # tsc --noEmit
|
|
461
|
+
npm test # vitest
|
|
462
|
+
npm run build # cjs + esm + types (lean core + every subpath)
|
|
463
|
+
npm run demo # the autonomous loop — dry run by default
|
|
464
|
+
|
|
465
|
+
npm run contracts:compile # hardhat compile
|
|
466
|
+
npm run contracts:test # hardhat test (23 specs)
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
| Suite | Tests | Covers |
|
|
470
|
+
|---|---|---|
|
|
471
|
+
| `evm.test.ts` | 51 | Celo + EVM chains, native + every stablecoin, balances |
|
|
472
|
+
| `mpp.test.ts` | 26 | Challenge parsing, credentials, protocol detection |
|
|
473
|
+
| `stripe.test.ts` | 25 | SPT flow, PaymentIntent, server challenges |
|
|
474
|
+
| `unified-wallet.test.ts` · `payment-uri.test.ts` | 23 each | Cross-chain wallet · EIP-681 / SEP-7 / Solana Pay |
|
|
475
|
+
| `facilitator-service.test.ts` · `session-manager.test.ts` | 21 each | Fee engine + receipts · session lifecycle |
|
|
476
|
+
| `policy.test.ts` · `intent-resolver.test.ts` | 20 each | Budget gates · cross-chain intent routing |
|
|
477
|
+
| `solana` · `stellar` · `chain-router` · `agent-card` · `did-resolver` … | 15–18 each | Non-EVM rails, routing, ERC-8004 identity |
|
|
478
|
+
| _… 35 suites total_ | **499 passing** (+9 integration tests skipped without creds) | + server gates, watchers, webhooks, contracts client |
|
|
479
|
+
|
|
480
|
+
CI runs the SDK and the Hardhat contracts on every push (Node 18/20/22) — see [`.github/workflows/ci.yml`](.github/workflows/ci.yml).
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
## Technology stack
|
|
485
|
+
|
|
486
|
+
| Layer | Stack |
|
|
487
|
+
|---|---|
|
|
488
|
+
| **EVM** | [viem](https://viem.sh) — type-safe Ethereum client |
|
|
489
|
+
| **Contracts** | Solidity 0.8.27, OpenZeppelin 5, [Hardhat](https://hardhat.org) |
|
|
490
|
+
| **Identity** | Canonical [ERC-8004](https://8004scan.io) registries on Celo |
|
|
491
|
+
| **Solana** | [@solana/web3.js](https://solana.com) + [@solana/spl-token](https://spl.solana.com/token) |
|
|
492
|
+
| **Stellar** | [@stellar/stellar-sdk](https://stellar.org) |
|
|
493
|
+
| **Stripe** | Stripe MPP / Shared Payment Tokens |
|
|
494
|
+
| **HTTP** | [axios](https://axios-http.com) with interceptor-based 402 handling |
|
|
495
|
+
| **Build / Test** | TypeScript strict, dual CJS + ESM, [Vitest](https://vitest.dev) |
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## Project layout
|
|
500
|
+
|
|
501
|
+
```
|
|
502
|
+
envoy-pay/
|
|
503
|
+
├── src/ TypeScript SDK
|
|
504
|
+
│ ├── index.ts Lean Celo core — the default `envoy-pay` import
|
|
505
|
+
│ ├── solana.ts, stellar.ts Subpath entry points (envoy-pay/solana, /stellar)
|
|
506
|
+
│ ├── adapters/ EVM (Celo + 11 chains), Solana, Stellar, Stripe MPP, OWS
|
|
507
|
+
│ ├── contracts/ EnvoyFacilitator viem client + ABI + deployed addresses
|
|
508
|
+
│ ├── identity/ ERC-8004 helpers, DID, agent card, reputation
|
|
509
|
+
│ ├── facilitator/ Hosted facilitator service + fee engine
|
|
510
|
+
│ ├── monitor/ Payment watchers (EVM, Solana, Stellar, multi-chain)
|
|
511
|
+
│ ├── providers/ OnchainOS (OKX) + cross-chain USDC bridge
|
|
512
|
+
│ ├── requests/ EIP-681, SEP-7, Solana Pay URI builders
|
|
513
|
+
│ ├── server/ Server-side gates (x402, MPP, webhook, receipt)
|
|
514
|
+
│ └── wallet/ Unified multi-chain wallet
|
|
515
|
+
├── contracts/ Hardhat workspace — EnvoyFacilitator.sol (+ mocks), 23 specs
|
|
516
|
+
└── examples/ Runnable examples (incl. the autonomous loop)
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
The web product UI lives in a separate repo, [`envoy-pay/envoy-app`](https://github.com/envoy-pay/envoy-app), which consumes this package.
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## License
|
|
524
|
+
|
|
525
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
526
|
+
|
|
527
|
+
<div align="center">
|
|
528
|
+
<sub>envoy — the payment layer for autonomous AI agents. Built on Celo.</sub>
|
|
529
|
+
</div>
|