@@ -321,6 +321,102 @@ describe('contract-request', () => {
321
321
expect ( ( ciResponse as Map < string , ZeroKnowledgeProofResponse > ) . has ( 'txhash1' ) ) . to . be . true ;
322
322
} ) ;
323
323
324
+ it ( '$noop operator not supported for OnChain V2' , async ( ) => {
325
+ const { did : userDID , credential : cred } = await idWallet . createIdentity ( {
326
+ method : DidMethod . Iden3 ,
327
+ blockchain : Blockchain . Polygon ,
328
+ networkId : NetworkId . Amoy ,
329
+ seed : seedPhrase ,
330
+ revocationOpts : {
331
+ type : CredentialStatusType . Iden3ReverseSparseMerkleTreeProof ,
332
+ id : rhsUrl
333
+ }
334
+ } ) ;
335
+
336
+ expect ( cred ) . not . to . be . undefined ;
337
+
338
+ const { did : issuerDID , credential : issuerAuthCredential } = await idWallet . createIdentity ( {
339
+ method : DidMethod . Iden3 ,
340
+ blockchain : Blockchain . Polygon ,
341
+ networkId : NetworkId . Amoy ,
342
+ seed : seedPhraseIssuer ,
343
+ revocationOpts : {
344
+ type : CredentialStatusType . Iden3ReverseSparseMerkleTreeProof ,
345
+ id : rhsUrl
346
+ }
347
+ } ) ;
348
+ expect ( issuerAuthCredential ) . not . to . be . undefined ;
349
+
350
+ const claimReq : CredentialRequest = {
351
+ credentialSchema :
352
+ 'https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3.json' ,
353
+ type : 'KYCAgeCredential' ,
354
+ credentialSubject : {
355
+ id : userDID . string ( ) ,
356
+ birthday : 19960424 ,
357
+ documentType : 99
358
+ } ,
359
+ expiration : 2793526400 ,
360
+ revocationOpts : {
361
+ type : CredentialStatusType . Iden3ReverseSparseMerkleTreeProof ,
362
+ id : rhsUrl
363
+ }
364
+ } ;
365
+ const issuerCred = await idWallet . issueCredential ( issuerDID , claimReq ) ;
366
+
367
+ await credWallet . save ( issuerCred ) ;
368
+
369
+ const proofReq : ZeroKnowledgeProofRequest = {
370
+ id : 1 ,
371
+ circuitId : CircuitId . AtomicQueryMTPV2OnChain ,
372
+ optional : false ,
373
+ query : {
374
+ allowedIssuers : [ '*' ] ,
375
+ type : claimReq . type ,
376
+ context :
377
+ 'https://raw.githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld'
378
+ }
379
+ } ;
380
+
381
+ const transactionData : ContractInvokeTransactionData = {
382
+ contract_address : '0x134b1be34911e39a8397ec6289782989729807a4' ,
383
+ method_id : 'b68967e2' ,
384
+ chain_id : 80001
385
+ } ;
386
+
387
+ const ciRequestBody : ContractInvokeRequestBody = {
388
+ reason : 'reason' ,
389
+ transaction_data : transactionData ,
390
+ scope : [ proofReq as ZeroKnowledgeProofRequest ]
391
+ } ;
392
+
393
+ const id = uuid . v4 ( ) ;
394
+ const ciRequest : ContractInvokeRequest = {
395
+ id,
396
+ typ : MediaType . PlainMessage ,
397
+ type : PROTOCOL_MESSAGE_TYPE . CONTRACT_INVOKE_REQUEST_MESSAGE_TYPE ,
398
+ thid : id ,
399
+ body : ciRequestBody
400
+ } ;
401
+
402
+ const ethSigner = new ethers . Wallet ( walletKey ) ;
403
+
404
+ const options : ContractInvokeHandlerOptions = {
405
+ ethSigner,
406
+ challenge : BigInt ( 112312 )
407
+ } ;
408
+ const msgBytes = byteEncoder . encode ( JSON . stringify ( ciRequest ) ) ;
409
+
410
+ try {
411
+ await contractRequestHandler . handleContractInvokeRequest ( userDID , msgBytes , options ) ;
412
+ expect . fail ( ) ;
413
+ } catch ( err : unknown ) {
414
+ expect ( ( err as Error ) . message ) . to . be . eq (
415
+ `operator $noop is not supported by credentialAtomicQueryMTPV2OnChain`
416
+ ) ;
417
+ }
418
+ } ) ;
419
+
324
420
// SKIPPED : integration test
325
421
it . skip ( 'contract request flow - integration test' , async ( ) => {
326
422
const stateEthConfig = defaultEthConnectionConfig ;
0 commit comments