@@ -55,7 +55,7 @@ import { expect } from 'chai';
55
55
import { CredentialStatusResolverRegistry } from '../../src/credentials' ;
56
56
import { RHSResolver } from '../../src/credentials' ;
57
57
import { ethers , JsonRpcProvider , Signer } from 'ethers' ;
58
- import { RPC_URL } from '../helpers' ;
58
+ import { RHS_URL , RPC_URL } from '../helpers' ;
59
59
60
60
describe ( 'contract-request' , ( ) => {
61
61
let idWallet : IdentityWallet ;
@@ -306,7 +306,7 @@ describe('contract-request', () => {
306
306
} ) ;
307
307
308
308
// SKIPPED : integration test
309
- it . skip ( 'contract request flow - integration test' , async ( ) => {
309
+ it . only ( 'contract request flow - integration test' , async ( ) => {
310
310
const stateEthConfig = defaultEthConnectionConfig ;
311
311
stateEthConfig . url = rpcUrl ;
312
312
stateEthConfig . contractAddress = '0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124' ;
@@ -373,12 +373,12 @@ describe('contract-request', () => {
373
373
374
374
const claimReq : CredentialRequest = {
375
375
credentialSchema :
376
- 'https://raw .githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json/KYCAgeCredential-v3 .json' ,
377
- type : 'KYCAgeCredential ' ,
376
+ 'https://gist .githubusercontent.com/ilya-korotya/e10cd79a8cc26ab6e40400a11838617e/raw/575edc33d485e2a4c806baad97e21117f3c90a9f/non-merklized-non-zero-balance .json' ,
377
+ type : 'Balance ' ,
378
378
credentialSubject : {
379
379
id : userDID . string ( ) ,
380
- birthday : 19960424 ,
381
- documentType : 99
380
+ address : '0x12323' ,
381
+ balance : '3'
382
382
} ,
383
383
expiration : 2793526400 ,
384
384
revocationOpts : {
@@ -388,26 +388,48 @@ describe('contract-request', () => {
388
388
} ;
389
389
const issuerCred = await idWallet . issueCredential ( issuerDID , claimReq ) ;
390
390
391
+
391
392
await credWallet . save ( issuerCred ) ;
392
393
394
+ const res = await idWallet . addCredentialsToMerkleTree ( [ issuerCred ] , issuerDID ) ;
395
+ await idWallet . publishStateToRHS ( issuerDID , RHS_URL ) ;
396
+
397
+ const ethSigner = new ethers . Wallet ( walletKey , dataStorage . states . getRpcProvider ( ) ) ;
398
+
399
+ const txId = await proofService . transitState (
400
+ issuerDID ,
401
+ res . oldTreeState ,
402
+ true ,
403
+ dataStorage . states ,
404
+ ethSigner
405
+ ) ;
406
+
407
+ const credsWithIden3MTPProof = await idWallet . generateIden3SparseMerkleTreeProof (
408
+ issuerDID ,
409
+ res . credentials ,
410
+ txId
411
+ ) ;
412
+
413
+ await credWallet . saveAll ( credsWithIden3MTPProof ) ;
414
+
393
415
const proofReq : ZeroKnowledgeProofRequest = {
394
- id : 200 ,
395
- circuitId : CircuitId . AtomicQuerySigV2OnChain ,
416
+ id : 2 ,
417
+ circuitId : CircuitId . AtomicQueryMTPV2OnChain ,
396
418
optional : false ,
397
419
query : {
398
420
allowedIssuers : [ '*' ] ,
399
421
type : claimReq . type ,
400
422
context :
401
- 'https://raw .githubusercontent.com/iden3/claim-schema-vocab/main/schemas/json-ld/kyc-v3.json-ld ' ,
423
+ 'https://gist .githubusercontent.com/ilya-korotya/660496c859f8d31a7d2a92ca5e970967/raw/6b5fc14fe630c17bfa52e05e08fdc8394c5ea0ce/non-merklized-non-zero-balance.jsonld ' ,
402
424
credentialSubject : {
403
- birthday : {
404
- $lt : 20020101
425
+ balance : {
426
+ $gt : 1
405
427
}
406
428
}
407
429
}
408
430
} ;
409
431
410
- const contractAddress = '0x2b23e5cF70D133fFaA7D8ba61E1bAC4637253880 ' ;
432
+ const contractAddress = '0xf702DB17F987ed751f360b3A54F5d9dEFE2B06F9 ' ;
411
433
const conf = defaultEthConnectionConfig ;
412
434
conf . contractAddress = contractAddress ;
413
435
conf . url = rpcUrl ;
@@ -437,7 +459,6 @@ describe('contract-request', () => {
437
459
body : ciRequestBody
438
460
} ;
439
461
440
- const ethSigner = new ethers . Wallet ( walletKey ) ;
441
462
442
463
const challenge = BytesHelper . bytesToInt ( hexToBytes ( ethSigner . address ) ) ;
443
464
0 commit comments