Skip to content

Commit

Permalink
Allow override on cfbenchmarks2 (#3528)
Browse files Browse the repository at this point in the history
* Allow cfb2 override

* Update comments
  • Loading branch information
mxiao-cll authored Nov 4, 2024
1 parent 4a3e99f commit 75cc798
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/four-rocks-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/cfbenchmarks-adapter': minor
---

Seperate cfb with cfb2
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,6 @@ export const SoakTestBlacklist: string[] = [
'blockchain.com', // Does not support . in the name
'cache.gold',
'ion.au',
'galaxy', // Not deployed internally
'stader-balance', // Not deployed internally
]
5 changes: 5 additions & 0 deletions packages/sources/cfbenchmarks/src/endpoint/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export const inputParameters = new InputParameters(
description: 'The symbol of the currency to convert to',
required: false,
},
adapterNameOverride: {
type: 'string',
description: 'Used internally for override and metrics, do not set this field',
required: false,
},
},
[
{
Expand Down
5 changes: 5 additions & 0 deletions packages/sources/cfbenchmarks/src/endpoint/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ const overridenBaseQuoteFromId: BaseQuoteToIdLookup = {

export function customInputValidation(
req: AdapterRequest<typeof inputParameters.validated>,
adapterSettings: BaseEndpointTypes['Settings'],
): AdapterError | undefined {
if (adapterSettings.API_SECONDARY) {
req.requestContext.data.adapterNameOverride = 'cfbenchmarks2'
}

const { base, quote, index } = req.requestContext.data
// Base and quote must be provided OR index must be provided
if (!(index || (base && quote))) {
Expand Down
7 changes: 6 additions & 1 deletion packages/sources/cfbenchmarks/src/transport/crypto-ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ export const makeWsTransport = (
const value = Number(message.value)
return [
{
params: { index, base: undefined, quote: undefined },
params: {
index,
base: undefined,
quote: undefined,
...(type != 'primary' && { adapterNameOverride: 'cfbenchmarks2' }),
},
response: {
result: value,
data: {
Expand Down

0 comments on commit 75cc798

Please sign in to comment.