@p2pdotme/sdk 1.0.5 → 1.1.1
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 +103 -41
- package/dist/country.cjs +9 -2
- package/dist/country.cjs.map +1 -1
- package/dist/country.d.cts +35 -10
- package/dist/country.d.ts +35 -10
- package/dist/country.mjs +6 -2
- package/dist/country.mjs.map +1 -1
- package/dist/fraud-engine.cjs +52 -48
- package/dist/fraud-engine.cjs.map +1 -1
- package/dist/fraud-engine.mjs +46 -42
- package/dist/fraud-engine.mjs.map +1 -1
- package/dist/index.cjs +4 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -36
- package/dist/index.d.ts +41 -36
- package/dist/index.mjs +4 -12
- package/dist/index.mjs.map +1 -1
- package/dist/orders.cjs +5961 -0
- package/dist/orders.cjs.map +1 -0
- package/dist/orders.d.cts +620 -0
- package/dist/orders.d.ts +620 -0
- package/dist/orders.mjs +5911 -0
- package/dist/orders.mjs.map +1 -0
- package/dist/prices.cjs +1432 -0
- package/dist/prices.cjs.map +1 -0
- package/dist/prices.d.cts +109 -0
- package/dist/prices.d.ts +109 -0
- package/dist/prices.mjs +1404 -0
- package/dist/prices.mjs.map +1 -0
- package/dist/profile.cjs +899 -69
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.d.cts +39 -27
- package/dist/profile.d.ts +39 -27
- package/dist/profile.mjs +892 -62
- package/dist/profile.mjs.map +1 -1
- package/dist/qr-parsers.cjs +88 -7
- package/dist/qr-parsers.cjs.map +1 -1
- package/dist/qr-parsers.d.cts +38 -16
- package/dist/qr-parsers.d.ts +38 -16
- package/dist/qr-parsers.mjs +88 -7
- package/dist/qr-parsers.mjs.map +1 -1
- package/dist/react.cjs +2955 -1105
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +384 -104
- package/dist/react.d.ts +384 -104
- package/dist/react.mjs +2841 -992
- package/dist/react.mjs.map +1 -1
- package/dist/zkkyc.cjs +405 -24
- package/dist/zkkyc.cjs.map +1 -1
- package/dist/zkkyc.d.cts +14 -9
- package/dist/zkkyc.d.ts +14 -9
- package/dist/zkkyc.mjs +405 -24
- package/dist/zkkyc.mjs.map +1 -1
- package/package.json +12 -12
- package/dist/order-routing.cjs +0 -888
- package/dist/order-routing.cjs.map +0 -1
- package/dist/order-routing.d.cts +0 -68
- package/dist/order-routing.d.ts +0 -68
- package/dist/order-routing.mjs +0 -860
- package/dist/order-routing.mjs.map +0 -1
- package/dist/payload.cjs +0 -3168
- package/dist/payload.cjs.map +0 -1
- package/dist/payload.d.cts +0 -147
- package/dist/payload.d.ts +0 -147
- package/dist/payload.mjs +0 -3124
- package/dist/payload.mjs.map +0 -1
package/dist/profile.d.ts
CHANGED
|
@@ -26,30 +26,47 @@ declare const ZodUsdcBalanceParamsSchema: z.ZodObject<{
|
|
|
26
26
|
address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
28
|
type UsdcBalanceParams = z.infer<typeof ZodUsdcBalanceParamsSchema>;
|
|
29
|
+
declare const ZodUsdcAllowanceParamsSchema: z.ZodObject<{
|
|
30
|
+
owner: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
type UsdcAllowanceParams = z.infer<typeof ZodUsdcAllowanceParamsSchema>;
|
|
29
33
|
declare const ZodGetBalancesParamsSchema: z.ZodObject<{
|
|
30
34
|
address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
31
35
|
currency: z.ZodEnum<{
|
|
32
|
-
|
|
36
|
+
IDR: "IDR";
|
|
37
|
+
INR: "INR";
|
|
38
|
+
BRL: "BRL";
|
|
39
|
+
ARS: "ARS";
|
|
40
|
+
MEX: "MEX";
|
|
41
|
+
VEN: "VEN";
|
|
42
|
+
EUR: "EUR";
|
|
43
|
+
NGN: "NGN";
|
|
44
|
+
USD: "USD";
|
|
45
|
+
COP: "COP";
|
|
33
46
|
}>;
|
|
34
47
|
}, z.core.$strip>;
|
|
35
48
|
type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;
|
|
36
49
|
declare const ZodTxLimitsParamsSchema: z.ZodObject<{
|
|
37
50
|
address: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
|
|
38
51
|
currency: z.ZodEnum<{
|
|
39
|
-
|
|
52
|
+
IDR: "IDR";
|
|
53
|
+
INR: "INR";
|
|
54
|
+
BRL: "BRL";
|
|
55
|
+
ARS: "ARS";
|
|
56
|
+
MEX: "MEX";
|
|
57
|
+
VEN: "VEN";
|
|
58
|
+
EUR: "EUR";
|
|
59
|
+
NGN: "NGN";
|
|
60
|
+
USD: "USD";
|
|
61
|
+
COP: "COP";
|
|
40
62
|
}>;
|
|
41
63
|
}, z.core.$strip>;
|
|
42
64
|
type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;
|
|
43
|
-
declare const ZodPriceConfigParamsSchema: z.ZodObject<{
|
|
44
|
-
currency: z.ZodEnum<{
|
|
45
|
-
[x: string]: string;
|
|
46
|
-
}>;
|
|
47
|
-
}, z.core.$strip>;
|
|
48
|
-
type PriceConfigParams = z.infer<typeof ZodPriceConfigParamsSchema>;
|
|
49
65
|
|
|
50
66
|
/**
|
|
51
67
|
* Minimal viem PublicClient interface — consumers pass their own client.
|
|
52
|
-
* The SDK
|
|
68
|
+
* The SDK uses `readContract` for single reads and `multicall` where available
|
|
69
|
+
* to batch multiple reads into one RPC round-trip.
|
|
53
70
|
*/
|
|
54
71
|
interface PublicClientLike {
|
|
55
72
|
readContract(args: {
|
|
@@ -58,18 +75,21 @@ interface PublicClientLike {
|
|
|
58
75
|
functionName: string;
|
|
59
76
|
args: readonly unknown[];
|
|
60
77
|
}): Promise<unknown>;
|
|
78
|
+
multicall?(args: {
|
|
79
|
+
contracts: readonly {
|
|
80
|
+
address: Address;
|
|
81
|
+
abi: readonly unknown[];
|
|
82
|
+
functionName: string;
|
|
83
|
+
args?: readonly unknown[];
|
|
84
|
+
}[];
|
|
85
|
+
allowFailure?: boolean;
|
|
86
|
+
}): Promise<readonly unknown[]>;
|
|
61
87
|
}
|
|
62
88
|
|
|
63
89
|
interface TxLimits {
|
|
64
90
|
readonly buyLimit: number;
|
|
65
91
|
readonly sellLimit: number;
|
|
66
92
|
}
|
|
67
|
-
interface RpPerUsdtLimit {
|
|
68
|
-
readonly numerator: bigint;
|
|
69
|
-
readonly denominator: bigint;
|
|
70
|
-
/** The USDC multiplier per RP: denominator / numerator. */
|
|
71
|
-
readonly multiplier: number;
|
|
72
|
-
}
|
|
73
93
|
|
|
74
94
|
interface ProfileConfig {
|
|
75
95
|
readonly publicClient: PublicClientLike;
|
|
@@ -84,26 +104,18 @@ interface Balances {
|
|
|
84
104
|
/** The sell price used for conversion. */
|
|
85
105
|
readonly sellPrice: number;
|
|
86
106
|
}
|
|
87
|
-
interface PriceConfig {
|
|
88
|
-
readonly buyPrice: bigint;
|
|
89
|
-
readonly sellPrice: bigint;
|
|
90
|
-
readonly buyPriceOffset: bigint;
|
|
91
|
-
readonly baseSpread: bigint;
|
|
92
|
-
}
|
|
93
107
|
|
|
94
108
|
interface Profile {
|
|
95
109
|
/** Reads the USDC balance for a given address (raw bigint, 6 decimals). */
|
|
96
110
|
getUsdcBalance(params: UsdcBalanceParams): ResultAsync<bigint, ProfileError>;
|
|
97
|
-
/** Reads
|
|
98
|
-
|
|
111
|
+
/** Reads the USDC allowance `owner → diamond` (raw bigint, 6 decimals). */
|
|
112
|
+
getUsdcAllowance(params: UsdcAllowanceParams): ResultAsync<bigint, ProfileError>;
|
|
99
113
|
/** Fetches USDC and fiat balance in parallel for a given address and currency. */
|
|
100
114
|
getBalances(params: GetBalancesParams): ResultAsync<Balances, ProfileError>;
|
|
101
115
|
/** Reads buy and sell transaction limits for a given address and currency. */
|
|
102
116
|
getTxLimits(params: TxLimitsParams): ResultAsync<TxLimits, ProfileError>;
|
|
103
|
-
/** Reads the RP-to-USDC limit ratio for a given currency. */
|
|
104
|
-
getRpPerUsdtLimitRational(params: PriceConfigParams): ResultAsync<RpPerUsdtLimit, ProfileError>;
|
|
105
117
|
}
|
|
106
|
-
/** Creates a Profile SDK instance for reading
|
|
118
|
+
/** Creates a Profile SDK instance for reading user-scoped balance and limit data. */
|
|
107
119
|
declare function createProfile(config: ProfileConfig): Profile;
|
|
108
120
|
|
|
109
|
-
export { type Balances, type GetBalancesParams, type
|
|
121
|
+
export { type Balances, type GetBalancesParams, type Profile, type ProfileConfig, ProfileError, type ProfileErrorCode, type PublicClientLike, type TxLimits, type TxLimitsParams, type UsdcAllowanceParams, type UsdcBalanceParams, createProfile };
|