-
Notifications
You must be signed in to change notification settings - Fork 326
OPDATA 4790 #4440
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?
OPDATA 4790 #4440
Conversation
🦋 Changeset detectedLatest commit: 5005a98 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Pull request overview
This PR introduces a new xusd-usd-exchange-rate source adapter that fetches the round value from the XUSD contract on Ethereum mainnet using JSON-RPC eth_call.
Key Changes:
- Implements a new adapter with a
roundendpoint that queries theround()function from contract0xE2Fc85BfB48C4cF147921fBE110cf92Ef9f26F94 - Uses HTTP transport with direct
eth_callJSON-RPC to retrieve on-chain data - Includes comprehensive unit and integration tests for transport functions and error handling scenarios
Reviewed changes
Copilot reviewed 15 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/tsconfig.test.json | Added reference to new adapter's test configuration |
| packages/tsconfig.json | Added reference to new adapter's build configuration |
| packages/sources/xusd-usd-exchange-rate/tsconfig.test.json | Test TypeScript configuration for the new adapter |
| packages/sources/xusd-usd-exchange-rate/tsconfig.json | Build TypeScript configuration for the new adapter |
| packages/sources/xusd-usd-exchange-rate/test/unit/round.test.ts | Unit tests for transport utility functions |
| packages/sources/xusd-usd-exchange-rate/test/integration/fixtures.ts | Mock fixtures for integration tests |
| packages/sources/xusd-usd-exchange-rate/test/integration/adapter.test.ts | Integration tests for adapter endpoints and error scenarios |
| packages/sources/xusd-usd-exchange-rate/test/integration/snapshots/adapter.test.ts.snap | Jest snapshots for integration test assertions |
| packages/sources/xusd-usd-exchange-rate/test-payload.json | Example test payload for the round endpoint |
| packages/sources/xusd-usd-exchange-rate/src/transport/round.ts | HTTP transport implementation for eth_call RPC requests |
| packages/sources/xusd-usd-exchange-rate/src/index.ts | Main adapter entry point and configuration |
| packages/sources/xusd-usd-exchange-rate/src/endpoint/round.ts | Round endpoint definition and input parameters |
| packages/sources/xusd-usd-exchange-rate/src/endpoint/index.ts | Endpoint exports |
| packages/sources/xusd-usd-exchange-rate/src/config/index.ts | Adapter configuration including ETHEREUM_RPC_URL |
| packages/sources/xusd-usd-exchange-rate/package.json | Package metadata and dependencies |
Files not reviewed (1)
- .pnp.cjs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull request overview
Copilot reviewed 17 out of 19 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- .pnp.cjs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull request overview
Copilot reviewed 17 out of 19 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- .pnp.cjs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mxiao-cll
left a comment
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.
What are we trying to do here? Just testing how the AI agent performs?
| import { config } from '../config' | ||
| import { httpTransport } from '../transport/round' | ||
|
|
||
| export const inputParameters = new InputParameters({}, [{}]) |
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.
There is an EmptyInputParameters from framework
| export const XUSD_CONTRACT_ADDRESS = '0xE2Fc85BfB48C4cF147921fBE110cf92Ef9f26F94' | ||
| export const ROUND_FUNCTION_SELECTOR = '0x146ca531' |
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.
These should come from input
| prepareRequests: (params, config) => { | ||
| return params.map((param) => ({ | ||
| params: [param], | ||
| request: buildEthCallRequest(config.ETHEREUM_RPC_URL), | ||
| })) | ||
| }, |
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.
This is wrong, you are building the same request over and over again. Just need to return 1 request here
| }, | ||
| 'latest', | ||
| ], | ||
| id: 1, |
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.
Are we hardcoding this to 1 everytime?
yes |
Ready EA Implementation for OPDATA-4790
Description
Adds a new
xusd-usd-exchange-ratesource adapter that fetches theround()value from the XUSD contract (0xE2Fc85BfB48C4cF147921fBE110cf92Ef9f26F94) on Ethereum mainnet viaeth_callJSON-RPC. This adapter supports the XUSD-USD exchange rate feed for Stream.Changes
xusd-usd-exchange-ratesource adapter withroundendpointeth_callJSON-RPC to query the on-chainround()functionETHEREUM_RPC_URLas a required environment variable (node operators provide their own RPC endpoint)buildEthCallRequest,parseHexToInt,buildErrorResponse,buildSuccessResponse)Steps to Test
ETHEREUM_RPC_URLenvironment variable to a valid Ethereum mainnet RPC endpointyarn test packages/sources/xusd-usd-exchange-rateQuality Assurance
infra-k8sconfiguration file.adapter-secretsconfiguration file.test-payload.jsonfile with relevant requests.feature/x,chore/x,release/x,hotfix/x,fix/x) or is created from Jira.