Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
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} 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, IdentityDetailResponse, IdentityDetailInfo} from './types.gen';

Check failure on line 4 in src/generated/client/sdk.gen.ts

View workflow job for this annotation

GitHub Actions / test (v22.11.0)

'IdentityDetailResponse' is declared but never used.

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

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


/**
* --------------------------- IdentityDetail
*/

export const identityDetail = <ThrowOnError extends boolean = false>(options?: Options<IdentityDetailData, ThrowOnError>) => {
return (_heyApiClient).get<IdentityDetailInfo, unknown, ThrowOnError>({
url: '/v1/admin/identity/detail',
...options,
headers: {
'Content-Type': 'application/json',
...options?.headers
}
});
};
43 changes: 38 additions & 5 deletions src/generated/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,6 @@ export type KeysetInfoData = {
* Request Mint
*/

// pub struct RequestToMintFromEBillRequest {
// pub ebill_id: String,
// pub amount: Amount,
// }

export type RequestToMintRequest = {
ebill_id: string;
amount: number;
Expand All @@ -529,3 +524,41 @@ export type KeysetInfoData = {
query?: never;
url: '/v1/admin/treasury/debit/request_to_mint_from_ebill'
};

/**
* Node ID
*/

export type IdentityDetailRequest = {
};

export type IdentityDetailInfo = {
node_id: string;
name: string;
email: string | null;
bitcoin_public_key: string;
npub: string;
postal_address: PostalAddress | null;
date_of_birth: string | null;
country_of_birth: string | null;
city_of_birth: string | null;
identification_number: string | null;
profile_picture_file: string | null;
identity_document_file: string | null;
nostr_relays: Array<string>;
};

export type IdentityDetailResponse = {
/**
* Successful response
*/
200: IdentityDetailInfo;
};


export type IdentityDetailData = {
body?: never;
path?: never;
query?: never;
url: '/v1/admin/identity/detail'
};
91 changes: 75 additions & 16 deletions src/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PageTitle } from "@/components/PageTitle"
import { Skeleton } from "@/components/ui/skeleton"
// import { fetchInfo } from "@/lib/api"
// import { useSuspenseQuery } from "@tanstack/react-query"
import { identityDetail } from "@/generated/client/sdk.gen"
import { useSuspenseQuery } from "@tanstack/react-query"
import { Suspense } from "react"

function Loader() {
Expand All @@ -13,25 +13,84 @@ function Loader() {
}

function PageBody() {
// const { data } = []; useSuspenseQuery({
// queryKey: ["info"],
// queryFn: fetchInfo,
// })
const { data } = useSuspenseQuery({
queryKey: ["identity-detail"],
queryFn: async () => {
const response = await identityDetail()
return response.data
},
staleTime: Infinity,
gcTime: Infinity,
})

const data = {
name: "bcr-wdc-quote-service",
version: "0.1.0",
pubkey: "0283bf290884eed3a7ca2663fc0260de2e2064d6b355ea13f98dec004b7a7ead99",
if (!data) {
return <>No identity found</>
}

return (
<>
<div className="flex flex-col gap-0.5 bg-accent text-accent-foreground rounded-lg p-2 my-2">
<span className="font-bold">{data.name}</span>
<span className="text-sm font-mono text-accent-foreground/50">{data.version}</span>
<span className="text-sm font-mono">{data.pubkey}</span>
<div className="flex flex-col gap-4">
<div className="bg-card text-card-foreground rounded-lg border p-6">
<h3 className="text-lg font-semibold mb-4">Information</h3>
<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>
<span className="font-semibold text-base">{data.name}</span>
</div>
{data.email && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Email</span>
<span className="font-mono text-sm text-muted-foreground">{data.email}</span>
</div>
)}
{data.date_of_birth && (
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Date of Birth</span>
<span className="text-sm">{data.date_of_birth}</span>
</div>
)}
</div>
</div>
</>

<div className="bg-card text-card-foreground rounded-lg border p-6">
<h3 className="text-lg font-semibold mb-4">Keys</h3>
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Node ID</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">
{data.node_id}
</span>
</div>
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">
Bitcoin Public Key
</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">
{data.bitcoin_public_key}
</span>
</div>
<div className="flex flex-col gap-1">
<span className="text-xs text-muted-foreground uppercase tracking-wide font-medium">Nostr Public Key</span>
<span className="font-mono text-sm break-all bg-muted p-2 rounded text-muted-foreground">{data.npub}</span>
</div>
</div>
</div>

{data.postal_address && (
<div className="bg-card text-card-foreground rounded-lg border p-6">
<h3 className="text-lg font-semibold mb-4">Address</h3>
<div className="flex flex-col gap-1">
<div className="text-sm leading-relaxed">
<div className="font-medium">{data.postal_address.address}</div>
<div className="text-muted-foreground">
{data.postal_address.city}
{data.postal_address.zip && `, ${data.postal_address.zip}`}
</div>
<div className="text-muted-foreground">{data.postal_address.country}</div>
</div>
</div>
</div>
)}
</div>
)
}

Expand Down
Loading