Skip to content
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

Peregrine Data External Adapter Submission #3590

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

droconnel22
Copy link

Closes #ISSUE_NUMBER_GOES_HERE

Description

......

Changes

  • High level
  • changes that
  • you made

Steps to Test

  1. Steps
  2. to
  3. test

Quality Assurance

  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant infra-k8s configuration file.
  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant adapter-secrets configuration file or update the soak testing blacklist.
  • If a new adapter was made, or a new endpoint was added, update the test-payload.json file with relevant requests.
  • The branch naming follows git flow (feature/x, chore/x, release/x, hotfix/x, fix/x) or is created from Jira.
  • This is related to a maximum of one Jira story or GitHub issue.
  • Types are safe (avoid TypeScript/TSLint features like any and disable, instead use more specific types).
  • All code changes have 100% unit and integration test coverage. If testing is not applicable or too difficult to justify doing, the reasoning should be documented explicitly in the PR.

Copy link

changeset-bot bot commented Nov 27, 2024

🦋 Changeset detected

Latest commit: 0ef17bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@chainlink/peregrine-fund-admin-adapter Patch

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

@droconnel22 droconnel22 changed the title nav and reserve build out Peregrine Data External Adapter Submission Nov 27, 2024
Copy link
Contributor

@mxiao-cll mxiao-cll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to run yarn as well as yarn test peregrine-fund-admin/test

packages/sources/peregrine-fund-admin/src/endpoint/nav.ts Outdated Show resolved Hide resolved
packages/sources/peregrine-fund-admin/src/endpoint/nav.ts Outdated Show resolved Hide resolved
@mmcallister-cll
Copy link
Contributor

once changes are made, please run yarn changeset and select major from root external-adapters-js dir.

@droconnel22
Copy link
Author

once changes are made, please run yarn changeset and select major from root external-adapters-js dir.

this has now been run and commited in latest for this PR.

@droconnel22
Copy link
Author

once changes are made, please run yarn changeset and select major from root external-adapters-js dir.

this has been run.

@droconnel22
Copy link
Author

what is the correct way to run test in my directory? I tried yarn test, etc.

@mxiao-cll
Copy link
Contributor

what is the correct way to run test in my directory? I tried yarn test, etc.

yarn test peregrine-fund-admin/test

in root

@droconnel22
Copy link
Author

`

PASS packages/sources/peregrine-fund-admin/test/integration/adapter.test.ts

Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 2 passed, 2 total
Time: 2.561 s, estimated 3 s`

Please confirm running the integration tests pass as expected.

@mmcallister-cll
Copy link
Contributor

mmcallister-cll commented Dec 4, 2024

Please run end to end manual tests as well on the package.
You'll need to set the necessary env vars (API_KEY, any endpoint overrides)
Then from external-adapters-js/packages/sources/peregrine-fund-admin run

> yarn build; yarn start

and request against your local EA with a curl like this (plus any additional params you add)

curl --location 'localhost:8080' \
--header 'Content-Type: application/json' \
--data '{
  "data": {
    "endpoint": "globalmarketcap",
    "assetId": "100"
  }
}'

hope this will help with the e2e debugging 🙏

@droconnel22
Copy link
Author

Updated Please

Please run end to end manual tests as well on the package. You'll need to set the necessary env vars (API_KEY, any endpoint overrides) Then from external-adapters-js/packages/sources/peregrine-fund-admin run

> yarn build; yarn start

and request against your local EA with a curl like this (plus any additional params you add)

curl --location 'localhost:8080' \
--header 'Content-Type: application/json' \
--data '{
  "data": {
    "endpoint": "globalmarketcap",
    "assetId": "100"
  }
}'

hope this will help with the e2e debugging 🙏

Should I run the yarn in the root of the directory or in the EA package

@mmcallister-cll
Copy link
Contributor

@droconnel22 please run

> yarn build; yarn start

from the EA package dir, ie:

$REPO/packages/sources/peregrine-fund-admin

This will run an instance of your peregrine-fund-admin EA locally so you can request against it on localhost:8080 with the above curl command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this file

@@ -0,0 +1,5 @@
---
'@chainlink/peregrine-fund-admin-adapter': patch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'@chainlink/peregrine-fund-admin-adapter': patch
'@chainlink/peregrine-fund-admin-adapter': major

API_BASE_URL: {
description: 'Base URL to Fund Admin Server Endpoint',
type: 'string',
default: '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default: '',
default: 'https://fund-admin-data-adapter-v1-960005989691.europe-west2.run.app',

type: 'string',
required: true,
sensitive: true,
default: '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line

API_RESERVE_ENDPOINT: {
description: 'API Endpoint to get the latest Proof of Reserves for a given asset',
type: 'string',
default: '',
Copy link
Contributor

@mmcallister-cll mmcallister-cll Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default: '',
default: '/api/v1/reserves',

description:
'An API endpoint for the latest Net Asset Value (NAV) calculation for a given asset',
type: 'string',
default: '',
Copy link
Contributor

@mmcallister-cll mmcallister-cll Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default: '',
default: '/api/v1/nav',


export interface ResponseSchema {
equityNav: number
seniorNav: number
Copy link
Contributor

@mmcallister-cll mmcallister-cll Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this changed on your side in the API response?

params: [param],
request: {
baseURL: config.API_BASE_URL,
url: config.API_NAV_ENDPOINT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url: config.API_NAV_ENDPOINT,
url: `${config.API_NAV_ENDPOINT}/${param.assetId}`,

return {
params: param,
response: {
result: Number(response.data.equityNav),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result: Number(response.data.equityNav),
result: Number(equityNav),

response: {
result: Number(response.data.equityNav),
data: {
result: Number(response.data.equityNav),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result: Number(response.data.equityNav),
result: Number(equityNav),

data: {
result: Number(response.data.equityNav),
timestamps: {
providerIndicatedTimeUnixMs: Number(response.data.updateDateTime) * 1000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateDateTime returns a formatted string, not a number that can be cast. Please use a proper conversion here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the same changes as above nav.ts file in this file as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants