@p2pdotme/sdk 1.0.2 → 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.
- package/README.md +2 -1
- package/dist/country.cjs +611 -0
- package/dist/country.cjs.map +1 -0
- package/dist/country.d.cts +106 -0
- package/dist/country.d.ts +106 -0
- package/dist/country.mjs +571 -0
- package/dist/country.mjs.map +1 -0
- package/dist/fraud-engine.cjs +19 -13
- package/dist/fraud-engine.cjs.map +1 -1
- package/dist/fraud-engine.mjs +19 -13
- package/dist/fraud-engine.mjs.map +1 -1
- package/dist/index.cjs +24 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -25
- package/dist/index.d.ts +32 -25
- package/dist/index.mjs +23 -16
- package/dist/index.mjs.map +1 -1
- package/dist/order-routing.cjs +19 -13
- package/dist/order-routing.cjs.map +1 -1
- package/dist/order-routing.mjs +19 -13
- package/dist/order-routing.mjs.map +1 -1
- package/dist/payload.cjs +18 -14
- package/dist/payload.cjs.map +1 -1
- package/dist/payload.d.cts +5 -20
- package/dist/payload.d.ts +5 -20
- package/dist/payload.mjs +18 -14
- package/dist/payload.mjs.map +1 -1
- package/dist/profile.cjs +19 -13
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.d.cts +3 -27
- package/dist/profile.d.ts +3 -27
- package/dist/profile.mjs +19 -13
- package/dist/profile.mjs.map +1 -1
- package/dist/qr-parsers.cjs +260 -5
- package/dist/qr-parsers.cjs.map +1 -1
- package/dist/qr-parsers.d.cts +10 -1
- package/dist/qr-parsers.d.ts +10 -1
- package/dist/qr-parsers.mjs +260 -5
- package/dist/qr-parsers.mjs.map +1 -1
- package/dist/react.cjs +26 -20
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +8 -47
- package/dist/react.d.ts +8 -47
- package/dist/react.mjs +26 -20
- package/dist/react.mjs.map +1 -1
- package/dist/zkkyc.cjs +19 -13
- package/dist/zkkyc.cjs.map +1 -1
- package/dist/zkkyc.mjs +19 -13
- package/dist/zkkyc.mjs.map +1 -1
- 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,17 +17,8 @@ declare class SdkError<TCode extends string = string> extends Error {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
declare const ZodCurrencySchema: z.ZodEnum<{
|
|
20
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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";
|