Skip to content

Commit a4a0362

Browse files
Feature/df 18875 cryptocompare inverse eth usd (#3049)
* CryptoCompare inverse behaviour * changeset * e2e test modified * test renamed * undo test changes * undo test changes
1 parent e837f7c commit a4a0362

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

.changeset/nasty-students-perform.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/cryptocompare-adapter': minor
3+
---
4+
5+
inverse behaviour to support BTC/ETH pair
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"from": "BTC",
4+
"to": "ETH",
5+
"includes": [
6+
{
7+
"from": "ETH",
8+
"to": "BTC",
9+
"inverse": true
10+
}
11+
]
12+
}
13+
]

packages/sources/cryptocompare/src/endpoint/crypto.ts

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ export const endpoint = new CryptoPriceEndpoint({
1414
customRouter: (_req, adapterConfig) => {
1515
return adapterConfig.WS_ENABLED ? 'ws' : 'rest'
1616
},
17+
requestTransforms: [
18+
(req) => {
19+
req.requestContext.data.base = req.requestContext.data.base.toUpperCase()
20+
req.requestContext.data.quote = req.requestContext.data.quote?.toUpperCase()
21+
},
22+
],
1723
inputParameters: cryptoInputParams,
1824
overrides: overrides.cryptocompare,
1925
})

packages/sources/cryptocompare/src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { expose, ServerInstance } from '@chainlink/external-adapter-framework'
22
import { PriceAdapter } from '@chainlink/external-adapter-framework/adapter'
33
import { crypto, vwap, volume, marketcap } from './endpoint'
44
import { config } from './config'
5+
import includes from './config/includes.json'
56

67
export const adapter = new PriceAdapter({
78
name: 'CRYPTOCOMPARE',
89
defaultEndpoint: 'crypto',
910
config,
1011
endpoints: [crypto, vwap, volume, marketcap],
12+
includes,
1113
rateLimiting: {
1214
tiers: {
1315
free: {

0 commit comments

Comments
 (0)