-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrpc_types.ts
221 lines (192 loc) · 5.03 KB
/
rpc_types.ts
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
export type AddressPrefix = "ban_" | "nano_";
export type Address = `${AddressPrefix}${string}`;
/** 32 byte block hash represented as 64 char hexadecimal */
export type BlockHash = string;
export type BlockStateChangeTypes = "send" | "receive";
export type BlockBasicTypes = BlockStateChangeTypes | "change";
export type BlockSubtype = BlockBasicTypes | "epoch";
export type BlockLegacyTypes = BlockBasicTypes | "open";
export type BlockAllTypes = BlockLegacyTypes | "state";
export interface BlockNoSignature {
type: BlockAllTypes;
account: Address;
previous: BlockHash;
representative: Address;
balance: `${number}`;
link: BlockHash;
link_as_account?: Address;
}
export interface Block extends BlockNoSignature {
signature: string;
work?: string;
}
export interface BlockCountRPC {
count: `${number}`;
unchecked: `${number}`;
cemented?: `${number}`;
}
export interface BlockInfoRPC {
block_account: Address;
amount: `${number}`;
balance: `${number}`;
height: `${number}`;
timestamp: `${number}`;
contents: Block;
//v19 or newer only
confirmed?: `${boolean}`;
subtype?: BlockSubtype; //for state blocks only
//v23 or newer only
successor?: `${string}`;
}
export interface BlocksRPC {
blocks: Record<BlockHash, Block>;
}
export interface BlocksInfoRPC {
blocks: Record<BlockHash, BlockInfoRPC>;
}
export interface RepresentativesRPC {
representatives: Record<Address, `${number}`>;
}
export interface RepresentativesOnlineRPC {
representatives: Address[];
}
export interface RepresentativesOnlineWeightRPC {
representatives: Record<Address, { weight: `${number}` }>;
}
export interface AccountHistoryBlock {
type: BlockStateChangeTypes;
account: Address;
amount: `${number}`;
local_timestamp: `${number}`;
height: `${number}`;
hash: BlockHash;
confirmed: boolean;
}
export interface AccountHistoryRawBlock {
account: Address;
amount: `${number}`;
amount_decimal: `${number}`;
balance: `${number}`;
balance_decimal: `${number}`;
confirmed: `${boolean}`;
hash: BlockHash;
height: `${number}`;
link: BlockHash;
local_timestamp: `${number}`;
previous: BlockHash;
representative: Address;
signature: string;
subtype: BlockSubtype;
type: BlockAllTypes;
work: string;
}
export interface AccountHistoryRPC {
account: Address;
history: AccountHistoryBlock[];
previous?: BlockHash;
}
export interface AccountHistoryRawRPC {
account: Address;
history: AccountHistoryRawBlock[];
previous?: BlockHash;
}
export interface AccountInfoRPC {
frontier: BlockHash;
open_block: BlockHash;
representative_block: BlockHash;
balance: `${number}`;
modified_timestamp: `${number}`;
block_count: `${number}`;
account_version: `${number}`;
confirmation_height?: `${number}`;
confirmation_height_frontier?: BlockHash;
representative?: Address;
weight?: `${number}`;
pending?: `${number}`;
receivable?: `${number}`;
confirmed_balance?: `${number}`;
confirmed_height?: `${number}`;
confirmed_frontier?: BlockHash;
confirmed_representative?: Address;
confirmed_receivable?: `${number}`;
confirmed_pending?: `${number}`;
}
export interface AccountBalanceRPC {
balance: `${number}`;
pending: `${number}`;
receivable?: `${number}`;
}
export interface AccountsBalancesRPC {
balances: Record<Address, AccountBalanceRPC>;
}
export interface AccountRepresentativeRPC {
representative: Address;
}
export interface AccountsRepresentativesRPC {
representatives: Record<Address, Address>;
}
export interface AccountWeightRPC {
weight: `${number}`;
}
export interface AccountReceivableRPC {
blocks: BlockHash[];
}
//doesn't happen if threshold is "0" for some reason. why, nano node rpc...
export interface AccountReceivableThresholdRPC {
blocks: Record<BlockHash, `${number}`>;
}
export interface AccountReceivableSourceRPC {
blocks: Record<
BlockHash,
{
amount: `${number}`;
source: Address;
}
>;
}
export interface DelegatorsRPC {
delegators: Record<Address, `${number}`>;
}
export interface DelegatorsCountRPC {
count: `${number}`;
}
export interface TelemetryRPC {
block_count: `${number}`;
cemented_count: `${number}`;
unchecked_count: `${number}`;
account_count: `${number}`;
bandwidth_cap: `${number}`;
peer_count: `${number}`;
protocol_version: `${number}`;
uptime: `${number}`;
genesis_block: BlockHash;
major_version: `${number}`;
minor_version: `${number}`;
patch_version: `${number}`;
pre_release_version: `${number}`;
maker: string;
timestamp: `${number}`;
active_difficulty: `${number}`;
node_id: string;
signature: string;
network_identifier: string;
}
export interface TelemetryAddressRPC extends TelemetryRPC {
signature: string;
node_id: string;
}
export interface TelemetryRawRPC extends TelemetryAddressRPC {
address: string;
port: `${number}`;
}
export interface VersionRPC {
rpc_version: `${number}`;
store_version: `${number}`;
protocol_version: `${number}`;
node_vendor: string;
store_vendor: string;
network: string;
network_identifier: string;
build_info: string;
}
//