@@ -59,7 +59,7 @@ import {
5959 getRoundsForManagerByAddress ,
6060 getDirectDonationsByProjectId ,
6161} from "./queries" ;
62- import { orderByMapping } from "./utils" ;
62+ import { mergeCanonicalAndLinkedProjects , orderByMapping } from "./utils" ;
6363import {
6464 AttestationService ,
6565 type MintingAttestationIdsData ,
@@ -251,9 +251,9 @@ export class DataLayer {
251251
252252 if ( response . projects . length === 0 ) return null ;
253253
254- // const project = mergeCanonicalAndLinkedProjects(response.projects)[0];
254+ const project = mergeCanonicalAndLinkedProjects ( response . projects ) [ 0 ] ;
255255
256- return { project : response . projects [ 0 ] } ;
256+ return { project : project } ;
257257 }
258258
259259 async getProjectAnchorByIdAndChainId ( {
@@ -316,7 +316,8 @@ export class DataLayer {
316316 requestVariables ,
317317 ) ;
318318
319- return response . projects ;
319+ const mergedProjects = mergeCanonicalAndLinkedProjects ( response . projects ) ;
320+ return mergedProjects ;
320321 }
321322
322323 /**
@@ -815,17 +816,30 @@ export class DataLayer {
815816 chainIds : number [ ] ;
816817 } ) : Promise < Contribution [ ] > {
817818 const { address, chainIds } = args ;
818- const response : { donations : Contribution [ ] } = await request (
819- this . gsIndexerEndpoint ,
820- getDonationsByDonorAddress ,
821- {
822- address : getAddress ( address ) ,
823- chainIds,
824- } ,
825- ) ;
819+ let offset = 0 ;
820+ let hasMore = true ;
821+ const limit = 200 ;
822+ let donations : Contribution [ ] = [ ] ;
823+
824+ while ( hasMore ) {
825+ const response : { donations : Contribution [ ] } = await request (
826+ this . gsIndexerEndpoint ,
827+ getDonationsByDonorAddress ,
828+ { address : getAddress ( address ) , chainIds, limit, offset } ,
829+ ) ;
830+
831+ donations = [ ...donations , ...response . donations ] ;
832+
833+ // Check if we need to fetch more
834+ if ( response . donations . length < limit ) {
835+ hasMore = false ;
836+ } else {
837+ offset += limit ;
838+ }
839+ }
826840
827841 // Filter out invalid donations and map the project metadata from application metadata (solution for canonical projects in indexer v2)
828- const validDonations = response . donations . reduce < Contribution [ ] > (
842+ const validDonations = donations . reduce < Contribution [ ] > (
829843 ( validDonations , donation ) => {
830844 if ( donation . round . strategyName !== "allov2.DirectAllocationStrategy" ) {
831845 if ( donation . application ?. project ) {
0 commit comments