@sip-protocol/sdk 0.6.9 → 0.6.11

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 (81) hide show
  1. package/package.json +1 -1
  2. package/dist/chunk-25QRORO4.mjs +0 -17031
  3. package/dist/chunk-4IFOPYJF.mjs +0 -11950
  4. package/dist/chunk-4VJHI66K.mjs +0 -12120
  5. package/dist/chunk-5BAS4D44.mjs +0 -10283
  6. package/dist/chunk-6WOV2YNG.mjs +0 -10179
  7. package/dist/chunk-7IMRM7LN.mjs +0 -12149
  8. package/dist/chunk-7QZPORY5.mjs +0 -15604
  9. package/dist/chunk-AB3SCLVT.mjs +0 -17026
  10. package/dist/chunk-AOZIY3GU.mjs +0 -12995
  11. package/dist/chunk-BC3P7JHS.mjs +0 -17031
  12. package/dist/chunk-BCLIX5T2.mjs +0 -12940
  13. package/dist/chunk-C2NPCUAJ.mjs +0 -17010
  14. package/dist/chunk-DMHBKRWV.mjs +0 -14712
  15. package/dist/chunk-DU7LQDD2.mjs +0 -10148
  16. package/dist/chunk-EU4UEWWG.mjs +0 -12164
  17. package/dist/chunk-FCVLFUIC.mjs +0 -16699
  18. package/dist/chunk-FKXPHKYD.mjs +0 -12955
  19. package/dist/chunk-G5UHXECN.mjs +0 -16340
  20. package/dist/chunk-GEDEIZHJ.mjs +0 -16798
  21. package/dist/chunk-GOOEOAMV.mjs +0 -17026
  22. package/dist/chunk-H5W3IPDU.mjs +0 -17028
  23. package/dist/chunk-J4Q4NJ2U.mjs +0 -13544
  24. package/dist/chunk-JNNXNTSS.mjs +0 -11034
  25. package/dist/chunk-KBS3OMSZ.mjs +0 -14737
  26. package/dist/chunk-KXN6IWL5.mjs +0 -10736
  27. package/dist/chunk-MR7HRCRS.mjs +0 -10165
  28. package/dist/chunk-MTNYSNR7.mjs +0 -16269
  29. package/dist/chunk-NDGUWOOZ.mjs +0 -10157
  30. package/dist/chunk-O4Y2ZUDL.mjs +0 -12721
  31. package/dist/chunk-O5PIB2EA.mjs +0 -16698
  32. package/dist/chunk-OPQ2GQIO.mjs +0 -13013
  33. package/dist/chunk-PCFM7FQO.mjs +0 -17010
  34. package/dist/chunk-QK464ARC.mjs +0 -16946
  35. package/dist/chunk-TK3FWQNC.mjs +0 -14737
  36. package/dist/chunk-UHZKNGIT.mjs +0 -223
  37. package/dist/chunk-UPTISVCY.mjs +0 -10304
  38. package/dist/chunk-VITVG25F.mjs +0 -982
  39. package/dist/chunk-VNBMNGC3.mjs +0 -16698
  40. package/dist/chunk-VXSHK7US.mjs +0 -10158
  41. package/dist/chunk-W2B7T6WU.mjs +0 -14714
  42. package/dist/chunk-W3YXIQ7L.mjs +0 -11950
  43. package/dist/chunk-W5TUELDQ.mjs +0 -16947
  44. package/dist/chunk-XLEPIR2P.mjs +0 -884
  45. package/dist/chunk-YZCK337Y.mjs +0 -12155
  46. package/dist/index-05W_S8A7.d.mts +0 -9237
  47. package/dist/index-5jAdWMA-.d.ts +0 -8973
  48. package/dist/index-B47OpN-g.d.ts +0 -11332
  49. package/dist/index-B9Vkpaao.d.mts +0 -8973
  50. package/dist/index-BVaHV5ge.d.mts +0 -11332
  51. package/dist/index-Ba7njCU3.d.ts +0 -6925
  52. package/dist/index-BcWNakUD.d.ts +0 -7990
  53. package/dist/index-BsKY3Hr0.d.mts +0 -7990
  54. package/dist/index-C5ehlFhR.d.mts +0 -9443
  55. package/dist/index-CD_zShu-.d.ts +0 -10870
  56. package/dist/index-CNzhx-WH.d.mts +0 -9316
  57. package/dist/index-CQBYdLYy.d.mts +0 -10976
  58. package/dist/index-Cg9TYEPv.d.mts +0 -11321
  59. package/dist/index-Co26-vbG.d.mts +0 -6925
  60. package/dist/index-CqSppS4i.d.ts +0 -9237
  61. package/dist/index-CqZJOO8C.d.mts +0 -11323
  62. package/dist/index-CywN9Bnp.d.ts +0 -11321
  63. package/dist/index-DAgedMrt.d.ts +0 -6927
  64. package/dist/index-DBa_jiZF.d.mts +0 -9606
  65. package/dist/index-DHy5ZjCD.d.ts +0 -10976
  66. package/dist/index-DLNdSQFQ.d.ts +0 -9316
  67. package/dist/index-DW7AQwcU.d.mts +0 -6927
  68. package/dist/index-DfsVsmxu.d.ts +0 -11323
  69. package/dist/index-DqZoHYKI.d.mts +0 -6418
  70. package/dist/index-Ink8HnKW.d.ts +0 -9606
  71. package/dist/index-ObjwyVDX.d.mts +0 -10870
  72. package/dist/index-dTtK_DTl.d.ts +0 -6762
  73. package/dist/index-h7B23m5b.d.ts +0 -9443
  74. package/dist/index-jnkYu-Z4.d.mts +0 -6762
  75. package/dist/index-m0xbSfmT.d.mts +0 -11318
  76. package/dist/index-rWLEgvhN.d.ts +0 -11318
  77. package/dist/index-vB1N1mHd.d.ts +0 -6418
  78. package/dist/noir-BHQtFvRk.d.mts +0 -467
  79. package/dist/noir-BHQtFvRk.d.ts +0 -467
  80. package/dist/noir-BTyLXLlZ.d.mts +0 -467
  81. package/dist/noir-BTyLXLlZ.d.ts +0 -467
@@ -1,223 +0,0 @@
1
- // src/errors.ts
2
- var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
3
- ErrorCode2["UNKNOWN"] = "SIP_1000";
4
- ErrorCode2["INTERNAL"] = "SIP_1001";
5
- ErrorCode2["NOT_IMPLEMENTED"] = "SIP_1002";
6
- ErrorCode2["VALIDATION_FAILED"] = "SIP_2000";
7
- ErrorCode2["INVALID_INPUT"] = "SIP_2001";
8
- ErrorCode2["INVALID_CHAIN"] = "SIP_2002";
9
- ErrorCode2["INVALID_PRIVACY_LEVEL"] = "SIP_2003";
10
- ErrorCode2["INVALID_AMOUNT"] = "SIP_2004";
11
- ErrorCode2["INVALID_HEX"] = "SIP_2005";
12
- ErrorCode2["INVALID_KEY"] = "SIP_2006";
13
- ErrorCode2["INVALID_ADDRESS"] = "SIP_2007";
14
- ErrorCode2["MISSING_REQUIRED"] = "SIP_2008";
15
- ErrorCode2["OUT_OF_RANGE"] = "SIP_2009";
16
- ErrorCode2["CRYPTO_FAILED"] = "SIP_3000";
17
- ErrorCode2["ENCRYPTION_FAILED"] = "SIP_3001";
18
- ErrorCode2["DECRYPTION_FAILED"] = "SIP_3002";
19
- ErrorCode2["KEY_DERIVATION_FAILED"] = "SIP_3003";
20
- ErrorCode2["COMMITMENT_FAILED"] = "SIP_3004";
21
- ErrorCode2["SIGNATURE_FAILED"] = "SIP_3005";
22
- ErrorCode2["INVALID_CURVE_POINT"] = "SIP_3006";
23
- ErrorCode2["INVALID_SCALAR"] = "SIP_3007";
24
- ErrorCode2["PROOF_FAILED"] = "SIP_4000";
25
- ErrorCode2["PROOF_GENERATION_FAILED"] = "SIP_4001";
26
- ErrorCode2["PROOF_VERIFICATION_FAILED"] = "SIP_4002";
27
- ErrorCode2["PROOF_NOT_IMPLEMENTED"] = "SIP_4003";
28
- ErrorCode2["PROOF_PROVIDER_NOT_READY"] = "SIP_4004";
29
- ErrorCode2["INVALID_PROOF_PARAMS"] = "SIP_4005";
30
- ErrorCode2["INTENT_FAILED"] = "SIP_5000";
31
- ErrorCode2["INTENT_EXPIRED"] = "SIP_5001";
32
- ErrorCode2["INTENT_CANCELLED"] = "SIP_5002";
33
- ErrorCode2["INTENT_NOT_FOUND"] = "SIP_5003";
34
- ErrorCode2["INTENT_INVALID_STATE"] = "SIP_5004";
35
- ErrorCode2["PROOFS_REQUIRED"] = "SIP_5005";
36
- ErrorCode2["QUOTE_EXPIRED"] = "SIP_5006";
37
- ErrorCode2["NETWORK_FAILED"] = "SIP_6000";
38
- ErrorCode2["NETWORK_TIMEOUT"] = "SIP_6001";
39
- ErrorCode2["NETWORK_UNAVAILABLE"] = "SIP_6002";
40
- ErrorCode2["RPC_ERROR"] = "SIP_6003";
41
- ErrorCode2["API_ERROR"] = "SIP_6004";
42
- ErrorCode2["RATE_LIMITED"] = "SIP_6005";
43
- ErrorCode2["WALLET_ERROR"] = "SIP_7000";
44
- ErrorCode2["WALLET_NOT_CONNECTED"] = "SIP_7001";
45
- ErrorCode2["WALLET_CONNECTION_FAILED"] = "SIP_7002";
46
- ErrorCode2["WALLET_SIGNING_FAILED"] = "SIP_7003";
47
- ErrorCode2["WALLET_TRANSACTION_FAILED"] = "SIP_7004";
48
- return ErrorCode2;
49
- })(ErrorCode || {});
50
- var SIPError = class extends Error {
51
- /** Machine-readable error code */
52
- code;
53
- /** Additional debugging context */
54
- context;
55
- /** Timestamp when error was created */
56
- timestamp;
57
- constructor(message, code = "SIP_1000" /* UNKNOWN */, options) {
58
- super(message, { cause: options?.cause });
59
- this.name = "SIPError";
60
- this.code = code;
61
- this.context = options?.context;
62
- this.timestamp = /* @__PURE__ */ new Date();
63
- if (Error.captureStackTrace) {
64
- Error.captureStackTrace(this, this.constructor);
65
- }
66
- }
67
- /**
68
- * Serialize error for logging or transmission
69
- */
70
- toJSON() {
71
- return {
72
- name: this.name,
73
- code: this.code,
74
- message: this.message,
75
- context: this.context,
76
- cause: this.cause instanceof Error ? this.cause.message : void 0,
77
- stack: this.stack,
78
- timestamp: this.timestamp.toISOString()
79
- };
80
- }
81
- /**
82
- * Create a string representation for logging
83
- */
84
- toString() {
85
- let result = `[${this.code}] ${this.name}: ${this.message}`;
86
- if (this.cause instanceof Error) {
87
- result += `
88
- Caused by: ${this.cause.message}`;
89
- }
90
- return result;
91
- }
92
- };
93
- var ValidationError = class extends SIPError {
94
- /** The field that failed validation (if applicable) */
95
- field;
96
- constructor(message, field, context, code = "SIP_2000" /* VALIDATION_FAILED */) {
97
- const fullMessage = field ? `Validation failed for '${field}': ${message}` : `Validation failed: ${message}`;
98
- super(fullMessage, code, { context });
99
- this.name = "ValidationError";
100
- this.field = field;
101
- }
102
- toJSON() {
103
- return {
104
- ...super.toJSON(),
105
- field: this.field
106
- };
107
- }
108
- };
109
- var CryptoError = class extends SIPError {
110
- /** The cryptographic operation that failed */
111
- operation;
112
- constructor(message, code = "SIP_3000" /* CRYPTO_FAILED */, options) {
113
- super(message, code, options);
114
- this.name = "CryptoError";
115
- this.operation = options?.operation;
116
- }
117
- };
118
- var EncryptionNotImplementedError = class extends CryptoError {
119
- /** The type of encryption operation */
120
- operationType;
121
- /** Reference to the specification document */
122
- specReference;
123
- constructor(operation, specReference) {
124
- const message = `${operation.charAt(0).toUpperCase() + operation.slice(1)}ion is not implemented. Real authenticated encryption (ChaCha20-Poly1305) is required. See specification: ${specReference}`;
125
- super(message, "SIP_1002" /* NOT_IMPLEMENTED */, {
126
- context: { operation, specReference }
127
- });
128
- this.name = "EncryptionNotImplementedError";
129
- this.operationType = operation;
130
- this.specReference = specReference;
131
- }
132
- };
133
- var ProofError = class extends SIPError {
134
- /** The type of proof involved */
135
- proofType;
136
- constructor(message, code = "SIP_4000" /* PROOF_FAILED */, options) {
137
- super(message, code, options);
138
- this.name = "ProofError";
139
- this.proofType = options?.proofType;
140
- }
141
- };
142
- var ProofNotImplementedError = class extends ProofError {
143
- /** Reference to the specification document */
144
- specReference;
145
- constructor(proofType, specReference) {
146
- const message = `${proofType.charAt(0).toUpperCase() + proofType.slice(1)} proof generation is not implemented. Real ZK proofs are required for production use. See specification: ${specReference}`;
147
- super(message, "SIP_4003" /* PROOF_NOT_IMPLEMENTED */, {
148
- context: { specReference },
149
- proofType
150
- });
151
- this.name = "ProofNotImplementedError";
152
- this.specReference = specReference;
153
- }
154
- };
155
- var IntentError = class extends SIPError {
156
- /** The intent ID involved (if available) */
157
- intentId;
158
- constructor(message, code = "SIP_5000" /* INTENT_FAILED */, options) {
159
- super(message, code, options);
160
- this.name = "IntentError";
161
- this.intentId = options?.intentId;
162
- }
163
- };
164
- var NetworkError = class extends SIPError {
165
- /** The endpoint that failed (if applicable) */
166
- endpoint;
167
- /** HTTP status code (if applicable) */
168
- statusCode;
169
- constructor(message, code = "SIP_6000" /* NETWORK_FAILED */, options) {
170
- super(message, code, options);
171
- this.name = "NetworkError";
172
- this.endpoint = options?.endpoint;
173
- this.statusCode = options?.statusCode;
174
- }
175
- };
176
- function isSIPError(error) {
177
- return error instanceof SIPError;
178
- }
179
- function hasErrorCode(error, code) {
180
- return isSIPError(error) && error.code === code;
181
- }
182
- function wrapError(error, message, code = "SIP_1001" /* INTERNAL */, context) {
183
- if (error instanceof SIPError) {
184
- return error;
185
- }
186
- const cause = error instanceof Error ? error : new Error(String(error));
187
- return new SIPError(message, code, { cause, context });
188
- }
189
- function getErrorMessage(error) {
190
- if (error instanceof Error) {
191
- return error.message;
192
- }
193
- return String(error);
194
- }
195
-
196
- // src/proofs/interface.ts
197
- var ProofGenerationError = class extends Error {
198
- proofType;
199
- cause;
200
- constructor(proofType, message, cause) {
201
- super(`${proofType} proof generation failed: ${message}`);
202
- this.name = "ProofGenerationError";
203
- this.proofType = proofType;
204
- this.cause = cause;
205
- }
206
- };
207
-
208
- export {
209
- ErrorCode,
210
- SIPError,
211
- ValidationError,
212
- CryptoError,
213
- EncryptionNotImplementedError,
214
- ProofError,
215
- ProofNotImplementedError,
216
- IntentError,
217
- NetworkError,
218
- isSIPError,
219
- hasErrorCode,
220
- wrapError,
221
- getErrorMessage,
222
- ProofGenerationError
223
- };