Skip to content

Commit

Permalink
Allow custom endpoint for indexer (#3631)
Browse files Browse the repository at this point in the history
Co-authored-by: app-token-issuer-data-feeds[bot] <134377064+app-token-issuer-data-feeds[bot]@users.noreply.github.com>
  • Loading branch information
1 parent a7af3ec commit 7338a47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-insects-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/proof-of-reserves-adapter': patch
---

Allow custom endpoint for indexer
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type TInputParameters = {
protocol: string
protocolEndpoint?: string
indexer: string
indexerEndpoint?: string
confirmations?: number
addresses?: string[]
disableAddressValidation?: boolean
Expand Down Expand Up @@ -57,6 +58,10 @@ const inputParameters: InputParameters<TInputParameters> = {
...indexerAdaptersV3.map(({ name }) => name.toUpperCase()),
],
},
indexerEndpoint: {
type: 'string',
description: 'Optional endpoint for the indexer external adapter to use',
},
confirmations: {
required: false,
type: 'number',
Expand Down Expand Up @@ -109,6 +114,7 @@ export const execute: ExecuteWithConfig<Config> = async (input, context, config)
confirmations,
config,
validatedAddresses,
validator.validated.data.indexerEndpoint,
)
const reduceOutput = await runReduceAdapter(indexer, context, balanceOutput)
return reduceOutput
Expand Down
6 changes: 6 additions & 0 deletions packages/composites/proof-of-reserves/src/utils/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const runBalanceAdapter = async (
confirmations: number,
config: Config,
input: AdapterResponse,
indexerEndpoint?: string,
): Promise<AdapterResponse> => {
const execute = makeRequestFactory(config, indexer)
let next
Expand Down Expand Up @@ -117,6 +118,11 @@ export const runBalanceAdapter = async (
},
}
}

if (indexerEndpoint) {
;(next.data as any).endpoint = indexerEndpoint
}

return callAdapter(execute, context, next, '_onBalance')
}

Expand Down

0 comments on commit 7338a47

Please sign in to comment.