Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/heavy-readers-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/infralabs-adapter': major
---

First build with support for API authentication, signature validation, and KMS integration
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
57 changes: 57 additions & 0 deletions packages/sources/infralabs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# INFRALABS

![1.0.0](https://img.shields.io/github/package-json/v/smartcontractkit/external-adapters-js?filename=packages/sources/infralabs/package.json) ![v3](https://img.shields.io/badge/framework%20version-v3-blueviolet)

This document was generated automatically. Please see [README Generator](../../scripts#readme-generator) for more info.

## Environment Variables

| Required? | Name | Description | Type | Options | Default |
| :-------: | :-----------------------: | :---------------------------------------------------------------------------: | :-----: | :-----: | :--------------------------------------------------------: |
| ✅ | API_KEY | Infralabs API key (shared across all endpoints) | string | | |
| | USHP_API_ENDPOINT | Infralabs USHP index API URL | string | | `https://ushp-index-interface.staging.infralabs.xyz/index` |
| | USHP_MAX_STALENESS_SECS | Maximum age in seconds for the USHP index value before it is considered stale | number | | `3600000` |
| | BACKGROUND_EXECUTE_MS | Milliseconds between background data refreshes | number | | `10000` |
| | KMS_KEY_TTL_MS | Milliseconds before a cached KMS public key is considered expired | number | | `60000` |
| | KMS_REGION | AWS region where the Infralabs KMS key is hosted | string | | `us-east-1` |
| ✅ | AWS_ACCESS_KEY_ID | AWS access key ID for KMS authentication | string | | |
| ✅ | AWS_SECRET_ACCESS_KEY | AWS secret access key for KMS authentication | string | | |
| | KMS_VERIFICATION_DISABLED | Disable KMS signature verification | boolean | | `true` |

---

## Data Provider Rate Limits

There are no rate limits for this adapter.

---

## Input Parameters

| Required? | Name | Description | Type | Options | Default |
| :-------: | :------: | :-----------------: | :----: | :--------------------: | :-----: |
| | endpoint | The endpoint to use | string | [ushp](#ushp-endpoint) | `ushp` |

## Ushp Endpoint

`ushp` is the only supported name for this endpoint.

### Input Params

There are no input parameters for this endpoint.

### Example

Request:

```json
{
"data": {
"endpoint": "ushp"
}
}
```

---

MIT License
41 changes: 41 additions & 0 deletions packages/sources/infralabs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@chainlink/infralabs-adapter",
"version": "1.0.0",
"description": "Chainlink external adapter for Infralabs indices",
"keywords": [
"Chainlink",
"LINK",
"blockchain",
"oracle",
"infralabs"
],
"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": "29.5.14",
"@types/node": "22.14.1",
"nock": "13.5.6",
"typescript": "5.8.3"
},
"dependencies": {
"@aws-sdk/client-kms": "^3.1071.0",
"@chainlink/external-adapter-framework": "2.17.1",
"tslib": "2.6.3"
}
}
55 changes: 55 additions & 0 deletions packages/sources/infralabs/src/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { AdapterConfig } from '@chainlink/external-adapter-framework/config'

// TODO change to prod default once ready
export const STAGING_USHP_API_ENDPOINT = 'https://ushp-index-interface.staging.infralabs.xyz/index'

export const config = new AdapterConfig({
API_KEY: {
description: 'Infralabs API key (shared across all endpoints)',
type: 'string',
required: true,
sensitive: true,
},
USHP_API_ENDPOINT: {
description: 'Infralabs USHP index API URL',
type: 'string',
default: STAGING_USHP_API_ENDPOINT,
},
USHP_MAX_STALENESS_SECS: {
description: 'Maximum age in seconds for the USHP index value before it is considered stale',
type: 'number',
default: 3_600_000,
},
BACKGROUND_EXECUTE_MS: {
description: 'Milliseconds between background data refreshes',
type: 'number',
default: 10_000,
},
KMS_KEY_TTL_MS: {
description: 'Milliseconds before a cached KMS public key is considered expired',
type: 'number',
default: 60_000,
},
KMS_REGION: {
description: 'AWS region where the Infralabs KMS key is hosted',
type: 'string',
default: 'us-east-1',
},
AWS_ACCESS_KEY_ID: {
description: 'AWS access key ID for KMS authentication',
type: 'string',
required: true,
sensitive: true,
},
AWS_SECRET_ACCESS_KEY: {
description: 'AWS secret access key for KMS authentication',
type: 'string',
required: true,
sensitive: true,
},
KMS_VERIFICATION_DISABLED: {
description: 'Disable KMS signature verification',
type: 'boolean',
default: true,
},
})
1 change: 1 addition & 0 deletions packages/sources/infralabs/src/endpoint/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ushpEndpoint as ushp } from './ushp'
19 changes: 19 additions & 0 deletions packages/sources/infralabs/src/endpoint/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { InputParameters } from '@chainlink/external-adapter-framework/validation'
import { config } from '../config'

export const inputParameters = new InputParameters({})

export type BaseEndpointTypes = {
Parameters: typeof inputParameters.definition
Settings: typeof config.settings
Response: {
Result: string
Data: {
price: number
rawValue: string
scale: number
lastUpdatedAt: number
signature: string
}
}
}
9 changes: 9 additions & 0 deletions packages/sources/infralabs/src/endpoint/ushp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { AdapterEndpoint } from '@chainlink/external-adapter-framework/adapter'
import { ushpTransport } from '../transport/ushp'
import { BaseEndpointTypes, inputParameters } from './types'

export const ushpEndpoint = new AdapterEndpoint<BaseEndpointTypes>({
name: 'ushp',
transport: ushpTransport,
inputParameters,
})
13 changes: 13 additions & 0 deletions packages/sources/infralabs/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expose, ServerInstance } from '@chainlink/external-adapter-framework'
import { Adapter } from '@chainlink/external-adapter-framework/adapter'
import { config } from './config'
import { ushp } from './endpoint'

export const adapter = new Adapter({
defaultEndpoint: ushp.name,
name: 'INFRALABS',
config,
endpoints: [ushp],
})

export const server = (): Promise<ServerInstance | undefined> => expose(adapter)
Loading
Loading