-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
62 lines (51 loc) · 1.19 KB
/
types.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
package types
import (
"io"
"math/big"
"net/http"
)
type NodeInfo struct {
Version string `json:"version"`
Addresses map[string]string `json:"addresses"`
Gateway string `json:"gateway"`
}
type BalanceResponse struct {
Balance string `json:"balance"`
}
type TxToBalanceRequest struct {
TxId string `json:"tx_id"`
}
type TopUpConfirmationResponse struct {
Confirmed bool `json:"confirmed"`
}
type TopUpConfirmation struct {
Confirmed bool `json:"confirmed"`
Hash string `json:"hash"`
Balance *big.Int `json:"balance"`
}
type Transaction struct {
ID string `json:"id"`
Currency string `json:"currency"`
Address string `json:"address"`
Owner string `json:"owner"`
Signature string `json:"signature"`
Target string `json:"target"`
Tags []Tag `json:"tags"`
Anchor string `json:"anchor"`
DataSize string `json:"data_size"`
RawSize string `json:"raw_size"`
}
type File struct {
Data io.ReadCloser
Header http.Header
ContentLength int64
ContentType string
}
func (b BalanceResponse) ToBigInt() *big.Int {
bInt := new(big.Int)
n, ok := bInt.SetString(b.Balance, 10)
if !ok {
return bInt
}
return n
}