forked from trezor/trezor-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
messages-eos.proto
281 lines (252 loc) · 8.4 KB
/
messages-eos.proto
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
syntax = "proto2";
package hw.trezor.messages.eos;
// Sugar for easier handling in Java
option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageEos";
/**
* Request: Ask device for Eos public key corresponding to address_n path
* @start
* @next EosPublicKey
* @next Failure
*/
message EosGetPublicKey {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node 44'/194'/0'
optional bool show_display = 2; // optionally show on display before sending the result
}
/**
* Response: Contains an Eos public key derived from device private seed
* @end
*/
message EosPublicKey {
required string wif_public_key = 1; // EOS pub key in Base58 encoding
required bytes raw_public_key = 2; // Raw public key
}
/**
* Request: Ask device to sign transaction
* @start
* @next EosTxRequest
* @next Failure
*/
message EosSignTx {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node 44'/194'/0'
required bytes chain_id = 2; // 256-bit long chain id
required EosTxHeader header = 3; // EOS transaction header
required uint32 num_actions = 4; // number of actions
/**
* Structure representing EOS transaction header
*/
message EosTxHeader {
required uint32 expiration = 1; // time at which transaction expires
required uint32 ref_block_num = 2; // 16-bit specifies a block num in the last 2^16 blocks.
required uint32 ref_block_prefix = 3; // specifies the lower 32 bits of the blockid at get_ref_blocknum
required uint32 max_net_usage_words = 4; // upper limit on total network bandwidth (in 8 byte words) billed for this transaction
required uint32 max_cpu_usage_ms = 5; // 8-bit upper limit on the total CPU time billed for this transaction
required uint32 delay_sec = 6; // number of seconds to delay this transaction for during which it may be canceled.
}
}
/**
* Response: Device asks to upload next action
* @next EosTxActionAck
*/
message EosTxActionRequest {
optional uint32 data_size = 1;
}
/**
* Request: Next action data that needs to be uploaded
* @next EosTxActionRequest
* @next EosSignedTx
* @next Failure
*/
message EosTxActionAck {
required EosActionCommon common = 1;
optional EosActionTransfer transfer = 2;
optional EosActionDelegate delegate = 3;
optional EosActionUndelegate undelegate = 4;
optional EosActionRefund refund = 5;
optional EosActionBuyRam buy_ram = 6;
optional EosActionBuyRamBytes buy_ram_bytes = 7;
optional EosActionSellRam sell_ram = 8;
optional EosActionVoteProducer vote_producer = 9;
optional EosActionUpdateAuth update_auth = 10;
optional EosActionDeleteAuth delete_auth = 11;
optional EosActionLinkAuth link_auth = 12;
optional EosActionUnlinkAuth unlink_auth = 13;
optional EosActionNewAccount new_account = 14;
optional EosActionUnknown unknown = 15;
/**
* Structure representing asset type
*/
message EosAsset {
required sint64 amount = 1;
required uint64 symbol = 2; // Lowest 8 bits used for precision.
}
/**
* Structure representing action permission level
*/
message EosPermissionLevel {
required uint64 actor = 1;
required uint64 permission = 2;
}
/**
* Structure representing auth key
*/
message EosAuthorizationKey {
required uint32 type = 1;
optional bytes key = 2; // Explicit public key bytes; when present, address_n must be empty
repeated uint32 address_n = 3; // BIP-32 path to derive key; when filled out, key must not be present
required uint32 weight = 4;
}
/**
* Structure representing auth account
*/
message EosAuthorizationAccount {
required EosPermissionLevel account = 1;
required uint32 weight = 2;
}
/**
* Structure representing auth delays
*/
message EosAuthorizationWait {
required uint32 wait_sec = 1;
required uint32 weight = 2;
}
/**
* Structure representing authorization settings
*/
message EosAuthorization {
required uint32 threshold = 1;
repeated EosAuthorizationKey keys = 2;
repeated EosAuthorizationAccount accounts = 3;
repeated EosAuthorizationWait waits = 4;
}
/**
* Structure representing the common part of every action
*/
message EosActionCommon {
required uint64 account = 1; // Contract name
required uint64 name = 2; // Action name
repeated EosPermissionLevel authorization = 3;
}
/**
* Structure representing transfer data structure
*/
message EosActionTransfer {
required uint64 sender = 1; // Asset sender
required uint64 receiver = 2;
required EosAsset quantity = 3;
required string memo = 4;
}
/**
* Structure representing delegation data structure
*/
message EosActionDelegate {
required uint64 sender = 1;
required uint64 receiver = 2;
required EosAsset net_quantity = 3; // Asset format '1.0000 EOS'
required EosAsset cpu_quantity = 4; // Asset format '1.0000 EOS'
required bool transfer = 5; // Transfer delegated tokens or not.
}
/**
* Structure representing the removal of delegated resources from `sender`
*/
message EosActionUndelegate {
required uint64 sender = 1;
required uint64 receiver = 2;
required EosAsset net_quantity = 3; // Asset format '1.0000 EOS'
required EosAsset cpu_quantity = 4; // Asset format '1.0000 EOS'
}
/**
* Structure representing fallback if undelegate wasnt executed automaticaly.
*/
message EosActionRefund {
required uint64 owner = 1;
}
/**
* Structure representing buying RAM operation for EOS tokens
*/
message EosActionBuyRam {
required uint64 payer = 1;
required uint64 receiver = 2;
required EosAsset quantity = 3; // Asset format '1.0000 EOS'
}
/**
* Structure representing buying bytes according to RAM market price.
*/
message EosActionBuyRamBytes {
required uint64 payer = 1;
required uint64 receiver = 2;
required uint32 bytes = 3; // Number of bytes
}
/**
* Structure representing sell RAM
*/
message EosActionSellRam {
required uint64 account = 1;
required uint64 bytes = 2; // Number of bytes
}
/**
* Structure representing voting. Currently, there could be up to 30 producers.
*/
message EosActionVoteProducer {
required uint64 voter = 1; // Voter account
required uint64 proxy = 2; // Proxy voter account
repeated uint64 producers = 3; // List of producers
}
/**
* Structure representing update authorization.
*/
message EosActionUpdateAuth {
required uint64 account = 1;
required uint64 permission = 2;
required uint64 parent = 3;
required EosAuthorization auth = 4;
}
/**
* Structure representing delete authorization.
*/
message EosActionDeleteAuth {
required uint64 account = 1;
required uint64 permission = 2;
}
/**
* Structure representing link authorization to action.
*/
message EosActionLinkAuth {
required uint64 account = 1;
required uint64 code = 2;
required uint64 type = 3;
required uint64 requirement = 4;
}
/**
* Structure representing unlink authorization from action.
*/
message EosActionUnlinkAuth {
required uint64 account = 1;
required uint64 code = 2;
required uint64 type = 3;
}
/**
* Structure representing creation of a new account.
*/
message EosActionNewAccount {
required uint64 creator = 1;
required uint64 name = 2;
required EosAuthorization owner = 3;
required EosAuthorization active = 4;
}
/**
* Structure representing actions not implemented above.
*/
message EosActionUnknown {
required uint32 data_size = 1;
required bytes data_chunk = 2;
}
}
/**
* Response: Device returns the signature.
* The signature_* fields contain the computed transaction signature. All three fields will be present.
* @end
*/
message EosSignedTx {
required string signature = 1; // Computed signature
}