Skip to content

Commit 1e111e7

Browse files
authored
New ICE Fx EA via NetDania jsApi (#3916)
* DF-21369 new ICE EA via NetDania jsApi streaming transport based on jsApi local price cache to deal with partial updates include jsApi license terms * DF-21369 abstract XHR instantiation in jsApi for testing * DF-21369 NetDania API double basic tests run both against double and real * DF-21369 ICE adapter end-to-end tests Makes use of netdania double (via xhr mocking)
1 parent ab2a5eb commit 1e111e7

34 files changed

+5027
-0
lines changed

.changeset/tough-hornets-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/ice-adapter': major
3+
---
4+
5+
First version

.pnp.cjs

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NetDania-License.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
NetDania License Terms
2+
3+
This project includes modified versions of software originally developed by NetDania Creations ApS. The Intellectual Property Rights related to this software are owned by NetDania and shall not be transferred to any other person or legal entity.
4+
5+
These components are proprietary and may only be used:
6+
- As part of the Chainlink External Adapter (EA) project;
7+
- By Chainlink Labs and Chainlink Node Operators in order to retrieve the content provided by NetDania.
8+
9+
For additional usage terms and attributions, please refer to the copyright notice included at the top of each relevant file.

packages/sources/ice/CHANGELOG.md

Whitespace-only changes.

packages/sources/ice/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Chainlink External Adapter for ice
2+
3+
This README will be generated automatically when code is merged to `main`. If you would like to generate a preview of the README, please run `yarn generate:readme ice`.

packages/sources/ice/package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "@chainlink/ice-adapter",
3+
"version": "0.0.0",
4+
"description": "Chainlink ice adapter.",
5+
"keywords": [
6+
"Chainlink",
7+
"LINK",
8+
"blockchain",
9+
"oracle",
10+
"ice"
11+
],
12+
"main": "dist/index.js",
13+
"types": "dist/index.d.ts",
14+
"files": [
15+
"dist"
16+
],
17+
"repository": {
18+
"url": "https://github.com/smartcontractkit/external-adapters-js",
19+
"type": "git"
20+
},
21+
"license": "MIT",
22+
"scripts": {
23+
"clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo",
24+
"prepack": "yarn build",
25+
"build": "tsc -b",
26+
"server": "node -e 'require(\"./index.js\").server()'",
27+
"server:dist": "node -e 'require(\"./dist/index.js\").server()'",
28+
"start": "yarn server:dist"
29+
},
30+
"devDependencies": {
31+
"@types/jest": "^29.5.14",
32+
"@types/node": "22.14.1",
33+
"mock-xmlhttprequest": "8.4.1",
34+
"typescript": "5.8.3",
35+
"xmlhttprequest": "1.8.0"
36+
},
37+
"dependencies": {
38+
"@chainlink/external-adapter-framework": "2.6.0",
39+
"tslib": "^2.8.0"
40+
}
41+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { AdapterConfig } from '@chainlink/external-adapter-framework/config'
2+
3+
export const config = new AdapterConfig({
4+
USER_GROUP: {
5+
description: 'User group for ICE',
6+
type: 'string',
7+
default: 'chain.link',
8+
},
9+
NETDANIA_PASSWORD: {
10+
description: 'Password for ICE',
11+
type: 'string',
12+
required: true,
13+
sensitive: true,
14+
},
15+
API_ENDPOINT: {
16+
description: 'streaming server endpoint for ICE',
17+
type: 'string',
18+
required: true,
19+
},
20+
API_ENDPOINT_FAILOVER_1: {
21+
description: 'failover endpoint for ICE',
22+
type: 'string',
23+
default: '',
24+
required: false,
25+
},
26+
API_ENDPOINT_FAILOVER_2: {
27+
description: 'failover endpoint for ICE',
28+
type: 'string',
29+
default: '',
30+
required: false,
31+
},
32+
API_ENDPOINT_FAILOVER_3: {
33+
description: 'failover endpoint for ICE',
34+
type: 'string',
35+
default: '',
36+
required: false,
37+
},
38+
POLLING_INTERVAL: {
39+
description: 'Polling interval for ICE',
40+
type: 'number',
41+
default: 2000,
42+
},
43+
CONNECTING_TIMEOUT_MS: {
44+
description: 'Connecting timeout in milliseconds for ICE',
45+
type: 'number',
46+
default: 4000,
47+
},
48+
})
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { endpoint as price } from './price'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import {
2+
LwbaEndpoint,
3+
lwbaEndpointInputParametersDefinition,
4+
LwbaResponseDataFields,
5+
} from '@chainlink/external-adapter-framework/adapter'
6+
import { InputParameters } from '@chainlink/external-adapter-framework/validation'
7+
import { config } from '../config'
8+
import { transport } from '../transport/price'
9+
10+
export const inputParameters = new InputParameters(lwbaEndpointInputParametersDefinition, [
11+
{
12+
base: 'EUR',
13+
quote: 'USD',
14+
},
15+
])
16+
17+
export type BaseEndpointTypes = {
18+
Parameters: typeof inputParameters.definition
19+
Response: LwbaResponseDataFields
20+
Settings: typeof config.settings
21+
}
22+
23+
export const endpoint = new LwbaEndpoint({
24+
name: 'price',
25+
aliases: ['latest-price', 'data-price', 'getReqObjPrice'],
26+
transport: transport,
27+
inputParameters,
28+
})

packages/sources/ice/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { expose, ServerInstance } from '@chainlink/external-adapter-framework'
2+
import { Adapter } from '@chainlink/external-adapter-framework/adapter'
3+
import { config } from './config'
4+
import { price } from './endpoint'
5+
6+
export const adapter = new Adapter({
7+
defaultEndpoint: price.name,
8+
name: 'ICE',
9+
config,
10+
endpoints: [price],
11+
})
12+
13+
export const server = (): Promise<ServerInstance | undefined> => expose(adapter)

0 commit comments

Comments
 (0)