agentwallet-sdk 5.1.0 → 5.2.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/LICENSE +21 -0
- package/README.md +240 -20
- package/dist/bridge/__tests__/solana.test.d.ts +2 -0
- package/dist/bridge/__tests__/solana.test.d.ts.map +1 -0
- package/dist/bridge/__tests__/solana.test.js +106 -0
- package/dist/bridge/__tests__/solana.test.js.map +1 -0
- package/dist/bridge/client.d.ts +21 -7
- package/dist/bridge/client.d.ts.map +1 -1
- package/dist/bridge/client.js +16 -1
- package/dist/bridge/client.js.map +1 -1
- package/dist/bridge/index.d.ts +12 -1
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/index.js +11 -0
- package/dist/bridge/index.js.map +1 -1
- package/dist/bridge/solana.d.ts +132 -0
- package/dist/bridge/solana.d.ts.map +1 -0
- package/dist/bridge/solana.js +313 -0
- package/dist/bridge/solana.js.map +1 -0
- package/dist/bridge/types.d.ts +35 -10
- package/dist/bridge/types.d.ts.map +1 -1
- package/dist/bridge/types.js +16 -4
- package/dist/bridge/types.js.map +1 -1
- package/dist/index.d.ts +215 -288
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/swap/SwapModule.d.ts +17 -3
- package/dist/swap/SwapModule.d.ts.map +1 -1
- package/dist/swap/SwapModule.js +20 -4
- package/dist/swap/SwapModule.js.map +1 -1
- package/dist/swap/index.d.ts +9 -2
- package/dist/swap/index.d.ts.map +1 -1
- package/dist/swap/index.js +8 -1
- package/dist/swap/index.js.map +1 -1
- package/dist/swap/types.d.ts +58 -1
- package/dist/swap/types.d.ts.map +1 -1
- package/dist/swap/types.js +56 -1
- package/dist/swap/types.js.map +1 -1
- package/dist/types.d.ts +20 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -1
- package/dist/x402/__tests__/client.test.js +77 -5
- package/dist/x402/__tests__/client.test.js.map +1 -1
- package/dist/x402/chains/stellar/index.d.ts +149 -0
- package/dist/x402/chains/stellar/index.d.ts.map +1 -0
- package/dist/x402/chains/stellar/index.js +197 -0
- package/dist/x402/chains/stellar/index.js.map +1 -0
- package/dist/x402/client.d.ts.map +1 -1
- package/dist/x402/client.js.map +1 -1
- package/dist/x402/types.d.ts +22 -3
- package/dist/x402/types.d.ts.map +1 -1
- package/dist/x402/types.js +34 -4
- package/dist/x402/types.js.map +1 -1
- package/package.json +16 -5
- package/dist/ap2/index.d.ts +0 -185
- package/dist/ap2/index.d.ts.map +0 -1
- package/dist/ap2/index.js +0 -255
- package/dist/ap2/index.js.map +0 -1
- package/dist/bridge/unified.d.ts +0 -101
- package/dist/bridge/unified.d.ts.map +0 -1
- package/dist/bridge/unified.js +0 -284
- package/dist/bridge/unified.js.map +0 -1
- package/dist/chains.d.ts +0 -62
- package/dist/chains.d.ts.map +0 -1
- package/dist/chains.js +0 -108
- package/dist/chains.js.map +0 -1
- package/dist/fiat/index.d.ts +0 -10
- package/dist/fiat/index.d.ts.map +0 -1
- package/dist/fiat/index.js +0 -9
- package/dist/fiat/index.js.map +0 -1
- package/dist/fiat/onramp.d.ts +0 -101
- package/dist/fiat/onramp.d.ts.map +0 -1
- package/dist/fiat/onramp.js +0 -155
- package/dist/fiat/onramp.js.map +0 -1
- package/dist/fiat/providers/index.d.ts +0 -16
- package/dist/fiat/providers/index.d.ts.map +0 -1
- package/dist/fiat/providers/index.js +0 -30
- package/dist/fiat/providers/index.js.map +0 -1
- package/dist/fiat/providers/moonpay.d.ts +0 -22
- package/dist/fiat/providers/moonpay.d.ts.map +0 -1
- package/dist/fiat/providers/moonpay.js +0 -107
- package/dist/fiat/providers/moonpay.js.map +0 -1
- package/dist/fiat/providers/stripe.d.ts +0 -26
- package/dist/fiat/providers/stripe.d.ts.map +0 -1
- package/dist/fiat/providers/stripe.js +0 -135
- package/dist/fiat/providers/stripe.js.map +0 -1
- package/dist/fiat/providers/transak.d.ts +0 -26
- package/dist/fiat/providers/transak.d.ts.map +0 -1
- package/dist/fiat/providers/transak.js +0 -119
- package/dist/fiat/providers/transak.js.map +0 -1
- package/dist/fiat/types.d.ts +0 -106
- package/dist/fiat/types.d.ts.map +0 -1
- package/dist/fiat/types.js +0 -13
- package/dist/fiat/types.js.map +0 -1
- package/dist/flash/executor.d.ts +0 -119
- package/dist/flash/executor.d.ts.map +0 -1
- package/dist/flash/executor.js +0 -195
- package/dist/flash/executor.js.map +0 -1
- package/dist/flash/index.d.ts +0 -28
- package/dist/flash/index.d.ts.map +0 -1
- package/dist/flash/index.js +0 -29
- package/dist/flash/index.js.map +0 -1
- package/dist/flash/scanner.d.ts +0 -133
- package/dist/flash/scanner.d.ts.map +0 -1
- package/dist/flash/scanner.js +0 -212
- package/dist/flash/scanner.js.map +0 -1
- package/dist/flash/types.d.ts +0 -136
- package/dist/flash/types.d.ts.map +0 -1
- package/dist/flash/types.js +0 -23
- package/dist/flash/types.js.map +0 -1
- package/dist/gas/index.d.ts +0 -4
- package/dist/gas/index.d.ts.map +0 -1
- package/dist/gas/index.js +0 -3
- package/dist/gas/index.js.map +0 -1
- package/dist/gas/sponsor.d.ts +0 -70
- package/dist/gas/sponsor.d.ts.map +0 -1
- package/dist/gas/sponsor.js +0 -193
- package/dist/gas/sponsor.js.map +0 -1
- package/dist/gas/types.d.ts +0 -76
- package/dist/gas/types.d.ts.map +0 -1
- package/dist/gas/types.js +0 -21
- package/dist/gas/types.js.map +0 -1
- package/dist/identity/agent-identity.d.ts +0 -276
- package/dist/identity/agent-identity.d.ts.map +0 -1
- package/dist/identity/agent-identity.js +0 -300
- package/dist/identity/agent-identity.js.map +0 -1
- package/dist/identity/email-resolver.d.ts +0 -235
- package/dist/identity/email-resolver.js +0 -283
- package/dist/identity/erc6551.d.ts +0 -441
- package/dist/identity/erc6551.d.ts.map +0 -1
- package/dist/identity/erc6551.js +0 -517
- package/dist/identity/erc6551.js.map +0 -1
- package/dist/mev/index.d.ts +0 -4
- package/dist/mev/index.d.ts.map +0 -1
- package/dist/mev/index.js +0 -8
- package/dist/mev/index.js.map +0 -1
- package/dist/mev/protection.d.ts +0 -54
- package/dist/mev/protection.d.ts.map +0 -1
- package/dist/mev/protection.js +0 -185
- package/dist/mev/protection.js.map +0 -1
- package/dist/mev/risk.d.ts +0 -19
- package/dist/mev/risk.d.ts.map +0 -1
- package/dist/mev/risk.js +0 -95
- package/dist/mev/risk.js.map +0 -1
- package/dist/mev/types.d.ts +0 -49
- package/dist/mev/types.d.ts.map +0 -1
- package/dist/mev/types.js +0 -2
- package/dist/mev/types.js.map +0 -1
- package/dist/settlement/index.d.ts +0 -4
- package/dist/settlement/index.d.ts.map +0 -1
- package/dist/settlement/index.js +0 -3
- package/dist/settlement/index.js.map +0 -1
- package/dist/settlement/types.d.ts +0 -66
- package/dist/settlement/types.d.ts.map +0 -1
- package/dist/settlement/types.js +0 -37
- package/dist/settlement/types.js.map +0 -1
- package/dist/settlement/verifier.d.ts +0 -75
- package/dist/settlement/verifier.d.ts.map +0 -1
- package/dist/settlement/verifier.js +0 -354
- package/dist/settlement/verifier.js.map +0 -1
- package/dist/solana/bridge.d.ts +0 -144
- package/dist/solana/bridge.d.ts.map +0 -1
- package/dist/solana/bridge.js +0 -352
- package/dist/solana/bridge.js.map +0 -1
- package/dist/solana/index.d.ts +0 -8
- package/dist/solana/index.d.ts.map +0 -1
- package/dist/solana/index.js +0 -6
- package/dist/solana/index.js.map +0 -1
- package/dist/solana/swap.d.ts +0 -85
- package/dist/solana/swap.d.ts.map +0 -1
- package/dist/solana/swap.js +0 -173
- package/dist/solana/swap.js.map +0 -1
- package/dist/solana/types.d.ts +0 -126
- package/dist/solana/types.d.ts.map +0 -1
- package/dist/solana/types.js +0 -10
- package/dist/solana/types.js.map +0 -1
- package/dist/solana/wallet.d.ts +0 -83
- package/dist/solana/wallet.d.ts.map +0 -1
- package/dist/solana/wallet.js +0 -164
- package/dist/solana/wallet.js.map +0 -1
- package/dist/solana/x402.d.ts +0 -69
- package/dist/solana/x402.d.ts.map +0 -1
- package/dist/solana/x402.js +0 -154
- package/dist/solana/x402.js.map +0 -1
- package/dist/solver/adapter.d.ts +0 -47
- package/dist/solver/adapter.d.ts.map +0 -1
- package/dist/solver/adapter.js +0 -146
- package/dist/solver/adapter.js.map +0 -1
- package/dist/solver/analyzer.d.ts +0 -48
- package/dist/solver/analyzer.d.ts.map +0 -1
- package/dist/solver/analyzer.js +0 -171
- package/dist/solver/analyzer.js.map +0 -1
- package/dist/solver/builder.d.ts +0 -31
- package/dist/solver/builder.d.ts.map +0 -1
- package/dist/solver/builder.js +0 -60
- package/dist/solver/builder.js.map +0 -1
- package/dist/solver/index.d.ts +0 -22
- package/dist/solver/index.d.ts.map +0 -1
- package/dist/solver/index.js +0 -25
- package/dist/solver/index.js.map +0 -1
- package/dist/solver/types.d.ts +0 -115
- package/dist/solver/types.d.ts.map +0 -1
- package/dist/solver/types.js +0 -10
- package/dist/solver/types.js.map +0 -1
- package/dist/spend-guard/index.d.ts +0 -125
- package/dist/spend-guard/index.d.ts.map +0 -1
- package/dist/spend-guard/index.js +0 -150
- package/dist/spend-guard/index.js.map +0 -1
- package/dist/swap/router/cache.d.ts +0 -13
- package/dist/swap/router/cache.d.ts.map +0 -1
- package/dist/swap/router/cache.js +0 -30
- package/dist/swap/router/cache.js.map +0 -1
- package/dist/swap/router/flashbots.d.ts +0 -10
- package/dist/swap/router/flashbots.d.ts.map +0 -1
- package/dist/swap/router/flashbots.js +0 -43
- package/dist/swap/router/flashbots.js.map +0 -1
- package/dist/swap/router/health.d.ts +0 -17
- package/dist/swap/router/health.d.ts.map +0 -1
- package/dist/swap/router/health.js +0 -38
- package/dist/swap/router/health.js.map +0 -1
- package/dist/swap/router/index.d.ts +0 -10
- package/dist/swap/router/index.d.ts.map +0 -1
- package/dist/swap/router/index.js +0 -10
- package/dist/swap/router/index.js.map +0 -1
- package/dist/swap/router/providers/cowswap.d.ts +0 -11
- package/dist/swap/router/providers/cowswap.d.ts.map +0 -1
- package/dist/swap/router/providers/cowswap.js +0 -79
- package/dist/swap/router/providers/cowswap.js.map +0 -1
- package/dist/swap/router/providers/index.d.ts +0 -20
- package/dist/swap/router/providers/index.d.ts.map +0 -1
- package/dist/swap/router/providers/index.js +0 -32
- package/dist/swap/router/providers/index.js.map +0 -1
- package/dist/swap/router/providers/jupiter.d.ts +0 -12
- package/dist/swap/router/providers/jupiter.d.ts.map +0 -1
- package/dist/swap/router/providers/jupiter.js +0 -73
- package/dist/swap/router/providers/jupiter.js.map +0 -1
- package/dist/swap/router/providers/lifi.d.ts +0 -11
- package/dist/swap/router/providers/lifi.d.ts.map +0 -1
- package/dist/swap/router/providers/lifi.js +0 -123
- package/dist/swap/router/providers/lifi.js.map +0 -1
- package/dist/swap/router/providers/oneinch.d.ts +0 -13
- package/dist/swap/router/providers/oneinch.d.ts.map +0 -1
- package/dist/swap/router/providers/oneinch.js +0 -71
- package/dist/swap/router/providers/oneinch.js.map +0 -1
- package/dist/swap/router/providers/paraswap.d.ts +0 -11
- package/dist/swap/router/providers/paraswap.d.ts.map +0 -1
- package/dist/swap/router/providers/paraswap.js +0 -73
- package/dist/swap/router/providers/paraswap.js.map +0 -1
- package/dist/swap/router/providers/uniswap.d.ts +0 -31
- package/dist/swap/router/providers/uniswap.d.ts.map +0 -1
- package/dist/swap/router/providers/uniswap.js +0 -237
- package/dist/swap/router/providers/uniswap.js.map +0 -1
- package/dist/swap/router/providers/zerox.d.ts +0 -13
- package/dist/swap/router/providers/zerox.d.ts.map +0 -1
- package/dist/swap/router/providers/zerox.js +0 -94
- package/dist/swap/router/providers/zerox.js.map +0 -1
- package/dist/swap/router/router.d.ts +0 -86
- package/dist/swap/router/router.d.ts.map +0 -1
- package/dist/swap/router/router.js +0 -224
- package/dist/swap/router/router.js.map +0 -1
- package/dist/swap/router/rsi/engine.d.ts +0 -60
- package/dist/swap/router/rsi/engine.d.ts.map +0 -1
- package/dist/swap/router/rsi/engine.js +0 -483
- package/dist/swap/router/rsi/engine.js.map +0 -1
- package/dist/swap/router/rsi/index.d.ts +0 -3
- package/dist/swap/router/rsi/index.d.ts.map +0 -1
- package/dist/swap/router/rsi/index.js +0 -3
- package/dist/swap/router/rsi/index.js.map +0 -1
- package/dist/swap/router/rsi/types.d.ts +0 -106
- package/dist/swap/router/rsi/types.d.ts.map +0 -1
- package/dist/swap/router/rsi/types.js +0 -3
- package/dist/swap/router/rsi/types.js.map +0 -1
- package/dist/swap/router/types.d.ts +0 -120
- package/dist/swap/router/types.d.ts.map +0 -1
- package/dist/swap/router/types.js +0 -16
- package/dist/swap/router/types.js.map +0 -1
- package/dist/tax/engine.d.ts +0 -131
- package/dist/tax/engine.d.ts.map +0 -1
- package/dist/tax/engine.js +0 -307
- package/dist/tax/engine.js.map +0 -1
- package/dist/tax/index.d.ts +0 -9
- package/dist/tax/index.d.ts.map +0 -1
- package/dist/tax/index.js +0 -12
- package/dist/tax/index.js.map +0 -1
- package/dist/tax/lots.d.ts +0 -60
- package/dist/tax/lots.d.ts.map +0 -1
- package/dist/tax/lots.js +0 -129
- package/dist/tax/lots.js.map +0 -1
- package/dist/tax/types.d.ts +0 -113
- package/dist/tax/types.d.ts.map +0 -1
- package/dist/tax/types.js +0 -18
- package/dist/tax/types.js.map +0 -1
- package/dist/verifiable-intent/index.d.ts +0 -84
- package/dist/verifiable-intent/index.js +0 -385
- package/dist/yield/index.d.ts +0 -26
- package/dist/yield/index.d.ts.map +0 -1
- package/dist/yield/index.js +0 -29
- package/dist/yield/index.js.map +0 -1
- package/dist/yield/rates.d.ts +0 -114
- package/dist/yield/rates.d.ts.map +0 -1
- package/dist/yield/rates.js +0 -351
- package/dist/yield/rates.js.map +0 -1
- package/dist/yield/types.d.ts +0 -134
- package/dist/yield/types.d.ts.map +0 -1
- package/dist/yield/types.js +0 -24
- package/dist/yield/types.js.map +0 -1
- package/dist/yield/vault.d.ts +0 -112
- package/dist/yield/vault.d.ts.map +0 -1
- package/dist/yield/vault.js +0 -264
- package/dist/yield/vault.js.map +0 -1
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* VerifiableIntent — Mastercard Verifiable Intent implementation for agentwallet-sdk
|
|
3
|
-
*
|
|
4
|
-
* Implements the Mastercard Verifiable Intent open standard (March 2026):
|
|
5
|
-
* - Create signed intent declarations for agent transactions
|
|
6
|
-
* - Verify intent signatures and scope constraints
|
|
7
|
-
* - Enforce spending caps, time windows, and merchant category limits
|
|
8
|
-
* - Compatible with Google AP2 (Agent Payments Protocol)
|
|
9
|
-
*
|
|
10
|
-
* The spec defines four pillars:
|
|
11
|
-
* 1. Agent Identity — unique Agentic Token per agent
|
|
12
|
-
* 2. Intent Declaration — structured payload describing the transaction
|
|
13
|
-
* 3. Authorization Chain — proof of human/system delegation
|
|
14
|
-
* 4. Scope Limits — spending caps, time windows, merchant categories
|
|
15
|
-
*
|
|
16
|
-
* @module verifiable-intent
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { createHash, createHmac, randomUUID } from 'crypto';
|
|
20
|
-
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
// Types
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @typedef {Object} AgentIdentity
|
|
27
|
-
* @property {string} agentId - Unique agent identifier (UUID or DID)
|
|
28
|
-
* @property {string} principalId - Human/system that delegated authority
|
|
29
|
-
* @property {string} agenticToken - Signed token proving agent registration
|
|
30
|
-
* @property {number} issuedAt - Unix timestamp of token issuance
|
|
31
|
-
* @property {number} expiresAt - Unix timestamp of token expiry
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @typedef {Object} ScopeConstraints
|
|
36
|
-
* @property {number} maxAmountPerTx - Maximum amount per single transaction (in minor units)
|
|
37
|
-
* @property {number} maxAmountPerDay - Maximum cumulative daily spend (in minor units)
|
|
38
|
-
* @property {number} maxTxPerDay - Maximum number of transactions per day
|
|
39
|
-
* @property {string[]} [allowedMerchantCategories] - MCC codes the agent can transact with
|
|
40
|
-
* @property {string[]} [allowedCurrencies] - ISO 4217 currency codes permitted
|
|
41
|
-
* @property {number} [windowStartUtc] - Unix timestamp: scope validity start
|
|
42
|
-
* @property {number} [windowEndUtc] - Unix timestamp: scope validity end
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @typedef {Object} IntentDeclaration
|
|
47
|
-
* @property {string} intentId - Unique ID for this intent (UUID v4)
|
|
48
|
-
* @property {string} agentId - Agent making the request
|
|
49
|
-
* @property {string} action - What the agent wants to do ('pay', 'subscribe', 'escrow', 'refund')
|
|
50
|
-
* @property {number} amount - Transaction amount in minor units
|
|
51
|
-
* @property {string} currency - ISO 4217 currency code
|
|
52
|
-
* @property {string} recipientId - Merchant/service/agent receiving payment
|
|
53
|
-
* @property {string} description - Human-readable purpose
|
|
54
|
-
* @property {number} createdAt - Unix timestamp
|
|
55
|
-
* @property {number} expiresAt - Unix timestamp when intent becomes invalid
|
|
56
|
-
* @property {Object} [metadata] - Additional key-value pairs
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @typedef {Object} SignedIntent
|
|
61
|
-
* @property {IntentDeclaration} intent - The intent payload
|
|
62
|
-
* @property {string} signature - HMAC-SHA256 signature of the canonical intent
|
|
63
|
-
* @property {string} agenticToken - The agent's identity token
|
|
64
|
-
* @property {string} signatureAlgorithm - Always 'HMAC-SHA256' in this implementation
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @typedef {Object} VerificationResult
|
|
69
|
-
* @property {boolean} valid - Whether the intent passes all checks
|
|
70
|
-
* @property {string[]} errors - List of validation failures (empty if valid)
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
// ---------------------------------------------------------------------------
|
|
74
|
-
// Core Implementation
|
|
75
|
-
// ---------------------------------------------------------------------------
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* VerifiableIntentClient — Create, sign, and verify Mastercard Verifiable Intent payloads.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* const vi = new VerifiableIntentClient({
|
|
83
|
-
* agentId: 'agent-001',
|
|
84
|
-
* principalId: 'user-bill',
|
|
85
|
-
* signingSecret: process.env.AGENT_SIGNING_SECRET,
|
|
86
|
-
* scope: {
|
|
87
|
-
* maxAmountPerTx: 10000, // $100.00
|
|
88
|
-
* maxAmountPerDay: 50000, // $500.00
|
|
89
|
-
* maxTxPerDay: 20,
|
|
90
|
-
* allowedCurrencies: ['USD', 'EUR'],
|
|
91
|
-
* }
|
|
92
|
-
* });
|
|
93
|
-
*
|
|
94
|
-
* const signed = vi.createIntent({
|
|
95
|
-
* action: 'pay',
|
|
96
|
-
* amount: 5000,
|
|
97
|
-
* currency: 'USD',
|
|
98
|
-
* recipientId: 'merchant-xyz',
|
|
99
|
-
* description: 'API compute credits',
|
|
100
|
-
* });
|
|
101
|
-
*
|
|
102
|
-
* const result = vi.verify(signed);
|
|
103
|
-
* // { valid: true, errors: [] }
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
export class VerifiableIntentClient {
|
|
107
|
-
/**
|
|
108
|
-
* @param {Object} config
|
|
109
|
-
* @param {string} config.agentId - Unique agent identifier
|
|
110
|
-
* @param {string} config.principalId - Human/system principal who delegated authority
|
|
111
|
-
* @param {string} config.signingSecret - Secret key for HMAC signing (min 32 chars)
|
|
112
|
-
* @param {ScopeConstraints} config.scope - Spending and authorization constraints
|
|
113
|
-
* @param {number} [config.tokenTtlSeconds=86400] - Agentic token lifetime (default 24h)
|
|
114
|
-
* @param {number} [config.intentTtlSeconds=300] - Intent validity window (default 5 min)
|
|
115
|
-
*/
|
|
116
|
-
constructor(config) {
|
|
117
|
-
if (!config.signingSecret || config.signingSecret.length < 32) {
|
|
118
|
-
throw new VerifiableIntentError('signingSecret must be at least 32 characters');
|
|
119
|
-
}
|
|
120
|
-
this.agentId = config.agentId;
|
|
121
|
-
this.principalId = config.principalId;
|
|
122
|
-
this.signingSecret = config.signingSecret;
|
|
123
|
-
this.scope = config.scope;
|
|
124
|
-
this.tokenTtlSeconds = config.tokenTtlSeconds ?? 86400;
|
|
125
|
-
this.intentTtlSeconds = config.intentTtlSeconds ?? 300;
|
|
126
|
-
|
|
127
|
-
// Daily tracking for scope enforcement
|
|
128
|
-
this._dailySpend = 0;
|
|
129
|
-
this._dailyTxCount = 0;
|
|
130
|
-
this._dailyResetDate = this._todayUtc();
|
|
131
|
-
|
|
132
|
-
// Generate agentic token on initialization
|
|
133
|
-
this.identity = this._issueAgenticToken();
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Create and sign a Verifiable Intent declaration.
|
|
138
|
-
*
|
|
139
|
-
* @param {Object} params
|
|
140
|
-
* @param {string} params.action - 'pay' | 'subscribe' | 'escrow' | 'refund'
|
|
141
|
-
* @param {number} params.amount - Amount in minor units (cents)
|
|
142
|
-
* @param {string} params.currency - ISO 4217 currency code
|
|
143
|
-
* @param {string} params.recipientId - Recipient identifier
|
|
144
|
-
* @param {string} params.description - Human-readable purpose
|
|
145
|
-
* @param {Object} [params.metadata] - Additional context
|
|
146
|
-
* @returns {SignedIntent}
|
|
147
|
-
*/
|
|
148
|
-
createIntent(params) {
|
|
149
|
-
const now = Math.floor(Date.now() / 1000);
|
|
150
|
-
|
|
151
|
-
// Check token validity
|
|
152
|
-
if (now >= this.identity.expiresAt) {
|
|
153
|
-
this.identity = this._issueAgenticToken();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const intent = {
|
|
157
|
-
intentId: randomUUID(),
|
|
158
|
-
agentId: this.agentId,
|
|
159
|
-
action: params.action,
|
|
160
|
-
amount: params.amount,
|
|
161
|
-
currency: params.currency,
|
|
162
|
-
recipientId: params.recipientId,
|
|
163
|
-
description: params.description,
|
|
164
|
-
createdAt: now,
|
|
165
|
-
expiresAt: now + this.intentTtlSeconds,
|
|
166
|
-
metadata: params.metadata ?? {},
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// Pre-sign scope validation
|
|
170
|
-
const scopeCheck = this._checkScope(intent);
|
|
171
|
-
if (!scopeCheck.valid) {
|
|
172
|
-
throw new VerifiableIntentError(
|
|
173
|
-
`Intent blocked by scope constraints: ${scopeCheck.errors.join(', ')}`
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const canonical = this._canonicalize(intent);
|
|
178
|
-
const signature = this._sign(canonical);
|
|
179
|
-
|
|
180
|
-
return {
|
|
181
|
-
intent,
|
|
182
|
-
signature,
|
|
183
|
-
agenticToken: this.identity.agenticToken,
|
|
184
|
-
signatureAlgorithm: 'HMAC-SHA256',
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Verify a signed intent declaration.
|
|
190
|
-
*
|
|
191
|
-
* Checks:
|
|
192
|
-
* 1. Signature validity (HMAC-SHA256)
|
|
193
|
-
* 2. Intent not expired
|
|
194
|
-
* 3. Agent identity matches
|
|
195
|
-
* 4. Scope constraints satisfied
|
|
196
|
-
*
|
|
197
|
-
* @param {SignedIntent} signedIntent
|
|
198
|
-
* @returns {VerificationResult}
|
|
199
|
-
*/
|
|
200
|
-
verify(signedIntent) {
|
|
201
|
-
const errors = [];
|
|
202
|
-
const { intent, signature, agenticToken } = signedIntent;
|
|
203
|
-
const now = Math.floor(Date.now() / 1000);
|
|
204
|
-
|
|
205
|
-
// 1. Signature check
|
|
206
|
-
const canonical = this._canonicalize(intent);
|
|
207
|
-
const expectedSig = this._sign(canonical);
|
|
208
|
-
if (signature !== expectedSig) {
|
|
209
|
-
errors.push('Invalid signature');
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// 2. Expiry check
|
|
213
|
-
if (now >= intent.expiresAt) {
|
|
214
|
-
errors.push(`Intent expired at ${new Date(intent.expiresAt * 1000).toISOString()}`);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// 3. Agent identity check
|
|
218
|
-
if (intent.agentId !== this.agentId) {
|
|
219
|
-
errors.push(`Agent ID mismatch: expected ${this.agentId}, got ${intent.agentId}`);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// 4. Agentic token check
|
|
223
|
-
if (agenticToken !== this.identity.agenticToken) {
|
|
224
|
-
errors.push('Agentic token mismatch or expired');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// 5. Scope constraints
|
|
228
|
-
const scopeResult = this._checkScope(intent);
|
|
229
|
-
errors.push(...scopeResult.errors);
|
|
230
|
-
|
|
231
|
-
return { valid: errors.length === 0, errors };
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Record a completed transaction against daily limits.
|
|
236
|
-
* Call this after a verified intent is successfully executed.
|
|
237
|
-
*
|
|
238
|
-
* @param {SignedIntent} signedIntent - The executed intent
|
|
239
|
-
*/
|
|
240
|
-
recordExecution(signedIntent) {
|
|
241
|
-
this._resetDailyIfNeeded();
|
|
242
|
-
this._dailySpend += signedIntent.intent.amount;
|
|
243
|
-
this._dailyTxCount += 1;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Get current daily usage against scope limits.
|
|
248
|
-
*
|
|
249
|
-
* @returns {{ spentToday: number, txToday: number, remainingBudget: number, remainingTx: number }}
|
|
250
|
-
*/
|
|
251
|
-
getDailyUsage() {
|
|
252
|
-
this._resetDailyIfNeeded();
|
|
253
|
-
return {
|
|
254
|
-
spentToday: this._dailySpend,
|
|
255
|
-
txToday: this._dailyTxCount,
|
|
256
|
-
remainingBudget: Math.max(0, this.scope.maxAmountPerDay - this._dailySpend),
|
|
257
|
-
remainingTx: Math.max(0, this.scope.maxTxPerDay - this._dailyTxCount),
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Serialize a signed intent to a portable JSON string for transmission.
|
|
263
|
-
*
|
|
264
|
-
* @param {SignedIntent} signedIntent
|
|
265
|
-
* @returns {string} JSON string
|
|
266
|
-
*/
|
|
267
|
-
static serialize(signedIntent) {
|
|
268
|
-
return JSON.stringify(signedIntent);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Deserialize a JSON string back to a SignedIntent object.
|
|
273
|
-
*
|
|
274
|
-
* @param {string} json
|
|
275
|
-
* @returns {SignedIntent}
|
|
276
|
-
*/
|
|
277
|
-
static deserialize(json) {
|
|
278
|
-
const parsed = JSON.parse(json);
|
|
279
|
-
if (!parsed.intent || !parsed.signature || !parsed.agenticToken) {
|
|
280
|
-
throw new VerifiableIntentError('Invalid SignedIntent structure');
|
|
281
|
-
}
|
|
282
|
-
return parsed;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// -------------------------------------------------------------------------
|
|
286
|
-
// Private methods
|
|
287
|
-
// -------------------------------------------------------------------------
|
|
288
|
-
|
|
289
|
-
_issueAgenticToken() {
|
|
290
|
-
const now = Math.floor(Date.now() / 1000);
|
|
291
|
-
const payload = `${this.agentId}:${this.principalId}:${now}`;
|
|
292
|
-
const token = createHmac('sha256', this.signingSecret)
|
|
293
|
-
.update(payload)
|
|
294
|
-
.digest('hex');
|
|
295
|
-
return {
|
|
296
|
-
agentId: this.agentId,
|
|
297
|
-
principalId: this.principalId,
|
|
298
|
-
agenticToken: token,
|
|
299
|
-
issuedAt: now,
|
|
300
|
-
expiresAt: now + this.tokenTtlSeconds,
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
_canonicalize(intent) {
|
|
305
|
-
// Deterministic JSON serialization: sorted keys, no whitespace
|
|
306
|
-
const ordered = {
|
|
307
|
-
action: intent.action,
|
|
308
|
-
agentId: intent.agentId,
|
|
309
|
-
amount: intent.amount,
|
|
310
|
-
createdAt: intent.createdAt,
|
|
311
|
-
currency: intent.currency,
|
|
312
|
-
description: intent.description,
|
|
313
|
-
expiresAt: intent.expiresAt,
|
|
314
|
-
intentId: intent.intentId,
|
|
315
|
-
metadata: intent.metadata,
|
|
316
|
-
recipientId: intent.recipientId,
|
|
317
|
-
};
|
|
318
|
-
return JSON.stringify(ordered);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
_sign(canonical) {
|
|
322
|
-
return createHmac('sha256', this.signingSecret)
|
|
323
|
-
.update(canonical)
|
|
324
|
-
.digest('hex');
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
_checkScope(intent) {
|
|
328
|
-
const errors = [];
|
|
329
|
-
this._resetDailyIfNeeded();
|
|
330
|
-
|
|
331
|
-
if (intent.amount > this.scope.maxAmountPerTx) {
|
|
332
|
-
errors.push(`Amount ${intent.amount} exceeds per-tx limit ${this.scope.maxAmountPerTx}`);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (this._dailySpend + intent.amount > this.scope.maxAmountPerDay) {
|
|
336
|
-
errors.push(
|
|
337
|
-
`Daily spend would be ${this._dailySpend + intent.amount}, exceeds limit ${this.scope.maxAmountPerDay}`
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
if (this._dailyTxCount + 1 > this.scope.maxTxPerDay) {
|
|
342
|
-
errors.push(`Daily tx count would exceed limit ${this.scope.maxTxPerDay}`);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
if (this.scope.allowedCurrencies && !this.scope.allowedCurrencies.includes(intent.currency)) {
|
|
346
|
-
errors.push(`Currency ${intent.currency} not in allowed list: ${this.scope.allowedCurrencies.join(', ')}`);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const now = Math.floor(Date.now() / 1000);
|
|
350
|
-
if (this.scope.windowStartUtc && now < this.scope.windowStartUtc) {
|
|
351
|
-
errors.push('Current time is before scope validity window');
|
|
352
|
-
}
|
|
353
|
-
if (this.scope.windowEndUtc && now >= this.scope.windowEndUtc) {
|
|
354
|
-
errors.push('Current time is past scope validity window');
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
return { valid: errors.length === 0, errors };
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
_todayUtc() {
|
|
361
|
-
return new Date().toISOString().slice(0, 10);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
_resetDailyIfNeeded() {
|
|
365
|
-
const today = this._todayUtc();
|
|
366
|
-
if (today !== this._dailyResetDate) {
|
|
367
|
-
this._dailySpend = 0;
|
|
368
|
-
this._dailyTxCount = 0;
|
|
369
|
-
this._dailyResetDate = today;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// ---------------------------------------------------------------------------
|
|
375
|
-
// Error class
|
|
376
|
-
// ---------------------------------------------------------------------------
|
|
377
|
-
|
|
378
|
-
export class VerifiableIntentError extends Error {
|
|
379
|
-
constructor(message, context) {
|
|
380
|
-
super(message);
|
|
381
|
-
this.context = context;
|
|
382
|
-
this.name = 'VerifiableIntentError';
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
//# sourceMappingURL=index.js.map
|
package/dist/yield/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Yield Vault Module
|
|
3
|
-
*
|
|
4
|
-
* Puts idle agent capital to work across DeFi vaults and RWA tokens.
|
|
5
|
-
*
|
|
6
|
-
* Quick start:
|
|
7
|
-
* import { YieldVault, YieldRateFetcher } from './yield/index.js';
|
|
8
|
-
*
|
|
9
|
-
* const vault = new YieldVault({ enabled: true });
|
|
10
|
-
* const opportunities = await vault.scan({ token: 'USDC', amountUsd: 10_000 });
|
|
11
|
-
* const best = opportunities.find(o => o.viable);
|
|
12
|
-
* if (best) {
|
|
13
|
-
* const tx = vault.buildDepositTx({
|
|
14
|
-
* protocol: best.best.protocol,
|
|
15
|
-
* token: 'USDC',
|
|
16
|
-
* amount: 10_000_000_000n, // 10k USDC (6 decimals)
|
|
17
|
-
* chain: best.best.chain,
|
|
18
|
-
* walletAddress: '0xYourAgentWallet',
|
|
19
|
-
* });
|
|
20
|
-
* // agent signs + sends tx
|
|
21
|
-
* }
|
|
22
|
-
*/
|
|
23
|
-
export { YieldVault } from './vault.js';
|
|
24
|
-
export { YieldRateFetcher, PROTOCOL_ADDRESSES } from './rates.js';
|
|
25
|
-
export type { YieldProtocol, YieldCategory, YieldPosition, YieldRate, YieldOpportunity, YieldVaultConfig, DepositResult, WithdrawResult, } from './types.js';
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/yield/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAElE,YAAY,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/yield/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @premium This module is part of AgentWallet Premium.
|
|
3
|
-
* Contact: https://github.com/up2itnow/AgentNexus2 for access.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Yield Vault Module
|
|
7
|
-
*
|
|
8
|
-
* Puts idle agent capital to work across DeFi vaults and RWA tokens.
|
|
9
|
-
*
|
|
10
|
-
* Quick start:
|
|
11
|
-
* import { YieldVault, YieldRateFetcher } from './yield/index.js';
|
|
12
|
-
*
|
|
13
|
-
* const vault = new YieldVault({ enabled: true });
|
|
14
|
-
* const opportunities = await vault.scan({ token: 'USDC', amountUsd: 10_000 });
|
|
15
|
-
* const best = opportunities.find(o => o.viable);
|
|
16
|
-
* if (best) {
|
|
17
|
-
* const tx = vault.buildDepositTx({
|
|
18
|
-
* protocol: best.best.protocol,
|
|
19
|
-
* token: 'USDC',
|
|
20
|
-
* amount: 10_000_000_000n, // 10k USDC (6 decimals)
|
|
21
|
-
* chain: best.best.chain,
|
|
22
|
-
* walletAddress: '0xYourAgentWallet',
|
|
23
|
-
* });
|
|
24
|
-
* // agent signs + sends tx
|
|
25
|
-
* }
|
|
26
|
-
*/
|
|
27
|
-
export { YieldVault } from './vault.js';
|
|
28
|
-
export { YieldRateFetcher, PROTOCOL_ADDRESSES } from './rates.js';
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
package/dist/yield/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/yield/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/yield/rates.d.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Yield Rate Fetcher
|
|
3
|
-
*
|
|
4
|
-
* Fetches current APY rates from DeFi protocols and RWA token sources.
|
|
5
|
-
* When a provider is not supplied (tests, offline, no RPC), returns accurate
|
|
6
|
-
* mock rates based on current market conditions (~Q1 2026).
|
|
7
|
-
*
|
|
8
|
-
* DeFi risk scores (0-100, lower = safer):
|
|
9
|
-
* Aave V3: 15 — battle-tested, billions TVL, audited
|
|
10
|
-
* Compound V3: 20 — mature, lower TVL than Aave
|
|
11
|
-
* Morpho Blue: 25 — newer architecture, peer-to-peer matching
|
|
12
|
-
*
|
|
13
|
-
* RWA risk scores:
|
|
14
|
-
* USDC-collateralized RWA: 10–20 (T-bill backed, regulated issuers)
|
|
15
|
-
*/
|
|
16
|
-
import { ethers } from 'ethers';
|
|
17
|
-
import type { YieldRate, YieldVaultConfig } from './types.js';
|
|
18
|
-
export declare const PROTOCOL_ADDRESSES: {
|
|
19
|
-
readonly 'aave-v3': {
|
|
20
|
-
readonly ethereum: {
|
|
21
|
-
readonly pool: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
|
|
22
|
-
readonly dataProvider: "0x7B4EB56E7CD4b454BA8ff71E4518426369a138a3";
|
|
23
|
-
};
|
|
24
|
-
readonly base: {
|
|
25
|
-
readonly pool: "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5";
|
|
26
|
-
readonly dataProvider: "0x2d8A3C5677189723C4cB8873CfC9C8976ddf54D8";
|
|
27
|
-
};
|
|
28
|
-
readonly arbitrum: {
|
|
29
|
-
readonly pool: "0x794a61358D6845594F94dc1DB02A252b5b4814aD";
|
|
30
|
-
readonly dataProvider: "0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654";
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
readonly 'compound-v3': {
|
|
34
|
-
readonly ethereum: {
|
|
35
|
-
readonly comet: "0xc3d688B66703497DAA19211EEdff47f25384cdc3";
|
|
36
|
-
};
|
|
37
|
-
readonly base: {
|
|
38
|
-
readonly comet: "0xb125E6687d4313864e53df431d5425969c15Eb2";
|
|
39
|
-
};
|
|
40
|
-
readonly arbitrum: {
|
|
41
|
-
readonly comet: "0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf";
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
readonly usdy: {
|
|
45
|
-
readonly ethereum: {
|
|
46
|
-
readonly token: "0x96F6eF951840721AdBF7B6A2Ce4A795F61F8f60a";
|
|
47
|
-
};
|
|
48
|
-
readonly arbitrum: {
|
|
49
|
-
readonly token: "0x7fAb54cb9d83BDAF0e94b1C2bA96F64Fb7D86b7A";
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
export declare class YieldRateFetcher {
|
|
54
|
-
/**
|
|
55
|
-
* Fetch current supply APY for Aave V3.
|
|
56
|
-
*
|
|
57
|
-
* On-chain: queries getReserveData() on the Aave Data Provider.
|
|
58
|
-
* currentLiquidityRate is in ray format (1e27 = 100% APY).
|
|
59
|
-
* APY = (1 + rate / 1e27 / SECONDS_PER_YEAR)^SECONDS_PER_YEAR - 1
|
|
60
|
-
*
|
|
61
|
-
* Falls back to accurate mock rates when provider is not available.
|
|
62
|
-
*
|
|
63
|
-
* Risk score: 15 (battle-tested, billions TVL, multiple audits)
|
|
64
|
-
*/
|
|
65
|
-
fetchAaveRate(token: string, chain: string, provider?: ethers.JsonRpcProvider): Promise<YieldRate>;
|
|
66
|
-
/**
|
|
67
|
-
* Fetch current supply APY for Compound V3.
|
|
68
|
-
*
|
|
69
|
-
* On-chain: calls getSupplyRate(utilization) on the Comet contract.
|
|
70
|
-
* supplyRate is per-second (18 decimals).
|
|
71
|
-
* APY = (1 + supplyRate / 1e18)^SECONDS_PER_YEAR - 1
|
|
72
|
-
*
|
|
73
|
-
* Risk score: 20 (mature protocol, lower TVL than Aave)
|
|
74
|
-
*/
|
|
75
|
-
fetchCompoundRate(token: string, chain: string, provider?: ethers.JsonRpcProvider): Promise<YieldRate>;
|
|
76
|
-
/**
|
|
77
|
-
* Fetch APY for Morpho Blue.
|
|
78
|
-
*
|
|
79
|
-
* Morpho Blue uses peer-to-peer rate matching — on-chain query is complex
|
|
80
|
-
* (varies per market). We use well-calibrated estimates based on current
|
|
81
|
-
* market conditions. Real implementation would query Morpho's API or
|
|
82
|
-
* aggregate across market IDs.
|
|
83
|
-
*
|
|
84
|
-
* Risk score: 25 (newer architecture, audited, growing TVL)
|
|
85
|
-
*/
|
|
86
|
-
fetchMorphoRate(token: string, chain: string, _provider?: ethers.JsonRpcProvider): Promise<YieldRate>;
|
|
87
|
-
/**
|
|
88
|
-
* Get current RWA token rates.
|
|
89
|
-
*
|
|
90
|
-
* RWA tokens are backed by tokenized T-bills and short-duration government bonds.
|
|
91
|
-
* Rates (~4.8–5.2% APY as of Q1 2026) track the Fed Funds rate.
|
|
92
|
-
*
|
|
93
|
-
* Agent-friendliness matrix:
|
|
94
|
-
* ┌──────────┬──────────────┬───────────┬───────────────────────────────────┐
|
|
95
|
-
* │ Protocol │ KYC Required │ Min Dep. │ Chains │
|
|
96
|
-
* ├──────────┼──────────────┼───────────┼───────────────────────────────────┤
|
|
97
|
-
* │ BUIDL │ ✅ YES │ $1,000,000│ Ethereum only │
|
|
98
|
-
* │ OUSG │ ✅ YES │ ~$5,000 │ Ethereum, Base │
|
|
99
|
-
* │ USDY │ ❌ NO │ ~$500 │ Ethereum, Arbitrum (best for bots)│
|
|
100
|
-
* │ USYC │ ❌ NO │ ~$1,000 │ Ethereum, Base │
|
|
101
|
-
* │ wUSTB │ ❌ NO │ ~$100 │ Ethereum │
|
|
102
|
-
* └──────────┴──────────────┴───────────┴───────────────────────────────────┘
|
|
103
|
-
*
|
|
104
|
-
* ⚠️ BUIDL: $1M minimum is a HARD requirement. Do not recommend to retail agents.
|
|
105
|
-
*/
|
|
106
|
-
fetchRWARates(chains: string[]): Promise<YieldRate[]>;
|
|
107
|
-
/**
|
|
108
|
-
* Fetch all rates across DeFi protocols and RWA tokens.
|
|
109
|
-
* Applies config filters (KYC, chains, tokens).
|
|
110
|
-
* Returns sorted by APY descending.
|
|
111
|
-
*/
|
|
112
|
-
fetchAllRates(config: YieldVaultConfig): Promise<YieldRate[]>;
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=rates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rates.d.ts","sourceRoot":"","sources":["../../src/yield/rates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAI9D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBrB,CAAC;AAsDX,qBAAa,gBAAgB;IAC3B;;;;;;;;;;OAUG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,CAAC,eAAe,GAChC,OAAO,CAAC,SAAS,CAAC;IAuCrB;;;;;;;;OAQG;IACG,iBAAiB,CACrB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,CAAC,eAAe,GAChC,OAAO,CAAC,SAAS,CAAC;IAoCrB;;;;;;;;;OASG;IACG,eAAe,CACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,eAAe,GACjC,OAAO,CAAC,SAAS,CAAC;IAmBrB;;;;;;;;;;;;;;;;;;OAkBG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAgG3D;;;;OAIG;IACG,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;CAsCpE"}
|