-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* DF-20625 apex EA initial commit * add changeset * review fixes
- Loading branch information
1 parent
29cf6c0
commit 805468b
Showing
19 changed files
with
549 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@chainlink/apex-adapter': major | ||
--- | ||
|
||
Apex EA Initial Commit |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Chainlink External Adapter for apex | ||
|
||
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 apex`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "@chainlink/apex-adapter", | ||
"version": "0.0.0", | ||
"description": "Chainlink apex adapter.", | ||
"keywords": [ | ||
"Chainlink", | ||
"LINK", | ||
"blockchain", | ||
"oracle", | ||
"apex" | ||
], | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"repository": { | ||
"url": "https://github.com/smartcontractkit/external-adapters-js", | ||
"type": "git" | ||
}, | ||
"license": "MIT", | ||
"scripts": { | ||
"clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo", | ||
"prepack": "yarn build", | ||
"build": "tsc -b", | ||
"server": "node -e 'require(\"./index.js\").server()'", | ||
"server:dist": "node -e 'require(\"./dist/index.js\").server()'", | ||
"start": "yarn server:dist" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "27.5.2", | ||
"@types/node": "22.12.0", | ||
"nock": "13.5.6", | ||
"typescript": "5.6.3" | ||
}, | ||
"dependencies": { | ||
"@chainlink/external-adapter-framework": "2.0.0", | ||
"axios": "1.7.9", | ||
"tslib": "2.4.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { AdapterConfig } from '@chainlink/external-adapter-framework/config' | ||
|
||
export const config = new AdapterConfig({ | ||
CLIENT_ID: { | ||
description: 'Data Provider client ID', | ||
type: 'string', | ||
required: true, | ||
sensitive: true, | ||
}, | ||
CLIENT_SECRET: { | ||
description: 'Data Provider client secret', | ||
type: 'string', | ||
required: true, | ||
sensitive: true, | ||
}, | ||
SCOPE: { | ||
description: 'Scope of credentials', | ||
type: 'string', | ||
required: true, | ||
sensitive: true, | ||
}, | ||
GRANT_TYPE: { | ||
description: 'Grant type for credentials', | ||
type: 'string', | ||
required: true, | ||
sensitive: true, | ||
}, | ||
NAV_API_ENDPOINT: { | ||
description: 'An API endpoint for Data Provider', | ||
type: 'string', | ||
default: 'https://api.apexgroup.com/v1/reports/NAV', | ||
}, | ||
AUTH_API_ENDPOINT: { | ||
description: 'An auth API endpoint for Data Provider', | ||
type: 'string', | ||
required: true, | ||
sensitive: true, | ||
}, | ||
BACKGROUND_EXECUTE_MS: { | ||
description: | ||
'The amount of time the background execute should sleep before performing the next request', | ||
type: 'number', | ||
default: 10_000, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { endpoint as nav } from './nav' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { AdapterEndpoint } from '@chainlink/external-adapter-framework/adapter' | ||
import { InputParameters } from '@chainlink/external-adapter-framework/validation' | ||
import { SingleNumberResultResponse } from '@chainlink/external-adapter-framework/util' | ||
import { config } from '../config' | ||
import { navTransport } from '../transport/nav' | ||
|
||
export const inputParameters = new InputParameters( | ||
{ | ||
accountName: { | ||
required: true, | ||
type: 'string', | ||
description: 'The account name to query', | ||
}, | ||
}, | ||
[ | ||
{ | ||
accountName: 'EXAMPLE', | ||
}, | ||
], | ||
) | ||
|
||
export type BaseEndpointTypes = { | ||
Parameters: typeof inputParameters.definition | ||
Response: SingleNumberResultResponse | ||
Settings: typeof config.settings | ||
} | ||
|
||
export const endpoint = new AdapterEndpoint({ | ||
name: 'nav', | ||
transport: navTransport, | ||
inputParameters, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { expose, ServerInstance } from '@chainlink/external-adapter-framework' | ||
import { Adapter } from '@chainlink/external-adapter-framework/adapter' | ||
import { config } from './config' | ||
import { nav } from './endpoint' | ||
|
||
export const adapter = new Adapter({ | ||
defaultEndpoint: nav.name, | ||
name: 'APEX', | ||
config, | ||
endpoints: [nav], | ||
rateLimiting: { | ||
tiers: { | ||
default: { | ||
rateLimit1m: 6, | ||
note: 'Setting reasonable default limits', | ||
}, | ||
}, | ||
}, | ||
}) | ||
|
||
export const server = (): Promise<ServerInstance | undefined> => expose(adapter) |
Oops, something went wrong.