@zakyirsyaad/monagent-plugin 0.1.0 → 0.1.3
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/dist/commands/monad/identity/get.d.ts +19 -0
- package/dist/commands/monad/identity/get.js +113 -0
- package/dist/commands/monad/identity/register.d.ts +16 -0
- package/dist/commands/monad/identity/register.js +122 -0
- package/dist/commands/monad/jobs/complete.d.ts +15 -0
- package/dist/commands/monad/jobs/complete.js +63 -0
- package/dist/commands/{jobs → monad/jobs}/create.d.ts +5 -2
- package/dist/commands/monad/jobs/create.js +88 -0
- package/dist/commands/monad/jobs/refund.d.ts +14 -0
- package/dist/commands/monad/jobs/refund.js +56 -0
- package/dist/commands/{pay.d.ts → monad/pay.d.ts} +5 -2
- package/dist/commands/monad/pay.js +123 -0
- package/dist/commands/monad/reputation/check.d.ts +18 -0
- package/dist/commands/monad/reputation/check.js +103 -0
- package/dist/commands/monad/reputation/give.d.ts +15 -0
- package/dist/commands/monad/reputation/give.js +99 -0
- package/dist/commands/monad/x402/pay.d.ts +21 -0
- package/dist/commands/monad/x402/pay.js +224 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.js +10 -7
- package/dist/monad.d.ts +424 -0
- package/dist/monad.js +186 -0
- package/dist/sdk.d.ts +62 -39
- package/dist/sdk.js +95 -8
- package/oclif.manifest.json +1304 -24
- package/package.json +47 -11
- package/dist/commands/identity/get.d.ts +0 -13
- package/dist/commands/identity/get.js +0 -59
- package/dist/commands/identity/register.d.ts +0 -12
- package/dist/commands/identity/register.js +0 -39
- package/dist/commands/jobs/create.js +0 -38
- package/dist/commands/pay.js +0 -33
- package/dist/commands/reputation/check.d.ts +0 -12
- package/dist/commands/reputation/check.js +0 -46
- package/dist/commands/reputation/give.d.ts +0 -12
- package/dist/commands/reputation/give.js +0 -45
- package/dist/commands/x402/pay.d.ts +0 -13
- package/dist/commands/x402/pay.js +0 -67
- package/dist/commands.test.d.ts +0 -1
- package/dist/commands.test.js +0 -141
package/dist/monad.d.ts
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Verified Monad Testnet & Mainnet specifications.
|
|
4
|
+
* Pinned for Monad Metropolis Hackathon.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MONAD_MAINNET_CHAIN_ID: 143;
|
|
7
|
+
export declare const MONAD_TESTNET_CHAIN_ID: 10143;
|
|
8
|
+
export declare const MONAD_MAINNET_CAIP2: "eip155:143";
|
|
9
|
+
export declare const MONAD_TESTNET_CAIP2: "eip155:10143";
|
|
10
|
+
export declare const MONAD_TESTNET_RPC_URL: "https://testnet-rpc.monad.xyz/";
|
|
11
|
+
export declare const MONAD_MAINNET_RPC_URL: "https://rpc.monad.xyz/";
|
|
12
|
+
export declare const MONAD_TESTNET_EXPLORER_URL: "https://testnet.monadexplorer.com";
|
|
13
|
+
export declare const MONAD_MAINNET_EXPLORER_URL: "https://monadexplorer.com";
|
|
14
|
+
export declare const MONAD_TESTNET_MONADSCAN_URL: "https://testnet.monadscan.com";
|
|
15
|
+
export declare const MONAD_TESTNET_MONADVISION_URL: "https://monadvision.com";
|
|
16
|
+
/**
|
|
17
|
+
* Official Canonical ERC-8004 Registries on Monad Testnet (10143) and Mainnet (143)
|
|
18
|
+
*/
|
|
19
|
+
export declare const MONAD_TESTNET_ERC8004_IDENTITY_REGISTRY: "0x8004A818BFB912233c491871b3d84c89A494BD9e";
|
|
20
|
+
export declare const MONAD_TESTNET_ERC8004_REPUTATION_REGISTRY: "0x8004B663056A597Dffe9eCcC1965A193B7388713";
|
|
21
|
+
export declare const MONAD_MAINNET_ERC8004_IDENTITY_REGISTRY: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
|
|
22
|
+
export declare const MONAD_MAINNET_ERC8004_REPUTATION_REGISTRY: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
|
|
23
|
+
/**
|
|
24
|
+
* Canonical USDC addresses (6 decimals, EIP-712 version "2")
|
|
25
|
+
*/
|
|
26
|
+
export declare const MONAD_TESTNET_USDC: "0x534b2f3A21130d7a60830c2Df862319e593943A3";
|
|
27
|
+
export declare const MONAD_MAINNET_USDC: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603";
|
|
28
|
+
export declare const MONAD_X402_FACILITATOR_URL: "https://x402-facilitator.molandak.org";
|
|
29
|
+
/**
|
|
30
|
+
* Deployed MonadA2AEscrow on Monad Testnet (Chain ID 10143)
|
|
31
|
+
*/
|
|
32
|
+
export declare const MONAD_DEPLOYED_A2A_ESCROW: "0x8dcab9ddf394eb29cb891b264627bf60ea6af6ff";
|
|
33
|
+
export declare const MONAD_DEPLOYED_AGENT_REGISTRY: "0x91f80eb44d9082d8881b116696cd8840680e3a1c";
|
|
34
|
+
export interface MonadChainConfig {
|
|
35
|
+
chainId: 10143 | 143;
|
|
36
|
+
name: string;
|
|
37
|
+
identityRegistry: `0x${string}`;
|
|
38
|
+
reputationRegistry: `0x${string}`;
|
|
39
|
+
usdc: `0x${string}`;
|
|
40
|
+
escrow?: `0x${string}`;
|
|
41
|
+
rpcUrl: string;
|
|
42
|
+
explorerUrl: string;
|
|
43
|
+
caip2: `eip155:10143` | `eip155:143`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Single per-chain table for Monad Testnet (10143) and Monad Mainnet (143)
|
|
47
|
+
*/
|
|
48
|
+
export declare const MONAD_CHAINS: Record<10143 | 143, MonadChainConfig>;
|
|
49
|
+
/**
|
|
50
|
+
* Resolves a chain input (number | string | undefined), defaulting safely to 10143.
|
|
51
|
+
* Throws CommandError("UNSUPPORTED_CHAIN", ...) for any other chain.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveChain(input?: number | string): MonadChainConfig;
|
|
54
|
+
export declare function getErc8004IdentityRegistry(chainId: number): `0x${string}`;
|
|
55
|
+
export declare function getErc8004ReputationRegistry(chainId: number): `0x${string}`;
|
|
56
|
+
export declare const MONAD_NETWORK: Readonly<{
|
|
57
|
+
chainId: 10143;
|
|
58
|
+
caip2: "eip155:10143";
|
|
59
|
+
name: "Monad Testnet";
|
|
60
|
+
nativeCurrency: {
|
|
61
|
+
name: string;
|
|
62
|
+
symbol: string;
|
|
63
|
+
decimals: number;
|
|
64
|
+
};
|
|
65
|
+
rpcUrl: "https://testnet-rpc.monad.xyz/";
|
|
66
|
+
explorerUrl: "https://testnet.monadexplorer.com";
|
|
67
|
+
explorers: {
|
|
68
|
+
monadExplorer: "https://testnet.monadexplorer.com";
|
|
69
|
+
monadScan: "https://testnet.monadscan.com";
|
|
70
|
+
monadVision: "https://monadvision.com";
|
|
71
|
+
};
|
|
72
|
+
tokens: {
|
|
73
|
+
USDC: "0x534b2f3A21130d7a60830c2Df862319e593943A3";
|
|
74
|
+
};
|
|
75
|
+
x402: {
|
|
76
|
+
facilitatorUrl: "https://x402-facilitator.molandak.org";
|
|
77
|
+
defaultNetwork: "eip155:10143";
|
|
78
|
+
};
|
|
79
|
+
erc8004: {
|
|
80
|
+
identityRegistry: "0x8004A818BFB912233c491871b3d84c89A494BD9e";
|
|
81
|
+
reputationRegistry: "0x8004B663056A597Dffe9eCcC1965A193B7388713";
|
|
82
|
+
agentRegistry: string;
|
|
83
|
+
};
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Official ERC-8004 Identity Registry ABI
|
|
87
|
+
*/
|
|
88
|
+
export declare const erc8004IdentityAbi: readonly [{
|
|
89
|
+
readonly name: "register";
|
|
90
|
+
readonly type: "function";
|
|
91
|
+
readonly stateMutability: "nonpayable";
|
|
92
|
+
readonly inputs: readonly [{
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
readonly name: "agentURI";
|
|
95
|
+
}];
|
|
96
|
+
readonly outputs: readonly [{
|
|
97
|
+
readonly type: "uint256";
|
|
98
|
+
readonly name: "agentId";
|
|
99
|
+
}];
|
|
100
|
+
}, {
|
|
101
|
+
readonly name: "ownerOf";
|
|
102
|
+
readonly type: "function";
|
|
103
|
+
readonly stateMutability: "view";
|
|
104
|
+
readonly inputs: readonly [{
|
|
105
|
+
readonly type: "uint256";
|
|
106
|
+
readonly name: "tokenId";
|
|
107
|
+
}];
|
|
108
|
+
readonly outputs: readonly [{
|
|
109
|
+
readonly type: "address";
|
|
110
|
+
}];
|
|
111
|
+
}, {
|
|
112
|
+
readonly name: "tokenURI";
|
|
113
|
+
readonly type: "function";
|
|
114
|
+
readonly stateMutability: "view";
|
|
115
|
+
readonly inputs: readonly [{
|
|
116
|
+
readonly type: "uint256";
|
|
117
|
+
readonly name: "tokenId";
|
|
118
|
+
}];
|
|
119
|
+
readonly outputs: readonly [{
|
|
120
|
+
readonly type: "string";
|
|
121
|
+
}];
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "getAgentWallet";
|
|
124
|
+
readonly type: "function";
|
|
125
|
+
readonly stateMutability: "view";
|
|
126
|
+
readonly inputs: readonly [{
|
|
127
|
+
readonly type: "uint256";
|
|
128
|
+
readonly name: "agentId";
|
|
129
|
+
}];
|
|
130
|
+
readonly outputs: readonly [{
|
|
131
|
+
readonly type: "address";
|
|
132
|
+
}];
|
|
133
|
+
}, {
|
|
134
|
+
readonly name: "Registered";
|
|
135
|
+
readonly type: "event";
|
|
136
|
+
readonly inputs: readonly [{
|
|
137
|
+
readonly type: "uint256";
|
|
138
|
+
readonly name: "agentId";
|
|
139
|
+
readonly indexed: true;
|
|
140
|
+
}, {
|
|
141
|
+
readonly type: "string";
|
|
142
|
+
readonly name: "agentURI";
|
|
143
|
+
}, {
|
|
144
|
+
readonly type: "address";
|
|
145
|
+
readonly name: "owner";
|
|
146
|
+
readonly indexed: true;
|
|
147
|
+
}];
|
|
148
|
+
}];
|
|
149
|
+
/**
|
|
150
|
+
* Official ERC-8004 Reputation Registry ABI
|
|
151
|
+
*/
|
|
152
|
+
export declare const erc8004ReputationAbi: readonly [{
|
|
153
|
+
readonly name: "giveFeedback";
|
|
154
|
+
readonly type: "function";
|
|
155
|
+
readonly stateMutability: "nonpayable";
|
|
156
|
+
readonly inputs: readonly [{
|
|
157
|
+
readonly type: "uint256";
|
|
158
|
+
readonly name: "agentId";
|
|
159
|
+
}, {
|
|
160
|
+
readonly type: "int128";
|
|
161
|
+
readonly name: "value";
|
|
162
|
+
}, {
|
|
163
|
+
readonly type: "uint8";
|
|
164
|
+
readonly name: "valueDecimals";
|
|
165
|
+
}, {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
readonly name: "tag1";
|
|
168
|
+
}, {
|
|
169
|
+
readonly type: "string";
|
|
170
|
+
readonly name: "tag2";
|
|
171
|
+
}, {
|
|
172
|
+
readonly type: "string";
|
|
173
|
+
readonly name: "endpoint";
|
|
174
|
+
}, {
|
|
175
|
+
readonly type: "string";
|
|
176
|
+
readonly name: "feedbackURI";
|
|
177
|
+
}, {
|
|
178
|
+
readonly type: "bytes32";
|
|
179
|
+
readonly name: "feedbackHash";
|
|
180
|
+
}];
|
|
181
|
+
readonly outputs: readonly [];
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "getSummary";
|
|
184
|
+
readonly type: "function";
|
|
185
|
+
readonly stateMutability: "view";
|
|
186
|
+
readonly inputs: readonly [{
|
|
187
|
+
readonly type: "uint256";
|
|
188
|
+
readonly name: "agentId";
|
|
189
|
+
}, {
|
|
190
|
+
readonly type: "address[]";
|
|
191
|
+
readonly name: "clientAddresses";
|
|
192
|
+
}, {
|
|
193
|
+
readonly type: "string";
|
|
194
|
+
readonly name: "tag1";
|
|
195
|
+
}, {
|
|
196
|
+
readonly type: "string";
|
|
197
|
+
readonly name: "tag2";
|
|
198
|
+
}];
|
|
199
|
+
readonly outputs: readonly [{
|
|
200
|
+
readonly type: "uint64";
|
|
201
|
+
readonly name: "count";
|
|
202
|
+
}, {
|
|
203
|
+
readonly type: "int128";
|
|
204
|
+
readonly name: "summaryValue";
|
|
205
|
+
}, {
|
|
206
|
+
readonly type: "uint8";
|
|
207
|
+
readonly name: "summaryValueDecimals";
|
|
208
|
+
}];
|
|
209
|
+
}, {
|
|
210
|
+
readonly name: "getClients";
|
|
211
|
+
readonly type: "function";
|
|
212
|
+
readonly stateMutability: "view";
|
|
213
|
+
readonly inputs: readonly [{
|
|
214
|
+
readonly type: "uint256";
|
|
215
|
+
readonly name: "agentId";
|
|
216
|
+
}];
|
|
217
|
+
readonly outputs: readonly [{
|
|
218
|
+
readonly type: "address[]";
|
|
219
|
+
}];
|
|
220
|
+
}, {
|
|
221
|
+
readonly name: "NewFeedback";
|
|
222
|
+
readonly type: "event";
|
|
223
|
+
readonly inputs: readonly [{
|
|
224
|
+
readonly type: "uint256";
|
|
225
|
+
readonly name: "agentId";
|
|
226
|
+
readonly indexed: true;
|
|
227
|
+
}, {
|
|
228
|
+
readonly type: "address";
|
|
229
|
+
readonly name: "clientAddress";
|
|
230
|
+
readonly indexed: true;
|
|
231
|
+
}, {
|
|
232
|
+
readonly type: "uint64";
|
|
233
|
+
readonly name: "feedbackIndex";
|
|
234
|
+
}, {
|
|
235
|
+
readonly type: "int128";
|
|
236
|
+
readonly name: "value";
|
|
237
|
+
}, {
|
|
238
|
+
readonly type: "uint8";
|
|
239
|
+
readonly name: "valueDecimals";
|
|
240
|
+
}, {
|
|
241
|
+
readonly type: "string";
|
|
242
|
+
readonly name: "indexedTag1";
|
|
243
|
+
readonly indexed: true;
|
|
244
|
+
}, {
|
|
245
|
+
readonly type: "string";
|
|
246
|
+
readonly name: "tag1";
|
|
247
|
+
}, {
|
|
248
|
+
readonly type: "string";
|
|
249
|
+
readonly name: "tag2";
|
|
250
|
+
}, {
|
|
251
|
+
readonly type: "string";
|
|
252
|
+
readonly name: "endpoint";
|
|
253
|
+
}, {
|
|
254
|
+
readonly type: "string";
|
|
255
|
+
readonly name: "feedbackURI";
|
|
256
|
+
}, {
|
|
257
|
+
readonly type: "bytes32";
|
|
258
|
+
readonly name: "feedbackHash";
|
|
259
|
+
}];
|
|
260
|
+
}];
|
|
261
|
+
/**
|
|
262
|
+
* Monad A2A Escrow ABI
|
|
263
|
+
*/
|
|
264
|
+
export declare const monadEscrowAbi: readonly [{
|
|
265
|
+
readonly name: "createAndFundJob";
|
|
266
|
+
readonly type: "function";
|
|
267
|
+
readonly stateMutability: "payable";
|
|
268
|
+
readonly inputs: readonly [{
|
|
269
|
+
readonly type: "address";
|
|
270
|
+
readonly name: "worker";
|
|
271
|
+
}, {
|
|
272
|
+
readonly type: "string";
|
|
273
|
+
readonly name: "taskDescription";
|
|
274
|
+
}, {
|
|
275
|
+
readonly type: "uint256";
|
|
276
|
+
readonly name: "durationHours";
|
|
277
|
+
}];
|
|
278
|
+
readonly outputs: readonly [{
|
|
279
|
+
readonly type: "uint256";
|
|
280
|
+
readonly name: "jobId";
|
|
281
|
+
}];
|
|
282
|
+
}, {
|
|
283
|
+
readonly name: "completeJob";
|
|
284
|
+
readonly type: "function";
|
|
285
|
+
readonly stateMutability: "nonpayable";
|
|
286
|
+
readonly inputs: readonly [{
|
|
287
|
+
readonly type: "uint256";
|
|
288
|
+
readonly name: "jobId";
|
|
289
|
+
}, {
|
|
290
|
+
readonly type: "string";
|
|
291
|
+
readonly name: "resultURI";
|
|
292
|
+
}];
|
|
293
|
+
readonly outputs: readonly [];
|
|
294
|
+
}, {
|
|
295
|
+
readonly name: "refundExpiredJob";
|
|
296
|
+
readonly type: "function";
|
|
297
|
+
readonly stateMutability: "nonpayable";
|
|
298
|
+
readonly inputs: readonly [{
|
|
299
|
+
readonly type: "uint256";
|
|
300
|
+
readonly name: "jobId";
|
|
301
|
+
}];
|
|
302
|
+
readonly outputs: readonly [];
|
|
303
|
+
}, {
|
|
304
|
+
readonly name: "getJob";
|
|
305
|
+
readonly type: "function";
|
|
306
|
+
readonly stateMutability: "view";
|
|
307
|
+
readonly inputs: readonly [{
|
|
308
|
+
readonly type: "uint256";
|
|
309
|
+
readonly name: "jobId";
|
|
310
|
+
}];
|
|
311
|
+
readonly outputs: readonly [{
|
|
312
|
+
readonly type: "tuple";
|
|
313
|
+
readonly components: readonly [{
|
|
314
|
+
readonly type: "address";
|
|
315
|
+
readonly name: "client";
|
|
316
|
+
}, {
|
|
317
|
+
readonly type: "address";
|
|
318
|
+
readonly name: "worker";
|
|
319
|
+
}, {
|
|
320
|
+
readonly type: "uint256";
|
|
321
|
+
readonly name: "bounty";
|
|
322
|
+
}, {
|
|
323
|
+
readonly type: "uint256";
|
|
324
|
+
readonly name: "deadline";
|
|
325
|
+
}, {
|
|
326
|
+
readonly type: "uint8";
|
|
327
|
+
readonly name: "status";
|
|
328
|
+
}, {
|
|
329
|
+
readonly type: "string";
|
|
330
|
+
readonly name: "taskDescription";
|
|
331
|
+
}, {
|
|
332
|
+
readonly type: "string";
|
|
333
|
+
readonly name: "resultURI";
|
|
334
|
+
}];
|
|
335
|
+
}];
|
|
336
|
+
}, {
|
|
337
|
+
readonly name: "JobCreated";
|
|
338
|
+
readonly type: "event";
|
|
339
|
+
readonly inputs: readonly [{
|
|
340
|
+
readonly type: "uint256";
|
|
341
|
+
readonly name: "jobId";
|
|
342
|
+
readonly indexed: true;
|
|
343
|
+
}, {
|
|
344
|
+
readonly type: "address";
|
|
345
|
+
readonly name: "client";
|
|
346
|
+
readonly indexed: true;
|
|
347
|
+
}, {
|
|
348
|
+
readonly type: "address";
|
|
349
|
+
readonly name: "worker";
|
|
350
|
+
readonly indexed: true;
|
|
351
|
+
}, {
|
|
352
|
+
readonly type: "uint256";
|
|
353
|
+
readonly name: "bounty";
|
|
354
|
+
}];
|
|
355
|
+
}, {
|
|
356
|
+
readonly name: "JobCompleted";
|
|
357
|
+
readonly type: "event";
|
|
358
|
+
readonly inputs: readonly [{
|
|
359
|
+
readonly type: "uint256";
|
|
360
|
+
readonly name: "jobId";
|
|
361
|
+
readonly indexed: true;
|
|
362
|
+
}, {
|
|
363
|
+
readonly type: "string";
|
|
364
|
+
readonly name: "resultURI";
|
|
365
|
+
}];
|
|
366
|
+
}, {
|
|
367
|
+
readonly name: "JobRefunded";
|
|
368
|
+
readonly type: "event";
|
|
369
|
+
readonly inputs: readonly [{
|
|
370
|
+
readonly type: "uint256";
|
|
371
|
+
readonly name: "jobId";
|
|
372
|
+
readonly indexed: true;
|
|
373
|
+
}];
|
|
374
|
+
}];
|
|
375
|
+
/**
|
|
376
|
+
* Schemas for inputs
|
|
377
|
+
*/
|
|
378
|
+
export declare const monadPaymentInputSchema: z.ZodObject<{
|
|
379
|
+
to: z.ZodString;
|
|
380
|
+
amount: z.ZodString;
|
|
381
|
+
token: z.ZodDefault<z.ZodString>;
|
|
382
|
+
memo: z.ZodOptional<z.ZodString>;
|
|
383
|
+
chainId: z.ZodOptional<z.ZodString>;
|
|
384
|
+
}, z.core.$strip>;
|
|
385
|
+
export type MonadPaymentInput = z.infer<typeof monadPaymentInputSchema>;
|
|
386
|
+
export declare const monadAgentCardSchema: z.ZodObject<{
|
|
387
|
+
name: z.ZodString;
|
|
388
|
+
description: z.ZodString;
|
|
389
|
+
endpoints: z.ZodArray<z.ZodString>;
|
|
390
|
+
walletAddress: z.ZodString;
|
|
391
|
+
supportedProtocols: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
392
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
393
|
+
}, z.core.$strip>;
|
|
394
|
+
export type MonadAgentCard = z.infer<typeof monadAgentCardSchema>;
|
|
395
|
+
export declare const monadReputationFeedbackSchema: z.ZodObject<{
|
|
396
|
+
agentId: z.ZodString;
|
|
397
|
+
value: z.ZodCoercedNumber<unknown>;
|
|
398
|
+
decimals: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
399
|
+
tag1: z.ZodDefault<z.ZodString>;
|
|
400
|
+
tag2: z.ZodDefault<z.ZodString>;
|
|
401
|
+
endpoint: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>>;
|
|
402
|
+
feedbackURI: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>>;
|
|
403
|
+
chainId: z.ZodOptional<z.ZodString>;
|
|
404
|
+
}, z.core.$strip>;
|
|
405
|
+
export type MonadReputationFeedback = z.infer<typeof monadReputationFeedbackSchema>;
|
|
406
|
+
export declare const monadCreateJobSchema: z.ZodObject<{
|
|
407
|
+
workerAddress: z.ZodString;
|
|
408
|
+
bountyMon: z.ZodString;
|
|
409
|
+
taskDescription: z.ZodString;
|
|
410
|
+
deadlineHours: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
411
|
+
chainId: z.ZodOptional<z.ZodString>;
|
|
412
|
+
}, z.core.$strip>;
|
|
413
|
+
export type MonadCreateJob = z.infer<typeof monadCreateJobSchema>;
|
|
414
|
+
export declare const monadCompleteJobSchema: z.ZodObject<{
|
|
415
|
+
jobId: z.ZodString;
|
|
416
|
+
resultURI: z.ZodDefault<z.ZodString>;
|
|
417
|
+
chainId: z.ZodOptional<z.ZodString>;
|
|
418
|
+
}, z.core.$strip>;
|
|
419
|
+
export type MonadCompleteJob = z.infer<typeof monadCompleteJobSchema>;
|
|
420
|
+
export declare const monadRefundJobSchema: z.ZodObject<{
|
|
421
|
+
jobId: z.ZodString;
|
|
422
|
+
chainId: z.ZodOptional<z.ZodString>;
|
|
423
|
+
}, z.core.$strip>;
|
|
424
|
+
export type MonadRefundJob = z.infer<typeof monadRefundJobSchema>;
|
package/dist/monad.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { parseAbi } from "viem";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { CommandError } from "@metamask/agent-wallet/plugin";
|
|
4
|
+
/**
|
|
5
|
+
* Verified Monad Testnet & Mainnet specifications.
|
|
6
|
+
* Pinned for Monad Metropolis Hackathon.
|
|
7
|
+
*/
|
|
8
|
+
export const MONAD_MAINNET_CHAIN_ID = 143;
|
|
9
|
+
export const MONAD_TESTNET_CHAIN_ID = 10143;
|
|
10
|
+
export const MONAD_MAINNET_CAIP2 = `eip155:${MONAD_MAINNET_CHAIN_ID}`;
|
|
11
|
+
export const MONAD_TESTNET_CAIP2 = `eip155:${MONAD_TESTNET_CHAIN_ID}`;
|
|
12
|
+
export const MONAD_TESTNET_RPC_URL = "https://testnet-rpc.monad.xyz/";
|
|
13
|
+
export const MONAD_MAINNET_RPC_URL = "https://rpc.monad.xyz/";
|
|
14
|
+
export const MONAD_TESTNET_EXPLORER_URL = "https://testnet.monadexplorer.com";
|
|
15
|
+
export const MONAD_MAINNET_EXPLORER_URL = "https://monadexplorer.com";
|
|
16
|
+
export const MONAD_TESTNET_MONADSCAN_URL = "https://testnet.monadscan.com";
|
|
17
|
+
export const MONAD_TESTNET_MONADVISION_URL = "https://monadvision.com";
|
|
18
|
+
/**
|
|
19
|
+
* Official Canonical ERC-8004 Registries on Monad Testnet (10143) and Mainnet (143)
|
|
20
|
+
*/
|
|
21
|
+
export const MONAD_TESTNET_ERC8004_IDENTITY_REGISTRY = "0x8004A818BFB912233c491871b3d84c89A494BD9e";
|
|
22
|
+
export const MONAD_TESTNET_ERC8004_REPUTATION_REGISTRY = "0x8004B663056A597Dffe9eCcC1965A193B7388713";
|
|
23
|
+
export const MONAD_MAINNET_ERC8004_IDENTITY_REGISTRY = "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
|
|
24
|
+
export const MONAD_MAINNET_ERC8004_REPUTATION_REGISTRY = "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63";
|
|
25
|
+
/**
|
|
26
|
+
* Canonical USDC addresses (6 decimals, EIP-712 version "2")
|
|
27
|
+
*/
|
|
28
|
+
export const MONAD_TESTNET_USDC = "0x534b2f3A21130d7a60830c2Df862319e593943A3";
|
|
29
|
+
export const MONAD_MAINNET_USDC = "0x754704Bc059F8C67012fEd69BC8A327a5aafb603";
|
|
30
|
+
export const MONAD_X402_FACILITATOR_URL = "https://x402-facilitator.molandak.org";
|
|
31
|
+
/**
|
|
32
|
+
* Deployed MonadA2AEscrow on Monad Testnet (Chain ID 10143)
|
|
33
|
+
*/
|
|
34
|
+
export const MONAD_DEPLOYED_A2A_ESCROW = "0x8dcab9ddf394eb29cb891b264627bf60ea6af6ff";
|
|
35
|
+
export const MONAD_DEPLOYED_AGENT_REGISTRY = "0x91f80eb44d9082d8881b116696cd8840680e3a1c";
|
|
36
|
+
/**
|
|
37
|
+
* Single per-chain table for Monad Testnet (10143) and Monad Mainnet (143)
|
|
38
|
+
*/
|
|
39
|
+
export const MONAD_CHAINS = {
|
|
40
|
+
10143: {
|
|
41
|
+
chainId: 10143,
|
|
42
|
+
name: "Monad Testnet",
|
|
43
|
+
identityRegistry: MONAD_TESTNET_ERC8004_IDENTITY_REGISTRY,
|
|
44
|
+
reputationRegistry: MONAD_TESTNET_ERC8004_REPUTATION_REGISTRY,
|
|
45
|
+
usdc: MONAD_TESTNET_USDC,
|
|
46
|
+
escrow: MONAD_DEPLOYED_A2A_ESCROW,
|
|
47
|
+
rpcUrl: MONAD_TESTNET_RPC_URL,
|
|
48
|
+
explorerUrl: MONAD_TESTNET_EXPLORER_URL,
|
|
49
|
+
caip2: MONAD_TESTNET_CAIP2,
|
|
50
|
+
},
|
|
51
|
+
143: {
|
|
52
|
+
chainId: 143,
|
|
53
|
+
name: "Monad Mainnet",
|
|
54
|
+
identityRegistry: MONAD_MAINNET_ERC8004_IDENTITY_REGISTRY,
|
|
55
|
+
reputationRegistry: MONAD_MAINNET_ERC8004_REPUTATION_REGISTRY,
|
|
56
|
+
usdc: MONAD_MAINNET_USDC,
|
|
57
|
+
escrow: undefined,
|
|
58
|
+
rpcUrl: MONAD_MAINNET_RPC_URL,
|
|
59
|
+
explorerUrl: MONAD_MAINNET_EXPLORER_URL,
|
|
60
|
+
caip2: MONAD_MAINNET_CAIP2,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Resolves a chain input (number | string | undefined), defaulting safely to 10143.
|
|
65
|
+
* Throws CommandError("UNSUPPORTED_CHAIN", ...) for any other chain.
|
|
66
|
+
*/
|
|
67
|
+
export function resolveChain(input) {
|
|
68
|
+
if (input === undefined || input === null || input === "") {
|
|
69
|
+
return MONAD_CHAINS[10143];
|
|
70
|
+
}
|
|
71
|
+
const parsed = Number(input);
|
|
72
|
+
if (parsed === 10143 || parsed === 143) {
|
|
73
|
+
return MONAD_CHAINS[parsed];
|
|
74
|
+
}
|
|
75
|
+
throw new CommandError("UNSUPPORTED_CHAIN", `Chain ID "${input}" is not supported. MonAgent supports Monad Testnet (10143) and Monad Mainnet (143).`, "Specify --chain-id 10143 or --chain-id 143.");
|
|
76
|
+
}
|
|
77
|
+
export function getErc8004IdentityRegistry(chainId) {
|
|
78
|
+
return resolveChain(chainId).identityRegistry;
|
|
79
|
+
}
|
|
80
|
+
export function getErc8004ReputationRegistry(chainId) {
|
|
81
|
+
return resolveChain(chainId).reputationRegistry;
|
|
82
|
+
}
|
|
83
|
+
export const MONAD_NETWORK = Object.freeze({
|
|
84
|
+
chainId: MONAD_TESTNET_CHAIN_ID,
|
|
85
|
+
caip2: MONAD_TESTNET_CAIP2,
|
|
86
|
+
name: "Monad Testnet",
|
|
87
|
+
nativeCurrency: {
|
|
88
|
+
name: "Monad",
|
|
89
|
+
symbol: "MON",
|
|
90
|
+
decimals: 18,
|
|
91
|
+
},
|
|
92
|
+
rpcUrl: MONAD_TESTNET_RPC_URL,
|
|
93
|
+
explorerUrl: MONAD_TESTNET_EXPLORER_URL,
|
|
94
|
+
explorers: {
|
|
95
|
+
monadExplorer: MONAD_TESTNET_EXPLORER_URL,
|
|
96
|
+
monadScan: MONAD_TESTNET_MONADSCAN_URL,
|
|
97
|
+
monadVision: MONAD_TESTNET_MONADVISION_URL,
|
|
98
|
+
},
|
|
99
|
+
tokens: {
|
|
100
|
+
USDC: MONAD_TESTNET_USDC,
|
|
101
|
+
},
|
|
102
|
+
x402: {
|
|
103
|
+
facilitatorUrl: MONAD_X402_FACILITATOR_URL,
|
|
104
|
+
defaultNetwork: MONAD_TESTNET_CAIP2,
|
|
105
|
+
},
|
|
106
|
+
erc8004: {
|
|
107
|
+
identityRegistry: MONAD_TESTNET_ERC8004_IDENTITY_REGISTRY,
|
|
108
|
+
reputationRegistry: MONAD_TESTNET_ERC8004_REPUTATION_REGISTRY,
|
|
109
|
+
agentRegistry: `eip155:10143:${MONAD_TESTNET_ERC8004_IDENTITY_REGISTRY}`,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* Official ERC-8004 Identity Registry ABI
|
|
114
|
+
*/
|
|
115
|
+
export const erc8004IdentityAbi = parseAbi([
|
|
116
|
+
"function register(string agentURI) returns (uint256 agentId)",
|
|
117
|
+
"function ownerOf(uint256 tokenId) view returns (address)",
|
|
118
|
+
"function tokenURI(uint256 tokenId) view returns (string)",
|
|
119
|
+
"function getAgentWallet(uint256 agentId) view returns (address)",
|
|
120
|
+
"event Registered(uint256 indexed agentId, string agentURI, address indexed owner)",
|
|
121
|
+
]);
|
|
122
|
+
/**
|
|
123
|
+
* Official ERC-8004 Reputation Registry ABI
|
|
124
|
+
*/
|
|
125
|
+
export const erc8004ReputationAbi = parseAbi([
|
|
126
|
+
"function giveFeedback(uint256 agentId, int128 value, uint8 valueDecimals, string tag1, string tag2, string endpoint, string feedbackURI, bytes32 feedbackHash)",
|
|
127
|
+
"function getSummary(uint256 agentId, address[] clientAddresses, string tag1, string tag2) view returns (uint64 count, int128 summaryValue, uint8 summaryValueDecimals)",
|
|
128
|
+
"function getClients(uint256 agentId) view returns (address[])",
|
|
129
|
+
"event NewFeedback(uint256 indexed agentId, address indexed clientAddress, uint64 feedbackIndex, int128 value, uint8 valueDecimals, string indexed indexedTag1, string tag1, string tag2, string endpoint, string feedbackURI, bytes32 feedbackHash)",
|
|
130
|
+
]);
|
|
131
|
+
/**
|
|
132
|
+
* Monad A2A Escrow ABI
|
|
133
|
+
*/
|
|
134
|
+
export const monadEscrowAbi = parseAbi([
|
|
135
|
+
"function createAndFundJob(address worker, string calldata taskDescription, uint256 durationHours) payable returns (uint256 jobId)",
|
|
136
|
+
"function completeJob(uint256 jobId, string calldata resultURI) external",
|
|
137
|
+
"function refundExpiredJob(uint256 jobId) external",
|
|
138
|
+
"function getJob(uint256 jobId) external view returns ((address client, address worker, uint256 bounty, uint256 deadline, uint8 status, string taskDescription, string resultURI))",
|
|
139
|
+
"event JobCreated(uint256 indexed jobId, address indexed client, address indexed worker, uint256 bounty)",
|
|
140
|
+
"event JobCompleted(uint256 indexed jobId, string resultURI)",
|
|
141
|
+
"event JobRefunded(uint256 indexed jobId)",
|
|
142
|
+
]);
|
|
143
|
+
/**
|
|
144
|
+
* Schemas for inputs
|
|
145
|
+
*/
|
|
146
|
+
export const monadPaymentInputSchema = z.object({
|
|
147
|
+
to: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Monad recipient address"),
|
|
148
|
+
amount: z.string().regex(/^\d+(\.\d+)?$/, "Amount must be a positive decimal string"),
|
|
149
|
+
token: z.string().default("MON"),
|
|
150
|
+
memo: z.string().max(256).optional(),
|
|
151
|
+
chainId: z.string().optional(),
|
|
152
|
+
});
|
|
153
|
+
export const monadAgentCardSchema = z.object({
|
|
154
|
+
name: z.string().min(1).max(64),
|
|
155
|
+
description: z.string().min(1).max(512),
|
|
156
|
+
endpoints: z.array(z.string().url()).min(1),
|
|
157
|
+
walletAddress: z.string().regex(/^0x[a-fA-F0-9]{40}$/),
|
|
158
|
+
supportedProtocols: z.array(z.string()).default(["mcp", "x402"]),
|
|
159
|
+
active: z.boolean().default(true),
|
|
160
|
+
});
|
|
161
|
+
export const monadReputationFeedbackSchema = z.object({
|
|
162
|
+
agentId: z.string().regex(/^\d+$/, "agentId must be a numeric string"),
|
|
163
|
+
value: z.coerce.number().int().min(-100).max(100),
|
|
164
|
+
decimals: z.coerce.number().int().min(0).max(2).default(0),
|
|
165
|
+
tag1: z.string().max(32).default("general"),
|
|
166
|
+
tag2: z.string().max(32).default("task"),
|
|
167
|
+
endpoint: z.string().url().or(z.literal("")).default(""),
|
|
168
|
+
feedbackURI: z.string().url().or(z.literal("")).default(""),
|
|
169
|
+
chainId: z.string().optional(),
|
|
170
|
+
});
|
|
171
|
+
export const monadCreateJobSchema = z.object({
|
|
172
|
+
workerAddress: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid worker address"),
|
|
173
|
+
bountyMon: z.string().regex(/^\d+(\.\d+)?$/, "Bounty must be a positive decimal string"),
|
|
174
|
+
taskDescription: z.string().min(1).max(500),
|
|
175
|
+
deadlineHours: z.coerce.number().int().min(1).max(168).default(24),
|
|
176
|
+
chainId: z.string().optional(),
|
|
177
|
+
});
|
|
178
|
+
export const monadCompleteJobSchema = z.object({
|
|
179
|
+
jobId: z.string().regex(/^\d+$/, "jobId must be a numeric string"),
|
|
180
|
+
resultURI: z.string().default("ipfs://settled"),
|
|
181
|
+
chainId: z.string().optional(),
|
|
182
|
+
});
|
|
183
|
+
export const monadRefundJobSchema = z.object({
|
|
184
|
+
jobId: z.string().regex(/^\d+$/, "jobId must be a numeric string"),
|
|
185
|
+
chainId: z.string().optional(),
|
|
186
|
+
});
|