Skip to content

Commit 0f7978b

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

File tree

6 files changed

+8
-54
lines changed

6 files changed

+8
-54
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 & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +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"
87
import { useSuspenseQuery } from "@tanstack/react-query"
98
import useLocalStorage from "@/hooks/use-local-storage"
109
import { ChartConfig, ChartContainer, ChartLegend, ChartLegendContent } from "@/components/ui/chart"
@@ -88,23 +87,6 @@ function PageBody() {
8887
)
8988
}
9089

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-
}
10890

10991
export default function CashFlowPage() {
11092
return (
@@ -122,7 +104,6 @@ export default function CashFlowPage() {
122104

123105
<Suspense fallback={<Loader />}>
124106
<PageBody />
125-
<DevSection />
126107
</Suspense>
127108
</>
128109
)

src/pages/balances/EarningsPage.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +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"
65
import { useSuspenseQuery } from "@tanstack/react-query"
76
import useLocalStorage from "@/hooks/use-local-storage"
87
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
@@ -85,23 +84,6 @@ function PageBody() {
8584
)
8685
}
8786

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-
}
10587

10688
export default function EarningsPage() {
10789
return (
@@ -111,7 +93,6 @@ export default function EarningsPage() {
11193

11294
<Suspense fallback={<Loader />}>
11395
<PageBody />
114-
<DevSection />
11596
</Suspense>
11697
</>
11798
)

0 commit comments

Comments
 (0)