@@ -757,6 +757,98 @@ export class AccountsApiClient extends BaseApiClient {
757757 } ;
758758 }
759759
760+ /**
761+ * Returns TanStack Query options for v4 multi-account transactions,
762+ * designed for use with `useInfiniteQuery`.
763+ *
764+ * Unlike `getV4MultiAccountTransactionsQueryOptions`, this method:
765+ * - Excludes pagination params (cursor/after/before) from the query key for stability across pages.
766+ * - Accepts `pageParam` at query-time (via React Query) instead of baking cursor into a closure.
767+ * - Calls `this.fetch()` directly (not `queryClient.fetchQuery()`) to avoid double-caching.
768+ *
769+ * @param params - API endpoint parameters (excluding pagination cursors).
770+ * @param params.accountAddresses - Array of CAIP-10 account addresses.
771+ * @param params.networks - CAIP-2 network IDs to filter by.
772+ * @param params.startTimestamp - Start timestamp (epoch).
773+ * @param params.endTimestamp - End timestamp (epoch).
774+ * @param params.limit - Max transactions per page (default 50).
775+ * @param params.sortDirection - Sort direction (ASC/DESC).
776+ * @param params.includeLogs - Whether to include logs.
777+ * @param params.includeTxMetadata - Whether to include transaction metadata.
778+ * @param params.maxLogsPerTx - Max logs per transaction.
779+ * @param params.lang - Language for transaction category (default "en").
780+ * @param options - Fetch options including cache settings.
781+ * @returns Options object compatible with `useInfiniteQuery`.
782+ */
783+ getV4MultiAccountTransactionsInfiniteQueryOptions (
784+ params : {
785+ accountAddresses : string [ ] ;
786+ networks ?: string [ ] ;
787+ startTimestamp ?: number ;
788+ endTimestamp ?: number ;
789+ limit ?: number ;
790+ sortDirection ?: 'ASC' | 'DESC' ;
791+ includeLogs ?: boolean ;
792+ includeTxMetadata ?: boolean ;
793+ maxLogsPerTx ?: number ;
794+ lang ?: string ;
795+ } ,
796+ options ?: FetchOptions ,
797+ ) : FetchQueryOptions < V4MultiAccountTransactionsResponse > {
798+ return {
799+ queryKey : [
800+ 'accounts' ,
801+ 'transactions' ,
802+ 'v4MultiAccount' ,
803+ {
804+ accountAddresses : [ ...params . accountAddresses ] . sort ( ) ,
805+ networks : params . networks && [ ...params . networks ] . sort ( ) ,
806+ startTimestamp : params . startTimestamp ,
807+ endTimestamp : params . endTimestamp ,
808+ limit : params . limit ,
809+ sortDirection : params . sortDirection ,
810+ includeLogs : params . includeLogs ,
811+ includeTxMetadata : params . includeTxMetadata ,
812+ maxLogsPerTx : params . maxLogsPerTx ,
813+ lang : params . lang ,
814+ } ,
815+ ] as const ,
816+ queryFn : ( {
817+ pageParam,
818+ signal,
819+ } : {
820+ pageParam ?: string ;
821+ signal ?: AbortSignal ;
822+ } ) =>
823+ this . fetch < V4MultiAccountTransactionsResponse > (
824+ API_URLS . ACCOUNTS ,
825+ '/v4/multiaccount/transactions' ,
826+ {
827+ signal,
828+ params : {
829+ accountAddresses : params . accountAddresses ,
830+ networks : params . networks ,
831+ startTimestamp : params . startTimestamp ,
832+ endTimestamp : params . endTimestamp ,
833+ cursor : pageParam ,
834+ limit : params . limit ,
835+ sortDirection : params . sortDirection ,
836+ includeLogs : params . includeLogs ,
837+ includeTxMetadata : params . includeTxMetadata ,
838+ maxLogsPerTx : params . maxLogsPerTx ,
839+ lang : params . lang ,
840+ } ,
841+ } ,
842+ ) ,
843+ getNextPageParam : ( { pageInfo } : V4MultiAccountTransactionsResponse ) =>
844+ pageInfo . hasNextPage ? pageInfo . endCursor : undefined ,
845+ initialPageParam : undefined as string | undefined ,
846+ ...getQueryOptionsOverrides ( options ) ,
847+ staleTime : options ?. staleTime ?? STALE_TIMES . TRANSACTIONS ,
848+ gcTime : options ?. gcTime ?? GC_TIMES . DEFAULT ,
849+ } ;
850+ }
851+
760852 /**
761853 * Get multi-account transactions (v4 endpoint).
762854 *
0 commit comments