@p2pdotme/sdk 1.0.1 → 1.0.3

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 (50) hide show
  1. package/README.md +1 -0
  2. package/dist/country.cjs +611 -0
  3. package/dist/country.cjs.map +1 -0
  4. package/dist/country.d.cts +106 -0
  5. package/dist/country.d.ts +106 -0
  6. package/dist/country.mjs +571 -0
  7. package/dist/country.mjs.map +1 -0
  8. package/dist/fraud-engine.cjs +19 -14
  9. package/dist/fraud-engine.cjs.map +1 -1
  10. package/dist/fraud-engine.mjs +19 -14
  11. package/dist/fraud-engine.mjs.map +1 -1
  12. package/dist/index.cjs +24 -17
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +32 -26
  15. package/dist/index.d.ts +32 -26
  16. package/dist/index.mjs +23 -17
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/order-routing.cjs +19 -14
  19. package/dist/order-routing.cjs.map +1 -1
  20. package/dist/order-routing.mjs +19 -14
  21. package/dist/order-routing.mjs.map +1 -1
  22. package/dist/payload.cjs +18 -15
  23. package/dist/payload.cjs.map +1 -1
  24. package/dist/payload.d.cts +5 -22
  25. package/dist/payload.d.ts +5 -22
  26. package/dist/payload.mjs +18 -15
  27. package/dist/payload.mjs.map +1 -1
  28. package/dist/profile.cjs +19 -14
  29. package/dist/profile.cjs.map +1 -1
  30. package/dist/profile.d.cts +3 -30
  31. package/dist/profile.d.ts +3 -30
  32. package/dist/profile.mjs +19 -14
  33. package/dist/profile.mjs.map +1 -1
  34. package/dist/qr-parsers.cjs +260 -5
  35. package/dist/qr-parsers.cjs.map +1 -1
  36. package/dist/qr-parsers.d.cts +10 -1
  37. package/dist/qr-parsers.d.ts +10 -1
  38. package/dist/qr-parsers.mjs +260 -5
  39. package/dist/qr-parsers.mjs.map +1 -1
  40. package/dist/react.cjs +26 -21
  41. package/dist/react.cjs.map +1 -1
  42. package/dist/react.d.cts +8 -52
  43. package/dist/react.d.ts +8 -52
  44. package/dist/react.mjs +26 -21
  45. package/dist/react.mjs.map +1 -1
  46. package/dist/zkkyc.cjs +19 -14
  47. package/dist/zkkyc.cjs.map +1 -1
  48. package/dist/zkkyc.mjs +19 -14
  49. package/dist/zkkyc.mjs.map +1 -1
  50. package/package.json +7 -1
package/dist/react.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as neverthrow from 'neverthrow';
2
2
  import { Result, ResultAsync } from 'neverthrow';
3
3
  import { Address } from 'viem';
4
- import { z } from 'zod';
4
+ import z$1, { z } from 'zod';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { ReactNode } from 'react';
7
7
 
@@ -17,18 +17,8 @@ declare class SdkError<TCode extends string = string> extends Error {
17
17
  }
18
18
 
19
19
  declare const ZodCurrencySchema: z.ZodEnum<{
20
- IDR: "IDR";
21
- INR: "INR";
22
- BRL: "BRL";
23
- ARS: "ARS";
24
- MEX: "MEX";
25
- VEN: "VEN";
26
- EUR: "EUR";
27
- NGN: "NGN";
28
- USD: "USD";
29
- COP: "COP";
20
+ [x: string]: string;
30
21
  }>;
31
- type CurrencyType = z.infer<typeof ZodCurrencySchema>;
32
22
 
33
23
  type ZkkycErrorCode = "VALIDATION_ERROR" | "CONTRACT_READ_ERROR" | "ENCODE_ERROR" | "RECLAIM_INIT_FAILED" | "RECLAIM_SESSION_NOT_FOUND" | "RECLAIM_PROOF_GENERATION_FAILED" | "RECLAIM_PROOF_INVALID" | "RECLAIM_POLLING_ABORTED" | "ZK_PASSPORT_INIT_FAILED" | "ZK_PASSPORT_REJECTED" | "ZK_PASSPORT_VERIFICATION_FAILED" | "ZK_PASSPORT_ABORTED" | "PEER_DEPENDENCY_MISSING";
34
24
  declare class ZkkycError extends SdkError<ZkkycErrorCode> {
@@ -128,6 +118,8 @@ interface Logger {
128
118
  error(message: string, data?: Record<string, unknown>): void;
129
119
  }
130
120
 
121
+ type CurrencyType = z$1.infer<typeof ZodCurrencySchema>;
122
+
131
123
  /**
132
124
  * Minimal viem PublicClient interface — consumers pass their own client.
133
125
  * The SDK only needs `readContract` for on-chain reads.
@@ -181,16 +173,7 @@ declare const ZodPlaceOrderParamsSchema: z.ZodObject<{
181
173
  recipientAddr: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
182
174
  orderType: z.ZodNumber;
183
175
  currency: z.ZodEnum<{
184
- IDR: "IDR";
185
- INR: "INR";
186
- BRL: "BRL";
187
- ARS: "ARS";
188
- MEX: "MEX";
189
- VEN: "VEN";
190
- EUR: "EUR";
191
- NGN: "NGN";
192
- USD: "USD";
193
- COP: "COP";
176
+ [x: string]: string;
194
177
  }>;
195
178
  fiatAmount: z.ZodBigInt;
196
179
  user: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
@@ -228,47 +211,20 @@ type UsdcBalanceParams = z.infer<typeof ZodUsdcBalanceParamsSchema>;
228
211
  declare const ZodGetBalancesParamsSchema: z.ZodObject<{
229
212
  address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
230
213
  currency: z.ZodEnum<{
231
- IDR: "IDR";
232
- INR: "INR";
233
- BRL: "BRL";
234
- ARS: "ARS";
235
- MEX: "MEX";
236
- VEN: "VEN";
237
- EUR: "EUR";
238
- NGN: "NGN";
239
- USD: "USD";
240
- COP: "COP";
214
+ [x: string]: string;
241
215
  }>;
242
216
  }, z.core.$strip>;
243
217
  type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;
244
218
  declare const ZodTxLimitsParamsSchema: z.ZodObject<{
245
219
  address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
246
220
  currency: z.ZodEnum<{
247
- IDR: "IDR";
248
- INR: "INR";
249
- BRL: "BRL";
250
- ARS: "ARS";
251
- MEX: "MEX";
252
- VEN: "VEN";
253
- EUR: "EUR";
254
- NGN: "NGN";
255
- USD: "USD";
256
- COP: "COP";
221
+ [x: string]: string;
257
222
  }>;
258
223
  }, z.core.$strip>;
259
224
  type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;
260
225
  declare const ZodPriceConfigParamsSchema: z.ZodObject<{
261
226
  currency: z.ZodEnum<{
262
- IDR: "IDR";
263
- INR: "INR";
264
- BRL: "BRL";
265
- ARS: "ARS";
266
- MEX: "MEX";
267
- VEN: "VEN";
268
- EUR: "EUR";
269
- NGN: "NGN";
270
- USD: "USD";
271
- COP: "COP";
227
+ [x: string]: string;
272
228
  }>;
273
229
  }, z.core.$strip>;
274
230
  type PriceConfigParams = z.infer<typeof ZodPriceConfigParamsSchema>;
package/dist/react.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as neverthrow from 'neverthrow';
2
2
  import { Result, ResultAsync } from 'neverthrow';
3
3
  import { Address } from 'viem';
4
- import { z } from 'zod';
4
+ import z$1, { z } from 'zod';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { ReactNode } from 'react';
7
7
 
@@ -17,18 +17,8 @@ declare class SdkError<TCode extends string = string> extends Error {
17
17
  }
18
18
 
19
19
  declare const ZodCurrencySchema: z.ZodEnum<{
20
- IDR: "IDR";
21
- INR: "INR";
22
- BRL: "BRL";
23
- ARS: "ARS";
24
- MEX: "MEX";
25
- VEN: "VEN";
26
- EUR: "EUR";
27
- NGN: "NGN";
28
- USD: "USD";
29
- COP: "COP";
20
+ [x: string]: string;
30
21
  }>;
31
- type CurrencyType = z.infer<typeof ZodCurrencySchema>;
32
22
 
33
23
  type ZkkycErrorCode = "VALIDATION_ERROR" | "CONTRACT_READ_ERROR" | "ENCODE_ERROR" | "RECLAIM_INIT_FAILED" | "RECLAIM_SESSION_NOT_FOUND" | "RECLAIM_PROOF_GENERATION_FAILED" | "RECLAIM_PROOF_INVALID" | "RECLAIM_POLLING_ABORTED" | "ZK_PASSPORT_INIT_FAILED" | "ZK_PASSPORT_REJECTED" | "ZK_PASSPORT_VERIFICATION_FAILED" | "ZK_PASSPORT_ABORTED" | "PEER_DEPENDENCY_MISSING";
34
24
  declare class ZkkycError extends SdkError<ZkkycErrorCode> {
@@ -128,6 +118,8 @@ interface Logger {
128
118
  error(message: string, data?: Record<string, unknown>): void;
129
119
  }
130
120
 
121
+ type CurrencyType = z$1.infer<typeof ZodCurrencySchema>;
122
+
131
123
  /**
132
124
  * Minimal viem PublicClient interface — consumers pass their own client.
133
125
  * The SDK only needs `readContract` for on-chain reads.
@@ -181,16 +173,7 @@ declare const ZodPlaceOrderParamsSchema: z.ZodObject<{
181
173
  recipientAddr: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
182
174
  orderType: z.ZodNumber;
183
175
  currency: z.ZodEnum<{
184
- IDR: "IDR";
185
- INR: "INR";
186
- BRL: "BRL";
187
- ARS: "ARS";
188
- MEX: "MEX";
189
- VEN: "VEN";
190
- EUR: "EUR";
191
- NGN: "NGN";
192
- USD: "USD";
193
- COP: "COP";
176
+ [x: string]: string;
194
177
  }>;
195
178
  fiatAmount: z.ZodBigInt;
196
179
  user: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
@@ -228,47 +211,20 @@ type UsdcBalanceParams = z.infer<typeof ZodUsdcBalanceParamsSchema>;
228
211
  declare const ZodGetBalancesParamsSchema: z.ZodObject<{
229
212
  address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
230
213
  currency: z.ZodEnum<{
231
- IDR: "IDR";
232
- INR: "INR";
233
- BRL: "BRL";
234
- ARS: "ARS";
235
- MEX: "MEX";
236
- VEN: "VEN";
237
- EUR: "EUR";
238
- NGN: "NGN";
239
- USD: "USD";
240
- COP: "COP";
214
+ [x: string]: string;
241
215
  }>;
242
216
  }, z.core.$strip>;
243
217
  type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;
244
218
  declare const ZodTxLimitsParamsSchema: z.ZodObject<{
245
219
  address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
246
220
  currency: z.ZodEnum<{
247
- IDR: "IDR";
248
- INR: "INR";
249
- BRL: "BRL";
250
- ARS: "ARS";
251
- MEX: "MEX";
252
- VEN: "VEN";
253
- EUR: "EUR";
254
- NGN: "NGN";
255
- USD: "USD";
256
- COP: "COP";
221
+ [x: string]: string;
257
222
  }>;
258
223
  }, z.core.$strip>;
259
224
  type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;
260
225
  declare const ZodPriceConfigParamsSchema: z.ZodObject<{
261
226
  currency: z.ZodEnum<{
262
- IDR: "IDR";
263
- INR: "INR";
264
- BRL: "BRL";
265
- ARS: "ARS";
266
- MEX: "MEX";
267
- VEN: "VEN";
268
- EUR: "EUR";
269
- NGN: "NGN";
270
- USD: "USD";
271
- COP: "COP";
227
+ [x: string]: string;
272
228
  }>;
273
229
  }, z.core.$strip>;
274
230
  type PriceConfigParams = z.infer<typeof ZodPriceConfigParamsSchema>;
package/dist/react.mjs CHANGED
@@ -78,7 +78,7 @@ async function getDeviceDetails(seonSession) {
78
78
  return { ...basic, ip, seonSession };
79
79
  }
80
80
 
81
- // src/validation/errors.ts
81
+ // src/validation/errors.validation.ts
82
82
  var SdkError = class extends Error {
83
83
  code;
84
84
  cause;
@@ -92,23 +92,35 @@ var SdkError = class extends Error {
92
92
  }
93
93
  };
94
94
 
95
- // src/validation/schemas.ts
95
+ // src/validation/schemas.validation.ts
96
96
  import { err, ok } from "neverthrow";
97
97
  import { isAddress } from "viem";
98
98
  import { z } from "zod";
99
+
100
+ // src/constants/currencies.constant.ts
101
+ var CURRENCY = {
102
+ IDR: "IDR",
103
+ INR: "INR",
104
+ BRL: "BRL",
105
+ ARS: "ARS",
106
+ MEX: "MEX",
107
+ VEN: "VEN",
108
+ EUR: "EUR",
109
+ NGN: "NGN",
110
+ USD: "USD",
111
+ COP: "COP"
112
+ };
113
+
114
+ // src/constants/orders.constant.ts
115
+ var ORDER_TYPE = {
116
+ BUY: 0,
117
+ SELL: 1,
118
+ PAY: 2
119
+ };
120
+
121
+ // src/validation/schemas.validation.ts
99
122
  var ZodAddressSchema = z.string().refine((s) => isAddress(s), { message: "Invalid Ethereum address" });
100
- var ZodCurrencySchema = z.enum([
101
- "IDR",
102
- "INR",
103
- "BRL",
104
- "ARS",
105
- "MEX",
106
- "VEN",
107
- "EUR",
108
- "NGN",
109
- "USD",
110
- "COP"
111
- ]);
123
+ var ZodCurrencySchema = z.enum(Object.values(CURRENCY));
112
124
  function validate(schema, data, toError) {
113
125
  const result = schema.safeParse(data);
114
126
  if (result.success) {
@@ -1579,13 +1591,6 @@ function createOrderRouter(config) {
1579
1591
  // src/payload/actions.ts
1580
1592
  import { errAsync as errAsync3 } from "neverthrow";
1581
1593
 
1582
- // src/constants/orders.ts
1583
- var ORDER_TYPE = {
1584
- BUY: 0,
1585
- SELL: 1,
1586
- PAY: 2
1587
- };
1588
-
1589
1594
  // src/payload/crypto.ts
1590
1595
  import { ok as ok4, Result as Result2, ResultAsync as ResultAsync7, safeTry } from "neverthrow";
1591
1596
  import { keccak256, serializeSignature, stringToHex as stringToHex4 } from "viem";