@p2pdotme/sdk 1.2.1 → 1.2.2

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/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
  /**
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
  /**
package/dist/react.mjs CHANGED
@@ -1424,6 +1424,32 @@ var reputationManagerAbi = [
1424
1424
  outputs: [],
1425
1425
  stateMutability: "nonpayable",
1426
1426
  type: "function"
1427
+ },
1428
+ {
1429
+ inputs: [
1430
+ { internalType: "bytes32", name: "nullifier", type: "bytes32" },
1431
+ { internalType: "uint256", name: "limit", type: "uint256" },
1432
+ { internalType: "uint256", name: "expiry", type: "uint256" },
1433
+ { internalType: "bytes", name: "signature", type: "bytes" }
1434
+ ],
1435
+ name: "submitKycAttestation",
1436
+ outputs: [],
1437
+ stateMutability: "nonpayable",
1438
+ type: "function"
1439
+ },
1440
+ {
1441
+ inputs: [],
1442
+ name: "kycRp",
1443
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1444
+ stateMutability: "view",
1445
+ type: "function"
1446
+ },
1447
+ {
1448
+ inputs: [{ internalType: "address", name: "", type: "address" }],
1449
+ name: "kycVerified",
1450
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
1451
+ stateMutability: "view",
1452
+ type: "function"
1427
1453
  }
1428
1454
  ];
1429
1455
 
@@ -5755,6 +5781,20 @@ var ZodZkPassportRegisterParamsSchema = z9.object({
5755
5781
  params: ZodSolidityVerifierParametersSchema,
5756
5782
  isIDCard: z9.boolean()
5757
5783
  });
5784
+ var ZodSimpleKycSubmitParamsSchema = z9.object({
5785
+ /** Per-(tenant, identity) Sybil nullifier (bytes32 hex). */
5786
+ nullifier: z9.string().refine((v) => /^0x[a-fA-F0-9]{64}$/.test(v), {
5787
+ message: "nullifier must be a bytes32 hex string"
5788
+ }),
5789
+ /** Remaining limit in micro-USDC (part of the signed struct). */
5790
+ limit: z9.bigint(),
5791
+ /** Attestation expiry (unix seconds). */
5792
+ expiry: z9.bigint(),
5793
+ /** 65-byte secp256k1 signature (hex). */
5794
+ signature: z9.string().refine((v) => /^0x[a-fA-F0-9]+$/.test(v), {
5795
+ message: "signature must be a hex string"
5796
+ })
5797
+ });
5758
5798
 
5759
5799
  // src/contracts/reputation-manager/writes.ts
5760
5800
  function prepareSocialVerify(reputationManagerAddress, params) {
@@ -5821,6 +5861,33 @@ function prepareSubmitAnonAadharProof(reputationManagerAddress, params) {
5821
5861
  )()
5822
5862
  );
5823
5863
  }
5864
+ function prepareSubmitKycAttestation(reputationManagerAddress, params) {
5865
+ return validate(
5866
+ ZodSimpleKycSubmitParamsSchema,
5867
+ params,
5868
+ (message, cause, data) => new ZkkycError(message, { code: "VALIDATION_ERROR", cause, context: { params: data } })
5869
+ ).andThen(
5870
+ (validated) => Result2.fromThrowable(
5871
+ () => ({
5872
+ to: reputationManagerAddress,
5873
+ data: encodeFunctionData7({
5874
+ abi: ABIS.EXTERNAL.REPUTATION_MANAGER,
5875
+ functionName: "submitKycAttestation",
5876
+ args: [
5877
+ validated.nullifier,
5878
+ validated.limit,
5879
+ validated.expiry,
5880
+ validated.signature
5881
+ ]
5882
+ })
5883
+ }),
5884
+ (error) => new ZkkycError("Failed to encode submitKycAttestation", {
5885
+ code: "ENCODE_ERROR",
5886
+ cause: error
5887
+ })
5888
+ )()
5889
+ );
5890
+ }
5824
5891
  function prepareZkPassportRegister(reputationManagerAddress, params) {
5825
5892
  return validate(
5826
5893
  ZodZkPassportRegisterParamsSchema,
@@ -6912,7 +6979,8 @@ function createZkkyc(config) {
6912
6979
  return {
6913
6980
  prepareSocialVerify: (params) => prepareSocialVerify(reputationManagerAddress, params),
6914
6981
  prepareSubmitAnonAadharProof: (params) => prepareSubmitAnonAadharProof(reputationManagerAddress, params),
6915
- prepareZkPassportRegister: (params) => prepareZkPassportRegister(reputationManagerAddress, params)
6982
+ prepareZkPassportRegister: (params) => prepareZkPassportRegister(reputationManagerAddress, params),
6983
+ prepareSubmitKycAttestation: (params) => prepareSubmitKycAttestation(reputationManagerAddress, params)
6916
6984
  };
6917
6985
  }
6918
6986