diff --git a/.changeset/fifty-insects-try.md b/.changeset/fifty-insects-try.md new file mode 100644 index 0000000000..811702388b --- /dev/null +++ b/.changeset/fifty-insects-try.md @@ -0,0 +1,5 @@ +--- +'@chainlink/proof-of-reserves-adapter': patch +--- + +Allow custom endpoint for indexer diff --git a/packages/composites/proof-of-reserves/src/endpoint/reserves.ts b/packages/composites/proof-of-reserves/src/endpoint/reserves.ts index ad7bded361..7e1a005b59 100644 --- a/packages/composites/proof-of-reserves/src/endpoint/reserves.ts +++ b/packages/composites/proof-of-reserves/src/endpoint/reserves.ts @@ -20,6 +20,7 @@ export type TInputParameters = { protocol: string protocolEndpoint?: string indexer: string + indexerEndpoint?: string confirmations?: number addresses?: string[] disableAddressValidation?: boolean @@ -57,6 +58,10 @@ const inputParameters: InputParameters = { ...indexerAdaptersV3.map(({ name }) => name.toUpperCase()), ], }, + indexerEndpoint: { + type: 'string', + description: 'Optional endpoint for the indexer external adapter to use', + }, confirmations: { required: false, type: 'number', @@ -109,6 +114,7 @@ export const execute: ExecuteWithConfig = async (input, context, config) confirmations, config, validatedAddresses, + validator.validated.data.indexerEndpoint, ) const reduceOutput = await runReduceAdapter(indexer, context, balanceOutput) return reduceOutput diff --git a/packages/composites/proof-of-reserves/src/utils/balance.ts b/packages/composites/proof-of-reserves/src/utils/balance.ts index a4a2665b62..4c497eca8e 100644 --- a/packages/composites/proof-of-reserves/src/utils/balance.ts +++ b/packages/composites/proof-of-reserves/src/utils/balance.ts @@ -58,6 +58,7 @@ export const runBalanceAdapter = async ( confirmations: number, config: Config, input: AdapterResponse, + indexerEndpoint?: string, ): Promise => { const execute = makeRequestFactory(config, indexer) let next @@ -117,6 +118,11 @@ export const runBalanceAdapter = async ( }, } } + + if (indexerEndpoint) { + ;(next.data as any).endpoint = indexerEndpoint + } + return callAdapter(execute, context, next, '_onBalance') }