Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

935 B
Raw Blame
/*
 * Copyright 2025 Daytona Platforms Inc.
 * Modified by BoxLite AI, 2025-2026
 * SPDX-License-Identifier: AGPL-3.0
 */

import type { PaginatedWalletTransactions } from '@/billing-api/types/WalletTransaction'
import { useQuery } from '@tanstack/react-query'
import { useApi } from '../useApi'
import { useConfig } from '../useConfig'
import { queryKeys } from './queryKeys'

export function useOrganizationWalletTransactionsQuery({
  organizationId,
  page,
  perPage,
  enabled = true,
}: {
  organizationId: string
  page?: number
  perPage?: number
  enabled?: boolean
}) {
  const { billingApi } = useApi()
  const config = useConfig()

  return useQuery<PaginatedWalletTransactions>({
    queryKey: queryKeys.billing.transactions(organizationId, page, perPage),
    queryFn: () => billingApi.listWalletTransactions(organizationId, page, perPage),
    enabled: Boolean(enabled && config.billingApiUrl && organizationId),
  })
}