The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
/*
* Copyright 2025 Daytona Platforms Inc.
* Modified by BoxLite AI, 2025-2026
* SPDX-License-Identifier: AGPL-3.0
*/
import { PaymentUrl } from '@/billing-api/types/OrganizationWallet'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { queryKeys } from '../queries/queryKeys'
import { useApi } from '../useApi'
interface TopUpWalletVariables {
organizationId: string
amountCents: number
}
export const useTopUpWalletMutation = () => {
const { billingApi } = useApi()
const queryClient = useQueryClient()
return useMutation<PaymentUrl, unknown, TopUpWalletVariables>({
mutationFn: ({ organizationId, amountCents }) => billingApi.topUpWallet(organizationId, amountCents),
onSuccess: async (_data, { organizationId }) => {
await Promise.all([
queryClient.invalidateQueries({ queryKey: queryKeys.organization.wallet(organizationId) }),
queryClient.invalidateQueries({ queryKey: queryKeys.billing.transactions(organizationId) }),
queryClient.invalidateQueries({ queryKey: queryKeys.billing.invoices(organizationId) }),
])
},
})
}