@ottochain/sdk 1.0.3 → 1.1.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 (153) hide show
  1. package/dist/cjs/generated/index.js +11 -1
  2. package/dist/cjs/metakit/drop-nulls.js +50 -0
  3. package/dist/cjs/metakit/normalize.js +147 -0
  4. package/dist/cjs/ottochain/metagraph-client.js +147 -0
  5. package/dist/cjs/validation.js +1 -1
  6. package/dist/esm/generated/index.js +11 -1
  7. package/dist/esm/metakit/drop-nulls.js +46 -0
  8. package/dist/esm/metakit/normalize.js +140 -0
  9. package/dist/esm/ottochain/metagraph-client.js +147 -0
  10. package/dist/esm/validation.js +1 -1
  11. package/dist/types/generated/index.d.ts +11 -1
  12. package/dist/types/metakit/drop-nulls.d.ts +29 -0
  13. package/dist/types/metakit/normalize.d.ts +67 -0
  14. package/dist/types/ottochain/index.d.ts +1 -1
  15. package/dist/types/ottochain/metagraph-client.d.ts +90 -0
  16. package/package.json +12 -12
  17. package/dist/apps/contracts/index.d.ts +0 -21
  18. package/dist/apps/contracts/index.js +0 -39
  19. package/dist/apps/contracts/types.d.ts +0 -24
  20. package/dist/apps/contracts/types.js +0 -48
  21. package/dist/apps/identity/index.d.ts +0 -22
  22. package/dist/apps/identity/index.js +0 -40
  23. package/dist/apps/identity/types.d.ts +0 -30
  24. package/dist/apps/identity/types.js +0 -53
  25. package/dist/apps/index.d.ts +0 -29
  26. package/dist/apps/index.js +0 -60
  27. package/dist/apps/markets/index.d.ts +0 -26
  28. package/dist/apps/markets/index.js +0 -46
  29. package/dist/apps/markets/types.d.ts +0 -185
  30. package/dist/apps/markets/types.js +0 -252
  31. package/dist/apps/oracles/index.d.ts +0 -26
  32. package/dist/apps/oracles/index.js +0 -46
  33. package/dist/apps/oracles/types.d.ts +0 -211
  34. package/dist/apps/oracles/types.js +0 -306
  35. package/dist/cjs/apps/contracts/types.js +0 -48
  36. package/dist/cjs/apps/corporate/types.js +0 -44
  37. package/dist/cjs/apps/governance/types.js +0 -42
  38. package/dist/cjs/apps/identity/types.js +0 -53
  39. package/dist/cjs/apps/markets/types.js +0 -219
  40. package/dist/cjs/apps/oracles/types.js +0 -282
  41. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract_pb.js +0 -100
  42. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate_pb.js +0 -392
  43. package/dist/cjs/generated/ottochain/apps/governance/v1/governance_pb.js +0 -235
  44. package/dist/cjs/generated/ottochain/apps/identity/v1/agent_pb.js +0 -116
  45. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation_pb.js +0 -79
  46. package/dist/cjs/generated/ottochain/apps/markets/v1/market_pb.js +0 -151
  47. package/dist/cjs/generated/ottochain/apps/oracles/v1/oracle_pb.js +0 -109
  48. package/dist/cjs/generated/ottochain/v1/common_pb.js +0 -37
  49. package/dist/cjs/generated/ottochain/v1/fiber_pb.js +0 -86
  50. package/dist/cjs/generated/ottochain/v1/messages_pb.js +0 -44
  51. package/dist/cjs/generated/ottochain/v1/records_pb.js +0 -44
  52. package/dist/errors.d.ts +0 -221
  53. package/dist/errors.js +0 -293
  54. package/dist/esm/apps/contracts/types.js +0 -44
  55. package/dist/esm/apps/corporate/types.js +0 -38
  56. package/dist/esm/apps/governance/types.js +0 -35
  57. package/dist/esm/apps/identity/types.js +0 -50
  58. package/dist/esm/apps/markets/types.js +0 -206
  59. package/dist/esm/apps/oracles/types.js +0 -267
  60. package/dist/esm/generated/ottochain/apps/contracts/v1/contract_pb.js +0 -97
  61. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate_pb.js +0 -389
  62. package/dist/esm/generated/ottochain/apps/governance/v1/governance_pb.js +0 -232
  63. package/dist/esm/generated/ottochain/apps/identity/v1/agent_pb.js +0 -113
  64. package/dist/esm/generated/ottochain/apps/identity/v1/attestation_pb.js +0 -76
  65. package/dist/esm/generated/ottochain/apps/markets/v1/market_pb.js +0 -148
  66. package/dist/esm/generated/ottochain/apps/oracles/v1/oracle_pb.js +0 -106
  67. package/dist/esm/generated/ottochain/v1/common_pb.js +0 -34
  68. package/dist/esm/generated/ottochain/v1/fiber_pb.js +0 -83
  69. package/dist/esm/generated/ottochain/v1/messages_pb.js +0 -41
  70. package/dist/esm/generated/ottochain/v1/records_pb.js +0 -41
  71. package/dist/generated/index.d.ts +0 -15
  72. package/dist/generated/index.js +0 -34
  73. package/dist/generated/ottochain/apps/contracts/v1/contract_pb.d.ts +0 -274
  74. package/dist/generated/ottochain/apps/contracts/v1/contract_pb.js +0 -100
  75. package/dist/generated/ottochain/apps/identity/v1/agent_pb.d.ts +0 -211
  76. package/dist/generated/ottochain/apps/identity/v1/agent_pb.js +0 -116
  77. package/dist/generated/ottochain/apps/identity/v1/attestation_pb.d.ts +0 -238
  78. package/dist/generated/ottochain/apps/identity/v1/attestation_pb.js +0 -79
  79. package/dist/generated/ottochain/apps/markets/v1/market_pb.d.ts +0 -436
  80. package/dist/generated/ottochain/apps/markets/v1/market_pb.js +0 -151
  81. package/dist/generated/ottochain/apps/oracles/v1/oracle_pb.d.ts +0 -393
  82. package/dist/generated/ottochain/apps/oracles/v1/oracle_pb.js +0 -109
  83. package/dist/generated/ottochain/v1/common_pb.d.ts +0 -86
  84. package/dist/generated/ottochain/v1/common_pb.js +0 -37
  85. package/dist/generated/ottochain/v1/fiber_pb.d.ts +0 -292
  86. package/dist/generated/ottochain/v1/fiber_pb.js +0 -86
  87. package/dist/generated/ottochain/v1/messages_pb.d.ts +0 -190
  88. package/dist/generated/ottochain/v1/messages_pb.js +0 -44
  89. package/dist/generated/ottochain/v1/records_pb.d.ts +0 -221
  90. package/dist/generated/ottochain/v1/records_pb.js +0 -44
  91. package/dist/index.d.ts +0 -21
  92. package/dist/index.js +0 -77
  93. package/dist/metakit/binary.d.ts +0 -38
  94. package/dist/metakit/binary.js +0 -58
  95. package/dist/metakit/canonicalize.d.ts +0 -26
  96. package/dist/metakit/canonicalize.js +0 -40
  97. package/dist/metakit/codec.d.ts +0 -16
  98. package/dist/metakit/codec.js +0 -45
  99. package/dist/metakit/currency-transaction.d.ts +0 -157
  100. package/dist/metakit/currency-transaction.js +0 -319
  101. package/dist/metakit/currency-types.d.ts +0 -55
  102. package/dist/metakit/currency-types.js +0 -13
  103. package/dist/metakit/hash.d.ts +0 -50
  104. package/dist/metakit/hash.js +0 -84
  105. package/dist/metakit/index.d.ts +0 -23
  106. package/dist/metakit/index.js +0 -74
  107. package/dist/metakit/network/client.d.ts +0 -23
  108. package/dist/metakit/network/client.js +0 -78
  109. package/dist/metakit/network/currency-l1-client.d.ts +0 -71
  110. package/dist/metakit/network/currency-l1-client.js +0 -101
  111. package/dist/metakit/network/data-l1-client.d.ts +0 -57
  112. package/dist/metakit/network/data-l1-client.js +0 -76
  113. package/dist/metakit/network/index.d.ts +0 -10
  114. package/dist/metakit/network/index.js +0 -16
  115. package/dist/metakit/network/types.d.ts +0 -74
  116. package/dist/metakit/network/types.js +0 -20
  117. package/dist/metakit/sign.d.ts +0 -65
  118. package/dist/metakit/sign.js +0 -120
  119. package/dist/metakit/signed-object.d.ts +0 -66
  120. package/dist/metakit/signed-object.js +0 -100
  121. package/dist/metakit/types.d.ts +0 -67
  122. package/dist/metakit/types.js +0 -14
  123. package/dist/metakit/verify.d.ts +0 -55
  124. package/dist/metakit/verify.js +0 -217
  125. package/dist/metakit/wallet.d.ts +0 -70
  126. package/dist/metakit/wallet.js +0 -127
  127. package/dist/ottochain/index.d.ts +0 -13
  128. package/dist/ottochain/index.js +0 -45
  129. package/dist/ottochain/metagraph-client.d.ts +0 -111
  130. package/dist/ottochain/metagraph-client.js +0 -157
  131. package/dist/ottochain/snapshot.d.ts +0 -86
  132. package/dist/ottochain/snapshot.js +0 -110
  133. package/dist/ottochain/types.d.ts +0 -278
  134. package/dist/ottochain/types.js +0 -11
  135. package/dist/types/apps/contracts/types.d.ts +0 -24
  136. package/dist/types/apps/corporate/types.d.ts +0 -9861
  137. package/dist/types/apps/governance/types.d.ts +0 -344
  138. package/dist/types/apps/identity/types.d.ts +0 -30
  139. package/dist/types/apps/markets/types.d.ts +0 -155
  140. package/dist/types/apps/oracles/types.d.ts +0 -193
  141. package/dist/types/generated/ottochain/apps/contracts/v1/contract_pb.d.ts +0 -274
  142. package/dist/types/generated/ottochain/apps/corporate/v1/corporate_pb.d.ts +0 -1172
  143. package/dist/types/generated/ottochain/apps/governance/v1/governance_pb.d.ts +0 -772
  144. package/dist/types/generated/ottochain/apps/identity/v1/agent_pb.d.ts +0 -211
  145. package/dist/types/generated/ottochain/apps/identity/v1/attestation_pb.d.ts +0 -238
  146. package/dist/types/generated/ottochain/apps/markets/v1/market_pb.d.ts +0 -436
  147. package/dist/types/generated/ottochain/apps/oracles/v1/oracle_pb.d.ts +0 -393
  148. package/dist/types/generated/ottochain/v1/common_pb.d.ts +0 -86
  149. package/dist/types/generated/ottochain/v1/fiber_pb.d.ts +0 -292
  150. package/dist/types/generated/ottochain/v1/messages_pb.d.ts +0 -190
  151. package/dist/types/generated/ottochain/v1/records_pb.d.ts +0 -221
  152. package/dist/validation.d.ts +0 -449
  153. package/dist/validation.js +0 -312
@@ -1,449 +0,0 @@
1
- /**
2
- * Input Validation with Zod Schemas
3
- *
4
- * Provides runtime validation for SDK types using Zod.
5
- *
6
- * @packageDocumentation
7
- */
8
- import { z } from 'zod';
9
- import { ValidationError } from './errors.js';
10
- /**
11
- * Schema for a DAG address
12
- */
13
- export declare const DagAddressSchema: z.ZodString;
14
- /**
15
- * Schema for a private key (64-character hex string)
16
- */
17
- export declare const PrivateKeySchema: z.ZodString;
18
- /**
19
- * Schema for a public key (128 or 130 character hex string)
20
- */
21
- export declare const PublicKeySchema: z.ZodString;
22
- /**
23
- * Schema for a KeyPair
24
- */
25
- export declare const KeyPairSchema: z.ZodObject<{
26
- /** Private key in hex format */
27
- privateKey: z.ZodString;
28
- /** Public key in hex format (uncompressed, with 04 prefix) */
29
- publicKey: z.ZodString;
30
- /** DAG address derived from the public key */
31
- address: z.ZodString;
32
- }, "strip", z.ZodTypeAny, {
33
- privateKey: string;
34
- publicKey: string;
35
- address: string;
36
- }, {
37
- privateKey: string;
38
- publicKey: string;
39
- address: string;
40
- }>;
41
- /**
42
- * Type for a validated KeyPair
43
- */
44
- export type ValidatedKeyPair = z.infer<typeof KeyPairSchema>;
45
- /**
46
- * Schema for a SignatureProof
47
- */
48
- export declare const SignatureProofSchema: z.ZodObject<{
49
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
50
- id: z.ZodString;
51
- /** DER-encoded ECDSA signature in hex format */
52
- signature: z.ZodString;
53
- }, "strip", z.ZodTypeAny, {
54
- id: string;
55
- signature: string;
56
- }, {
57
- id: string;
58
- signature: string;
59
- }>;
60
- /**
61
- * Type for a validated SignatureProof
62
- */
63
- export type ValidatedSignatureProof = z.infer<typeof SignatureProofSchema>;
64
- /**
65
- * Schema for a Signed object (generic)
66
- */
67
- export declare const SignedSchema: <T extends z.ZodTypeAny>(valueSchema: T) => z.ZodObject<{
68
- value: T;
69
- proofs: z.ZodArray<z.ZodObject<{
70
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
71
- id: z.ZodString;
72
- /** DER-encoded ECDSA signature in hex format */
73
- signature: z.ZodString;
74
- }, "strip", z.ZodTypeAny, {
75
- id: string;
76
- signature: string;
77
- }, {
78
- id: string;
79
- signature: string;
80
- }>, "many">;
81
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
82
- value: T;
83
- proofs: z.ZodArray<z.ZodObject<{
84
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
85
- id: z.ZodString;
86
- /** DER-encoded ECDSA signature in hex format */
87
- signature: z.ZodString;
88
- }, "strip", z.ZodTypeAny, {
89
- id: string;
90
- signature: string;
91
- }, {
92
- id: string;
93
- signature: string;
94
- }>, "many">;
95
- }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
96
- value: T;
97
- proofs: z.ZodArray<z.ZodObject<{
98
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
99
- id: z.ZodString;
100
- /** DER-encoded ECDSA signature in hex format */
101
- signature: z.ZodString;
102
- }, "strip", z.ZodTypeAny, {
103
- id: string;
104
- signature: string;
105
- }, {
106
- id: string;
107
- signature: string;
108
- }>, "many">;
109
- }>, any>[k]; } : never, z.baseObjectInputType<{
110
- value: T;
111
- proofs: z.ZodArray<z.ZodObject<{
112
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
113
- id: z.ZodString;
114
- /** DER-encoded ECDSA signature in hex format */
115
- signature: z.ZodString;
116
- }, "strip", z.ZodTypeAny, {
117
- id: string;
118
- signature: string;
119
- }, {
120
- id: string;
121
- signature: string;
122
- }>, "many">;
123
- }> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
124
- value: T;
125
- proofs: z.ZodArray<z.ZodObject<{
126
- /** Public key hex (uncompressed, without 04 prefix) - 128 characters */
127
- id: z.ZodString;
128
- /** DER-encoded ECDSA signature in hex format */
129
- signature: z.ZodString;
130
- }, "strip", z.ZodTypeAny, {
131
- id: string;
132
- signature: string;
133
- }, {
134
- id: string;
135
- signature: string;
136
- }>, "many">;
137
- }>[k_1]; } : never>;
138
- /**
139
- * Schema for TransactionReference
140
- */
141
- export declare const TransactionReferenceSchema: z.ZodObject<{
142
- ordinal: z.ZodNumber;
143
- hash: z.ZodString;
144
- }, "strip", z.ZodTypeAny, {
145
- hash: string;
146
- ordinal: number;
147
- }, {
148
- hash: string;
149
- ordinal: number;
150
- }>;
151
- /**
152
- * Schema for CurrencyTransactionValue
153
- */
154
- export declare const CurrencyTransactionValueSchema: z.ZodObject<{
155
- source: z.ZodString;
156
- destination: z.ZodString;
157
- amount: z.ZodNumber;
158
- fee: z.ZodDefault<z.ZodNumber>;
159
- }, "strip", z.ZodTypeAny, {
160
- source: string;
161
- destination: string;
162
- amount: number;
163
- fee: number;
164
- }, {
165
- source: string;
166
- destination: string;
167
- amount: number;
168
- fee?: number | undefined;
169
- }>;
170
- /**
171
- * Schema for CurrencyTransaction
172
- */
173
- export declare const CurrencyTransactionSchema: z.ZodObject<{
174
- value: z.ZodObject<{
175
- source: z.ZodString;
176
- destination: z.ZodString;
177
- amount: z.ZodNumber;
178
- fee: z.ZodDefault<z.ZodNumber>;
179
- }, "strip", z.ZodTypeAny, {
180
- source: string;
181
- destination: string;
182
- amount: number;
183
- fee: number;
184
- }, {
185
- source: string;
186
- destination: string;
187
- amount: number;
188
- fee?: number | undefined;
189
- }>;
190
- parent: z.ZodObject<{
191
- ordinal: z.ZodNumber;
192
- hash: z.ZodString;
193
- }, "strip", z.ZodTypeAny, {
194
- hash: string;
195
- ordinal: number;
196
- }, {
197
- hash: string;
198
- ordinal: number;
199
- }>;
200
- }, "strip", z.ZodTypeAny, {
201
- value: {
202
- source: string;
203
- destination: string;
204
- amount: number;
205
- fee: number;
206
- };
207
- parent: {
208
- hash: string;
209
- ordinal: number;
210
- };
211
- }, {
212
- value: {
213
- source: string;
214
- destination: string;
215
- amount: number;
216
- fee?: number | undefined;
217
- };
218
- parent: {
219
- hash: string;
220
- ordinal: number;
221
- };
222
- }>;
223
- /**
224
- * Type for a validated CurrencyTransaction
225
- */
226
- export type ValidatedCurrencyTransaction = z.infer<typeof CurrencyTransactionSchema>;
227
- /**
228
- * Schema for TransferParams
229
- */
230
- export declare const TransferParamsSchema: z.ZodObject<{
231
- from: z.ZodString;
232
- to: z.ZodString;
233
- amount: z.ZodNumber;
234
- fee: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
235
- }, "strip", z.ZodTypeAny, {
236
- amount: number;
237
- fee: number;
238
- from: string;
239
- to: string;
240
- }, {
241
- amount: number;
242
- from: string;
243
- to: string;
244
- fee?: number | undefined;
245
- }>;
246
- /**
247
- * Type for validated TransferParams
248
- */
249
- export type ValidatedTransferParams = z.infer<typeof TransferParamsSchema>;
250
- /**
251
- * Schema for AgentIdentity registration
252
- */
253
- export declare const AgentIdentityRegistrationSchema: z.ZodObject<{
254
- /** Public key in hex format */
255
- publicKey: z.ZodString;
256
- /** Display name for the agent */
257
- displayName: z.ZodString;
258
- /** Initial reputation (default: 10) */
259
- reputation: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
260
- }, "strip", z.ZodTypeAny, {
261
- publicKey: string;
262
- displayName: string;
263
- reputation: number;
264
- }, {
265
- publicKey: string;
266
- displayName: string;
267
- reputation?: number | undefined;
268
- }>;
269
- /**
270
- * Type for validated AgentIdentity registration
271
- */
272
- export type ValidatedAgentIdentityRegistration = z.infer<typeof AgentIdentityRegistrationSchema>;
273
- /**
274
- * Schema for PlatformLink
275
- */
276
- export declare const PlatformLinkSchema: z.ZodObject<{
277
- platform: z.ZodEnum<["DISCORD", "TELEGRAM", "TWITTER", "GITHUB", "CUSTOM"]>;
278
- platformUserId: z.ZodString;
279
- platformUsername: z.ZodString;
280
- verified: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
281
- }, "strip", z.ZodTypeAny, {
282
- platform: "DISCORD" | "TELEGRAM" | "TWITTER" | "GITHUB" | "CUSTOM";
283
- platformUserId: string;
284
- platformUsername: string;
285
- verified: boolean;
286
- }, {
287
- platform: "DISCORD" | "TELEGRAM" | "TWITTER" | "GITHUB" | "CUSTOM";
288
- platformUserId: string;
289
- platformUsername: string;
290
- verified?: boolean | undefined;
291
- }>;
292
- /**
293
- * Type for validated PlatformLink
294
- */
295
- export type ValidatedPlatformLink = z.infer<typeof PlatformLinkSchema>;
296
- /**
297
- * Schema for contract terms (flexible structure)
298
- */
299
- export declare const ContractTermsSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
300
- /**
301
- * Schema for ProposeContractRequest
302
- */
303
- export declare const ProposeContractRequestSchema: z.ZodObject<{
304
- /** Proposer's DAG address */
305
- proposer: z.ZodString;
306
- /** Counterparty's DAG address */
307
- counterparty: z.ZodString;
308
- /** Contract terms */
309
- terms: z.ZodRecord<z.ZodString, z.ZodUnknown>;
310
- /** Human-readable description */
311
- description: z.ZodString;
312
- }, "strip", z.ZodTypeAny, {
313
- proposer: string;
314
- counterparty: string;
315
- terms: Record<string, unknown>;
316
- description: string;
317
- }, {
318
- proposer: string;
319
- counterparty: string;
320
- terms: Record<string, unknown>;
321
- description: string;
322
- }>;
323
- /**
324
- * Type for validated ProposeContractRequest
325
- */
326
- export type ValidatedProposeContractRequest = z.infer<typeof ProposeContractRequestSchema>;
327
- /**
328
- * Schema for AcceptContractRequest
329
- */
330
- export declare const AcceptContractRequestSchema: z.ZodObject<{
331
- /** Contract ID to accept */
332
- contractId: z.ZodString;
333
- /** Acceptor's DAG address */
334
- acceptor: z.ZodString;
335
- }, "strip", z.ZodTypeAny, {
336
- contractId: string;
337
- acceptor: string;
338
- }, {
339
- contractId: string;
340
- acceptor: string;
341
- }>;
342
- /**
343
- * Type for validated AcceptContractRequest
344
- */
345
- export type ValidatedAcceptContractRequest = z.infer<typeof AcceptContractRequestSchema>;
346
- /**
347
- * Schema for CompleteContractRequest
348
- */
349
- export declare const CompleteContractRequestSchema: z.ZodObject<{
350
- /** Contract ID to complete */
351
- contractId: z.ZodString;
352
- /** Completer's DAG address */
353
- completer: z.ZodString;
354
- /** Proof of completion */
355
- proof: z.ZodString;
356
- }, "strip", z.ZodTypeAny, {
357
- contractId: string;
358
- completer: string;
359
- proof: string;
360
- }, {
361
- contractId: string;
362
- completer: string;
363
- proof: string;
364
- }>;
365
- /**
366
- * Type for validated CompleteContractRequest
367
- */
368
- export type ValidatedCompleteContractRequest = z.infer<typeof CompleteContractRequestSchema>;
369
- /**
370
- * Validate data against a Zod schema
371
- *
372
- * @param schema - Zod schema to validate against
373
- * @param data - Data to validate
374
- * @param fieldName - Optional field name for error context
375
- * @returns Validated and typed data
376
- * @throws {ValidationError} If validation fails
377
- *
378
- * @example
379
- * ```typescript
380
- * const keyPair = validate(KeyPairSchema, inputData, 'keyPair');
381
- * // keyPair is now typed as ValidatedKeyPair
382
- * ```
383
- */
384
- export declare function validate<T extends z.ZodTypeAny>(schema: T, data: unknown, fieldName?: string): z.infer<T>;
385
- /**
386
- * Validate a private key
387
- *
388
- * @param privateKey - Private key to validate
389
- * @returns Validated private key
390
- * @throws {ValidationError} If validation fails
391
- */
392
- export declare function validatePrivateKey(privateKey: unknown): string;
393
- /**
394
- * Validate a public key
395
- *
396
- * @param publicKey - Public key to validate
397
- * @returns Validated public key
398
- * @throws {ValidationError} If validation fails
399
- */
400
- export declare function validatePublicKey(publicKey: unknown): string;
401
- /**
402
- * Validate a DAG address
403
- *
404
- * @param address - Address to validate
405
- * @returns Validated address
406
- * @throws {ValidationError} If validation fails
407
- */
408
- export declare function validateAddress(address: unknown): string;
409
- /**
410
- * Validate a KeyPair
411
- *
412
- * @param keyPair - KeyPair to validate
413
- * @returns Validated KeyPair
414
- * @throws {ValidationError} If validation fails
415
- */
416
- export declare function validateKeyPair(keyPair: unknown): ValidatedKeyPair;
417
- /**
418
- * Safe validation that returns a result object instead of throwing
419
- *
420
- * @param schema - Zod schema to validate against
421
- * @param data - Data to validate
422
- * @returns Object with success status and data or error
423
- *
424
- * @example
425
- * ```typescript
426
- * const result = safeParse(KeyPairSchema, inputData);
427
- * if (result.success) {
428
- * console.log(result.data.address);
429
- * } else {
430
- * console.log(result.error.message);
431
- * }
432
- * ```
433
- */
434
- export declare function safeParse<T extends z.ZodTypeAny>(schema: T, data: unknown): {
435
- success: true;
436
- data: z.infer<T>;
437
- } | {
438
- success: false;
439
- error: ValidationError;
440
- };
441
- /**
442
- * Assert that a condition is true, throwing ValidationError if not
443
- *
444
- * @param condition - Condition to check
445
- * @param message - Error message if condition is false
446
- * @param field - Optional field name for context
447
- * @throws {ValidationError} If condition is false
448
- */
449
- export declare function assert(condition: boolean, message: string, field?: string): asserts condition;