From 983b8115019d2dd7a072069929bd663bfd4edd26 Mon Sep 17 00:00:00 2001 From: Mohamed Mehany <7327188+mohamed-mehany@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:03:10 +0400 Subject: [PATCH 1/3] Replace clientReferenceId with packageId as primary identifier for Anchorage packages endpoint --- .changeset/tiny-paths-smoke.md | 5 +++++ packages/sources/anchorage/src/endpoint/packages.ts | 6 +++--- packages/sources/anchorage/src/transport/packages.ts | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/tiny-paths-smoke.md diff --git a/.changeset/tiny-paths-smoke.md b/.changeset/tiny-paths-smoke.md new file mode 100644 index 0000000000..0467d8428d --- /dev/null +++ b/.changeset/tiny-paths-smoke.md @@ -0,0 +1,5 @@ +--- +'@chainlink/anchorage-adapter': major +--- + +Add packageId support to Anchorage packages endpoint diff --git a/packages/sources/anchorage/src/endpoint/packages.ts b/packages/sources/anchorage/src/endpoint/packages.ts index 045be11e18..53e2b79b32 100644 --- a/packages/sources/anchorage/src/endpoint/packages.ts +++ b/packages/sources/anchorage/src/endpoint/packages.ts @@ -6,10 +6,10 @@ import { packagesTransport } from '../transport/packages' export const inputParameters = new InputParameters( { - clientReferenceId: { + packageId: { required: true, type: 'string', - description: 'Id of the vault', + description: 'Id of the collateral management package', }, assetType: { required: true, @@ -19,7 +19,7 @@ export const inputParameters = new InputParameters( }, [ { - clientReferenceId: '123456', + packageId: '1c1dd6b2899660900088', assetType: 'BTC', }, ], diff --git a/packages/sources/anchorage/src/transport/packages.ts b/packages/sources/anchorage/src/transport/packages.ts index 1e9a0c145a..f9a817c353 100644 --- a/packages/sources/anchorage/src/transport/packages.ts +++ b/packages/sources/anchorage/src/transport/packages.ts @@ -13,6 +13,7 @@ const logger = makeLogger('PackageTransport') type RequestParams = typeof inputParameters.validated interface PackageResponse { + packageId: string clientReferenceId: string collateralAssets: [ { @@ -80,7 +81,7 @@ export class PackagesTransport extends SubscriptionTransport ) const assets = response - .filter((r) => r.clientReferenceId.toUpperCase() == params.clientReferenceId.toUpperCase()) + .filter((r) => r.packageId.toLowerCase() == params.packageId.toLowerCase()) .flatMap((r) => r.collateralAssets) const result = assets From 7043fe57d497ee8b49d062b857b095280ac3ec1c Mon Sep 17 00:00:00 2001 From: Mohamed Mehany <7327188+mohamed-mehany@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:09:53 +0400 Subject: [PATCH 2/3] Adds tests --- .../integration/__snapshots__/adapter.test.ts.snap | 12 ++++++++++++ .../anchorage/test/integration/adapter.test.ts | 2 +- .../sources/anchorage/test/integration/fixtures.ts | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/sources/anchorage/test/integration/__snapshots__/adapter.test.ts.snap b/packages/sources/anchorage/test/integration/__snapshots__/adapter.test.ts.snap index bb67b47f15..5dd009c3ba 100644 --- a/packages/sources/anchorage/test/integration/__snapshots__/adapter.test.ts.snap +++ b/packages/sources/anchorage/test/integration/__snapshots__/adapter.test.ts.snap @@ -25,6 +25,12 @@ exports[`execute packages endpoint should return success 1`] = ` ], "result": 2.3, }, + "meta": { + "adapterName": "ANCHORAGE", + "metrics": { + "feedId": "{"packageId":"pkg-123456","assetType":"btc"}", + }, + }, "result": 2.3, "statusCode": 200, "timestamps": { @@ -50,6 +56,12 @@ exports[`execute wallet endpoint should return success 1`] = ` }, ], }, + "meta": { + "adapterName": "ANCHORAGE", + "metrics": { + "feedId": "{"vaultId":"b0bb5449c1e4926542ce693b4db2e883","coin":"ethhol","chainId":"testnet","network":"ethereum"}", + }, + }, "result": null, "statusCode": 200, "timestamps": { diff --git a/packages/sources/anchorage/test/integration/adapter.test.ts b/packages/sources/anchorage/test/integration/adapter.test.ts index 7cce046405..1c0fe396e5 100644 --- a/packages/sources/anchorage/test/integration/adapter.test.ts +++ b/packages/sources/anchorage/test/integration/adapter.test.ts @@ -58,7 +58,7 @@ describe('execute', () => { const response = await testAdapter.request({ endpoint: 'packages', - clientReferenceId: '123456', + packageId: 'pkg-123456', assetType: 'BTC', }) diff --git a/packages/sources/anchorage/test/integration/fixtures.ts b/packages/sources/anchorage/test/integration/fixtures.ts index 97ca5e4b10..515d041ff8 100644 --- a/packages/sources/anchorage/test/integration/fixtures.ts +++ b/packages/sources/anchorage/test/integration/fixtures.ts @@ -167,6 +167,7 @@ export const mockPackagesResponseSuccess = (): nock.Scope => () => ({ data: [ { + packageId: 'pkg-123456', clientReferenceId: '123456', collateralAssets: [ { @@ -204,6 +205,7 @@ export const mockPackagesResponseSuccess = (): nock.Scope => .reply(200, () => ({ data: [ { + packageId: 'pkg-123456', clientReferenceId: '123456', collateralAssets: [ { @@ -224,6 +226,7 @@ export const mockPackagesResponseSuccess = (): nock.Scope => .reply(200, () => ({ data: [ { + packageId: 'pkg-789012', clientReferenceId: '789012', collateralAssets: [ { From 3a69b15c35f056ac4502aeb61fff57c40aad5400 Mon Sep 17 00:00:00 2001 From: Mohamed Mehany <7327188+mohamed-mehany@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:15:32 +0400 Subject: [PATCH 3/3] Missing snapshots --- .../integration/__snapshots__/adapter.test.ts.snap | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/sources/anchorage/test/integration/__snapshots__/adapter.test.ts.snap b/packages/sources/anchorage/test/integration/__snapshots__/adapter.test.ts.snap index 5dd009c3ba..bb67b47f15 100644 --- a/packages/sources/anchorage/test/integration/__snapshots__/adapter.test.ts.snap +++ b/packages/sources/anchorage/test/integration/__snapshots__/adapter.test.ts.snap @@ -25,12 +25,6 @@ exports[`execute packages endpoint should return success 1`] = ` ], "result": 2.3, }, - "meta": { - "adapterName": "ANCHORAGE", - "metrics": { - "feedId": "{"packageId":"pkg-123456","assetType":"btc"}", - }, - }, "result": 2.3, "statusCode": 200, "timestamps": { @@ -56,12 +50,6 @@ exports[`execute wallet endpoint should return success 1`] = ` }, ], }, - "meta": { - "adapterName": "ANCHORAGE", - "metrics": { - "feedId": "{"vaultId":"b0bb5449c1e4926542ce693b4db2e883","coin":"ethhol","chainId":"testnet","network":"ethereum"}", - }, - }, "result": null, "statusCode": 200, "timestamps": {