@@ -17,7 +17,7 @@ import { InMemoryPrivateKeyStore } from '../../src/kms/store';
17
17
import { IDataStorage , IStateStorage , IOnChainZKPVerifier } from '../../src/storage/interfaces' ;
18
18
import { InMemoryDataSource , InMemoryMerkleTreeStorage } from '../../src/storage/memory' ;
19
19
import { CredentialRequest , CredentialWallet } from '../../src/credentials' ;
20
- import { ProofService } from '../../src/proof' ;
20
+ import { IProofService , ProofService } from '../../src/proof' ;
21
21
import { CircuitId } from '../../src/circuits' ;
22
22
import { CredentialStatusType , VerifiableConstants , W3CCredential } from '../../src/verifiable' ;
23
23
import { RootInfo , StateProof } from '../../src/storage/entities/state' ;
@@ -50,14 +50,15 @@ import { expect } from 'chai';
50
50
import { CredentialStatusResolverRegistry } from '../../src/credentials' ;
51
51
import { RHSResolver } from '../../src/credentials' ;
52
52
import { ethers , Signer } from 'ethers' ;
53
+ import { RHS_URL , WALLET_KEY } from '../helpers' ;
53
54
54
55
describe ( 'contract-request' , ( ) => {
55
56
let idWallet : IdentityWallet ;
56
57
let credWallet : CredentialWallet ;
57
58
58
59
let dataStorage : IDataStorage ;
59
- let proofService : ProofService ;
60
- let contractRequest : IContractRequestHandler ;
60
+ let proofService : IProofService ;
61
+ let contractRequestHandler : IContractRequestHandler ;
61
62
let packageMgr : IPackageManager ;
62
63
const rhsUrl = process . env . RHS_URL as string ;
63
64
const rpcUrl = process . env . RPC_URL as string ;
@@ -191,7 +192,7 @@ describe('contract-request', () => {
191
192
proofService . generateAuthV2Inputs . bind ( proofService ) ,
192
193
proofService . verifyState . bind ( proofService )
193
194
) ;
194
- contractRequest = new ContractRequestHandler ( packageMgr , proofService , mockZKPVerifier ) ;
195
+ contractRequestHandler = new ContractRequestHandler ( packageMgr , proofService , mockZKPVerifier ) ;
195
196
} ) ;
196
197
197
198
it ( 'contract request flow' , async ( ) => {
@@ -284,7 +285,7 @@ describe('contract-request', () => {
284
285
challenge : BigInt ( 112312 )
285
286
} ;
286
287
const msgBytes = byteEncoder . encode ( JSON . stringify ( ciRequest ) ) ;
287
- const ciResponse = await contractRequest . handleContractInvokeRequest (
288
+ const ciResponse = await contractRequestHandler . handleContractInvokeRequest (
288
289
userDID ,
289
290
msgBytes ,
290
291
options
@@ -332,7 +333,6 @@ describe('contract-request', () => {
332
333
proofService . generateAuthV2Inputs . bind ( proofService ) ,
333
334
proofService . verifyState . bind ( proofService )
334
335
) ;
335
- contractRequest = new ContractRequestHandler ( packageMgr , proofService , mockZKPVerifier ) ;
336
336
337
337
const { did : userDID , credential : cred } = await idWallet . createIdentity ( {
338
338
method : DidMethod . Iden3 ,
@@ -402,7 +402,7 @@ describe('contract-request', () => {
402
402
conf . chainId = 80001 ;
403
403
404
404
const zkpVerifier = new OnChainZKPVerifier ( [ conf ] ) ;
405
- contractRequest = new ContractRequestHandler ( packageMgr , proofService , zkpVerifier ) ;
405
+ contractRequestHandler = new ContractRequestHandler ( packageMgr , proofService , zkpVerifier ) ;
406
406
407
407
const transactionData : ContractInvokeTransactionData = {
408
408
contract_address : contractAddress ,
@@ -434,7 +434,7 @@ describe('contract-request', () => {
434
434
challenge
435
435
} ;
436
436
const msgBytes = byteEncoder . encode ( JSON . stringify ( ciRequest ) ) ;
437
- const ciResponse = await contractRequest . handleContractInvokeRequest (
437
+ const ciResponse = await contractRequestHandler . handleContractInvokeRequest (
438
438
userDID ,
439
439
msgBytes ,
440
440
options
@@ -484,7 +484,6 @@ describe('contract-request', () => {
484
484
proofService . generateAuthV2Inputs . bind ( proofService ) ,
485
485
proofService . verifyState . bind ( proofService )
486
486
) ;
487
- contractRequest = new ContractRequestHandler ( packageMgr , proofService , mockZKPVerifier ) ;
488
487
489
488
const { did : userDID , credential : cred } = await idWallet . createIdentity ( {
490
489
method : DidMethod . Iden3 ,
@@ -531,7 +530,7 @@ describe('contract-request', () => {
531
530
await credWallet . save ( issuerCred ) ;
532
531
533
532
const proofReq : ZeroKnowledgeProofRequest = {
534
- id : 1 ,
533
+ id : 200 ,
535
534
circuitId : CircuitId . AtomicQueryV3OnChain ,
536
535
optional : false ,
537
536
query : {
@@ -547,14 +546,14 @@ describe('contract-request', () => {
547
546
}
548
547
} ;
549
548
550
- const contractAddress = '0x6Ee102705DD27c1025fc03E5Db375BAe1c237432 ' ;
549
+ const contractAddress = '0xD0Fd3E9fDF448e5B86Cc0f73E5Ee7D2F284884c0 ' ;
551
550
const conf = defaultEthConnectionConfig ;
552
551
conf . contractAddress = contractAddress ;
553
552
conf . url = rpcUrl ;
554
553
conf . chainId = 80001 ;
555
554
556
555
const zkpVerifier = new OnChainZKPVerifier ( [ conf ] ) ;
557
- contractRequest = new ContractRequestHandler ( packageMgr , proofService , zkpVerifier ) ;
556
+ contractRequestHandler = new ContractRequestHandler ( packageMgr , proofService , zkpVerifier ) ;
558
557
559
558
const transactionData : ContractInvokeTransactionData = {
560
559
contract_address : contractAddress ,
@@ -586,7 +585,7 @@ describe('contract-request', () => {
586
585
challenge
587
586
} ;
588
587
const msgBytes = byteEncoder . encode ( JSON . stringify ( ciRequest ) ) ;
589
- const ciResponse = await contractRequest . handleContractInvokeRequest (
588
+ const ciResponse = await contractRequestHandler . handleContractInvokeRequest (
590
589
userDID ,
591
590
msgBytes ,
592
591
options
0 commit comments