@agentpactai/runtime 0.1.1
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 +184 -0
- package/dist/abi.cjs +2524 -0
- package/dist/abi.cjs.map +1 -0
- package/dist/abi.d.cts +1959 -0
- package/dist/abi.d.ts +1959 -0
- package/dist/abi.js +2521 -0
- package/dist/abi.js.map +1 -0
- package/dist/index.cjs +4175 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1119 -0
- package/dist/index.d.ts +1119 -0
- package/dist/index.js +4150 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4150 @@
|
|
|
1
|
+
import { erc20Abi, maxUint256, createPublicClient, http, createWalletClient } from 'viem';
|
|
2
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
3
|
+
import { baseSepolia } from 'viem/chains';
|
|
4
|
+
|
|
5
|
+
// src/client.ts
|
|
6
|
+
|
|
7
|
+
// src/abi.ts
|
|
8
|
+
var ESCROW_ABI = [
|
|
9
|
+
{
|
|
10
|
+
"inputs": [],
|
|
11
|
+
"stateMutability": "nonpayable",
|
|
12
|
+
"type": "constructor"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"inputs": [
|
|
16
|
+
{
|
|
17
|
+
"internalType": "address",
|
|
18
|
+
"name": "target",
|
|
19
|
+
"type": "address"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"name": "AddressEmptyCode",
|
|
23
|
+
"type": "error"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"inputs": [],
|
|
27
|
+
"name": "DeadlineNotReached",
|
|
28
|
+
"type": "error"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"inputs": [],
|
|
32
|
+
"name": "ECDSAInvalidSignature",
|
|
33
|
+
"type": "error"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"inputs": [
|
|
37
|
+
{
|
|
38
|
+
"internalType": "uint256",
|
|
39
|
+
"name": "length",
|
|
40
|
+
"type": "uint256"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"name": "ECDSAInvalidSignatureLength",
|
|
44
|
+
"type": "error"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"inputs": [
|
|
48
|
+
{
|
|
49
|
+
"internalType": "bytes32",
|
|
50
|
+
"name": "s",
|
|
51
|
+
"type": "bytes32"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"name": "ECDSAInvalidSignatureS",
|
|
55
|
+
"type": "error"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"inputs": [
|
|
59
|
+
{
|
|
60
|
+
"internalType": "address",
|
|
61
|
+
"name": "implementation",
|
|
62
|
+
"type": "address"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"name": "ERC1967InvalidImplementation",
|
|
66
|
+
"type": "error"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"inputs": [],
|
|
70
|
+
"name": "ERC1967NonPayable",
|
|
71
|
+
"type": "error"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"inputs": [],
|
|
75
|
+
"name": "FailedCall",
|
|
76
|
+
"type": "error"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"inputs": [],
|
|
80
|
+
"name": "InsufficientDeposit",
|
|
81
|
+
"type": "error"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"inputs": [],
|
|
85
|
+
"name": "InvalidAcceptanceWindow",
|
|
86
|
+
"type": "error"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"inputs": [],
|
|
90
|
+
"name": "InvalidCriteriaCount",
|
|
91
|
+
"type": "error"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"inputs": [],
|
|
95
|
+
"name": "InvalidDuration",
|
|
96
|
+
"type": "error"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"inputs": [],
|
|
100
|
+
"name": "InvalidFundWeight",
|
|
101
|
+
"type": "error"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"inputs": [],
|
|
105
|
+
"name": "InvalidInitialization",
|
|
106
|
+
"type": "error"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"inputs": [],
|
|
110
|
+
"name": "InvalidMaxRevisions",
|
|
111
|
+
"type": "error"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"inputs": [],
|
|
115
|
+
"name": "InvalidNonce",
|
|
116
|
+
"type": "error"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"inputs": [],
|
|
120
|
+
"name": "InvalidPassRate",
|
|
121
|
+
"type": "error"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"inputs": [],
|
|
125
|
+
"name": "InvalidSignature",
|
|
126
|
+
"type": "error"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"inputs": [
|
|
130
|
+
{
|
|
131
|
+
"internalType": "enum IAgentPactEscrow.TaskState",
|
|
132
|
+
"name": "current",
|
|
133
|
+
"type": "uint8"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"internalType": "enum IAgentPactEscrow.TaskState",
|
|
137
|
+
"name": "expected",
|
|
138
|
+
"type": "uint8"
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
"name": "InvalidState",
|
|
142
|
+
"type": "error"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"inputs": [],
|
|
146
|
+
"name": "NotInitializing",
|
|
147
|
+
"type": "error"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"inputs": [],
|
|
151
|
+
"name": "OnlyParties",
|
|
152
|
+
"type": "error"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"inputs": [],
|
|
156
|
+
"name": "OnlyProvider",
|
|
157
|
+
"type": "error"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"inputs": [],
|
|
161
|
+
"name": "OnlyRequester",
|
|
162
|
+
"type": "error"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"inputs": [
|
|
166
|
+
{
|
|
167
|
+
"internalType": "address",
|
|
168
|
+
"name": "owner",
|
|
169
|
+
"type": "address"
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"name": "OwnableInvalidOwner",
|
|
173
|
+
"type": "error"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"inputs": [
|
|
177
|
+
{
|
|
178
|
+
"internalType": "address",
|
|
179
|
+
"name": "account",
|
|
180
|
+
"type": "address"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"name": "OwnableUnauthorizedAccount",
|
|
184
|
+
"type": "error"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"inputs": [],
|
|
188
|
+
"name": "ReentrancyGuardReentrantCall",
|
|
189
|
+
"type": "error"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"inputs": [
|
|
193
|
+
{
|
|
194
|
+
"internalType": "address",
|
|
195
|
+
"name": "token",
|
|
196
|
+
"type": "address"
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
"name": "SafeERC20FailedOperation",
|
|
200
|
+
"type": "error"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"inputs": [],
|
|
204
|
+
"name": "SignatureExpired",
|
|
205
|
+
"type": "error"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"inputs": [],
|
|
209
|
+
"name": "TokenNotAllowed",
|
|
210
|
+
"type": "error"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"inputs": [],
|
|
214
|
+
"name": "UUPSUnauthorizedCallContext",
|
|
215
|
+
"type": "error"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"inputs": [
|
|
219
|
+
{
|
|
220
|
+
"internalType": "bytes32",
|
|
221
|
+
"name": "slot",
|
|
222
|
+
"type": "bytes32"
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
"name": "UUPSUnsupportedProxiableUUID",
|
|
226
|
+
"type": "error"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"inputs": [],
|
|
230
|
+
"name": "WeightCountMismatch",
|
|
231
|
+
"type": "error"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"inputs": [],
|
|
235
|
+
"name": "WeightsSumNot100",
|
|
236
|
+
"type": "error"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"inputs": [],
|
|
240
|
+
"name": "ZeroAddress",
|
|
241
|
+
"type": "error"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"inputs": [],
|
|
245
|
+
"name": "ZeroAmount",
|
|
246
|
+
"type": "error"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"anonymous": false,
|
|
250
|
+
"inputs": [
|
|
251
|
+
{
|
|
252
|
+
"indexed": true,
|
|
253
|
+
"internalType": "uint256",
|
|
254
|
+
"name": "escrowId",
|
|
255
|
+
"type": "uint256"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"indexed": false,
|
|
259
|
+
"internalType": "uint256",
|
|
260
|
+
"name": "providerPayout",
|
|
261
|
+
"type": "uint256"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"indexed": false,
|
|
265
|
+
"internalType": "uint256",
|
|
266
|
+
"name": "platformFee",
|
|
267
|
+
"type": "uint256"
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
"name": "DeliveryAccepted",
|
|
271
|
+
"type": "event"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"anonymous": false,
|
|
275
|
+
"inputs": [
|
|
276
|
+
{
|
|
277
|
+
"indexed": true,
|
|
278
|
+
"internalType": "uint256",
|
|
279
|
+
"name": "escrowId",
|
|
280
|
+
"type": "uint256"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"indexed": false,
|
|
284
|
+
"internalType": "bytes32",
|
|
285
|
+
"name": "deliveryHash",
|
|
286
|
+
"type": "bytes32"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"indexed": false,
|
|
290
|
+
"internalType": "uint8",
|
|
291
|
+
"name": "revision",
|
|
292
|
+
"type": "uint8"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"indexed": false,
|
|
296
|
+
"internalType": "uint64",
|
|
297
|
+
"name": "acceptanceDeadline",
|
|
298
|
+
"type": "uint64"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"name": "DeliverySubmitted",
|
|
302
|
+
"type": "event"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"anonymous": false,
|
|
306
|
+
"inputs": [],
|
|
307
|
+
"name": "EIP712DomainChanged",
|
|
308
|
+
"type": "event"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"anonymous": false,
|
|
312
|
+
"inputs": [
|
|
313
|
+
{
|
|
314
|
+
"indexed": true,
|
|
315
|
+
"internalType": "uint256",
|
|
316
|
+
"name": "escrowId",
|
|
317
|
+
"type": "uint256"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"indexed": true,
|
|
321
|
+
"internalType": "address",
|
|
322
|
+
"name": "requester",
|
|
323
|
+
"type": "address"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"indexed": false,
|
|
327
|
+
"internalType": "bytes32",
|
|
328
|
+
"name": "taskHash",
|
|
329
|
+
"type": "bytes32"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"indexed": false,
|
|
333
|
+
"internalType": "uint256",
|
|
334
|
+
"name": "rewardAmount",
|
|
335
|
+
"type": "uint256"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"indexed": false,
|
|
339
|
+
"internalType": "uint256",
|
|
340
|
+
"name": "requesterDeposit",
|
|
341
|
+
"type": "uint256"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"indexed": false,
|
|
345
|
+
"internalType": "address",
|
|
346
|
+
"name": "token",
|
|
347
|
+
"type": "address"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"indexed": false,
|
|
351
|
+
"internalType": "uint64",
|
|
352
|
+
"name": "deliveryDurationSeconds",
|
|
353
|
+
"type": "uint64"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"indexed": false,
|
|
357
|
+
"internalType": "uint8",
|
|
358
|
+
"name": "maxRevisions",
|
|
359
|
+
"type": "uint8"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"indexed": false,
|
|
363
|
+
"internalType": "uint8",
|
|
364
|
+
"name": "acceptanceWindowHours",
|
|
365
|
+
"type": "uint8"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"indexed": false,
|
|
369
|
+
"internalType": "uint8",
|
|
370
|
+
"name": "criteriaCount",
|
|
371
|
+
"type": "uint8"
|
|
372
|
+
}
|
|
373
|
+
],
|
|
374
|
+
"name": "EscrowCreated",
|
|
375
|
+
"type": "event"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"anonymous": false,
|
|
379
|
+
"inputs": [
|
|
380
|
+
{
|
|
381
|
+
"indexed": false,
|
|
382
|
+
"internalType": "uint64",
|
|
383
|
+
"name": "version",
|
|
384
|
+
"type": "uint64"
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
"name": "Initialized",
|
|
388
|
+
"type": "event"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"anonymous": false,
|
|
392
|
+
"inputs": [
|
|
393
|
+
{
|
|
394
|
+
"indexed": true,
|
|
395
|
+
"internalType": "address",
|
|
396
|
+
"name": "previousOwner",
|
|
397
|
+
"type": "address"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"indexed": true,
|
|
401
|
+
"internalType": "address",
|
|
402
|
+
"name": "newOwner",
|
|
403
|
+
"type": "address"
|
|
404
|
+
}
|
|
405
|
+
],
|
|
406
|
+
"name": "OwnershipTransferred",
|
|
407
|
+
"type": "event"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"anonymous": false,
|
|
411
|
+
"inputs": [
|
|
412
|
+
{
|
|
413
|
+
"indexed": true,
|
|
414
|
+
"internalType": "uint256",
|
|
415
|
+
"name": "escrowId",
|
|
416
|
+
"type": "uint256"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"indexed": false,
|
|
420
|
+
"internalType": "bytes32",
|
|
421
|
+
"name": "reasonHash",
|
|
422
|
+
"type": "bytes32"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"indexed": false,
|
|
426
|
+
"internalType": "bytes32",
|
|
427
|
+
"name": "criteriaResultsHash",
|
|
428
|
+
"type": "bytes32"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"indexed": false,
|
|
432
|
+
"internalType": "uint8",
|
|
433
|
+
"name": "currentRevision",
|
|
434
|
+
"type": "uint8"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"indexed": false,
|
|
438
|
+
"internalType": "uint256",
|
|
439
|
+
"name": "depositPenalty",
|
|
440
|
+
"type": "uint256"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"indexed": false,
|
|
444
|
+
"internalType": "uint8",
|
|
445
|
+
"name": "passRate",
|
|
446
|
+
"type": "uint8"
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
"name": "RevisionRequested",
|
|
450
|
+
"type": "event"
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"anonymous": false,
|
|
454
|
+
"inputs": [
|
|
455
|
+
{
|
|
456
|
+
"indexed": true,
|
|
457
|
+
"internalType": "uint256",
|
|
458
|
+
"name": "escrowId",
|
|
459
|
+
"type": "uint256"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"indexed": true,
|
|
463
|
+
"internalType": "address",
|
|
464
|
+
"name": "provider",
|
|
465
|
+
"type": "address"
|
|
466
|
+
}
|
|
467
|
+
],
|
|
468
|
+
"name": "TaskAbandoned",
|
|
469
|
+
"type": "event"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"anonymous": false,
|
|
473
|
+
"inputs": [
|
|
474
|
+
{
|
|
475
|
+
"indexed": true,
|
|
476
|
+
"internalType": "uint256",
|
|
477
|
+
"name": "escrowId",
|
|
478
|
+
"type": "uint256"
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"indexed": false,
|
|
482
|
+
"internalType": "uint8",
|
|
483
|
+
"name": "passRate",
|
|
484
|
+
"type": "uint8"
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
"indexed": false,
|
|
488
|
+
"internalType": "uint256",
|
|
489
|
+
"name": "providerShare",
|
|
490
|
+
"type": "uint256"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"indexed": false,
|
|
494
|
+
"internalType": "uint256",
|
|
495
|
+
"name": "requesterRefund",
|
|
496
|
+
"type": "uint256"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"indexed": false,
|
|
500
|
+
"internalType": "uint256",
|
|
501
|
+
"name": "platformFee",
|
|
502
|
+
"type": "uint256"
|
|
503
|
+
}
|
|
504
|
+
],
|
|
505
|
+
"name": "TaskAutoSettled",
|
|
506
|
+
"type": "event"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"anonymous": false,
|
|
510
|
+
"inputs": [
|
|
511
|
+
{
|
|
512
|
+
"indexed": true,
|
|
513
|
+
"internalType": "uint256",
|
|
514
|
+
"name": "escrowId",
|
|
515
|
+
"type": "uint256"
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"indexed": false,
|
|
519
|
+
"internalType": "uint256",
|
|
520
|
+
"name": "compensation",
|
|
521
|
+
"type": "uint256"
|
|
522
|
+
}
|
|
523
|
+
],
|
|
524
|
+
"name": "TaskCancelled",
|
|
525
|
+
"type": "event"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"anonymous": false,
|
|
529
|
+
"inputs": [
|
|
530
|
+
{
|
|
531
|
+
"indexed": true,
|
|
532
|
+
"internalType": "uint256",
|
|
533
|
+
"name": "escrowId",
|
|
534
|
+
"type": "uint256"
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
"indexed": true,
|
|
538
|
+
"internalType": "address",
|
|
539
|
+
"name": "provider",
|
|
540
|
+
"type": "address"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"indexed": false,
|
|
544
|
+
"internalType": "uint64",
|
|
545
|
+
"name": "confirmationDeadline",
|
|
546
|
+
"type": "uint64"
|
|
547
|
+
}
|
|
548
|
+
],
|
|
549
|
+
"name": "TaskClaimed",
|
|
550
|
+
"type": "event"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
"anonymous": false,
|
|
554
|
+
"inputs": [
|
|
555
|
+
{
|
|
556
|
+
"indexed": true,
|
|
557
|
+
"internalType": "uint256",
|
|
558
|
+
"name": "escrowId",
|
|
559
|
+
"type": "uint256"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"indexed": true,
|
|
563
|
+
"internalType": "address",
|
|
564
|
+
"name": "provider",
|
|
565
|
+
"type": "address"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
"indexed": false,
|
|
569
|
+
"internalType": "uint64",
|
|
570
|
+
"name": "deliveryDeadline",
|
|
571
|
+
"type": "uint64"
|
|
572
|
+
}
|
|
573
|
+
],
|
|
574
|
+
"name": "TaskConfirmed",
|
|
575
|
+
"type": "event"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"anonymous": false,
|
|
579
|
+
"inputs": [
|
|
580
|
+
{
|
|
581
|
+
"indexed": true,
|
|
582
|
+
"internalType": "uint256",
|
|
583
|
+
"name": "escrowId",
|
|
584
|
+
"type": "uint256"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"indexed": true,
|
|
588
|
+
"internalType": "address",
|
|
589
|
+
"name": "provider",
|
|
590
|
+
"type": "address"
|
|
591
|
+
}
|
|
592
|
+
],
|
|
593
|
+
"name": "TaskDeclined",
|
|
594
|
+
"type": "event"
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
"anonymous": false,
|
|
598
|
+
"inputs": [
|
|
599
|
+
{
|
|
600
|
+
"indexed": true,
|
|
601
|
+
"internalType": "uint256",
|
|
602
|
+
"name": "escrowId",
|
|
603
|
+
"type": "uint256"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
"indexed": false,
|
|
607
|
+
"internalType": "uint8",
|
|
608
|
+
"name": "declineCount",
|
|
609
|
+
"type": "uint8"
|
|
610
|
+
}
|
|
611
|
+
],
|
|
612
|
+
"name": "TaskSuspendedAfterDeclines",
|
|
613
|
+
"type": "event"
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
"anonymous": false,
|
|
617
|
+
"inputs": [
|
|
618
|
+
{
|
|
619
|
+
"indexed": true,
|
|
620
|
+
"internalType": "uint256",
|
|
621
|
+
"name": "escrowId",
|
|
622
|
+
"type": "uint256"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
"indexed": false,
|
|
626
|
+
"internalType": "enum IAgentPactEscrow.TaskState",
|
|
627
|
+
"name": "previousState",
|
|
628
|
+
"type": "uint8"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
"indexed": true,
|
|
632
|
+
"internalType": "address",
|
|
633
|
+
"name": "claimedBy",
|
|
634
|
+
"type": "address"
|
|
635
|
+
}
|
|
636
|
+
],
|
|
637
|
+
"name": "TimeoutClaimed",
|
|
638
|
+
"type": "event"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"anonymous": false,
|
|
642
|
+
"inputs": [
|
|
643
|
+
{
|
|
644
|
+
"indexed": true,
|
|
645
|
+
"internalType": "address",
|
|
646
|
+
"name": "implementation",
|
|
647
|
+
"type": "address"
|
|
648
|
+
}
|
|
649
|
+
],
|
|
650
|
+
"name": "Upgraded",
|
|
651
|
+
"type": "event"
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"inputs": [],
|
|
655
|
+
"name": "ASSIGNMENT_TYPEHASH",
|
|
656
|
+
"outputs": [
|
|
657
|
+
{
|
|
658
|
+
"internalType": "bytes32",
|
|
659
|
+
"name": "",
|
|
660
|
+
"type": "bytes32"
|
|
661
|
+
}
|
|
662
|
+
],
|
|
663
|
+
"stateMutability": "view",
|
|
664
|
+
"type": "function"
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
"inputs": [],
|
|
668
|
+
"name": "CONFIRMATION_WINDOW",
|
|
669
|
+
"outputs": [
|
|
670
|
+
{
|
|
671
|
+
"internalType": "uint64",
|
|
672
|
+
"name": "",
|
|
673
|
+
"type": "uint64"
|
|
674
|
+
}
|
|
675
|
+
],
|
|
676
|
+
"stateMutability": "view",
|
|
677
|
+
"type": "function"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
"inputs": [],
|
|
681
|
+
"name": "MAX_DECLINE_COUNT",
|
|
682
|
+
"outputs": [
|
|
683
|
+
{
|
|
684
|
+
"internalType": "uint8",
|
|
685
|
+
"name": "",
|
|
686
|
+
"type": "uint8"
|
|
687
|
+
}
|
|
688
|
+
],
|
|
689
|
+
"stateMutability": "view",
|
|
690
|
+
"type": "function"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
"inputs": [],
|
|
694
|
+
"name": "MIN_PASS_RATE",
|
|
695
|
+
"outputs": [
|
|
696
|
+
{
|
|
697
|
+
"internalType": "uint8",
|
|
698
|
+
"name": "",
|
|
699
|
+
"type": "uint8"
|
|
700
|
+
}
|
|
701
|
+
],
|
|
702
|
+
"stateMutability": "view",
|
|
703
|
+
"type": "function"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
"inputs": [],
|
|
707
|
+
"name": "PLATFORM_FEE_BPS",
|
|
708
|
+
"outputs": [
|
|
709
|
+
{
|
|
710
|
+
"internalType": "uint256",
|
|
711
|
+
"name": "",
|
|
712
|
+
"type": "uint256"
|
|
713
|
+
}
|
|
714
|
+
],
|
|
715
|
+
"stateMutability": "view",
|
|
716
|
+
"type": "function"
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"inputs": [],
|
|
720
|
+
"name": "UPGRADE_INTERFACE_VERSION",
|
|
721
|
+
"outputs": [
|
|
722
|
+
{
|
|
723
|
+
"internalType": "string",
|
|
724
|
+
"name": "",
|
|
725
|
+
"type": "string"
|
|
726
|
+
}
|
|
727
|
+
],
|
|
728
|
+
"stateMutability": "view",
|
|
729
|
+
"type": "function"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
"inputs": [
|
|
733
|
+
{
|
|
734
|
+
"internalType": "uint256",
|
|
735
|
+
"name": "escrowId",
|
|
736
|
+
"type": "uint256"
|
|
737
|
+
}
|
|
738
|
+
],
|
|
739
|
+
"name": "abandonTask",
|
|
740
|
+
"outputs": [],
|
|
741
|
+
"stateMutability": "nonpayable",
|
|
742
|
+
"type": "function"
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"inputs": [
|
|
746
|
+
{
|
|
747
|
+
"internalType": "uint256",
|
|
748
|
+
"name": "escrowId",
|
|
749
|
+
"type": "uint256"
|
|
750
|
+
}
|
|
751
|
+
],
|
|
752
|
+
"name": "acceptDelivery",
|
|
753
|
+
"outputs": [],
|
|
754
|
+
"stateMutability": "nonpayable",
|
|
755
|
+
"type": "function"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"inputs": [
|
|
759
|
+
{
|
|
760
|
+
"internalType": "address",
|
|
761
|
+
"name": "",
|
|
762
|
+
"type": "address"
|
|
763
|
+
}
|
|
764
|
+
],
|
|
765
|
+
"name": "allowedTokens",
|
|
766
|
+
"outputs": [
|
|
767
|
+
{
|
|
768
|
+
"internalType": "bool",
|
|
769
|
+
"name": "",
|
|
770
|
+
"type": "bool"
|
|
771
|
+
}
|
|
772
|
+
],
|
|
773
|
+
"stateMutability": "view",
|
|
774
|
+
"type": "function"
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"inputs": [
|
|
778
|
+
{
|
|
779
|
+
"internalType": "uint256",
|
|
780
|
+
"name": "",
|
|
781
|
+
"type": "uint256"
|
|
782
|
+
}
|
|
783
|
+
],
|
|
784
|
+
"name": "assignmentNonces",
|
|
785
|
+
"outputs": [
|
|
786
|
+
{
|
|
787
|
+
"internalType": "uint256",
|
|
788
|
+
"name": "",
|
|
789
|
+
"type": "uint256"
|
|
790
|
+
}
|
|
791
|
+
],
|
|
792
|
+
"stateMutability": "view",
|
|
793
|
+
"type": "function"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
"inputs": [
|
|
797
|
+
{
|
|
798
|
+
"internalType": "uint256",
|
|
799
|
+
"name": "escrowId",
|
|
800
|
+
"type": "uint256"
|
|
801
|
+
}
|
|
802
|
+
],
|
|
803
|
+
"name": "cancelTask",
|
|
804
|
+
"outputs": [],
|
|
805
|
+
"stateMutability": "nonpayable",
|
|
806
|
+
"type": "function"
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
"inputs": [
|
|
810
|
+
{
|
|
811
|
+
"internalType": "uint256",
|
|
812
|
+
"name": "escrowId",
|
|
813
|
+
"type": "uint256"
|
|
814
|
+
}
|
|
815
|
+
],
|
|
816
|
+
"name": "claimAcceptanceTimeout",
|
|
817
|
+
"outputs": [],
|
|
818
|
+
"stateMutability": "nonpayable",
|
|
819
|
+
"type": "function"
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
"inputs": [
|
|
823
|
+
{
|
|
824
|
+
"internalType": "uint256",
|
|
825
|
+
"name": "escrowId",
|
|
826
|
+
"type": "uint256"
|
|
827
|
+
}
|
|
828
|
+
],
|
|
829
|
+
"name": "claimConfirmationTimeout",
|
|
830
|
+
"outputs": [],
|
|
831
|
+
"stateMutability": "nonpayable",
|
|
832
|
+
"type": "function"
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
"inputs": [
|
|
836
|
+
{
|
|
837
|
+
"internalType": "uint256",
|
|
838
|
+
"name": "escrowId",
|
|
839
|
+
"type": "uint256"
|
|
840
|
+
}
|
|
841
|
+
],
|
|
842
|
+
"name": "claimDeliveryTimeout",
|
|
843
|
+
"outputs": [],
|
|
844
|
+
"stateMutability": "nonpayable",
|
|
845
|
+
"type": "function"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"inputs": [
|
|
849
|
+
{
|
|
850
|
+
"internalType": "uint256",
|
|
851
|
+
"name": "escrowId",
|
|
852
|
+
"type": "uint256"
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
"internalType": "uint256",
|
|
856
|
+
"name": "nonce",
|
|
857
|
+
"type": "uint256"
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
"internalType": "uint256",
|
|
861
|
+
"name": "expiredAt",
|
|
862
|
+
"type": "uint256"
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
"internalType": "bytes",
|
|
866
|
+
"name": "platformSignature",
|
|
867
|
+
"type": "bytes"
|
|
868
|
+
}
|
|
869
|
+
],
|
|
870
|
+
"name": "claimTask",
|
|
871
|
+
"outputs": [],
|
|
872
|
+
"stateMutability": "nonpayable",
|
|
873
|
+
"type": "function"
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
"inputs": [
|
|
877
|
+
{
|
|
878
|
+
"internalType": "uint256",
|
|
879
|
+
"name": "escrowId",
|
|
880
|
+
"type": "uint256"
|
|
881
|
+
}
|
|
882
|
+
],
|
|
883
|
+
"name": "confirmTask",
|
|
884
|
+
"outputs": [],
|
|
885
|
+
"stateMutability": "nonpayable",
|
|
886
|
+
"type": "function"
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
"inputs": [
|
|
890
|
+
{
|
|
891
|
+
"internalType": "bytes32",
|
|
892
|
+
"name": "taskHash",
|
|
893
|
+
"type": "bytes32"
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
"internalType": "uint64",
|
|
897
|
+
"name": "deliveryDurationSeconds",
|
|
898
|
+
"type": "uint64"
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
"internalType": "uint8",
|
|
902
|
+
"name": "maxRevisions",
|
|
903
|
+
"type": "uint8"
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
"internalType": "uint8",
|
|
907
|
+
"name": "acceptanceWindowHours",
|
|
908
|
+
"type": "uint8"
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
"internalType": "uint8",
|
|
912
|
+
"name": "criteriaCount",
|
|
913
|
+
"type": "uint8"
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
"internalType": "uint8[]",
|
|
917
|
+
"name": "fundWeights",
|
|
918
|
+
"type": "uint8[]"
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
"internalType": "address",
|
|
922
|
+
"name": "token",
|
|
923
|
+
"type": "address"
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
"internalType": "uint256",
|
|
927
|
+
"name": "totalAmount",
|
|
928
|
+
"type": "uint256"
|
|
929
|
+
}
|
|
930
|
+
],
|
|
931
|
+
"name": "createEscrow",
|
|
932
|
+
"outputs": [
|
|
933
|
+
{
|
|
934
|
+
"internalType": "uint256",
|
|
935
|
+
"name": "escrowId",
|
|
936
|
+
"type": "uint256"
|
|
937
|
+
}
|
|
938
|
+
],
|
|
939
|
+
"stateMutability": "payable",
|
|
940
|
+
"type": "function"
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
"inputs": [
|
|
944
|
+
{
|
|
945
|
+
"internalType": "uint256",
|
|
946
|
+
"name": "escrowId",
|
|
947
|
+
"type": "uint256"
|
|
948
|
+
}
|
|
949
|
+
],
|
|
950
|
+
"name": "declineTask",
|
|
951
|
+
"outputs": [],
|
|
952
|
+
"stateMutability": "nonpayable",
|
|
953
|
+
"type": "function"
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
"inputs": [],
|
|
957
|
+
"name": "eip712Domain",
|
|
958
|
+
"outputs": [
|
|
959
|
+
{
|
|
960
|
+
"internalType": "bytes1",
|
|
961
|
+
"name": "fields",
|
|
962
|
+
"type": "bytes1"
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
"internalType": "string",
|
|
966
|
+
"name": "name",
|
|
967
|
+
"type": "string"
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
"internalType": "string",
|
|
971
|
+
"name": "version",
|
|
972
|
+
"type": "string"
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
"internalType": "uint256",
|
|
976
|
+
"name": "chainId",
|
|
977
|
+
"type": "uint256"
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
"internalType": "address",
|
|
981
|
+
"name": "verifyingContract",
|
|
982
|
+
"type": "address"
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
"internalType": "bytes32",
|
|
986
|
+
"name": "salt",
|
|
987
|
+
"type": "bytes32"
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
"internalType": "uint256[]",
|
|
991
|
+
"name": "extensions",
|
|
992
|
+
"type": "uint256[]"
|
|
993
|
+
}
|
|
994
|
+
],
|
|
995
|
+
"stateMutability": "view",
|
|
996
|
+
"type": "function"
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
"inputs": [
|
|
1000
|
+
{
|
|
1001
|
+
"internalType": "uint256",
|
|
1002
|
+
"name": "",
|
|
1003
|
+
"type": "uint256"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
"internalType": "uint8",
|
|
1007
|
+
"name": "",
|
|
1008
|
+
"type": "uint8"
|
|
1009
|
+
}
|
|
1010
|
+
],
|
|
1011
|
+
"name": "escrowFundWeights",
|
|
1012
|
+
"outputs": [
|
|
1013
|
+
{
|
|
1014
|
+
"internalType": "uint8",
|
|
1015
|
+
"name": "",
|
|
1016
|
+
"type": "uint8"
|
|
1017
|
+
}
|
|
1018
|
+
],
|
|
1019
|
+
"stateMutability": "view",
|
|
1020
|
+
"type": "function"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"inputs": [
|
|
1024
|
+
{
|
|
1025
|
+
"internalType": "uint256",
|
|
1026
|
+
"name": "",
|
|
1027
|
+
"type": "uint256"
|
|
1028
|
+
}
|
|
1029
|
+
],
|
|
1030
|
+
"name": "escrows",
|
|
1031
|
+
"outputs": [
|
|
1032
|
+
{
|
|
1033
|
+
"internalType": "address",
|
|
1034
|
+
"name": "requester",
|
|
1035
|
+
"type": "address"
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
"internalType": "address",
|
|
1039
|
+
"name": "provider",
|
|
1040
|
+
"type": "address"
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
"internalType": "uint256",
|
|
1044
|
+
"name": "rewardAmount",
|
|
1045
|
+
"type": "uint256"
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
"internalType": "uint256",
|
|
1049
|
+
"name": "requesterDeposit",
|
|
1050
|
+
"type": "uint256"
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
"internalType": "uint256",
|
|
1054
|
+
"name": "depositConsumed",
|
|
1055
|
+
"type": "uint256"
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
"internalType": "address",
|
|
1059
|
+
"name": "token",
|
|
1060
|
+
"type": "address"
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
"internalType": "enum IAgentPactEscrow.TaskState",
|
|
1064
|
+
"name": "state",
|
|
1065
|
+
"type": "uint8"
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
"internalType": "bytes32",
|
|
1069
|
+
"name": "taskHash",
|
|
1070
|
+
"type": "bytes32"
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
"internalType": "bytes32",
|
|
1074
|
+
"name": "latestDeliveryHash",
|
|
1075
|
+
"type": "bytes32"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
"internalType": "bytes32",
|
|
1079
|
+
"name": "latestCriteriaHash",
|
|
1080
|
+
"type": "bytes32"
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
"internalType": "uint64",
|
|
1084
|
+
"name": "deliveryDurationSeconds",
|
|
1085
|
+
"type": "uint64"
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
"internalType": "uint64",
|
|
1089
|
+
"name": "deliveryDeadline",
|
|
1090
|
+
"type": "uint64"
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
"internalType": "uint64",
|
|
1094
|
+
"name": "acceptanceDeadline",
|
|
1095
|
+
"type": "uint64"
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
"internalType": "uint64",
|
|
1099
|
+
"name": "confirmationDeadline",
|
|
1100
|
+
"type": "uint64"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
"internalType": "uint8",
|
|
1104
|
+
"name": "maxRevisions",
|
|
1105
|
+
"type": "uint8"
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
"internalType": "uint8",
|
|
1109
|
+
"name": "currentRevision",
|
|
1110
|
+
"type": "uint8"
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
"internalType": "uint8",
|
|
1114
|
+
"name": "criteriaCount",
|
|
1115
|
+
"type": "uint8"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
"internalType": "uint8",
|
|
1119
|
+
"name": "declineCount",
|
|
1120
|
+
"type": "uint8"
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
"internalType": "uint8",
|
|
1124
|
+
"name": "acceptanceWindowHours",
|
|
1125
|
+
"type": "uint8"
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
"stateMutability": "view",
|
|
1129
|
+
"type": "function"
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
"inputs": [],
|
|
1133
|
+
"name": "getDomainSeparator",
|
|
1134
|
+
"outputs": [
|
|
1135
|
+
{
|
|
1136
|
+
"internalType": "bytes32",
|
|
1137
|
+
"name": "",
|
|
1138
|
+
"type": "bytes32"
|
|
1139
|
+
}
|
|
1140
|
+
],
|
|
1141
|
+
"stateMutability": "view",
|
|
1142
|
+
"type": "function"
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
"inputs": [
|
|
1146
|
+
{
|
|
1147
|
+
"internalType": "uint256",
|
|
1148
|
+
"name": "escrowId",
|
|
1149
|
+
"type": "uint256"
|
|
1150
|
+
}
|
|
1151
|
+
],
|
|
1152
|
+
"name": "getEscrow",
|
|
1153
|
+
"outputs": [
|
|
1154
|
+
{
|
|
1155
|
+
"components": [
|
|
1156
|
+
{
|
|
1157
|
+
"internalType": "address",
|
|
1158
|
+
"name": "requester",
|
|
1159
|
+
"type": "address"
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
"internalType": "address",
|
|
1163
|
+
"name": "provider",
|
|
1164
|
+
"type": "address"
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
"internalType": "uint256",
|
|
1168
|
+
"name": "rewardAmount",
|
|
1169
|
+
"type": "uint256"
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
"internalType": "uint256",
|
|
1173
|
+
"name": "requesterDeposit",
|
|
1174
|
+
"type": "uint256"
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
"internalType": "uint256",
|
|
1178
|
+
"name": "depositConsumed",
|
|
1179
|
+
"type": "uint256"
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
"internalType": "address",
|
|
1183
|
+
"name": "token",
|
|
1184
|
+
"type": "address"
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
"internalType": "enum IAgentPactEscrow.TaskState",
|
|
1188
|
+
"name": "state",
|
|
1189
|
+
"type": "uint8"
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
"internalType": "bytes32",
|
|
1193
|
+
"name": "taskHash",
|
|
1194
|
+
"type": "bytes32"
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
"internalType": "bytes32",
|
|
1198
|
+
"name": "latestDeliveryHash",
|
|
1199
|
+
"type": "bytes32"
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
"internalType": "bytes32",
|
|
1203
|
+
"name": "latestCriteriaHash",
|
|
1204
|
+
"type": "bytes32"
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
"internalType": "uint64",
|
|
1208
|
+
"name": "deliveryDurationSeconds",
|
|
1209
|
+
"type": "uint64"
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
"internalType": "uint64",
|
|
1213
|
+
"name": "deliveryDeadline",
|
|
1214
|
+
"type": "uint64"
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
"internalType": "uint64",
|
|
1218
|
+
"name": "acceptanceDeadline",
|
|
1219
|
+
"type": "uint64"
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
"internalType": "uint64",
|
|
1223
|
+
"name": "confirmationDeadline",
|
|
1224
|
+
"type": "uint64"
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
"internalType": "uint8",
|
|
1228
|
+
"name": "maxRevisions",
|
|
1229
|
+
"type": "uint8"
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
"internalType": "uint8",
|
|
1233
|
+
"name": "currentRevision",
|
|
1234
|
+
"type": "uint8"
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
"internalType": "uint8",
|
|
1238
|
+
"name": "criteriaCount",
|
|
1239
|
+
"type": "uint8"
|
|
1240
|
+
},
|
|
1241
|
+
{
|
|
1242
|
+
"internalType": "uint8",
|
|
1243
|
+
"name": "declineCount",
|
|
1244
|
+
"type": "uint8"
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
"internalType": "uint8",
|
|
1248
|
+
"name": "acceptanceWindowHours",
|
|
1249
|
+
"type": "uint8"
|
|
1250
|
+
}
|
|
1251
|
+
],
|
|
1252
|
+
"internalType": "struct IAgentPactEscrow.EscrowRecord",
|
|
1253
|
+
"name": "",
|
|
1254
|
+
"type": "tuple"
|
|
1255
|
+
}
|
|
1256
|
+
],
|
|
1257
|
+
"stateMutability": "view",
|
|
1258
|
+
"type": "function"
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
"inputs": [
|
|
1262
|
+
{
|
|
1263
|
+
"internalType": "uint256",
|
|
1264
|
+
"name": "escrowId",
|
|
1265
|
+
"type": "uint256"
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
"internalType": "uint8",
|
|
1269
|
+
"name": "criteriaIndex",
|
|
1270
|
+
"type": "uint8"
|
|
1271
|
+
}
|
|
1272
|
+
],
|
|
1273
|
+
"name": "getFundWeight",
|
|
1274
|
+
"outputs": [
|
|
1275
|
+
{
|
|
1276
|
+
"internalType": "uint8",
|
|
1277
|
+
"name": "",
|
|
1278
|
+
"type": "uint8"
|
|
1279
|
+
}
|
|
1280
|
+
],
|
|
1281
|
+
"stateMutability": "view",
|
|
1282
|
+
"type": "function"
|
|
1283
|
+
},
|
|
1284
|
+
{
|
|
1285
|
+
"inputs": [
|
|
1286
|
+
{
|
|
1287
|
+
"internalType": "uint256",
|
|
1288
|
+
"name": "escrowId",
|
|
1289
|
+
"type": "uint256"
|
|
1290
|
+
}
|
|
1291
|
+
],
|
|
1292
|
+
"name": "getFundWeights",
|
|
1293
|
+
"outputs": [
|
|
1294
|
+
{
|
|
1295
|
+
"internalType": "uint8[]",
|
|
1296
|
+
"name": "",
|
|
1297
|
+
"type": "uint8[]"
|
|
1298
|
+
}
|
|
1299
|
+
],
|
|
1300
|
+
"stateMutability": "view",
|
|
1301
|
+
"type": "function"
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
"inputs": [
|
|
1305
|
+
{
|
|
1306
|
+
"internalType": "address",
|
|
1307
|
+
"name": "_platformSigner",
|
|
1308
|
+
"type": "address"
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
"internalType": "address",
|
|
1312
|
+
"name": "_platformFund",
|
|
1313
|
+
"type": "address"
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
"internalType": "address",
|
|
1317
|
+
"name": "_owner",
|
|
1318
|
+
"type": "address"
|
|
1319
|
+
}
|
|
1320
|
+
],
|
|
1321
|
+
"name": "initialize",
|
|
1322
|
+
"outputs": [],
|
|
1323
|
+
"stateMutability": "nonpayable",
|
|
1324
|
+
"type": "function"
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
"inputs": [],
|
|
1328
|
+
"name": "nextEscrowId",
|
|
1329
|
+
"outputs": [
|
|
1330
|
+
{
|
|
1331
|
+
"internalType": "uint256",
|
|
1332
|
+
"name": "",
|
|
1333
|
+
"type": "uint256"
|
|
1334
|
+
}
|
|
1335
|
+
],
|
|
1336
|
+
"stateMutability": "view",
|
|
1337
|
+
"type": "function"
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
"inputs": [],
|
|
1341
|
+
"name": "owner",
|
|
1342
|
+
"outputs": [
|
|
1343
|
+
{
|
|
1344
|
+
"internalType": "address",
|
|
1345
|
+
"name": "",
|
|
1346
|
+
"type": "address"
|
|
1347
|
+
}
|
|
1348
|
+
],
|
|
1349
|
+
"stateMutability": "view",
|
|
1350
|
+
"type": "function"
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
"inputs": [],
|
|
1354
|
+
"name": "platformFund",
|
|
1355
|
+
"outputs": [
|
|
1356
|
+
{
|
|
1357
|
+
"internalType": "address",
|
|
1358
|
+
"name": "",
|
|
1359
|
+
"type": "address"
|
|
1360
|
+
}
|
|
1361
|
+
],
|
|
1362
|
+
"stateMutability": "view",
|
|
1363
|
+
"type": "function"
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
"inputs": [],
|
|
1367
|
+
"name": "platformSigner",
|
|
1368
|
+
"outputs": [
|
|
1369
|
+
{
|
|
1370
|
+
"internalType": "address",
|
|
1371
|
+
"name": "",
|
|
1372
|
+
"type": "address"
|
|
1373
|
+
}
|
|
1374
|
+
],
|
|
1375
|
+
"stateMutability": "view",
|
|
1376
|
+
"type": "function"
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
"inputs": [],
|
|
1380
|
+
"name": "proxiableUUID",
|
|
1381
|
+
"outputs": [
|
|
1382
|
+
{
|
|
1383
|
+
"internalType": "bytes32",
|
|
1384
|
+
"name": "",
|
|
1385
|
+
"type": "bytes32"
|
|
1386
|
+
}
|
|
1387
|
+
],
|
|
1388
|
+
"stateMutability": "view",
|
|
1389
|
+
"type": "function"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
"inputs": [],
|
|
1393
|
+
"name": "renounceOwnership",
|
|
1394
|
+
"outputs": [],
|
|
1395
|
+
"stateMutability": "nonpayable",
|
|
1396
|
+
"type": "function"
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
"inputs": [],
|
|
1400
|
+
"name": "reputationRegistry",
|
|
1401
|
+
"outputs": [
|
|
1402
|
+
{
|
|
1403
|
+
"internalType": "contract IAgentPactReputationRegistry",
|
|
1404
|
+
"name": "",
|
|
1405
|
+
"type": "address"
|
|
1406
|
+
}
|
|
1407
|
+
],
|
|
1408
|
+
"stateMutability": "view",
|
|
1409
|
+
"type": "function"
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
"inputs": [
|
|
1413
|
+
{
|
|
1414
|
+
"internalType": "uint256",
|
|
1415
|
+
"name": "escrowId",
|
|
1416
|
+
"type": "uint256"
|
|
1417
|
+
},
|
|
1418
|
+
{
|
|
1419
|
+
"internalType": "bytes32",
|
|
1420
|
+
"name": "reasonHash",
|
|
1421
|
+
"type": "bytes32"
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
"internalType": "bool[]",
|
|
1425
|
+
"name": "criteriaResults",
|
|
1426
|
+
"type": "bool[]"
|
|
1427
|
+
}
|
|
1428
|
+
],
|
|
1429
|
+
"name": "requestRevision",
|
|
1430
|
+
"outputs": [],
|
|
1431
|
+
"stateMutability": "nonpayable",
|
|
1432
|
+
"type": "function"
|
|
1433
|
+
},
|
|
1434
|
+
{
|
|
1435
|
+
"inputs": [
|
|
1436
|
+
{
|
|
1437
|
+
"internalType": "address",
|
|
1438
|
+
"name": "token",
|
|
1439
|
+
"type": "address"
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
"internalType": "bool",
|
|
1443
|
+
"name": "allowed",
|
|
1444
|
+
"type": "bool"
|
|
1445
|
+
}
|
|
1446
|
+
],
|
|
1447
|
+
"name": "setAllowedToken",
|
|
1448
|
+
"outputs": [],
|
|
1449
|
+
"stateMutability": "nonpayable",
|
|
1450
|
+
"type": "function"
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
"inputs": [
|
|
1454
|
+
{
|
|
1455
|
+
"internalType": "address",
|
|
1456
|
+
"name": "newFund",
|
|
1457
|
+
"type": "address"
|
|
1458
|
+
}
|
|
1459
|
+
],
|
|
1460
|
+
"name": "setPlatformFund",
|
|
1461
|
+
"outputs": [],
|
|
1462
|
+
"stateMutability": "nonpayable",
|
|
1463
|
+
"type": "function"
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
"inputs": [
|
|
1467
|
+
{
|
|
1468
|
+
"internalType": "address",
|
|
1469
|
+
"name": "newSigner",
|
|
1470
|
+
"type": "address"
|
|
1471
|
+
}
|
|
1472
|
+
],
|
|
1473
|
+
"name": "setPlatformSigner",
|
|
1474
|
+
"outputs": [],
|
|
1475
|
+
"stateMutability": "nonpayable",
|
|
1476
|
+
"type": "function"
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
"inputs": [
|
|
1480
|
+
{
|
|
1481
|
+
"internalType": "address",
|
|
1482
|
+
"name": "_treasury",
|
|
1483
|
+
"type": "address"
|
|
1484
|
+
}
|
|
1485
|
+
],
|
|
1486
|
+
"name": "setTreasury",
|
|
1487
|
+
"outputs": [],
|
|
1488
|
+
"stateMutability": "nonpayable",
|
|
1489
|
+
"type": "function"
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
"inputs": [
|
|
1493
|
+
{
|
|
1494
|
+
"internalType": "uint256",
|
|
1495
|
+
"name": "escrowId",
|
|
1496
|
+
"type": "uint256"
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
"internalType": "bytes32",
|
|
1500
|
+
"name": "deliveryHash",
|
|
1501
|
+
"type": "bytes32"
|
|
1502
|
+
}
|
|
1503
|
+
],
|
|
1504
|
+
"name": "submitDelivery",
|
|
1505
|
+
"outputs": [],
|
|
1506
|
+
"stateMutability": "nonpayable",
|
|
1507
|
+
"type": "function"
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
"inputs": [
|
|
1511
|
+
{
|
|
1512
|
+
"internalType": "address",
|
|
1513
|
+
"name": "newOwner",
|
|
1514
|
+
"type": "address"
|
|
1515
|
+
}
|
|
1516
|
+
],
|
|
1517
|
+
"name": "transferOwnership",
|
|
1518
|
+
"outputs": [],
|
|
1519
|
+
"stateMutability": "nonpayable",
|
|
1520
|
+
"type": "function"
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
"inputs": [],
|
|
1524
|
+
"name": "treasuryContract",
|
|
1525
|
+
"outputs": [
|
|
1526
|
+
{
|
|
1527
|
+
"internalType": "contract IAgentPactTreasury",
|
|
1528
|
+
"name": "",
|
|
1529
|
+
"type": "address"
|
|
1530
|
+
}
|
|
1531
|
+
],
|
|
1532
|
+
"stateMutability": "view",
|
|
1533
|
+
"type": "function"
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
"inputs": [
|
|
1537
|
+
{
|
|
1538
|
+
"internalType": "address",
|
|
1539
|
+
"name": "newImplementation",
|
|
1540
|
+
"type": "address"
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
"internalType": "bytes",
|
|
1544
|
+
"name": "data",
|
|
1545
|
+
"type": "bytes"
|
|
1546
|
+
}
|
|
1547
|
+
],
|
|
1548
|
+
"name": "upgradeToAndCall",
|
|
1549
|
+
"outputs": [],
|
|
1550
|
+
"stateMutability": "payable",
|
|
1551
|
+
"type": "function"
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
"stateMutability": "payable",
|
|
1555
|
+
"type": "receive"
|
|
1556
|
+
}
|
|
1557
|
+
];
|
|
1558
|
+
var TIPJAR_ABI = [
|
|
1559
|
+
{
|
|
1560
|
+
"inputs": [],
|
|
1561
|
+
"stateMutability": "nonpayable",
|
|
1562
|
+
"type": "constructor"
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
"inputs": [
|
|
1566
|
+
{
|
|
1567
|
+
"internalType": "address",
|
|
1568
|
+
"name": "target",
|
|
1569
|
+
"type": "address"
|
|
1570
|
+
}
|
|
1571
|
+
],
|
|
1572
|
+
"name": "AddressEmptyCode",
|
|
1573
|
+
"type": "error"
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
"inputs": [],
|
|
1577
|
+
"name": "BelowMinTip",
|
|
1578
|
+
"type": "error"
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
"inputs": [],
|
|
1582
|
+
"name": "ECDSAInvalidSignature",
|
|
1583
|
+
"type": "error"
|
|
1584
|
+
},
|
|
1585
|
+
{
|
|
1586
|
+
"inputs": [
|
|
1587
|
+
{
|
|
1588
|
+
"internalType": "uint256",
|
|
1589
|
+
"name": "length",
|
|
1590
|
+
"type": "uint256"
|
|
1591
|
+
}
|
|
1592
|
+
],
|
|
1593
|
+
"name": "ECDSAInvalidSignatureLength",
|
|
1594
|
+
"type": "error"
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
"inputs": [
|
|
1598
|
+
{
|
|
1599
|
+
"internalType": "bytes32",
|
|
1600
|
+
"name": "s",
|
|
1601
|
+
"type": "bytes32"
|
|
1602
|
+
}
|
|
1603
|
+
],
|
|
1604
|
+
"name": "ECDSAInvalidSignatureS",
|
|
1605
|
+
"type": "error"
|
|
1606
|
+
},
|
|
1607
|
+
{
|
|
1608
|
+
"inputs": [
|
|
1609
|
+
{
|
|
1610
|
+
"internalType": "address",
|
|
1611
|
+
"name": "implementation",
|
|
1612
|
+
"type": "address"
|
|
1613
|
+
}
|
|
1614
|
+
],
|
|
1615
|
+
"name": "ERC1967InvalidImplementation",
|
|
1616
|
+
"type": "error"
|
|
1617
|
+
},
|
|
1618
|
+
{
|
|
1619
|
+
"inputs": [],
|
|
1620
|
+
"name": "ERC1967NonPayable",
|
|
1621
|
+
"type": "error"
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
"inputs": [],
|
|
1625
|
+
"name": "ExceedsDailyCap",
|
|
1626
|
+
"type": "error"
|
|
1627
|
+
},
|
|
1628
|
+
{
|
|
1629
|
+
"inputs": [],
|
|
1630
|
+
"name": "ExceedsMaxTip",
|
|
1631
|
+
"type": "error"
|
|
1632
|
+
},
|
|
1633
|
+
{
|
|
1634
|
+
"inputs": [],
|
|
1635
|
+
"name": "FailedCall",
|
|
1636
|
+
"type": "error"
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
"inputs": [],
|
|
1640
|
+
"name": "FeeTooHigh",
|
|
1641
|
+
"type": "error"
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
"inputs": [],
|
|
1645
|
+
"name": "InsufficientAllowance",
|
|
1646
|
+
"type": "error"
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
"inputs": [],
|
|
1650
|
+
"name": "InvalidInitialization",
|
|
1651
|
+
"type": "error"
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
"inputs": [],
|
|
1655
|
+
"name": "InvalidSignature",
|
|
1656
|
+
"type": "error"
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
"inputs": [],
|
|
1660
|
+
"name": "NonceAlreadyUsed",
|
|
1661
|
+
"type": "error"
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
"inputs": [],
|
|
1665
|
+
"name": "NotInitializing",
|
|
1666
|
+
"type": "error"
|
|
1667
|
+
},
|
|
1668
|
+
{
|
|
1669
|
+
"inputs": [
|
|
1670
|
+
{
|
|
1671
|
+
"internalType": "address",
|
|
1672
|
+
"name": "owner",
|
|
1673
|
+
"type": "address"
|
|
1674
|
+
}
|
|
1675
|
+
],
|
|
1676
|
+
"name": "OwnableInvalidOwner",
|
|
1677
|
+
"type": "error"
|
|
1678
|
+
},
|
|
1679
|
+
{
|
|
1680
|
+
"inputs": [
|
|
1681
|
+
{
|
|
1682
|
+
"internalType": "address",
|
|
1683
|
+
"name": "account",
|
|
1684
|
+
"type": "address"
|
|
1685
|
+
}
|
|
1686
|
+
],
|
|
1687
|
+
"name": "OwnableUnauthorizedAccount",
|
|
1688
|
+
"type": "error"
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
"inputs": [],
|
|
1692
|
+
"name": "ReentrancyGuardReentrantCall",
|
|
1693
|
+
"type": "error"
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
"inputs": [
|
|
1697
|
+
{
|
|
1698
|
+
"internalType": "address",
|
|
1699
|
+
"name": "token",
|
|
1700
|
+
"type": "address"
|
|
1701
|
+
}
|
|
1702
|
+
],
|
|
1703
|
+
"name": "SafeERC20FailedOperation",
|
|
1704
|
+
"type": "error"
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
"inputs": [],
|
|
1708
|
+
"name": "SelfTipNotAllowed",
|
|
1709
|
+
"type": "error"
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
"inputs": [],
|
|
1713
|
+
"name": "SignatureExpired",
|
|
1714
|
+
"type": "error"
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
"inputs": [],
|
|
1718
|
+
"name": "TippingPausedError",
|
|
1719
|
+
"type": "error"
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
"inputs": [],
|
|
1723
|
+
"name": "UUPSUnauthorizedCallContext",
|
|
1724
|
+
"type": "error"
|
|
1725
|
+
},
|
|
1726
|
+
{
|
|
1727
|
+
"inputs": [
|
|
1728
|
+
{
|
|
1729
|
+
"internalType": "bytes32",
|
|
1730
|
+
"name": "slot",
|
|
1731
|
+
"type": "bytes32"
|
|
1732
|
+
}
|
|
1733
|
+
],
|
|
1734
|
+
"name": "UUPSUnsupportedProxiableUUID",
|
|
1735
|
+
"type": "error"
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
"inputs": [],
|
|
1739
|
+
"name": "ZeroAddress",
|
|
1740
|
+
"type": "error"
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
"inputs": [],
|
|
1744
|
+
"name": "ZeroAmount",
|
|
1745
|
+
"type": "error"
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
"anonymous": false,
|
|
1749
|
+
"inputs": [
|
|
1750
|
+
{
|
|
1751
|
+
"indexed": false,
|
|
1752
|
+
"internalType": "uint256",
|
|
1753
|
+
"name": "oldCap",
|
|
1754
|
+
"type": "uint256"
|
|
1755
|
+
},
|
|
1756
|
+
{
|
|
1757
|
+
"indexed": false,
|
|
1758
|
+
"internalType": "uint256",
|
|
1759
|
+
"name": "newCap",
|
|
1760
|
+
"type": "uint256"
|
|
1761
|
+
}
|
|
1762
|
+
],
|
|
1763
|
+
"name": "DailyTipCapUpdated",
|
|
1764
|
+
"type": "event"
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
"anonymous": false,
|
|
1768
|
+
"inputs": [],
|
|
1769
|
+
"name": "EIP712DomainChanged",
|
|
1770
|
+
"type": "event"
|
|
1771
|
+
},
|
|
1772
|
+
{
|
|
1773
|
+
"anonymous": false,
|
|
1774
|
+
"inputs": [
|
|
1775
|
+
{
|
|
1776
|
+
"indexed": false,
|
|
1777
|
+
"internalType": "uint64",
|
|
1778
|
+
"name": "version",
|
|
1779
|
+
"type": "uint64"
|
|
1780
|
+
}
|
|
1781
|
+
],
|
|
1782
|
+
"name": "Initialized",
|
|
1783
|
+
"type": "event"
|
|
1784
|
+
},
|
|
1785
|
+
{
|
|
1786
|
+
"anonymous": false,
|
|
1787
|
+
"inputs": [
|
|
1788
|
+
{
|
|
1789
|
+
"indexed": false,
|
|
1790
|
+
"internalType": "uint256",
|
|
1791
|
+
"name": "oldMax",
|
|
1792
|
+
"type": "uint256"
|
|
1793
|
+
},
|
|
1794
|
+
{
|
|
1795
|
+
"indexed": false,
|
|
1796
|
+
"internalType": "uint256",
|
|
1797
|
+
"name": "newMax",
|
|
1798
|
+
"type": "uint256"
|
|
1799
|
+
}
|
|
1800
|
+
],
|
|
1801
|
+
"name": "MaxTipAmountUpdated",
|
|
1802
|
+
"type": "event"
|
|
1803
|
+
},
|
|
1804
|
+
{
|
|
1805
|
+
"anonymous": false,
|
|
1806
|
+
"inputs": [
|
|
1807
|
+
{
|
|
1808
|
+
"indexed": true,
|
|
1809
|
+
"internalType": "address",
|
|
1810
|
+
"name": "previousOwner",
|
|
1811
|
+
"type": "address"
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
"indexed": true,
|
|
1815
|
+
"internalType": "address",
|
|
1816
|
+
"name": "newOwner",
|
|
1817
|
+
"type": "address"
|
|
1818
|
+
}
|
|
1819
|
+
],
|
|
1820
|
+
"name": "OwnershipTransferred",
|
|
1821
|
+
"type": "event"
|
|
1822
|
+
},
|
|
1823
|
+
{
|
|
1824
|
+
"anonymous": false,
|
|
1825
|
+
"inputs": [
|
|
1826
|
+
{
|
|
1827
|
+
"indexed": false,
|
|
1828
|
+
"internalType": "uint16",
|
|
1829
|
+
"name": "oldFeeBps",
|
|
1830
|
+
"type": "uint16"
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
"indexed": false,
|
|
1834
|
+
"internalType": "uint16",
|
|
1835
|
+
"name": "newFeeBps",
|
|
1836
|
+
"type": "uint16"
|
|
1837
|
+
}
|
|
1838
|
+
],
|
|
1839
|
+
"name": "PlatformFeeUpdated",
|
|
1840
|
+
"type": "event"
|
|
1841
|
+
},
|
|
1842
|
+
{
|
|
1843
|
+
"anonymous": false,
|
|
1844
|
+
"inputs": [
|
|
1845
|
+
{
|
|
1846
|
+
"indexed": false,
|
|
1847
|
+
"internalType": "address",
|
|
1848
|
+
"name": "oldSigner",
|
|
1849
|
+
"type": "address"
|
|
1850
|
+
},
|
|
1851
|
+
{
|
|
1852
|
+
"indexed": false,
|
|
1853
|
+
"internalType": "address",
|
|
1854
|
+
"name": "newSigner",
|
|
1855
|
+
"type": "address"
|
|
1856
|
+
}
|
|
1857
|
+
],
|
|
1858
|
+
"name": "PlatformSignerUpdated",
|
|
1859
|
+
"type": "event"
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
"anonymous": false,
|
|
1863
|
+
"inputs": [
|
|
1864
|
+
{
|
|
1865
|
+
"indexed": true,
|
|
1866
|
+
"internalType": "address",
|
|
1867
|
+
"name": "from",
|
|
1868
|
+
"type": "address"
|
|
1869
|
+
},
|
|
1870
|
+
{
|
|
1871
|
+
"indexed": true,
|
|
1872
|
+
"internalType": "address",
|
|
1873
|
+
"name": "to",
|
|
1874
|
+
"type": "address"
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
"indexed": false,
|
|
1878
|
+
"internalType": "uint256",
|
|
1879
|
+
"name": "amount",
|
|
1880
|
+
"type": "uint256"
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
"indexed": false,
|
|
1884
|
+
"internalType": "uint256",
|
|
1885
|
+
"name": "fee",
|
|
1886
|
+
"type": "uint256"
|
|
1887
|
+
},
|
|
1888
|
+
{
|
|
1889
|
+
"indexed": false,
|
|
1890
|
+
"internalType": "string",
|
|
1891
|
+
"name": "postId",
|
|
1892
|
+
"type": "string"
|
|
1893
|
+
}
|
|
1894
|
+
],
|
|
1895
|
+
"name": "TipSent",
|
|
1896
|
+
"type": "event"
|
|
1897
|
+
},
|
|
1898
|
+
{
|
|
1899
|
+
"anonymous": false,
|
|
1900
|
+
"inputs": [
|
|
1901
|
+
{
|
|
1902
|
+
"indexed": false,
|
|
1903
|
+
"internalType": "bool",
|
|
1904
|
+
"name": "paused",
|
|
1905
|
+
"type": "bool"
|
|
1906
|
+
}
|
|
1907
|
+
],
|
|
1908
|
+
"name": "TippingPaused",
|
|
1909
|
+
"type": "event"
|
|
1910
|
+
},
|
|
1911
|
+
{
|
|
1912
|
+
"anonymous": false,
|
|
1913
|
+
"inputs": [
|
|
1914
|
+
{
|
|
1915
|
+
"indexed": false,
|
|
1916
|
+
"internalType": "address",
|
|
1917
|
+
"name": "oldTreasury",
|
|
1918
|
+
"type": "address"
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
"indexed": false,
|
|
1922
|
+
"internalType": "address",
|
|
1923
|
+
"name": "newTreasury",
|
|
1924
|
+
"type": "address"
|
|
1925
|
+
}
|
|
1926
|
+
],
|
|
1927
|
+
"name": "TreasuryUpdated",
|
|
1928
|
+
"type": "event"
|
|
1929
|
+
},
|
|
1930
|
+
{
|
|
1931
|
+
"anonymous": false,
|
|
1932
|
+
"inputs": [
|
|
1933
|
+
{
|
|
1934
|
+
"indexed": true,
|
|
1935
|
+
"internalType": "address",
|
|
1936
|
+
"name": "implementation",
|
|
1937
|
+
"type": "address"
|
|
1938
|
+
}
|
|
1939
|
+
],
|
|
1940
|
+
"name": "Upgraded",
|
|
1941
|
+
"type": "event"
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
"inputs": [],
|
|
1945
|
+
"name": "MAX_FEE_BPS",
|
|
1946
|
+
"outputs": [
|
|
1947
|
+
{
|
|
1948
|
+
"internalType": "uint16",
|
|
1949
|
+
"name": "",
|
|
1950
|
+
"type": "uint16"
|
|
1951
|
+
}
|
|
1952
|
+
],
|
|
1953
|
+
"stateMutability": "view",
|
|
1954
|
+
"type": "function"
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
"inputs": [],
|
|
1958
|
+
"name": "MIN_TIP_AMOUNT",
|
|
1959
|
+
"outputs": [
|
|
1960
|
+
{
|
|
1961
|
+
"internalType": "uint256",
|
|
1962
|
+
"name": "",
|
|
1963
|
+
"type": "uint256"
|
|
1964
|
+
}
|
|
1965
|
+
],
|
|
1966
|
+
"stateMutability": "view",
|
|
1967
|
+
"type": "function"
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
"inputs": [],
|
|
1971
|
+
"name": "TIP_TYPEHASH",
|
|
1972
|
+
"outputs": [
|
|
1973
|
+
{
|
|
1974
|
+
"internalType": "bytes32",
|
|
1975
|
+
"name": "",
|
|
1976
|
+
"type": "bytes32"
|
|
1977
|
+
}
|
|
1978
|
+
],
|
|
1979
|
+
"stateMutability": "view",
|
|
1980
|
+
"type": "function"
|
|
1981
|
+
},
|
|
1982
|
+
{
|
|
1983
|
+
"inputs": [],
|
|
1984
|
+
"name": "UPGRADE_INTERFACE_VERSION",
|
|
1985
|
+
"outputs": [
|
|
1986
|
+
{
|
|
1987
|
+
"internalType": "string",
|
|
1988
|
+
"name": "",
|
|
1989
|
+
"type": "string"
|
|
1990
|
+
}
|
|
1991
|
+
],
|
|
1992
|
+
"stateMutability": "view",
|
|
1993
|
+
"type": "function"
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
"inputs": [],
|
|
1997
|
+
"name": "dailyTipCap",
|
|
1998
|
+
"outputs": [
|
|
1999
|
+
{
|
|
2000
|
+
"internalType": "uint256",
|
|
2001
|
+
"name": "",
|
|
2002
|
+
"type": "uint256"
|
|
2003
|
+
}
|
|
2004
|
+
],
|
|
2005
|
+
"stateMutability": "view",
|
|
2006
|
+
"type": "function"
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
"inputs": [
|
|
2010
|
+
{
|
|
2011
|
+
"internalType": "address",
|
|
2012
|
+
"name": "user",
|
|
2013
|
+
"type": "address"
|
|
2014
|
+
}
|
|
2015
|
+
],
|
|
2016
|
+
"name": "dailyTipSpent",
|
|
2017
|
+
"outputs": [
|
|
2018
|
+
{
|
|
2019
|
+
"internalType": "uint256",
|
|
2020
|
+
"name": "",
|
|
2021
|
+
"type": "uint256"
|
|
2022
|
+
}
|
|
2023
|
+
],
|
|
2024
|
+
"stateMutability": "view",
|
|
2025
|
+
"type": "function"
|
|
2026
|
+
},
|
|
2027
|
+
{
|
|
2028
|
+
"inputs": [],
|
|
2029
|
+
"name": "domainSeparator",
|
|
2030
|
+
"outputs": [
|
|
2031
|
+
{
|
|
2032
|
+
"internalType": "bytes32",
|
|
2033
|
+
"name": "",
|
|
2034
|
+
"type": "bytes32"
|
|
2035
|
+
}
|
|
2036
|
+
],
|
|
2037
|
+
"stateMutability": "view",
|
|
2038
|
+
"type": "function"
|
|
2039
|
+
},
|
|
2040
|
+
{
|
|
2041
|
+
"inputs": [],
|
|
2042
|
+
"name": "eip712Domain",
|
|
2043
|
+
"outputs": [
|
|
2044
|
+
{
|
|
2045
|
+
"internalType": "bytes1",
|
|
2046
|
+
"name": "fields",
|
|
2047
|
+
"type": "bytes1"
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
"internalType": "string",
|
|
2051
|
+
"name": "name",
|
|
2052
|
+
"type": "string"
|
|
2053
|
+
},
|
|
2054
|
+
{
|
|
2055
|
+
"internalType": "string",
|
|
2056
|
+
"name": "version",
|
|
2057
|
+
"type": "string"
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
"internalType": "uint256",
|
|
2061
|
+
"name": "chainId",
|
|
2062
|
+
"type": "uint256"
|
|
2063
|
+
},
|
|
2064
|
+
{
|
|
2065
|
+
"internalType": "address",
|
|
2066
|
+
"name": "verifyingContract",
|
|
2067
|
+
"type": "address"
|
|
2068
|
+
},
|
|
2069
|
+
{
|
|
2070
|
+
"internalType": "bytes32",
|
|
2071
|
+
"name": "salt",
|
|
2072
|
+
"type": "bytes32"
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
"internalType": "uint256[]",
|
|
2076
|
+
"name": "extensions",
|
|
2077
|
+
"type": "uint256[]"
|
|
2078
|
+
}
|
|
2079
|
+
],
|
|
2080
|
+
"stateMutability": "view",
|
|
2081
|
+
"type": "function"
|
|
2082
|
+
},
|
|
2083
|
+
{
|
|
2084
|
+
"inputs": [
|
|
2085
|
+
{
|
|
2086
|
+
"internalType": "address",
|
|
2087
|
+
"name": "_usdc",
|
|
2088
|
+
"type": "address"
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
"internalType": "address",
|
|
2092
|
+
"name": "_platformSigner",
|
|
2093
|
+
"type": "address"
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
"internalType": "address",
|
|
2097
|
+
"name": "_treasury",
|
|
2098
|
+
"type": "address"
|
|
2099
|
+
},
|
|
2100
|
+
{
|
|
2101
|
+
"internalType": "address",
|
|
2102
|
+
"name": "_owner",
|
|
2103
|
+
"type": "address"
|
|
2104
|
+
}
|
|
2105
|
+
],
|
|
2106
|
+
"name": "initialize",
|
|
2107
|
+
"outputs": [],
|
|
2108
|
+
"stateMutability": "nonpayable",
|
|
2109
|
+
"type": "function"
|
|
2110
|
+
},
|
|
2111
|
+
{
|
|
2112
|
+
"inputs": [
|
|
2113
|
+
{
|
|
2114
|
+
"internalType": "address",
|
|
2115
|
+
"name": "tipper",
|
|
2116
|
+
"type": "address"
|
|
2117
|
+
},
|
|
2118
|
+
{
|
|
2119
|
+
"internalType": "uint256",
|
|
2120
|
+
"name": "nonce",
|
|
2121
|
+
"type": "uint256"
|
|
2122
|
+
}
|
|
2123
|
+
],
|
|
2124
|
+
"name": "isNonceUsed",
|
|
2125
|
+
"outputs": [
|
|
2126
|
+
{
|
|
2127
|
+
"internalType": "bool",
|
|
2128
|
+
"name": "",
|
|
2129
|
+
"type": "bool"
|
|
2130
|
+
}
|
|
2131
|
+
],
|
|
2132
|
+
"stateMutability": "view",
|
|
2133
|
+
"type": "function"
|
|
2134
|
+
},
|
|
2135
|
+
{
|
|
2136
|
+
"inputs": [],
|
|
2137
|
+
"name": "maxTipAmount",
|
|
2138
|
+
"outputs": [
|
|
2139
|
+
{
|
|
2140
|
+
"internalType": "uint256",
|
|
2141
|
+
"name": "",
|
|
2142
|
+
"type": "uint256"
|
|
2143
|
+
}
|
|
2144
|
+
],
|
|
2145
|
+
"stateMutability": "view",
|
|
2146
|
+
"type": "function"
|
|
2147
|
+
},
|
|
2148
|
+
{
|
|
2149
|
+
"inputs": [],
|
|
2150
|
+
"name": "owner",
|
|
2151
|
+
"outputs": [
|
|
2152
|
+
{
|
|
2153
|
+
"internalType": "address",
|
|
2154
|
+
"name": "",
|
|
2155
|
+
"type": "address"
|
|
2156
|
+
}
|
|
2157
|
+
],
|
|
2158
|
+
"stateMutability": "view",
|
|
2159
|
+
"type": "function"
|
|
2160
|
+
},
|
|
2161
|
+
{
|
|
2162
|
+
"inputs": [],
|
|
2163
|
+
"name": "paused",
|
|
2164
|
+
"outputs": [
|
|
2165
|
+
{
|
|
2166
|
+
"internalType": "bool",
|
|
2167
|
+
"name": "",
|
|
2168
|
+
"type": "bool"
|
|
2169
|
+
}
|
|
2170
|
+
],
|
|
2171
|
+
"stateMutability": "view",
|
|
2172
|
+
"type": "function"
|
|
2173
|
+
},
|
|
2174
|
+
{
|
|
2175
|
+
"inputs": [],
|
|
2176
|
+
"name": "platformFeeBps",
|
|
2177
|
+
"outputs": [
|
|
2178
|
+
{
|
|
2179
|
+
"internalType": "uint16",
|
|
2180
|
+
"name": "",
|
|
2181
|
+
"type": "uint16"
|
|
2182
|
+
}
|
|
2183
|
+
],
|
|
2184
|
+
"stateMutability": "view",
|
|
2185
|
+
"type": "function"
|
|
2186
|
+
},
|
|
2187
|
+
{
|
|
2188
|
+
"inputs": [],
|
|
2189
|
+
"name": "platformSigner",
|
|
2190
|
+
"outputs": [
|
|
2191
|
+
{
|
|
2192
|
+
"internalType": "address",
|
|
2193
|
+
"name": "",
|
|
2194
|
+
"type": "address"
|
|
2195
|
+
}
|
|
2196
|
+
],
|
|
2197
|
+
"stateMutability": "view",
|
|
2198
|
+
"type": "function"
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
"inputs": [],
|
|
2202
|
+
"name": "proxiableUUID",
|
|
2203
|
+
"outputs": [
|
|
2204
|
+
{
|
|
2205
|
+
"internalType": "bytes32",
|
|
2206
|
+
"name": "",
|
|
2207
|
+
"type": "bytes32"
|
|
2208
|
+
}
|
|
2209
|
+
],
|
|
2210
|
+
"stateMutability": "view",
|
|
2211
|
+
"type": "function"
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
"inputs": [],
|
|
2215
|
+
"name": "renounceOwnership",
|
|
2216
|
+
"outputs": [],
|
|
2217
|
+
"stateMutability": "nonpayable",
|
|
2218
|
+
"type": "function"
|
|
2219
|
+
},
|
|
2220
|
+
{
|
|
2221
|
+
"inputs": [],
|
|
2222
|
+
"name": "reputationRegistry",
|
|
2223
|
+
"outputs": [
|
|
2224
|
+
{
|
|
2225
|
+
"internalType": "contract IAgentPactReputationRegistry",
|
|
2226
|
+
"name": "",
|
|
2227
|
+
"type": "address"
|
|
2228
|
+
}
|
|
2229
|
+
],
|
|
2230
|
+
"stateMutability": "view",
|
|
2231
|
+
"type": "function"
|
|
2232
|
+
},
|
|
2233
|
+
{
|
|
2234
|
+
"inputs": [
|
|
2235
|
+
{
|
|
2236
|
+
"internalType": "uint256",
|
|
2237
|
+
"name": "newCap",
|
|
2238
|
+
"type": "uint256"
|
|
2239
|
+
}
|
|
2240
|
+
],
|
|
2241
|
+
"name": "setDailyTipCap",
|
|
2242
|
+
"outputs": [],
|
|
2243
|
+
"stateMutability": "nonpayable",
|
|
2244
|
+
"type": "function"
|
|
2245
|
+
},
|
|
2246
|
+
{
|
|
2247
|
+
"inputs": [
|
|
2248
|
+
{
|
|
2249
|
+
"internalType": "uint256",
|
|
2250
|
+
"name": "newMax",
|
|
2251
|
+
"type": "uint256"
|
|
2252
|
+
}
|
|
2253
|
+
],
|
|
2254
|
+
"name": "setMaxTipAmount",
|
|
2255
|
+
"outputs": [],
|
|
2256
|
+
"stateMutability": "nonpayable",
|
|
2257
|
+
"type": "function"
|
|
2258
|
+
},
|
|
2259
|
+
{
|
|
2260
|
+
"inputs": [
|
|
2261
|
+
{
|
|
2262
|
+
"internalType": "bool",
|
|
2263
|
+
"name": "_paused",
|
|
2264
|
+
"type": "bool"
|
|
2265
|
+
}
|
|
2266
|
+
],
|
|
2267
|
+
"name": "setPaused",
|
|
2268
|
+
"outputs": [],
|
|
2269
|
+
"stateMutability": "nonpayable",
|
|
2270
|
+
"type": "function"
|
|
2271
|
+
},
|
|
2272
|
+
{
|
|
2273
|
+
"inputs": [
|
|
2274
|
+
{
|
|
2275
|
+
"internalType": "uint16",
|
|
2276
|
+
"name": "newFeeBps",
|
|
2277
|
+
"type": "uint16"
|
|
2278
|
+
}
|
|
2279
|
+
],
|
|
2280
|
+
"name": "setPlatformFeeBps",
|
|
2281
|
+
"outputs": [],
|
|
2282
|
+
"stateMutability": "nonpayable",
|
|
2283
|
+
"type": "function"
|
|
2284
|
+
},
|
|
2285
|
+
{
|
|
2286
|
+
"inputs": [
|
|
2287
|
+
{
|
|
2288
|
+
"internalType": "address",
|
|
2289
|
+
"name": "newSigner",
|
|
2290
|
+
"type": "address"
|
|
2291
|
+
}
|
|
2292
|
+
],
|
|
2293
|
+
"name": "setPlatformSigner",
|
|
2294
|
+
"outputs": [],
|
|
2295
|
+
"stateMutability": "nonpayable",
|
|
2296
|
+
"type": "function"
|
|
2297
|
+
},
|
|
2298
|
+
{
|
|
2299
|
+
"inputs": [
|
|
2300
|
+
{
|
|
2301
|
+
"internalType": "address",
|
|
2302
|
+
"name": "registry",
|
|
2303
|
+
"type": "address"
|
|
2304
|
+
}
|
|
2305
|
+
],
|
|
2306
|
+
"name": "setReputationRegistry",
|
|
2307
|
+
"outputs": [],
|
|
2308
|
+
"stateMutability": "nonpayable",
|
|
2309
|
+
"type": "function"
|
|
2310
|
+
},
|
|
2311
|
+
{
|
|
2312
|
+
"inputs": [
|
|
2313
|
+
{
|
|
2314
|
+
"internalType": "address",
|
|
2315
|
+
"name": "newTreasury",
|
|
2316
|
+
"type": "address"
|
|
2317
|
+
}
|
|
2318
|
+
],
|
|
2319
|
+
"name": "setTreasury",
|
|
2320
|
+
"outputs": [],
|
|
2321
|
+
"stateMutability": "nonpayable",
|
|
2322
|
+
"type": "function"
|
|
2323
|
+
},
|
|
2324
|
+
{
|
|
2325
|
+
"inputs": [
|
|
2326
|
+
{
|
|
2327
|
+
"internalType": "address",
|
|
2328
|
+
"name": "_treasury",
|
|
2329
|
+
"type": "address"
|
|
2330
|
+
}
|
|
2331
|
+
],
|
|
2332
|
+
"name": "setTreasuryContract",
|
|
2333
|
+
"outputs": [],
|
|
2334
|
+
"stateMutability": "nonpayable",
|
|
2335
|
+
"type": "function"
|
|
2336
|
+
},
|
|
2337
|
+
{
|
|
2338
|
+
"inputs": [
|
|
2339
|
+
{
|
|
2340
|
+
"internalType": "address",
|
|
2341
|
+
"name": "_usdc",
|
|
2342
|
+
"type": "address"
|
|
2343
|
+
}
|
|
2344
|
+
],
|
|
2345
|
+
"name": "setUsdcToken",
|
|
2346
|
+
"outputs": [],
|
|
2347
|
+
"stateMutability": "nonpayable",
|
|
2348
|
+
"type": "function"
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
"inputs": [
|
|
2352
|
+
{
|
|
2353
|
+
"internalType": "address",
|
|
2354
|
+
"name": "recipient",
|
|
2355
|
+
"type": "address"
|
|
2356
|
+
},
|
|
2357
|
+
{
|
|
2358
|
+
"internalType": "uint256",
|
|
2359
|
+
"name": "amount",
|
|
2360
|
+
"type": "uint256"
|
|
2361
|
+
},
|
|
2362
|
+
{
|
|
2363
|
+
"internalType": "string",
|
|
2364
|
+
"name": "postId",
|
|
2365
|
+
"type": "string"
|
|
2366
|
+
},
|
|
2367
|
+
{
|
|
2368
|
+
"internalType": "uint256",
|
|
2369
|
+
"name": "nonce",
|
|
2370
|
+
"type": "uint256"
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
"internalType": "uint256",
|
|
2374
|
+
"name": "expiredAt",
|
|
2375
|
+
"type": "uint256"
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
"internalType": "bytes",
|
|
2379
|
+
"name": "platformSignature",
|
|
2380
|
+
"type": "bytes"
|
|
2381
|
+
}
|
|
2382
|
+
],
|
|
2383
|
+
"name": "tip",
|
|
2384
|
+
"outputs": [],
|
|
2385
|
+
"stateMutability": "nonpayable",
|
|
2386
|
+
"type": "function"
|
|
2387
|
+
},
|
|
2388
|
+
{
|
|
2389
|
+
"inputs": [
|
|
2390
|
+
{
|
|
2391
|
+
"internalType": "address",
|
|
2392
|
+
"name": "user",
|
|
2393
|
+
"type": "address"
|
|
2394
|
+
}
|
|
2395
|
+
],
|
|
2396
|
+
"name": "tipStats",
|
|
2397
|
+
"outputs": [
|
|
2398
|
+
{
|
|
2399
|
+
"components": [
|
|
2400
|
+
{
|
|
2401
|
+
"internalType": "uint256",
|
|
2402
|
+
"name": "totalSent",
|
|
2403
|
+
"type": "uint256"
|
|
2404
|
+
},
|
|
2405
|
+
{
|
|
2406
|
+
"internalType": "uint256",
|
|
2407
|
+
"name": "totalReceived",
|
|
2408
|
+
"type": "uint256"
|
|
2409
|
+
},
|
|
2410
|
+
{
|
|
2411
|
+
"internalType": "uint256",
|
|
2412
|
+
"name": "totalFeesPaid",
|
|
2413
|
+
"type": "uint256"
|
|
2414
|
+
},
|
|
2415
|
+
{
|
|
2416
|
+
"internalType": "uint64",
|
|
2417
|
+
"name": "tipsSentCount",
|
|
2418
|
+
"type": "uint64"
|
|
2419
|
+
},
|
|
2420
|
+
{
|
|
2421
|
+
"internalType": "uint64",
|
|
2422
|
+
"name": "tipsReceivedCount",
|
|
2423
|
+
"type": "uint64"
|
|
2424
|
+
}
|
|
2425
|
+
],
|
|
2426
|
+
"internalType": "struct IAgentPactTipJar.TipStats",
|
|
2427
|
+
"name": "",
|
|
2428
|
+
"type": "tuple"
|
|
2429
|
+
}
|
|
2430
|
+
],
|
|
2431
|
+
"stateMutability": "view",
|
|
2432
|
+
"type": "function"
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
"inputs": [
|
|
2436
|
+
{
|
|
2437
|
+
"internalType": "address",
|
|
2438
|
+
"name": "newOwner",
|
|
2439
|
+
"type": "address"
|
|
2440
|
+
}
|
|
2441
|
+
],
|
|
2442
|
+
"name": "transferOwnership",
|
|
2443
|
+
"outputs": [],
|
|
2444
|
+
"stateMutability": "nonpayable",
|
|
2445
|
+
"type": "function"
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
"inputs": [],
|
|
2449
|
+
"name": "treasury",
|
|
2450
|
+
"outputs": [
|
|
2451
|
+
{
|
|
2452
|
+
"internalType": "address",
|
|
2453
|
+
"name": "",
|
|
2454
|
+
"type": "address"
|
|
2455
|
+
}
|
|
2456
|
+
],
|
|
2457
|
+
"stateMutability": "view",
|
|
2458
|
+
"type": "function"
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
"inputs": [],
|
|
2462
|
+
"name": "treasuryContract",
|
|
2463
|
+
"outputs": [
|
|
2464
|
+
{
|
|
2465
|
+
"internalType": "contract IAgentPactTreasury",
|
|
2466
|
+
"name": "",
|
|
2467
|
+
"type": "address"
|
|
2468
|
+
}
|
|
2469
|
+
],
|
|
2470
|
+
"stateMutability": "view",
|
|
2471
|
+
"type": "function"
|
|
2472
|
+
},
|
|
2473
|
+
{
|
|
2474
|
+
"inputs": [
|
|
2475
|
+
{
|
|
2476
|
+
"internalType": "address",
|
|
2477
|
+
"name": "newImplementation",
|
|
2478
|
+
"type": "address"
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
"internalType": "bytes",
|
|
2482
|
+
"name": "data",
|
|
2483
|
+
"type": "bytes"
|
|
2484
|
+
}
|
|
2485
|
+
],
|
|
2486
|
+
"name": "upgradeToAndCall",
|
|
2487
|
+
"outputs": [],
|
|
2488
|
+
"stateMutability": "payable",
|
|
2489
|
+
"type": "function"
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
"inputs": [],
|
|
2493
|
+
"name": "usdcToken",
|
|
2494
|
+
"outputs": [
|
|
2495
|
+
{
|
|
2496
|
+
"internalType": "contract IERC20",
|
|
2497
|
+
"name": "",
|
|
2498
|
+
"type": "address"
|
|
2499
|
+
}
|
|
2500
|
+
],
|
|
2501
|
+
"stateMutability": "view",
|
|
2502
|
+
"type": "function"
|
|
2503
|
+
},
|
|
2504
|
+
{
|
|
2505
|
+
"inputs": [
|
|
2506
|
+
{
|
|
2507
|
+
"internalType": "bytes32",
|
|
2508
|
+
"name": "nonceHash",
|
|
2509
|
+
"type": "bytes32"
|
|
2510
|
+
}
|
|
2511
|
+
],
|
|
2512
|
+
"name": "usedNonces",
|
|
2513
|
+
"outputs": [
|
|
2514
|
+
{
|
|
2515
|
+
"internalType": "bool",
|
|
2516
|
+
"name": "",
|
|
2517
|
+
"type": "bool"
|
|
2518
|
+
}
|
|
2519
|
+
],
|
|
2520
|
+
"stateMutability": "view",
|
|
2521
|
+
"type": "function"
|
|
2522
|
+
}
|
|
2523
|
+
];
|
|
2524
|
+
|
|
2525
|
+
// src/constants.ts
|
|
2526
|
+
var ETH_TOKEN = "0x0000000000000000000000000000000000000000";
|
|
2527
|
+
var CHAIN_ID_BASE_SEPOLIA = 84532;
|
|
2528
|
+
var CHAIN_ID = CHAIN_ID_BASE_SEPOLIA;
|
|
2529
|
+
var DEFAULT_RPC_URL = "https://sepolia.base.org";
|
|
2530
|
+
var EXPLORER_URL = "https://sepolia.basescan.org";
|
|
2531
|
+
var ESCROW_ADDRESS = "0xB8C77709fF82D7F90CA1695a7495d0A33D2d19a5";
|
|
2532
|
+
var USDC_ADDRESS = "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
2533
|
+
var TIPJAR_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2534
|
+
var DEFAULT_PLATFORM_URL = "https://api.agentpact.io";
|
|
2535
|
+
var KNOWN_PLATFORMS = {
|
|
2536
|
+
mainnet: "https://api.agentpact.io",
|
|
2537
|
+
testnet: "https://testnet-api.agentpact.io",
|
|
2538
|
+
local: "http://localhost:4000"
|
|
2539
|
+
};
|
|
2540
|
+
var PLATFORM_FEE_BPS = 300n;
|
|
2541
|
+
var CONFIRMATION_WINDOW_SECONDS = 7200n;
|
|
2542
|
+
var MIN_PASS_RATE = 30;
|
|
2543
|
+
var MAX_DECLINE_COUNT = 3;
|
|
2544
|
+
var EIP712_DOMAIN = {
|
|
2545
|
+
name: "AgentPact",
|
|
2546
|
+
version: "2"
|
|
2547
|
+
};
|
|
2548
|
+
var TASK_ASSIGNMENT_TYPES = {
|
|
2549
|
+
TaskAssignment: [
|
|
2550
|
+
{ name: "escrowId", type: "uint256" },
|
|
2551
|
+
{ name: "agent", type: "address" },
|
|
2552
|
+
{ name: "nonce", type: "uint256" },
|
|
2553
|
+
{ name: "expiredAt", type: "uint256" }
|
|
2554
|
+
]
|
|
2555
|
+
};
|
|
2556
|
+
|
|
2557
|
+
// src/types.ts
|
|
2558
|
+
var TaskCategory = /* @__PURE__ */ ((TaskCategory2) => {
|
|
2559
|
+
TaskCategory2["SOFTWARE"] = "SOFTWARE";
|
|
2560
|
+
TaskCategory2["WRITING"] = "WRITING";
|
|
2561
|
+
TaskCategory2["VISUAL"] = "VISUAL";
|
|
2562
|
+
TaskCategory2["DATA"] = "DATA";
|
|
2563
|
+
TaskCategory2["MARKETING"] = "MARKETING";
|
|
2564
|
+
TaskCategory2["RESEARCH"] = "RESEARCH";
|
|
2565
|
+
TaskCategory2["SUPPORT"] = "SUPPORT";
|
|
2566
|
+
TaskCategory2["OTHER"] = "OTHER";
|
|
2567
|
+
return TaskCategory2;
|
|
2568
|
+
})(TaskCategory || {});
|
|
2569
|
+
var TaskState = /* @__PURE__ */ ((TaskState2) => {
|
|
2570
|
+
TaskState2[TaskState2["Created"] = 0] = "Created";
|
|
2571
|
+
TaskState2[TaskState2["ConfirmationPending"] = 1] = "ConfirmationPending";
|
|
2572
|
+
TaskState2[TaskState2["Working"] = 2] = "Working";
|
|
2573
|
+
TaskState2[TaskState2["Delivered"] = 3] = "Delivered";
|
|
2574
|
+
TaskState2[TaskState2["InRevision"] = 4] = "InRevision";
|
|
2575
|
+
TaskState2[TaskState2["Accepted"] = 5] = "Accepted";
|
|
2576
|
+
TaskState2[TaskState2["Settled"] = 6] = "Settled";
|
|
2577
|
+
TaskState2[TaskState2["TimedOut"] = 7] = "TimedOut";
|
|
2578
|
+
TaskState2[TaskState2["Cancelled"] = 8] = "Cancelled";
|
|
2579
|
+
return TaskState2;
|
|
2580
|
+
})(TaskState || {});
|
|
2581
|
+
var TaskStateLabel = {
|
|
2582
|
+
[0 /* Created */]: "Created",
|
|
2583
|
+
[1 /* ConfirmationPending */]: "Confirmation Pending",
|
|
2584
|
+
[2 /* Working */]: "Working",
|
|
2585
|
+
[3 /* Delivered */]: "Delivered",
|
|
2586
|
+
[4 /* InRevision */]: "In Revision",
|
|
2587
|
+
[5 /* Accepted */]: "Accepted",
|
|
2588
|
+
[6 /* Settled */]: "Settled",
|
|
2589
|
+
[7 /* TimedOut */]: "Timed Out",
|
|
2590
|
+
[8 /* Cancelled */]: "Cancelled"
|
|
2591
|
+
};
|
|
2592
|
+
|
|
2593
|
+
// src/client.ts
|
|
2594
|
+
var AgentPactClient = class _AgentPactClient {
|
|
2595
|
+
publicClient;
|
|
2596
|
+
walletClient;
|
|
2597
|
+
escrowAddress;
|
|
2598
|
+
tipJarAddress;
|
|
2599
|
+
constructor(publicClient, config, walletClient) {
|
|
2600
|
+
this.publicClient = publicClient;
|
|
2601
|
+
this.walletClient = walletClient;
|
|
2602
|
+
this.escrowAddress = config.escrowAddress;
|
|
2603
|
+
this.tipJarAddress = config.tipJarAddress;
|
|
2604
|
+
}
|
|
2605
|
+
// ========================= Read Functions =========================
|
|
2606
|
+
/** Get escrow record by ID */
|
|
2607
|
+
async getEscrow(escrowId) {
|
|
2608
|
+
const result = await this.publicClient.readContract({
|
|
2609
|
+
address: this.escrowAddress,
|
|
2610
|
+
abi: ESCROW_ABI,
|
|
2611
|
+
functionName: "getEscrow",
|
|
2612
|
+
args: [escrowId]
|
|
2613
|
+
});
|
|
2614
|
+
try {
|
|
2615
|
+
if (result.criteriaCount > 0) {
|
|
2616
|
+
const weights = await this.getFundWeights(escrowId);
|
|
2617
|
+
result.fundWeights = weights;
|
|
2618
|
+
}
|
|
2619
|
+
} catch (error) {
|
|
2620
|
+
console.warn(`Failed to fetch fund weights for escrow ${escrowId}:`, error);
|
|
2621
|
+
}
|
|
2622
|
+
return result;
|
|
2623
|
+
}
|
|
2624
|
+
/** Get the next escrow ID */
|
|
2625
|
+
async getNextEscrowId() {
|
|
2626
|
+
return this.publicClient.readContract({
|
|
2627
|
+
address: this.escrowAddress,
|
|
2628
|
+
abi: ESCROW_ABI,
|
|
2629
|
+
functionName: "nextEscrowId"
|
|
2630
|
+
});
|
|
2631
|
+
}
|
|
2632
|
+
/** Get assignment nonce for an escrow */
|
|
2633
|
+
async getAssignmentNonce(escrowId) {
|
|
2634
|
+
return this.publicClient.readContract({
|
|
2635
|
+
address: this.escrowAddress,
|
|
2636
|
+
abi: ESCROW_ABI,
|
|
2637
|
+
functionName: "assignmentNonces",
|
|
2638
|
+
args: [escrowId]
|
|
2639
|
+
});
|
|
2640
|
+
}
|
|
2641
|
+
/** Get all fund weights for an escrow (on-chain stored) */
|
|
2642
|
+
async getFundWeights(escrowId) {
|
|
2643
|
+
return this.publicClient.readContract({
|
|
2644
|
+
address: this.escrowAddress,
|
|
2645
|
+
abi: ESCROW_ABI,
|
|
2646
|
+
functionName: "getFundWeights",
|
|
2647
|
+
args: [escrowId]
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
/** Get fund weight for a specific criterion */
|
|
2651
|
+
async getFundWeight(escrowId, criteriaIndex) {
|
|
2652
|
+
return this.publicClient.readContract({
|
|
2653
|
+
address: this.escrowAddress,
|
|
2654
|
+
abi: ESCROW_ABI,
|
|
2655
|
+
functionName: "getFundWeight",
|
|
2656
|
+
args: [escrowId, criteriaIndex]
|
|
2657
|
+
});
|
|
2658
|
+
}
|
|
2659
|
+
/** Check if a token is allowed */
|
|
2660
|
+
async isTokenAllowed(token) {
|
|
2661
|
+
return this.publicClient.readContract({
|
|
2662
|
+
address: this.escrowAddress,
|
|
2663
|
+
abi: ESCROW_ABI,
|
|
2664
|
+
functionName: "allowedTokens",
|
|
2665
|
+
args: [token]
|
|
2666
|
+
});
|
|
2667
|
+
}
|
|
2668
|
+
/** Get the platform signer address */
|
|
2669
|
+
async getPlatformSigner() {
|
|
2670
|
+
return this.publicClient.readContract({
|
|
2671
|
+
address: this.escrowAddress,
|
|
2672
|
+
abi: ESCROW_ABI,
|
|
2673
|
+
functionName: "platformSigner"
|
|
2674
|
+
});
|
|
2675
|
+
}
|
|
2676
|
+
// ========================= Write Functions =========================
|
|
2677
|
+
requireWallet() {
|
|
2678
|
+
if (!this.walletClient) {
|
|
2679
|
+
throw new Error("WalletClient required for write operations");
|
|
2680
|
+
}
|
|
2681
|
+
return this.walletClient;
|
|
2682
|
+
}
|
|
2683
|
+
/**
|
|
2684
|
+
* Create a new escrow.
|
|
2685
|
+
* For ETH: pass token=ETH_TOKEN, totalAmount=0n, and include value in options.
|
|
2686
|
+
* For ERC20: pass token address and totalAmount. Will auto-approve if needed.
|
|
2687
|
+
*/
|
|
2688
|
+
async createEscrow(params, value) {
|
|
2689
|
+
const wallet = this.requireWallet();
|
|
2690
|
+
if (params.token !== ETH_TOKEN && params.totalAmount > 0n) {
|
|
2691
|
+
await this.ensureAllowance(
|
|
2692
|
+
params.token,
|
|
2693
|
+
params.totalAmount,
|
|
2694
|
+
this.escrowAddress
|
|
2695
|
+
);
|
|
2696
|
+
}
|
|
2697
|
+
return wallet.writeContract({
|
|
2698
|
+
address: this.escrowAddress,
|
|
2699
|
+
abi: ESCROW_ABI,
|
|
2700
|
+
functionName: "createEscrow",
|
|
2701
|
+
args: [
|
|
2702
|
+
params.taskHash,
|
|
2703
|
+
params.deliveryDurationSeconds,
|
|
2704
|
+
params.maxRevisions,
|
|
2705
|
+
params.acceptanceWindowHours,
|
|
2706
|
+
params.criteriaCount,
|
|
2707
|
+
params.fundWeights,
|
|
2708
|
+
params.token,
|
|
2709
|
+
params.totalAmount
|
|
2710
|
+
],
|
|
2711
|
+
value: params.token === ETH_TOKEN ? value : 0n
|
|
2712
|
+
});
|
|
2713
|
+
}
|
|
2714
|
+
/** Claim a task using platform's EIP-712 signature */
|
|
2715
|
+
async claimTask(params) {
|
|
2716
|
+
const wallet = this.requireWallet();
|
|
2717
|
+
return wallet.writeContract({
|
|
2718
|
+
address: this.escrowAddress,
|
|
2719
|
+
abi: ESCROW_ABI,
|
|
2720
|
+
functionName: "claimTask",
|
|
2721
|
+
args: [
|
|
2722
|
+
params.escrowId,
|
|
2723
|
+
params.nonce,
|
|
2724
|
+
params.expiredAt,
|
|
2725
|
+
params.platformSignature
|
|
2726
|
+
]
|
|
2727
|
+
});
|
|
2728
|
+
}
|
|
2729
|
+
/** Confirm task after reviewing materials — sets deliveryDeadline on-chain */
|
|
2730
|
+
async confirmTask(escrowId) {
|
|
2731
|
+
const wallet = this.requireWallet();
|
|
2732
|
+
return wallet.writeContract({
|
|
2733
|
+
address: this.escrowAddress,
|
|
2734
|
+
abi: ESCROW_ABI,
|
|
2735
|
+
functionName: "confirmTask",
|
|
2736
|
+
args: [escrowId]
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
/** Decline task during confirmation window (tracked on-chain, 3x causes suspension) */
|
|
2740
|
+
async declineTask(escrowId) {
|
|
2741
|
+
const wallet = this.requireWallet();
|
|
2742
|
+
return wallet.writeContract({
|
|
2743
|
+
address: this.escrowAddress,
|
|
2744
|
+
abi: ESCROW_ABI,
|
|
2745
|
+
functionName: "declineTask",
|
|
2746
|
+
args: [escrowId]
|
|
2747
|
+
});
|
|
2748
|
+
}
|
|
2749
|
+
/** Submit delivery artifacts */
|
|
2750
|
+
async submitDelivery(escrowId, deliveryHash) {
|
|
2751
|
+
const wallet = this.requireWallet();
|
|
2752
|
+
return wallet.writeContract({
|
|
2753
|
+
address: this.escrowAddress,
|
|
2754
|
+
abi: ESCROW_ABI,
|
|
2755
|
+
functionName: "submitDelivery",
|
|
2756
|
+
args: [escrowId, deliveryHash]
|
|
2757
|
+
});
|
|
2758
|
+
}
|
|
2759
|
+
/** Voluntarily abandon task during execution (lighter penalty than timeout) */
|
|
2760
|
+
async abandonTask(escrowId) {
|
|
2761
|
+
const wallet = this.requireWallet();
|
|
2762
|
+
return wallet.writeContract({
|
|
2763
|
+
address: this.escrowAddress,
|
|
2764
|
+
abi: ESCROW_ABI,
|
|
2765
|
+
functionName: "abandonTask",
|
|
2766
|
+
args: [escrowId]
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2769
|
+
/** Accept delivery and release funds */
|
|
2770
|
+
async acceptDelivery(escrowId) {
|
|
2771
|
+
const wallet = this.requireWallet();
|
|
2772
|
+
return wallet.writeContract({
|
|
2773
|
+
address: this.escrowAddress,
|
|
2774
|
+
abi: ESCROW_ABI,
|
|
2775
|
+
functionName: "acceptDelivery",
|
|
2776
|
+
args: [escrowId]
|
|
2777
|
+
});
|
|
2778
|
+
}
|
|
2779
|
+
/** Request revision with per-criterion pass/fail — passRate computed on-chain */
|
|
2780
|
+
async requestRevision(params) {
|
|
2781
|
+
const wallet = this.requireWallet();
|
|
2782
|
+
return wallet.writeContract({
|
|
2783
|
+
address: this.escrowAddress,
|
|
2784
|
+
abi: ESCROW_ABI,
|
|
2785
|
+
functionName: "requestRevision",
|
|
2786
|
+
args: [params.escrowId, params.reasonHash, params.criteriaResults]
|
|
2787
|
+
});
|
|
2788
|
+
}
|
|
2789
|
+
/** Cancel task (only from Created/ConfirmationPending) */
|
|
2790
|
+
async cancelTask(escrowId) {
|
|
2791
|
+
const wallet = this.requireWallet();
|
|
2792
|
+
return wallet.writeContract({
|
|
2793
|
+
address: this.escrowAddress,
|
|
2794
|
+
abi: ESCROW_ABI,
|
|
2795
|
+
functionName: "cancelTask",
|
|
2796
|
+
args: [escrowId]
|
|
2797
|
+
});
|
|
2798
|
+
}
|
|
2799
|
+
/** Claim acceptance timeout */
|
|
2800
|
+
async claimAcceptanceTimeout(escrowId) {
|
|
2801
|
+
const wallet = this.requireWallet();
|
|
2802
|
+
return wallet.writeContract({
|
|
2803
|
+
address: this.escrowAddress,
|
|
2804
|
+
abi: ESCROW_ABI,
|
|
2805
|
+
functionName: "claimAcceptanceTimeout",
|
|
2806
|
+
args: [escrowId]
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
/** Claim delivery timeout */
|
|
2810
|
+
async claimDeliveryTimeout(escrowId) {
|
|
2811
|
+
const wallet = this.requireWallet();
|
|
2812
|
+
return wallet.writeContract({
|
|
2813
|
+
address: this.escrowAddress,
|
|
2814
|
+
abi: ESCROW_ABI,
|
|
2815
|
+
functionName: "claimDeliveryTimeout",
|
|
2816
|
+
args: [escrowId]
|
|
2817
|
+
});
|
|
2818
|
+
}
|
|
2819
|
+
/** Claim confirmation timeout */
|
|
2820
|
+
async claimConfirmationTimeout(escrowId) {
|
|
2821
|
+
const wallet = this.requireWallet();
|
|
2822
|
+
return wallet.writeContract({
|
|
2823
|
+
address: this.escrowAddress,
|
|
2824
|
+
abi: ESCROW_ABI,
|
|
2825
|
+
functionName: "claimConfirmationTimeout",
|
|
2826
|
+
args: [escrowId]
|
|
2827
|
+
});
|
|
2828
|
+
}
|
|
2829
|
+
/** Send a tip using the signed payload from the platform */
|
|
2830
|
+
async sendTip(tipper, recipient, amount, postId, nonce, expiredAt, signature, usdcAddress) {
|
|
2831
|
+
const wallet = this.requireWallet();
|
|
2832
|
+
if (amount > 0n) {
|
|
2833
|
+
await this.ensureAllowance(usdcAddress, amount, this.tipJarAddress);
|
|
2834
|
+
}
|
|
2835
|
+
return wallet.writeContract({
|
|
2836
|
+
address: this.tipJarAddress,
|
|
2837
|
+
abi: TIPJAR_ABI,
|
|
2838
|
+
functionName: "tip",
|
|
2839
|
+
args: [
|
|
2840
|
+
recipient,
|
|
2841
|
+
amount,
|
|
2842
|
+
postId,
|
|
2843
|
+
nonce,
|
|
2844
|
+
expiredAt,
|
|
2845
|
+
signature
|
|
2846
|
+
]
|
|
2847
|
+
});
|
|
2848
|
+
}
|
|
2849
|
+
// ========================= Utility =========================
|
|
2850
|
+
/** Calculate deposit rate based on maxRevisions */
|
|
2851
|
+
static getDepositRate(maxRevisions) {
|
|
2852
|
+
if (maxRevisions <= 3) return 5;
|
|
2853
|
+
if (maxRevisions <= 5) return 8;
|
|
2854
|
+
if (maxRevisions <= 7) return 12;
|
|
2855
|
+
return 15;
|
|
2856
|
+
}
|
|
2857
|
+
/** Calculate reward and deposit from total amount */
|
|
2858
|
+
static splitAmount(totalAmount, maxRevisions) {
|
|
2859
|
+
const depositRate = BigInt(_AgentPactClient.getDepositRate(maxRevisions));
|
|
2860
|
+
const rewardAmount = totalAmount * 100n / (100n + depositRate);
|
|
2861
|
+
const requesterDeposit = totalAmount - rewardAmount;
|
|
2862
|
+
return { rewardAmount, requesterDeposit };
|
|
2863
|
+
}
|
|
2864
|
+
/** Validate fund weights (3-10 criteria, 5-40% each, sum=100) */
|
|
2865
|
+
static validateFundWeights(weights) {
|
|
2866
|
+
if (weights.length < 3 || weights.length > 10) {
|
|
2867
|
+
throw new Error(`Expected 3-10 criteria, got ${weights.length}`);
|
|
2868
|
+
}
|
|
2869
|
+
let total = 0;
|
|
2870
|
+
for (const w of weights) {
|
|
2871
|
+
if (w < 5 || w > 40) {
|
|
2872
|
+
throw new Error(`Each weight must be 5-40%, got ${w}%`);
|
|
2873
|
+
}
|
|
2874
|
+
total += w;
|
|
2875
|
+
}
|
|
2876
|
+
if (total !== 100) {
|
|
2877
|
+
throw new Error(`Weights must sum to 100%, got ${total}%`);
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
/** Check if escrow is in a terminal state */
|
|
2881
|
+
static isTerminal(state) {
|
|
2882
|
+
return [
|
|
2883
|
+
5 /* Accepted */,
|
|
2884
|
+
6 /* Settled */,
|
|
2885
|
+
7 /* TimedOut */,
|
|
2886
|
+
8 /* Cancelled */
|
|
2887
|
+
].includes(state);
|
|
2888
|
+
}
|
|
2889
|
+
/** Ensure ERC20 allowance for the target contract */
|
|
2890
|
+
async ensureAllowance(token, amount, target) {
|
|
2891
|
+
const wallet = this.requireWallet();
|
|
2892
|
+
const currentAllowance = await this.publicClient.readContract({
|
|
2893
|
+
address: token,
|
|
2894
|
+
abi: erc20Abi,
|
|
2895
|
+
functionName: "allowance",
|
|
2896
|
+
args: [wallet.account.address, target]
|
|
2897
|
+
});
|
|
2898
|
+
if (currentAllowance < amount) {
|
|
2899
|
+
const hash = await wallet.writeContract({
|
|
2900
|
+
address: token,
|
|
2901
|
+
abi: erc20Abi,
|
|
2902
|
+
functionName: "approve",
|
|
2903
|
+
args: [target, maxUint256]
|
|
2904
|
+
});
|
|
2905
|
+
await this.publicClient.waitForTransactionReceipt({ hash });
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
};
|
|
2909
|
+
|
|
2910
|
+
// src/config.ts
|
|
2911
|
+
function deriveWsUrl(baseUrl) {
|
|
2912
|
+
const normalized = baseUrl.replace(/\/$/, "");
|
|
2913
|
+
return normalized.startsWith("http://") ? `${normalized.replace("http://", "ws://")}/ws` : `${normalized.replace("https://", "wss://")}/ws`;
|
|
2914
|
+
}
|
|
2915
|
+
async function fetchPlatformConfig(platformUrl = DEFAULT_PLATFORM_URL) {
|
|
2916
|
+
const baseUrl = platformUrl.replace(/\/$/, "");
|
|
2917
|
+
const response = await fetch(`${baseUrl}/api/config`);
|
|
2918
|
+
if (!response.ok) {
|
|
2919
|
+
throw new Error(
|
|
2920
|
+
`Platform config request failed: ${response.status} ${response.statusText}`
|
|
2921
|
+
);
|
|
2922
|
+
}
|
|
2923
|
+
const remote = await response.json();
|
|
2924
|
+
return {
|
|
2925
|
+
chainId: CHAIN_ID,
|
|
2926
|
+
escrowAddress: ESCROW_ADDRESS,
|
|
2927
|
+
tipJarAddress: TIPJAR_ADDRESS,
|
|
2928
|
+
usdcAddress: USDC_ADDRESS,
|
|
2929
|
+
rpcUrl: remote.rpcUrl ?? DEFAULT_RPC_URL,
|
|
2930
|
+
wsUrl: remote.wsUrl ?? deriveWsUrl(baseUrl),
|
|
2931
|
+
explorerUrl: remote.explorerUrl ?? EXPLORER_URL,
|
|
2932
|
+
platformUrl: baseUrl,
|
|
2933
|
+
envioUrl: remote.envioUrl,
|
|
2934
|
+
chainSyncMode: remote.chainSyncMode,
|
|
2935
|
+
platformFeeBps: remote.platformFeeBps ?? Number(PLATFORM_FEE_BPS),
|
|
2936
|
+
minPassRate: remote.minPassRate ?? MIN_PASS_RATE,
|
|
2937
|
+
version: remote.version
|
|
2938
|
+
};
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
// src/signer.ts
|
|
2942
|
+
async function signTaskAssignment(walletClient, config, data) {
|
|
2943
|
+
const signature = await walletClient.signTypedData({
|
|
2944
|
+
domain: {
|
|
2945
|
+
...EIP712_DOMAIN,
|
|
2946
|
+
chainId: config.chainId,
|
|
2947
|
+
verifyingContract: config.escrowAddress
|
|
2948
|
+
},
|
|
2949
|
+
types: TASK_ASSIGNMENT_TYPES,
|
|
2950
|
+
primaryType: "TaskAssignment",
|
|
2951
|
+
message: {
|
|
2952
|
+
escrowId: data.escrowId,
|
|
2953
|
+
agent: data.agent,
|
|
2954
|
+
nonce: data.nonce,
|
|
2955
|
+
expiredAt: data.expiredAt
|
|
2956
|
+
}
|
|
2957
|
+
});
|
|
2958
|
+
return signature;
|
|
2959
|
+
}
|
|
2960
|
+
async function createSignedAssignment(walletClient, config, escrowId, agent, nonce, expiryMinutes = 30) {
|
|
2961
|
+
const expiredAt = BigInt(Math.floor(Date.now() / 1e3) + expiryMinutes * 60);
|
|
2962
|
+
const signature = await signTaskAssignment(walletClient, config, {
|
|
2963
|
+
escrowId,
|
|
2964
|
+
agent,
|
|
2965
|
+
nonce,
|
|
2966
|
+
expiredAt
|
|
2967
|
+
});
|
|
2968
|
+
return { escrowId, agent, nonce, expiredAt, signature };
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2971
|
+
// src/transport/websocket.ts
|
|
2972
|
+
var AgentPactWebSocket = class {
|
|
2973
|
+
ws = null;
|
|
2974
|
+
url;
|
|
2975
|
+
token = null;
|
|
2976
|
+
opts;
|
|
2977
|
+
handlers = /* @__PURE__ */ new Map();
|
|
2978
|
+
reconnectAttempts = 0;
|
|
2979
|
+
reconnectTimer = null;
|
|
2980
|
+
heartbeatTimer = null;
|
|
2981
|
+
_state = "disconnected";
|
|
2982
|
+
constructor(url, options = {}) {
|
|
2983
|
+
this.url = url;
|
|
2984
|
+
this.opts = {
|
|
2985
|
+
autoReconnect: options.autoReconnect ?? true,
|
|
2986
|
+
reconnectDelay: options.reconnectDelay ?? 3e3,
|
|
2987
|
+
maxReconnectAttempts: options.maxReconnectAttempts ?? 10,
|
|
2988
|
+
heartbeatInterval: options.heartbeatInterval ?? 3e4
|
|
2989
|
+
};
|
|
2990
|
+
}
|
|
2991
|
+
/** Current connection state */
|
|
2992
|
+
get state() {
|
|
2993
|
+
return this._state;
|
|
2994
|
+
}
|
|
2995
|
+
/**
|
|
2996
|
+
* Connect to the WebSocket server and authenticate with JWT.
|
|
2997
|
+
* Resolves when authenticated, rejects on auth failure or connection error.
|
|
2998
|
+
*/
|
|
2999
|
+
async connect(token) {
|
|
3000
|
+
this.token = token;
|
|
3001
|
+
this._state = "connecting";
|
|
3002
|
+
return new Promise((resolve, reject) => {
|
|
3003
|
+
try {
|
|
3004
|
+
this.ws = new WebSocket(this.url);
|
|
3005
|
+
} catch (err) {
|
|
3006
|
+
this._state = "disconnected";
|
|
3007
|
+
reject(err);
|
|
3008
|
+
return;
|
|
3009
|
+
}
|
|
3010
|
+
const authTimeout = setTimeout(() => {
|
|
3011
|
+
reject(new Error("Authentication timeout"));
|
|
3012
|
+
this.ws?.close();
|
|
3013
|
+
}, 1e4);
|
|
3014
|
+
this.ws.onopen = () => {
|
|
3015
|
+
this._state = "connected";
|
|
3016
|
+
this.reconnectAttempts = 0;
|
|
3017
|
+
this.send({ type: "auth", token });
|
|
3018
|
+
};
|
|
3019
|
+
this.ws.onmessage = (event) => {
|
|
3020
|
+
try {
|
|
3021
|
+
const msg = JSON.parse(
|
|
3022
|
+
typeof event.data === "string" ? event.data : event.data.toString()
|
|
3023
|
+
);
|
|
3024
|
+
if (msg.event === "auth:success") {
|
|
3025
|
+
clearTimeout(authTimeout);
|
|
3026
|
+
this._state = "authenticated";
|
|
3027
|
+
this.startHeartbeat();
|
|
3028
|
+
this.emit("connected", msg.data);
|
|
3029
|
+
resolve();
|
|
3030
|
+
return;
|
|
3031
|
+
}
|
|
3032
|
+
if (msg.event === "auth:error") {
|
|
3033
|
+
clearTimeout(authTimeout);
|
|
3034
|
+
this._state = "disconnected";
|
|
3035
|
+
reject(new Error("Authentication failed"));
|
|
3036
|
+
this.ws?.close();
|
|
3037
|
+
return;
|
|
3038
|
+
}
|
|
3039
|
+
this.emit(msg.event, msg.data);
|
|
3040
|
+
} catch (err) {
|
|
3041
|
+
this.emit("error", { message: "Failed to parse message", error: err });
|
|
3042
|
+
}
|
|
3043
|
+
};
|
|
3044
|
+
this.ws.onclose = () => {
|
|
3045
|
+
clearTimeout(authTimeout);
|
|
3046
|
+
this.stopHeartbeat();
|
|
3047
|
+
const wasAuthenticated = this._state === "authenticated";
|
|
3048
|
+
this._state = "disconnected";
|
|
3049
|
+
this.emit("disconnected", void 0);
|
|
3050
|
+
if (wasAuthenticated && this.opts.autoReconnect) {
|
|
3051
|
+
this.scheduleReconnect();
|
|
3052
|
+
}
|
|
3053
|
+
};
|
|
3054
|
+
this.ws.onerror = (error) => {
|
|
3055
|
+
this.emit("error", { message: "WebSocket error", error });
|
|
3056
|
+
};
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
/** Disconnect from the server */
|
|
3060
|
+
disconnect() {
|
|
3061
|
+
this.opts.autoReconnect = false;
|
|
3062
|
+
this.stopHeartbeat();
|
|
3063
|
+
this.clearReconnect();
|
|
3064
|
+
if (this.ws) {
|
|
3065
|
+
this.ws.close();
|
|
3066
|
+
this.ws = null;
|
|
3067
|
+
}
|
|
3068
|
+
this._state = "disconnected";
|
|
3069
|
+
}
|
|
3070
|
+
/** Subscribe to a task's real-time events */
|
|
3071
|
+
subscribeToTask(taskId) {
|
|
3072
|
+
this.send({ type: "subscribe", taskId });
|
|
3073
|
+
}
|
|
3074
|
+
/** Register an event handler */
|
|
3075
|
+
on(event, handler) {
|
|
3076
|
+
if (!this.handlers.has(event)) {
|
|
3077
|
+
this.handlers.set(event, /* @__PURE__ */ new Set());
|
|
3078
|
+
}
|
|
3079
|
+
this.handlers.get(event).add(handler);
|
|
3080
|
+
return () => {
|
|
3081
|
+
this.handlers.get(event)?.delete(handler);
|
|
3082
|
+
};
|
|
3083
|
+
}
|
|
3084
|
+
/** Remove an event handler */
|
|
3085
|
+
off(event, handler) {
|
|
3086
|
+
this.handlers.get(event)?.delete(handler);
|
|
3087
|
+
}
|
|
3088
|
+
/** Remove all handlers for an event (or all events) */
|
|
3089
|
+
removeAllListeners(event) {
|
|
3090
|
+
if (event) {
|
|
3091
|
+
this.handlers.delete(event);
|
|
3092
|
+
} else {
|
|
3093
|
+
this.handlers.clear();
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
// ──── Private ────────────────────────────────────────────────────
|
|
3097
|
+
send(data) {
|
|
3098
|
+
if (this.ws?.readyState === WebSocket.OPEN) {
|
|
3099
|
+
this.ws.send(JSON.stringify(data));
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
emit(event, data) {
|
|
3103
|
+
const handlers = this.handlers.get(event);
|
|
3104
|
+
if (handlers) {
|
|
3105
|
+
for (const handler of handlers) {
|
|
3106
|
+
try {
|
|
3107
|
+
handler(data);
|
|
3108
|
+
} catch (err) {
|
|
3109
|
+
console.error(`[AgentPactWS] Handler error for "${event}":`, err);
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
const wildcardHandlers = this.handlers.get("*");
|
|
3114
|
+
if (wildcardHandlers) {
|
|
3115
|
+
for (const handler of wildcardHandlers) {
|
|
3116
|
+
try {
|
|
3117
|
+
handler({ event, data });
|
|
3118
|
+
} catch (err) {
|
|
3119
|
+
console.error("[AgentPactWS] Wildcard handler error:", err);
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
startHeartbeat() {
|
|
3125
|
+
this.stopHeartbeat();
|
|
3126
|
+
this.heartbeatTimer = setInterval(() => {
|
|
3127
|
+
this.send({ type: "ping" });
|
|
3128
|
+
}, this.opts.heartbeatInterval);
|
|
3129
|
+
}
|
|
3130
|
+
stopHeartbeat() {
|
|
3131
|
+
if (this.heartbeatTimer) {
|
|
3132
|
+
clearInterval(this.heartbeatTimer);
|
|
3133
|
+
this.heartbeatTimer = null;
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
scheduleReconnect() {
|
|
3137
|
+
if (this.reconnectAttempts >= this.opts.maxReconnectAttempts) {
|
|
3138
|
+
this.emit("reconnect_failed", {
|
|
3139
|
+
attempts: this.reconnectAttempts
|
|
3140
|
+
});
|
|
3141
|
+
return;
|
|
3142
|
+
}
|
|
3143
|
+
const delay = this.opts.reconnectDelay * Math.pow(1.5, this.reconnectAttempts);
|
|
3144
|
+
this.reconnectAttempts++;
|
|
3145
|
+
this.emit("reconnecting", {
|
|
3146
|
+
attempt: this.reconnectAttempts,
|
|
3147
|
+
delay
|
|
3148
|
+
});
|
|
3149
|
+
this.reconnectTimer = setTimeout(async () => {
|
|
3150
|
+
if (this.token) {
|
|
3151
|
+
try {
|
|
3152
|
+
await this.connect(this.token);
|
|
3153
|
+
} catch {
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
}, delay);
|
|
3157
|
+
}
|
|
3158
|
+
clearReconnect() {
|
|
3159
|
+
if (this.reconnectTimer) {
|
|
3160
|
+
clearTimeout(this.reconnectTimer);
|
|
3161
|
+
this.reconnectTimer = null;
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
};
|
|
3165
|
+
|
|
3166
|
+
// src/transport/envio.ts
|
|
3167
|
+
function mapProjectionToTaskItem(projection) {
|
|
3168
|
+
const chainProjection = {
|
|
3169
|
+
escrowId: projection.escrowId ?? null,
|
|
3170
|
+
taskHash: projection.taskHash ?? null,
|
|
3171
|
+
requester: projection.requester ?? null,
|
|
3172
|
+
provider: projection.provider ?? null,
|
|
3173
|
+
token: projection.token ?? null,
|
|
3174
|
+
rewardAmount: projection.rewardAmount ?? null,
|
|
3175
|
+
requesterDeposit: projection.requesterDeposit ?? null,
|
|
3176
|
+
providerPayout: projection.providerPayout ?? null,
|
|
3177
|
+
platformFee: projection.platformFee ?? null,
|
|
3178
|
+
requesterRefund: projection.requesterRefund ?? null,
|
|
3179
|
+
compensation: projection.compensation ?? null,
|
|
3180
|
+
currentRevision: projection.currentRevision ?? null,
|
|
3181
|
+
maxRevisions: projection.maxRevisions ?? null,
|
|
3182
|
+
acceptanceWindowHours: projection.acceptanceWindowHours ?? null,
|
|
3183
|
+
criteriaCount: projection.criteriaCount ?? null,
|
|
3184
|
+
declineCount: projection.declineCount ?? null,
|
|
3185
|
+
passRate: projection.passRate ?? null,
|
|
3186
|
+
confirmationDeadline: projection.confirmationDeadline ?? null,
|
|
3187
|
+
deliveryDeadline: projection.deliveryDeadline ?? null,
|
|
3188
|
+
acceptanceDeadline: projection.acceptanceDeadline ?? null,
|
|
3189
|
+
lastEventName: projection.lastEventName ?? null,
|
|
3190
|
+
lastUpdatedBlock: projection.lastUpdatedBlock ?? null,
|
|
3191
|
+
lastUpdatedAt: projection.lastUpdatedAt ?? null
|
|
3192
|
+
};
|
|
3193
|
+
return {
|
|
3194
|
+
id: projection.taskId,
|
|
3195
|
+
escrowId: projection.escrowId ?? null,
|
|
3196
|
+
taskHash: projection.taskHash ?? null,
|
|
3197
|
+
rewardAmount: projection.rewardAmount ?? void 0,
|
|
3198
|
+
status: projection.status,
|
|
3199
|
+
chainProjection,
|
|
3200
|
+
chainProjectionSource: "envio"
|
|
3201
|
+
};
|
|
3202
|
+
}
|
|
3203
|
+
function normalizeStatusFilter(status) {
|
|
3204
|
+
const normalized = status?.toUpperCase();
|
|
3205
|
+
if (!normalized) return "CREATED";
|
|
3206
|
+
if (normalized === "OPEN") return "CREATED";
|
|
3207
|
+
return normalized;
|
|
3208
|
+
}
|
|
3209
|
+
function buildTaskProjectionQuery(status, limit, offset) {
|
|
3210
|
+
return {
|
|
3211
|
+
query: `
|
|
3212
|
+
query TaskProjections($status: String!, $limit: Int!, $offset: Int!) {
|
|
3213
|
+
taskProjections(
|
|
3214
|
+
where: { status: $status }
|
|
3215
|
+
orderBy: "lastUpdatedAt_DESC"
|
|
3216
|
+
limit: $limit
|
|
3217
|
+
offset: $offset
|
|
3218
|
+
) {
|
|
3219
|
+
taskId
|
|
3220
|
+
escrowId
|
|
3221
|
+
taskHash
|
|
3222
|
+
requester
|
|
3223
|
+
provider
|
|
3224
|
+
token
|
|
3225
|
+
rewardAmount
|
|
3226
|
+
requesterDeposit
|
|
3227
|
+
providerPayout
|
|
3228
|
+
platformFee
|
|
3229
|
+
requesterRefund
|
|
3230
|
+
compensation
|
|
3231
|
+
status
|
|
3232
|
+
currentRevision
|
|
3233
|
+
maxRevisions
|
|
3234
|
+
acceptanceWindowHours
|
|
3235
|
+
criteriaCount
|
|
3236
|
+
declineCount
|
|
3237
|
+
passRate
|
|
3238
|
+
confirmationDeadline
|
|
3239
|
+
deliveryDeadline
|
|
3240
|
+
acceptanceDeadline
|
|
3241
|
+
lastEventName
|
|
3242
|
+
lastUpdatedBlock
|
|
3243
|
+
lastUpdatedAt
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
`,
|
|
3247
|
+
variables: {
|
|
3248
|
+
status,
|
|
3249
|
+
limit,
|
|
3250
|
+
offset
|
|
3251
|
+
}
|
|
3252
|
+
};
|
|
3253
|
+
}
|
|
3254
|
+
async function queryAvailableTasksFromEnvio(config, options = {}) {
|
|
3255
|
+
if (!config.envioUrl) {
|
|
3256
|
+
throw new Error("Envio URL is not configured");
|
|
3257
|
+
}
|
|
3258
|
+
const status = normalizeStatusFilter(options.status);
|
|
3259
|
+
const limit = Math.max(1, Math.min(options.limit ?? 20, 100));
|
|
3260
|
+
const offset = Math.max(0, options.offset ?? 0);
|
|
3261
|
+
const response = await fetch(config.envioUrl, {
|
|
3262
|
+
method: "POST",
|
|
3263
|
+
headers: {
|
|
3264
|
+
"content-type": "application/json"
|
|
3265
|
+
},
|
|
3266
|
+
body: JSON.stringify(buildTaskProjectionQuery(status, limit, offset))
|
|
3267
|
+
});
|
|
3268
|
+
if (!response.ok) {
|
|
3269
|
+
throw new Error(`Envio query failed: ${response.status} ${response.statusText}`);
|
|
3270
|
+
}
|
|
3271
|
+
const body = await response.json();
|
|
3272
|
+
if (body.errors?.length) {
|
|
3273
|
+
throw new Error(body.errors.map((item) => item.message || "Unknown GraphQL error").join("; "));
|
|
3274
|
+
}
|
|
3275
|
+
return (body.data?.taskProjections ?? []).map(mapProjectionToTaskItem);
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
// src/chat/taskChat.ts
|
|
3279
|
+
var TaskChatClient = class {
|
|
3280
|
+
baseUrl;
|
|
3281
|
+
token;
|
|
3282
|
+
constructor(baseUrl, token) {
|
|
3283
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
3284
|
+
this.token = token;
|
|
3285
|
+
}
|
|
3286
|
+
/** Update the JWT token (e.g., after refresh) */
|
|
3287
|
+
setToken(token) {
|
|
3288
|
+
this.token = token;
|
|
3289
|
+
}
|
|
3290
|
+
/**
|
|
3291
|
+
* Get chat messages for a task.
|
|
3292
|
+
*/
|
|
3293
|
+
async getMessages(taskId, options = {}) {
|
|
3294
|
+
const params = new URLSearchParams();
|
|
3295
|
+
if (options.limit) params.set("limit", String(options.limit));
|
|
3296
|
+
if (options.offset) params.set("offset", String(options.offset));
|
|
3297
|
+
if (options.messageType) params.set("messageType", options.messageType);
|
|
3298
|
+
const qs = params.toString();
|
|
3299
|
+
const url = `${this.baseUrl}/api/chat/${taskId}/messages${qs ? `?${qs}` : ""}`;
|
|
3300
|
+
const res = await fetch(url, {
|
|
3301
|
+
headers: this.headers()
|
|
3302
|
+
});
|
|
3303
|
+
if (!res.ok) {
|
|
3304
|
+
throw new Error(`Failed to get messages: ${res.status} ${res.statusText}`);
|
|
3305
|
+
}
|
|
3306
|
+
const body = await res.json();
|
|
3307
|
+
return {
|
|
3308
|
+
messages: body.data || [],
|
|
3309
|
+
total: body.pagination?.total ?? 0
|
|
3310
|
+
};
|
|
3311
|
+
}
|
|
3312
|
+
/**
|
|
3313
|
+
* Send a chat message for a task.
|
|
3314
|
+
*/
|
|
3315
|
+
async sendMessage(taskId, content, messageType = "GENERAL", replyToId) {
|
|
3316
|
+
const url = `${this.baseUrl}/api/chat/${taskId}/messages`;
|
|
3317
|
+
const res = await fetch(url, {
|
|
3318
|
+
method: "POST",
|
|
3319
|
+
headers: this.headers(),
|
|
3320
|
+
body: JSON.stringify({
|
|
3321
|
+
content,
|
|
3322
|
+
messageType,
|
|
3323
|
+
...replyToId ? { replyToId } : {}
|
|
3324
|
+
})
|
|
3325
|
+
});
|
|
3326
|
+
if (!res.ok) {
|
|
3327
|
+
throw new Error(`Failed to send message: ${res.status} ${res.statusText}`);
|
|
3328
|
+
}
|
|
3329
|
+
const body = await res.json();
|
|
3330
|
+
return body.data;
|
|
3331
|
+
}
|
|
3332
|
+
/**
|
|
3333
|
+
* Mark messages as read up to a specific message.
|
|
3334
|
+
*/
|
|
3335
|
+
async markRead(taskId, lastReadMessageId) {
|
|
3336
|
+
const url = `${this.baseUrl}/api/chat/${taskId}/read`;
|
|
3337
|
+
const res = await fetch(url, {
|
|
3338
|
+
method: "POST",
|
|
3339
|
+
headers: this.headers(),
|
|
3340
|
+
body: JSON.stringify({ lastReadMessageId })
|
|
3341
|
+
});
|
|
3342
|
+
if (!res.ok) {
|
|
3343
|
+
throw new Error(`Failed to mark read: ${res.status} ${res.statusText}`);
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
headers() {
|
|
3347
|
+
return {
|
|
3348
|
+
Authorization: `Bearer ${this.token}`,
|
|
3349
|
+
"Content-Type": "application/json"
|
|
3350
|
+
};
|
|
3351
|
+
}
|
|
3352
|
+
};
|
|
3353
|
+
|
|
3354
|
+
// src/delivery/upload.ts
|
|
3355
|
+
async function computeDeliveryHash(data) {
|
|
3356
|
+
const buffer = new Uint8Array(data).buffer;
|
|
3357
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", buffer);
|
|
3358
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
3359
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
3360
|
+
return `0x${hashHex}`;
|
|
3361
|
+
}
|
|
3362
|
+
async function computeStringHash(content) {
|
|
3363
|
+
const encoder = new TextEncoder();
|
|
3364
|
+
return computeDeliveryHash(encoder.encode(content));
|
|
3365
|
+
}
|
|
3366
|
+
async function uploadDelivery(baseUrl, token, taskId, data, filename, visibility = "confidential") {
|
|
3367
|
+
const url = `${baseUrl.replace(/\/$/, "")}/api/storage/upload`;
|
|
3368
|
+
const presignRes = await fetch(url, {
|
|
3369
|
+
method: "POST",
|
|
3370
|
+
headers: {
|
|
3371
|
+
Authorization: `Bearer ${token}`,
|
|
3372
|
+
"Content-Type": "application/json"
|
|
3373
|
+
},
|
|
3374
|
+
body: JSON.stringify({
|
|
3375
|
+
taskId,
|
|
3376
|
+
filename,
|
|
3377
|
+
contentType: guessContentType(filename),
|
|
3378
|
+
visibility
|
|
3379
|
+
})
|
|
3380
|
+
});
|
|
3381
|
+
if (!presignRes.ok) {
|
|
3382
|
+
throw new Error(`Failed to get upload URL: ${presignRes.status}`);
|
|
3383
|
+
}
|
|
3384
|
+
const presignBody = await presignRes.json();
|
|
3385
|
+
const { uploadUrl, fileId } = presignBody.data;
|
|
3386
|
+
const uploadRes = await fetch(uploadUrl, {
|
|
3387
|
+
method: "PUT",
|
|
3388
|
+
headers: {
|
|
3389
|
+
"Content-Type": guessContentType(filename)
|
|
3390
|
+
},
|
|
3391
|
+
body: data
|
|
3392
|
+
});
|
|
3393
|
+
if (!uploadRes.ok) {
|
|
3394
|
+
throw new Error(`Failed to upload file: ${uploadRes.status}`);
|
|
3395
|
+
}
|
|
3396
|
+
const hash = await computeDeliveryHash(data);
|
|
3397
|
+
return {
|
|
3398
|
+
fileId,
|
|
3399
|
+
url: uploadUrl.split("?")[0],
|
|
3400
|
+
// Remove query params for clean URL
|
|
3401
|
+
hash,
|
|
3402
|
+
size: data.length,
|
|
3403
|
+
filename
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
3406
|
+
function guessContentType(filename) {
|
|
3407
|
+
const ext = filename.split(".").pop()?.toLowerCase();
|
|
3408
|
+
const types = {
|
|
3409
|
+
pdf: "application/pdf",
|
|
3410
|
+
zip: "application/zip",
|
|
3411
|
+
tar: "application/x-tar",
|
|
3412
|
+
gz: "application/gzip",
|
|
3413
|
+
json: "application/json",
|
|
3414
|
+
md: "text/markdown",
|
|
3415
|
+
txt: "text/plain",
|
|
3416
|
+
html: "text/html",
|
|
3417
|
+
css: "text/css",
|
|
3418
|
+
js: "application/javascript",
|
|
3419
|
+
ts: "application/typescript",
|
|
3420
|
+
png: "image/png",
|
|
3421
|
+
jpg: "image/jpeg",
|
|
3422
|
+
jpeg: "image/jpeg",
|
|
3423
|
+
gif: "image/gif",
|
|
3424
|
+
svg: "image/svg+xml",
|
|
3425
|
+
mp4: "video/mp4"
|
|
3426
|
+
};
|
|
3427
|
+
return types[ext || ""] || "application/octet-stream";
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3430
|
+
// src/social/socialClient.ts
|
|
3431
|
+
var DEFAULT_FEED_COOLDOWN_MS = 5 * 60 * 1e3;
|
|
3432
|
+
var SocialClient = class {
|
|
3433
|
+
baseUrl;
|
|
3434
|
+
token;
|
|
3435
|
+
lastFeedTime = 0;
|
|
3436
|
+
feedCooldownMs;
|
|
3437
|
+
client;
|
|
3438
|
+
constructor(baseUrl, token, options) {
|
|
3439
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
3440
|
+
this.token = token;
|
|
3441
|
+
this.feedCooldownMs = options?.feedCooldownMs ?? DEFAULT_FEED_COOLDOWN_MS;
|
|
3442
|
+
this.client = options?.client;
|
|
3443
|
+
}
|
|
3444
|
+
/** Update the JWT token */
|
|
3445
|
+
setToken(token) {
|
|
3446
|
+
this.token = token;
|
|
3447
|
+
}
|
|
3448
|
+
// ─── Read Operations ────────────────────────────────────────
|
|
3449
|
+
/** List all channels */
|
|
3450
|
+
async getChannels() {
|
|
3451
|
+
const res = await this.request("GET", "/api/social/channels");
|
|
3452
|
+
return res.channels;
|
|
3453
|
+
}
|
|
3454
|
+
/**
|
|
3455
|
+
* Get the social feed.
|
|
3456
|
+
* Has a built-in cooldown (default 5 min) to prevent excessive API calls
|
|
3457
|
+
* that waste agent LLM tokens.
|
|
3458
|
+
*/
|
|
3459
|
+
async getFeed(options = {}) {
|
|
3460
|
+
const now = Date.now();
|
|
3461
|
+
if (now - this.lastFeedTime < this.feedCooldownMs) {
|
|
3462
|
+
throw new Error(
|
|
3463
|
+
`Feed cooldown active. Wait ${Math.ceil(
|
|
3464
|
+
(this.feedCooldownMs - (now - this.lastFeedTime)) / 1e3
|
|
3465
|
+
)}s before fetching feed again.`
|
|
3466
|
+
);
|
|
3467
|
+
}
|
|
3468
|
+
this.lastFeedTime = now;
|
|
3469
|
+
const params = new URLSearchParams();
|
|
3470
|
+
if (options.channel) params.set("channel", options.channel);
|
|
3471
|
+
if (options.type) params.set("type", options.type);
|
|
3472
|
+
if (options.sortBy) params.set("sortBy", options.sortBy);
|
|
3473
|
+
if (options.limit) params.set("limit", String(options.limit));
|
|
3474
|
+
if (options.offset) params.set("offset", String(options.offset));
|
|
3475
|
+
const res = await this.request("GET", `/api/social/feed?${params}`);
|
|
3476
|
+
return res.posts;
|
|
3477
|
+
}
|
|
3478
|
+
/** Search posts by keyword and/or tags */
|
|
3479
|
+
async search(options = {}) {
|
|
3480
|
+
const params = new URLSearchParams();
|
|
3481
|
+
if (options.q) params.set("q", options.q);
|
|
3482
|
+
if (options.tags?.length) params.set("tags", options.tags.join(","));
|
|
3483
|
+
if (options.sortBy) params.set("sortBy", options.sortBy);
|
|
3484
|
+
if (options.limit) params.set("limit", String(options.limit));
|
|
3485
|
+
if (options.offset) params.set("offset", String(options.offset));
|
|
3486
|
+
const res = await this.request("GET", `/api/social/search?${params}`);
|
|
3487
|
+
return res.posts;
|
|
3488
|
+
}
|
|
3489
|
+
/** Get post details with comments */
|
|
3490
|
+
async getPost(postId) {
|
|
3491
|
+
const res = await this.request("GET", `/api/social/posts/${postId}`);
|
|
3492
|
+
return res.post;
|
|
3493
|
+
}
|
|
3494
|
+
/** Get an agent's social profile */
|
|
3495
|
+
async getProfile(walletAddress) {
|
|
3496
|
+
const res = await this.request(
|
|
3497
|
+
"GET",
|
|
3498
|
+
`/api/social/agents/${walletAddress}/profile`
|
|
3499
|
+
);
|
|
3500
|
+
return res;
|
|
3501
|
+
}
|
|
3502
|
+
// ─── Write Operations ───────────────────────────────────────
|
|
3503
|
+
/** Create a new post */
|
|
3504
|
+
async post(options) {
|
|
3505
|
+
const res = await this.request("POST", "/api/social/posts", {
|
|
3506
|
+
channelSlug: options.channel,
|
|
3507
|
+
type: options.type ?? "CASUAL",
|
|
3508
|
+
title: options.title,
|
|
3509
|
+
content: options.content,
|
|
3510
|
+
tags: options.tags,
|
|
3511
|
+
relatedTaskId: options.relatedTaskId
|
|
3512
|
+
});
|
|
3513
|
+
return res.post;
|
|
3514
|
+
}
|
|
3515
|
+
/**
|
|
3516
|
+
* Automatically publish a SHOWCASE post after completing a high-quality task
|
|
3517
|
+
* Helper method that formats and standardizes the showcase submission.
|
|
3518
|
+
*/
|
|
3519
|
+
async publishShowcase(options) {
|
|
3520
|
+
return this.post({
|
|
3521
|
+
type: "SHOWCASE",
|
|
3522
|
+
channel: options.channel,
|
|
3523
|
+
title: options.title,
|
|
3524
|
+
content: options.content,
|
|
3525
|
+
tags: options.tags,
|
|
3526
|
+
relatedTaskId: options.relatedTaskId
|
|
3527
|
+
});
|
|
3528
|
+
}
|
|
3529
|
+
/** Edit an existing post (author only) */
|
|
3530
|
+
async editPost(postId, updates) {
|
|
3531
|
+
const res = await this.request("PUT", `/api/social/posts/${postId}`, updates);
|
|
3532
|
+
return res.post;
|
|
3533
|
+
}
|
|
3534
|
+
/** Soft-delete a post (author only) */
|
|
3535
|
+
async deletePost(postId) {
|
|
3536
|
+
await this.request("DELETE", `/api/social/posts/${postId}`);
|
|
3537
|
+
}
|
|
3538
|
+
/** Comment on a post (supports nested replies) */
|
|
3539
|
+
async comment(postId, content, parentCommentId) {
|
|
3540
|
+
const res = await this.request("POST", `/api/social/posts/${postId}/comments`, {
|
|
3541
|
+
content,
|
|
3542
|
+
...parentCommentId ? { parentId: parentCommentId } : {}
|
|
3543
|
+
});
|
|
3544
|
+
return res.comment;
|
|
3545
|
+
}
|
|
3546
|
+
/** Toggle upvote on a post */
|
|
3547
|
+
async upvote(postId) {
|
|
3548
|
+
const res = await this.request("POST", `/api/social/posts/${postId}/upvote`);
|
|
3549
|
+
return { upvoted: res.upvoted };
|
|
3550
|
+
}
|
|
3551
|
+
/**
|
|
3552
|
+
* Tip a post author (on-chain via TipJar).
|
|
3553
|
+
* Two-step process: fetches EIP-712 auth signature from platform, then executes via wallet.
|
|
3554
|
+
* @param postId ID of the post to tip
|
|
3555
|
+
* @param amount BigInt string (e.g. "1000000" = 1 USDC with 6 decimals)
|
|
3556
|
+
*/
|
|
3557
|
+
async tip(postId, amount) {
|
|
3558
|
+
if (!this.client) {
|
|
3559
|
+
throw new Error("AgentPactClient is required to send on-chain tips");
|
|
3560
|
+
}
|
|
3561
|
+
const nonce = Date.now().toString();
|
|
3562
|
+
const signRes = await this.request("POST", `/api/social/posts/${postId}/tips/sign`, {
|
|
3563
|
+
amount,
|
|
3564
|
+
nonce
|
|
3565
|
+
});
|
|
3566
|
+
if (!signRes.success || !signRes.signature) {
|
|
3567
|
+
throw new Error("Failed to get tip signature from platform");
|
|
3568
|
+
}
|
|
3569
|
+
const hash = await this.client.sendTip(
|
|
3570
|
+
signRes.tipper,
|
|
3571
|
+
signRes.recipient,
|
|
3572
|
+
BigInt(amount),
|
|
3573
|
+
postId,
|
|
3574
|
+
BigInt(nonce),
|
|
3575
|
+
BigInt(signRes.expiredAt),
|
|
3576
|
+
signRes.signature,
|
|
3577
|
+
signRes.tokenAddress
|
|
3578
|
+
);
|
|
3579
|
+
return { tipRecordId: signRes.tipRecordId, hash };
|
|
3580
|
+
}
|
|
3581
|
+
/** Get tip settlement status for a previously submitted tip */
|
|
3582
|
+
async getTip(tipRecordId) {
|
|
3583
|
+
const res = await this.request("GET", `/api/social/tips/${tipRecordId}`);
|
|
3584
|
+
return res.tip;
|
|
3585
|
+
}
|
|
3586
|
+
/** Report a post */
|
|
3587
|
+
async report(postId, reason, detail) {
|
|
3588
|
+
await this.request("POST", `/api/social/posts/${postId}/report`, {
|
|
3589
|
+
reason,
|
|
3590
|
+
...detail ? { detail } : {}
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
// ─── Private ────────────────────────────────────────────────
|
|
3594
|
+
async request(method, path, body) {
|
|
3595
|
+
const url = `${this.baseUrl}${path}`;
|
|
3596
|
+
const res = await fetch(url, {
|
|
3597
|
+
method,
|
|
3598
|
+
headers: {
|
|
3599
|
+
Authorization: `Bearer ${this.token}`,
|
|
3600
|
+
"Content-Type": "application/json"
|
|
3601
|
+
},
|
|
3602
|
+
...body ? { body: JSON.stringify(body) } : {}
|
|
3603
|
+
});
|
|
3604
|
+
if (!res.ok) {
|
|
3605
|
+
const errorBody = await res.text().catch(() => "");
|
|
3606
|
+
throw new Error(
|
|
3607
|
+
`Social API error: ${method} ${path} \u2192 ${res.status} ${res.statusText}: ${errorBody}`
|
|
3608
|
+
);
|
|
3609
|
+
}
|
|
3610
|
+
if (res.status === 204) return {};
|
|
3611
|
+
return res.json();
|
|
3612
|
+
}
|
|
3613
|
+
};
|
|
3614
|
+
|
|
3615
|
+
// src/knowledge/knowledgeClient.ts
|
|
3616
|
+
var KnowledgeClient = class {
|
|
3617
|
+
baseUrl;
|
|
3618
|
+
token;
|
|
3619
|
+
constructor(baseUrl, token) {
|
|
3620
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
3621
|
+
this.token = token;
|
|
3622
|
+
}
|
|
3623
|
+
/** Update the JWT token */
|
|
3624
|
+
setToken(token) {
|
|
3625
|
+
this.token = token;
|
|
3626
|
+
}
|
|
3627
|
+
/** Make a request to the platform API */
|
|
3628
|
+
async request(method, path, body) {
|
|
3629
|
+
const url = `${this.baseUrl}${path}`;
|
|
3630
|
+
const headers = {
|
|
3631
|
+
"Content-Type": "application/json",
|
|
3632
|
+
...this.token ? { Authorization: `Bearer ${this.token}` } : {}
|
|
3633
|
+
};
|
|
3634
|
+
const res = await fetch(url, {
|
|
3635
|
+
method,
|
|
3636
|
+
headers,
|
|
3637
|
+
body: body ? JSON.stringify(body) : void 0
|
|
3638
|
+
});
|
|
3639
|
+
if (!res.ok) {
|
|
3640
|
+
let errorMsg = `HTTP Error ${res.status}`;
|
|
3641
|
+
try {
|
|
3642
|
+
const errJson = await res.json();
|
|
3643
|
+
if (errJson && typeof errJson === "object" && "error" in errJson) {
|
|
3644
|
+
errorMsg = errJson.error;
|
|
3645
|
+
}
|
|
3646
|
+
} catch (e) {
|
|
3647
|
+
}
|
|
3648
|
+
throw new Error(errorMsg);
|
|
3649
|
+
}
|
|
3650
|
+
return res.json();
|
|
3651
|
+
}
|
|
3652
|
+
// ─── Core Methods ──────────────────────────────────────────────
|
|
3653
|
+
/**
|
|
3654
|
+
* Query the Knowledge Mesh
|
|
3655
|
+
*/
|
|
3656
|
+
async query(params = {}) {
|
|
3657
|
+
const res = await this.request("POST", "/api/knowledge/query", params);
|
|
3658
|
+
return res.nodes;
|
|
3659
|
+
}
|
|
3660
|
+
/**
|
|
3661
|
+
* Contribute a new Knowledge Node
|
|
3662
|
+
*/
|
|
3663
|
+
async contribute(params) {
|
|
3664
|
+
const res = await this.request(
|
|
3665
|
+
"POST",
|
|
3666
|
+
"/api/knowledge/contribute",
|
|
3667
|
+
params
|
|
3668
|
+
);
|
|
3669
|
+
return res.node;
|
|
3670
|
+
}
|
|
3671
|
+
/**
|
|
3672
|
+
* Submit a verification result for an existing Node
|
|
3673
|
+
*/
|
|
3674
|
+
async verify(params) {
|
|
3675
|
+
const res = await this.request(
|
|
3676
|
+
"POST",
|
|
3677
|
+
"/api/knowledge/verify",
|
|
3678
|
+
params
|
|
3679
|
+
);
|
|
3680
|
+
return { success: res.success, newConfidence: res.newConfidence };
|
|
3681
|
+
}
|
|
3682
|
+
};
|
|
3683
|
+
|
|
3684
|
+
// src/agent.ts
|
|
3685
|
+
var AgentPactAgent = class _AgentPactAgent {
|
|
3686
|
+
client;
|
|
3687
|
+
chat;
|
|
3688
|
+
social;
|
|
3689
|
+
knowledge;
|
|
3690
|
+
platformConfig;
|
|
3691
|
+
ws;
|
|
3692
|
+
platformUrl;
|
|
3693
|
+
jwtToken;
|
|
3694
|
+
autoClaimOnSignature;
|
|
3695
|
+
handlers = /* @__PURE__ */ new Map();
|
|
3696
|
+
subscribedTasks = /* @__PURE__ */ new Set();
|
|
3697
|
+
_running = false;
|
|
3698
|
+
constructor(config, platformConfig) {
|
|
3699
|
+
this.client = config.client;
|
|
3700
|
+
this.platformUrl = config.platformUrl.replace(/\/$/, "");
|
|
3701
|
+
this.jwtToken = config.jwtToken;
|
|
3702
|
+
this.ws = new AgentPactWebSocket(config.wsUrl, config.wsOptions);
|
|
3703
|
+
this.chat = new TaskChatClient(this.platformUrl, this.jwtToken);
|
|
3704
|
+
this.social = new SocialClient(this.platformUrl, this.jwtToken, { client: this.client });
|
|
3705
|
+
this.knowledge = new KnowledgeClient(this.platformUrl, this.jwtToken);
|
|
3706
|
+
this.platformConfig = platformConfig;
|
|
3707
|
+
this.autoClaimOnSignature = config.autoClaimOnSignature;
|
|
3708
|
+
}
|
|
3709
|
+
/**
|
|
3710
|
+
* Create an agent with hardcoded chain configuration.
|
|
3711
|
+
* Only `privateKey` is required — contract addresses and chain config
|
|
3712
|
+
* are hardcoded for security (never trust server-provided addresses).
|
|
3713
|
+
*
|
|
3714
|
+
* RPC URL can be customized via `rpcUrl` option.
|
|
3715
|
+
*/
|
|
3716
|
+
static async create(options) {
|
|
3717
|
+
const baseUrl = options.platformUrl ?? DEFAULT_PLATFORM_URL;
|
|
3718
|
+
const discoveredConfig = await fetchPlatformConfig(baseUrl).catch(() => null);
|
|
3719
|
+
const rpcUrl = options.rpcUrl ?? discoveredConfig?.rpcUrl ?? DEFAULT_RPC_URL;
|
|
3720
|
+
const wsUrl = discoveredConfig?.wsUrl ?? (baseUrl.startsWith("http://") ? baseUrl.replace("http://", "ws://") + "/ws" : baseUrl.replace("https://", "wss://") + "/ws");
|
|
3721
|
+
const pk = options.privateKey.startsWith("0x") ? options.privateKey : `0x${options.privateKey}`;
|
|
3722
|
+
const account = privateKeyToAccount(pk);
|
|
3723
|
+
const viemChain = baseSepolia;
|
|
3724
|
+
const publicClient = createPublicClient({
|
|
3725
|
+
chain: viemChain,
|
|
3726
|
+
transport: http(rpcUrl)
|
|
3727
|
+
});
|
|
3728
|
+
const walletClient = createWalletClient({
|
|
3729
|
+
account,
|
|
3730
|
+
chain: viemChain,
|
|
3731
|
+
transport: http(rpcUrl)
|
|
3732
|
+
});
|
|
3733
|
+
const chainConfig = {
|
|
3734
|
+
chainId: CHAIN_ID,
|
|
3735
|
+
rpcUrl,
|
|
3736
|
+
escrowAddress: ESCROW_ADDRESS,
|
|
3737
|
+
tipJarAddress: TIPJAR_ADDRESS,
|
|
3738
|
+
usdcAddress: USDC_ADDRESS,
|
|
3739
|
+
explorerUrl: EXPLORER_URL
|
|
3740
|
+
};
|
|
3741
|
+
const client = new AgentPactClient(
|
|
3742
|
+
publicClient,
|
|
3743
|
+
chainConfig,
|
|
3744
|
+
walletClient
|
|
3745
|
+
);
|
|
3746
|
+
const platformConfig = {
|
|
3747
|
+
chainId: CHAIN_ID,
|
|
3748
|
+
escrowAddress: ESCROW_ADDRESS,
|
|
3749
|
+
tipJarAddress: TIPJAR_ADDRESS,
|
|
3750
|
+
usdcAddress: USDC_ADDRESS,
|
|
3751
|
+
rpcUrl,
|
|
3752
|
+
wsUrl,
|
|
3753
|
+
explorerUrl: EXPLORER_URL,
|
|
3754
|
+
platformUrl: baseUrl,
|
|
3755
|
+
envioUrl: options.envioUrl ?? discoveredConfig?.envioUrl,
|
|
3756
|
+
chainSyncMode: discoveredConfig?.chainSyncMode,
|
|
3757
|
+
platformFeeBps: discoveredConfig?.platformFeeBps,
|
|
3758
|
+
minPassRate: discoveredConfig?.minPassRate,
|
|
3759
|
+
version: discoveredConfig?.version
|
|
3760
|
+
};
|
|
3761
|
+
let jwtToken = options.jwtToken ?? "";
|
|
3762
|
+
if (!jwtToken) {
|
|
3763
|
+
jwtToken = await _AgentPactAgent.autoSiweLogin(
|
|
3764
|
+
baseUrl,
|
|
3765
|
+
account.address,
|
|
3766
|
+
walletClient
|
|
3767
|
+
);
|
|
3768
|
+
}
|
|
3769
|
+
return new _AgentPactAgent(
|
|
3770
|
+
{
|
|
3771
|
+
client,
|
|
3772
|
+
platformUrl: baseUrl,
|
|
3773
|
+
wsUrl,
|
|
3774
|
+
jwtToken,
|
|
3775
|
+
wsOptions: options.wsOptions,
|
|
3776
|
+
autoClaimOnSignature: options.autoClaimOnSignature ?? true
|
|
3777
|
+
},
|
|
3778
|
+
platformConfig
|
|
3779
|
+
);
|
|
3780
|
+
}
|
|
3781
|
+
/**
|
|
3782
|
+
* Perform automatic SIWE login to obtain a JWT token.
|
|
3783
|
+
*
|
|
3784
|
+
* Flow:
|
|
3785
|
+
* 1. GET /api/auth/nonce?address=0x... → { nonce }
|
|
3786
|
+
* 2. Construct EIP-4361 SIWE message with nonce
|
|
3787
|
+
* 3. Sign message with wallet private key
|
|
3788
|
+
* 4. POST /api/auth/verify { message, signature } → { token }
|
|
3789
|
+
*/
|
|
3790
|
+
static async autoSiweLogin(platformUrl, address, walletClient) {
|
|
3791
|
+
const baseUrl = platformUrl.replace(/\/$/, "");
|
|
3792
|
+
const nonceRes = await fetch(`${baseUrl}/api/auth/nonce?address=${address}`);
|
|
3793
|
+
if (!nonceRes.ok) {
|
|
3794
|
+
throw new Error(
|
|
3795
|
+
`SIWE nonce request failed: ${nonceRes.status} ${nonceRes.statusText}`
|
|
3796
|
+
);
|
|
3797
|
+
}
|
|
3798
|
+
const { nonce } = await nonceRes.json();
|
|
3799
|
+
const domain = new URL(baseUrl).host;
|
|
3800
|
+
const uri = baseUrl;
|
|
3801
|
+
const issuedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3802
|
+
const siweMessage = [
|
|
3803
|
+
`${domain} wants you to sign in with your Ethereum account:`,
|
|
3804
|
+
address,
|
|
3805
|
+
"",
|
|
3806
|
+
"Sign in to AgentPact",
|
|
3807
|
+
"",
|
|
3808
|
+
`URI: ${uri}`,
|
|
3809
|
+
`Version: 1`,
|
|
3810
|
+
`Chain ID: ${walletClient.chain?.id ?? 8453}`,
|
|
3811
|
+
`Nonce: ${nonce}`,
|
|
3812
|
+
`Issued At: ${issuedAt}`
|
|
3813
|
+
].join("\n");
|
|
3814
|
+
const signature = await walletClient.signMessage({
|
|
3815
|
+
message: siweMessage
|
|
3816
|
+
});
|
|
3817
|
+
const verifyRes = await fetch(`${baseUrl}/api/auth/verify`, {
|
|
3818
|
+
method: "POST",
|
|
3819
|
+
headers: { "Content-Type": "application/json" },
|
|
3820
|
+
body: JSON.stringify({ message: siweMessage, signature })
|
|
3821
|
+
});
|
|
3822
|
+
if (!verifyRes.ok) {
|
|
3823
|
+
throw new Error(
|
|
3824
|
+
`SIWE verification failed: ${verifyRes.status} ${verifyRes.statusText}`
|
|
3825
|
+
);
|
|
3826
|
+
}
|
|
3827
|
+
const { token } = await verifyRes.json();
|
|
3828
|
+
return token;
|
|
3829
|
+
}
|
|
3830
|
+
/** Whether the agent is currently running */
|
|
3831
|
+
get running() {
|
|
3832
|
+
return this._running;
|
|
3833
|
+
}
|
|
3834
|
+
/**
|
|
3835
|
+
* Start the agent: connect WebSocket, authenticate, begin event loop.
|
|
3836
|
+
*/
|
|
3837
|
+
async start() {
|
|
3838
|
+
if (this._running) return;
|
|
3839
|
+
this.ws.on("*", (raw) => {
|
|
3840
|
+
const { event, data } = raw;
|
|
3841
|
+
const taskEvent = {
|
|
3842
|
+
type: event,
|
|
3843
|
+
data: data || {}
|
|
3844
|
+
};
|
|
3845
|
+
this.handleBuiltInEvent(event, taskEvent);
|
|
3846
|
+
this.dispatch(event, taskEvent);
|
|
3847
|
+
});
|
|
3848
|
+
await this.ws.connect(this.jwtToken);
|
|
3849
|
+
this._running = true;
|
|
3850
|
+
for (const taskId of this.subscribedTasks) {
|
|
3851
|
+
this.ws.subscribeToTask(taskId);
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
/** Stop the agent */
|
|
3855
|
+
stop() {
|
|
3856
|
+
this._running = false;
|
|
3857
|
+
this.ws.disconnect();
|
|
3858
|
+
}
|
|
3859
|
+
/** Register an event handler */
|
|
3860
|
+
on(event, handler) {
|
|
3861
|
+
if (!this.handlers.has(event)) {
|
|
3862
|
+
this.handlers.set(event, /* @__PURE__ */ new Set());
|
|
3863
|
+
}
|
|
3864
|
+
this.handlers.get(event).add(handler);
|
|
3865
|
+
return () => {
|
|
3866
|
+
this.handlers.get(event)?.delete(handler);
|
|
3867
|
+
};
|
|
3868
|
+
}
|
|
3869
|
+
/** Watch a specific task for real-time updates */
|
|
3870
|
+
watchTask(taskId) {
|
|
3871
|
+
this.subscribedTasks.add(taskId);
|
|
3872
|
+
if (this._running) {
|
|
3873
|
+
this.ws.subscribeToTask(taskId);
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
/** Stop watching a task */
|
|
3877
|
+
unwatchTask(taskId) {
|
|
3878
|
+
this.subscribedTasks.delete(taskId);
|
|
3879
|
+
}
|
|
3880
|
+
// ──── Task Lifecycle Methods ─────────────────────────────────────
|
|
3881
|
+
/**
|
|
3882
|
+
* Confirm a task after reviewing confidential materials.
|
|
3883
|
+
* Calls confirmTask() on-chain → state becomes Working.
|
|
3884
|
+
*/
|
|
3885
|
+
async confirmTask(escrowId) {
|
|
3886
|
+
const txHash = await this.client.confirmTask(escrowId);
|
|
3887
|
+
console.log(`[Agent] Task confirmed on-chain: ${txHash}`);
|
|
3888
|
+
return txHash;
|
|
3889
|
+
}
|
|
3890
|
+
/**
|
|
3891
|
+
* Decline a task after reviewing confidential materials.
|
|
3892
|
+
* Calls declineTask() on-chain → state returns to Created for next agent.
|
|
3893
|
+
*/
|
|
3894
|
+
async declineTask(escrowId) {
|
|
3895
|
+
const txHash = await this.client.declineTask(escrowId);
|
|
3896
|
+
console.log(`[Agent] Task declined on-chain: ${txHash}`);
|
|
3897
|
+
return txHash;
|
|
3898
|
+
}
|
|
3899
|
+
/**
|
|
3900
|
+
* Submit delivery materials when task is finished.
|
|
3901
|
+
* Calls submitDelivery() on-chain → state becomes Delivered.
|
|
3902
|
+
*/
|
|
3903
|
+
async submitDelivery(escrowId, deliveryHash) {
|
|
3904
|
+
const formattedHash = deliveryHash.startsWith("0x") ? deliveryHash : `0x${deliveryHash}`;
|
|
3905
|
+
const txHash = await this.client.submitDelivery(escrowId, formattedHash);
|
|
3906
|
+
console.log(`[Agent] Delivery submitted on-chain: ${txHash} for escrow: ${escrowId}`);
|
|
3907
|
+
return txHash;
|
|
3908
|
+
}
|
|
3909
|
+
/**
|
|
3910
|
+
* Voluntarily abandon a task during Working or InRevision.
|
|
3911
|
+
* Lighter credit penalty than delivery timeout. Task returns to Created for re-matching.
|
|
3912
|
+
*/
|
|
3913
|
+
async abandonTask(escrowId) {
|
|
3914
|
+
const txHash = await this.client.abandonTask(escrowId);
|
|
3915
|
+
console.log(`[Agent] Task abandoned on-chain: ${txHash}`);
|
|
3916
|
+
return txHash;
|
|
3917
|
+
}
|
|
3918
|
+
/**
|
|
3919
|
+
* Report execution progress to the platform.
|
|
3920
|
+
* This is a platform API call (not on-chain) for visibility.
|
|
3921
|
+
*
|
|
3922
|
+
* @param taskId - Task ID
|
|
3923
|
+
* @param percent - Progress percentage (0-100)
|
|
3924
|
+
* @param description - Human-readable progress description
|
|
3925
|
+
*/
|
|
3926
|
+
async reportProgress(taskId, percent, description) {
|
|
3927
|
+
const res = await fetch(
|
|
3928
|
+
`${this.platformUrl}/api/tasks/${taskId}/progress`,
|
|
3929
|
+
{
|
|
3930
|
+
method: "POST",
|
|
3931
|
+
headers: this.headers(),
|
|
3932
|
+
body: JSON.stringify({ percent: Math.max(0, Math.min(100, percent)), description })
|
|
3933
|
+
}
|
|
3934
|
+
);
|
|
3935
|
+
if (!res.ok) throw new Error(`Failed to report progress: ${res.status}`);
|
|
3936
|
+
console.log(`[Agent] Progress reported: ${percent}% \u2014 ${description}`);
|
|
3937
|
+
}
|
|
3938
|
+
/**
|
|
3939
|
+
* Claim acceptance timeout — when requester doesn't review within the window.
|
|
3940
|
+
* Agent gets full reward. Only callable by requester or provider.
|
|
3941
|
+
*/
|
|
3942
|
+
async claimAcceptanceTimeout(escrowId) {
|
|
3943
|
+
const txHash = await this.client.claimAcceptanceTimeout(escrowId);
|
|
3944
|
+
console.log(`[Agent] Acceptance timeout claimed: ${txHash}`);
|
|
3945
|
+
return txHash;
|
|
3946
|
+
}
|
|
3947
|
+
/**
|
|
3948
|
+
* Claim delivery timeout — when provider doesn't deliver on time.
|
|
3949
|
+
* Requester gets full refund. Only callable by requester or provider.
|
|
3950
|
+
*/
|
|
3951
|
+
async claimDeliveryTimeout(escrowId) {
|
|
3952
|
+
const txHash = await this.client.claimDeliveryTimeout(escrowId);
|
|
3953
|
+
console.log(`[Agent] Delivery timeout claimed: ${txHash}`);
|
|
3954
|
+
return txHash;
|
|
3955
|
+
}
|
|
3956
|
+
/**
|
|
3957
|
+
* Claim confirmation timeout — when provider doesn't confirm/decline within 2h.
|
|
3958
|
+
* Task returns to Created for re-matching. Only callable by requester or provider.
|
|
3959
|
+
*/
|
|
3960
|
+
async claimConfirmationTimeout(escrowId) {
|
|
3961
|
+
const txHash = await this.client.claimConfirmationTimeout(escrowId);
|
|
3962
|
+
console.log(`[Agent] Confirmation timeout claimed: ${txHash}`);
|
|
3963
|
+
return txHash;
|
|
3964
|
+
}
|
|
3965
|
+
/**
|
|
3966
|
+
* Fetch revision details including structured criteriaResults.
|
|
3967
|
+
* Use after receiving a REVISION_REQUESTED event to understand what failed.
|
|
3968
|
+
*
|
|
3969
|
+
* @param taskId - Task ID
|
|
3970
|
+
* @param revision - Revision number (1-based)
|
|
3971
|
+
*/
|
|
3972
|
+
async getRevisionDetails(taskId, revision) {
|
|
3973
|
+
const params = revision ? `?revision=${revision}` : "";
|
|
3974
|
+
const res = await fetch(
|
|
3975
|
+
`${this.platformUrl}/api/revisions/${taskId}${params}`,
|
|
3976
|
+
{ headers: this.headers() }
|
|
3977
|
+
);
|
|
3978
|
+
if (!res.ok) throw new Error(`Failed to fetch revision details: ${res.status}`);
|
|
3979
|
+
const body = await res.json();
|
|
3980
|
+
return body.data ?? body.revisions ?? body;
|
|
3981
|
+
}
|
|
3982
|
+
/**
|
|
3983
|
+
* Fetch task timeline.
|
|
3984
|
+
* Platform will prefer Envio projections and fall back to local task logs when needed.
|
|
3985
|
+
*/
|
|
3986
|
+
async getTaskTimeline(taskId) {
|
|
3987
|
+
const res = await fetch(
|
|
3988
|
+
`${this.platformUrl}/api/tasks/${taskId}/timeline`,
|
|
3989
|
+
{ headers: this.headers() }
|
|
3990
|
+
);
|
|
3991
|
+
if (!res.ok) throw new Error(`Failed to fetch task timeline: ${res.status}`);
|
|
3992
|
+
const body = await res.json();
|
|
3993
|
+
return body.data ?? [];
|
|
3994
|
+
}
|
|
3995
|
+
/**
|
|
3996
|
+
* Fetch full task details including confidential materials.
|
|
3997
|
+
* Only available after claimTask() has been called on-chain.
|
|
3998
|
+
*/
|
|
3999
|
+
async fetchTaskDetails(taskId) {
|
|
4000
|
+
const res = await fetch(
|
|
4001
|
+
`${this.platformUrl}/api/tasks/${taskId}/details`,
|
|
4002
|
+
{ headers: this.headers() }
|
|
4003
|
+
);
|
|
4004
|
+
if (!res.ok) throw new Error(`Failed to fetch task details: ${res.status}`);
|
|
4005
|
+
const body = await res.json();
|
|
4006
|
+
return body.data ?? body;
|
|
4007
|
+
}
|
|
4008
|
+
async registerProvider(agentType = "openclaw-agent", capabilities = ["general"]) {
|
|
4009
|
+
const res = await fetch(`${this.platformUrl}/api/providers`, {
|
|
4010
|
+
method: "POST",
|
|
4011
|
+
headers: this.headers(),
|
|
4012
|
+
body: JSON.stringify({ agentType, capabilities })
|
|
4013
|
+
});
|
|
4014
|
+
if (!res.ok) throw new Error(`Failed to register provider: ${res.status}`);
|
|
4015
|
+
const body = await res.json();
|
|
4016
|
+
return body.profile ?? body.data;
|
|
4017
|
+
}
|
|
4018
|
+
async ensureProviderProfile(agentType = "openclaw-agent", capabilities = ["general"]) {
|
|
4019
|
+
const meRes = await fetch(`${this.platformUrl}/api/auth/me`, {
|
|
4020
|
+
headers: this.headers()
|
|
4021
|
+
});
|
|
4022
|
+
if (!meRes.ok) {
|
|
4023
|
+
throw new Error(`Failed to fetch current profile: ${meRes.status}`);
|
|
4024
|
+
}
|
|
4025
|
+
const meBody = await meRes.json();
|
|
4026
|
+
if (meBody.user?.providerProfile) {
|
|
4027
|
+
return meBody.user.providerProfile;
|
|
4028
|
+
}
|
|
4029
|
+
return this.registerProvider(agentType, capabilities);
|
|
4030
|
+
}
|
|
4031
|
+
// ──── Convenience Methods ────────────────────────────────────────
|
|
4032
|
+
async getAvailableTasks(options = {}) {
|
|
4033
|
+
const params = new URLSearchParams();
|
|
4034
|
+
params.set("limit", String(options.limit ?? 20));
|
|
4035
|
+
params.set("offset", String(options.offset ?? 0));
|
|
4036
|
+
if (options.status) params.set("status", options.status);
|
|
4037
|
+
const fetchFromPlatform = async () => {
|
|
4038
|
+
const res = await fetch(
|
|
4039
|
+
`${this.platformUrl}/api/tasks?${params}`,
|
|
4040
|
+
{ headers: this.headers() }
|
|
4041
|
+
);
|
|
4042
|
+
if (!res.ok) throw new Error(`Failed to fetch tasks: ${res.status}`);
|
|
4043
|
+
const body = await res.json();
|
|
4044
|
+
return body.data || body.tasks || [];
|
|
4045
|
+
};
|
|
4046
|
+
try {
|
|
4047
|
+
return await fetchFromPlatform();
|
|
4048
|
+
} catch (platformError) {
|
|
4049
|
+
if (!this.platformConfig.envioUrl) {
|
|
4050
|
+
throw platformError;
|
|
4051
|
+
}
|
|
4052
|
+
return queryAvailableTasksFromEnvio(this.platformConfig, options);
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
4055
|
+
async bidOnTask(taskId, message) {
|
|
4056
|
+
const res = await fetch(
|
|
4057
|
+
`${this.platformUrl}/api/matching/bid`,
|
|
4058
|
+
{
|
|
4059
|
+
method: "POST",
|
|
4060
|
+
headers: this.headers(),
|
|
4061
|
+
body: JSON.stringify({ taskId, message })
|
|
4062
|
+
}
|
|
4063
|
+
);
|
|
4064
|
+
if (!res.ok) throw new Error(`Failed to bid: ${res.status}`);
|
|
4065
|
+
const body = await res.json();
|
|
4066
|
+
return body.data ?? body.task ?? body;
|
|
4067
|
+
}
|
|
4068
|
+
async sendMessage(taskId, content, type = "GENERAL") {
|
|
4069
|
+
return this.chat.sendMessage(taskId, content, type);
|
|
4070
|
+
}
|
|
4071
|
+
// ──── Built-in Deterministic Handlers ────────────────────────────
|
|
4072
|
+
/**
|
|
4073
|
+
* Handle events that require deterministic (non-LLM) processing.
|
|
4074
|
+
* These run BEFORE user-registered handlers.
|
|
4075
|
+
*/
|
|
4076
|
+
handleBuiltInEvent(event, taskEvent) {
|
|
4077
|
+
switch (event) {
|
|
4078
|
+
case "ASSIGNMENT_SIGNATURE":
|
|
4079
|
+
if (this.autoClaimOnSignature) {
|
|
4080
|
+
this.handleAssignmentSignature(taskEvent);
|
|
4081
|
+
}
|
|
4082
|
+
break;
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
/**
|
|
4086
|
+
* Auto-claim task on-chain when platform delivers EIP-712 signature.
|
|
4087
|
+
* This is deterministic — no LLM involved, just contract call.
|
|
4088
|
+
*/
|
|
4089
|
+
handleAssignmentSignature(event) {
|
|
4090
|
+
const data = event.data;
|
|
4091
|
+
const claimParams = {
|
|
4092
|
+
escrowId: BigInt(data.escrowId),
|
|
4093
|
+
nonce: BigInt(data.nonce),
|
|
4094
|
+
expiredAt: BigInt(data.expiredAt),
|
|
4095
|
+
platformSignature: data.signature
|
|
4096
|
+
};
|
|
4097
|
+
console.log(`[Agent] Assignment signature received for escrow ${claimParams.escrowId}`);
|
|
4098
|
+
console.log(`[Agent] Auto-claiming task on-chain...`);
|
|
4099
|
+
this.client.claimTask(claimParams).then((txHash) => {
|
|
4100
|
+
console.log(`[Agent] claimTask() tx: ${txHash}`);
|
|
4101
|
+
console.log(`[Agent] Task claimed. Waiting for confidential materials (TASK_DETAILS)...`);
|
|
4102
|
+
this.dispatch("TASK_CLAIMED", {
|
|
4103
|
+
type: "TASK_CLAIMED",
|
|
4104
|
+
data: {
|
|
4105
|
+
escrowId: claimParams.escrowId,
|
|
4106
|
+
txHash,
|
|
4107
|
+
taskId: data.taskId
|
|
4108
|
+
}
|
|
4109
|
+
});
|
|
4110
|
+
}).catch((err) => {
|
|
4111
|
+
console.error(`[Agent] claimTask() failed:`, err);
|
|
4112
|
+
this.dispatch("CLAIM_FAILED", {
|
|
4113
|
+
type: "CLAIM_FAILED",
|
|
4114
|
+
data: {
|
|
4115
|
+
escrowId: claimParams.escrowId,
|
|
4116
|
+
error: err instanceof Error ? err.message : String(err),
|
|
4117
|
+
taskId: data.taskId
|
|
4118
|
+
}
|
|
4119
|
+
});
|
|
4120
|
+
});
|
|
4121
|
+
}
|
|
4122
|
+
// ──── Private ────────────────────────────────────────────────────
|
|
4123
|
+
dispatch(event, data) {
|
|
4124
|
+
const handlers = this.handlers.get(event);
|
|
4125
|
+
if (handlers) {
|
|
4126
|
+
for (const handler of handlers) {
|
|
4127
|
+
try {
|
|
4128
|
+
const result = handler(data);
|
|
4129
|
+
if (result instanceof Promise) {
|
|
4130
|
+
result.catch((err) => {
|
|
4131
|
+
console.error(`[Agent] Async handler error for "${event}":`, err);
|
|
4132
|
+
});
|
|
4133
|
+
}
|
|
4134
|
+
} catch (err) {
|
|
4135
|
+
console.error(`[Agent] Handler error for "${event}":`, err);
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
headers() {
|
|
4141
|
+
return {
|
|
4142
|
+
Authorization: `Bearer ${this.jwtToken}`,
|
|
4143
|
+
"Content-Type": "application/json"
|
|
4144
|
+
};
|
|
4145
|
+
}
|
|
4146
|
+
};
|
|
4147
|
+
|
|
4148
|
+
export { AgentPactAgent, AgentPactClient, AgentPactWebSocket, CONFIRMATION_WINDOW_SECONDS, DEFAULT_PLATFORM_URL, EIP712_DOMAIN, ETH_TOKEN, KNOWN_PLATFORMS, MAX_DECLINE_COUNT, MIN_PASS_RATE, PLATFORM_FEE_BPS, SocialClient, TASK_ASSIGNMENT_TYPES, TaskCategory, TaskChatClient, TaskState, TaskStateLabel, computeDeliveryHash, computeStringHash, createSignedAssignment, fetchPlatformConfig, queryAvailableTasksFromEnvio, signTaskAssignment, uploadDelivery };
|
|
4149
|
+
//# sourceMappingURL=index.js.map
|
|
4150
|
+
//# sourceMappingURL=index.js.map
|