Skip to content

Commit 6bd929b

Browse files
change treasury-service and ebpp endpoints for balances
1 parent 82ab953 commit 6bd929b

File tree

6 files changed

+8
-58
lines changed

6 files changed

+8
-58
lines changed

src/constants/endpoints.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const INFO = "/v1/info"
2-
const BALANCES = "/v1/admin/balance"
32

43
const ADMIN_QUOTE = "/v1/admin/credit/quote"
54
const ADMIN_QUOTE_PENDING = "/v1/admin/credit/quote"
@@ -8,4 +7,4 @@ const ADMIN_QUOTE_BY_ID = "/v1/admin/credit/quote/:id"
87
const CREDIT_QUOTE = "/v1/credit/mint/quote"
98
const CREDIT_QUOTES_BY_ID = "/v1/credit/mint/quote/:id"
109

11-
export { INFO, BALANCES, ADMIN_QUOTE, ADMIN_QUOTE_PENDING, ADMIN_QUOTE_BY_ID, CREDIT_QUOTE, CREDIT_QUOTES_BY_ID }
10+
export { INFO, ADMIN_QUOTE, ADMIN_QUOTE_PENDING, ADMIN_QUOTE_BY_ID, CREDIT_QUOTE, CREDIT_QUOTES_BY_ID }

src/generated/client/sdk.gen.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,21 @@ export const activateKeyset = <ThrowOnError extends boolean = false>(options: Op
107107

108108
export const debitBalance = <ThrowOnError extends boolean = false>(options: Options<DebitData, ThrowOnError>) => {
109109
return (options.client ?? _heyApiClient).get<ECashBalance, unknown, ThrowOnError>({
110-
url: '/v1/admin/balance/debit',
110+
url: '/v1/admin/treasury/debit/balance',
111111
...options
112112
});
113113
};
114114

115115
export const creditBalance = <ThrowOnError extends boolean = false>(options: Options<CreditData, ThrowOnError>) => {
116116
return (options.client ?? _heyApiClient).get<ECashBalance, unknown, ThrowOnError>({
117-
url: '/v1/admin/balance/credit',
117+
url: '/v1/admin/treasury/credit/balance',
118118
...options
119119
});
120120
};
121121

122122
export const onchainBalance = <ThrowOnError extends boolean = false>(options: Options<OnChainData, ThrowOnError>) => {
123123
return (options.client ?? _heyApiClient).get<OnChainBalanceData, unknown, ThrowOnError>({
124-
url: '/v1/admin/onchain/balance',
124+
url: '/v1/admin/ebpp/onchain/balance',
125125
...options
126126
});
127127
};

src/generated/client/types.gen.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,14 +452,14 @@ export type DebitData = {
452452
body?: never;
453453
path?: never;
454454
query?: never;
455-
url: '/v1/admin/balance/debit';
455+
url: '/v1/admin/treasury/debit/balance';
456456
};
457457

458458
export type CreditData = {
459459
body?: never;
460460
path?: never;
461461
query?: never;
462-
url: '/v1/admin/balance/credit';
462+
url: '/v1/admin/treasury/credit/balance';
463463
};
464464

465465
export type OnChainBalanceData = {
@@ -473,7 +473,7 @@ export type OnChainData = {
473473
body?: never;
474474
path?: never;
475475
query?: never;
476-
url: '/v1/admin/onchain/balance';
476+
url: '/v1/admin/ebpp/onchain/balance';
477477
};
478478

479479
/**

src/lib/api.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { API_URL } from "@/constants/api"
2-
import { BALANCES, INFO } from "@/constants/endpoints"
2+
import { INFO } from "@/constants/endpoints"
33

44
const apiFetch = async <T = unknown>(endpoint: string, options: RequestInit = {}): Promise<T> => {
55
const url = `${API_URL}${endpoint}`
@@ -77,10 +77,3 @@ export interface BalancesResponse {
7777
}
7878
}
7979

80-
export async function fetchBalances(): Promise<BalancesResponse> {
81-
return apiFetch<BalancesResponse>(BALANCES, {
82-
headers: {
83-
"Content-Type": "application/json",
84-
},
85-
})
86-
}

src/pages/balances/CashFlowPage.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { CartesianGrid, Line, LineChart, Tooltip, XAxis, YAxis } from "recharts"
44
import { Breadcrumbs } from "@/components/Breadcrumbs"
55
import { PageTitle } from "@/components/PageTitle"
66
import { Skeleton } from "@/components/ui/skeleton"
7-
import { fetchBalances } from "@/lib/api"
8-
import { useSuspenseQuery } from "@tanstack/react-query"
9-
import useLocalStorage from "@/hooks/use-local-storage"
107
import { ChartConfig, ChartContainer, ChartLegend, ChartLegendContent } from "@/components/ui/chart"
118

129
function Loader() {
@@ -88,23 +85,6 @@ function PageBody() {
8885
)
8986
}
9087

91-
function DevSection() {
92-
const [devMode] = useLocalStorage("devMode", false)
93-
const { data } = useSuspenseQuery({
94-
queryKey: ["balances"],
95-
queryFn: fetchBalances,
96-
})
97-
98-
return (
99-
<>
100-
{devMode && (
101-
<pre className="text-sm bg-accent text-accent-foreground rounded-lg p-2 my-2">
102-
{JSON.stringify(data, null, 2)}
103-
</pre>
104-
)}
105-
</>
106-
)
107-
}
10888

10989
export default function CashFlowPage() {
11090
return (
@@ -122,7 +102,6 @@ export default function CashFlowPage() {
122102

123103
<Suspense fallback={<Loader />}>
124104
<PageBody />
125-
<DevSection />
126105
</Suspense>
127106
</>
128107
)

src/pages/balances/EarningsPage.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import { Suspense, useState } from "react"
22
import { Breadcrumbs } from "@/components/Breadcrumbs"
33
import { PageTitle } from "@/components/PageTitle"
44
import { Skeleton } from "@/components/ui/skeleton"
5-
import { fetchBalances } from "@/lib/api"
6-
import { useSuspenseQuery } from "@tanstack/react-query"
7-
import useLocalStorage from "@/hooks/use-local-storage"
85
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
96
import { Link } from "react-router"
107
import { Button } from "@/components/ui/button"
@@ -85,23 +82,6 @@ function PageBody() {
8582
)
8683
}
8784

88-
function DevSection() {
89-
const [devMode] = useLocalStorage("devMode", false)
90-
const { data } = useSuspenseQuery({
91-
queryKey: ["balances"],
92-
queryFn: fetchBalances,
93-
})
94-
95-
return (
96-
<>
97-
{devMode && (
98-
<pre className="text-sm bg-accent text-accent-foreground rounded-lg p-2 my-2">
99-
{JSON.stringify(data, null, 2)}
100-
</pre>
101-
)}
102-
</>
103-
)
104-
}
10585

10686
export default function EarningsPage() {
10787
return (
@@ -111,7 +91,6 @@ export default function EarningsPage() {
11191

11292
<Suspense fallback={<Loader />}>
11393
<PageBody />
114-
<DevSection />
11594
</Suspense>
11695
</>
11796
)

0 commit comments

Comments
 (0)