This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alephium_model.go
156 lines (128 loc) · 3.69 KB
/
alephium_model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package alephium
import (
"fmt"
"math/big"
)
type WalletInfo struct {
Wallet `json:",inline"`
Locked bool `json:"locked"`
}
func (w WalletInfo) String() string {
return fmt.Sprintf("%s, %v", w.Name, w.Locked)
}
type ErrorDetail struct {
Resource string `json:"resource"`
Detail string `json:"detail"`
}
func (e ErrorDetail) Error() string {
return e.Detail
}
type WalletBalances struct {
TotalBalance ALPH `json:"totalBalance"`
Balances []AddressBalance `json:"balances"`
}
func (b WalletBalances) GetTotalBalance() (*big.Int, bool) {
if b.TotalBalance.Amount == nil {
return new(big.Int), true
}
return b.TotalBalance.Amount, true
}
type AddressBalance struct {
Address string `json:"address"`
Balance ALPH `json:"balance"`
}
func (b AddressBalance) GetBalance() (*big.Int, bool) {
return b.Balance.Amount, true
}
var WalletLockError = ErrorDetail{
Detail: "WalletInfo is locked",
}
type WalletCreate struct {
Wallet `json:",inline"`
Mnemonic string `json:"mnemonic"`
}
type WalletAddresses struct {
ActiveAddress string `json:"activeAddress"`
Addresses []WalletAddress `json:"addresses"`
}
type WalletAddress struct {
Address string `json:"address"`
Group int `json:"group"`
}
type Wallet struct {
Name string `json:"walletName"`
}
type MinersAddresses struct {
Addresses []string `json:"addresses"`
}
type InterCliquePeerInfo struct {
CliqueId string `json:"cliqueId"`
BrokerId int `json:"brokerId"`
GroupNumPerBroker int `json:"groupNumPerBroker"`
Address IPAndPort `json:"address"`
IsSynced bool `json:"isSynced"`
}
type IPAndPort struct {
Addr string `json:"addr"`
Port int `json:"port"`
}
type SelfCliqueInfo struct {
CliqueId string `json:"cliqueId"`
NetworkType string `json:"networkType"`
NumZerosAtLeastInHash int `json:"numZerosAtLeastInHash"`
Nodes []NodeAddress `json:"nodes"`
Synced bool `json:"synced"`
GroupNumPerBroker int `json:"groupNumPerBroker"`
Groups int `json:"groups"`
}
type NodeAddress struct {
Address string `json:"address"`
RestPort int `json:"restPort"`
WsPort int `json:"wsPort"`
}
type NodeInfo struct {
Version string `json:"version"`
BuildInfo struct {
ReleaseVersion string `json:"releaseVersion"`
Commit string `json:"commit"`
} `json:"buildInfo"`
}
type Transaction struct {
TransactionId string `json:"txId"`
FromGroup int `json:"fromGroup"`
ToGroup int `json:"toGroup"`
}
type Address struct {
Address string `json:"address"`
}
type TransactionStatus struct {
Type string `json:"type"`
BlockHash string `json:"blockHash"`
BlockIndex int `json:"blockIndex"`
ChainConfirmations int `json:"chainConfirmations"`
FromGroupConfirmations int `json:"fromGroupConfirmations"`
ToGroupConfirmations int `json:"toGroupConfirmations"`
}
type AddressUtxoBalance struct {
Balance ALPH `json:"balance"`
BalanceHint string `json:"balanceHint"`
LockedBalance ALPH `json:"lockedBalance"`
LockedBalanceHint string `json:"lockedBalanceHint"`
UtxoNum int `json:"utxoNum"`
}
type AddressGroup struct {
Group int `json:"group"`
}
type DiscoveredNeighbor struct {
CliqueId string `json:"cliqueId"`
BrokerId int `json:"brokerId"`
GroupNumPerBroker int `json:"groupNumPerBroker"`
}
type Misbehavior struct {
Peer string `json:"peer"`
Status MisbehaviorStatus `json:"status"`
}
type MisbehaviorStatus struct {
Type string `json:"type"`
Value int `json:"value"`
}