Skip to content

Commit

Permalink
common: use tapSubgraph config to control TAP feature
Browse files Browse the repository at this point in the history
If a user doesnt set up the tapSubgraph config, features related to TAP will be disabled.
Such as connect to TAP contract or RAV processing.
  • Loading branch information
carlosvdr committed Jul 15, 2024
1 parent 5c684cb commit 8cbafdb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/indexer-common/src/allocations/query-fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class AllocationReceiptCollector implements ReceiptCollector {
declare models: QueryFeeModels
declare transactionManager: TransactionManager
declare allocationExchange: Contract
declare tapContracts?: TapContracts
declare tapContracts: TapContracts | undefined
declare allocations: Eventual<Allocation[]>
declare collectEndpoint: URL
declare partialVoucherEndpoint: URL
Expand Down
29 changes: 15 additions & 14 deletions packages/indexer-common/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ export class Network {
deployment:
networkSubgraphDeploymentId !== undefined
? {
graphNode,
deployment: networkSubgraphDeploymentId,
}
graphNode,
deployment: networkSubgraphDeploymentId,
}
: undefined,
subgraphFreshnessChecker: networkSubgraphFreshnessChecker,
})
Expand Down Expand Up @@ -238,18 +238,19 @@ export class Network {
// * Escrow contract
// --------------------------------------------------------------------------------
const networkIdentifier = await networkProvider.getNetwork()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let tapContracts: any
try {
tapContracts = await connectTapContracts(
wallet,
networkIdentifier.chainId,
specification.tapAddressBook,
)
} catch (err) {
logger.error(`Failed to connect to tap contract bindings:`, { err })
let tapContracts: TapContracts | undefined = undefined
if (tapSubgraph) {
try {
tapContracts = await connectTapContracts(
wallet,
networkIdentifier.chainId,
specification.tapAddressBook,
)
} catch (err) {
logger.error(`Failed to connect to tap contract bindings:`, { err })
throw err
}
}

// --------------------------------------------------------------------------------
// * Allocation and allocation signers
// --------------------------------------------------------------------------------
Expand Down

0 comments on commit 8cbafdb

Please sign in to comment.