Skip to content

Commit 55cff27

Browse files
committed
Fetch identity detail
1 parent e35e957 commit 55cff27

File tree

3 files changed

+108
-22
lines changed

3 files changed

+108
-22
lines changed

src/generated/client/sdk.gen.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

33
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
4-
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} from './types.gen';
4+
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, IdentityDetailResponse, IdentityDetailInfo} from './types.gen';
55

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

@@ -152,3 +152,19 @@ export const requestToMint = <ThrowOnError extends boolean = false>(options: Opt
152152
}
153153
});
154154
};
155+
156+
157+
/**
158+
* --------------------------- IdentityDetail
159+
*/
160+
161+
export const identityDetail = <ThrowOnError extends boolean = false>(options?: Options<IdentityDetailData, ThrowOnError>) => {
162+
return (_heyApiClient).get<IdentityDetailInfo, unknown, ThrowOnError>({
163+
url: '/v1/admin/identity/detail',
164+
...options,
165+
headers: {
166+
'Content-Type': 'application/json',
167+
...options?.headers
168+
}
169+
});
170+
};

src/generated/client/types.gen.ts

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,6 @@ export type KeysetInfoData = {
501501
* Request Mint
502502
*/
503503

504-
// pub struct RequestToMintFromEBillRequest {
505-
// pub ebill_id: String,
506-
// pub amount: Amount,
507-
// }
508-
509504
export type RequestToMintRequest = {
510505
ebill_id: string;
511506
amount: number;
@@ -529,3 +524,41 @@ export type KeysetInfoData = {
529524
query?: never;
530525
url: '/v1/admin/treasury/debit/request_to_mint_from_ebill'
531526
};
527+
528+
/**
529+
* Node ID
530+
*/
531+
532+
export type IdentityDetailRequest = {
533+
};
534+
535+
export type IdentityDetailInfo = {
536+
node_id: string;
537+
name: string;
538+
email: string;
539+
bitcoin_public_key: string;
540+
npub: string;
541+
postal_address: PostalAddress;
542+
date_of_birth: string;
543+
country_of_birth: string | null;
544+
city_of_birth: string | null;
545+
identification_number: string | null;
546+
profile_picture_file: string | null;
547+
identity_document_file: string | null;
548+
nostr_relays: Array<string>;
549+
};
550+
551+
export type IdentityDetailResponse = {
552+
/**
553+
* Successful response
554+
*/
555+
200: IdentityDetailInfo;
556+
};
557+
558+
559+
export type IdentityDetailData = {
560+
body?: never;
561+
path?: never;
562+
query?: never;
563+
url: '/v1/admin/identity/detail'
564+
};

src/pages/home/HomePage.tsx

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { PageTitle } from "@/components/PageTitle"
22
import { Skeleton } from "@/components/ui/skeleton"
3-
// import { fetchInfo } from "@/lib/api"
4-
// import { useSuspenseQuery } from "@tanstack/react-query"
3+
import { identityDetail } from "@/generated/client/sdk.gen"
4+
import { useSuspenseQuery } from "@tanstack/react-query"
55
import { Suspense } from "react"
66

77
function Loader() {
@@ -13,23 +13,60 @@ function Loader() {
1313
}
1414

1515
function PageBody() {
16-
// const { data } = []; useSuspenseQuery({
17-
// queryKey: ["info"],
18-
// queryFn: fetchInfo,
19-
// })
20-
21-
const data = {
22-
name: "bcr-wdc-quote-service",
23-
version: "0.1.0",
24-
pubkey: "0283bf290884eed3a7ca2663fc0260de2e2064d6b355ea13f98dec004b7a7ead99",
25-
}
16+
const { data } = useSuspenseQuery({
17+
queryKey: ["identity-detail"],
18+
queryFn: async () => {
19+
const response = await identityDetail()
20+
return response.data
21+
},
22+
staleTime: Infinity, // Data won't change
23+
gcTime: Infinity,
24+
})
2625

2726
return (
2827
<>
29-
<div className="flex flex-col gap-0.5 bg-accent text-accent-foreground rounded-lg p-2 my-2">
30-
<span className="font-bold">{data.name}</span>
31-
<span className="text-sm font-mono text-accent-foreground/50">{data.version}</span>
32-
<span className="text-sm font-mono">{data.pubkey}</span>
28+
<div className="flex flex-col gap-2 bg-accent text-accent-foreground rounded-lg p-4 my-2">
29+
<div className="flex flex-col gap-0.5">
30+
<span className="text-xs text-accent-foreground/50 uppercase tracking-wide">Name</span>
31+
<span className="font-bold">{data.name}</span>
32+
</div>
33+
34+
<div className="flex flex-col gap-0.5">
35+
<span className="text-xs text-accent-foreground/50 uppercase tracking-wide">Email</span>
36+
<span className="font-mono text-sm">{data.email}</span>
37+
</div>
38+
39+
<div className="flex flex-col gap-0.5">
40+
<span className="text-xs text-accent-foreground/50 uppercase tracking-wide">Node ID</span>
41+
<span className="font-mono text-sm break-all">{data.node_id}</span>
42+
</div>
43+
44+
<div className="flex flex-col gap-0.5">
45+
<span className="text-xs text-accent-foreground/50 uppercase tracking-wide">Bitcoin Public Key</span>
46+
<span className="font-mono text-sm break-all">{data.bitcoin_public_key}</span>
47+
</div>
48+
49+
<div className="flex flex-col gap-0.5">
50+
<span className="text-xs text-accent-foreground/50 uppercase tracking-wide">Nostr Public Key</span>
51+
<span className="font-mono text-sm break-all">{data.npub}</span>
52+
</div>
53+
54+
<div className="flex flex-col gap-0.5">
55+
<span className="text-xs text-accent-foreground/50 uppercase tracking-wide">Date of Birth</span>
56+
<span className="text-sm">{data.date_of_birth}</span>
57+
</div>
58+
59+
<div className="flex flex-col gap-0.5">
60+
<span className="text-xs text-accent-foreground/50 uppercase tracking-wide">Address</span>
61+
<div className="text-sm">
62+
<div>{data.postal_address.address}</div>
63+
<div>
64+
{data.postal_address.city}
65+
{data.postal_address.zip && `, ${data.postal_address.zip}`}
66+
</div>
67+
<div>{data.postal_address.country}</div>
68+
</div>
69+
</div>
3370
</div>
3471
</>
3572
)

0 commit comments

Comments
 (0)