@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.
- package/dist/browser/esm/index.js +14 -14
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +14 -14
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/iden3comm/handlers/contract-request.js +4 -4
- package/dist/node/cjs/storage/blockchain/onchain-zkp-verifier.js +10 -10
- package/dist/node/esm/iden3comm/handlers/contract-request.js +4 -4
- package/dist/node/esm/storage/blockchain/onchain-zkp-verifier.js +10 -10
- package/dist/types/storage/blockchain/onchain-zkp-verifier.d.ts +2 -2
- package/package.json +1 -1
|
@@ -53385,9 +53385,9 @@ var PolygonIdSdk = (function (exports) {
|
|
|
53385
53385
|
* function submitZKPResponse(uint64 requestId, uint256[] calldata inputs,
|
|
53386
53386
|
* uint256[2] calldata a, uint256[2][2] calldata b, uint256[2] calldata c) public
|
|
53387
53387
|
*/
|
|
53388
|
-
FunctionSignatures["
|
|
53388
|
+
FunctionSignatures["SubmitZKPResponseV1"] = "b68967e2";
|
|
53389
53389
|
//function submitZKPResponseV2(tuple[](uint64 requestId,bytes zkProof,bytes data),bytes crossChainProof)
|
|
53390
|
-
FunctionSignatures["
|
|
53390
|
+
FunctionSignatures["SubmitZKPResponseV2"] = "ade09fcd";
|
|
53391
53391
|
})(exports.FunctionSignatures || (exports.FunctionSignatures = {}));
|
|
53392
53392
|
/**
|
|
53393
53393
|
* OnChainZKPVerifier is a class that allows to interact with the OnChainZKPVerifier contract
|
|
@@ -53423,8 +53423,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
53423
53423
|
* {@inheritDoc IOnChainZKPVerifier.prepareTxArgsSubmitV1}
|
|
53424
53424
|
*/
|
|
53425
53425
|
async prepareTxArgsSubmitV1(txData, zkProofResponse) {
|
|
53426
|
-
if (txData.method_id.replace('0x', '') !== exports.FunctionSignatures.
|
|
53427
|
-
throw new Error(`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${exports.FunctionSignatures.
|
|
53426
|
+
if (txData.method_id.replace('0x', '') !== exports.FunctionSignatures.SubmitZKPResponseV1) {
|
|
53427
|
+
throw new Error(`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${exports.FunctionSignatures.SubmitZKPResponseV1}' is supported.`);
|
|
53428
53428
|
}
|
|
53429
53429
|
const requestID = zkProofResponse.id;
|
|
53430
53430
|
const inputs = zkProofResponse.pub_signals;
|
|
@@ -53448,8 +53448,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
53448
53448
|
if (!chainConfig) {
|
|
53449
53449
|
throw new Error(`config for chain id ${txData.chain_id} was not found`);
|
|
53450
53450
|
}
|
|
53451
|
-
if (txData.method_id.replace('0x', '') !== exports.FunctionSignatures.
|
|
53452
|
-
throw new Error(`submitZKPResponse function doesn't implement requested method id. Only '0x${exports.FunctionSignatures.
|
|
53451
|
+
if (txData.method_id.replace('0x', '') !== exports.FunctionSignatures.SubmitZKPResponseV1) {
|
|
53452
|
+
throw new Error(`submitZKPResponse function doesn't implement requested method id. Only '0x${exports.FunctionSignatures.SubmitZKPResponseV1}' is supported.`);
|
|
53453
53453
|
}
|
|
53454
53454
|
const provider = new JsonRpcProvider(chainConfig.url, chainConfig.chainId);
|
|
53455
53455
|
ethSigner = ethSigner.connect(provider);
|
|
@@ -53493,8 +53493,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
53493
53493
|
if (!chainConfig) {
|
|
53494
53494
|
throw new Error(`config for chain id ${txData.chain_id} was not found`);
|
|
53495
53495
|
}
|
|
53496
|
-
if (txData.method_id.replace('0x', '') !== exports.FunctionSignatures.
|
|
53497
|
-
throw new Error(`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${exports.FunctionSignatures.
|
|
53496
|
+
if (txData.method_id.replace('0x', '') !== exports.FunctionSignatures.SubmitZKPResponseV2) {
|
|
53497
|
+
throw new Error(`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${exports.FunctionSignatures.SubmitZKPResponseV2}' is supported.`);
|
|
53498
53498
|
}
|
|
53499
53499
|
if (!this._opts?.didResolverUrl) {
|
|
53500
53500
|
throw new Error(`did resolver url required for crosschain verification`);
|
|
@@ -53530,8 +53530,8 @@ var PolygonIdSdk = (function (exports) {
|
|
|
53530
53530
|
return new Map().set(txnHash, zkProofResponses);
|
|
53531
53531
|
}
|
|
53532
53532
|
async prepareTxArgsSubmitV2(txData, zkProofResponses) {
|
|
53533
|
-
if (txData.method_id.replace('0x', '') !== exports.FunctionSignatures.
|
|
53534
|
-
throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${exports.FunctionSignatures.
|
|
53533
|
+
if (txData.method_id.replace('0x', '') !== exports.FunctionSignatures.SubmitZKPResponseV2) {
|
|
53534
|
+
throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${exports.FunctionSignatures.SubmitZKPResponseV2}' is supported.`);
|
|
53535
53535
|
}
|
|
53536
53536
|
if (!this._opts?.didResolverUrl) {
|
|
53537
53537
|
throw new Error(`did resolver url required for crosschain verification`);
|
|
@@ -78585,9 +78585,9 @@ var PolygonIdSdk = (function (exports) {
|
|
|
78585
78585
|
const zkpResponses = await processZeroKnowledgeProofRequests(did, message?.body?.scope, verifierDid, this._proofService, { ethSigner, challenge, supportedCircuits: this._supportedCircuits });
|
|
78586
78586
|
const methodId = message.body.transaction_data.method_id.replace('0x', '');
|
|
78587
78587
|
switch (methodId) {
|
|
78588
|
-
case exports.FunctionSignatures.
|
|
78588
|
+
case exports.FunctionSignatures.SubmitZKPResponseV2:
|
|
78589
78589
|
return this._zkpVerifier.submitZKPResponseV2(ethSigner, message.body.transaction_data, zkpResponses);
|
|
78590
|
-
case exports.FunctionSignatures.
|
|
78590
|
+
case exports.FunctionSignatures.SubmitZKPResponseV1: {
|
|
78591
78591
|
const txHashZkpResponseMap = await this._zkpVerifier.submitZKPResponse(ethSigner, message.body.transaction_data, zkpResponses);
|
|
78592
78592
|
const response = new Map();
|
|
78593
78593
|
for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
|
|
@@ -78596,7 +78596,7 @@ var PolygonIdSdk = (function (exports) {
|
|
|
78596
78596
|
return response;
|
|
78597
78597
|
}
|
|
78598
78598
|
default:
|
|
78599
|
-
throw new Error(`Not supported method id. Only '${exports.FunctionSignatures.
|
|
78599
|
+
throw new Error(`Not supported method id. Only '${exports.FunctionSignatures.SubmitZKPResponseV1} and ${exports.FunctionSignatures.SubmitZKPResponseV2} are supported.'`);
|
|
78600
78600
|
}
|
|
78601
78601
|
}
|
|
78602
78602
|
/**
|
|
@@ -78657,7 +78657,7 @@ var PolygonIdSdk = (function (exports) {
|
|
|
78657
78657
|
*/
|
|
78658
78658
|
async handleContractInvokeRequest(did, request, opts) {
|
|
78659
78659
|
const ciRequest = await this.parseContractInvokeRequest(request);
|
|
78660
|
-
if (ciRequest.body.transaction_data.method_id !== exports.FunctionSignatures.
|
|
78660
|
+
if (ciRequest.body.transaction_data.method_id !== exports.FunctionSignatures.SubmitZKPResponseV1) {
|
|
78661
78661
|
throw new Error(`please use handle method to work with other method ids`);
|
|
78662
78662
|
}
|
|
78663
78663
|
if (ciRequest.type !== PROTOCOL_MESSAGE_TYPE.CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE) {
|