Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 17 additions & 1 deletion src/generated/client/sdk.gen.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is auto-generated by @hey-api/openapi-ts

import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
import type { ListQuotesData, ListQuotesResponse, ListPendingQuotesData, ListPendingQuotesResponse, AdminLookupQuoteData, AdminLookupQuoteResponse, AdminUpdateQuoteData, AdminUpdateQuoteResponse, ResolveOfferData, EnquireQuoteData, EnquireQuoteResponse, LookupQuoteData, LookupQuoteResponse, ActivateKeysetData, ActivateKeysetResponse, DebitData, CreditData, ECashBalance, OnChainBalanceData, OnChainData, KeysetInfoData, KeySetInfo, RequestToMintData, RequestToMintResponseInfo, IdentityDetailData, IdentityDetailInfo, BillPaymentData, BillPaymentState} from './types.gen';
import type { ListQuotesData, ListQuotesResponse, ListPendingQuotesData, ListPendingQuotesResponse, AdminLookupQuoteData, AdminLookupQuoteResponse, AdminUpdateQuoteData, AdminUpdateQuoteResponse, ResolveOfferData, EnquireQuoteData, EnquireQuoteResponse, LookupQuoteData, LookupQuoteResponse, ActivateKeysetData, ActivateKeysetResponse, DebitData, CreditData, ECashBalance, OnChainBalanceData, OnChainData, KeysetInfoData, KeySetInfo, RequestToMintData, RequestToMintResponseInfo, IdentityDetailData, IdentityDetailInfo, BillPaymentData, BillPaymentState, MintInfo, MintInfoData} from './types.gen';

import { client as _heyApiClient } from './client.gen';

Expand Down Expand Up @@ -183,3 +183,19 @@
}
});
};


/**
* --------------------------- MintInfo
*/

export const mintInfo = <ThrowOnError extends boolean = false>(options?: Options<MintInfoData, ThrowOnError>) => {
return (_heyApiClient).get<MintInfo, unknown, ThrowOnError>({
url: '/v1/admin/info',
...options,
headers: {
'Content-Type': 'application/json',
...options?.headers
}
});
};

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

View check run for this annotation

Codecov / codecov/patch

src/generated/client/sdk.gen.ts#L192-L201

Added lines #L192 - L201 were not covered by tests
20 changes: 20 additions & 0 deletions src/generated/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,3 +597,23 @@ export type BillPaymentData = {
query?: never;
url: '/v1/admin/bill/payment_status/{bill_id}';
};

/**
* Mint Info
*/

export type MintInfo = {
name: string,
pubkey: string | null,
version: string | null,
description: string | null,
description_long: string | null,
contact: Array<string> | null,
}

export type MintInfoData = {
body?: never;
path?: never;
query?: never;
url: '/v1/admin/info'
};
68 changes: 66 additions & 2 deletions src/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PageTitle } from "@/components/PageTitle"
import { Skeleton } from "@/components/ui/skeleton"
import { identityDetail } from "@/generated/client/sdk.gen"
import { identityDetail, mintInfo } from "@/generated/client/sdk.gen"

Check warning on line 3 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L3

Added line #L3 was not covered by tests
import { useSuspenseQuery } from "@tanstack/react-query"
import { Suspense } from "react"

Expand All @@ -23,6 +23,16 @@
gcTime: Infinity,
})

const { data: mintData } = useSuspenseQuery({
queryKey: ["mint-info"],
queryFn: async () => {
const response = await mintInfo()
return response.data ?? null
},
staleTime: Infinity,
gcTime: Infinity,
})

Check warning on line 34 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L26-L34

Added lines #L26 - L34 were not covered by tests

if (!data) {
return (
<div className="bg-card text-card-foreground rounded-lg border p-6">
Expand All @@ -33,8 +43,62 @@

return (
<div className="flex flex-col gap-4">
{mintData && (
<div className="bg-card text-card-foreground rounded-lg border p-6">
<h3 className="text-lg font-semibold mb-4">Mint Information</h3>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{mintData.name && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Name</span>
<span className="font-semibold text-base">{mintData.name}</span>
</div>

Check warning on line 54 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L46-L54

Added lines #L46 - L54 were not covered by tests
)}
{mintData.version && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Version</span>
<span className="text-sm">{mintData.version}</span>
</div>

Check warning on line 60 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L56-L60

Added lines #L56 - L60 were not covered by tests
)}
{mintData.description && (
<div className="flex flex-col gap-1 md:col-span-2">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Description</span>
<span className="text-sm">{mintData.description}</span>
</div>

Check warning on line 66 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L62-L66

Added lines #L62 - L66 were not covered by tests
)}
{mintData.description_long && (
<div className="flex flex-col gap-1 md:col-span-2">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">

Check warning on line 70 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L68-L70

Added lines #L68 - L70 were not covered by tests
Long Description
</span>
<span className="text-sm">{mintData.description_long}</span>
</div>

Check warning on line 74 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L72-L74

Added lines #L72 - L74 were not covered by tests
)}
{mintData.pubkey && (
<div className="flex flex-col gap-1 md:col-span-2">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Public Key</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">
{mintData.pubkey}
</span>
</div>

Check warning on line 82 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L76-L82

Added lines #L76 - L82 were not covered by tests
)}
{mintData.contact && mintData.contact.length > 0 && (
<div className="flex flex-col gap-1 md:col-span-2">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Contact</span>
<div className="flex flex-wrap gap-2">
{mintData.contact.map((contact, index) => (
<span key={index} className="text-sm bg-muted px-2 py-1 rounded">
Copy link
Preview

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using the array index as a React key can lead to rendering issues if the list changes. Use a unique identifier like the contact value instead (e.g., key={contact}).

Suggested change
{mintData.contact.map((contact, index) => (
<span key={index} className="text-sm bg-muted px-2 py-1 rounded">
{mintData.contact.map((contact) => (
<span key={contact} className="text-sm bg-muted px-2 py-1 rounded">

Copilot uses AI. Check for mistakes.

{contact}
</span>
))}
</div>
</div>

Check warning on line 94 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L84-L94

Added lines #L84 - L94 were not covered by tests
)}
</div>
</div>

Check warning on line 97 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L96-L97

Added lines #L96 - L97 were not covered by tests
)}

<div className="bg-card text-card-foreground rounded-lg border p-6">
<h3 className="text-lg font-semibold mb-4">Information</h3>
<h3 className="text-lg font-semibold mb-4">Identity</h3>

Check warning on line 101 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L101

Added line #L101 was not covered by tests
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Name</span>
Expand Down
Loading