-
Notifications
You must be signed in to change notification settings - Fork 261
Add Canton EA to read from Canton participant node #4103
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
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
e7337ba
add canton ea endpoint and transport
cl-mayowa 18bd27c
add changeset
cl-mayowa c742a59
update contract query and input params
cl-mayowa 511d86e
remove unsued functions and refactor code
cl-mayowa 7740b18
update integration tests for new changes
cl-mayowa 56c9ac7
refactor adapter settings and tests
cl-mayowa 406352a
add custom return handler with tests
cl-mayowa 21b971f
refactor canton to be extensible and added tests
cl-mayowa af69997
update dependencies lock
cl-mayowa 75afbec
remove outdated snapshots
cl-mayowa 31b221c
update external adapter framework version
cl-mayowa 2372d13
remove useless read me
cl-mayowa acb7400
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] ba364e6
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] bf71600
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] f9a90a7
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] cb56ec8
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 5fecd29
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] a77e0c9
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 66e56f3
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 9f040d4
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] da9910d
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 6894d6f
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 7d7eca5
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] eb0f8a0
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 3d72bc8
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] c4d3058
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 81e9a05
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] d599e48
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 8a80033
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] f89d741
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 3f9bf7c
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 0c866c2
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 9deeb54
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] a35a768
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] fd289c6
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 0078775
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 439c593
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 4bf55de
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 6cb1830
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 98aba67
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] b16b5ca
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 82fe1f4
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 0f8d35d
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] fa20726
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] cbe3d2b
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 7079039
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 331895b
Merge branch 'main' into DS-1113-Canton-EA
app-token-issuer-data-feeds[bot] 3d9dc11
Add canton-functions path to tsconfig
Fletch153 020bbfe
add README for canton EA
cl-mayowa f57271e
merge main into DS-1113-Canton-EA
cl-mayowa 1a1406f
upgrade EA version
cl-mayowa a725f52
update yarn
cl-mayowa 0d20cb3
Merge branch 'main' into DS-1113-Canton-EA
cl-mayowa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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/canton-functions-adapter': major | ||
| --- | ||
|
|
||
| This EA enables us to read data from Canton participant nodes via the Ledger API |
This file contains hidden or 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,10 @@ | ||
| root = true | ||
|
|
||
| [*] | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
|
|
||
| [*.{js,json,yml}] | ||
| charset = utf-8 | ||
| indent_style = space | ||
| indent_size = 2 |
This file contains hidden or 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,4 @@ | ||
| /.yarn/** linguist-vendored | ||
| /.yarn/releases/* binary | ||
| /.yarn/plugins/**/* binary | ||
| /.pnp.* binary linguist-generated |
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 hidden or 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,56 @@ | ||
| # CANTON_FUNCTIONS | ||
|
|
||
|   | ||
|
|
||
| This document was generated automatically. Please see [README Generator](../../scripts#readme-generator) for more info. | ||
|
|
||
| ## Environment Variables | ||
|
|
||
| | Required? | Name | Description | Type | Options | Default | | ||
| | :-------: | :-------------------: | :---------------------------------------------------------------------------------------: | :----: | :-----: | :-----: | | ||
| | ✅ | AUTH_TOKEN | JWT token for Canton JSON API authentication | string | | | | ||
| | | BACKGROUND_EXECUTE_MS | The amount of time the background execute should sleep before performing the next request | number | | `1000` | | ||
| | ✅ | URL | The Canton JSON API URL | string | | | | ||
| | ✅ | TEMPLATE_ID | The template ID to query contracts for (format: packageId:Module:Template) | string | | | | ||
| | ✅ | CHOICE | The non-consuming choice to exercise on the contract | string | | | | ||
| | | ARGUMENT | The argument for the choice (JSON string) | string | | | | ||
| | | CONTRACT_FILTER | Filter to query contracts when contractId is not provided (JSON string) | string | | | | ||
|
|
||
| --- | ||
|
|
||
| ## 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 | [canton-data](#canton-data-endpoint) | `canton-data` | | ||
|
|
||
| ## Canton-data Endpoint | ||
|
|
||
| `canton-data` is the only supported name for this endpoint. | ||
|
|
||
| ### Input Params | ||
|
|
||
| | Required? | Name | Aliases | Description | Type | Options | Default | Depends On | Not Valid With | | ||
| | :-------: | :--------: | :-----: | :-----------------------------------: | :----: | :-----: | :-----: | :--------: | :------------: | | ||
| | | contractId | | The contract ID to exercise choice on | string | | | | | | ||
|
|
||
| ### Example | ||
|
|
||
| Request: | ||
|
|
||
| ```json | ||
| { | ||
| "data": { | ||
| "endpoint": "canton-data", | ||
| "contractId": "00e1f5c6d8b9a7f4e3c2d1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6d5e4f3a2b1c0" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| --- |
This file contains hidden or 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,42 @@ | ||
| { | ||
| "name": "@chainlink/canton-functions-adapter", | ||
| "version": "1.0.0", | ||
cl-mayowa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "description": "Chainlink canton-functions adapter.", | ||
| "keywords": [ | ||
| "Chainlink", | ||
| "LINK", | ||
| "blockchain", | ||
| "oracle", | ||
| "canton-functions" | ||
| ], | ||
| "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": { | ||
| "@sinonjs/fake-timers": "9.1.2", | ||
| "@types/jest": "^29.5.14", | ||
| "@types/node": "22.14.1", | ||
| "@types/sinonjs__fake-timers": "8.1.5", | ||
| "nock": "13.5.6", | ||
| "typescript": "5.8.3" | ||
| }, | ||
| "dependencies": { | ||
| "@chainlink/external-adapter-framework": "2.11.5", | ||
| "tslib": "2.4.1" | ||
| } | ||
| } | ||
This file contains hidden or 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 @@ | ||
| import { AdapterConfig } from '@chainlink/external-adapter-framework/config' | ||
|
|
||
| export const config = new AdapterConfig({ | ||
| AUTH_TOKEN: { | ||
| description: 'JWT token for Canton JSON API authentication', | ||
| type: 'string', | ||
| required: true, | ||
| sensitive: true, | ||
| }, | ||
| BACKGROUND_EXECUTE_MS: { | ||
cl-mayowa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| description: | ||
| 'The amount of time the background execute should sleep before performing the next request', | ||
| type: 'number', | ||
| default: 1_000, | ||
| }, | ||
| URL: { | ||
| description: 'The Canton JSON API URL', | ||
| type: 'string', | ||
| required: true, | ||
| }, | ||
| TEMPLATE_ID: { | ||
| description: 'The template ID to query contracts for (format: packageId:Module:Template)', | ||
| type: 'string', | ||
| required: true, | ||
| }, | ||
| CHOICE: { | ||
cl-mayowa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| description: 'The non-consuming choice to exercise on the contract', | ||
| type: 'string', | ||
| required: true, | ||
| }, | ||
| ARGUMENT: { | ||
| description: 'The argument for the choice (JSON string)', | ||
| type: 'string', | ||
| required: false, | ||
| }, | ||
| CONTRACT_FILTER: { | ||
| description: 'Filter to query contracts when contractId is not provided (JSON string)', | ||
| type: 'string', | ||
| required: false, | ||
| }, | ||
| }) | ||
39 changes: 39 additions & 0 deletions
39
packages/sources/canton-functions/src/endpoint/canton-data.ts
This file contains hidden or 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,39 @@ | ||
| import { AdapterEndpoint } from '@chainlink/external-adapter-framework/adapter' | ||
| import { InputParameters } from '@chainlink/external-adapter-framework/validation' | ||
| import { config } from '../config' | ||
| import { cantonDataTransport } from '../transport/canton-data' | ||
|
|
||
| export const inputParameters = new InputParameters( | ||
| { | ||
cl-mayowa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| contractId: { | ||
| description: 'The contract ID to exercise choice on', | ||
| type: 'string', | ||
| required: false, | ||
| }, | ||
| }, | ||
| [ | ||
| { | ||
| contractId: '00e1f5c6d8b9a7f4e3c2d1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6d5e4f3a2b1c0', | ||
| }, | ||
| ], | ||
| ) | ||
|
|
||
| export type BaseEndpointTypes = { | ||
| Parameters: typeof inputParameters.definition | ||
| Response: { | ||
| Data: { | ||
| result: string | ||
| exerciseResult: any | ||
| contract?: any | ||
| } | ||
| Result: string | ||
| } | ||
| Settings: typeof config.settings | ||
| } | ||
|
|
||
| export const endpoint = new AdapterEndpoint({ | ||
| name: 'canton-data', | ||
| aliases: [], | ||
cl-mayowa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| transport: cantonDataTransport, | ||
| inputParameters, | ||
| }) | ||
This file contains hidden or 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 cantonData } from './canton-data' |
This file contains hidden or 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,24 @@ | ||
| import { expose, ServerInstance } from '@chainlink/external-adapter-framework' | ||
| import { Adapter } from '@chainlink/external-adapter-framework/adapter' | ||
| import { config } from './config' | ||
| import { cantonData } from './endpoint' | ||
|
|
||
| export const adapter = new Adapter({ | ||
Fletch153 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| defaultEndpoint: cantonData.name, | ||
| name: 'CANTON_FUNCTIONS', | ||
| config, | ||
| endpoints: [cantonData], | ||
| }) | ||
|
|
||
| export const server = (): Promise<ServerInstance | undefined> => expose(adapter) | ||
|
|
||
| // Export types and utilities for secondary adapters | ||
| export { BaseEndpointTypes, inputParameters } from './endpoint/canton-data' | ||
| export type { | ||
| Contract, | ||
| ExerciseChoiceRequest, | ||
| ExerciseResponse, | ||
| QueryContractByTemplateRequest, | ||
| } from './shared/canton-client' | ||
| export { CantonDataTransport, ResultHandler } from './transport/canton-data' | ||
| export { config as cantonConfig } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.