@p2pdotme/sdk 1.0.2 → 1.0.4

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 (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +8 -4
  3. package/dist/country.cjs +613 -0
  4. package/dist/country.cjs.map +1 -0
  5. package/dist/country.d.cts +107 -0
  6. package/dist/country.d.ts +107 -0
  7. package/dist/country.mjs +573 -0
  8. package/dist/country.mjs.map +1 -0
  9. package/dist/fraud-engine.cjs +19 -13
  10. package/dist/fraud-engine.cjs.map +1 -1
  11. package/dist/fraud-engine.mjs +19 -13
  12. package/dist/fraud-engine.mjs.map +1 -1
  13. package/dist/index.cjs +24 -16
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +32 -25
  16. package/dist/index.d.ts +32 -25
  17. package/dist/index.mjs +23 -16
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/order-routing.cjs +19 -13
  20. package/dist/order-routing.cjs.map +1 -1
  21. package/dist/order-routing.mjs +19 -13
  22. package/dist/order-routing.mjs.map +1 -1
  23. package/dist/payload.cjs +18 -14
  24. package/dist/payload.cjs.map +1 -1
  25. package/dist/payload.d.cts +5 -20
  26. package/dist/payload.d.ts +5 -20
  27. package/dist/payload.mjs +18 -14
  28. package/dist/payload.mjs.map +1 -1
  29. package/dist/profile.cjs +19 -13
  30. package/dist/profile.cjs.map +1 -1
  31. package/dist/profile.d.cts +3 -27
  32. package/dist/profile.d.ts +3 -27
  33. package/dist/profile.mjs +19 -13
  34. package/dist/profile.mjs.map +1 -1
  35. package/dist/qr-parsers.cjs +260 -5
  36. package/dist/qr-parsers.cjs.map +1 -1
  37. package/dist/qr-parsers.d.cts +10 -1
  38. package/dist/qr-parsers.d.ts +10 -1
  39. package/dist/qr-parsers.mjs +260 -5
  40. package/dist/qr-parsers.mjs.map +1 -1
  41. package/dist/react.cjs +26 -20
  42. package/dist/react.cjs.map +1 -1
  43. package/dist/react.d.cts +8 -47
  44. package/dist/react.d.ts +8 -47
  45. package/dist/react.mjs +26 -20
  46. package/dist/react.mjs.map +1 -1
  47. package/dist/zkkyc.cjs +21 -15
  48. package/dist/zkkyc.cjs.map +1 -1
  49. package/dist/zkkyc.d.cts +2 -2
  50. package/dist/zkkyc.d.ts +2 -2
  51. package/dist/zkkyc.mjs +21 -15
  52. package/dist/zkkyc.mjs.map +1 -1
  53. package/package.json +9 -2
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,17 +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";
20
+ [x: string]: string;
29
21
  }>;
30
- type CurrencyType = z.infer<typeof ZodCurrencySchema>;
31
22
 
32
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";
33
24
  declare class ZkkycError extends SdkError<ZkkycErrorCode> {
@@ -127,6 +118,8 @@ interface Logger {
127
118
  error(message: string, data?: Record<string, unknown>): void;
128
119
  }
129
120
 
121
+ type CurrencyType = z$1.infer<typeof ZodCurrencySchema>;
122
+
130
123
  /**
131
124
  * Minimal viem PublicClient interface — consumers pass their own client.
132
125
  * The SDK only needs `readContract` for on-chain reads.
@@ -180,15 +173,7 @@ declare const ZodPlaceOrderParamsSchema: z.ZodObject<{
180
173
  recipientAddr: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
181
174
  orderType: z.ZodNumber;
182
175
  currency: z.ZodEnum<{
183
- IDR: "IDR";
184
- INR: "INR";
185
- BRL: "BRL";
186
- ARS: "ARS";
187
- MEX: "MEX";
188
- VEN: "VEN";
189
- EUR: "EUR";
190
- NGN: "NGN";
191
- USD: "USD";
176
+ [x: string]: string;
192
177
  }>;
193
178
  fiatAmount: z.ZodBigInt;
194
179
  user: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
@@ -226,44 +211,20 @@ type UsdcBalanceParams = z.infer<typeof ZodUsdcBalanceParamsSchema>;
226
211
  declare const ZodGetBalancesParamsSchema: z.ZodObject<{
227
212
  address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
228
213
  currency: z.ZodEnum<{
229
- IDR: "IDR";
230
- INR: "INR";
231
- BRL: "BRL";
232
- ARS: "ARS";
233
- MEX: "MEX";
234
- VEN: "VEN";
235
- EUR: "EUR";
236
- NGN: "NGN";
237
- USD: "USD";
214
+ [x: string]: string;
238
215
  }>;
239
216
  }, z.core.$strip>;
240
217
  type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;
241
218
  declare const ZodTxLimitsParamsSchema: z.ZodObject<{
242
219
  address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
243
220
  currency: z.ZodEnum<{
244
- IDR: "IDR";
245
- INR: "INR";
246
- BRL: "BRL";
247
- ARS: "ARS";
248
- MEX: "MEX";
249
- VEN: "VEN";
250
- EUR: "EUR";
251
- NGN: "NGN";
252
- USD: "USD";
221
+ [x: string]: string;
253
222
  }>;
254
223
  }, z.core.$strip>;
255
224
  type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;
256
225
  declare const ZodPriceConfigParamsSchema: z.ZodObject<{
257
226
  currency: z.ZodEnum<{
258
- IDR: "IDR";
259
- INR: "INR";
260
- BRL: "BRL";
261
- ARS: "ARS";
262
- MEX: "MEX";
263
- VEN: "VEN";
264
- EUR: "EUR";
265
- NGN: "NGN";
266
- USD: "USD";
227
+ [x: string]: string;
267
228
  }>;
268
229
  }, z.core.$strip>;
269
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,17 +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";
20
+ [x: string]: string;
29
21
  }>;
30
- type CurrencyType = z.infer<typeof ZodCurrencySchema>;
31
22
 
32
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";
33
24
  declare class ZkkycError extends SdkError<ZkkycErrorCode> {
@@ -127,6 +118,8 @@ interface Logger {
127
118
  error(message: string, data?: Record<string, unknown>): void;
128
119
  }
129
120
 
121
+ type CurrencyType = z$1.infer<typeof ZodCurrencySchema>;
122
+
130
123
  /**
131
124
  * Minimal viem PublicClient interface — consumers pass their own client.
132
125
  * The SDK only needs `readContract` for on-chain reads.
@@ -180,15 +173,7 @@ declare const ZodPlaceOrderParamsSchema: z.ZodObject<{
180
173
  recipientAddr: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
181
174
  orderType: z.ZodNumber;
182
175
  currency: z.ZodEnum<{
183
- IDR: "IDR";
184
- INR: "INR";
185
- BRL: "BRL";
186
- ARS: "ARS";
187
- MEX: "MEX";
188
- VEN: "VEN";
189
- EUR: "EUR";
190
- NGN: "NGN";
191
- USD: "USD";
176
+ [x: string]: string;
192
177
  }>;
193
178
  fiatAmount: z.ZodBigInt;
194
179
  user: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
@@ -226,44 +211,20 @@ type UsdcBalanceParams = z.infer<typeof ZodUsdcBalanceParamsSchema>;
226
211
  declare const ZodGetBalancesParamsSchema: z.ZodObject<{
227
212
  address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
228
213
  currency: z.ZodEnum<{
229
- IDR: "IDR";
230
- INR: "INR";
231
- BRL: "BRL";
232
- ARS: "ARS";
233
- MEX: "MEX";
234
- VEN: "VEN";
235
- EUR: "EUR";
236
- NGN: "NGN";
237
- USD: "USD";
214
+ [x: string]: string;
238
215
  }>;
239
216
  }, z.core.$strip>;
240
217
  type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;
241
218
  declare const ZodTxLimitsParamsSchema: z.ZodObject<{
242
219
  address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
243
220
  currency: z.ZodEnum<{
244
- IDR: "IDR";
245
- INR: "INR";
246
- BRL: "BRL";
247
- ARS: "ARS";
248
- MEX: "MEX";
249
- VEN: "VEN";
250
- EUR: "EUR";
251
- NGN: "NGN";
252
- USD: "USD";
221
+ [x: string]: string;
253
222
  }>;
254
223
  }, z.core.$strip>;
255
224
  type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;
256
225
  declare const ZodPriceConfigParamsSchema: z.ZodObject<{
257
226
  currency: z.ZodEnum<{
258
- IDR: "IDR";
259
- INR: "INR";
260
- BRL: "BRL";
261
- ARS: "ARS";
262
- MEX: "MEX";
263
- VEN: "VEN";
264
- EUR: "EUR";
265
- NGN: "NGN";
266
- USD: "USD";
227
+ [x: string]: string;
267
228
  }>;
268
229
  }, z.core.$strip>;
269
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,22 +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
- ]);
123
+ var ZodCurrencySchema = z.enum(Object.values(CURRENCY));
111
124
  function validate(schema, data, toError) {
112
125
  const result = schema.safeParse(data);
113
126
  if (result.success) {
@@ -1578,13 +1591,6 @@ function createOrderRouter(config) {
1578
1591
  // src/payload/actions.ts
1579
1592
  import { errAsync as errAsync3 } from "neverthrow";
1580
1593
 
1581
- // src/constants/orders.ts
1582
- var ORDER_TYPE = {
1583
- BUY: 0,
1584
- SELL: 1,
1585
- PAY: 2
1586
- };
1587
-
1588
1594
  // src/payload/crypto.ts
1589
1595
  import { ok as ok4, Result as Result2, ResultAsync as ResultAsync7, safeTry } from "neverthrow";
1590
1596
  import { keccak256, serializeSignature, stringToHex as stringToHex4 } from "viem";