From 376dad0351c51b1b18eaee478abf9c714fae9cfb Mon Sep 17 00:00:00 2001 From: ruhil6789 Date: Thu, 15 Jan 2026 22:20:20 +0530 Subject: [PATCH 1/3] fix(koios): add cursor support to fetchCollectionAssets (#618) --- packages/mesh-provider/src/koios.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/mesh-provider/src/koios.ts b/packages/mesh-provider/src/koios.ts index 168e93fa2..b4d9793d9 100644 --- a/packages/mesh-provider/src/koios.ts +++ b/packages/mesh-provider/src/koios.ts @@ -283,23 +283,30 @@ export class KoiosProvider * @param cursor The cursor for pagination * @returns The list of assets and the next cursor */ - async fetchCollectionAssets(policyId: string): Promise<{ assets: Asset[] }> { + async fetchCollectionAssets( + policyId: string, + cursor?: number | string, + ): Promise<{ assets: Asset[]; next?: string | number | null }> { try { + // Note: Koios API doesn't support pagination for policy_asset_info endpoint + // We return all assets and set next to null to match the interface const { data, status } = await this._axiosInstance.get( `policy_asset_info?_asset_policy=${policyId}`, ); - if (status === 200) + if (status === 200) { return { assets: data.map((asset: KoiosAsset) => ({ unit: `${asset.policy_id}${asset.asset_name}`, quantity: asset.total_supply, })), + next: null, // Koios doesn't support pagination for this endpoint }; + } throw parseHttpError(data); } catch (error) { - throw parseHttpError(error); + return { assets: [], next: null }; } } From 70b033103422c2aa9469fc5815d705cf995ee26e Mon Sep 17 00:00:00 2001 From: ruhil6789 Date: Thu, 15 Jan 2026 22:20:35 +0530 Subject: [PATCH 2/3] docs(koios): document governance proposal limitation (#618) --- packages/mesh-provider/src/koios.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/mesh-provider/src/koios.ts b/packages/mesh-provider/src/koios.ts index b4d9793d9..e1104c667 100644 --- a/packages/mesh-provider/src/koios.ts +++ b/packages/mesh-provider/src/koios.ts @@ -460,7 +460,9 @@ export class KoiosProvider txHash: string, certIndex: number, ): Promise { - throw new Error("Method not implemented"); + // Koios API doesn't currently support governance proposal queries + // This is consistent with other providers like Maestro, Yaci, and U5C + throw new Error("Governance proposal queries are not supported by Koios API"); } /** From 2360b064cf4e93b9d16be19c582d8750d3b99612 Mon Sep 17 00:00:00 2001 From: ruhil6789 Date: Thu, 15 Jan 2026 22:59:06 +0530 Subject: [PATCH 3/3] fix(koios): implement proper pagination support for fetchCollectionAssets (#618) --- packages/mesh-provider/src/koios.ts | 31 ++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/packages/mesh-provider/src/koios.ts b/packages/mesh-provider/src/koios.ts index e1104c667..152a12546 100644 --- a/packages/mesh-provider/src/koios.ts +++ b/packages/mesh-provider/src/koios.ts @@ -280,7 +280,7 @@ export class KoiosProvider /** * Fetches the list of assets for a given policy ID. * @param policyId The policy ID to fetch assets for - * @param cursor The cursor for pagination + * @param cursor The cursor for pagination (used as offset) * @returns The list of assets and the next cursor */ async fetchCollectionAssets( @@ -288,19 +288,32 @@ export class KoiosProvider cursor?: number | string, ): Promise<{ assets: Asset[]; next?: string | number | null }> { try { - // Note: Koios API doesn't support pagination for policy_asset_info endpoint - // We return all assets and set next to null to match the interface + // Koios API supports pagination with limit and offset + // Default limit is 500 (Koios API maximum), cursor is used as offset + const limit = 500; + const offset = cursor + ? typeof cursor === "number" + ? cursor + : parseInt(cursor, 10) + : 0; + const { data, status } = await this._axiosInstance.get( - `policy_asset_info?_asset_policy=${policyId}`, + `policy_asset_info?_asset_policy=${policyId}&limit=${limit}&offset=${offset}`, ); if (status === 200) { + const assets = data.map((asset: KoiosAsset) => ({ + unit: `${asset.policy_id}${asset.asset_name}`, + quantity: asset.total_supply, + })); + + // If we got fewer assets than the limit, there are no more pages + // Otherwise, return the next offset + const next = data.length === limit ? offset + limit : null; + return { - assets: data.map((asset: KoiosAsset) => ({ - unit: `${asset.policy_id}${asset.asset_name}`, - quantity: asset.total_supply, - })), - next: null, // Koios doesn't support pagination for this endpoint + assets, + next, }; }