-
-
Notifications
You must be signed in to change notification settings - Fork 663
/
messages-stellar.proto
289 lines (264 loc) · 10.4 KB
/
messages-stellar.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
syntax = "proto2";
package hw.trezor.messages.stellar;
// Sugar for easier handling in Java
option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageStellar";
// https://github.com/stellar/stellar-core/blob/02d26858069de7c0eefe065056fb0a19bf72ea56/src/xdr/Stellar-ledger-entries.x#L25-L31
enum StellarAssetType {
NATIVE = 0;
ALPHANUM4 = 1;
ALPHANUM12 = 2;
}
/**
* Describes a Stellar asset
* @embed
*/
message StellarAsset {
required StellarAssetType type = 1;
optional string code = 2; // for non-native assets, string describing the code
optional string issuer = 3; // issuing address
}
/**
* Request: Address at the specified index
* @start
* @next StellarAddress
*/
message StellarGetAddress {
repeated uint32 address_n = 1; // BIP-32 path. For compatibility with other wallets, must be m/44'/148'/index'
optional bool show_display = 2; // optionally show on display before sending the result
optional bool chunkify = 3; // display the address in chunks of 4 characters
}
/**
* Response: Address for the given index
* @end
*/
message StellarAddress {
required string address = 1; // Address in Stellar format (base32 of a pubkey with checksum)
}
/**
* Request: ask device to sign Stellar transaction
* @start
* @next StellarTxOpRequest
*/
message StellarSignTx {
repeated uint32 address_n = 2; // BIP-32 path. For compatibility with other wallets, must be m/44'/148'/index'
required string network_passphrase = 3; // passphrase for signing messages on the destination network
required string source_account = 4; // source account address
required uint32 fee = 5; // Fee (in stroops) for the transaction
required uint64 sequence_number = 6; // transaction sequence number
required uint32 timebounds_start = 8; // unix timestamp (client must truncate this to 32 bytes)
required uint32 timebounds_end = 9; // unix timestamp (client must truncate this to 32 bytes)
required StellarMemoType memo_type = 10; // type of memo attached to the transaction
optional string memo_text = 11; // up to 28 characters (4 bytes are for length)
optional uint64 memo_id = 12; // 8-byte uint64
optional bytes memo_hash = 13; // 32 bytes representing a hash
required uint32 num_operations = 14; // number of operations in this transaction
// https://github.com/stellar/stellar-core/blob/02d26858069de7c0eefe065056fb0a19bf72ea56/src/xdr/Stellar-transaction.x#L506-L513
enum StellarMemoType {
NONE = 0;
TEXT = 1;
ID = 2;
HASH = 3;
RETURN = 4;
}
}
/**
* Response: device is ready for client to send the next operation
* @next StellarPaymentOp
* @next StellarCreateAccountOp
* @next StellarPathPaymentStrictReceiveOp
* @next StellarPathPaymentStrictSendOp
* @next StellarManageSellOfferOp
* @next StellarManageBuyOfferOp
* @next StellarCreatePassiveSellOfferOp
* @next StellarSetOptionsOp
* @next StellarChangeTrustOp
* @next StellarAllowTrustOp
* @next StellarAccountMergeOp
* @next StellarManageDataOp
* @next StellarBumpSequenceOp
*/
message StellarTxOpRequest {
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarPaymentOp {
optional string source_account = 1; // (optional) source account address
required string destination_account = 2; // destination account address
required StellarAsset asset = 3; // asset involved in the operation
required sint64 amount = 4; // amount of the given asset to pay
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarCreateAccountOp {
optional string source_account = 1; // (optional) source account address
required string new_account = 2; // account address to create
required sint64 starting_balance = 3; // initial starting balance for the new account
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarPathPaymentStrictReceiveOp {
optional string source_account = 1; // (optional) source address
required StellarAsset send_asset = 2; // asset we pay with
required sint64 send_max = 3; // the maximum amount of sendAsset to send (excluding fees)
required string destination_account = 4; // recipient of the payment
required StellarAsset destination_asset = 5; // what they end up with
required sint64 destination_amount = 6; // amount they end up with
repeated StellarAsset paths = 7; // additional hops it must go through to get there
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarPathPaymentStrictSendOp {
optional string source_account = 1; // (optional) source address
required StellarAsset send_asset = 2; // asset we pay with
required sint64 send_amount = 3; // amount of sendAsset to send (excluding fees)
required string destination_account = 4; // recipient of the payment
required StellarAsset destination_asset = 5; // what they end up with
required sint64 destination_min = 6; // the minimum amount of dest asset to be received
repeated StellarAsset paths = 7; //additional hops it must go through to get there
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarManageSellOfferOp {
optional string source_account = 1; // (optional) source account address
required StellarAsset selling_asset = 2;
required StellarAsset buying_asset = 3;
required sint64 amount = 4;
required uint32 price_n = 5; // Price numerator
required uint32 price_d = 6; // Price denominator
required uint64 offer_id = 7; // Offer ID for updating an existing offer
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarManageBuyOfferOp {
optional string source_account = 1; // (optional) source account address
required StellarAsset selling_asset = 2;
required StellarAsset buying_asset = 3;
required sint64 amount = 4;
required uint32 price_n = 5; // Price numerator
required uint32 price_d = 6; // Price denominator
required uint64 offer_id = 7; // Offer ID for updating an existing offer
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarCreatePassiveSellOfferOp {
optional string source_account = 1; // (optional) source account address
required StellarAsset selling_asset = 2;
required StellarAsset buying_asset = 3;
required sint64 amount = 4;
required uint32 price_n = 5; // Price numerator
required uint32 price_d = 6; // Price denominator
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarSetOptionsOp {
optional string source_account = 1; // (optional) source account address
optional string inflation_destination_account = 2; // (optional) inflation destination address
optional uint32 clear_flags = 3;
optional uint32 set_flags = 4;
optional uint32 master_weight = 5;
optional uint32 low_threshold = 6;
optional uint32 medium_threshold = 7;
optional uint32 high_threshold = 8;
optional string home_domain = 9;
optional StellarSignerType signer_type = 10;
optional bytes signer_key = 11;
optional uint32 signer_weight = 12;
// https://github.com/stellar/stellar-core/blob/02d26858069de7c0eefe065056fb0a19bf72ea56/src/xdr/Stellar-types.x#L32-L37
enum StellarSignerType {
ACCOUNT = 0;
PRE_AUTH = 1;
HASH = 2;
}
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarChangeTrustOp {
optional string source_account = 1; // (optional) source account address
required StellarAsset asset = 2;
required uint64 limit = 3;
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarAllowTrustOp {
optional string source_account = 1; // (optional) source account address
required string trusted_account = 2; // The account being allowed to hold the asset
required StellarAssetType asset_type = 3;
optional string asset_code = 4; // human-readable asset code
required bool is_authorized = 5;
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarAccountMergeOp {
optional string source_account = 1; // (optional) source account address
required string destination_account = 2; // destination account address
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarManageDataOp {
optional string source_account = 1; // (optional) source account address
required string key = 2;
optional bytes value = 3; // 64 bytes of arbitrary data
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarBumpSequenceOp {
optional string source_account = 1; // (optional) source account address
required uint64 bump_to = 2; // new sequence number
}
/**
* Request: ask device to confirm this operation type
* @next StellarTxOpRequest
* @next StellarSignedTx
*/
message StellarClaimClaimableBalanceOp {
optional string source_account = 1; // (optional) source account address
required bytes balance_id = 2; // balance id, 4 bytes of type flag, 32 bytes of data
}
/**
* Response: signature for transaction
* @end
*/
message StellarSignedTx {
required bytes public_key = 1; // public key for the private key used to sign data
required bytes signature = 2; // signature suitable for sending to the Stellar network
}