@blindmarket/sdk 0.1.8 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/executor/WorkerRuntime.d.ts +21 -0
  2. package/dist/executor/WorkerRuntime.js +56 -27
  3. package/dist/index.d.ts +75 -9
  4. package/dist/index.js +52 -3
  5. package/package.json +8 -1
  6. package/biome.json +0 -19
  7. package/examples/agent-demo.ts +0 -121
  8. package/scripts/gen-crypto-fixtures.mjs +0 -72
  9. package/src/agent/Agent.ts +0 -122
  10. package/src/agent/index.ts +0 -1
  11. package/src/api/index.ts +0 -1
  12. package/src/chain/BlindEscrowClient.ts +0 -196
  13. package/src/chain/BlindReputationClient.ts +0 -60
  14. package/src/chain/ChainClient.ts +0 -65
  15. package/src/chain/IBlindMarketChain.ts +0 -109
  16. package/src/chain/TaskRegistryClient.ts +0 -91
  17. package/src/chain/abi/BlindEscrow.json +0 -1113
  18. package/src/chain/abi/BlindReputation.json +0 -447
  19. package/src/chain/abi/TaskRegistry.json +0 -586
  20. package/src/chain/abi/index.ts +0 -5
  21. package/src/chain/createChainAdapter.ts +0 -40
  22. package/src/chain/domain-types.ts +0 -92
  23. package/src/chain/errors.ts +0 -43
  24. package/src/chain/evm/EVMChainAdapter.ts +0 -212
  25. package/src/chain/evm/index.ts +0 -1
  26. package/src/chain/index.ts +0 -12
  27. package/src/compute/index.ts +0 -1
  28. package/src/crypto/aes.ts +0 -104
  29. package/src/crypto/constants.ts +0 -7
  30. package/src/crypto/ecies.ts +0 -60
  31. package/src/crypto/envelope.ts +0 -131
  32. package/src/crypto/hkdf.ts +0 -45
  33. package/src/crypto/index.ts +0 -6
  34. package/src/crypto/keys.ts +0 -56
  35. package/src/errors/BlindMarketError.ts +0 -38
  36. package/src/errors/codes.ts +0 -67
  37. package/src/errors/index.ts +0 -3
  38. package/src/errors/subclasses.ts +0 -59
  39. package/src/events/EventBus.ts +0 -45
  40. package/src/events/index.ts +0 -2
  41. package/src/events/types.ts +0 -13
  42. package/src/executor/WorkerRuntime.ts +0 -338
  43. package/src/executor/index.ts +0 -8
  44. package/src/index.ts +0 -636
  45. package/src/keystore/InMemoryKeyStore.ts +0 -146
  46. package/src/keystore/KeyStore.ts +0 -19
  47. package/src/keystore/index.ts +0 -2
  48. package/src/network/index.ts +0 -3
  49. package/src/network/presets.ts +0 -66
  50. package/src/network/resolve.ts +0 -31
  51. package/src/network/types.ts +0 -20
  52. package/src/signer/EthersSigner.ts +0 -82
  53. package/src/signer/PrivateKeySigner.ts +0 -19
  54. package/src/signer/Signer.ts +0 -40
  55. package/src/signer/index.ts +0 -3
  56. package/src/storage/MemoryStorage.ts +0 -49
  57. package/src/storage/Storage.ts +0 -15
  58. package/src/storage/ZgStorage.ts +0 -124
  59. package/src/storage/index.ts +0 -3
  60. package/src/testing/index.ts +0 -1
  61. package/src/tools/adapters.ts +0 -177
  62. package/src/tools/helpers.ts +0 -199
  63. package/src/tools/index.ts +0 -59
  64. package/src/tools/types.ts +0 -47
  65. package/src/types.ts +0 -297
  66. package/src/verifier/index.ts +0 -1
  67. package/src/worker/Worker.ts +0 -98
  68. package/src/worker/index.ts +0 -1
  69. package/test/agent.test.ts +0 -193
  70. package/test/chain.test.ts +0 -145
  71. package/test/crypto.aes.test.ts +0 -81
  72. package/test/crypto.compat.test.ts +0 -33
  73. package/test/crypto.ecies.test.ts +0 -64
  74. package/test/envelope.test.ts +0 -82
  75. package/test/errors.test.ts +0 -64
  76. package/test/events.test.ts +0 -59
  77. package/test/fixtures/crypto.json +0 -16
  78. package/test/keystore.test.ts +0 -103
  79. package/test/network.test.ts +0 -53
  80. package/test/signer.test.ts +0 -66
  81. package/test/smoke.test.ts +0 -7
  82. package/test/storage.test.ts +0 -55
  83. package/test/worker.test.ts +0 -181
  84. package/tsconfig.build.json +0 -1
  85. package/tsconfig.json +0 -14
  86. package/tsup.config.ts +0 -32
  87. package/vitest.config.ts +0 -17
@@ -1,586 +0,0 @@
1
- [
2
- {
3
- "inputs": [],
4
- "stateMutability": "nonpayable",
5
- "type": "constructor"
6
- },
7
- {
8
- "inputs": [],
9
- "name": "EnforcedPause",
10
- "type": "error"
11
- },
12
- {
13
- "inputs": [],
14
- "name": "ExpectedPause",
15
- "type": "error"
16
- },
17
- {
18
- "inputs": [],
19
- "name": "NotAdmin",
20
- "type": "error"
21
- },
22
- {
23
- "inputs": [],
24
- "name": "NotAuthorized",
25
- "type": "error"
26
- },
27
- {
28
- "inputs": [],
29
- "name": "NotPendingAdmin",
30
- "type": "error"
31
- },
32
- {
33
- "inputs": [],
34
- "name": "TaskAlreadyClosed",
35
- "type": "error"
36
- },
37
- {
38
- "inputs": [],
39
- "name": "TaskAlreadyExists",
40
- "type": "error"
41
- },
42
- {
43
- "inputs": [],
44
- "name": "TaskNotFound",
45
- "type": "error"
46
- },
47
- {
48
- "inputs": [],
49
- "name": "ZeroAddress",
50
- "type": "error"
51
- },
52
- {
53
- "anonymous": false,
54
- "inputs": [
55
- {
56
- "indexed": true,
57
- "internalType": "address",
58
- "name": "oldAdmin",
59
- "type": "address"
60
- },
61
- {
62
- "indexed": true,
63
- "internalType": "address",
64
- "name": "newAdmin",
65
- "type": "address"
66
- }
67
- ],
68
- "name": "AdminTransferCompleted",
69
- "type": "event"
70
- },
71
- {
72
- "anonymous": false,
73
- "inputs": [
74
- {
75
- "indexed": true,
76
- "internalType": "address",
77
- "name": "currentAdmin",
78
- "type": "address"
79
- },
80
- {
81
- "indexed": true,
82
- "internalType": "address",
83
- "name": "pendingAdmin",
84
- "type": "address"
85
- }
86
- ],
87
- "name": "AdminTransferProposed",
88
- "type": "event"
89
- },
90
- {
91
- "anonymous": false,
92
- "inputs": [
93
- {
94
- "indexed": false,
95
- "internalType": "address",
96
- "name": "account",
97
- "type": "address"
98
- }
99
- ],
100
- "name": "Paused",
101
- "type": "event"
102
- },
103
- {
104
- "anonymous": false,
105
- "inputs": [
106
- {
107
- "indexed": true,
108
- "internalType": "address",
109
- "name": "publisher",
110
- "type": "address"
111
- }
112
- ],
113
- "name": "PublisherAuthorized",
114
- "type": "event"
115
- },
116
- {
117
- "anonymous": false,
118
- "inputs": [
119
- {
120
- "indexed": true,
121
- "internalType": "address",
122
- "name": "publisher",
123
- "type": "address"
124
- }
125
- ],
126
- "name": "PublisherRevoked",
127
- "type": "event"
128
- },
129
- {
130
- "anonymous": false,
131
- "inputs": [
132
- {
133
- "indexed": true,
134
- "internalType": "uint256",
135
- "name": "taskId",
136
- "type": "uint256"
137
- }
138
- ],
139
- "name": "TaskClosed",
140
- "type": "event"
141
- },
142
- {
143
- "anonymous": false,
144
- "inputs": [
145
- {
146
- "indexed": true,
147
- "internalType": "uint256",
148
- "name": "taskId",
149
- "type": "uint256"
150
- },
151
- {
152
- "indexed": true,
153
- "internalType": "address",
154
- "name": "agent",
155
- "type": "address"
156
- },
157
- {
158
- "indexed": false,
159
- "internalType": "string",
160
- "name": "category",
161
- "type": "string"
162
- },
163
- {
164
- "indexed": false,
165
- "internalType": "string",
166
- "name": "locationZone",
167
- "type": "string"
168
- },
169
- {
170
- "indexed": false,
171
- "internalType": "uint256",
172
- "name": "reward",
173
- "type": "uint256"
174
- }
175
- ],
176
- "name": "TaskPublished",
177
- "type": "event"
178
- },
179
- {
180
- "anonymous": false,
181
- "inputs": [
182
- {
183
- "indexed": false,
184
- "internalType": "address",
185
- "name": "account",
186
- "type": "address"
187
- }
188
- ],
189
- "name": "Unpaused",
190
- "type": "event"
191
- },
192
- {
193
- "inputs": [],
194
- "name": "acceptAdmin",
195
- "outputs": [],
196
- "stateMutability": "nonpayable",
197
- "type": "function"
198
- },
199
- {
200
- "inputs": [],
201
- "name": "admin",
202
- "outputs": [
203
- {
204
- "internalType": "address",
205
- "name": "",
206
- "type": "address"
207
- }
208
- ],
209
- "stateMutability": "view",
210
- "type": "function"
211
- },
212
- {
213
- "inputs": [
214
- {
215
- "internalType": "address",
216
- "name": "publisher",
217
- "type": "address"
218
- }
219
- ],
220
- "name": "authorizePublisher",
221
- "outputs": [],
222
- "stateMutability": "nonpayable",
223
- "type": "function"
224
- },
225
- {
226
- "inputs": [
227
- {
228
- "internalType": "address",
229
- "name": "",
230
- "type": "address"
231
- }
232
- ],
233
- "name": "authorizedPublishers",
234
- "outputs": [
235
- {
236
- "internalType": "bool",
237
- "name": "",
238
- "type": "bool"
239
- }
240
- ],
241
- "stateMutability": "view",
242
- "type": "function"
243
- },
244
- {
245
- "inputs": [
246
- {
247
- "internalType": "uint256",
248
- "name": "taskId",
249
- "type": "uint256"
250
- }
251
- ],
252
- "name": "closeTask",
253
- "outputs": [],
254
- "stateMutability": "nonpayable",
255
- "type": "function"
256
- },
257
- {
258
- "inputs": [
259
- {
260
- "internalType": "uint256",
261
- "name": "offset",
262
- "type": "uint256"
263
- },
264
- {
265
- "internalType": "uint256",
266
- "name": "limit",
267
- "type": "uint256"
268
- }
269
- ],
270
- "name": "getOpenTasks",
271
- "outputs": [
272
- {
273
- "components": [
274
- {
275
- "internalType": "uint256",
276
- "name": "taskId",
277
- "type": "uint256"
278
- },
279
- {
280
- "internalType": "address",
281
- "name": "agent",
282
- "type": "address"
283
- },
284
- {
285
- "internalType": "string",
286
- "name": "category",
287
- "type": "string"
288
- },
289
- {
290
- "internalType": "string",
291
- "name": "locationZone",
292
- "type": "string"
293
- },
294
- {
295
- "internalType": "uint256",
296
- "name": "reward",
297
- "type": "uint256"
298
- },
299
- {
300
- "internalType": "uint256",
301
- "name": "createdAt",
302
- "type": "uint256"
303
- },
304
- {
305
- "internalType": "bool",
306
- "name": "isOpen",
307
- "type": "bool"
308
- }
309
- ],
310
- "internalType": "struct TaskRegistry.TaskMeta[]",
311
- "name": "",
312
- "type": "tuple[]"
313
- }
314
- ],
315
- "stateMutability": "view",
316
- "type": "function"
317
- },
318
- {
319
- "inputs": [
320
- {
321
- "internalType": "uint256",
322
- "name": "taskId",
323
- "type": "uint256"
324
- }
325
- ],
326
- "name": "getTaskMeta",
327
- "outputs": [
328
- {
329
- "components": [
330
- {
331
- "internalType": "uint256",
332
- "name": "taskId",
333
- "type": "uint256"
334
- },
335
- {
336
- "internalType": "address",
337
- "name": "agent",
338
- "type": "address"
339
- },
340
- {
341
- "internalType": "string",
342
- "name": "category",
343
- "type": "string"
344
- },
345
- {
346
- "internalType": "string",
347
- "name": "locationZone",
348
- "type": "string"
349
- },
350
- {
351
- "internalType": "uint256",
352
- "name": "reward",
353
- "type": "uint256"
354
- },
355
- {
356
- "internalType": "uint256",
357
- "name": "createdAt",
358
- "type": "uint256"
359
- },
360
- {
361
- "internalType": "bool",
362
- "name": "isOpen",
363
- "type": "bool"
364
- }
365
- ],
366
- "internalType": "struct TaskRegistry.TaskMeta",
367
- "name": "",
368
- "type": "tuple"
369
- }
370
- ],
371
- "stateMutability": "view",
372
- "type": "function"
373
- },
374
- {
375
- "inputs": [],
376
- "name": "openTaskCount",
377
- "outputs": [
378
- {
379
- "internalType": "uint256",
380
- "name": "",
381
- "type": "uint256"
382
- }
383
- ],
384
- "stateMutability": "view",
385
- "type": "function"
386
- },
387
- {
388
- "inputs": [],
389
- "name": "pause",
390
- "outputs": [],
391
- "stateMutability": "nonpayable",
392
- "type": "function"
393
- },
394
- {
395
- "inputs": [],
396
- "name": "paused",
397
- "outputs": [
398
- {
399
- "internalType": "bool",
400
- "name": "",
401
- "type": "bool"
402
- }
403
- ],
404
- "stateMutability": "view",
405
- "type": "function"
406
- },
407
- {
408
- "inputs": [],
409
- "name": "pendingAdmin",
410
- "outputs": [
411
- {
412
- "internalType": "address",
413
- "name": "",
414
- "type": "address"
415
- }
416
- ],
417
- "stateMutability": "view",
418
- "type": "function"
419
- },
420
- {
421
- "inputs": [
422
- {
423
- "internalType": "address",
424
- "name": "_newAdmin",
425
- "type": "address"
426
- }
427
- ],
428
- "name": "proposeAdmin",
429
- "outputs": [],
430
- "stateMutability": "nonpayable",
431
- "type": "function"
432
- },
433
- {
434
- "inputs": [
435
- {
436
- "internalType": "uint256",
437
- "name": "taskId",
438
- "type": "uint256"
439
- },
440
- {
441
- "internalType": "address",
442
- "name": "agent",
443
- "type": "address"
444
- },
445
- {
446
- "internalType": "string",
447
- "name": "category",
448
- "type": "string"
449
- },
450
- {
451
- "internalType": "string",
452
- "name": "locationZone",
453
- "type": "string"
454
- },
455
- {
456
- "internalType": "uint256",
457
- "name": "reward",
458
- "type": "uint256"
459
- }
460
- ],
461
- "name": "publishTask",
462
- "outputs": [],
463
- "stateMutability": "nonpayable",
464
- "type": "function"
465
- },
466
- {
467
- "inputs": [
468
- {
469
- "internalType": "address",
470
- "name": "publisher",
471
- "type": "address"
472
- }
473
- ],
474
- "name": "revokePublisher",
475
- "outputs": [],
476
- "stateMutability": "nonpayable",
477
- "type": "function"
478
- },
479
- {
480
- "inputs": [
481
- {
482
- "internalType": "uint256",
483
- "name": "",
484
- "type": "uint256"
485
- }
486
- ],
487
- "name": "taskExists",
488
- "outputs": [
489
- {
490
- "internalType": "bool",
491
- "name": "",
492
- "type": "bool"
493
- }
494
- ],
495
- "stateMutability": "view",
496
- "type": "function"
497
- },
498
- {
499
- "inputs": [
500
- {
501
- "internalType": "uint256",
502
- "name": "",
503
- "type": "uint256"
504
- }
505
- ],
506
- "name": "taskIdToIndex",
507
- "outputs": [
508
- {
509
- "internalType": "uint256",
510
- "name": "",
511
- "type": "uint256"
512
- }
513
- ],
514
- "stateMutability": "view",
515
- "type": "function"
516
- },
517
- {
518
- "inputs": [
519
- {
520
- "internalType": "uint256",
521
- "name": "",
522
- "type": "uint256"
523
- }
524
- ],
525
- "name": "taskList",
526
- "outputs": [
527
- {
528
- "internalType": "uint256",
529
- "name": "taskId",
530
- "type": "uint256"
531
- },
532
- {
533
- "internalType": "address",
534
- "name": "agent",
535
- "type": "address"
536
- },
537
- {
538
- "internalType": "string",
539
- "name": "category",
540
- "type": "string"
541
- },
542
- {
543
- "internalType": "string",
544
- "name": "locationZone",
545
- "type": "string"
546
- },
547
- {
548
- "internalType": "uint256",
549
- "name": "reward",
550
- "type": "uint256"
551
- },
552
- {
553
- "internalType": "uint256",
554
- "name": "createdAt",
555
- "type": "uint256"
556
- },
557
- {
558
- "internalType": "bool",
559
- "name": "isOpen",
560
- "type": "bool"
561
- }
562
- ],
563
- "stateMutability": "view",
564
- "type": "function"
565
- },
566
- {
567
- "inputs": [],
568
- "name": "totalTasks",
569
- "outputs": [
570
- {
571
- "internalType": "uint256",
572
- "name": "",
573
- "type": "uint256"
574
- }
575
- ],
576
- "stateMutability": "view",
577
- "type": "function"
578
- },
579
- {
580
- "inputs": [],
581
- "name": "unpause",
582
- "outputs": [],
583
- "stateMutability": "nonpayable",
584
- "type": "function"
585
- }
586
- ]
@@ -1,5 +0,0 @@
1
- import BlindEscrowAbi from './BlindEscrow.json' with { type: 'json' };
2
- import BlindReputationAbi from './BlindReputation.json' with { type: 'json' };
3
- import TaskRegistryAbi from './TaskRegistry.json' with { type: 'json' };
4
-
5
- export { BlindEscrowAbi, BlindReputationAbi, TaskRegistryAbi };
@@ -1,40 +0,0 @@
1
- import type { IBlindMarketChain } from './IBlindMarketChain.js';
2
- import { EVMChainAdapter } from './evm/EVMChainAdapter.js';
3
- import { resolveNetwork } from '../network/resolve.js';
4
- import type { Network, NetworkName as PresetName } from '../network/index.js';
5
- import type { EthersSigner } from '../signer/EthersSigner.js';
6
-
7
- /**
8
- * Options for creating a chain adapter via the factory.
9
- *
10
- * The factory chooses the correct adapter based on `network.chainType`.
11
- */
12
- export interface CreateChainAdapterOptions {
13
- network: Network | PresetName;
14
- signer?: EthersSigner;
15
- }
16
-
17
- /**
18
- * Factory: create the correct IBlindMarketChain adapter for the given network.
19
- *
20
- * @example
21
- * ```ts
22
- * // EVM (0G)
23
- * const chain = createChainAdapter({
24
- * network: 'og-testnet',
25
- * signer: new PrivateKeySigner(privkey, provider),
26
- * });
27
- * ```
28
- */
29
- export function createChainAdapter(opts: CreateChainAdapterOptions): IBlindMarketChain {
30
- const network = resolveNetwork(opts.network);
31
-
32
- if (network.chainType !== 'evm') {
33
- throw new Error(`Unsupported chain type: ${network.chainType}. Only EVM (0G) is supported.`);
34
- }
35
-
36
- return new EVMChainAdapter({
37
- network,
38
- signer: opts.signer,
39
- });
40
- }