-
Notifications
You must be signed in to change notification settings - Fork 322
CM-1099 LiveArt External Adapter #4018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@chainlink/liveart-external-adapter': major | ||
--- | ||
|
||
Create EA NAV for LiveArt |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# LiveArt NAV External Adapter |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "@chainlink/liveart-external-adapter", | ||
"version": "1.0.0", | ||
"description": "LiveArt NAV external adapter for Chainlink", | ||
"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": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo", | ||
"prepack": "yarn build", | ||
"build": "tsc -b", | ||
"server": "node -e 'require(\"./src/index.ts\").server()'", | ||
"server:dist": "node -e 'require(\"./dist/index.js\").server()'", | ||
"start": "yarn server:dist" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.14", | ||
"@types/node": "22.14.1", | ||
"nock": "13.5.6", | ||
"typescript": "5.8.3" | ||
}, | ||
"dependencies": { | ||
"@chainlink/external-adapter-framework": "2.7.0", | ||
"axios": "^1.11.0", | ||
"tslib": "2.4.1" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { AdapterConfig } from '@chainlink/external-adapter-framework/config' | ||
|
||
export type Config = { | ||
API_BASE_URL: string | ||
BEARER_TOKEN: string | ||
} | ||
|
||
export const config: AdapterConfig = new AdapterConfig({ | ||
API_BASE_URL: { | ||
description: 'The API URL for the LiveArt data provider', | ||
type: 'string', | ||
required: true, | ||
}, | ||
Comment on lines
+9
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we put a default url here? |
||
BEARER_TOKEN: { | ||
description: 'The Bearer token for authentication', | ||
type: 'string', | ||
required: true, | ||
sensitive: true, | ||
}, | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { AdapterEndpoint } from '@chainlink/external-adapter-framework/adapter' | ||
import { InputParameters } from '@chainlink/external-adapter-framework/validation' | ||
|
||
import { httpTransport } from '../transport/transport' | ||
|
||
export const inputParameters = new InputParameters( | ||
{ | ||
artwork_id: { | ||
aliases: ['artworkId'], | ||
required: true, | ||
type: 'string', | ||
description: 'The ID of the artwork to fetch', | ||
}, | ||
}, | ||
[ | ||
{ | ||
artwork_id: 'banksy', | ||
}, | ||
], | ||
) | ||
|
||
export const liveArtNAV = new AdapterEndpoint({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just call this nav |
||
name: 'nav', | ||
transport: httpTransport, | ||
inputParameters, | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { expose, ServerInstance } from '@chainlink/external-adapter-framework' | ||
import { Adapter } from '@chainlink/external-adapter-framework/adapter' | ||
|
||
import { config } from './config/config' | ||
import { liveArtNAV } from './endpoint/nav' | ||
|
||
// Endpoints | ||
// GET /artwork/{artwork_id}/price | ||
// GET /healthcheck | ||
Comment on lines
+7
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not how this works, we do POST instead. Also this comment is not necessary |
||
|
||
export const adapter = new Adapter({ | ||
defaultEndpoint: liveArtNAV.name, | ||
name: 'LIVE_ART NAV', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LIVE_ART_NAV |
||
config, | ||
endpoints: [liveArtNAV], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to put a rate limiter here |
||
}) | ||
|
||
export const server = (): Promise<ServerInstance | undefined> => expose(adapter) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"requests": [{ | ||
"artwork_id": "banksy" | ||
}] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this?