@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
|
@@ -53246,9 +53246,9 @@ var FunctionSignatures;
|
|
|
53246
53246
|
* function submitZKPResponse(uint64 requestId, uint256[] calldata inputs,
|
|
53247
53247
|
* uint256[2] calldata a, uint256[2][2] calldata b, uint256[2] calldata c) public
|
|
53248
53248
|
*/
|
|
53249
|
-
FunctionSignatures["
|
|
53249
|
+
FunctionSignatures["SubmitZKPResponseV1"] = "b68967e2";
|
|
53250
53250
|
//function submitZKPResponseV2(tuple[](uint64 requestId,bytes zkProof,bytes data),bytes crossChainProof)
|
|
53251
|
-
FunctionSignatures["
|
|
53251
|
+
FunctionSignatures["SubmitZKPResponseV2"] = "ade09fcd";
|
|
53252
53252
|
})(FunctionSignatures || (FunctionSignatures = {}));
|
|
53253
53253
|
/**
|
|
53254
53254
|
* OnChainZKPVerifier is a class that allows to interact with the OnChainZKPVerifier contract
|
|
@@ -53284,8 +53284,8 @@ class OnChainZKPVerifier {
|
|
|
53284
53284
|
* {@inheritDoc IOnChainZKPVerifier.prepareTxArgsSubmitV1}
|
|
53285
53285
|
*/
|
|
53286
53286
|
async prepareTxArgsSubmitV1(txData, zkProofResponse) {
|
|
53287
|
-
if (txData.method_id.replace('0x', '') !== FunctionSignatures.
|
|
53288
|
-
throw new Error(`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${FunctionSignatures.
|
|
53287
|
+
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV1) {
|
|
53288
|
+
throw new Error(`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV1}' is supported.`);
|
|
53289
53289
|
}
|
|
53290
53290
|
const requestID = zkProofResponse.id;
|
|
53291
53291
|
const inputs = zkProofResponse.pub_signals;
|
|
@@ -53309,8 +53309,8 @@ class OnChainZKPVerifier {
|
|
|
53309
53309
|
if (!chainConfig) {
|
|
53310
53310
|
throw new Error(`config for chain id ${txData.chain_id} was not found`);
|
|
53311
53311
|
}
|
|
53312
|
-
if (txData.method_id.replace('0x', '') !== FunctionSignatures.
|
|
53313
|
-
throw new Error(`submitZKPResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.
|
|
53312
|
+
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV1) {
|
|
53313
|
+
throw new Error(`submitZKPResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV1}' is supported.`);
|
|
53314
53314
|
}
|
|
53315
53315
|
const provider = new JsonRpcProvider(chainConfig.url, chainConfig.chainId);
|
|
53316
53316
|
ethSigner = ethSigner.connect(provider);
|
|
@@ -53354,8 +53354,8 @@ class OnChainZKPVerifier {
|
|
|
53354
53354
|
if (!chainConfig) {
|
|
53355
53355
|
throw new Error(`config for chain id ${txData.chain_id} was not found`);
|
|
53356
53356
|
}
|
|
53357
|
-
if (txData.method_id.replace('0x', '') !== FunctionSignatures.
|
|
53358
|
-
throw new Error(`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${FunctionSignatures.
|
|
53357
|
+
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV2) {
|
|
53358
|
+
throw new Error(`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV2}' is supported.`);
|
|
53359
53359
|
}
|
|
53360
53360
|
if (!this._opts?.didResolverUrl) {
|
|
53361
53361
|
throw new Error(`did resolver url required for crosschain verification`);
|
|
@@ -53391,8 +53391,8 @@ class OnChainZKPVerifier {
|
|
|
53391
53391
|
return new Map().set(txnHash, zkProofResponses);
|
|
53392
53392
|
}
|
|
53393
53393
|
async prepareTxArgsSubmitV2(txData, zkProofResponses) {
|
|
53394
|
-
if (txData.method_id.replace('0x', '') !== FunctionSignatures.
|
|
53395
|
-
throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.
|
|
53394
|
+
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV2) {
|
|
53395
|
+
throw new Error(`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV2}' is supported.`);
|
|
53396
53396
|
}
|
|
53397
53397
|
if (!this._opts?.didResolverUrl) {
|
|
53398
53398
|
throw new Error(`did resolver url required for crosschain verification`);
|
|
@@ -57703,9 +57703,9 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
57703
57703
|
const zkpResponses = await processZeroKnowledgeProofRequests(did, message?.body?.scope, verifierDid, this._proofService, { ethSigner, challenge, supportedCircuits: this._supportedCircuits });
|
|
57704
57704
|
const methodId = message.body.transaction_data.method_id.replace('0x', '');
|
|
57705
57705
|
switch (methodId) {
|
|
57706
|
-
case FunctionSignatures.
|
|
57706
|
+
case FunctionSignatures.SubmitZKPResponseV2:
|
|
57707
57707
|
return this._zkpVerifier.submitZKPResponseV2(ethSigner, message.body.transaction_data, zkpResponses);
|
|
57708
|
-
case FunctionSignatures.
|
|
57708
|
+
case FunctionSignatures.SubmitZKPResponseV1: {
|
|
57709
57709
|
const txHashZkpResponseMap = await this._zkpVerifier.submitZKPResponse(ethSigner, message.body.transaction_data, zkpResponses);
|
|
57710
57710
|
const response = new Map();
|
|
57711
57711
|
for (const [txHash, zkpResponse] of txHashZkpResponseMap) {
|
|
@@ -57714,7 +57714,7 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
57714
57714
|
return response;
|
|
57715
57715
|
}
|
|
57716
57716
|
default:
|
|
57717
|
-
throw new Error(`Not supported method id. Only '${FunctionSignatures.
|
|
57717
|
+
throw new Error(`Not supported method id. Only '${FunctionSignatures.SubmitZKPResponseV1} and ${FunctionSignatures.SubmitZKPResponseV2} are supported.'`);
|
|
57718
57718
|
}
|
|
57719
57719
|
}
|
|
57720
57720
|
/**
|
|
@@ -57775,7 +57775,7 @@ class ContractRequestHandler extends AbstractMessageHandler {
|
|
|
57775
57775
|
*/
|
|
57776
57776
|
async handleContractInvokeRequest(did, request, opts) {
|
|
57777
57777
|
const ciRequest = await this.parseContractInvokeRequest(request);
|
|
57778
|
-
if (ciRequest.body.transaction_data.method_id !== FunctionSignatures.
|
|
57778
|
+
if (ciRequest.body.transaction_data.method_id !== FunctionSignatures.SubmitZKPResponseV1) {
|
|
57779
57779
|
throw new Error(`please use handle method to work with other method ids`);
|
|
57780
57780
|
}
|
|
57781
57781
|
if (ciRequest.type !== PROTOCOL_MESSAGE_TYPE.CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE) {
|