@lagoon-protocol/lagoon-mcp 0.6.0 → 0.7.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/README.md +72 -54
- package/dist/cache/index.d.ts +4 -1
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +4 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/graphql/fragments/apr-breakdown.fragment.d.ts +4 -1
- package/dist/graphql/fragments/apr-breakdown.fragment.d.ts.map +1 -1
- package/dist/graphql/fragments/apr-breakdown.fragment.js +3 -0
- package/dist/graphql/fragments/apr-breakdown.fragment.js.map +1 -1
- package/dist/graphql/fragments/composition.fragment.d.ts +23 -134
- package/dist/graphql/fragments/composition.fragment.d.ts.map +1 -1
- package/dist/graphql/fragments/composition.fragment.js +9 -7
- package/dist/graphql/fragments/composition.fragment.js.map +1 -1
- package/dist/graphql/fragments/index.d.ts +1 -1
- package/dist/graphql/fragments/index.d.ts.map +1 -1
- package/dist/graphql/fragments/index.js +5 -4
- package/dist/graphql/fragments/index.js.map +1 -1
- package/dist/graphql/fragments/vault.fragment.d.ts +28 -1
- package/dist/graphql/fragments/vault.fragment.d.ts.map +1 -1
- package/dist/graphql/fragments/vault.fragment.js +28 -0
- package/dist/graphql/fragments/vault.fragment.js.map +1 -1
- package/dist/graphql/queries/composition.queries.d.ts +10 -28
- package/dist/graphql/queries/composition.queries.d.ts.map +1 -1
- package/dist/graphql/queries/composition.queries.js +17 -28
- package/dist/graphql/queries/composition.queries.js.map +1 -1
- package/dist/graphql/queries/discovery.queries.d.ts +50 -0
- package/dist/graphql/queries/discovery.queries.d.ts.map +1 -0
- package/dist/graphql/queries/discovery.queries.js +188 -0
- package/dist/graphql/queries/discovery.queries.js.map +1 -0
- package/dist/graphql/queries/export.queries.d.ts +1 -1
- package/dist/graphql/queries/export.queries.d.ts.map +1 -1
- package/dist/graphql/queries/index.d.ts +1 -0
- package/dist/graphql/queries/index.d.ts.map +1 -1
- package/dist/graphql/queries/index.js +2 -0
- package/dist/graphql/queries/index.js.map +1 -1
- package/dist/graphql/queries/portfolio.queries.d.ts +2 -2
- package/dist/graphql/queries/portfolio.queries.d.ts.map +1 -1
- package/dist/graphql/queries/portfolio.queries.js +9 -3
- package/dist/graphql/queries/portfolio.queries.js.map +1 -1
- package/dist/graphql/queries/risk.queries.d.ts +3 -3
- package/dist/graphql/queries/risk.queries.d.ts.map +1 -1
- package/dist/graphql/queries/vault.queries.d.ts +3 -3
- package/dist/graphql/queries/vault.queries.d.ts.map +1 -1
- package/dist/index.js +0 -0
- package/dist/services/analytics/risk.service.d.ts +43 -21
- package/dist/services/analytics/risk.service.d.ts.map +1 -1
- package/dist/services/analytics/risk.service.js +141 -129
- package/dist/services/analytics/risk.service.js.map +1 -1
- package/dist/tools/compare-vaults.d.ts.map +1 -1
- package/dist/tools/compare-vaults.js +44 -74
- package/dist/tools/compare-vaults.js.map +1 -1
- package/dist/tools/get-asset.d.ts +17 -0
- package/dist/tools/get-asset.d.ts.map +1 -0
- package/dist/tools/get-asset.js +44 -0
- package/dist/tools/get-asset.js.map +1 -0
- package/dist/tools/get-curator.d.ts +13 -0
- package/dist/tools/get-curator.d.ts.map +1 -0
- package/dist/tools/get-curator.js +81 -0
- package/dist/tools/get-curator.js.map +1 -0
- package/dist/tools/get-global-tvl.d.ts +20 -0
- package/dist/tools/get-global-tvl.d.ts.map +1 -0
- package/dist/tools/get-global-tvl.js +38 -0
- package/dist/tools/get-global-tvl.js.map +1 -0
- package/dist/tools/get-historical-state.d.ts +22 -0
- package/dist/tools/get-historical-state.d.ts.map +1 -0
- package/dist/tools/get-historical-state.js +65 -0
- package/dist/tools/get-historical-state.js.map +1 -0
- package/dist/tools/get-indexing-status.d.ts +20 -0
- package/dist/tools/get-indexing-status.d.ts.map +1 -0
- package/dist/tools/get-indexing-status.js +38 -0
- package/dist/tools/get-indexing-status.js.map +1 -0
- package/dist/tools/list-chains.d.ts +16 -0
- package/dist/tools/list-chains.d.ts.map +1 -0
- package/dist/tools/list-chains.js +46 -0
- package/dist/tools/list-chains.js.map +1 -0
- package/dist/tools/list-curators.d.ts +18 -0
- package/dist/tools/list-curators.d.ts.map +1 -0
- package/dist/tools/list-curators.js +49 -0
- package/dist/tools/list-curators.js.map +1 -0
- package/dist/tools/predict-yield.d.ts.map +1 -1
- package/dist/tools/predict-yield.js +77 -6
- package/dist/tools/predict-yield.js.map +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +83 -11
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/simulate-vault.d.ts +1 -1
- package/dist/tools/user-portfolio.d.ts.map +1 -1
- package/dist/tools/user-portfolio.js +30 -51
- package/dist/tools/user-portfolio.js.map +1 -1
- package/dist/tools/vault-composition.d.ts +18 -15
- package/dist/tools/vault-composition.d.ts.map +1 -1
- package/dist/tools/vault-composition.js +71 -155
- package/dist/tools/vault-composition.js.map +1 -1
- package/dist/types/generated.d.ts +393 -15
- package/dist/types/generated.d.ts.map +1 -1
- package/dist/utils/comparison-metrics.d.ts +13 -1
- package/dist/utils/comparison-metrics.d.ts.map +1 -1
- package/dist/utils/comparison-metrics.js +29 -4
- package/dist/utils/comparison-metrics.js.map +1 -1
- package/dist/utils/composition-metrics.d.ts +42 -0
- package/dist/utils/composition-metrics.d.ts.map +1 -0
- package/dist/utils/composition-metrics.js +50 -0
- package/dist/utils/composition-metrics.js.map +1 -0
- package/dist/utils/fee-formatting.d.ts +41 -0
- package/dist/utils/fee-formatting.d.ts.map +1 -0
- package/dist/utils/fee-formatting.js +57 -0
- package/dist/utils/fee-formatting.js.map +1 -0
- package/dist/utils/operational-signals.d.ts +55 -0
- package/dist/utils/operational-signals.d.ts.map +1 -0
- package/dist/utils/operational-signals.js +105 -0
- package/dist/utils/operational-signals.js.map +1 -0
- package/dist/utils/validators.d.ts +103 -0
- package/dist/utils/validators.d.ts.map +1 -1
- package/dist/utils/validators.js +59 -1
- package/dist/utils/validators.js.map +1 -1
- package/package.json +2 -2
- package/dist/graphql/fragments.d.ts +0 -183
- package/dist/graphql/fragments.d.ts.map +0 -1
- package/dist/graphql/fragments.js +0 -297
- package/dist/graphql/fragments.js.map +0 -1
- package/dist/graphql/queries/period-summaries.d.ts +0 -15
- package/dist/graphql/queries/period-summaries.d.ts.map +0 -1
- package/dist/graphql/queries/period-summaries.js +0 -24
- package/dist/graphql/queries/period-summaries.js.map +0 -1
- package/dist/services/analytics/protocol-overview.service.d.ts +0 -61
- package/dist/services/analytics/protocol-overview.service.d.ts.map +0 -1
- package/dist/services/analytics/protocol-overview.service.js +0 -182
- package/dist/services/analytics/protocol-overview.service.js.map +0 -1
- package/dist/tools/index.d.ts +0 -26
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -32
- package/dist/tools/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Lagoon MCP Server
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@lagoon-protocol/lagoon-mcp)
|
|
4
|
+
[](https://github.com/hopperlabsxyz/lagoon-mcp/actions/workflows/ci.yml)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
|
|
3
8
|
Model Context Protocol (MCP) server providing Claude Code with conversational access to Lagoon DeFi vault analytics.
|
|
4
9
|
|
|
5
10
|
## Overview
|
|
@@ -24,14 +29,14 @@ Lagoon MCP enables natural language queries about DeFi vaults, user portfolios,
|
|
|
24
29
|
- Claude Desktop app
|
|
25
30
|
- Access to Lagoon backend GraphQL endpoint
|
|
26
31
|
|
|
27
|
-
### Installation
|
|
32
|
+
### Installation
|
|
28
33
|
|
|
29
34
|
```bash
|
|
30
35
|
# Install globally
|
|
31
|
-
npm install -g @
|
|
36
|
+
npm install -g @lagoon-protocol/lagoon-mcp
|
|
32
37
|
|
|
33
38
|
# Or install locally
|
|
34
|
-
npm install @
|
|
39
|
+
npm install @lagoon-protocol/lagoon-mcp
|
|
35
40
|
```
|
|
36
41
|
|
|
37
42
|
### Configuration
|
|
@@ -43,8 +48,19 @@ npm install @hopperlabsxyz/lagoon-mcp
|
|
|
43
48
|
| **Claude Desktop** | ✅ Available Now | JSON | [↓ See below](#claude-desktop) |
|
|
44
49
|
| **Claude Code (CLI)** | ✅ Available Now | JSON | [↓ See below](#claude-code-cli) |
|
|
45
50
|
| **OpenAI Agents SDK** | ✅ Available Now | YAML | [↓ See below](#openai-agents-sdk) |
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
|
|
52
|
+
> The server uses the standard MCP stdio transport, so **any MCP-compatible client** (Cursor, Cline, and others) works with no code changes — only the config format differs.
|
|
53
|
+
|
|
54
|
+
#### Environment Variables
|
|
55
|
+
|
|
56
|
+
All configuration is supplied through environment variables (validated at startup). See [.env.example](./.env.example).
|
|
57
|
+
|
|
58
|
+
| Variable | Required | Default | Purpose |
|
|
59
|
+
|----------|----------|---------|---------|
|
|
60
|
+
| `LAGOON_GRAPHQL_URL` | Recommended | `http://localhost:3001/query` | Lagoon backend GraphQL endpoint (use `https://api.lagoon.finance/query` for production) |
|
|
61
|
+
| `NODE_ENV` | No | `development` | Runtime mode: `development` / `production` / `test` |
|
|
62
|
+
| `CACHE_TTL` | No | `600` | Default cache TTL, in seconds |
|
|
63
|
+
| `CACHE_MAX_KEYS` | No | `1000` | Maximum number of cache entries |
|
|
48
64
|
|
|
49
65
|
---
|
|
50
66
|
|
|
@@ -76,7 +92,7 @@ Add to your Claude Desktop config file:
|
|
|
76
92
|
"command": "node",
|
|
77
93
|
"args": ["/path/to/lagoon-mcp/dist/index.js"],
|
|
78
94
|
"env": {
|
|
79
|
-
"LAGOON_GRAPHQL_URL": "http://localhost:
|
|
95
|
+
"LAGOON_GRAPHQL_URL": "http://localhost:3001/query"
|
|
80
96
|
}
|
|
81
97
|
}
|
|
82
98
|
}
|
|
@@ -95,7 +111,7 @@ Claude Code CLI uses a project-scoped configuration system. You can configure MC
|
|
|
95
111
|
|
|
96
112
|
Edit your `~/.claude.json` file and add lagoon-mcp to your project:
|
|
97
113
|
|
|
98
|
-
**For production use** (after `npm install -g @
|
|
114
|
+
**For production use** (after `npm install -g @lagoon-protocol/lagoon-mcp`):
|
|
99
115
|
|
|
100
116
|
```json
|
|
101
117
|
{
|
|
@@ -127,7 +143,7 @@ Edit your `~/.claude.json` file and add lagoon-mcp to your project:
|
|
|
127
143
|
"command": "node",
|
|
128
144
|
"args": ["/absolute/path/to/lagoon-mcp/dist/index.js"],
|
|
129
145
|
"env": {
|
|
130
|
-
"LAGOON_GRAPHQL_URL": "http://localhost:
|
|
146
|
+
"LAGOON_GRAPHQL_URL": "http://localhost:3001/query"
|
|
131
147
|
}
|
|
132
148
|
}
|
|
133
149
|
}
|
|
@@ -207,33 +223,9 @@ const lagoonServer = new MCPServerStdio({
|
|
|
207
223
|
|
|
208
224
|
---
|
|
209
225
|
|
|
210
|
-
####
|
|
211
|
-
|
|
212
|
-
**Status**: MCP support for ChatGPT Desktop is currently in development and expected "in the coming months" per OpenAI.
|
|
213
|
-
|
|
214
|
-
**Availability**:
|
|
215
|
-
- ⏳ Desktop app with MCP: Not yet released
|
|
216
|
-
- ⏳ Enterprise/Team: Limited beta access only
|
|
217
|
-
- ❌ Individual ChatGPT Plus: Not available yet
|
|
218
|
-
|
|
219
|
-
**Expected Configuration** (once available):
|
|
220
|
-
|
|
221
|
-
Configuration file location will likely follow a similar pattern to Claude Desktop (exact location TBD).
|
|
222
|
-
|
|
223
|
-
```json
|
|
224
|
-
{
|
|
225
|
-
"mcpServers": {
|
|
226
|
-
"lagoon": {
|
|
227
|
-
"command": "lagoon-mcp",
|
|
228
|
-
"env": {
|
|
229
|
-
"LAGOON_GRAPHQL_URL": "https://api.lagoon.finance/query"
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
```
|
|
226
|
+
#### Other MCP clients
|
|
235
227
|
|
|
236
|
-
|
|
228
|
+
The server speaks the standard MCP protocol over stdio transport, so any MCP-compatible client works — including new clients as they add MCP support. Only the configuration format differs from the examples above; point the client at the `lagoon-mcp` command and set `LAGOON_GRAPHQL_URL`.
|
|
237
229
|
|
|
238
230
|
### Usage
|
|
239
231
|
|
|
@@ -291,18 +283,29 @@ Complete tool documentation available in [docs/tools/](./docs/tools/).
|
|
|
291
283
|
|
|
292
284
|
| Tool | Description | Documentation |
|
|
293
285
|
|------|-------------|---------------|
|
|
286
|
+
| **discover_tools** | Search and discover available tools by category or keyword | — |
|
|
294
287
|
| **query_graphql** | Execute raw GraphQL queries for advanced use cases | [→ Details](./docs/tools/query-graphql.md) |
|
|
295
288
|
| **get_vault_data** | Get comprehensive vault information by address and chain | [→ Details](./docs/tools/get-vault-data.md) |
|
|
296
289
|
| **get_user_portfolio** | Aggregate user holdings across all supported chains | [→ Details](./docs/tools/user-portfolio.md) |
|
|
297
290
|
| **search_vaults** | Search and filter vaults with 20+ advanced criteria | [→ Details](./docs/tools/search-vaults.md) |
|
|
298
291
|
| **get_vault_performance** | Historical metrics and performance analysis | [→ Details](./docs/tools/vault-performance.md) |
|
|
299
292
|
| **get_transactions** | Query vault transaction history with flexible filtering | [→ Details](./docs/tools/get-transactions.md) |
|
|
300
|
-
| **compare_vaults** | Side-by-side vault comparison with
|
|
301
|
-
| **optimize_portfolio** | Modern Portfolio Theory optimization with yield sustainability warnings | [→ Details](./docs/tools/optimize-portfolio.md) |
|
|
293
|
+
| **compare_vaults** | Side-by-side vault comparison with normalized metrics and rankings (2–20 vaults, cross-chain) | [→ Details](./docs/tools/compare-vaults.md) |
|
|
302
294
|
| **get_price_history** | Historical share price data with OHLCV time-series | [→ Details](./docs/tools/price-history.md) |
|
|
303
|
-
| **export_data** | Export vault data in CSV/JSON format | [→ Details](./docs/tools/export-data.md) |
|
|
295
|
+
| **export_data** | Export vault data, transactions, price history, or performance in CSV/JSON format | [→ Details](./docs/tools/export-data.md) |
|
|
304
296
|
| **analyze_risk** | Multi-factor risk analysis with comprehensive scoring | [→ Details](./docs/tools/analyze-risk.md) |
|
|
297
|
+
| **analyze_risks** | Batch risk analysis for 2–20 vaults in a single call (cross-chain) | — |
|
|
305
298
|
| **predict_yield** | ML-based yield forecasting with confidence intervals | [→ Details](./docs/tools/predict-yield.md) |
|
|
299
|
+
| **optimize_portfolio** | Modern Portfolio Theory optimization with yield sustainability warnings | [→ Details](./docs/tools/optimize-portfolio.md) |
|
|
300
|
+
| **simulate_vault** | Simulate vault behavior under different parameters for scenario analysis | [→ Details](./docs/tools/simulate-vault.md) |
|
|
301
|
+
| **get_vault_composition** | Typed DeFi protocol composition (Vault.composition) with HHI diversification scoring. Chain-aware (requires chainId). | — |
|
|
302
|
+
| **get_global_tvl** | Live total value locked across all Lagoon vaults & chains (USD) | — |
|
|
303
|
+
| **get_indexing_status** | Last indexed block per chain — call BEFORE analytics to detect stale data | — |
|
|
304
|
+
| **list_chains** | Lagoon-supported chains with chainId, factory address, wrapped native token | — |
|
|
305
|
+
| **list_curators** | Curator directory (name, id, description, website) | — |
|
|
306
|
+
| **get_curator** | Single curator lookup by id | — |
|
|
307
|
+
| **get_asset** | ERC20 asset metadata + current USD price | — |
|
|
308
|
+
| **get_historical_state** | Vault state at a specific Unix timestamp (price-per-share, fees, totalAssets, roles, guardrails) | — |
|
|
306
309
|
|
|
307
310
|
**See also**: [Tool Selection Guide](./docs/tools/README.md#tool-selection-guide) | [Common Workflows](./docs/tools/README.md#common-workflows)
|
|
308
311
|
|
|
@@ -379,12 +382,22 @@ Skills are procedural knowledge modules that enhance how Claude uses MCP tools.
|
|
|
379
382
|
|
|
380
383
|
### Available Skills
|
|
381
384
|
|
|
385
|
+
**Customer-facing**
|
|
386
|
+
|
|
382
387
|
| Skill | Purpose | Audience |
|
|
383
388
|
|-------|---------|----------|
|
|
384
389
|
| `lagoon-onboarding` | Guide new users to first vault selection | New Users |
|
|
385
390
|
| `lagoon-portfolio-review` | Quarterly portfolio health checks | Existing Users |
|
|
386
391
|
| `lagoon-risk-expert` | Comprehensive risk evaluation | Advanced Users |
|
|
387
392
|
|
|
393
|
+
**Internal team**
|
|
394
|
+
|
|
395
|
+
| Skill | Purpose | Audience |
|
|
396
|
+
|-------|---------|----------|
|
|
397
|
+
| `lagoon-protocol-health` | Daily/weekly KPI monitoring | Operations |
|
|
398
|
+
| `lagoon-curator-evaluation` | Partnership assessment with scoring | Business Development |
|
|
399
|
+
| `lagoon-customer-support` | Support response templates | Support Team |
|
|
400
|
+
|
|
388
401
|
### Using Skills
|
|
389
402
|
|
|
390
403
|
#### With Claude Desktop
|
|
@@ -413,7 +426,7 @@ const { systemPrompt, detectedSkill, tokensAdded } = buildSkillAwarePrompt(
|
|
|
413
426
|
);
|
|
414
427
|
|
|
415
428
|
const response = await claude.messages.create({
|
|
416
|
-
model: 'claude-sonnet-4-
|
|
429
|
+
model: 'claude-sonnet-4-6',
|
|
417
430
|
system: systemPrompt,
|
|
418
431
|
tools: mcpTools,
|
|
419
432
|
messages: [{ role: 'user', content: userMessage }]
|
|
@@ -424,7 +437,7 @@ const response = await claude.messages.create({
|
|
|
424
437
|
|
|
425
438
|
## Development
|
|
426
439
|
|
|
427
|
-
For
|
|
440
|
+
For gotchas, conventions, testing, and how to add a tool, see [docs/agent-notes.md](./docs/agent-notes.md) (the developer reference, also imported by [CLAUDE.md](./CLAUDE.md)).
|
|
428
441
|
|
|
429
442
|
### Quick Start
|
|
430
443
|
|
|
@@ -452,16 +465,21 @@ npm test
|
|
|
452
465
|
```
|
|
453
466
|
lagoon-mcp/
|
|
454
467
|
├── docs/
|
|
455
|
-
│ ├──
|
|
468
|
+
│ ├── agent-notes.md # Developer reference (gotchas, conventions, add-a-tool)
|
|
456
469
|
│ └── tools/ # Individual tool documentation
|
|
457
470
|
├── skills/ # Claude Skills for enhanced interactions
|
|
458
471
|
├── src/
|
|
459
|
-
│ ├── tools/ # Tool implementations
|
|
472
|
+
│ ├── tools/ # Tool implementations + registry.ts
|
|
473
|
+
│ ├── services/ # Business-logic services (e.g. RiskService)
|
|
460
474
|
│ ├── resources/ # MCP resources
|
|
461
475
|
│ ├── prompts/ # MCP prompts
|
|
462
476
|
│ ├── skills/ # Skills TypeScript API
|
|
463
|
-
│ ├── graphql/ # GraphQL client
|
|
464
|
-
│ ├──
|
|
477
|
+
│ ├── graphql/ # GraphQL client, queries, fragments
|
|
478
|
+
│ ├── sdk/ # APR, simulation, and math utilities
|
|
479
|
+
│ ├── core/ # DI container, cache adapter, invalidation
|
|
480
|
+
│ ├── cache/ # Cache TTL and key definitions
|
|
481
|
+
│ ├── schemas/ # Zod config/env schemas
|
|
482
|
+
│ ├── types/ # TypeScript + generated GraphQL types
|
|
465
483
|
│ └── utils/ # Utilities
|
|
466
484
|
├── tests/ # Test suite
|
|
467
485
|
└── package.json
|
|
@@ -489,8 +507,8 @@ lagoon-mcp/
|
|
|
489
507
|
### Architecture Patterns
|
|
490
508
|
|
|
491
509
|
**Hybrid Service Layer**:
|
|
492
|
-
- **Direct GraphQL** for simple operations (
|
|
493
|
-
- **Service Layer** for complex multi-step operations (e.g., RiskService)
|
|
510
|
+
- **Direct GraphQL** for simple operations (most tools)
|
|
511
|
+
- **Service Layer** for complex multi-step operations (e.g., `RiskService` for risk analysis)
|
|
494
512
|
- See [ADR-001](./docs/architecture/ADR-001-service-layer.md) for decision rationale
|
|
495
513
|
|
|
496
514
|
**Dependency Injection**:
|
|
@@ -544,12 +562,14 @@ export function createExecuteAnalyzeRisk(container: ServiceContainer) {
|
|
|
544
562
|
|
|
545
563
|
| Data Type | TTL | Rationale | Cache Tag |
|
|
546
564
|
|-----------|-----|-----------|-----------|
|
|
547
|
-
| Transactions | 5 min | Frequently changing | `TRANSACTION` |
|
|
548
565
|
| User portfolios | 5 min | Dynamic user holdings | `PORTFOLIO` |
|
|
549
566
|
| Search results | 10 min | Balance freshness/performance | `VAULT` |
|
|
567
|
+
| Transactions | 15 min | Recent activity, moderately static | `TRANSACTION` |
|
|
550
568
|
| Vault data | 15 min | Relatively static | `VAULT` |
|
|
569
|
+
| Vault composition | 15 min | Backend caches Octav data ~6h | `VAULT` |
|
|
551
570
|
| Risk analysis | 15 min | Multi-factor metrics | `RISK` |
|
|
552
571
|
| Performance data | 30 min | Historical, less volatile | `PERFORMANCE` |
|
|
572
|
+
| Price history | 30 min | Daily aggregates | `PERFORMANCE` |
|
|
553
573
|
| Yield predictions | 60 min | ML forecasts valid longer | `PREDICTION` |
|
|
554
574
|
| Schema | 24 hours | Rarely changes | `SCHEMA` |
|
|
555
575
|
|
|
@@ -621,11 +641,8 @@ Type 'unknown' is not assignable to type 'Vault'
|
|
|
621
641
|
|
|
622
642
|
## FAQ
|
|
623
643
|
|
|
624
|
-
**Q:
|
|
625
|
-
A:
|
|
626
|
-
|
|
627
|
-
**Q: Does this work with Grok?**
|
|
628
|
-
A: No. xAI has not announced native MCP support for Grok, and there is no Grok desktop app with MCP capabilities. We recommend using Claude Desktop or waiting for ChatGPT Desktop MCP support.
|
|
644
|
+
**Q: Which clients does this work with?**
|
|
645
|
+
A: Any MCP-compatible client. It's verified with Claude Desktop, Claude Code (CLI), and the OpenAI Agents SDK, and works with other MCP clients (e.g. Cursor, Cline) since it uses the standard stdio transport. Clients without native MCP support cannot use it until they add MCP.
|
|
629
646
|
|
|
630
647
|
**Q: Do I need to modify the code for different platforms?**
|
|
631
648
|
A: No! The lagoon-mcp server is already compatible with all MCP clients (uses standard MCP protocol and stdio transport). Only configuration format differs between platforms.
|
|
@@ -643,10 +660,10 @@ A: Yes! The MCP protocol is standard. Any MCP-compatible client should work (e.g
|
|
|
643
660
|
A: No rate limiting in MCP. Backend GraphQL API is public with no auth.
|
|
644
661
|
|
|
645
662
|
**Q: Can I add custom tools?**
|
|
646
|
-
A: Yes! Fork the repo, add your tool in `src/tools/`, and register in `src/tools/
|
|
663
|
+
A: Yes! Fork the repo, add your tool in `src/tools/`, and register it in `TOOL_REGISTRY` in `src/tools/registry.ts`.
|
|
647
664
|
|
|
648
665
|
**Q: How do I update to a new version?**
|
|
649
|
-
A: Run `npm update -g @
|
|
666
|
+
A: Run `npm update -g @lagoon-protocol/lagoon-mcp` and restart Claude Desktop.
|
|
650
667
|
|
|
651
668
|
**Q: Does this work with all chains?**
|
|
652
669
|
A: Yes! Supports all chains available in the Lagoon backend (12+ networks).
|
|
@@ -659,7 +676,8 @@ MIT License - see [LICENSE](./LICENSE) for details
|
|
|
659
676
|
|
|
660
677
|
- **Issues**: [GitHub Issues](https://github.com/hopperlabsxyz/lagoon-mcp/issues)
|
|
661
678
|
- **Discussions**: [GitHub Discussions](https://github.com/hopperlabsxyz/lagoon-mcp/discussions)
|
|
662
|
-
- **Documentation**: [Tool Docs](./docs/tools/) | [
|
|
679
|
+
- **Documentation**: [Tool Docs](./docs/tools/) | [Developer Reference](./docs/agent-notes.md)
|
|
680
|
+
- **Release history**: [CHANGELOG.md](./CHANGELOG.md)
|
|
663
681
|
|
|
664
682
|
## Acknowledgments
|
|
665
683
|
|
package/dist/cache/index.d.ts
CHANGED
|
@@ -45,6 +45,9 @@ export declare const cacheTTL: {
|
|
|
45
45
|
readonly yieldPrediction: 3600;
|
|
46
46
|
readonly portfolioOptimization: 300;
|
|
47
47
|
readonly composition: 900;
|
|
48
|
+
readonly globalTvl: 300;
|
|
49
|
+
readonly indexingStatus: 60;
|
|
50
|
+
readonly historicalState: 3600;
|
|
48
51
|
};
|
|
49
52
|
/**
|
|
50
53
|
* Search filters type for cache key generation
|
|
@@ -74,7 +77,7 @@ export declare const cacheKeys: {
|
|
|
74
77
|
schema: () => string;
|
|
75
78
|
compareVaults: (addresses: string[], chainIds: number[]) => string;
|
|
76
79
|
priceHistory: (address: string, chainId: number, range: string) => string;
|
|
77
|
-
composition: (address: string) => string;
|
|
80
|
+
composition: (address: string, chainId: number) => string;
|
|
78
81
|
};
|
|
79
82
|
/**
|
|
80
83
|
* Generate cache key based on cache tag and parameters
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index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AAM,CAAC,GAAG,MAAM,CAa7F;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,SAAS,CAAC,KAAK,CAE/C;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAEjC"}
|
package/dist/cache/index.js
CHANGED
|
@@ -51,6 +51,9 @@ export const cacheTTL = {
|
|
|
51
51
|
yieldPrediction: 3600, // 60 minutes - ML-based forecast, expensive computation
|
|
52
52
|
portfolioOptimization: 300, // 5 minutes - user-specific, interactive use case
|
|
53
53
|
composition: 900, // 15 minutes - protocol composition from Octav API (backend caches 6h)
|
|
54
|
+
globalTvl: 300, // 5 minutes - protocol-wide TVL; ticks slowly but markets move
|
|
55
|
+
indexingStatus: 60, // 60 seconds - indexer health, block-by-block freshness needed
|
|
56
|
+
historicalState: 3600, // 60 minutes - historical state by timestamp is immutable once past
|
|
54
57
|
};
|
|
55
58
|
/**
|
|
56
59
|
* Cache key generators
|
|
@@ -70,7 +73,7 @@ export const cacheKeys = {
|
|
|
70
73
|
return `compare:${sortedAddresses}:${sortedChainIds}`;
|
|
71
74
|
},
|
|
72
75
|
priceHistory: (address, chainId, range) => `price_history:${address}:${chainId}:${range}`,
|
|
73
|
-
composition: (address) => `composition:${address.toLowerCase()}`,
|
|
76
|
+
composition: (address, chainId) => `composition:${address.toLowerCase()}:${chainId}`,
|
|
74
77
|
};
|
|
75
78
|
/**
|
|
76
79
|
* Generate cache key based on cache tag and parameters
|
package/dist/cache/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;IAC3B,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AAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;SACxC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,YAAY,EAAE,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,KAAK,CAAC,QAAQ,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
export interface APRBreakdown {
|
|
13
13
|
linearNetApr: number;
|
|
14
14
|
linearNetAprWithoutExtraYields: number;
|
|
15
|
+
twrrNetApr?: number | null;
|
|
16
|
+
twrrNetAprWithoutExtraYields?: number | null;
|
|
17
|
+
twrrGrossAprWithoutExtraYields?: number | null;
|
|
15
18
|
airdrops: Array<{
|
|
16
19
|
name: string;
|
|
17
20
|
apr: number;
|
|
@@ -60,5 +63,5 @@ export interface APRBreakdown {
|
|
|
60
63
|
* }
|
|
61
64
|
* ```
|
|
62
65
|
*/
|
|
63
|
-
export declare const APR_BREAKDOWN_FRAGMENT = "\n fragment APRBreakdownFragment on APRs {\n linearNetApr\n linearNetAprWithoutExtraYields\n airdrops {\n name\n apr\n description\n distributionTimestamp\n endTimestamp\n isEstimation\n logoUrl\n multiplier\n ppsIncrease\n startTimestamp\n }\n incentives {\n name\n apr\n aprDescription\n description\n endTimestamp\n incentiveRate {\n incentiveAmount\n referenceToken {\n id\n }\n referenceTokenAmount\n }\n }\n nativeYields {\n name\n apr\n aprDescription\n description\n endTimestamp\n isEstimation\n logoUrl\n multiplier\n startTimestamp\n }\n }\n";
|
|
66
|
+
export declare const APR_BREAKDOWN_FRAGMENT = "\n fragment APRBreakdownFragment on APRs {\n linearNetApr\n linearNetAprWithoutExtraYields\n twrrNetApr\n twrrNetAprWithoutExtraYields\n twrrGrossAprWithoutExtraYields\n airdrops {\n name\n apr\n description\n distributionTimestamp\n endTimestamp\n isEstimation\n logoUrl\n multiplier\n ppsIncrease\n startTimestamp\n }\n incentives {\n name\n apr\n aprDescription\n description\n endTimestamp\n incentiveRate {\n incentiveAmount\n referenceToken {\n id\n }\n referenceTokenAmount\n }\n }\n nativeYields {\n name\n apr\n aprDescription\n description\n endTimestamp\n isEstimation\n logoUrl\n multiplier\n startTimestamp\n }\n }\n";
|
|
64
67
|
//# sourceMappingURL=apr-breakdown.fragment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apr-breakdown.fragment.d.ts","sourceRoot":"","sources":["../../../src/graphql/fragments/apr-breakdown.fragment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,8BAA8B,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"apr-breakdown.fragment.d.ts","sourceRoot":"","sources":["../../../src/graphql/fragments/apr-breakdown.fragment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,8BAA8B,EAAE,MAAM,CAAC;IAGvC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,4BAA4B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,8BAA8B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,qBAAqB,EAAE,MAAM,CAAC;QAC9B,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,OAAO,CAAC;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;IACH,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE;YACb,eAAe,EAAE,MAAM,CAAC;YACxB,cAAc,EAAE;gBACd,EAAE,EAAE,MAAM,CAAC;aACZ,CAAC;YACF,oBAAoB,EAAE,MAAM,CAAC;SAC9B,CAAC;KACH,CAAC,CAAC;IACH,YAAY,EAAE,KAAK,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,YAAY,EAAE,OAAO,CAAC;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;CACJ;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,o0BA6ClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apr-breakdown.fragment.js","sourceRoot":"","sources":["../../../src/graphql/fragments/apr-breakdown.fragment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"apr-breakdown.fragment.js","sourceRoot":"","sources":["../../../src/graphql/fragments/apr-breakdown.fragment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoDH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CrC,CAAC"}
|
|
@@ -1,145 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Composition Fragment
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Note: The vaultComposition endpoint returns JSONObject type, so no GraphQL fragment
|
|
8
|
-
* is needed. The response is a flat object keyed by chain name.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Chain composition data from Octav API
|
|
12
|
-
* Each chain entry contains aggregated position values and metadata
|
|
13
|
-
*/
|
|
14
|
-
export interface ChainComposition {
|
|
15
|
-
/** Display name of the chain (e.g., "Ethereum", "Arbitrum") */
|
|
16
|
-
name: string;
|
|
17
|
-
/** Unique key for the chain (e.g., "ethereum", "arbitrum") */
|
|
18
|
-
key: string;
|
|
19
|
-
/** Chain ID as string (e.g., "1", "42161") */
|
|
20
|
-
chainId: string;
|
|
21
|
-
/** Total USD value of positions on this chain */
|
|
22
|
-
value: string;
|
|
23
|
-
/** Percentile ranking of this chain's value */
|
|
24
|
-
valuePercentile: string;
|
|
25
|
-
/** Total cost basis (may be "N/A") */
|
|
26
|
-
totalCostBasis: string;
|
|
27
|
-
/** Total closed PnL (may be "N/A") */
|
|
28
|
-
totalClosedPnl: string;
|
|
29
|
-
/** Total open PnL (may be "N/A") */
|
|
30
|
-
totalOpenPnl: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Raw vaultComposition response - JSONObject keyed by chain name
|
|
34
|
-
*
|
|
35
|
-
* Example:
|
|
36
|
-
* ```typescript
|
|
37
|
-
* {
|
|
38
|
-
* "ethereum": { name: "Ethereum", key: "ethereum", chainId: "1", value: "6224.80", ... },
|
|
39
|
-
* "arbitrum": { name: "Arbitrum", key: "arbitrum", chainId: "42161", value: "3.99", ... },
|
|
40
|
-
* "linea": { name: "Linea", key: "linea", chainId: "59144", value: "0", ... },
|
|
41
|
-
* // ... 60+ chains
|
|
42
|
-
* }
|
|
43
|
-
* ```
|
|
4
|
+
* Typed shape of `Vault.composition: CompositionData` (the v0.6+ replacement
|
|
5
|
+
* for the retired `vaultComposition(walletAddress)` JSONObject query).
|
|
44
6
|
*/
|
|
45
|
-
export type RawVaultComposition = Record<string, ChainComposition>;
|
|
46
7
|
/**
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
export interface ProtocolPositionCategory {
|
|
50
|
-
/** Category name (e.g., "Lending", "Yield", "Deposit", "Spot") */
|
|
51
|
-
name: string;
|
|
52
|
-
/** Total USD value in this category */
|
|
53
|
-
totalValue: string;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Chain-level breakdown within a protocol
|
|
57
|
-
*/
|
|
58
|
-
export interface ProtocolChainData {
|
|
59
|
-
/** Chain display name (e.g., "Ethereum") */
|
|
60
|
-
name: string;
|
|
61
|
-
/** Chain key (e.g., "ethereum") */
|
|
62
|
-
key: string;
|
|
63
|
-
/** USD value on this chain */
|
|
64
|
-
value: string;
|
|
65
|
-
/** Total cost basis (may be "N/A") */
|
|
66
|
-
totalCostBasis: string;
|
|
67
|
-
/** Total closed PnL (may be "N/A") */
|
|
68
|
-
totalClosedPnl: string;
|
|
69
|
-
/** Total open PnL (may be "N/A") */
|
|
70
|
-
totalOpenPnl: string;
|
|
71
|
-
/** Position categories on this chain (keyed by category type) */
|
|
72
|
-
protocolPositions: Record<string, ProtocolPositionCategory>;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Protocol-level composition data from Octav API
|
|
76
|
-
* Represents a DeFi protocol like Spark, Morpho, Yield Basis, or "wallet" for idle assets
|
|
77
|
-
*
|
|
78
|
-
* Example protocols: spark, morphoblue, yieldbasis, lagoon, hyperliquid, wallet
|
|
79
|
-
*/
|
|
80
|
-
export interface ProtocolCompositionData {
|
|
81
|
-
/** Protocol display name (e.g., "Spark", "Morpho", "Yield Basis", "Wallet") */
|
|
82
|
-
name: string;
|
|
83
|
-
/** Protocol key/identifier (e.g., "spark", "morphoblue", "wallet") */
|
|
84
|
-
key: string;
|
|
85
|
-
/** Total USD value in this protocol */
|
|
86
|
-
value: string;
|
|
87
|
-
/** Total cost basis (may be "N/A") */
|
|
88
|
-
totalCostBasis: string;
|
|
89
|
-
/** Total closed PnL (may be "N/A") */
|
|
90
|
-
totalClosedPnl: string;
|
|
91
|
-
/** Total open PnL (may be "N/A") */
|
|
92
|
-
totalOpenPnl: string;
|
|
93
|
-
/** Chain-level breakdown within this protocol */
|
|
94
|
-
chains: Record<string, ProtocolChainData>;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Full vaultComposition response structure from Octav API
|
|
98
|
-
*
|
|
99
|
-
* Contains two main sections:
|
|
100
|
-
* - assetByProtocols: Protocol-level breakdown (preferred for analysis)
|
|
101
|
-
* - chains: Chain-level summary (legacy, kept for backward compatibility)
|
|
102
|
-
*
|
|
103
|
-
* Example:
|
|
104
|
-
* ```typescript
|
|
105
|
-
* {
|
|
106
|
-
* address: "0x...",
|
|
107
|
-
* networth: "4970636.89",
|
|
108
|
-
* assetByProtocols: {
|
|
109
|
-
* "spark": { name: "Spark", value: "1324461.98", chains: { ethereum: {...} } },
|
|
110
|
-
* "wallet": { name: "Wallet", value: "6356.97", chains: { ethereum: {...} } },
|
|
111
|
-
* // ... other protocols
|
|
112
|
-
* },
|
|
113
|
-
* chains: {
|
|
114
|
-
* "ethereum": { name: "Ethereum", chainId: "1", value: "4970455.03", ... },
|
|
115
|
-
* // ... other chains
|
|
116
|
-
* }
|
|
117
|
-
* }
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
export interface VaultCompositionFullResponse {
|
|
121
|
-
/** Vault/wallet address */
|
|
122
|
-
address: string;
|
|
123
|
-
/** Total portfolio net worth in USD */
|
|
124
|
-
networth: string;
|
|
125
|
-
/** Protocol-level breakdown (PRIMARY - use for diversification analysis) */
|
|
126
|
-
assetByProtocols: Record<string, ProtocolCompositionData>;
|
|
127
|
-
/** Chain-level summary (LEGACY - kept for backward compatibility) */
|
|
128
|
-
chains: Record<string, ChainComposition>;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* @deprecated Use ChainComposition instead - backend API changed
|
|
132
|
-
* Protocol composition within a vault (legacy structure)
|
|
8
|
+
* Protocol-level allocation within `Vault.composition`. Sorted by
|
|
9
|
+
* `repartition` descending in the backend response.
|
|
133
10
|
*/
|
|
134
11
|
export interface ProtocolComposition {
|
|
12
|
+
/** Protocol display name (e.g., "morphoblue", "spark", "Other") */
|
|
135
13
|
protocol: string;
|
|
14
|
+
/** USD value deployed to this protocol */
|
|
136
15
|
valueInUsd: number;
|
|
16
|
+
/** Percentage of total vault value (0–100) */
|
|
137
17
|
repartition: number;
|
|
18
|
+
/** Drill-down for grouped items (currently only used by the "Other" bucket) */
|
|
138
19
|
details?: ProtocolComposition[];
|
|
20
|
+
/** Protocol logo URL (from Octav) */
|
|
21
|
+
logoUrl?: string | null;
|
|
139
22
|
}
|
|
140
23
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
24
|
+
* Token/position-level allocation within `Vault.composition`.
|
|
25
|
+
*
|
|
26
|
+
* Caveat (per live probe May 2026): `contract` and `chainKey` are empty
|
|
27
|
+
* strings in production, and `symbol`/`name` are human-readable display
|
|
28
|
+
* strings (e.g., "Spark - reth"), not real ERC20 contracts. Useful for
|
|
29
|
+
* display but NOT for programmatic cross-referencing.
|
|
143
30
|
*/
|
|
144
31
|
export interface TokenComposition {
|
|
145
32
|
symbol: string;
|
|
@@ -149,18 +36,20 @@ export interface TokenComposition {
|
|
|
149
36
|
valueInUsd: number;
|
|
150
37
|
repartition: number;
|
|
151
38
|
details?: TokenComposition[];
|
|
39
|
+
logoUrl?: string | null;
|
|
152
40
|
}
|
|
153
41
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
42
|
+
* Top-level shape of `Vault.composition`. `totalValueInUsd` is nullable —
|
|
43
|
+
* the backend returns null when no Octav data has been fetched yet.
|
|
156
44
|
*/
|
|
157
45
|
export interface CompositionData {
|
|
158
46
|
compositions: ProtocolComposition[];
|
|
159
47
|
tokenCompositions: TokenComposition[];
|
|
48
|
+
totalValueInUsd: number | null;
|
|
160
49
|
}
|
|
161
50
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
51
|
+
* GraphQL fragment for the typed CompositionData. Inlined inside a
|
|
52
|
+
* `vaultByAddress { composition { ... } }` query — NOT a standalone query.
|
|
164
53
|
*/
|
|
165
|
-
export declare const COMPOSITION_FRAGMENT = "\n fragment CompositionFragment on CompositionData {\n compositions {\n protocol\n valueInUsd\n repartition\n details {\n protocol\n valueInUsd\n repartition\n }\n }\n tokenCompositions {\n symbol\n name\n contract\n chainKey\n valueInUsd\n repartition\n details {\n symbol\n name\n contract\n chainKey\n valueInUsd\n repartition\n }\n }\n }\n";
|
|
54
|
+
export declare const COMPOSITION_FRAGMENT = "\n fragment CompositionFragment on CompositionData {\n totalValueInUsd\n compositions {\n protocol\n valueInUsd\n repartition\n logoUrl\n details {\n protocol\n valueInUsd\n repartition\n logoUrl\n }\n }\n tokenCompositions {\n symbol\n name\n contract\n chainKey\n valueInUsd\n repartition\n logoUrl\n details {\n symbol\n name\n contract\n chainKey\n valueInUsd\n repartition\n logoUrl\n }\n }\n }\n";
|
|
166
55
|
//# sourceMappingURL=composition.fragment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition.fragment.d.ts","sourceRoot":"","sources":["../../../src/graphql/fragments/composition.fragment.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"composition.fragment.d.ts","sourceRoot":"","sources":["../../../src/graphql/fragments/composition.fragment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,mBAAmB,EAAE,CAAC;IACpC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+jBAkChC,CAAC"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Composition Fragment
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Note: The vaultComposition endpoint returns JSONObject type, so no GraphQL fragment
|
|
8
|
-
* is needed. The response is a flat object keyed by chain name.
|
|
4
|
+
* Typed shape of `Vault.composition: CompositionData` (the v0.6+ replacement
|
|
5
|
+
* for the retired `vaultComposition(walletAddress)` JSONObject query).
|
|
9
6
|
*/
|
|
10
7
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* GraphQL fragment for the typed CompositionData. Inlined inside a
|
|
9
|
+
* `vaultByAddress { composition { ... } }` query — NOT a standalone query.
|
|
13
10
|
*/
|
|
14
11
|
export const COMPOSITION_FRAGMENT = `
|
|
15
12
|
fragment CompositionFragment on CompositionData {
|
|
13
|
+
totalValueInUsd
|
|
16
14
|
compositions {
|
|
17
15
|
protocol
|
|
18
16
|
valueInUsd
|
|
19
17
|
repartition
|
|
18
|
+
logoUrl
|
|
20
19
|
details {
|
|
21
20
|
protocol
|
|
22
21
|
valueInUsd
|
|
23
22
|
repartition
|
|
23
|
+
logoUrl
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
tokenCompositions {
|
|
@@ -30,6 +30,7 @@ export const COMPOSITION_FRAGMENT = `
|
|
|
30
30
|
chainKey
|
|
31
31
|
valueInUsd
|
|
32
32
|
repartition
|
|
33
|
+
logoUrl
|
|
33
34
|
details {
|
|
34
35
|
symbol
|
|
35
36
|
name
|
|
@@ -37,6 +38,7 @@ export const COMPOSITION_FRAGMENT = `
|
|
|
37
38
|
chainKey
|
|
38
39
|
valueInUsd
|
|
39
40
|
repartition
|
|
41
|
+
logoUrl
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition.fragment.js","sourceRoot":"","sources":["../../../src/graphql/fragments/composition.fragment.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"composition.fragment.js","sourceRoot":"","sources":["../../../src/graphql/fragments/composition.fragment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0DH;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCnC,CAAC"}
|