Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/constants/endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const INFO = "/v1/info"
const BALANCES = "/v1/admin/balance"

const ADMIN_QUOTE = "/v1/admin/credit/quote"
const ADMIN_QUOTE_PENDING = "/v1/admin/credit/quote"
Expand All @@ -8,4 +7,4 @@ const ADMIN_QUOTE_BY_ID = "/v1/admin/credit/quote/:id"
const CREDIT_QUOTE = "/v1/credit/mint/quote"
const CREDIT_QUOTES_BY_ID = "/v1/credit/mint/quote/:id"

export { INFO, BALANCES, ADMIN_QUOTE, ADMIN_QUOTE_PENDING, ADMIN_QUOTE_BY_ID, CREDIT_QUOTE, CREDIT_QUOTES_BY_ID }
export { INFO, ADMIN_QUOTE, ADMIN_QUOTE_PENDING, ADMIN_QUOTE_BY_ID, CREDIT_QUOTE, CREDIT_QUOTES_BY_ID }
6 changes: 3 additions & 3 deletions src/generated/client/sdk.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,21 @@

export const debitBalance = <ThrowOnError extends boolean = false>(options: Options<DebitData, ThrowOnError>) => {
return (options.client ?? _heyApiClient).get<ECashBalance, unknown, ThrowOnError>({
url: '/v1/admin/balance/debit',
url: '/v1/admin/treasury/debit/balance',

Check warning on line 110 in src/generated/client/sdk.gen.ts

View check run for this annotation

Codecov / codecov/patch

src/generated/client/sdk.gen.ts#L110

Added line #L110 was not covered by tests
...options
});
};

export const creditBalance = <ThrowOnError extends boolean = false>(options: Options<CreditData, ThrowOnError>) => {
return (options.client ?? _heyApiClient).get<ECashBalance, unknown, ThrowOnError>({
url: '/v1/admin/balance/credit',
url: '/v1/admin/treasury/credit/balance',

Check warning on line 117 in src/generated/client/sdk.gen.ts

View check run for this annotation

Codecov / codecov/patch

src/generated/client/sdk.gen.ts#L117

Added line #L117 was not covered by tests
...options
});
};

export const onchainBalance = <ThrowOnError extends boolean = false>(options: Options<OnChainData, ThrowOnError>) => {
return (options.client ?? _heyApiClient).get<OnChainBalanceData, unknown, ThrowOnError>({
url: '/v1/admin/onchain/balance',
url: '/v1/admin/ebpp/onchain/balance',

Check warning on line 124 in src/generated/client/sdk.gen.ts

View check run for this annotation

Codecov / codecov/patch

src/generated/client/sdk.gen.ts#L124

Added line #L124 was not covered by tests
...options
});
};
Expand Down
6 changes: 3 additions & 3 deletions src/generated/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,14 @@ export type DebitData = {
body?: never;
path?: never;
query?: never;
url: '/v1/admin/balance/debit';
url: '/v1/admin/treasury/debit/balance';
};

export type CreditData = {
body?: never;
path?: never;
query?: never;
url: '/v1/admin/balance/credit';
url: '/v1/admin/treasury/credit/balance';
};

export type OnChainBalanceData = {
Expand All @@ -473,7 +473,7 @@ export type OnChainData = {
body?: never;
path?: never;
query?: never;
url: '/v1/admin/onchain/balance';
url: '/v1/admin/ebpp/onchain/balance';
};

/**
Expand Down
9 changes: 1 addition & 8 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API_URL } from "@/constants/api"
import { BALANCES, INFO } from "@/constants/endpoints"
import { INFO } from "@/constants/endpoints"

Check warning on line 2 in src/lib/api.ts

View check run for this annotation

Codecov / codecov/patch

src/lib/api.ts#L2

Added line #L2 was not covered by tests

const apiFetch = async <T = unknown>(endpoint: string, options: RequestInit = {}): Promise<T> => {
const url = `${API_URL}${endpoint}`
Expand Down Expand Up @@ -77,10 +77,3 @@
}
}

export async function fetchBalances(): Promise<BalancesResponse> {
return apiFetch<BalancesResponse>(BALANCES, {
headers: {
"Content-Type": "application/json",
},
})
}
21 changes: 0 additions & 21 deletions src/pages/balances/CashFlowPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { CartesianGrid, Line, LineChart, Tooltip, XAxis, YAxis } from "recharts"
import { Breadcrumbs } from "@/components/Breadcrumbs"
import { PageTitle } from "@/components/PageTitle"
import { Skeleton } from "@/components/ui/skeleton"
import { fetchBalances } from "@/lib/api"
import { useSuspenseQuery } from "@tanstack/react-query"
import useLocalStorage from "@/hooks/use-local-storage"
import { ChartConfig, ChartContainer, ChartLegend, ChartLegendContent } from "@/components/ui/chart"

function Loader() {
Expand Down Expand Up @@ -88,23 +85,6 @@ function PageBody() {
)
}

function DevSection() {
const [devMode] = useLocalStorage("devMode", false)
const { data } = useSuspenseQuery({
queryKey: ["balances"],
queryFn: fetchBalances,
})

return (
<>
{devMode && (
<pre className="text-sm bg-accent text-accent-foreground rounded-lg p-2 my-2">
{JSON.stringify(data, null, 2)}
</pre>
)}
</>
)
}

export default function CashFlowPage() {
return (
Expand All @@ -122,7 +102,6 @@ export default function CashFlowPage() {

<Suspense fallback={<Loader />}>
<PageBody />
<DevSection />
</Suspense>
</>
)
Expand Down
21 changes: 0 additions & 21 deletions src/pages/balances/EarningsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { Suspense, useState } from "react"
import { Breadcrumbs } from "@/components/Breadcrumbs"
import { PageTitle } from "@/components/PageTitle"
import { Skeleton } from "@/components/ui/skeleton"
import { fetchBalances } from "@/lib/api"
import { useSuspenseQuery } from "@tanstack/react-query"
import useLocalStorage from "@/hooks/use-local-storage"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
import { Link } from "react-router"
import { Button } from "@/components/ui/button"
Expand Down Expand Up @@ -85,23 +82,6 @@ function PageBody() {
)
}

function DevSection() {
const [devMode] = useLocalStorage("devMode", false)
const { data } = useSuspenseQuery({
queryKey: ["balances"],
queryFn: fetchBalances,
})

return (
<>
{devMode && (
<pre className="text-sm bg-accent text-accent-foreground rounded-lg p-2 my-2">
{JSON.stringify(data, null, 2)}
</pre>
)}
</>
)
}

export default function EarningsPage() {
return (
Expand All @@ -111,7 +91,6 @@ export default function EarningsPage() {

<Suspense fallback={<Loader />}>
<PageBody />
<DevSection />
</Suspense>
</>
)
Expand Down
Loading