@p2pdotme/sdk 1.2.1 → 1.2.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 (60) hide show
  1. package/README.md +1 -1
  2. package/dist/country.cjs +117 -2
  3. package/dist/country.cjs.map +1 -1
  4. package/dist/country.d.cts +13 -1
  5. package/dist/country.d.ts +13 -1
  6. package/dist/country.mjs +114 -2
  7. package/dist/country.mjs.map +1 -1
  8. package/dist/fraud-engine.cjs +2 -1
  9. package/dist/fraud-engine.cjs.map +1 -1
  10. package/dist/fraud-engine.mjs +2 -1
  11. package/dist/fraud-engine.mjs.map +1 -1
  12. package/dist/index.cjs +3 -2
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +1 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.mjs +3 -2
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/orders.cjs +42 -1
  19. package/dist/orders.cjs.map +1 -1
  20. package/dist/orders.d.cts +2 -0
  21. package/dist/orders.d.ts +2 -0
  22. package/dist/orders.mjs +42 -1
  23. package/dist/orders.mjs.map +1 -1
  24. package/dist/prices.cjs +42 -1
  25. package/dist/prices.cjs.map +1 -1
  26. package/dist/prices.d.cts +1 -0
  27. package/dist/prices.d.ts +1 -0
  28. package/dist/prices.mjs +42 -1
  29. package/dist/prices.mjs.map +1 -1
  30. package/dist/profile.cjs +42 -1
  31. package/dist/profile.cjs.map +1 -1
  32. package/dist/profile.d.cts +2 -0
  33. package/dist/profile.d.ts +2 -0
  34. package/dist/profile.mjs +42 -1
  35. package/dist/profile.mjs.map +1 -1
  36. package/dist/qr-parsers.cjs +50 -1
  37. package/dist/qr-parsers.cjs.map +1 -1
  38. package/dist/qr-parsers.d.cts +1 -0
  39. package/dist/qr-parsers.d.ts +1 -0
  40. package/dist/qr-parsers.mjs +50 -1
  41. package/dist/qr-parsers.mjs.map +1 -1
  42. package/dist/react.cjs +71 -2
  43. package/dist/react.cjs.map +1 -1
  44. package/dist/react.d.cts +18 -1
  45. package/dist/react.d.ts +18 -1
  46. package/dist/react.mjs +71 -2
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/stake.cjs +28 -1
  49. package/dist/stake.cjs.map +1 -1
  50. package/dist/stake.d.cts +1 -0
  51. package/dist/stake.d.ts +1 -0
  52. package/dist/stake.mjs +28 -1
  53. package/dist/stake.mjs.map +1 -1
  54. package/dist/zkkyc.cjs +234 -51
  55. package/dist/zkkyc.cjs.map +1 -1
  56. package/dist/zkkyc.d.cts +106 -5
  57. package/dist/zkkyc.d.ts +106 -5
  58. package/dist/zkkyc.mjs +230 -50
  59. package/dist/zkkyc.mjs.map +1 -1
  60. package/package.json +32 -12
package/dist/react.d.cts CHANGED
@@ -16,7 +16,7 @@ declare class SdkError<TCode extends string = string> extends Error {
16
16
  });
17
17
  }
18
18
 
19
- 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";
19
+ 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" | "SIMPLE_KYC_SESSION_FAILED" | "SIMPLE_KYC_REDEEM_FAILED" | "PEER_DEPENDENCY_MISSING";
20
20
  declare class ZkkycError extends SdkError<ZkkycErrorCode> {
21
21
  constructor(message: string, options: {
22
22
  code: ZkkycErrorCode;
@@ -73,6 +73,13 @@ declare const ZodZkPassportRegisterParamsSchema: z.ZodObject<{
73
73
  isIDCard: z.ZodBoolean;
74
74
  }, z.core.$strip>;
75
75
  type ZkPassportRegisterParams = z.infer<typeof ZodZkPassportRegisterParamsSchema>;
76
+ declare const ZodSimpleKycSubmitParamsSchema: z.ZodObject<{
77
+ nullifier: z.ZodString;
78
+ limit: z.ZodBigInt;
79
+ expiry: z.ZodBigInt;
80
+ signature: z.ZodString;
81
+ }, z.core.$strip>;
82
+ type SimpleKycSubmitParams = z.infer<typeof ZodSimpleKycSubmitParamsSchema>;
76
83
 
77
84
  interface Zkkyc {
78
85
  prepareSocialVerify(params: SocialVerifyParams): Result<{
@@ -87,6 +94,10 @@ interface Zkkyc {
87
94
  to: Address;
88
95
  data: `0x${string}`;
89
96
  }, ZkkycError>;
97
+ prepareSubmitKycAttestation(params: SimpleKycSubmitParams): Result<{
98
+ to: Address;
99
+ data: `0x${string}`;
100
+ }, ZkkycError>;
90
101
  }
91
102
 
92
103
  /**
@@ -137,6 +148,7 @@ declare const ZodGetStakeBoostConfigParamsSchema: z.ZodObject<{
137
148
  NGN: "NGN";
138
149
  USD: "USD";
139
150
  COP: "COP";
151
+ ECU: "ECU";
140
152
  }>;
141
153
  }, z.core.$strip>;
142
154
  type GetStakeBoostConfigParams = z.infer<typeof ZodGetStakeBoostConfigParamsSchema>;
@@ -287,6 +299,7 @@ declare const ZodGetFeeConfigParamsSchema: z.ZodObject<{
287
299
  NGN: "NGN";
288
300
  USD: "USD";
289
301
  COP: "COP";
302
+ ECU: "ECU";
290
303
  }>;
291
304
  }, z.core.$strip>;
292
305
  type GetFeeConfigParams = z.infer<typeof ZodGetFeeConfigParamsSchema>;
@@ -309,6 +322,7 @@ declare const ZodPlaceOrderParamsSchema: z.ZodObject<{
309
322
  NGN: "NGN";
310
323
  USD: "USD";
311
324
  COP: "COP";
325
+ ECU: "ECU";
312
326
  }>;
313
327
  user: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
314
328
  amount: z.ZodBigInt;
@@ -555,6 +569,7 @@ declare const ZodCurrencyScopedParamsSchema: z.ZodObject<{
555
569
  NGN: "NGN";
556
570
  USD: "USD";
557
571
  COP: "COP";
572
+ ECU: "ECU";
558
573
  }>;
559
574
  }, z.core.$strip>;
560
575
  type CurrencyScopedParams = z.infer<typeof ZodCurrencyScopedParamsSchema>;
@@ -620,6 +635,7 @@ declare const ZodGetBalancesParamsSchema: z.ZodObject<{
620
635
  NGN: "NGN";
621
636
  USD: "USD";
622
637
  COP: "COP";
638
+ ECU: "ECU";
623
639
  }>;
624
640
  }, z.core.$strip>;
625
641
  type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;
@@ -636,6 +652,7 @@ declare const ZodTxLimitsParamsSchema: z.ZodObject<{
636
652
  NGN: "NGN";
637
653
  USD: "USD";
638
654
  COP: "COP";
655
+ ECU: "ECU";
639
656
  }>;
640
657
  }, z.core.$strip>;
641
658
  type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;
package/dist/react.d.ts CHANGED
@@ -16,7 +16,7 @@ declare class SdkError<TCode extends string = string> extends Error {
16
16
  });
17
17
  }
18
18
 
19
- 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";
19
+ 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" | "SIMPLE_KYC_SESSION_FAILED" | "SIMPLE_KYC_REDEEM_FAILED" | "PEER_DEPENDENCY_MISSING";
20
20
  declare class ZkkycError extends SdkError<ZkkycErrorCode> {
21
21
  constructor(message: string, options: {
22
22
  code: ZkkycErrorCode;
@@ -73,6 +73,13 @@ declare const ZodZkPassportRegisterParamsSchema: z.ZodObject<{
73
73
  isIDCard: z.ZodBoolean;
74
74
  }, z.core.$strip>;
75
75
  type ZkPassportRegisterParams = z.infer<typeof ZodZkPassportRegisterParamsSchema>;
76
+ declare const ZodSimpleKycSubmitParamsSchema: z.ZodObject<{
77
+ nullifier: z.ZodString;
78
+ limit: z.ZodBigInt;
79
+ expiry: z.ZodBigInt;
80
+ signature: z.ZodString;
81
+ }, z.core.$strip>;
82
+ type SimpleKycSubmitParams = z.infer<typeof ZodSimpleKycSubmitParamsSchema>;
76
83
 
77
84
  interface Zkkyc {
78
85
  prepareSocialVerify(params: SocialVerifyParams): Result<{
@@ -87,6 +94,10 @@ interface Zkkyc {
87
94
  to: Address;
88
95
  data: `0x${string}`;
89
96
  }, ZkkycError>;
97
+ prepareSubmitKycAttestation(params: SimpleKycSubmitParams): Result<{
98
+ to: Address;
99
+ data: `0x${string}`;
100
+ }, ZkkycError>;
90
101
  }
91
102
 
92
103
  /**
@@ -137,6 +148,7 @@ declare const ZodGetStakeBoostConfigParamsSchema: z.ZodObject<{
137
148
  NGN: "NGN";
138
149
  USD: "USD";
139
150
  COP: "COP";
151
+ ECU: "ECU";
140
152
  }>;
141
153
  }, z.core.$strip>;
142
154
  type GetStakeBoostConfigParams = z.infer<typeof ZodGetStakeBoostConfigParamsSchema>;
@@ -287,6 +299,7 @@ declare const ZodGetFeeConfigParamsSchema: z.ZodObject<{
287
299
  NGN: "NGN";
288
300
  USD: "USD";
289
301
  COP: "COP";
302
+ ECU: "ECU";
290
303
  }>;
291
304
  }, z.core.$strip>;
292
305
  type GetFeeConfigParams = z.infer<typeof ZodGetFeeConfigParamsSchema>;
@@ -309,6 +322,7 @@ declare const ZodPlaceOrderParamsSchema: z.ZodObject<{
309
322
  NGN: "NGN";
310
323
  USD: "USD";
311
324
  COP: "COP";
325
+ ECU: "ECU";
312
326
  }>;
313
327
  user: z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>;
314
328
  amount: z.ZodBigInt;
@@ -555,6 +569,7 @@ declare const ZodCurrencyScopedParamsSchema: z.ZodObject<{
555
569
  NGN: "NGN";
556
570
  USD: "USD";
557
571
  COP: "COP";
572
+ ECU: "ECU";
558
573
  }>;
559
574
  }, z.core.$strip>;
560
575
  type CurrencyScopedParams = z.infer<typeof ZodCurrencyScopedParamsSchema>;
@@ -620,6 +635,7 @@ declare const ZodGetBalancesParamsSchema: z.ZodObject<{
620
635
  NGN: "NGN";
621
636
  USD: "USD";
622
637
  COP: "COP";
638
+ ECU: "ECU";
623
639
  }>;
624
640
  }, z.core.$strip>;
625
641
  type GetBalancesParams = z.infer<typeof ZodGetBalancesParamsSchema>;
@@ -636,6 +652,7 @@ declare const ZodTxLimitsParamsSchema: z.ZodObject<{
636
652
  NGN: "NGN";
637
653
  USD: "USD";
638
654
  COP: "COP";
655
+ ECU: "ECU";
639
656
  }>;
640
657
  }, z.core.$strip>;
641
658
  type TxLimitsParams = z.infer<typeof ZodTxLimitsParamsSchema>;
package/dist/react.mjs CHANGED
@@ -68,7 +68,8 @@ var CURRENCY = {
68
68
  EUR: "EUR",
69
69
  NGN: "NGN",
70
70
  USD: "USD",
71
- COP: "COP"
71
+ COP: "COP",
72
+ ECU: "ECU"
72
73
  };
73
74
  var CURRENCY_CODES = Object.values(CURRENCY);
74
75
 
@@ -1424,6 +1425,32 @@ var reputationManagerAbi = [
1424
1425
  outputs: [],
1425
1426
  stateMutability: "nonpayable",
1426
1427
  type: "function"
1428
+ },
1429
+ {
1430
+ inputs: [
1431
+ { internalType: "bytes32", name: "nullifier", type: "bytes32" },
1432
+ { internalType: "uint256", name: "limit", type: "uint256" },
1433
+ { internalType: "uint256", name: "expiry", type: "uint256" },
1434
+ { internalType: "bytes", name: "signature", type: "bytes" }
1435
+ ],
1436
+ name: "submitKycAttestation",
1437
+ outputs: [],
1438
+ stateMutability: "nonpayable",
1439
+ type: "function"
1440
+ },
1441
+ {
1442
+ inputs: [],
1443
+ name: "kycRp",
1444
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1445
+ stateMutability: "view",
1446
+ type: "function"
1447
+ },
1448
+ {
1449
+ inputs: [{ internalType: "address", name: "", type: "address" }],
1450
+ name: "kycVerified",
1451
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
1452
+ stateMutability: "view",
1453
+ type: "function"
1427
1454
  }
1428
1455
  ];
1429
1456
 
@@ -5755,6 +5782,20 @@ var ZodZkPassportRegisterParamsSchema = z9.object({
5755
5782
  params: ZodSolidityVerifierParametersSchema,
5756
5783
  isIDCard: z9.boolean()
5757
5784
  });
5785
+ var ZodSimpleKycSubmitParamsSchema = z9.object({
5786
+ /** Per-(tenant, identity) Sybil nullifier (bytes32 hex). */
5787
+ nullifier: z9.string().refine((v) => /^0x[a-fA-F0-9]{64}$/.test(v), {
5788
+ message: "nullifier must be a bytes32 hex string"
5789
+ }),
5790
+ /** Remaining limit in micro-USDC (part of the signed struct). */
5791
+ limit: z9.bigint(),
5792
+ /** Attestation expiry (unix seconds). */
5793
+ expiry: z9.bigint(),
5794
+ /** 65-byte secp256k1 signature (hex). */
5795
+ signature: z9.string().refine((v) => /^0x[a-fA-F0-9]+$/.test(v), {
5796
+ message: "signature must be a hex string"
5797
+ })
5798
+ });
5758
5799
 
5759
5800
  // src/contracts/reputation-manager/writes.ts
5760
5801
  function prepareSocialVerify(reputationManagerAddress, params) {
@@ -5821,6 +5862,33 @@ function prepareSubmitAnonAadharProof(reputationManagerAddress, params) {
5821
5862
  )()
5822
5863
  );
5823
5864
  }
5865
+ function prepareSubmitKycAttestation(reputationManagerAddress, params) {
5866
+ return validate(
5867
+ ZodSimpleKycSubmitParamsSchema,
5868
+ params,
5869
+ (message, cause, data) => new ZkkycError(message, { code: "VALIDATION_ERROR", cause, context: { params: data } })
5870
+ ).andThen(
5871
+ (validated) => Result2.fromThrowable(
5872
+ () => ({
5873
+ to: reputationManagerAddress,
5874
+ data: encodeFunctionData7({
5875
+ abi: ABIS.EXTERNAL.REPUTATION_MANAGER,
5876
+ functionName: "submitKycAttestation",
5877
+ args: [
5878
+ validated.nullifier,
5879
+ validated.limit,
5880
+ validated.expiry,
5881
+ validated.signature
5882
+ ]
5883
+ })
5884
+ }),
5885
+ (error) => new ZkkycError("Failed to encode submitKycAttestation", {
5886
+ code: "ENCODE_ERROR",
5887
+ cause: error
5888
+ })
5889
+ )()
5890
+ );
5891
+ }
5824
5892
  function prepareZkPassportRegister(reputationManagerAddress, params) {
5825
5893
  return validate(
5826
5894
  ZodZkPassportRegisterParamsSchema,
@@ -6912,7 +6980,8 @@ function createZkkyc(config) {
6912
6980
  return {
6913
6981
  prepareSocialVerify: (params) => prepareSocialVerify(reputationManagerAddress, params),
6914
6982
  prepareSubmitAnonAadharProof: (params) => prepareSubmitAnonAadharProof(reputationManagerAddress, params),
6915
- prepareZkPassportRegister: (params) => prepareZkPassportRegister(reputationManagerAddress, params)
6983
+ prepareZkPassportRegister: (params) => prepareZkPassportRegister(reputationManagerAddress, params),
6984
+ prepareSubmitKycAttestation: (params) => prepareSubmitKycAttestation(reputationManagerAddress, params)
6916
6985
  };
6917
6986
  }
6918
6987