Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.1.0

* Initial version

# 0.1.1

* Add request to pay eBill button
* Display Node ID on Home
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'
};
95 changes: 79 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,88 @@
}

function PageBody() {
// const { data } = []; useSuspenseQuery({
// queryKey: ["info"],
// queryFn: fetchInfo,
// })
const { data } = useSuspenseQuery({
queryKey: ["identity-detail"],
queryFn: async () => {
const response = await identityDetail()
return response.data ?? null
},
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 (
<div className="bg-card text-card-foreground rounded-lg border p-6">
<div className="text-center text-muted-foreground">No identity found</div>
</div>

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

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L26 - L30 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 47 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L35-L47

Added lines #L35 - L47 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 53 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

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

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

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

View check run for this annotation

Codecov / codecov/patch

src/pages/home/HomePage.tsx#L55

Added line #L55 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 68 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L58 - L68 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 80 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L70 - L80 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 95 in src/pages/home/HomePage.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L82 - L95 were not covered by tests
)}
</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#L97

Added line #L97 was not covered by tests
)
}

Expand Down
Loading