@@ -15,6 +15,7 @@ import {
15
15
createIndexerManagementClient ,
16
16
Operator ,
17
17
ActionManager ,
18
+ IndexerManagementClient ,
18
19
} from '@graphprotocol/indexer-common'
19
20
import {
20
21
connectDatabase ,
@@ -23,6 +24,7 @@ import {
23
24
Logger ,
24
25
Metrics ,
25
26
parseGRT ,
27
+ SubgraphDeploymentID ,
26
28
toAddress ,
27
29
} from '@graphprotocol/common-ts'
28
30
import { Sequelize } from 'sequelize'
@@ -46,6 +48,8 @@ let managementModels: IndexerManagementModels
46
48
let queryFeeModels : QueryFeeModels
47
49
let network : Network
48
50
let dipsCollector : DipsCollector
51
+ let indexerManagementClient : IndexerManagementClient
52
+ let operator : Operator
49
53
const networkSpecWithDips = {
50
54
...testNetworkSpecification ,
51
55
indexerOptions : {
@@ -59,13 +63,13 @@ const networkSpecWithDips = {
59
63
60
64
const mockSubgraphDeployment = ( id : string ) => {
61
65
return {
62
- id : id ,
66
+ id : new SubgraphDeploymentID ( id ) ,
63
67
ipfsHash : id ,
64
68
deniedAt : null ,
65
69
stakedTokens : BigNumber . from ( '1000' ) ,
66
70
signalledTokens : BigNumber . from ( '1000' ) ,
67
71
queryFeesAmount : BigNumber . from ( '0' ) ,
68
- protocolNetwork : 'eip155:42161 ' ,
72
+ protocolNetwork : 'eip155:421614 ' ,
69
73
}
70
74
}
71
75
@@ -105,10 +109,7 @@ const setup = async () => {
105
109
metrics ,
106
110
)
107
111
dipsCollector = network . dipsCollector !
108
- }
109
-
110
- const ensureGlobalIndexingRule = async ( ) => {
111
- const indexerManagementClient = await createIndexerManagementClient ( {
112
+ indexerManagementClient = await createIndexerManagementClient ( {
112
113
models : managementModels ,
113
114
graphNode,
114
115
logger,
@@ -121,7 +122,10 @@ const ensureGlobalIndexingRule = async () => {
121
122
network,
122
123
} )
123
124
124
- const operator = new Operator ( logger , indexerManagementClient , networkSpecWithDips )
125
+ operator = new Operator ( logger , indexerManagementClient , networkSpecWithDips )
126
+ }
127
+
128
+ const ensureGlobalIndexingRule = async ( ) => {
125
129
await operator . ensureGlobalIndexingRule ( )
126
130
logger . debug ( 'Ensured global indexing rule' )
127
131
}
@@ -225,7 +229,7 @@ describe('DipsManager', () => {
225
229
payer : '123456df40c29949a75a6693c77834c00b8a5678' ,
226
230
signature : Buffer . from ( '1234' , 'hex' ) ,
227
231
signed_payload : Buffer . from ( '5678' , 'hex' ) ,
228
- protocol_network : 'arbitrum-one ' ,
232
+ protocol_network : 'arbitrum-sepolia ' ,
229
233
chain_id : 'eip155:1' ,
230
234
base_price_per_epoch : '100' ,
231
235
price_per_entity : '1' ,
@@ -333,6 +337,7 @@ describe('DipsManager', () => {
333
337
protocolNetwork : 'eip155:421614' ,
334
338
allocationAmount : '1030' ,
335
339
} )
340
+
336
341
// Mock fetch the subgraph deployment from the network subgraph
337
342
network . networkMonitor . subgraphDeployment = jest
338
343
. fn ( )
@@ -445,7 +450,7 @@ describe('DipsCollector', () => {
445
450
payer : '123456df40c29949a75a6693c77834c00b8a5678' ,
446
451
signature : Buffer . from ( '1234' , 'hex' ) ,
447
452
signed_payload : Buffer . from ( '5678' , 'hex' ) ,
448
- protocol_network : 'arbitrum-one ' ,
453
+ protocol_network : 'arbitrum-sepolia ' ,
449
454
chain_id : 'eip155:1' ,
450
455
base_price_per_epoch : '100' ,
451
456
price_per_entity : '1' ,
@@ -476,17 +481,19 @@ describe('DipsCollector', () => {
476
481
status : CollectPaymentStatus . ACCEPT ,
477
482
tapReceipt : Buffer . from ( '1234' , 'hex' ) ,
478
483
} )
479
- jest . spyOn ( GatewayDipsServiceMessages , 'decodeTapReceipt' ) . mockImplementation ( ( ) => {
480
- logger . info ( 'MOCK Decoding TAP receipt' )
481
- return {
482
- allocation_id : toAddress ( testAllocationId ) ,
483
- signer_address : toAddress ( '0xabcd56df41234949a75a6693c77834c00b8abbbb' ) ,
484
- signature : Buffer . from ( '1234' , 'hex' ) ,
485
- timestamp_ns : 1234567890 ,
486
- nonce : 1 ,
487
- value : '1000' ,
488
- }
489
- } )
484
+ jest
485
+ . spyOn ( GatewayDipsServiceMessages , 'decodeTapReceipt' )
486
+ . mockImplementation ( ( ) => {
487
+ logger . info ( 'MOCK Decoding TAP receipt' )
488
+ return {
489
+ allocation_id : toAddress ( testAllocationId ) ,
490
+ signer_address : toAddress ( '0xabcd56df41234949a75a6693c77834c00b8abbbb' ) ,
491
+ signature : Buffer . from ( '1234' , 'hex' ) ,
492
+ timestamp_ns : 1234567890 ,
493
+ nonce : 1 ,
494
+ value : '1000' ,
495
+ }
496
+ } )
490
497
; ( getEscrowSenderForSigner as jest . Mock ) . mockImplementation ( ( ) => {
491
498
return toAddress ( '0x123456df40c29949a75a6693c77834c00b8a5678' )
492
499
} )
0 commit comments