Skip to content

Commit 46f102b

Browse files
DF21398 OnRe NAV EA (#3921)
* DF-21398 OnRe NAV EA * update test-payload * add rateLimit * yarn lock file * .pnp.cjs file * yarn cache * fixing tests * update package versions * fix dependencies * Changes - Review 1 * fix test * fix date to include UTC time * Modify output; add ripcord * Review 20 June - Part 1 * Update test snapshot * OnRe EA - correct precision * Change Response Type * update snapshot * refactor * Add changeset * Fix linter; Fix Tests * remove circuit breaking ripcord * remove circuit breaking ripcord * fix failing test * fix typo * Update snapshot * Update ResponseSchema field type
1 parent 73a7c62 commit 46f102b

File tree

5 files changed

+46
-27
lines changed

5 files changed

+46
-27
lines changed

.changeset/lazy-drinks-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/onre-adapter': minor
3+
---
4+
5+
Change API; Add Ripcord

packages/sources/onre/src/config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export const config = new AdapterConfig({
44
API_ENDPOINT: {
55
description: 'An API endpoint for OnRe',
66
type: 'string',
7-
default: 'https://onre-api-prod.ew.r.appspot.com/nav',
7+
default: 'https://onre-api-prod.ew.r.appspot.com/data/nav',
88
},
99
})

packages/sources/onre/src/transport/nav.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ interface FundNavData {
1010
fund_id: number
1111
}
1212

13-
type ProviderResponseSchema = FundNavData[]
13+
interface ProviderResponseSchema {
14+
data: FundNavData[]
15+
ripcord: boolean
16+
ripcordDetails: string | null
17+
}
1418

1519
export type FundNavDataWithTimestamp = Omit<FundNavData, 'net_asset_value_date'> & {
1620
net_asset_value_date: number
@@ -49,7 +53,7 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
4953
}
5054

5155
return params.map((param) => {
52-
const filteredData = response.data.filter((item) => item.fund_id === param.fundId)
56+
const filteredData = response.data.data.filter((item) => item.fund_id === param.fundId)
5357
if (filteredData.length === 0) {
5458
return {
5559
params: param,
@@ -100,6 +104,9 @@ export const httpTransport = new HttpTransport<HttpTransportTypes>({
100104
response: {
101105
result: result,
102106
data: resultData,
107+
ripcord: Number(response.data.ripcord),
108+
ripcordValue: response.data.ripcord,
109+
ripcordDetails: response.data.ripcordDetails,
103110
},
104111
}
105112
})

packages/sources/onre/test/integration/__snapshots__/adapter.test.ts.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ exports[`execute nav endpoint should return success - nav 1`] = `
2121
"navPerShare": 2.01702150000035,
2222
},
2323
"result": 2.01702150000035,
24+
"ripcord": 0,
25+
"ripcordDetails": null,
26+
"ripcordValue": false,
2427
"statusCode": 200,
2528
"timestamps": {
2629
"providerDataReceivedUnixMs": 978347471111,
Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
import nock from 'nock'
22

33
export const mockResponseSuccess = (): nock.Scope =>
4-
nock('https://onre-api-prod.ew.r.appspot.com/nav', {
4+
nock('https://onre-api-prod.ew.r.appspot.com/data/nav', {
55
encodedQueryParams: true,
66
})
77
.get('')
8-
.reply(200, () => [
9-
{
10-
net_asset_value_date: '06/14/2025',
11-
net_asset_value: '2.01702150000035000',
12-
assets_under_management: '15172254.24630367655644876519110000',
13-
fund_name: 'ONe',
14-
fund_id: 1,
15-
},
16-
{
17-
net_asset_value_date: '06/13/2025',
18-
net_asset_value: '1.01654803794770000',
19-
assets_under_management: '12165140.98716837796116030716880000',
20-
fund_name: 'ONe',
21-
fund_id: 1,
22-
},
23-
{
24-
net_asset_value_date: '06/12/2025',
25-
net_asset_value: '1.01607457589505000',
26-
assets_under_management: '12159421.51526390254394172217410000',
27-
fund_name: 'ONe',
28-
fund_id: 1,
29-
},
30-
])
8+
.reply(200, () => ({
9+
data: [
10+
{
11+
net_asset_value_date: '06/14/2025',
12+
net_asset_value: '2.01702150000035000',
13+
assets_under_management: '15172254.24630367655644876519110000',
14+
fund_name: 'ONe',
15+
fund_id: 1,
16+
},
17+
{
18+
net_asset_value_date: '06/13/2025',
19+
net_asset_value: '1.01654803794770000',
20+
assets_under_management: '12165140.98716837796116030716880000',
21+
fund_name: 'ONe',
22+
fund_id: 1,
23+
},
24+
{
25+
net_asset_value_date: '06/12/2025',
26+
net_asset_value: '1.01607457589505000',
27+
assets_under_management: '12159421.51526390254394172217410000',
28+
fund_name: 'ONe',
29+
fund_id: 1,
30+
},
31+
],
32+
ripcord: false,
33+
ripcordDetails: null,
34+
}))
3135
.persist()

0 commit comments

Comments
 (0)