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

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
}
});
};

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

View check run for this annotation

Codecov / codecov/patch

src/generated/client/sdk.gen.ts#L161-L170

Added lines #L161 - L170 were not covered by tests
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"

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

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L3-L4

Added lines #L3 - L4 were not covered by tests
import { Suspense } from "react"

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

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,
})

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

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L16-L24

Added lines #L16 - L24 were not covered by tests

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

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

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L26 - L27 were not covered by tests
}

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>

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

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L31-L43

Added lines #L31 - L43 were not covered by tests
)}
{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>

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

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L45-L49

Added lines #L45 - L49 were not covered by tests
)}
</div>

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

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L51

Added line #L51 was not covered by tests
</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">

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

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L54 - L64 were not covered by tests
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>

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

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L66 - L76 were not covered by tests

{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>

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

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L78-L91

Added lines #L78 - L91 were not covered by tests
)}
</div>

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

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L93

Added line #L93 was not covered by tests
)
}

Expand Down
Loading