@blindmarket/sdk 0.1.5 → 0.1.7
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 +242 -29
- package/dist/chain/BlindEscrowClient.js +5 -1
- package/dist/chain/ChainClient.d.ts +1 -1
- package/dist/chain/ChainClient.js +1 -1
- package/dist/crypto/constants.js +1 -1
- package/dist/errors/BlindMarketError.d.ts +14 -0
- package/dist/errors/BlindMarketError.js +30 -0
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/subclasses.d.ts +9 -9
- package/dist/errors/subclasses.js +9 -9
- package/dist/index.d.ts +282 -29
- package/dist/index.js +399 -41
- package/dist/keystore/InMemoryKeyStore.js +2 -2
- package/dist/mcp.d.ts +23 -0
- package/dist/mcp.js +101 -0
- package/dist/signer/EthersSigner.js +1 -1
- package/dist/storage/index.d.ts +0 -1
- package/dist/storage/index.js +1 -1
- package/dist/tools/adapters.d.ts +99 -0
- package/dist/tools/adapters.js +129 -0
- package/dist/tools/helpers.d.ts +9 -0
- package/dist/tools/helpers.js +169 -0
- package/dist/tools/index.d.ts +36 -0
- package/dist/tools/index.js +32 -0
- package/dist/tools/types.d.ts +44 -0
- package/dist/tools/types.js +1 -0
- package/dist/types.d.ts +201 -0
- package/dist/types.js +24 -1
- package/package.json +13 -2
- package/src/chain/BlindEscrowClient.ts +5 -0
- package/src/index.ts +518 -49
- package/src/storage/index.ts +1 -1
- package/src/tools/adapters.ts +177 -0
- package/src/tools/helpers.ts +199 -0
- package/src/tools/index.ts +59 -0
- package/src/tools/types.ts +47 -0
- package/src/types.ts +220 -0
- package/tsconfig.json +2 -1
package/dist/types.d.ts
CHANGED
|
@@ -56,3 +56,204 @@ export interface TxReceiptLike {
|
|
|
56
56
|
gasUsed: bigint;
|
|
57
57
|
}
|
|
58
58
|
export type Awaitable<T> = T | Promise<T>;
|
|
59
|
+
export interface HealthStatus {
|
|
60
|
+
status: string;
|
|
61
|
+
timestamp: string;
|
|
62
|
+
}
|
|
63
|
+
export interface PlatformStats {
|
|
64
|
+
openTasks: number;
|
|
65
|
+
activeAgents: number;
|
|
66
|
+
activeValidators: number;
|
|
67
|
+
totalAgents: number;
|
|
68
|
+
registeredUsers: number;
|
|
69
|
+
completedTasks: number;
|
|
70
|
+
activeWorkers: number;
|
|
71
|
+
}
|
|
72
|
+
export interface OpenTask {
|
|
73
|
+
id: number;
|
|
74
|
+
agent: Address;
|
|
75
|
+
worker?: Address;
|
|
76
|
+
amount: string;
|
|
77
|
+
token: Address;
|
|
78
|
+
category: string;
|
|
79
|
+
locationZone: string;
|
|
80
|
+
deadline: number;
|
|
81
|
+
status: number;
|
|
82
|
+
taskHash?: Hex;
|
|
83
|
+
}
|
|
84
|
+
export interface CreateTaskTx {
|
|
85
|
+
unsignedTx: {
|
|
86
|
+
to: Address;
|
|
87
|
+
data: Hex;
|
|
88
|
+
value?: string;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export interface TaskDetail extends OpenTask {
|
|
92
|
+
metadata?: Record<string, unknown>;
|
|
93
|
+
a2aState?: A2ATaskState;
|
|
94
|
+
}
|
|
95
|
+
export interface A2ATaskState {
|
|
96
|
+
taskId: string;
|
|
97
|
+
status: string;
|
|
98
|
+
executorAddress?: string;
|
|
99
|
+
acceptedAt?: string;
|
|
100
|
+
submittedAt?: string;
|
|
101
|
+
resultData?: Record<string, unknown> | null;
|
|
102
|
+
verificationResult?: {
|
|
103
|
+
passed: boolean;
|
|
104
|
+
reasons: string[];
|
|
105
|
+
score?: number;
|
|
106
|
+
breakdown?: Array<{
|
|
107
|
+
name: string;
|
|
108
|
+
score: number;
|
|
109
|
+
weight: number;
|
|
110
|
+
reason: string;
|
|
111
|
+
error?: string;
|
|
112
|
+
}>;
|
|
113
|
+
};
|
|
114
|
+
assignTxHash?: Hex;
|
|
115
|
+
verifyTxHash?: Hex;
|
|
116
|
+
wrappedKeys?: Record<string, string>;
|
|
117
|
+
}
|
|
118
|
+
export interface ExecutorProfile {
|
|
119
|
+
address: Address;
|
|
120
|
+
displayName: string;
|
|
121
|
+
capabilities: AgentCapability[];
|
|
122
|
+
publicKey: string;
|
|
123
|
+
reputation: number;
|
|
124
|
+
tasksCompleted: number;
|
|
125
|
+
totalEarnedRaw: string;
|
|
126
|
+
minReward?: string;
|
|
127
|
+
preferredCapabilities?: AgentCapability[];
|
|
128
|
+
registeredAt: string;
|
|
129
|
+
decayedScore?: number;
|
|
130
|
+
disputeRatio?: number;
|
|
131
|
+
avgRating?: number;
|
|
132
|
+
}
|
|
133
|
+
export interface RegisterExecutorInput {
|
|
134
|
+
address: Address;
|
|
135
|
+
displayName: string;
|
|
136
|
+
capabilities: AgentCapability[];
|
|
137
|
+
publicKey: string;
|
|
138
|
+
agentCardUrl?: string;
|
|
139
|
+
mcpEndpointUrl?: string;
|
|
140
|
+
minReward?: string;
|
|
141
|
+
preferredCapabilities?: AgentCapability[];
|
|
142
|
+
}
|
|
143
|
+
/** Params for BlindMarket.createAgent() — generates wallet + registers executor in one call. */
|
|
144
|
+
export interface CreateAgentParams {
|
|
145
|
+
/** Display name for the agent in the marketplace. */
|
|
146
|
+
displayName: string;
|
|
147
|
+
/** Capabilities this agent offers. Use AgentCap.DATA_PROCESSING etc. */
|
|
148
|
+
capabilities: AgentCapability[];
|
|
149
|
+
/** Which of the above the agent prefers (subset of capabilities). */
|
|
150
|
+
preferredCapabilities?: AgentCapability[];
|
|
151
|
+
/** Minimum reward per task (wei string). */
|
|
152
|
+
minReward?: string;
|
|
153
|
+
/** Agent card URL for marketplace display. */
|
|
154
|
+
agentCardUrl?: string;
|
|
155
|
+
/** MCP endpoint URL for tool-based agents. */
|
|
156
|
+
mcpEndpointUrl?: string;
|
|
157
|
+
}
|
|
158
|
+
/** Result of BlindMarket.createAgent(). */
|
|
159
|
+
export interface CreateAgentResult {
|
|
160
|
+
executor: ExecutorProfile;
|
|
161
|
+
wallet: {
|
|
162
|
+
address: Address;
|
|
163
|
+
publicKey: string;
|
|
164
|
+
privateKey: string;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export interface DeployedAgentInfo {
|
|
168
|
+
id: string;
|
|
169
|
+
name: string;
|
|
170
|
+
ownerAddress: Address;
|
|
171
|
+
walletAddress: Address;
|
|
172
|
+
publicKey: string;
|
|
173
|
+
status: string;
|
|
174
|
+
provider: string;
|
|
175
|
+
model: string;
|
|
176
|
+
capabilities: AgentCapability[];
|
|
177
|
+
inftTokenId?: number;
|
|
178
|
+
deployedAt: string;
|
|
179
|
+
lastActiveAt?: string;
|
|
180
|
+
minReward?: string;
|
|
181
|
+
}
|
|
182
|
+
export interface AgentWalletInfo {
|
|
183
|
+
walletAddress: Address;
|
|
184
|
+
publicKey: string;
|
|
185
|
+
}
|
|
186
|
+
export interface ReputationInfo {
|
|
187
|
+
address: Address;
|
|
188
|
+
onChainScore: number;
|
|
189
|
+
decayedScore: number;
|
|
190
|
+
totalTasks: number;
|
|
191
|
+
disputesLost: number;
|
|
192
|
+
disputeRatio: number;
|
|
193
|
+
}
|
|
194
|
+
export interface LeaderboardEntry extends ReputationInfo {
|
|
195
|
+
rank: number;
|
|
196
|
+
displayName?: string;
|
|
197
|
+
}
|
|
198
|
+
export interface StorageUploadResult {
|
|
199
|
+
rootHash: RootHash;
|
|
200
|
+
size: number;
|
|
201
|
+
}
|
|
202
|
+
export interface Message {
|
|
203
|
+
id: number;
|
|
204
|
+
taskId: string;
|
|
205
|
+
fromAddress: Address;
|
|
206
|
+
toAddress: Address;
|
|
207
|
+
content: string;
|
|
208
|
+
read: boolean;
|
|
209
|
+
createdAt: string;
|
|
210
|
+
}
|
|
211
|
+
export interface AgentSearchResult {
|
|
212
|
+
address: Address;
|
|
213
|
+
displayName: string;
|
|
214
|
+
capabilities: string[];
|
|
215
|
+
avgRating: number;
|
|
216
|
+
reviewCount: number;
|
|
217
|
+
badgeCount: number;
|
|
218
|
+
reputation: number;
|
|
219
|
+
}
|
|
220
|
+
export interface TaskTemplate {
|
|
221
|
+
id: number;
|
|
222
|
+
title: string;
|
|
223
|
+
description: string;
|
|
224
|
+
category: string;
|
|
225
|
+
instructions: string;
|
|
226
|
+
verificationCriteria: Record<string, unknown>;
|
|
227
|
+
requiredCapabilities?: string[];
|
|
228
|
+
estimatedReward?: string;
|
|
229
|
+
}
|
|
230
|
+
export interface VerifyTaskInput {
|
|
231
|
+
taskId: number;
|
|
232
|
+
taskCategory: string;
|
|
233
|
+
taskRequirements: string;
|
|
234
|
+
evidenceSummary: string;
|
|
235
|
+
}
|
|
236
|
+
/** Dot-notation access to valid capability strings. */
|
|
237
|
+
export declare const AgentCap: {
|
|
238
|
+
readonly DATA_PROCESSING: "data_processing";
|
|
239
|
+
readonly WEB_RESEARCH: "web_research";
|
|
240
|
+
readonly CODE_EXECUTION: "code_execution";
|
|
241
|
+
readonly CONTENT_GENERATION: "content_generation";
|
|
242
|
+
readonly API_INTEGRATION: "api_integration";
|
|
243
|
+
readonly TEXT_ANALYSIS: "text_analysis";
|
|
244
|
+
readonly TRANSLATION: "translation";
|
|
245
|
+
readonly SUMMARIZATION: "summarization";
|
|
246
|
+
readonly IMAGE_ANALYSIS: "image_analysis";
|
|
247
|
+
readonly DOCUMENT_PROCESSING: "document_processing";
|
|
248
|
+
readonly MATH_COMPUTATION: "math_computation";
|
|
249
|
+
readonly DATA_EXTRACTION: "data_extraction";
|
|
250
|
+
readonly REPORT_GENERATION: "report_generation";
|
|
251
|
+
readonly CODE_REVIEW: "code_review";
|
|
252
|
+
readonly TESTING: "testing";
|
|
253
|
+
readonly SCHEDULING: "scheduling";
|
|
254
|
+
readonly EMAIL_DRAFTING: "email_drafting";
|
|
255
|
+
readonly SOCIAL_MEDIA: "social_media";
|
|
256
|
+
readonly MARKET_RESEARCH: "market_research";
|
|
257
|
+
readonly COMPETITIVE_ANALYSIS: "competitive_analysis";
|
|
258
|
+
};
|
|
259
|
+
export type AgentCapability = typeof AgentCap[keyof typeof AgentCap];
|
package/dist/types.js
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
// ── Agent capabilities ───────────────────────────────────────────────────────
|
|
2
|
+
/** Dot-notation access to valid capability strings. */
|
|
3
|
+
export const AgentCap = {
|
|
4
|
+
DATA_PROCESSING: 'data_processing',
|
|
5
|
+
WEB_RESEARCH: 'web_research',
|
|
6
|
+
CODE_EXECUTION: 'code_execution',
|
|
7
|
+
CONTENT_GENERATION: 'content_generation',
|
|
8
|
+
API_INTEGRATION: 'api_integration',
|
|
9
|
+
TEXT_ANALYSIS: 'text_analysis',
|
|
10
|
+
TRANSLATION: 'translation',
|
|
11
|
+
SUMMARIZATION: 'summarization',
|
|
12
|
+
IMAGE_ANALYSIS: 'image_analysis',
|
|
13
|
+
DOCUMENT_PROCESSING: 'document_processing',
|
|
14
|
+
MATH_COMPUTATION: 'math_computation',
|
|
15
|
+
DATA_EXTRACTION: 'data_extraction',
|
|
16
|
+
REPORT_GENERATION: 'report_generation',
|
|
17
|
+
CODE_REVIEW: 'code_review',
|
|
18
|
+
TESTING: 'testing',
|
|
19
|
+
SCHEDULING: 'scheduling',
|
|
20
|
+
EMAIL_DRAFTING: 'email_drafting',
|
|
21
|
+
SOCIAL_MEDIA: 'social_media',
|
|
22
|
+
MARKET_RESEARCH: 'market_research',
|
|
23
|
+
COMPETITIVE_ANALYSIS: 'competitive_analysis',
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blindmarket/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "BlindMarket SDK — deploy agents, assign workers, verify evidence",
|
|
5
5
|
"author": "BlindMarket Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,14 @@
|
|
|
21
21
|
"bounty",
|
|
22
22
|
"blockchain",
|
|
23
23
|
"encrypted",
|
|
24
|
-
"agent-to-human"
|
|
24
|
+
"agent-to-human",
|
|
25
|
+
"mcp",
|
|
26
|
+
"model-context-protocol",
|
|
27
|
+
"openai-tools",
|
|
28
|
+
"agent-sdk",
|
|
29
|
+
"claude",
|
|
30
|
+
"langchain",
|
|
31
|
+
"vercel-ai-sdk"
|
|
25
32
|
],
|
|
26
33
|
"type": "module",
|
|
27
34
|
"main": "./dist/index.js",
|
|
@@ -30,6 +37,10 @@
|
|
|
30
37
|
".": {
|
|
31
38
|
"import": "./dist/index.js",
|
|
32
39
|
"types": "./dist/index.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./tools": {
|
|
42
|
+
"import": "./dist/tools/index.js",
|
|
43
|
+
"types": "./dist/tools/index.d.ts"
|
|
33
44
|
}
|
|
34
45
|
},
|
|
35
46
|
"scripts": {
|
|
@@ -45,6 +45,10 @@ export class BlindEscrowClient {
|
|
|
45
45
|
/** Create a task and return its id + receipt. Reads the TaskCreated event for the id. */
|
|
46
46
|
async createTask(args: CreateTaskArgs): Promise<{ taskId: TaskId; receipt: TxReceiptLike }> {
|
|
47
47
|
try {
|
|
48
|
+
const overrides: ethers.Overrides = {};
|
|
49
|
+
if (args.token === '0x0000000000000000000000000000000000000000') {
|
|
50
|
+
overrides.value = args.amount;
|
|
51
|
+
}
|
|
48
52
|
const tx = await this.contract.createTask!(
|
|
49
53
|
args.taskHash,
|
|
50
54
|
args.token,
|
|
@@ -52,6 +56,7 @@ export class BlindEscrowClient {
|
|
|
52
56
|
args.category,
|
|
53
57
|
args.locationZone,
|
|
54
58
|
args.deadline,
|
|
59
|
+
overrides,
|
|
55
60
|
);
|
|
56
61
|
const rec = await tx.wait(1);
|
|
57
62
|
const taskId = this.extractTaskIdFromReceipt(rec);
|