Skip to content

Commit

Permalink
Feature/df 18875 cryptocompare inverse eth usd (#3049)
Browse files Browse the repository at this point in the history
* CryptoCompare inverse behaviour

* changeset

* e2e test modified

* test renamed

* undo test changes

* undo test changes
  • Loading branch information
Subarna-Singh authored Oct 26, 2023
1 parent e837f7c commit a4a0362
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/nasty-students-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/cryptocompare-adapter': minor
---

inverse behaviour to support BTC/ETH pair
13 changes: 13 additions & 0 deletions packages/sources/cryptocompare/src/config/includes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"from": "BTC",
"to": "ETH",
"includes": [
{
"from": "ETH",
"to": "BTC",
"inverse": true
}
]
}
]
6 changes: 6 additions & 0 deletions packages/sources/cryptocompare/src/endpoint/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export const endpoint = new CryptoPriceEndpoint({
customRouter: (_req, adapterConfig) => {
return adapterConfig.WS_ENABLED ? 'ws' : 'rest'
},
requestTransforms: [
(req) => {
req.requestContext.data.base = req.requestContext.data.base.toUpperCase()
req.requestContext.data.quote = req.requestContext.data.quote?.toUpperCase()
},
],
inputParameters: cryptoInputParams,
overrides: overrides.cryptocompare,
})
2 changes: 2 additions & 0 deletions packages/sources/cryptocompare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { expose, ServerInstance } from '@chainlink/external-adapter-framework'
import { PriceAdapter } from '@chainlink/external-adapter-framework/adapter'
import { crypto, vwap, volume, marketcap } from './endpoint'
import { config } from './config'
import includes from './config/includes.json'

export const adapter = new PriceAdapter({
name: 'CRYPTOCOMPARE',
defaultEndpoint: 'crypto',
config,
endpoints: [crypto, vwap, volume, marketcap],
includes,
rateLimiting: {
tiers: {
free: {
Expand Down

0 comments on commit a4a0362

Please sign in to comment.