-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathmessages-eos.proto
290 lines (259 loc) · 8.74 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
282
283
284
285
286
287
288
289
290
syntax = "proto2";
// Sugar for easier handling in Java
option java_package = "com.shapeshift.keepkey.lib.protobuf";
option java_outer_classname = "KeepKeyMessageEos";
enum EosPublicKeyKind {
EOS = 0;
EOS_K1 = 1;
EOS_R1 = 2;
}
/**
* 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
optional EosPublicKeyKind kind = 3; // format to display the pubkey in
}
/**
* Response: Contains an Eos public key derived from device private seed
* @end
*/
message EosPublicKey {
optional string wif_public_key = 1; // EOS pub key in Base58 encoding
optional 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'
optional bytes chain_id = 2; // 256-bit long chain id
optional EosTxHeader header = 3; // EOS transaction header
optional 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 {
}
/**
* Request: Next action data that needs to be uploaded
* @next EosTxActionRequest
* @next EosSignedTx
* @next Failure
*/
message EosTxActionAck {
optional 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 {
optional sint64 amount = 1 [jstype = JS_STRING];
optional uint64 symbol = 2 [jstype = JS_STRING]; // First 8-bits used for precission.
}
/**
* Structure representing action permission level
*/
message EosPermissionLevel {
optional uint64 actor = 1 [jstype = JS_STRING];
optional uint64 permission = 2 [jstype = JS_STRING];
}
/**
* Structure representing auth key
*/
message EosAuthorizationKey {
optional uint32 type = 1;
optional bytes key = 2;
optional uint32 weight = 3;
repeated uint32 address_n = 4;
}
/**
* Structure representing auth account
*/
message EosAuthorizationAccount {
optional EosPermissionLevel account = 1;
optional uint32 weight = 2;
}
/**
* Structure representing auth delays
*/
message EosAuthorizationWait {
optional uint32 wait_sec = 1;
optional uint32 weight = 2;
}
/**
* Structure representing authorization settings
*/
message EosAuthorization {
optional 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 {
optional uint64 account = 1 [jstype = JS_STRING]; // Contract name
optional uint64 name = 2 [jstype = JS_STRING]; // Action name
repeated EosPermissionLevel authorization = 3;
}
/**
* Structure representing transfer data structure
*/
message EosActionTransfer {
optional uint64 sender = 1 [jstype = JS_STRING]; // Asset sender
optional uint64 receiver = 2 [jstype = JS_STRING];
optional EosAsset quantity = 3;
optional string memo = 4;
}
/**
* Structure representing delegation data structure
*/
message EosActionDelegate {
optional uint64 sender = 1 [jstype = JS_STRING];
optional uint64 receiver = 2 [jstype = JS_STRING];
optional EosAsset net_quantity = 3; // Asset format '1.0000 EOS'
optional EosAsset cpu_quantity = 4; // Asset format '1.0000 EOS'
optional bool transfer = 5; // Transfer delegated tokens or not.
}
/**
* Structure representing the removal of delegated resources from `payer`
*/
message EosActionUndelegate {
optional uint64 sender = 1 [jstype = JS_STRING];
optional uint64 receiver = 2 [jstype = JS_STRING];
optional EosAsset net_quantity = 3; // Asset format '1.0000 EOS'
optional EosAsset cpu_quantity = 4; // Asset format '1.0000 EOS'
}
/**
* Structure representing fallbalck if undelegate wasnt executed automaticaly.
*/
message EosActionRefund {
optional uint64 owner = 1 [jstype = JS_STRING];
}
/**
* Structure representing buying RAM operation for EOS tokens
*/
message EosActionBuyRam {
optional uint64 payer = 1 [jstype = JS_STRING];
optional uint64 receiver = 2 [jstype = JS_STRING];
optional EosAsset quantity = 3; // Asset format '1.0000 EOS'
}
/**
* Structure representing buying bytes according to RAM market price.
*/
message EosActionBuyRamBytes {
optional uint64 payer = 1 [jstype = JS_STRING];
optional uint64 receiver = 2 [jstype = JS_STRING];
optional uint32 bytes = 3; // Number of bytes
}
/**
* Structure representing sell RAM
*/
message EosActionSellRam {
optional uint64 account = 1 [jstype = JS_STRING];
optional sint64 bytes = 2 [jstype = JS_STRING]; // Number of bytes
}
/**
* Structure representing voting. Currently, there could be up to 30 producers.
*/
message EosActionVoteProducer {
optional uint64 voter = 1 [jstype = JS_STRING]; // Voter account
optional uint64 proxy = 2 [jstype = JS_STRING]; // Proxy voter account
repeated uint64 producers = 3 [jstype = JS_STRING]; // List of producers
}
/**
* Structure representing update authorization.
*/
message EosActionUpdateAuth {
optional uint64 account = 1 [jstype = JS_STRING];
optional uint64 permission = 2 [jstype = JS_STRING];
optional uint64 parent = 3 [jstype = JS_STRING];
optional EosAuthorization auth = 4;
}
/**
* Structure representing delete authorization.
*/
message EosActionDeleteAuth {
optional uint64 account = 1 [jstype = JS_STRING];
optional uint64 permission = 2 [jstype = JS_STRING];
}
/**
* Structure representing link authorization to action.
*/
message EosActionLinkAuth {
optional uint64 account = 1 [jstype = JS_STRING];
optional uint64 code = 2 [jstype = JS_STRING];
optional uint64 type = 3 [jstype = JS_STRING];
optional uint64 requirement = 4 [jstype = JS_STRING];
}
/**
* Structure representing unlink authorization from action.
*/
message EosActionUnlinkAuth {
optional uint64 account = 1 [jstype = JS_STRING];
optional uint64 code = 2 [jstype = JS_STRING];
optional uint64 type = 3 [jstype = JS_STRING];
}
/**
* Structure representing creation of a new account.
*/
message EosActionNewAccount {
optional uint64 creator = 1 [jstype = JS_STRING];
optional uint64 name = 2 [jstype = JS_STRING];
optional EosAuthorization owner = 3;
optional EosAuthorization active = 4;
}
/**
* Structure representing actions not implemented above.
*/
message EosActionUnknown {
optional uint32 data_size = 1;
optional 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 {
optional uint32 signature_v = 1; // Computed signature (recovery parameter, limited to 31 or 32)
optional bytes signature_r = 2; // Computed signature R component (256 bit)
optional bytes signature_s = 3; // Computed signature S component (256 bit)
optional bytes hash = 4; // Hash
}