Skip to content

Commit

Permalink
fix submit typo in supported enum (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-basiuk committed Sep 19, 2024
1 parent fb82622 commit 0bed0ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/iden3comm/handlers/contract-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ export class ContractRequestHandler

const methodId = message.body.transaction_data.method_id.replace('0x', '');
switch (methodId) {
case FunctionSignatures.SumbitZKPResponseV2:
case FunctionSignatures.SubmitZKPResponseV2:
return this._zkpVerifier.submitZKPResponseV2(
ethSigner,
message.body.transaction_data,
zkpResponses
);
case FunctionSignatures.SumbitZKPResponseV1: {
case FunctionSignatures.SubmitZKPResponseV1: {
const txHashZkpResponseMap = await this._zkpVerifier.submitZKPResponse(
ethSigner,
message.body.transaction_data,
Expand All @@ -151,7 +151,7 @@ export class ContractRequestHandler
}
default:
throw new Error(
`Not supported method id. Only '${FunctionSignatures.SumbitZKPResponseV1} and ${FunctionSignatures.SumbitZKPResponseV2} are supported.'`
`Not supported method id. Only '${FunctionSignatures.SubmitZKPResponseV1} and ${FunctionSignatures.SubmitZKPResponseV2} are supported.'`
);
}
}
Expand Down Expand Up @@ -224,7 +224,7 @@ export class ContractRequestHandler
): Promise<Map<string, ZeroKnowledgeProofResponse>> {
const ciRequest = await this.parseContractInvokeRequest(request);

if (ciRequest.body.transaction_data.method_id !== FunctionSignatures.SumbitZKPResponseV1) {
if (ciRequest.body.transaction_data.method_id !== FunctionSignatures.SubmitZKPResponseV1) {
throw new Error(`please use handle method to work with other method ids`);
}

Expand Down
20 changes: 10 additions & 10 deletions src/storage/blockchain/onchain-zkp-verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export enum FunctionSignatures {
* function submitZKPResponse(uint64 requestId, uint256[] calldata inputs,
* uint256[2] calldata a, uint256[2][2] calldata b, uint256[2] calldata c) public
*/
SumbitZKPResponseV1 = 'b68967e2',
SubmitZKPResponseV1 = 'b68967e2',
//function submitZKPResponseV2(tuple[](uint64 requestId,bytes zkProof,bytes data),bytes crossChainProof)
SumbitZKPResponseV2 = 'ade09fcd'
SubmitZKPResponseV2 = 'ade09fcd'
}
/**
* OnChainZKPVerifierOptions represents OnChainZKPVerifier options
Expand Down Expand Up @@ -83,9 +83,9 @@ export class OnChainZKPVerifier implements IOnChainZKPVerifier {
txData: ContractInvokeTransactionData,
zkProofResponse: ZeroKnowledgeProofResponse
): Promise<JsonDocumentObjectValue[]> {
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV1) {
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV1) {
throw new Error(
`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV1}' is supported.`
`prepareTxArgsSubmitV1 function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV1}' is supported.`
);
}
const requestID = zkProofResponse.id;
Expand Down Expand Up @@ -117,9 +117,9 @@ export class OnChainZKPVerifier implements IOnChainZKPVerifier {
if (!chainConfig) {
throw new Error(`config for chain id ${txData.chain_id} was not found`);
}
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV1) {
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV1) {
throw new Error(
`submitZKPResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV1}' is supported.`
`submitZKPResponse function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV1}' is supported.`
);
}
const provider = new JsonRpcProvider(chainConfig.url, chainConfig.chainId);
Expand Down Expand Up @@ -174,9 +174,9 @@ export class OnChainZKPVerifier implements IOnChainZKPVerifier {
if (!chainConfig) {
throw new Error(`config for chain id ${txData.chain_id} was not found`);
}
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV2) {
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV2) {
throw new Error(
`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV2}' is supported.`
`submitZKPResponseV2 function doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV2}' is supported.`
);
}
if (!this._opts?.didResolverUrl) {
Expand Down Expand Up @@ -223,9 +223,9 @@ export class OnChainZKPVerifier implements IOnChainZKPVerifier {
txData: ContractInvokeTransactionData,
zkProofResponses: ZeroKnowledgeProofResponse[]
): Promise<JsonDocumentObjectValue[]> {
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SumbitZKPResponseV2) {
if (txData.method_id.replace('0x', '') !== FunctionSignatures.SubmitZKPResponseV2) {
throw new Error(
`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SumbitZKPResponseV2}' is supported.`
`submit cross chain doesn't implement requested method id. Only '0x${FunctionSignatures.SubmitZKPResponseV2}' is supported.`
);
}
if (!this._opts?.didResolverUrl) {
Expand Down

0 comments on commit 0bed0ba

Please sign in to comment.