Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom endpoint for indexer #3631

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading