@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.
Files changed (66) hide show
  1. package/README.md +103 -41
  2. package/dist/country.cjs +9 -2
  3. package/dist/country.cjs.map +1 -1
  4. package/dist/country.d.cts +35 -10
  5. package/dist/country.d.ts +35 -10
  6. package/dist/country.mjs +6 -2
  7. package/dist/country.mjs.map +1 -1
  8. package/dist/fraud-engine.cjs +52 -48
  9. package/dist/fraud-engine.cjs.map +1 -1
  10. package/dist/fraud-engine.mjs +46 -42
  11. package/dist/fraud-engine.mjs.map +1 -1
  12. package/dist/index.cjs +4 -14
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +41 -36
  15. package/dist/index.d.ts +41 -36
  16. package/dist/index.mjs +4 -12
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/orders.cjs +5961 -0
  19. package/dist/orders.cjs.map +1 -0
  20. package/dist/orders.d.cts +620 -0
  21. package/dist/orders.d.ts +620 -0
  22. package/dist/orders.mjs +5911 -0
  23. package/dist/orders.mjs.map +1 -0
  24. package/dist/prices.cjs +1432 -0
  25. package/dist/prices.cjs.map +1 -0
  26. package/dist/prices.d.cts +109 -0
  27. package/dist/prices.d.ts +109 -0
  28. package/dist/prices.mjs +1404 -0
  29. package/dist/prices.mjs.map +1 -0
  30. package/dist/profile.cjs +899 -69
  31. package/dist/profile.cjs.map +1 -1
  32. package/dist/profile.d.cts +39 -27
  33. package/dist/profile.d.ts +39 -27
  34. package/dist/profile.mjs +892 -62
  35. package/dist/profile.mjs.map +1 -1
  36. package/dist/qr-parsers.cjs +88 -7
  37. package/dist/qr-parsers.cjs.map +1 -1
  38. package/dist/qr-parsers.d.cts +38 -16
  39. package/dist/qr-parsers.d.ts +38 -16
  40. package/dist/qr-parsers.mjs +88 -7
  41. package/dist/qr-parsers.mjs.map +1 -1
  42. package/dist/react.cjs +2955 -1105
  43. package/dist/react.cjs.map +1 -1
  44. package/dist/react.d.cts +384 -104
  45. package/dist/react.d.ts +384 -104
  46. package/dist/react.mjs +2841 -992
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/zkkyc.cjs +405 -24
  49. package/dist/zkkyc.cjs.map +1 -1
  50. package/dist/zkkyc.d.cts +14 -9
  51. package/dist/zkkyc.d.ts +14 -9
  52. package/dist/zkkyc.mjs +405 -24
  53. package/dist/zkkyc.mjs.map +1 -1
  54. package/package.json +12 -12
  55. package/dist/order-routing.cjs +0 -888
  56. package/dist/order-routing.cjs.map +0 -1
  57. package/dist/order-routing.d.cts +0 -68
  58. package/dist/order-routing.d.ts +0 -68
  59. package/dist/order-routing.mjs +0 -860
  60. package/dist/order-routing.mjs.map +0 -1
  61. package/dist/payload.cjs +0 -3168
  62. package/dist/payload.cjs.map +0 -1
  63. package/dist/payload.d.cts +0 -147
  64. package/dist/payload.d.ts +0 -147
  65. package/dist/payload.mjs +0 -3124
  66. 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
- [x: string]: string;
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
- [x: string]: string;
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 only needs `readContract` for on-chain reads.
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 buy/sell price config for a given currency (raw bigint, 6 decimals). */
98
- getPriceConfig(params: PriceConfigParams): ResultAsync<PriceConfig, ProfileError>;
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 account balance and price data. */
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 PriceConfig, type PriceConfigParams, type Profile, type ProfileConfig, ProfileError, type ProfileErrorCode, type PublicClientLike, type RpPerUsdtLimit, type TxLimits, type TxLimitsParams, type UsdcBalanceParams, createProfile };
121
+ export { type Balances, type GetBalancesParams, type Profile, type ProfileConfig, ProfileError, type ProfileErrorCode, type PublicClientLike, type TxLimits, type TxLimitsParams, type UsdcAllowanceParams, type UsdcBalanceParams, createProfile };