@0xpolygonid/js-sdk 1.18.0 → 1.18.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.
@@ -63,9 +63,9 @@ class ContractRequestHandler extends message_handler_1.AbstractMessageHandler {
63
63
  const zkpResponses = await (0, common_1.processZeroKnowledgeProofRequests)(did, message?.body?.scope, verifierDid, this._proofService, { ethSigner, challenge, supportedCircuits: this._supportedCircuits });
64
64
  const methodId = message.body.transaction_data.method_id.replace('0x', '');
65
65
  switch (methodId) {
66
- case storage_1.FunctionSignatures.SumbitZKPResponseV2:
66
+ case storage_1.FunctionSignatures.SubmitZKPResponseV2:
67
67
  return this._zkpVerifier.submitZKPResponseV2(ethSigner, message.body.transaction_data, zkpResponses);
68
- case storage_1.FunctionSignatures.SumbitZKPResponseV1: {
68
+ case storage_1.FunctionSignatures.SubmitZKPResponseV1: {
69
69
  const txHashZkpResponseMap = await this._zkpVerifier.submitZKPResponse(ethSigner, message.body.transaction_data, zkpResponses);
70
70
  const response = new Map();
71
71
  for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
@@ -74,7 +74,7 @@ class ContractRequestHandler extends message_handler_1.AbstractMessageHandler {
74
74
  return response;
75
75
  }
76
76
  default:
77
- throw new Error(`Not supported method id. Only '${storage_1.FunctionSignatures.SumbitZKPResponseV1} and ${storage_1.FunctionSignatures.SumbitZKPResponseV2} are supported.'`);
77
+ throw new Error(`Not supported method id. Only '${storage_1.FunctionSignatures.SubmitZKPResponseV1} and ${storage_1.FunctionSignatures.SubmitZKPResponseV2} are supported.'`);
78
78
  }
79
79
  }
80
80
  /**
@@ -135,7 +135,7 @@ class ContractRequestHandler extends message_handler_1.AbstractMessageHandler {
135
135
  */
136
136
  async handleContractInvokeRequest(did, request, opts) {
137
137
  const ciRequest = await this.parseContractInvokeRequest(request);
138
- if (ciRequest.body.transaction_data.method_id !== storage_1.FunctionSignatures.SumbitZKPResponseV1) {
138
+ if (ciRequest.body.transaction_data.method_id !== storage_1.FunctionSignatures.SubmitZKPResponseV1) {
139
139
  throw new Error(`please use handle method to work with other method ids`);
140
140
  }
141
141
  if (ciRequest.type !== constants_1.PROTOCOL_MESSAGE_TYPE.CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE) {
@@ -22,9 +22,9 @@ var FunctionSignatures;
22
22
  * function submitZKPResponse(uint64 requestId, uint256[] calldata inputs,
23
23
  * uint256[2] calldata a, uint256[2][2] calldata b, uint256[2] calldata c) public
24
24
  */
25
- FunctionSignatures["SumbitZKPResponseV1"] = "b68967e2";
25
+ FunctionSignatures["SubmitZKPResponseV1"] = "b68967e2";
26
26
  //function submitZKPResponseV2(tuple[](uint64 requestId,bytes zkProof,bytes data),bytes crossChainProof)
27
- FunctionSignatures["SumbitZKPResponseV2"] = "ade09fcd";
27
+ FunctionSignatures["SubmitZKPResponseV2"] = "ade09fcd";
28
28
  })(FunctionSignatures = exports.FunctionSignatures || (exports.FunctionSignatures = {}));
29
29
  /**
30
30
  * OnChainZKPVerifier is a class that allows to interact with the OnChainZKPVerifier contract
@@ -60,8 +60,8 @@ class OnChainZKPVerifier {
60
60
  * {@inheritDoc IOnChainZKPVerifier.prepareTxArgsSubmitV1}
61
61
  */
62
62
  async prepareTxArgsSubmitV1(txData, zkProofResponse) {
63
- if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV1) {
64
- throw new Error(`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV1}' is supported.`);
63
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV1) {
64
+ throw new Error(`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV1}' is supported.`);
65
65
  }
66
66
  const requestID = zkProofResponse.id;
67
67
  const inputs = zkProofResponse.pub_signals;
@@ -85,8 +85,8 @@ class OnChainZKPVerifier {
85
85
  if (!chainConfig) {
86
86
  throw new Error(`config for chain id ${txData.chain_id} was not found`);
87
87
  }
88
- if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV1) {
89
- throw new Error(`submitZKPResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV1}' is supported.`);
88
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV1) {
89
+ throw new Error(`submitZKPResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV1}' is supported.`);
90
90
  }
91
91
  const provider = new ethers_1.JsonRpcProvider(chainConfig.url, chainConfig.chainId);
92
92
  ethSigner = ethSigner.connect(provider);
@@ -130,8 +130,8 @@ class OnChainZKPVerifier {
130
130
  if (!chainConfig) {
131
131
  throw new Error(`config for chain id ${txData.chain_id} was not found`);
132
132
  }
133
- if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV2) {
134
- throw new Error(`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV2}' is supported.`);
133
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV2) {
134
+ throw new Error(`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV2}' is supported.`);
135
135
  }
136
136
  if (!this._opts?.didResolverUrl) {
137
137
  throw new Error(`did resolver url required for crosschain verification`);
@@ -167,8 +167,8 @@ class OnChainZKPVerifier {
167
167
  return new Map().set(txnHash, zkProofResponses);
168
168
  }
169
169
  async prepareTxArgsSubmitV2(txData, zkProofResponses) {
170
- if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV2) {
171
- throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV2}' is supported.`);
170
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV2) {
171
+ throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV2}' is supported.`);
172
172
  }
173
173
  if (!this._opts?.didResolverUrl) {
174
174
  throw new Error(`did resolver url required for crosschain verification`);
@@ -60,9 +60,9 @@ export class ContractRequestHandler extends AbstractMessageHandler {
60
60
  const zkpResponses = await processZeroKnowledgeProofRequests(did, message?.body?.scope, verifierDid, this._proofService, { ethSigner, challenge, supportedCircuits: this._supportedCircuits });
61
61
  const methodId = message.body.transaction_data.method_id.replace('0x', '');
62
62
  switch (methodId) {
63
- case FunctionSignatures.SumbitZKPResponseV2:
63
+ case FunctionSignatures.SubmitZKPResponseV2:
64
64
  return this._zkpVerifier.submitZKPResponseV2(ethSigner, message.body.transaction_data, zkpResponses);
65
- case FunctionSignatures.SumbitZKPResponseV1: {
65
+ case FunctionSignatures.SubmitZKPResponseV1: {
66
66
  const txHashZkpResponseMap = await this._zkpVerifier.submitZKPResponse(ethSigner, message.body.transaction_data, zkpResponses);
67
67
  const response = new Map();
68
68
  for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
@@ -71,7 +71,7 @@ export class ContractRequestHandler extends AbstractMessageHandler {
71
71
  return response;
72
72
  }
73
73
  default:
74
- throw new Error(`Not supported method id. Only '${FunctionSignatures.SumbitZKPResponseV1} and ${FunctionSignatures.SumbitZKPResponseV2} are supported.'`);
74
+ throw new Error(`Not supported method id. Only '${FunctionSignatures.SubmitZKPResponseV1} and ${FunctionSignatures.SubmitZKPResponseV2} are supported.'`);
75
75
  }
76
76
  }
77
77
  /**
@@ -132,7 +132,7 @@ export class ContractRequestHandler extends AbstractMessageHandler {
132
132
  */
133
133
  async handleContractInvokeRequest(did, request, opts) {
134
134
  const ciRequest = await this.parseContractInvokeRequest(request);
135
- if (ciRequest.body.transaction_data.method_id !== FunctionSignatures.SumbitZKPResponseV1) {
135
+ if (ciRequest.body.transaction_data.method_id !== FunctionSignatures.SubmitZKPResponseV1) {
136
136
  throw new Error(`please use handle method to work with other method ids`);
137
137
  }
138
138
  if (ciRequest.type !== PROTOCOL_MESSAGE_TYPE.CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE) {
@@ -16,9 +16,9 @@ export var FunctionSignatures;
16
16
  * function submitZKPResponse(uint64 requestId, uint256[] calldata inputs,
17
17
  * uint256[2] calldata a, uint256[2][2] calldata b, uint256[2] calldata c) public
18
18
  */
19
- FunctionSignatures["SumbitZKPResponseV1"] = "b68967e2";
19
+ FunctionSignatures["SubmitZKPResponseV1"] = "b68967e2";
20
20
  //function submitZKPResponseV2(tuple[](uint64 requestId,bytes zkProof,bytes data),bytes crossChainProof)
21
- FunctionSignatures["SumbitZKPResponseV2"] = "ade09fcd";
21
+ FunctionSignatures["SubmitZKPResponseV2"] = "ade09fcd";
22
22
  })(FunctionSignatures || (FunctionSignatures = {}));
23
23
  /**
24
24
  * OnChainZKPVerifier is a class that allows to interact with the OnChainZKPVerifier contract
@@ -54,8 +54,8 @@ export class OnChainZKPVerifier {
54
54
  * {@inheritDoc IOnChainZKPVerifier.prepareTxArgsSubmitV1}
55
55
  */
56
56
  async prepareTxArgsSubmitV1(txData, zkProofResponse) {
57
- if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV1) {
58
- throw new Error(`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV1}' is supported.`);
57
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV1) {
58
+ throw new Error(`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV1}' is supported.`);
59
59
  }
60
60
  const requestID = zkProofResponse.id;
61
61
  const inputs = zkProofResponse.pub_signals;
@@ -79,8 +79,8 @@ export class OnChainZKPVerifier {
79
79
  if (!chainConfig) {
80
80
  throw new Error(`config for chain id ${txData.chain_id} was not found`);
81
81
  }
82
- if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV1) {
83
- throw new Error(`submitZKPResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV1}' is supported.`);
82
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV1) {
83
+ throw new Error(`submitZKPResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV1}' is supported.`);
84
84
  }
85
85
  const provider = new JsonRpcProvider(chainConfig.url, chainConfig.chainId);
86
86
  ethSigner = ethSigner.connect(provider);
@@ -124,8 +124,8 @@ export class OnChainZKPVerifier {
124
124
  if (!chainConfig) {
125
125
  throw new Error(`config for chain id ${txData.chain_id} was not found`);
126
126
  }
127
- if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV2) {
128
- throw new Error(`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV2}' is supported.`);
127
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV2) {
128
+ throw new Error(`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV2}' is supported.`);
129
129
  }
130
130
  if (!this._opts?.didResolverUrl) {
131
131
  throw new Error(`did resolver url required for crosschain verification`);
@@ -161,8 +161,8 @@ export class OnChainZKPVerifier {
161
161
  return new Map().set(txnHash, zkProofResponses);
162
162
  }
163
163
  async prepareTxArgsSubmitV2(txData, zkProofResponses) {
164
- if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV2) {
165
- throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV2}' is supported.`);
164
+ if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV2) {
165
+ throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV2}' is supported.`);
166
166
  }
167
167
  if (!this._opts?.didResolverUrl) {
168
168
  throw new Error(`did resolver url required for crosschain verification`);
@@ -11,8 +11,8 @@ export declare enum FunctionSignatures {
11
11
  * function submitZKPResponse(uint64 requestId, uint256[] calldata inputs,
12
12
  * uint256[2] calldata a, uint256[2][2] calldata b, uint256[2] calldata c) public
13
13
  */
14
- SumbitZKPResponseV1 = "b68967e2",
15
- SumbitZKPResponseV2 = "ade09fcd"
14
+ SubmitZKPResponseV1 = "b68967e2",
15
+ SubmitZKPResponseV2 = "ade09fcd"
16
16
  }
17
17
  /**
18
18
  * OnChainZKPVerifierOptions represents OnChainZKPVerifier options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xpolygonid/js-sdk",
3
- "version": "1.18.0",
3
+ "version": "1.18.1",
4
4
  "description": "SDK to work with Polygon ID",
5
5
  "main": "dist/node/cjs/index.js",
6
6
  "module": "dist/node/esm/index.js",