Skip to content

Commit 606c40c

Browse files
committed
chore: type response of info
1 parent 57cb0ad commit 606c40c

File tree

3 files changed

+84
-3
lines changed

3 files changed

+84
-3
lines changed

src/lib/api.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@ import { INFO } from "@/constants/endpoints";
22
import { apiFetch } from "@/utils/api";
33

44
export interface InfoResponse {
5-
version: string
5+
name?: string
6+
pubkey?: string
7+
version?: string
8+
description?: string
9+
description_long?: string
10+
"contact": {
11+
"method": string
12+
"info": string
13+
}[],
14+
motd?: string
15+
icon_url?: string
16+
urls?: string[],
17+
time?: number,
18+
nuts?: Record<string, {
19+
methods?: Record<string, unknown>[],
20+
disabled?: boolean
21+
supported?: boolean
22+
}>
623
}
724

825
export async function fetchInfo(): Promise<InfoResponse> {

src/mocks/handlers/info.ts

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,70 @@ export const fetchInfo = http.get<never, never, InfoResponse>(INFO, async () =>
66
await delay(1000)
77

88
return HttpResponse.json({
9-
version: '0.1.0-dev'
9+
"name": "Bob's Cashu mint",
10+
"pubkey": "0283bf290884eed3a7ca2663fc0260de2e2064d6b355ea13f98dec004b7a7ead99",
11+
"version": "Nutshell/0.15.0",
12+
"description": "The short mint description",
13+
"description_long": "A description that can be a long piece of text.",
14+
"contact": [
15+
{
16+
"method": "email",
17+
18+
},
19+
{
20+
"method": "twitter",
21+
"info": "@me"
22+
},
23+
{
24+
"method": "nostr",
25+
"info": "npub..."
26+
}
27+
],
28+
"motd": "Message to display to users.",
29+
"icon_url": "https://mint.host/icon.jpg",
30+
"urls": [
31+
"https://mint.host",
32+
"http://mint8gv0sq5ul602uxt2fe0t80e3c2bi9fy0cxedp69v1vat6ruj81wv.onion"
33+
],
34+
"time": 1725304480,
35+
"nuts": {
36+
"4": {
37+
"methods": [
38+
{
39+
"method": "bolt11",
40+
"unit": "sat",
41+
"min_amount": 0,
42+
"max_amount": 10000
43+
}
44+
],
45+
"disabled": false
46+
},
47+
"5": {
48+
"methods": [
49+
{
50+
"method": "bolt11",
51+
"unit": "sat",
52+
"min_amount": 100,
53+
"max_amount": 10000
54+
}
55+
],
56+
"disabled": false
57+
},
58+
"7": {
59+
"supported": true
60+
},
61+
"8": {
62+
"supported": true
63+
},
64+
"9": {
65+
"supported": true
66+
},
67+
"10": {
68+
"supported": true
69+
},
70+
"12": {
71+
"supported": true
72+
}
73+
}
1074
})
1175
})

src/pages/home/HomePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function HomePageBody() {
2323
return (
2424
<>
2525
<pre>
26-
{JSON.stringify(data)}
26+
{JSON.stringify(data, null, 2)}
2727
</pre>
2828
</>
2929
)

0 commit comments

Comments
 (0)