forked from trezor/trezor-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
messages-binance.proto
155 lines (135 loc) · 3.92 KB
/
messages-binance.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
syntax = "proto2";
package hw.trezor.messages.binance;
// Sugar for easier handling in Java
option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageBinance";
/** XXX
Most likely, ALL fields in this file should be `required`. We are leaving some optionals
in place, in cases where the field value continues to the JSON as a string -- on the off
chance that somebody is relying on the behavior.
*/
/**
* Request: Ask the device for a Binance address.
* @start
* @next BinanceAddress
* @next Failure
*/
message BinanceGetAddress {
repeated uint32 address_n = 1; // BIP-32-style path to derive the key from master node
optional bool show_display = 2; // optionally prompt for confirmation on trezor display
}
/**
* Response: A Binance address.
* @end
*/
message BinanceAddress {
required string address = 1; // prefixed bech32 Binance address
}
/**
* Request: Ask device for a public key corresponding to address_n path.
* @start
* @next BinancePublicKey
*/
message BinanceGetPublicKey {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional bool show_display = 2; // optionally show on display before sending the result
}
/**
* Response: A public key corresponding to address_n path.
* @end
*/
message BinancePublicKey {
required bytes public_key = 1;
}
/**
* Request: Starts the Binance transaction protocol flow.
* A transaction consists of these common fields and a series of Binance<Any>Msg messages.
* These parts form a JSON structure (a string) in Trezor's memory, which is signed to produce a BinanceSignedTx.
* @start
* @next BinanceTxRequest
* @next Failure
*/
message BinanceSignTx {
repeated uint32 address_n = 1; // BIP-32-style path to derive the key from master node
required uint32 msg_count = 2; // count of Binance<Any>Msg to be included in this tx
required sint64 account_number = 3;
optional string chain_id = 4;
optional string memo = 5;
required sint64 sequence = 6;
required sint64 source = 7;
}
/**
* Response: Trezor requests the next message or signals that it is ready to send a BinanceSignedTx.
* @next BinanceTransferMsg
* @next BinanceOrderMsg
* @next BinanceCancelMsg
*/
message BinanceTxRequest {
}
/**
* Request: Ask the device to include a Binance transfer msg in the tx.
* @next BinanceSignedTx
* @next Failure
*/
message BinanceTransferMsg {
repeated BinanceInputOutput inputs = 1;
repeated BinanceInputOutput outputs = 2;
message BinanceInputOutput {
required string address = 1;
repeated BinanceCoin coins = 2;
}
message BinanceCoin {
required sint64 amount = 1;
required string denom = 2;
}
}
/**
* Request: Ask the device to include a Binance order msg in the tx.
* @next BinanceSignedTx
* @next Failure
*/
message BinanceOrderMsg {
optional string id = 1;
required BinanceOrderType ordertype = 2;
required sint64 price = 3;
required sint64 quantity = 4;
optional string sender = 5;
required BinanceOrderSide side = 6;
optional string symbol = 7;
required BinanceTimeInForce timeinforce = 8;
enum BinanceOrderType {
OT_UNKNOWN = 0;
MARKET = 1;
LIMIT = 2;
OT_RESERVED = 3;
}
enum BinanceOrderSide {
SIDE_UNKNOWN = 0;
BUY = 1;
SELL = 2;
}
enum BinanceTimeInForce {
TIF_UNKNOWN = 0;
GTE = 1;
TIF_RESERVED = 2;
IOC = 3;
}
}
/**
* Request: Ask the device to include a Binance cancel msg in the tx.
* @next BinanceSignedTx
* @next Failure
*/
message BinanceCancelMsg {
optional string refid = 1;
optional string sender = 2;
optional string symbol = 3;
}
/**
* Response: A transaction signature and public key corresponding to the address_n path in BinanceSignTx.
* @end
*/
message BinanceSignedTx {
required bytes signature = 1;
required bytes public_key = 2;
}