forked from trezor/blockbook
/
ws_types.go
125 lines (104 loc) · 4.12 KB
/
ws_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
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
package server
import "encoding/json"
type WsReq struct {
ID string `json:"id"`
Method string `json:"method" ts_type:"'getAccountInfo' | 'getInfo' | 'getBlockHash'| 'getBlock' | 'getAccountUtxo' | 'getBalanceHistory' | 'getTransaction' | 'getTransactionSpecific' | 'estimateFee' | 'sendTransaction' | 'subscribeNewBlock' | 'unsubscribeNewBlock' | 'subscribeNewTransaction' | 'unsubscribeNewTransaction' | 'subscribeAddresses' | 'unsubscribeAddresses' | 'subscribeFiatRates' | 'unsubscribeFiatRates' | 'ping' | 'getCurrentFiatRates' | 'getFiatRatesForTimestamps' | 'getFiatRatesTickersList' | 'getMempoolFilters'"`
Params json.RawMessage `json:"params" ts_type:"any"`
}
type WsRes struct {
ID string `json:"id"`
Data interface{} `json:"data"`
}
type WsAccountInfoReq struct {
Descriptor string `json:"descriptor"`
Details string `json:"details,omitempty" ts_type:"'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txslight' | 'txs'"`
Tokens string `json:"tokens,omitempty" ts_type:"'derived' | 'used' | 'nonzero'"`
PageSize int `json:"pageSize,omitempty"`
Page int `json:"page,omitempty"`
FromHeight int `json:"from,omitempty"`
ToHeight int `json:"to,omitempty"`
ContractFilter string `json:"contractFilter,omitempty"`
SecondaryCurrency string `json:"secondaryCurrency,omitempty"`
Gap int `json:"gap,omitempty"`
}
type WsBackendInfo struct {
Version string `json:"version,omitempty"`
Subversion string `json:"subversion,omitempty"`
ConsensusVersion string `json:"consensus_version,omitempty"`
Consensus interface{} `json:"consensus,omitempty"`
}
type WsInfoRes struct {
Name string `json:"name"`
Shortcut string `json:"shortcut"`
Decimals int `json:"decimals"`
Version string `json:"version"`
BestHeight int `json:"bestHeight"`
BestHash string `json:"bestHash"`
Block0Hash string `json:"block0Hash"`
Testnet bool `json:"testnet"`
Backend WsBackendInfo `json:"backend"`
}
type WsBlockHashReq struct {
Height int `json:"height"`
}
type WsBlockHashRes struct {
Hash string `json:"hash"`
}
type WsBlockReq struct {
Id string `json:"id"`
PageSize int `json:"pageSize,omitempty"`
Page int `json:"page,omitempty"`
}
type WsAccountUtxoReq struct {
Descriptor string `json:"descriptor"`
}
type WsBalanceHistoryReq struct {
Descriptor string `json:"descriptor"`
From int64 `json:"from,omitempty"`
To int64 `json:"to,omitempty"`
Currencies []string `json:"currencies,omitempty"`
Gap int `json:"gap,omitempty"`
GroupBy uint32 `json:"groupBy,omitempty"`
}
type WsTransactionReq struct {
Txid string `json:"txid"`
}
type WsMempoolFiltersReq struct {
ScriptType string `json:"scriptType"`
FromTimestamp uint32 `json:"fromTimestamp"`
}
type WsTransactionSpecificReq struct {
Txid string `json:"txid"`
}
type WsEstimateFeeReq struct {
Blocks []int `json:"blocks,omitempty"`
Specific map[string]interface{} `json:"specific,omitempty" ts_type:"{conservative?: boolean;txsize?: number;from?: string;to?: string;data?: string;value?: string;}"`
}
type WsEstimateFeeRes struct {
FeePerTx string `json:"feePerTx,omitempty"`
FeePerUnit string `json:"feePerUnit,omitempty"`
FeeLimit string `json:"feeLimit,omitempty"`
}
type WsSendTransactionReq struct {
Hex string `json:"hex"`
}
type WsSubscribeAddressesReq struct {
Addresses []string `json:"addresses"`
}
type WsSubscribeFiatRatesReq struct {
Currency string `json:"currency,omitempty"`
Tokens []string `json:"tokens,omitempty"`
}
type WsCurrentFiatRatesReq struct {
Currencies []string `json:"currencies,omitempty"`
Token string `json:"token,omitempty"`
}
type WsFiatRatesForTimestampsReq struct {
Timestamps []int64 `json:"timestamps"`
Currencies []string `json:"currencies,omitempty"`
Token string `json:"token,omitempty"`
}
type WsFiatRatesTickersListReq struct {
Timestamp int64 `json:"timestamp,omitempty"`
Token string `json:"token,omitempty"`
}