Skip to content

Commit 2bbb27c

Browse files
Merge pull request #14 from Nuklai/piotr-introduce-typescript
Introduce typescript
2 parents 753826c + 374df88 commit 2bbb27c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6707
-6688
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ go.work
2525
build/
2626
node_modules
2727
frontend/dist
28+
frontend/wailsjs
2829
.nuklai-wallet
2930
config.json.prod
31+
.yarn
32+
.pnp.loader.mjs
33+
.pnp.cjs

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cSpell.words": ["Nuklai"]
3+
}

backend/html.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ import (
1111

1212
// Inspiration: https://gist.github.com/inotnako/c4a82f6723f6ccea5d83c5d3689373dd
1313
type HTMLMeta struct {
14-
URL string
15-
Host string
16-
17-
SiteName string
18-
Title string
19-
Description string
20-
Image string
14+
URL string `json:"url"`
15+
Host string `json:"host"`
16+
SiteName string `json:"site_name"`
17+
Title string `json:"title"`
18+
Description string `json:"description"`
19+
Image string `json:"image"`
2120
}
2221

2322
func ParseHTML(url string, host string, resp io.Reader) *HTMLMeta {

backend/models.go

+64-75
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,26 @@ import (
99
)
1010

1111
type Alert struct {
12-
Type string
13-
Content string
12+
Type string `json:"type"`
13+
Content string `json:"content"`
1414
}
1515

1616
type AddressInfo struct {
17-
Name string
18-
Address string
19-
AddrStr string
17+
Name string `json:"name"`
18+
Address string `json:"address"`
19+
AddrStr string `json:"addrStr"`
2020
}
2121

2222
type TransactionInfo struct {
23-
ID string
24-
Size string
25-
Timestamp int64
26-
Actor string
27-
28-
Success bool
29-
Type string
30-
Units string
31-
Fee string
32-
Summary string
23+
ID string `json:"id"`
24+
Size string `json:"size"`
25+
Timestamp int64 `json:"timestamp"`
26+
Actor string `json:"actor"`
27+
Success bool `json:"success"`
28+
Type string `json:"type"`
29+
Units string `json:"units"`
30+
Fee string `json:"fee"`
31+
Summary string `json:"summary"`
3332
}
3433

3534
type TimeStat struct {
@@ -40,88 +39,78 @@ type TimeStat struct {
4039
}
4140

4241
type BlockInfo struct {
43-
Timestamp int64
44-
ID string
45-
Height uint64
46-
Size string
47-
TPS string
48-
Consumed string
49-
Prices string
50-
StateRoot string
51-
52-
Txs int
53-
FailTxs int
54-
55-
Latency int64
42+
ID string `json:"id"`
43+
Timestamp int64 `json:"timestamp"`
44+
Height uint64 `json:"height"`
45+
Size string `json:"size"`
46+
TPS string `json:"tps"`
47+
Consumed string `json:"consumed"`
48+
Prices string `json:"prices"`
49+
StateRoot string `json:"state_root"`
50+
Txs int `json:"txs"`
51+
FailTxs int `json:"fail_txs"`
52+
Latency int64 `json:"latency"`
5653
}
5754

5855
type GenericInfo struct {
59-
Timestamp int64
60-
Count uint64
61-
Category string
56+
Timestamp int64 `json:"timestamp"`
57+
Count uint64 `json:"count"`
58+
Category string `json:"category"`
6259
}
6360

6461
type AssetInfo struct {
65-
ID string
66-
67-
Symbol string
68-
Decimals int
69-
Metadata string
70-
Supply string
71-
Creator string
72-
StrSymbol string
62+
ID string `json:"id"`
63+
Symbol string `json:"symbol"`
64+
Decimals int `json:"decimals"`
65+
Metadata string `json:"metadata"`
66+
Supply string `json:"supply"`
67+
Creator string `json:"creator"`
68+
StrSymbol string `json:"strSymbol"`
7369
}
7470

7571
type BalanceInfo struct {
76-
ID string
77-
78-
Str string
79-
Bal string
80-
Has bool
72+
ID string `json:"id"`
73+
Str string `json:"str"`
74+
Bal string `json:"bal"`
75+
Has bool `json:"has"`
8176
}
8277

8378
type Transactions struct {
84-
Alerts []*Alert
85-
TxInfos []*TransactionInfo
79+
Alerts []*Alert `json:"alerts"`
80+
TxInfos []*TransactionInfo `json:"tx_infos"`
8681
}
8782

8883
type FaucetSearchInfo struct {
89-
FaucetAddress string
90-
Salt string
91-
Difficulty uint16
92-
93-
Solution string
94-
Attempts uint64
95-
Elapsed string
96-
97-
Amount string
98-
TxID string
99-
100-
Err string
84+
FaucetAddress string `json:"faucet_address"`
85+
Salt string `json:"salt"`
86+
Difficulty uint16 `json:"difficulty"`
87+
Solution string `json:"solution"`
88+
Attempts uint64 `json:"attempts"`
89+
Elapsed string `json:"elapsed"`
90+
Amount string `json:"amount"`
91+
TxID string `json:"tx_id"`
92+
Err string `json:"err"`
10193
}
10294

10395
type FaucetSolutions struct {
104-
Alerts []*Alert
105-
CurrentSearch *FaucetSearchInfo
106-
PastSearches []*FaucetSearchInfo
96+
Alerts []*Alert `json:"alerts"`
97+
CurrentSearch *FaucetSearchInfo `json:"current_search"`
98+
PastSearches []*FaucetSearchInfo `json:"past_searches"`
10799
}
108100

109101
type FeedInfo struct {
110-
Address string
111-
Fee string
102+
Address string `json:"address"`
103+
Fee string `json:"fee"`
112104
}
113105

114106
type FeedObject struct {
115-
SubnetID string
116-
ChainID string
117-
118-
Address string
119-
ID string
120-
Timestamp int64
121-
Fee string
122-
123-
Message string
124-
URL string
125-
126-
URLMeta *HTMLMeta
107+
ID string `json:"id"`
108+
SubnetID string `json:"subnet_id"`
109+
ChainID string `json:"chain_id"`
110+
Address string `json:"address"`
111+
Timestamp int64 `json:"timestamp"`
112+
Fee string `json:"fee"`
113+
Message string `json:"message"`
114+
URL string `json:"url"`
115+
URLMeta *HTMLMeta `json:"url_meta"`
127116
}

frontend/.yarnrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

frontend/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
</head>
88
<body>
99
<div id="root"></div>
10-
<script src="./src/main.jsx" type="module"></script>
10+
<script type="module" src="/src/main.tsx"></script>
1111
</body>
1212
</html>

0 commit comments

Comments
 (0)