@blindmarket/sdk 0.1.6 → 0.1.8

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 (156) hide show
  1. package/README.md +242 -29
  2. package/dist/chain/BlindEscrowClient.d.ts +2 -0
  3. package/dist/chain/BlindEscrowClient.js +19 -7
  4. package/dist/chain/BlindReputationClient.d.ts +3 -0
  5. package/dist/chain/BlindReputationClient.js +3 -1
  6. package/dist/chain/ChainClient.d.ts +6 -3
  7. package/dist/chain/ChainClient.js +6 -1
  8. package/dist/chain/IBlindMarketChain.d.ts +74 -0
  9. package/dist/chain/IBlindMarketChain.js +1 -0
  10. package/dist/chain/TaskRegistryClient.d.ts +2 -1
  11. package/dist/chain/TaskRegistryClient.js +15 -7
  12. package/dist/chain/createChainAdapter.d.ts +25 -0
  13. package/dist/chain/createChainAdapter.js +24 -0
  14. package/dist/chain/domain-types.d.ts +77 -0
  15. package/dist/chain/domain-types.js +1 -0
  16. package/dist/chain/evm/EVMChainAdapter.d.ts +56 -0
  17. package/dist/chain/evm/EVMChainAdapter.js +161 -0
  18. package/dist/chain/evm/index.d.ts +1 -0
  19. package/dist/chain/evm/index.js +1 -0
  20. package/dist/chain/index.d.ts +4 -0
  21. package/dist/chain/index.js +5 -0
  22. package/dist/crypto/constants.js +1 -1
  23. package/dist/errors/{BlindBountyError.d.ts → BlindMarketError.d.ts} +1 -1
  24. package/dist/errors/{BlindBountyError.js → BlindMarketError.js} +1 -1
  25. package/dist/errors/index.d.ts +1 -1
  26. package/dist/errors/index.js +1 -1
  27. package/dist/errors/subclasses.d.ts +9 -9
  28. package/dist/errors/subclasses.js +9 -9
  29. package/dist/executor/WorkerRuntime.d.ts +113 -0
  30. package/dist/executor/WorkerRuntime.js +248 -0
  31. package/dist/executor/index.d.ts +1 -0
  32. package/dist/executor/index.js +1 -0
  33. package/dist/index.d.ts +292 -22
  34. package/dist/index.js +413 -23
  35. package/dist/keystore/InMemoryKeyStore.js +2 -2
  36. package/dist/network/presets.d.ts +33 -5
  37. package/dist/network/presets.js +35 -8
  38. package/dist/network/resolve.d.ts +12 -3
  39. package/dist/network/resolve.js +15 -7
  40. package/dist/network/types.d.ts +3 -16
  41. package/dist/signer/EthersSigner.js +1 -1
  42. package/dist/storage/index.d.ts +0 -1
  43. package/dist/storage/index.js +1 -1
  44. package/dist/tools/adapters.d.ts +99 -0
  45. package/dist/tools/adapters.js +129 -0
  46. package/dist/tools/helpers.d.ts +9 -0
  47. package/dist/tools/helpers.js +169 -0
  48. package/dist/tools/index.d.ts +36 -0
  49. package/dist/tools/index.js +32 -0
  50. package/dist/tools/types.d.ts +44 -0
  51. package/dist/tools/types.js +1 -0
  52. package/dist/types.d.ts +202 -1
  53. package/dist/types.js +24 -1
  54. package/package.json +13 -2
  55. package/src/chain/BlindEscrowClient.ts +20 -6
  56. package/src/chain/BlindReputationClient.ts +6 -1
  57. package/src/chain/ChainClient.ts +9 -3
  58. package/src/chain/IBlindMarketChain.ts +109 -0
  59. package/src/chain/TaskRegistryClient.ts +17 -8
  60. package/src/chain/createChainAdapter.ts +40 -0
  61. package/src/chain/domain-types.ts +92 -0
  62. package/src/chain/evm/EVMChainAdapter.ts +212 -0
  63. package/src/chain/evm/index.ts +1 -0
  64. package/src/chain/index.ts +6 -0
  65. package/src/executor/WorkerRuntime.ts +338 -0
  66. package/src/executor/index.ts +8 -0
  67. package/src/index.ts +546 -36
  68. package/src/network/presets.ts +47 -8
  69. package/src/network/resolve.ts +20 -8
  70. package/src/network/types.ts +18 -16
  71. package/src/signer/index.ts +1 -1
  72. package/src/storage/index.ts +1 -1
  73. package/src/tools/adapters.ts +177 -0
  74. package/src/tools/helpers.ts +199 -0
  75. package/src/tools/index.ts +59 -0
  76. package/src/tools/types.ts +47 -0
  77. package/src/types.ts +222 -1
  78. package/tsconfig.json +2 -1
  79. package/dist/BlindEscrowClient-CyPuKMge.d.cts +0 -54
  80. package/dist/BlindEscrowClient-R7iGpE-n.d.ts +0 -54
  81. package/dist/KeyStore-Be_SSpCt.d.cts +0 -21
  82. package/dist/KeyStore-k1JgYPJY.d.ts +0 -21
  83. package/dist/Signer-BnqH_qew.d.cts +0 -38
  84. package/dist/Signer-LColE0Uo.d.ts +0 -38
  85. package/dist/Storage-4QOrh7rm.d.ts +0 -17
  86. package/dist/Storage-Cf4IJRMk.d.cts +0 -17
  87. package/dist/TaskRegistryClient-Ch6lYqM_.d.ts +0 -24
  88. package/dist/TaskRegistryClient-CrQjddDc.d.cts +0 -24
  89. package/dist/aes-J-7HrHze.d.cts +0 -17
  90. package/dist/aes-J-7HrHze.d.ts +0 -17
  91. package/dist/agent/index.cjs +0 -425
  92. package/dist/agent/index.cjs.map +0 -1
  93. package/dist/agent/index.d.cts +0 -63
  94. package/dist/agent/index.js.map +0 -1
  95. package/dist/api/index.cjs +0 -4
  96. package/dist/api/index.cjs.map +0 -1
  97. package/dist/api/index.d.cts +0 -2
  98. package/dist/api/index.js.map +0 -1
  99. package/dist/chain/index.cjs +0 -2484
  100. package/dist/chain/index.cjs.map +0 -1
  101. package/dist/chain/index.d.cts +0 -2305
  102. package/dist/chain/index.js.map +0 -1
  103. package/dist/compute/index.cjs +0 -4
  104. package/dist/compute/index.cjs.map +0 -1
  105. package/dist/compute/index.d.cts +0 -2
  106. package/dist/compute/index.js.map +0 -1
  107. package/dist/crypto/index.cjs +0 -424
  108. package/dist/crypto/index.cjs.map +0 -1
  109. package/dist/crypto/index.d.cts +0 -74
  110. package/dist/crypto/index.js.map +0 -1
  111. package/dist/errors/index.cjs +0 -136
  112. package/dist/errors/index.cjs.map +0 -1
  113. package/dist/errors/index.d.cts +0 -60
  114. package/dist/errors/index.js.map +0 -1
  115. package/dist/events/index.cjs +0 -41
  116. package/dist/events/index.cjs.map +0 -1
  117. package/dist/events/index.d.cts +0 -61
  118. package/dist/events/index.js.map +0 -1
  119. package/dist/index.cjs +0 -4
  120. package/dist/index.cjs.map +0 -1
  121. package/dist/index.d.cts +0 -2
  122. package/dist/index.js.map +0 -1
  123. package/dist/keystore/index.cjs +0 -335
  124. package/dist/keystore/index.cjs.map +0 -1
  125. package/dist/keystore/index.d.cts +0 -23
  126. package/dist/keystore/index.js.map +0 -1
  127. package/dist/network/index.cjs +0 -74
  128. package/dist/network/index.cjs.map +0 -1
  129. package/dist/network/index.d.cts +0 -36
  130. package/dist/network/index.js.map +0 -1
  131. package/dist/signer/index.cjs +0 -121
  132. package/dist/signer/index.cjs.map +0 -1
  133. package/dist/signer/index.d.cts +0 -40
  134. package/dist/signer/index.js.map +0 -1
  135. package/dist/storage/ZgStorage.d.ts +0 -24
  136. package/dist/storage/ZgStorage.js +0 -102
  137. package/dist/storage/index.cjs +0 -221
  138. package/dist/storage/index.cjs.map +0 -1
  139. package/dist/storage/index.d.cts +0 -44
  140. package/dist/storage/index.js.map +0 -1
  141. package/dist/testing/index.cjs +0 -4
  142. package/dist/testing/index.cjs.map +0 -1
  143. package/dist/testing/index.d.cts +0 -2
  144. package/dist/testing/index.js.map +0 -1
  145. package/dist/types-BOG5Ub1z.d.cts +0 -31
  146. package/dist/types-BOG5Ub1z.d.ts +0 -31
  147. package/dist/types-V7_ZmUb-.d.cts +0 -19
  148. package/dist/types-hAsITUQ7.d.ts +0 -19
  149. package/dist/verifier/index.cjs +0 -4
  150. package/dist/verifier/index.cjs.map +0 -1
  151. package/dist/verifier/index.d.cts +0 -2
  152. package/dist/verifier/index.js.map +0 -1
  153. package/dist/worker/index.cjs +0 -382
  154. package/dist/worker/index.cjs.map +0 -1
  155. package/dist/worker/index.d.cts +0 -58
  156. package/dist/worker/index.js.map +0 -1
package/src/types.ts CHANGED
@@ -22,7 +22,8 @@ export type TaskStatus =
22
22
  | 'submitted'
23
23
  | 'verified'
24
24
  | 'completed'
25
- | 'cancelled';
25
+ | 'cancelled'
26
+ | 'disputed';
26
27
 
27
28
  export interface TaskMetadata {
28
29
  category: string;
@@ -74,3 +75,223 @@ export interface TxReceiptLike {
74
75
  }
75
76
 
76
77
  export type Awaitable<T> = T | Promise<T>;
78
+
79
+ // ── REST API types ──────────────────────────────────────────────────────────
80
+
81
+ export interface HealthStatus {
82
+ status: string;
83
+ timestamp: string;
84
+ }
85
+
86
+ export interface PlatformStats {
87
+ openTasks: number;
88
+ activeAgents: number;
89
+ activeValidators: number;
90
+ totalAgents: number;
91
+ registeredUsers: number;
92
+ completedTasks: number;
93
+ activeWorkers: number;
94
+ }
95
+
96
+ export interface OpenTask {
97
+ id: number;
98
+ agent: Address;
99
+ worker?: Address;
100
+ amount: string;
101
+ token: Address;
102
+ category: string;
103
+ locationZone: string;
104
+ deadline: number;
105
+ status: number;
106
+ taskHash?: Hex;
107
+ }
108
+
109
+ export interface CreateTaskTx {
110
+ unsignedTx: {
111
+ to: Address;
112
+ data: Hex;
113
+ value?: string;
114
+ };
115
+ }
116
+
117
+ export interface TaskDetail extends OpenTask {
118
+ metadata?: Record<string, unknown>;
119
+ a2aState?: A2ATaskState;
120
+ }
121
+
122
+ export interface A2ATaskState {
123
+ taskId: string;
124
+ status: string;
125
+ executorAddress?: string;
126
+ acceptedAt?: string;
127
+ submittedAt?: string;
128
+ resultData?: Record<string, unknown> | null;
129
+ verificationResult?: {
130
+ passed: boolean;
131
+ reasons: string[];
132
+ score?: number;
133
+ breakdown?: Array<{ name: string; score: number; weight: number; reason: string; error?: string }>;
134
+ };
135
+ assignTxHash?: Hex;
136
+ verifyTxHash?: Hex;
137
+ wrappedKeys?: Record<string, string>;
138
+ }
139
+
140
+ export interface ExecutorProfile {
141
+ address: Address;
142
+ displayName: string;
143
+ capabilities: AgentCapability[];
144
+ publicKey: string;
145
+ reputation: number;
146
+ tasksCompleted: number;
147
+ totalEarnedRaw: string;
148
+ minReward?: string;
149
+ preferredCapabilities?: AgentCapability[];
150
+ registeredAt: string;
151
+ decayedScore?: number;
152
+ disputeRatio?: number;
153
+ avgRating?: number;
154
+ }
155
+
156
+ export interface RegisterExecutorInput {
157
+ address: Address;
158
+ displayName: string;
159
+ capabilities: AgentCapability[];
160
+ publicKey: string;
161
+ agentCardUrl?: string;
162
+ mcpEndpointUrl?: string;
163
+ minReward?: string;
164
+ preferredCapabilities?: AgentCapability[];
165
+ }
166
+
167
+ /** Params for BlindMarket.createAgent() — generates wallet + registers executor in one call. */
168
+ export interface CreateAgentParams {
169
+ /** Display name for the agent in the marketplace. */
170
+ displayName: string;
171
+ /** Capabilities this agent offers. Use AgentCap.DATA_PROCESSING etc. */
172
+ capabilities: AgentCapability[];
173
+ /** Which of the above the agent prefers (subset of capabilities). */
174
+ preferredCapabilities?: AgentCapability[];
175
+ /** Minimum reward per task (wei string). */
176
+ minReward?: string;
177
+ /** Agent card URL for marketplace display. */
178
+ agentCardUrl?: string;
179
+ /** MCP endpoint URL for tool-based agents. */
180
+ mcpEndpointUrl?: string;
181
+ }
182
+
183
+ /** Result of BlindMarket.createAgent(). */
184
+ export interface CreateAgentResult {
185
+ executor: ExecutorProfile;
186
+ wallet: {
187
+ address: Address;
188
+ publicKey: string;
189
+ privateKey: string; // hex with 0x prefix — ⚠️ store securely, shown once
190
+ };
191
+ }
192
+
193
+ export interface DeployedAgentInfo {
194
+ id: string;
195
+ name: string;
196
+ ownerAddress: Address;
197
+ walletAddress: Address;
198
+ publicKey: string;
199
+ status: string;
200
+ provider: string;
201
+ model: string;
202
+ capabilities: AgentCapability[];
203
+ inftTokenId?: number;
204
+ deployedAt: string;
205
+ lastActiveAt?: string;
206
+ minReward?: string;
207
+ }
208
+
209
+ export interface AgentWalletInfo {
210
+ walletAddress: Address;
211
+ publicKey: string;
212
+ }
213
+
214
+ export interface ReputationInfo {
215
+ address: Address;
216
+ onChainScore: number;
217
+ decayedScore: number;
218
+ totalTasks: number;
219
+ disputesLost: number;
220
+ disputeRatio: number;
221
+ }
222
+
223
+ export interface LeaderboardEntry extends ReputationInfo {
224
+ rank: number;
225
+ displayName?: string;
226
+ }
227
+
228
+ export interface StorageUploadResult {
229
+ rootHash: RootHash;
230
+ size: number;
231
+ }
232
+
233
+ export interface Message {
234
+ id: number;
235
+ taskId: string;
236
+ fromAddress: Address;
237
+ toAddress: Address;
238
+ content: string;
239
+ read: boolean;
240
+ createdAt: string;
241
+ }
242
+
243
+ export interface AgentSearchResult {
244
+ address: Address;
245
+ displayName: string;
246
+ capabilities: string[];
247
+ avgRating: number;
248
+ reviewCount: number;
249
+ badgeCount: number;
250
+ reputation: number;
251
+ }
252
+
253
+ export interface TaskTemplate {
254
+ id: number;
255
+ title: string;
256
+ description: string;
257
+ category: string;
258
+ instructions: string;
259
+ verificationCriteria: Record<string, unknown>;
260
+ requiredCapabilities?: string[];
261
+ estimatedReward?: string;
262
+ }
263
+
264
+ export interface VerifyTaskInput {
265
+ taskId: number;
266
+ taskCategory: string;
267
+ taskRequirements: string;
268
+ evidenceSummary: string;
269
+ }
270
+
271
+ // ── Agent capabilities ───────────────────────────────────────────────────────
272
+
273
+ /** Dot-notation access to valid capability strings. */
274
+ export const AgentCap = {
275
+ DATA_PROCESSING: 'data_processing',
276
+ WEB_RESEARCH: 'web_research',
277
+ CODE_EXECUTION: 'code_execution',
278
+ CONTENT_GENERATION: 'content_generation',
279
+ API_INTEGRATION: 'api_integration',
280
+ TEXT_ANALYSIS: 'text_analysis',
281
+ TRANSLATION: 'translation',
282
+ SUMMARIZATION: 'summarization',
283
+ IMAGE_ANALYSIS: 'image_analysis',
284
+ DOCUMENT_PROCESSING: 'document_processing',
285
+ MATH_COMPUTATION: 'math_computation',
286
+ DATA_EXTRACTION: 'data_extraction',
287
+ REPORT_GENERATION: 'report_generation',
288
+ CODE_REVIEW: 'code_review',
289
+ TESTING: 'testing',
290
+ SCHEDULING: 'scheduling',
291
+ EMAIL_DRAFTING: 'email_drafting',
292
+ SOCIAL_MEDIA: 'social_media',
293
+ MARKET_RESEARCH: 'market_research',
294
+ COMPETITIVE_ANALYSIS: 'competitive_analysis',
295
+ } as const;
296
+
297
+ export type AgentCapability = typeof AgentCap[keyof typeof AgentCap];
package/tsconfig.json CHANGED
@@ -9,5 +9,6 @@
9
9
  "strict": true,
10
10
  "skipLibCheck": true
11
11
  },
12
- "include": ["src/index.ts"]
12
+ "include": ["src"],
13
+ "exclude": ["src/storage/ZgStorage.ts"]
13
14
  }
@@ -1,54 +0,0 @@
1
- import { ethers } from 'ethers';
2
- import { A as Address, H as Hex, T as TaskId, b as TxReceiptLike, e as TaskStatus } from './types-BOG5Ub1z.cjs';
3
-
4
- interface CreateTaskArgs {
5
- taskHash: Hex;
6
- token: Address;
7
- amount: bigint;
8
- category: string;
9
- locationZone: string;
10
- deadline: bigint;
11
- }
12
- interface OnChainTask {
13
- taskId: TaskId;
14
- agent: Address;
15
- worker: Address;
16
- token: Address;
17
- amount: bigint;
18
- taskHash: Hex;
19
- evidenceHash: Hex;
20
- status: TaskStatus;
21
- createdAt: Date;
22
- deadline: Date;
23
- }
24
- /**
25
- * Typed ethers v6 wrapper for the BlindEscrow contract. Every state-changing
26
- * method awaits one confirmation and returns a TxReceiptLike; every read
27
- * returns decoded values. Ethers errors are mapped to ChainError via
28
- * wrapChainError().
29
- */
30
- declare class BlindEscrowClient {
31
- readonly contract: ethers.Contract;
32
- readonly address: Address;
33
- constructor(address: Address, runner: ethers.ContractRunner);
34
- /** Create a task and return its id + receipt. Reads the TaskCreated event for the id. */
35
- createTask(args: CreateTaskArgs): Promise<{
36
- taskId: TaskId;
37
- receipt: TxReceiptLike;
38
- }>;
39
- assignWorker(taskId: TaskId, worker: Address): Promise<TxReceiptLike>;
40
- submitEvidence(taskId: TaskId, evidenceHash: Hex): Promise<TxReceiptLike>;
41
- completeVerification(taskId: TaskId, passed: boolean): Promise<TxReceiptLike>;
42
- cancelTask(taskId: TaskId): Promise<TxReceiptLike>;
43
- raiseDispute(taskId: TaskId): Promise<TxReceiptLike>;
44
- resolveDispute(taskId: TaskId, workerFavored: boolean): Promise<TxReceiptLike>;
45
- claimTimeout(taskId: TaskId): Promise<TxReceiptLike>;
46
- getTask(taskId: TaskId): Promise<OnChainTask>;
47
- isTaskExpired(taskId: TaskId): Promise<boolean>;
48
- nextTaskId(): Promise<TaskId>;
49
- feeBps(): Promise<bigint>;
50
- private sendTx;
51
- private extractTaskIdFromReceipt;
52
- }
53
-
54
- export { BlindEscrowClient as B, type CreateTaskArgs as C, type OnChainTask as O };
@@ -1,54 +0,0 @@
1
- import { ethers } from 'ethers';
2
- import { A as Address, H as Hex, T as TaskId, b as TxReceiptLike, e as TaskStatus } from './types-BOG5Ub1z.js';
3
-
4
- interface CreateTaskArgs {
5
- taskHash: Hex;
6
- token: Address;
7
- amount: bigint;
8
- category: string;
9
- locationZone: string;
10
- deadline: bigint;
11
- }
12
- interface OnChainTask {
13
- taskId: TaskId;
14
- agent: Address;
15
- worker: Address;
16
- token: Address;
17
- amount: bigint;
18
- taskHash: Hex;
19
- evidenceHash: Hex;
20
- status: TaskStatus;
21
- createdAt: Date;
22
- deadline: Date;
23
- }
24
- /**
25
- * Typed ethers v6 wrapper for the BlindEscrow contract. Every state-changing
26
- * method awaits one confirmation and returns a TxReceiptLike; every read
27
- * returns decoded values. Ethers errors are mapped to ChainError via
28
- * wrapChainError().
29
- */
30
- declare class BlindEscrowClient {
31
- readonly contract: ethers.Contract;
32
- readonly address: Address;
33
- constructor(address: Address, runner: ethers.ContractRunner);
34
- /** Create a task and return its id + receipt. Reads the TaskCreated event for the id. */
35
- createTask(args: CreateTaskArgs): Promise<{
36
- taskId: TaskId;
37
- receipt: TxReceiptLike;
38
- }>;
39
- assignWorker(taskId: TaskId, worker: Address): Promise<TxReceiptLike>;
40
- submitEvidence(taskId: TaskId, evidenceHash: Hex): Promise<TxReceiptLike>;
41
- completeVerification(taskId: TaskId, passed: boolean): Promise<TxReceiptLike>;
42
- cancelTask(taskId: TaskId): Promise<TxReceiptLike>;
43
- raiseDispute(taskId: TaskId): Promise<TxReceiptLike>;
44
- resolveDispute(taskId: TaskId, workerFavored: boolean): Promise<TxReceiptLike>;
45
- claimTimeout(taskId: TaskId): Promise<TxReceiptLike>;
46
- getTask(taskId: TaskId): Promise<OnChainTask>;
47
- isTaskExpired(taskId: TaskId): Promise<boolean>;
48
- nextTaskId(): Promise<TaskId>;
49
- feeBps(): Promise<bigint>;
50
- private sendTx;
51
- private extractTaskIdFromReceipt;
52
- }
53
-
54
- export { BlindEscrowClient as B, type CreateTaskArgs as C, type OnChainTask as O };
@@ -1,21 +0,0 @@
1
- import { T as TaskId, a as TaskKey, A as Address, H as Hex, c as TaskKeyRef } from './types-BOG5Ub1z.cjs';
2
-
3
- /**
4
- * Per-session storage for task AES keys and cached peer public keys. The SDK
5
- * never logs or serializes anything from here — this is the one place at-rest
6
- * secrets live. Implementations MUST treat passphrase-protected exports as the
7
- * only portable format.
8
- */
9
- interface KeyStore {
10
- putTaskKey(taskId: TaskId, key: TaskKey): Promise<void>;
11
- getTaskKey(taskId: TaskId): Promise<TaskKey | null>;
12
- putPeerPubKey(addr: Address, pubkey: Hex): Promise<void>;
13
- getPeerPubKey(addr: Address): Promise<Hex | null>;
14
- list(): Promise<TaskKeyRef[]>;
15
- delete(taskId: TaskId): Promise<void>;
16
- /** Portable, encrypted-at-rest JSON export for backup/migration. */
17
- export(passphrase: string): Promise<string>;
18
- import(data: string, passphrase: string): Promise<void>;
19
- }
20
-
21
- export type { KeyStore as K };
@@ -1,21 +0,0 @@
1
- import { T as TaskId, a as TaskKey, A as Address, H as Hex, c as TaskKeyRef } from './types-BOG5Ub1z.js';
2
-
3
- /**
4
- * Per-session storage for task AES keys and cached peer public keys. The SDK
5
- * never logs or serializes anything from here — this is the one place at-rest
6
- * secrets live. Implementations MUST treat passphrase-protected exports as the
7
- * only portable format.
8
- */
9
- interface KeyStore {
10
- putTaskKey(taskId: TaskId, key: TaskKey): Promise<void>;
11
- getTaskKey(taskId: TaskId): Promise<TaskKey | null>;
12
- putPeerPubKey(addr: Address, pubkey: Hex): Promise<void>;
13
- getPeerPubKey(addr: Address): Promise<Hex | null>;
14
- list(): Promise<TaskKeyRef[]>;
15
- delete(taskId: TaskId): Promise<void>;
16
- /** Portable, encrypted-at-rest JSON export for backup/migration. */
17
- export(passphrase: string): Promise<string>;
18
- import(data: string, passphrase: string): Promise<void>;
19
- }
20
-
21
- export type { KeyStore as K };
@@ -1,38 +0,0 @@
1
- import { A as Address, H as Hex } from './types-BOG5Ub1z.cjs';
2
-
3
- interface TxRequest {
4
- to: Address;
5
- from?: Address;
6
- data?: Hex;
7
- value?: bigint;
8
- gasLimit?: bigint;
9
- nonce?: number;
10
- chainId?: bigint;
11
- }
12
- interface TypedDataDomain {
13
- name?: string;
14
- version?: string;
15
- chainId?: bigint | number;
16
- verifyingContract?: Address;
17
- salt?: Hex;
18
- }
19
- type TypedDataField = {
20
- name: string;
21
- type: string;
22
- };
23
- /**
24
- * Uniform signing interface used across the SDK. Adapters wrap ethers Signer,
25
- * raw private keys, EIP-1193 providers, or KMS. Implementations MUST return
26
- * hex-encoded signatures (0x-prefixed) and addresses (0x-prefixed, 20 bytes).
27
- */
28
- interface Signer {
29
- getAddress(): Promise<Address>;
30
- chainId(): Promise<bigint>;
31
- signMessage(msg: string | Uint8Array): Promise<Hex>;
32
- signTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, value: Record<string, unknown>): Promise<Hex>;
33
- signTransaction(tx: TxRequest): Promise<Hex>;
34
- /** Uncompressed secp256k1 public key, 0x04-prefixed (hex). */
35
- getPublicKey(): Promise<Hex>;
36
- }
37
-
38
- export type { Signer as S, TypedDataDomain as T, TypedDataField as a, TxRequest as b };
@@ -1,38 +0,0 @@
1
- import { A as Address, H as Hex } from './types-BOG5Ub1z.js';
2
-
3
- interface TxRequest {
4
- to: Address;
5
- from?: Address;
6
- data?: Hex;
7
- value?: bigint;
8
- gasLimit?: bigint;
9
- nonce?: number;
10
- chainId?: bigint;
11
- }
12
- interface TypedDataDomain {
13
- name?: string;
14
- version?: string;
15
- chainId?: bigint | number;
16
- verifyingContract?: Address;
17
- salt?: Hex;
18
- }
19
- type TypedDataField = {
20
- name: string;
21
- type: string;
22
- };
23
- /**
24
- * Uniform signing interface used across the SDK. Adapters wrap ethers Signer,
25
- * raw private keys, EIP-1193 providers, or KMS. Implementations MUST return
26
- * hex-encoded signatures (0x-prefixed) and addresses (0x-prefixed, 20 bytes).
27
- */
28
- interface Signer {
29
- getAddress(): Promise<Address>;
30
- chainId(): Promise<bigint>;
31
- signMessage(msg: string | Uint8Array): Promise<Hex>;
32
- signTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, value: Record<string, unknown>): Promise<Hex>;
33
- signTransaction(tx: TxRequest): Promise<Hex>;
34
- /** Uncompressed secp256k1 public key, 0x04-prefixed (hex). */
35
- getPublicKey(): Promise<Hex>;
36
- }
37
-
38
- export type { Signer as S, TypedDataDomain as T, TypedDataField as a, TxRequest as b };
@@ -1,17 +0,0 @@
1
- import { U as UploadResult, d as RootHash } from './types-BOG5Ub1z.js';
2
-
3
- /**
4
- * Abstraction over blob storage. Default implementation (ZgStorage) uses
5
- * 0G Storage; MemoryStorage is for tests and local fallback. Consumers can
6
- * provide their own adapter for IPFS, S3, etc.
7
- */
8
- interface Storage {
9
- /** Upload bytes, return root hash + optional tx hash + size. */
10
- upload(bytes: Uint8Array): Promise<UploadResult>;
11
- /** Download bytes by root hash. Throws StorageError('STORAGE/NOT_FOUND') if absent. */
12
- download(rootHash: RootHash): Promise<Uint8Array>;
13
- /** Compute the canonical root hash without uploading. */
14
- hash(bytes: Uint8Array): Promise<RootHash>;
15
- }
16
-
17
- export type { Storage as S };
@@ -1,17 +0,0 @@
1
- import { U as UploadResult, d as RootHash } from './types-BOG5Ub1z.cjs';
2
-
3
- /**
4
- * Abstraction over blob storage. Default implementation (ZgStorage) uses
5
- * 0G Storage; MemoryStorage is for tests and local fallback. Consumers can
6
- * provide their own adapter for IPFS, S3, etc.
7
- */
8
- interface Storage {
9
- /** Upload bytes, return root hash + optional tx hash + size. */
10
- upload(bytes: Uint8Array): Promise<UploadResult>;
11
- /** Download bytes by root hash. Throws StorageError('STORAGE/NOT_FOUND') if absent. */
12
- download(rootHash: RootHash): Promise<Uint8Array>;
13
- /** Compute the canonical root hash without uploading. */
14
- hash(bytes: Uint8Array): Promise<RootHash>;
15
- }
16
-
17
- export type { Storage as S };
@@ -1,24 +0,0 @@
1
- import { ethers } from 'ethers';
2
- import { A as Address, T as TaskId, b as TxReceiptLike } from './types-BOG5Ub1z.js';
3
-
4
- interface OpenTaskMeta {
5
- taskId: TaskId;
6
- token: Address;
7
- category: string;
8
- locationZone: string;
9
- reward: bigint;
10
- createdAt: Date;
11
- }
12
- declare class TaskRegistryClient {
13
- readonly contract: ethers.Contract;
14
- readonly address: Address;
15
- constructor(address: Address, runner: ethers.ContractRunner);
16
- getTaskMeta(taskId: TaskId): Promise<OpenTaskMeta>;
17
- getOpenTasks(offset: bigint, limit: bigint): Promise<TaskId[]>;
18
- totalTasks(): Promise<bigint>;
19
- openTaskCount(): Promise<bigint>;
20
- taskExists(taskId: TaskId): Promise<boolean>;
21
- closeTask(taskId: TaskId): Promise<TxReceiptLike>;
22
- }
23
-
24
- export { type OpenTaskMeta as O, TaskRegistryClient as T };
@@ -1,24 +0,0 @@
1
- import { ethers } from 'ethers';
2
- import { A as Address, T as TaskId, b as TxReceiptLike } from './types-BOG5Ub1z.cjs';
3
-
4
- interface OpenTaskMeta {
5
- taskId: TaskId;
6
- token: Address;
7
- category: string;
8
- locationZone: string;
9
- reward: bigint;
10
- createdAt: Date;
11
- }
12
- declare class TaskRegistryClient {
13
- readonly contract: ethers.Contract;
14
- readonly address: Address;
15
- constructor(address: Address, runner: ethers.ContractRunner);
16
- getTaskMeta(taskId: TaskId): Promise<OpenTaskMeta>;
17
- getOpenTasks(offset: bigint, limit: bigint): Promise<TaskId[]>;
18
- totalTasks(): Promise<bigint>;
19
- openTaskCount(): Promise<bigint>;
20
- taskExists(taskId: TaskId): Promise<boolean>;
21
- closeTask(taskId: TaskId): Promise<TxReceiptLike>;
22
- }
23
-
24
- export { type OpenTaskMeta as O, TaskRegistryClient as T };
@@ -1,17 +0,0 @@
1
- /** Generate a fresh 32-byte AES-256 key. */
2
- declare function generateAesKey(): Promise<Uint8Array>;
3
- /**
4
- * AES-256-GCM encrypt. Output format: [12 IV][16 tag][ciphertext].
5
- * This ordering matches backend/src/services/crypto.ts and frontend/src/lib/crypto.ts
6
- * byte-for-byte, so SDK blobs decrypt anywhere in the stack.
7
- */
8
- declare function aesEncrypt(plaintext: Uint8Array, key: Uint8Array): Promise<Uint8Array>;
9
- /**
10
- * AES-256-GCM decrypt. Input format: [12 IV][16 tag][ciphertext].
11
- * Throws CRYPTO/INTEGRITY_CHECK on truncation or tag mismatch.
12
- */
13
- declare function aesDecrypt(blob: Uint8Array, key: Uint8Array): Promise<Uint8Array>;
14
- /** SHA-256 of arbitrary bytes. Returns 32-byte digest. */
15
- declare function sha256(data: Uint8Array): Promise<Uint8Array>;
16
-
17
- export { aesDecrypt as a, aesEncrypt as b, generateAesKey as g, sha256 as s };
@@ -1,17 +0,0 @@
1
- /** Generate a fresh 32-byte AES-256 key. */
2
- declare function generateAesKey(): Promise<Uint8Array>;
3
- /**
4
- * AES-256-GCM encrypt. Output format: [12 IV][16 tag][ciphertext].
5
- * This ordering matches backend/src/services/crypto.ts and frontend/src/lib/crypto.ts
6
- * byte-for-byte, so SDK blobs decrypt anywhere in the stack.
7
- */
8
- declare function aesEncrypt(plaintext: Uint8Array, key: Uint8Array): Promise<Uint8Array>;
9
- /**
10
- * AES-256-GCM decrypt. Input format: [12 IV][16 tag][ciphertext].
11
- * Throws CRYPTO/INTEGRITY_CHECK on truncation or tag mismatch.
12
- */
13
- declare function aesDecrypt(blob: Uint8Array, key: Uint8Array): Promise<Uint8Array>;
14
- /** SHA-256 of arbitrary bytes. Returns 32-byte digest. */
15
- declare function sha256(data: Uint8Array): Promise<Uint8Array>;
16
-
17
- export { aesDecrypt as a, aesEncrypt as b, generateAesKey as g, sha256 as s };