@varun-ai07/covenant-mcp 1.2.3 → 1.3.2
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 +1056 -170
- package/dist/abis/MultiTokenEscrow.json +836 -0
- package/dist/abis/v2/AgentRegistry.json +872 -0
- package/dist/abis/v2/DisputeResolution.json +493 -0
- package/dist/abis/v2/InsurancePool.json +645 -0
- package/dist/abis/v2/ReceiptVerifier.json +394 -0
- package/dist/abis/v2/RevisionManager.json +544 -0
- package/dist/abis/v2/TaskEscrow.json +1018 -0
- package/dist/cli.js +0 -0
- package/dist/config.d.ts +13 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +84 -25
- package/dist/config.js.map +1 -1
- package/dist/lib/did.d.ts +72 -0
- package/dist/lib/did.d.ts.map +1 -0
- package/dist/lib/did.js +115 -0
- package/dist/lib/did.js.map +1 -0
- package/dist/lib/formatResponse.d.ts +33 -0
- package/dist/lib/formatResponse.d.ts.map +1 -0
- package/dist/lib/formatResponse.js +92 -0
- package/dist/lib/formatResponse.js.map +1 -0
- package/dist/lib/schemaHelpers.d.ts +11 -0
- package/dist/lib/schemaHelpers.d.ts.map +1 -0
- package/dist/lib/schemaHelpers.js +11 -0
- package/dist/lib/schemaHelpers.js.map +1 -0
- package/dist/lib/store.d.ts +10 -0
- package/dist/lib/store.d.ts.map +1 -0
- package/dist/lib/store.js +39 -0
- package/dist/lib/store.js.map +1 -0
- package/dist/lib/verify.d.ts +21 -0
- package/dist/lib/verify.d.ts.map +1 -0
- package/dist/lib/verify.js +568 -0
- package/dist/lib/verify.js.map +1 -0
- package/dist/schemas.d.ts +5 -5
- package/dist/schemas.d.ts.map +1 -1
- package/dist/server.d.ts +1 -25
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +53 -37
- package/dist/server.js.map +1 -1
- package/dist/shared-types.d.ts +67 -0
- package/dist/shared-types.d.ts.map +1 -0
- package/dist/shared-types.js +86 -0
- package/dist/shared-types.js.map +1 -0
- package/dist/tools/account-abstraction.d.ts +3 -0
- package/dist/tools/account-abstraction.d.ts.map +1 -0
- package/dist/tools/account-abstraction.js +364 -0
- package/dist/tools/account-abstraction.js.map +1 -0
- package/dist/tools/batches.d.ts.map +1 -1
- package/dist/tools/batches.js +68 -37
- package/dist/tools/batches.js.map +1 -1
- package/dist/tools/bounties.d.ts +3 -0
- package/dist/tools/bounties.d.ts.map +1 -0
- package/dist/tools/bounties.js +304 -0
- package/dist/tools/bounties.js.map +1 -0
- package/dist/tools/bridge.d.ts +3 -0
- package/dist/tools/bridge.d.ts.map +1 -0
- package/dist/tools/bridge.js +190 -0
- package/dist/tools/bridge.js.map +1 -0
- package/dist/tools/collectives.d.ts.map +1 -1
- package/dist/tools/collectives.js +74 -46
- package/dist/tools/collectives.js.map +1 -1
- package/dist/tools/covenant-help.d.ts +3 -0
- package/dist/tools/covenant-help.d.ts.map +1 -0
- package/dist/tools/covenant-help.js +321 -0
- package/dist/tools/covenant-help.js.map +1 -0
- package/dist/tools/cross-chain.d.ts +3 -0
- package/dist/tools/cross-chain.d.ts.map +1 -0
- package/dist/tools/cross-chain.js +77 -0
- package/dist/tools/cross-chain.js.map +1 -0
- package/dist/tools/disputes.d.ts.map +1 -1
- package/dist/tools/disputes.js +39 -33
- package/dist/tools/disputes.js.map +1 -1
- package/dist/tools/escrow.d.ts.map +1 -1
- package/dist/tools/escrow.js +248 -199
- package/dist/tools/escrow.js.map +1 -1
- package/dist/tools/fiat-onramp.d.ts +3 -0
- package/dist/tools/fiat-onramp.d.ts.map +1 -0
- package/dist/tools/fiat-onramp.js +108 -0
- package/dist/tools/fiat-onramp.js.map +1 -0
- package/dist/tools/governance.d.ts +3 -0
- package/dist/tools/governance.d.ts.map +1 -0
- package/dist/tools/governance.js +271 -0
- package/dist/tools/governance.js.map +1 -0
- package/dist/tools/grants.d.ts +3 -0
- package/dist/tools/grants.d.ts.map +1 -0
- package/dist/tools/grants.js +269 -0
- package/dist/tools/grants.js.map +1 -0
- package/dist/tools/insurance.d.ts.map +1 -1
- package/dist/tools/insurance.js +92 -45
- package/dist/tools/insurance.js.map +1 -1
- package/dist/tools/market.d.ts.map +1 -1
- package/dist/tools/market.js +122 -103
- package/dist/tools/market.js.map +1 -1
- package/dist/tools/matching.d.ts +3 -0
- package/dist/tools/matching.d.ts.map +1 -0
- package/dist/tools/matching.js +233 -0
- package/dist/tools/matching.js.map +1 -0
- package/dist/tools/messaging.d.ts +3 -0
- package/dist/tools/messaging.d.ts.map +1 -0
- package/dist/tools/messaging.js +159 -0
- package/dist/tools/messaging.js.map +1 -0
- package/dist/tools/multi-token.d.ts +3 -0
- package/dist/tools/multi-token.d.ts.map +1 -0
- package/dist/tools/multi-token.js +274 -0
- package/dist/tools/multi-token.js.map +1 -0
- package/dist/tools/offchain-coordinator.d.ts +3 -0
- package/dist/tools/offchain-coordinator.d.ts.map +1 -0
- package/dist/tools/offchain-coordinator.js +436 -0
- package/dist/tools/offchain-coordinator.js.map +1 -0
- package/dist/tools/protocol.d.ts.map +1 -1
- package/dist/tools/protocol.js +19 -6
- package/dist/tools/protocol.js.map +1 -1
- package/dist/tools/receipts.d.ts.map +1 -1
- package/dist/tools/receipts.js +39 -39
- package/dist/tools/receipts.js.map +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +90 -43
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/reputation-vc.d.ts +3 -0
- package/dist/tools/reputation-vc.d.ts.map +1 -0
- package/dist/tools/reputation-vc.js +438 -0
- package/dist/tools/reputation-vc.js.map +1 -0
- package/dist/tools/revisions.d.ts +3 -0
- package/dist/tools/revisions.d.ts.map +1 -0
- package/dist/tools/revisions.js +108 -0
- package/dist/tools/revisions.js.map +1 -0
- package/dist/tools/router.d.ts +3 -0
- package/dist/tools/router.d.ts.map +1 -0
- package/dist/tools/router.js +104 -0
- package/dist/tools/router.js.map +1 -0
- package/dist/tools/streaming.d.ts +3 -0
- package/dist/tools/streaming.d.ts.map +1 -0
- package/dist/tools/streaming.js +350 -0
- package/dist/tools/streaming.js.map +1 -0
- package/dist/tools/templates.d.ts +3 -0
- package/dist/tools/templates.d.ts.map +1 -0
- package/dist/tools/templates.js +392 -0
- package/dist/tools/templates.js.map +1 -0
- package/dist/tools/training.d.ts +3 -0
- package/dist/tools/training.d.ts.map +1 -0
- package/dist/tools/training.js +304 -0
- package/dist/tools/training.js.map +1 -0
- package/dist/tools/v2-settlement.d.ts +3 -0
- package/dist/tools/v2-settlement.d.ts.map +1 -0
- package/dist/tools/v2-settlement.js +226 -0
- package/dist/tools/v2-settlement.js.map +1 -0
- package/dist/tools/verification.d.ts +3 -0
- package/dist/tools/verification.d.ts.map +1 -0
- package/dist/tools/verification.js +215 -0
- package/dist/tools/verification.js.map +1 -0
- package/dist/tools/verify-deep.d.ts +3 -0
- package/dist/tools/verify-deep.d.ts.map +1 -0
- package/dist/tools/verify-deep.js +125 -0
- package/dist/tools/verify-deep.js.map +1 -0
- package/dist/types.d.ts +16 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -23
- package/dist/types.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grant Program MCP Tools (In-Memory MVP)
|
|
3
|
+
*
|
|
4
|
+
* apply_grant — Submit a grant application
|
|
5
|
+
* list_grants — List grant applications with status filter
|
|
6
|
+
* get_grant — Get grant application details
|
|
7
|
+
* vote_grant — Vote on a grant application (reputation-weighted)
|
|
8
|
+
*/
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { loadAbi, CONTRACTS, getAccount } from "../config.js";
|
|
11
|
+
import { readContract } from "../handlers/wallet.js";
|
|
12
|
+
import { formatReadResult, formatError } from "../handlers/transactions.js";
|
|
13
|
+
import { formatSuccess, formatStructuredError } from "../lib/formatResponse.js";
|
|
14
|
+
import { ethAmount } from "../lib/schemaHelpers.js";
|
|
15
|
+
import { loadStore, saveStore } from "../lib/store.js";
|
|
16
|
+
const grantsData = loadStore("grants", { counter: 0, items: {} });
|
|
17
|
+
let grantCounter = grantsData.counter;
|
|
18
|
+
const grants = new Map(Object.entries(grantsData.items).map(([k, v]) => [Number(k), v]));
|
|
19
|
+
function persist() {
|
|
20
|
+
const items = {};
|
|
21
|
+
grants.forEach((v, k) => { items[k] = v; });
|
|
22
|
+
saveStore("grants", { counter: grantCounter, items });
|
|
23
|
+
}
|
|
24
|
+
// ─── ABI for reading agent reputation ───────────────────────
|
|
25
|
+
const REGISTRY_ABI = loadAbi("AgentRegistry");
|
|
26
|
+
async function getAgentReputation(address) {
|
|
27
|
+
try {
|
|
28
|
+
const profile = await readContract(CONTRACTS.AgentRegistry, REGISTRY_ABI, "getAgent", [address]);
|
|
29
|
+
return Number(profile.reputation ?? 0);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// ─── Validation Schemas ──────────────────────────────────────
|
|
36
|
+
const applyGrantSchema = z.object({
|
|
37
|
+
title: z.string().min(1).max(200),
|
|
38
|
+
description: z.string().min(1).max(2000),
|
|
39
|
+
category: z.enum(["ecosystem_growth", "research", "community", "security"]),
|
|
40
|
+
amountRequested: z.string().regex(/^\d+\.?\d*$/, "Invalid ETH amount format")
|
|
41
|
+
.refine(val => {
|
|
42
|
+
const amount = parseFloat(val);
|
|
43
|
+
return amount > 0 && amount <= 10000;
|
|
44
|
+
}, { message: "Amount must be between 0 and 10,000 ETH" }),
|
|
45
|
+
});
|
|
46
|
+
const voteGrantSchema = z.object({
|
|
47
|
+
grantId: z.number().int().nonnegative(),
|
|
48
|
+
support: z.boolean(),
|
|
49
|
+
});
|
|
50
|
+
// ─── Tool Registration ───────────────────────────────────────
|
|
51
|
+
export function registerGrantTools(server) {
|
|
52
|
+
// ──────────────────────────────────────────────────────────────
|
|
53
|
+
// corven_apply_grant
|
|
54
|
+
// ──────────────────────────────────────────────────────────────
|
|
55
|
+
server.registerTool("corven_apply_grant", {
|
|
56
|
+
title: "Apply for Grant",
|
|
57
|
+
description: "Submits a grant application to the COVENANT grant program.\n" +
|
|
58
|
+
"USE WHEN: You need funding for ecosystem growth, research, community, or security work related to COVENANT.\n" +
|
|
59
|
+
"REQUIRES: Wallet configured via PRIVATE_KEY. Must be a registered agent.\n" +
|
|
60
|
+
"RETURNS: Grant ID, title, category, amount requested, status (pending), applicant address.\n" +
|
|
61
|
+
"COMES BEFORE: Community members call corven_vote_grant to vote. Approved grants move to 'funded' status.\n" +
|
|
62
|
+
"CATEGORIES: ecosystem_growth (tooling, integrations), research (protocols, cryptography), community (education, events), security (audits, monitoring).",
|
|
63
|
+
inputSchema: {
|
|
64
|
+
title: z.string().describe("Short title for the grant proposal"),
|
|
65
|
+
description: z.string().describe("Detailed description of what the grant will fund and expected outcomes"),
|
|
66
|
+
category: z.enum(["ecosystem_growth", "research", "community", "security"])
|
|
67
|
+
.describe("Grant category: ecosystem_growth, research, community, or security"),
|
|
68
|
+
amountRequested: ethAmount,
|
|
69
|
+
},
|
|
70
|
+
}, async ({ title, description, category, amountRequested }) => {
|
|
71
|
+
try {
|
|
72
|
+
const validation = applyGrantSchema.safeParse({ title, description, category, amountRequested });
|
|
73
|
+
if (!validation.success) {
|
|
74
|
+
return formatStructuredError(`Invalid input: ${validation.error.issues.map(e => e.message).join(", ")}`, "Validation failed.", "Check parameter formats: title (1-200 chars), description (1-2000 chars), category (enum), amountRequested (ETH decimal string).", false);
|
|
75
|
+
}
|
|
76
|
+
const account = getAccount();
|
|
77
|
+
if (!account) {
|
|
78
|
+
return formatStructuredError("No private key configured.", "PRIVATE_KEY not set.", "Set PRIVATE_KEY in .env.", false);
|
|
79
|
+
}
|
|
80
|
+
const id = grantCounter++;
|
|
81
|
+
const grant = {
|
|
82
|
+
id,
|
|
83
|
+
title,
|
|
84
|
+
description,
|
|
85
|
+
applicant: account.address,
|
|
86
|
+
category,
|
|
87
|
+
amountRequested,
|
|
88
|
+
status: "pending",
|
|
89
|
+
votesFor: 0,
|
|
90
|
+
votesAgainst: 0,
|
|
91
|
+
voters: {},
|
|
92
|
+
createdAt: Math.floor(Date.now() / 1000),
|
|
93
|
+
};
|
|
94
|
+
grants.set(id, grant);
|
|
95
|
+
persist();
|
|
96
|
+
return formatSuccess(`Grant #${id} application submitted successfully.`, {
|
|
97
|
+
grantId: id,
|
|
98
|
+
title,
|
|
99
|
+
category,
|
|
100
|
+
amountRequested: `${amountRequested} ETH`,
|
|
101
|
+
status: "pending",
|
|
102
|
+
applicant: account.address,
|
|
103
|
+
}, undefined, [
|
|
104
|
+
"Your application is now pending community review.",
|
|
105
|
+
"Use corven_list_grants to track status. Community members vote via corven_vote_grant.",
|
|
106
|
+
]);
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
return formatError(e);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
// ──────────────────────────────────────────────────────────────
|
|
113
|
+
// corven_list_grants
|
|
114
|
+
// ──────────────────────────────────────────────────────────────
|
|
115
|
+
server.registerTool("corven_list_grants", {
|
|
116
|
+
title: "List Grants",
|
|
117
|
+
description: "Lists all grant applications with optional status filter.\n" +
|
|
118
|
+
"USE WHEN: Reviewing pending grants to vote on. Checking grant program activity. Tracking your own applications.\n" +
|
|
119
|
+
"REQUIRES: Nothing. Free read-only call.\n" +
|
|
120
|
+
"RETURNS: Array of grant summaries (id, title, category, amount, status, votes, applicant).\n" +
|
|
121
|
+
"COMES BEFORE: corven_get_grant for full details, corven_vote_grant to cast a vote.",
|
|
122
|
+
inputSchema: {
|
|
123
|
+
status: z.enum(["pending", "approved", "rejected", "funded"]).optional()
|
|
124
|
+
.describe("Filter by grant status. Omit to return all grants."),
|
|
125
|
+
},
|
|
126
|
+
}, async ({ status }) => {
|
|
127
|
+
try {
|
|
128
|
+
const results = [];
|
|
129
|
+
for (const grant of grants.values()) {
|
|
130
|
+
if (status && grant.status !== status)
|
|
131
|
+
continue;
|
|
132
|
+
results.push({
|
|
133
|
+
id: grant.id,
|
|
134
|
+
title: grant.title,
|
|
135
|
+
category: grant.category,
|
|
136
|
+
amountRequested: `${grant.amountRequested} ETH`,
|
|
137
|
+
status: grant.status,
|
|
138
|
+
votesFor: grant.votesFor,
|
|
139
|
+
votesAgainst: grant.votesAgainst,
|
|
140
|
+
applicant: grant.applicant,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
if (results.length === 0) {
|
|
144
|
+
return formatReadResult({ count: 0, grants: [] }, status
|
|
145
|
+
? `No grants found with status "${status}".`
|
|
146
|
+
: "No grant applications found.");
|
|
147
|
+
}
|
|
148
|
+
return formatReadResult({ count: results.length, grants: results }, `Found ${results.length} grant application${results.length === 1 ? "" : "s"}.`);
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
return formatError(e);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
// ──────────────────────────────────────────────────────────────
|
|
155
|
+
// corven_get_grant
|
|
156
|
+
// ──────────────────────────────────────────────────────────────
|
|
157
|
+
server.registerTool("corven_get_grant", {
|
|
158
|
+
title: "Get Grant Details",
|
|
159
|
+
description: "Reads full details of a grant application including all votes.\n" +
|
|
160
|
+
"USE WHEN: Reviewing a specific grant before voting. Checking vote counts and voter details.\n" +
|
|
161
|
+
"REQUIRES: Nothing. Free read-only call.\n" +
|
|
162
|
+
"RETURNS: Full grant details — title, description, category, amount, status, applicant, votes, individual voter records.\n" +
|
|
163
|
+
"COMES AFTER: corven_list_grants found the grant ID.\n" +
|
|
164
|
+
"COMES BEFORE: corven_vote_grant to cast your vote.",
|
|
165
|
+
inputSchema: {
|
|
166
|
+
grantId: z.number().describe("Grant application ID to look up"),
|
|
167
|
+
},
|
|
168
|
+
}, async ({ grantId }) => {
|
|
169
|
+
try {
|
|
170
|
+
const grant = grants.get(grantId);
|
|
171
|
+
if (!grant) {
|
|
172
|
+
return formatStructuredError(`Grant #${grantId} not found.`, "No grant application exists with that ID.", "Call corven_list_grants to see available grants.", false);
|
|
173
|
+
}
|
|
174
|
+
const voterList = Object.entries(grant.voters).map(([addr, v]) => ({
|
|
175
|
+
address: addr,
|
|
176
|
+
support: v.support,
|
|
177
|
+
weight: v.weight,
|
|
178
|
+
}));
|
|
179
|
+
return formatReadResult({
|
|
180
|
+
id: grant.id,
|
|
181
|
+
title: grant.title,
|
|
182
|
+
description: grant.description,
|
|
183
|
+
applicant: grant.applicant,
|
|
184
|
+
category: grant.category,
|
|
185
|
+
amountRequested: `${grant.amountRequested} ETH`,
|
|
186
|
+
status: grant.status,
|
|
187
|
+
votesFor: grant.votesFor,
|
|
188
|
+
votesAgainst: grant.votesAgainst,
|
|
189
|
+
totalVoters: voterList.length,
|
|
190
|
+
voters: voterList,
|
|
191
|
+
createdAt: grant.createdAt,
|
|
192
|
+
}, `Grant #${grantId}`);
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
return formatError(e);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
// ──────────────────────────────────────────────────────────────
|
|
199
|
+
// corven_vote_grant
|
|
200
|
+
// ──────────────────────────────────────────────────────────────
|
|
201
|
+
server.registerTool("corven_vote_grant", {
|
|
202
|
+
title: "Vote on Grant",
|
|
203
|
+
description: "Casts a reputation-weighted vote on a grant application. Your vote weight equals your agent's reputation score (0-1000).\n" +
|
|
204
|
+
"USE WHEN: Reviewing and voting on pending grant applications as a community member.\n" +
|
|
205
|
+
"REQUIRES: Wallet configured via PRIVATE_KEY. Must be a registered agent with reputation > 0.\n" +
|
|
206
|
+
"RETURNS: Grant ID, your vote (support/oppose), your reputation weight, updated vote totals.\n" +
|
|
207
|
+
"COMES AFTER: corven_list_grants or corven_get_grant to review the application.\n" +
|
|
208
|
+
"NOTE: Each address can only vote once per grant. You cannot vote on your own application. Vote weight is your current on-chain reputation.",
|
|
209
|
+
inputSchema: {
|
|
210
|
+
grantId: z.number().describe("Grant application ID to vote on"),
|
|
211
|
+
support: z.boolean().describe("true = vote in favor (approve), false = vote against (reject)"),
|
|
212
|
+
},
|
|
213
|
+
}, async ({ grantId, support }) => {
|
|
214
|
+
try {
|
|
215
|
+
const validation = voteGrantSchema.safeParse({ grantId, support });
|
|
216
|
+
if (!validation.success) {
|
|
217
|
+
return formatStructuredError(`Invalid input: ${validation.error.issues.map(e => e.message).join(", ")}`, "Validation failed.", "Check grantId (non-negative integer) and support (boolean).", false);
|
|
218
|
+
}
|
|
219
|
+
const account = getAccount();
|
|
220
|
+
if (!account) {
|
|
221
|
+
return formatStructuredError("No private key configured.", "PRIVATE_KEY not set.", "Set PRIVATE_KEY in .env.", false);
|
|
222
|
+
}
|
|
223
|
+
const grant = grants.get(grantId);
|
|
224
|
+
if (!grant) {
|
|
225
|
+
return formatStructuredError(`Grant #${grantId} not found.`, "No grant application exists with that ID.", "Call corven_list_grants to see available grants.", false);
|
|
226
|
+
}
|
|
227
|
+
if (grant.status !== "pending") {
|
|
228
|
+
return formatStructuredError(`Grant #${grantId} is not pending (status: ${grant.status}).`, "Only pending grants can receive votes.", "Call corven_list_grants with status='pending' to find votable grants.", false);
|
|
229
|
+
}
|
|
230
|
+
const voterAddr = account.address;
|
|
231
|
+
if (grant.applicant.toLowerCase() === voterAddr.toLowerCase()) {
|
|
232
|
+
return formatStructuredError("Cannot vote on your own grant application.", `This grant was created by ${grant.applicant}.`, "Only other community members can vote on a grant.", false);
|
|
233
|
+
}
|
|
234
|
+
if (grant.voters[voterAddr]) {
|
|
235
|
+
return formatStructuredError(`You have already voted on Grant #${grantId}.`, "Each address can only vote once per grant.", "Your existing vote is recorded. Check corven_get_grant for current totals.", false);
|
|
236
|
+
}
|
|
237
|
+
const weight = await getAgentReputation(voterAddr);
|
|
238
|
+
if (weight <= 0) {
|
|
239
|
+
return formatStructuredError("Agent has no reputation for voting.", `Address ${voterAddr} is not registered or has 0 reputation.`, "Register as an agent first with corven_register_agent.", false);
|
|
240
|
+
}
|
|
241
|
+
grant.voters[voterAddr] = { support, weight };
|
|
242
|
+
if (support) {
|
|
243
|
+
grant.votesFor += weight;
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
grant.votesAgainst += weight;
|
|
247
|
+
}
|
|
248
|
+
persist();
|
|
249
|
+
return formatSuccess(`Vote recorded for Grant #${grantId}.`, {
|
|
250
|
+
grantId,
|
|
251
|
+
voter: voterAddr,
|
|
252
|
+
support,
|
|
253
|
+
weight,
|
|
254
|
+
votesFor: grant.votesFor,
|
|
255
|
+
votesAgainst: grant.votesAgainst,
|
|
256
|
+
totalVoters: Object.keys(grant.voters).length,
|
|
257
|
+
}, undefined, [
|
|
258
|
+
support
|
|
259
|
+
? `You voted in favor with weight ${weight} (your reputation).`
|
|
260
|
+
: `You voted against with weight ${weight} (your reputation).`,
|
|
261
|
+
`Grant #${grantId} now has ${grant.votesFor} for / ${grant.votesAgainst} against.`,
|
|
262
|
+
]);
|
|
263
|
+
}
|
|
264
|
+
catch (e) {
|
|
265
|
+
return formatError(e);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=grants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/tools/grants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAsB,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAwBvD,MAAM,UAAU,GAAG,S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AAC,CAAC,iCAAiC,MAAM,qBAAqB;gBAChE,UAAU,OAAO,YAAY,KAAK,CAAC,QAAQ,UAAU,KAAK,CAAC,YAAY,WAAW;aACnF,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insurance.d.ts","sourceRoot":"","sources":["../../src/tools/insurance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"insurance.d.ts","sourceRoot":"","sources":["../../src/tools/insurance.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA+T9D"}
|
package/dist/tools/insurance.js
CHANGED
|
@@ -10,6 +10,8 @@ import { parseEther, formatEther } from "viem";
|
|
|
10
10
|
import { loadAbi, CONTRACTS, getAccount } from "../config.js";
|
|
11
11
|
import { executeOrPrepare, readContract } from "../handlers/wallet.js";
|
|
12
12
|
import { formatTxResult, formatReadResult, formatError } from "../handlers/transactions.js";
|
|
13
|
+
import { parseContractError, formatStructuredError } from "../lib/formatResponse.js";
|
|
14
|
+
import { taskId as taskIdSchema, ethAmount, ethAddress } from "../lib/schemaHelpers.js";
|
|
13
15
|
const ABI = loadAbi("AgentInsurance");
|
|
14
16
|
// Input validation schemas
|
|
15
17
|
const claimInsuranceSchema = z.object({
|
|
@@ -21,10 +23,15 @@ export function registerInsuranceTools(server) {
|
|
|
21
23
|
// ──────────────────────────────────────────────────────────────
|
|
22
24
|
server.registerTool("corven_claim_insurance", {
|
|
23
25
|
title: "Claim Insurance",
|
|
24
|
-
description: "Submit an insurance claim for a failed task. " +
|
|
25
|
-
"
|
|
26
|
+
description: "Submit an insurance claim for a failed task. May require governance approval depending on claim type.\n" +
|
|
27
|
+
"USE WHEN: A task you were working on failed (e.g., deadline passed, dispute lost) and you want to recover covered funds.\n" +
|
|
28
|
+
"REQUIRES: You must be a member of the insurance pool (corven_join_insurance_pool). The task must have had a premium paid (corven_pay_premium).\n" +
|
|
29
|
+
"RETURNS: Transaction hash. The claim ID is emitted in the event logs.\n" +
|
|
30
|
+
"COMES AFTER: corven_pay_premium was called for this task, and the task failed.\n" +
|
|
31
|
+
"COMES BEFORE: corven_vote_on_claim (governance votes), corven_pay_claim (payout after approval).\n" +
|
|
32
|
+
"NOTE: Claims may require governance approval. Check coverage with corven_get_coverage_percent.",
|
|
26
33
|
inputSchema: {
|
|
27
|
-
taskId:
|
|
34
|
+
taskId: taskIdSchema,
|
|
28
35
|
},
|
|
29
36
|
}, async ({ taskId }) => {
|
|
30
37
|
try {
|
|
@@ -40,7 +47,8 @@ export function registerInsuranceTools(server) {
|
|
|
40
47
|
return formatTxResult(result);
|
|
41
48
|
}
|
|
42
49
|
catch (e) {
|
|
43
|
-
|
|
50
|
+
const parsed = parseContractError(e);
|
|
51
|
+
return formatStructuredError(parsed.error, parsed.cause, parsed.fix, parsed.retryable);
|
|
44
52
|
}
|
|
45
53
|
});
|
|
46
54
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -48,45 +56,43 @@ export function registerInsuranceTools(server) {
|
|
|
48
56
|
// ──────────────────────────────────────────────────────────────
|
|
49
57
|
server.registerTool("corven_get_claim", {
|
|
50
58
|
title: "Get Insurance Claim",
|
|
51
|
-
description: "
|
|
59
|
+
description: "Get claim details by ID, or total claim count if no ID provided.\n" +
|
|
60
|
+
"USE WHEN: You need to check the status, amount, or resolution of an insurance claim.\n" +
|
|
61
|
+
"REQUIRES: The claim must exist on-chain.\n" +
|
|
62
|
+
"RETURNS: Claim details including claimant, task ID, amount, status, and approval votes. If no ID provided, returns total claim count.\n" +
|
|
63
|
+
"COMES AFTER: corven_claim_insurance filed the claim.\n" +
|
|
64
|
+
"COMES BEFORE: corven_vote_on_claim (if governance voting is pending) or corven_pay_claim (if approved).\n" +
|
|
65
|
+
"NOTE: Omit claimId to get the total number of claims.",
|
|
52
66
|
inputSchema: {
|
|
53
|
-
claimId: z.number().describe("Claim ID"),
|
|
67
|
+
claimId: z.number().optional().describe("Claim ID. Omit to get total claim count."),
|
|
54
68
|
},
|
|
55
69
|
}, async ({ claimId }) => {
|
|
56
70
|
try {
|
|
71
|
+
if (claimId === undefined) {
|
|
72
|
+
const count = await readContract(CONTRACTS.AgentInsurance, ABI, "claimCounter", []);
|
|
73
|
+
return formatReadResult({ claimCount: Number(count) }, "Insurance Claim Count");
|
|
74
|
+
}
|
|
57
75
|
const data = await readContract(CONTRACTS.AgentInsurance, ABI, "getClaim", [BigInt(claimId)]);
|
|
58
|
-
const enriched = {
|
|
59
|
-
...data,
|
|
60
|
-
amountEth: data.amount ? formatEther(data.amount) : "0",
|
|
61
|
-
};
|
|
76
|
+
const enriched = { ...data, amountEth: data.amount ? formatEther(data.amount) : "0" };
|
|
62
77
|
return formatReadResult(enriched, `Insurance Claim #${claimId}`);
|
|
63
78
|
}
|
|
64
79
|
catch (e) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
// ──────────────────────────────────────────────────────────────
|
|
69
|
-
// get_claim_counter
|
|
70
|
-
// ──────────────────────────────────────────────────────────────
|
|
71
|
-
server.registerTool("corven_get_claim_counter", {
|
|
72
|
-
title: "Get Claim Counter",
|
|
73
|
-
description: "Get the total number of insurance claims filed.",
|
|
74
|
-
inputSchema: {},
|
|
75
|
-
}, async () => {
|
|
76
|
-
try {
|
|
77
|
-
const count = await readContract(CONTRACTS.AgentInsurance, ABI, "claimCounter", []);
|
|
78
|
-
return formatReadResult({ count: Number(count) }, "Insurance Claim Counter");
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
return formatError(e);
|
|
80
|
+
const parsed = parseContractError(e);
|
|
81
|
+
return formatStructuredError(parsed.error, parsed.cause, parsed.fix, parsed.retryable);
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
+
// get_claim_counter merged into get_claim (returns count when no claimId)
|
|
84
85
|
// ──────────────────────────────────────────────────────────────
|
|
85
86
|
// get_coverage_percent
|
|
86
87
|
// ──────────────────────────────────────────────────────────────
|
|
87
88
|
server.registerTool("corven_get_coverage_percent", {
|
|
88
89
|
title: "Get Coverage Percentage",
|
|
89
|
-
description: "Get the insurance coverage percentage (e.g., 80% = 80)
|
|
90
|
+
description: "Get the insurance coverage percentage (e.g., 80% = 80).\n" +
|
|
91
|
+
"USE WHEN: You want to know what percentage of a failed task's payment the insurance pool covers.\n" +
|
|
92
|
+
"REQUIRES: None — this is a read-only query.\n" +
|
|
93
|
+
"RETURNS: The coverage percentage as a number (e.g., 80 means 80% of task payment is covered).\n" +
|
|
94
|
+
"COMES BEFORE: corven_pay_premium (decide if coverage is worth the premium cost).\n" +
|
|
95
|
+
"NOTE: This is a protocol-wide constant, not per-task.",
|
|
90
96
|
inputSchema: {},
|
|
91
97
|
}, async () => {
|
|
92
98
|
try {
|
|
@@ -94,7 +100,8 @@ export function registerInsuranceTools(server) {
|
|
|
94
100
|
return formatReadResult({ coveragePercent: Number(percent) }, "Coverage Percentage");
|
|
95
101
|
}
|
|
96
102
|
catch (e) {
|
|
97
|
-
|
|
103
|
+
const parsed = parseContractError(e);
|
|
104
|
+
return formatStructuredError(parsed.error, parsed.cause, parsed.fix, parsed.retryable);
|
|
98
105
|
}
|
|
99
106
|
});
|
|
100
107
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -102,9 +109,15 @@ export function registerInsuranceTools(server) {
|
|
|
102
109
|
// ──────────────────────────────────────────────────────────────
|
|
103
110
|
server.registerTool("corven_join_insurance_pool", {
|
|
104
111
|
title: "Join Insurance Pool",
|
|
105
|
-
description: "Join the agent insurance pool by contributing ETH (min 0.01 ETH)
|
|
112
|
+
description: "Join the agent insurance pool by contributing ETH (min 0.01 ETH).\n" +
|
|
113
|
+
"USE WHEN: You want to protect yourself against task failures by joining the shared insurance pool.\n" +
|
|
114
|
+
"REQUIRES: You must be a registered agent. Minimum contribution is 0.01 ETH.\n" +
|
|
115
|
+
"RETURNS: Transaction hash confirming pool membership.\n" +
|
|
116
|
+
"COMES AFTER: corven_register_agent (you must be registered first).\n" +
|
|
117
|
+
"COMES BEFORE: corven_pay_premium (insure specific tasks), corven_claim_insurance (file claims on failures).\n" +
|
|
118
|
+
"NOTE: Your contribution goes into the shared pool. Higher contributions mean more coverage priority.",
|
|
106
119
|
inputSchema: {
|
|
107
|
-
contribution:
|
|
120
|
+
contribution: ethAmount,
|
|
108
121
|
},
|
|
109
122
|
}, async ({ contribution }) => {
|
|
110
123
|
try {
|
|
@@ -116,7 +129,8 @@ export function registerInsuranceTools(server) {
|
|
|
116
129
|
return formatTxResult(result);
|
|
117
130
|
}
|
|
118
131
|
catch (e) {
|
|
119
|
-
|
|
132
|
+
const parsed = parseContractError(e);
|
|
133
|
+
return formatStructuredError(parsed.error, parsed.cause, parsed.fix, parsed.retryable);
|
|
120
134
|
}
|
|
121
135
|
});
|
|
122
136
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -124,10 +138,16 @@ export function registerInsuranceTools(server) {
|
|
|
124
138
|
// ──────────────────────────────────────────────────────────────
|
|
125
139
|
server.registerTool("corven_pay_premium", {
|
|
126
140
|
title: "Pay Insurance Premium",
|
|
127
|
-
description: "Pay insurance premium for a specific task to get coverage. Premium is typically a percentage (e.g., 5%) of the task payment
|
|
141
|
+
description: "Pay insurance premium for a specific task to get coverage. Premium is typically a percentage (e.g., 5%) of the task payment.\n" +
|
|
142
|
+
"USE WHEN: You want to insure a task against failure before starting work.\n" +
|
|
143
|
+
"REQUIRES: You must be a member of the insurance pool (corven_join_insurance_pool). The task must exist.\n" +
|
|
144
|
+
"RETURNS: Transaction hash confirming premium payment and coverage activation.\n" +
|
|
145
|
+
"COMES AFTER: corven_join_insurance_pool (must be a pool member) and corven_create_task (task must exist).\n" +
|
|
146
|
+
"COMES BEFORE: corven_claim_insurance (if the task fails, you can claim coverage).\n" +
|
|
147
|
+
"NOTE: Premium is typically 5% of the task payment. Check corven_get_coverage_percent for the coverage ratio.",
|
|
128
148
|
inputSchema: {
|
|
129
|
-
taskId:
|
|
130
|
-
premium:
|
|
149
|
+
taskId: taskIdSchema,
|
|
150
|
+
premium: ethAmount,
|
|
131
151
|
},
|
|
132
152
|
}, async ({ taskId, premium }) => {
|
|
133
153
|
try {
|
|
@@ -140,7 +160,8 @@ export function registerInsuranceTools(server) {
|
|
|
140
160
|
return formatTxResult(result);
|
|
141
161
|
}
|
|
142
162
|
catch (e) {
|
|
143
|
-
|
|
163
|
+
const parsed = parseContractError(e);
|
|
164
|
+
return formatStructuredError(parsed.error, parsed.cause, parsed.fix, parsed.retryable);
|
|
144
165
|
}
|
|
145
166
|
});
|
|
146
167
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -148,7 +169,13 @@ export function registerInsuranceTools(server) {
|
|
|
148
169
|
// ──────────────────────────────────────────────────────────────
|
|
149
170
|
server.registerTool("corven_vote_on_claim", {
|
|
150
171
|
title: "Vote on Insurance Claim",
|
|
151
|
-
description: "Governance member votes on an insurance claim
|
|
172
|
+
description: "Governance member votes on an insurance claim.\n" +
|
|
173
|
+
"USE WHEN: You are a governance member and an insurance claim needs your approval or rejection.\n" +
|
|
174
|
+
"REQUIRES: You must be a governance-eligible member of the insurance pool.\n" +
|
|
175
|
+
"RETURNS: Transaction hash confirming your vote.\n" +
|
|
176
|
+
"COMES AFTER: corven_claim_insurance filed the claim.\n" +
|
|
177
|
+
"COMES BEFORE: corven_pay_claim (payout after sufficient approvals).\n" +
|
|
178
|
+
"NOTE: Claims need a minimum number of approval votes to be paid out.",
|
|
152
179
|
inputSchema: {
|
|
153
180
|
claimId: z.number().describe("Claim ID"),
|
|
154
181
|
inFavor: z.boolean().describe("True to approve, false to reject"),
|
|
@@ -162,7 +189,8 @@ export function registerInsuranceTools(server) {
|
|
|
162
189
|
return formatTxResult(result);
|
|
163
190
|
}
|
|
164
191
|
catch (e) {
|
|
165
|
-
|
|
192
|
+
const parsed = parseContractError(e);
|
|
193
|
+
return formatStructuredError(parsed.error, parsed.cause, parsed.fix, parsed.retryable);
|
|
166
194
|
}
|
|
167
195
|
});
|
|
168
196
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -170,7 +198,13 @@ export function registerInsuranceTools(server) {
|
|
|
170
198
|
// ──────────────────────────────────────────────────────────────
|
|
171
199
|
server.registerTool("corven_pay_claim", {
|
|
172
200
|
title: "Pay Insurance Claim",
|
|
173
|
-
description: "Pay out an approved insurance claim
|
|
201
|
+
description: "Pay out an approved insurance claim.\n" +
|
|
202
|
+
"USE WHEN: An insurance claim has received enough governance approval votes and is ready for payout.\n" +
|
|
203
|
+
"REQUIRES: The claim must have sufficient approval votes from governance members.\n" +
|
|
204
|
+
"RETURNS: Transaction hash. The claim amount is transferred to the claimant.\n" +
|
|
205
|
+
"COMES AFTER: corven_vote_on_claim resulted in sufficient approvals.\n" +
|
|
206
|
+
"COMES BEFORE: The claimant receives ETH in their wallet.\n" +
|
|
207
|
+
"NOTE: Anyone can trigger the payout once the claim is approved.",
|
|
174
208
|
inputSchema: {
|
|
175
209
|
claimId: z.number().describe("Claim ID"),
|
|
176
210
|
},
|
|
@@ -183,7 +217,8 @@ export function registerInsuranceTools(server) {
|
|
|
183
217
|
return formatTxResult(result);
|
|
184
218
|
}
|
|
185
219
|
catch (e) {
|
|
186
|
-
|
|
220
|
+
const parsed = parseContractError(e);
|
|
221
|
+
return formatStructuredError(parsed.error, parsed.cause, parsed.fix, parsed.retryable);
|
|
187
222
|
}
|
|
188
223
|
});
|
|
189
224
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -191,7 +226,12 @@ export function registerInsuranceTools(server) {
|
|
|
191
226
|
// ──────────────────────────────────────────────────────────────
|
|
192
227
|
server.registerTool("corven_get_pool_balance", {
|
|
193
228
|
title: "Get Insurance Pool Balance",
|
|
194
|
-
description: "Get the current balance of the insurance pool
|
|
229
|
+
description: "Get the current balance of the insurance pool.\n" +
|
|
230
|
+
"USE WHEN: You want to check if the pool has enough funds to cover potential claims.\n" +
|
|
231
|
+
"REQUIRES: None — this is a read-only query.\n" +
|
|
232
|
+
"RETURNS: Pool balance in ETH.\n" +
|
|
233
|
+
"COMES BEFORE: corven_join_insurance_pool or corven_claim_insurance.\n" +
|
|
234
|
+
"NOTE: A low pool balance may mean claims cannot be fully paid out.",
|
|
195
235
|
inputSchema: {},
|
|
196
236
|
}, async () => {
|
|
197
237
|
try {
|
|
@@ -199,7 +239,8 @@ export function registerInsuranceTools(server) {
|
|
|
199
239
|
return formatReadResult({ poolBalanceEth: formatEther(balance) }, "Insurance Pool Balance");
|
|
200
240
|
}
|
|
201
241
|
catch (e) {
|
|
202
|
-
|
|
242
|
+
const parsed = parseContractError(e);
|
|
243
|
+
return formatStructuredError(parsed.error, parsed.cause, parsed.fix, parsed.retryable);
|
|
203
244
|
}
|
|
204
245
|
});
|
|
205
246
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -207,9 +248,14 @@ export function registerInsuranceTools(server) {
|
|
|
207
248
|
// ──────────────────────────────────────────────────────────────
|
|
208
249
|
server.registerTool("corven_get_member_info", {
|
|
209
250
|
title: "Get Insurance Member Info",
|
|
210
|
-
description: "Get insurance membership info for an agent
|
|
251
|
+
description: "Get insurance membership info for an agent.\n" +
|
|
252
|
+
"USE WHEN: You want to check if an agent is a pool member and their contribution level.\n" +
|
|
253
|
+
"REQUIRES: The agent address must be provided.\n" +
|
|
254
|
+
"RETURNS: Membership details including contribution amount, join date, and active status.\n" +
|
|
255
|
+
"COMES BEFORE: corven_pay_premium or corven_claim_insurance (verify membership first).\n" +
|
|
256
|
+
"NOTE: Returns empty/default data if the agent is not a pool member.",
|
|
211
257
|
inputSchema: {
|
|
212
|
-
agent:
|
|
258
|
+
agent: ethAddress,
|
|
213
259
|
},
|
|
214
260
|
}, async ({ agent }) => {
|
|
215
261
|
try {
|
|
@@ -217,7 +263,8 @@ export function registerInsuranceTools(server) {
|
|
|
217
263
|
return formatReadResult(data, `Insurance info for ${agent}`);
|
|
218
264
|
}
|
|
219
265
|
catch (e) {
|
|
220
|
-
|
|
266
|
+
const parsed = parseContractError(e);
|
|
267
|
+
return formatStructuredError(parsed.error, parsed.cause, parsed.fix, parsed.retryable);
|
|
221
268
|
}
|
|
222
269
|
});
|
|
223
270
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insurance.js","sourceRoot":"","sources":["../../src/tools/insurance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAA2B,MAAM,MAAM,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"insurance.js","sourceRoot":"","sources":["../../src/tools/insurance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAA2B,MAAM,MAAM,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,SAA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,2BAA2B;QAClC,WAAW,EACT,+CAA+C;YAC/C,0FAA0F;YAC1F,iDAAiD;YACjD,4FAA4F;YAC5F,yFAAyF;YACzF,qEAAqE;QACvE,WAAW,EAAE;YACX,KAAK,EAAE,UAAU;SAClB;KACF,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAClB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,YAAY,CAC7B,SAAS,CAAC,cAAc,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,KAAgB,CAAC,CACnE,CAAC;YACF,OAAO,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,KAAK,EAAE,CAAC,CAAC;QAC/D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;YACrC,OAAO,qBAAqB,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QACzF,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../src/tools/market.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../src/tools/market.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAkDzE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAya3D"}
|