@@ -99,20 +99,22 @@ export type TransactionResult =
99
99
| ActionFailure [ ]
100
100
101
101
export class AllocationManager {
102
- private dipsManager : DipsManager
102
+ private dipsManager : DipsManager | null = null
103
103
constructor (
104
104
private logger : Logger ,
105
105
private models : IndexerManagementModels ,
106
106
private graphNode : GraphNode ,
107
107
private network : Network ,
108
108
) {
109
- this . dipsManager = new DipsManager (
110
- this . logger ,
111
- this . models ,
112
- this . graphNode ,
113
- this . network ,
114
- this ,
115
- )
109
+ if ( this . network . specification . indexerOptions . dipperEndpoint ) {
110
+ this . dipsManager = new DipsManager (
111
+ this . logger ,
112
+ this . models ,
113
+ this . graphNode ,
114
+ this . network ,
115
+ this ,
116
+ )
117
+ }
116
118
}
117
119
118
120
async executeBatch ( actions : Action [ ] ) : Promise < AllocationResult [ ] > {
@@ -521,6 +523,14 @@ export class AllocationManager {
521
523
await upsertIndexingRule ( logger , this . models , indexingRule )
522
524
}
523
525
526
+ if ( this . dipsManager ) {
527
+ await this . dipsManager . tryUpdateAgreementAllocation (
528
+ deployment ,
529
+ null ,
530
+ createAllocationEventLogs . allocationID ,
531
+ )
532
+ }
533
+
524
534
return {
525
535
actionID,
526
536
type : 'allocate' ,
@@ -677,6 +687,15 @@ export class AllocationManager {
677
687
678
688
await upsertIndexingRule ( logger , this . models , neverIndexingRule )
679
689
690
+ if ( this . dipsManager ) {
691
+ await this . dipsManager . tryCancelAgreement ( allocationID )
692
+ await this . dipsManager . tryUpdateAgreementAllocation (
693
+ allocation . subgraphDeployment . id . toString ( ) ,
694
+ allocationID ,
695
+ null ,
696
+ )
697
+ }
698
+
680
699
return {
681
700
actionID,
682
701
type : 'unallocate' ,
@@ -976,6 +995,14 @@ export class AllocationManager {
976
995
await upsertIndexingRule ( logger , this . models , indexingRule )
977
996
}
978
997
998
+ if ( this . dipsManager ) {
999
+ await this . dipsManager . tryUpdateAgreementAllocation (
1000
+ subgraphDeploymentID . toString ( ) ,
1001
+ allocationID ,
1002
+ createAllocationEventLogs . allocationID ,
1003
+ )
1004
+ }
1005
+
979
1006
return {
980
1007
actionID,
981
1008
type : 'reallocate' ,
0 commit comments