1syntax = "proto2"; 2 3// Sugar for easier handling in Java 4option java_package = "com.keepkey.deviceprotocol"; 5option java_outer_classname = "KeepKeyMessageBinance"; 6 7import "types.proto"; 8 9/** 10 * Request: Ask the device for a Binance address. 11 * @start 12 * @next BinanceAddress 13 * @next Failure 14 */ 15message BinanceGetAddress { 16 repeated uint32 address_n = 1; // BIP-32-style path to derive the key from master node 17 optional bool show_display = 2; // optionally prompt for confirmation on trezor display 18} 19 20/** 21 * Response: A Binance address. 22 * @end 23 */ 24message BinanceAddress { 25 optional string address = 1; // prefixed bech32 Binance address 26} 27 28/** 29 * Request: Ask device for a public key corresponding to address_n path. 30 * @start 31 * @next BinancePublicKey 32 */ 33message BinanceGetPublicKey { 34 repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node 35 optional bool show_display = 2; // optionally show on display before sending the result 36} 37 38/** 39 * Response: A public key corresponding to address_n path. 40 * @end 41 */ 42message BinancePublicKey { 43 optional bytes public_key = 1; 44} 45 46/** 47 * Request: Starts the Binance transaction protocol flow. 48 * A transaction consists of these common fields and a series of Binance<Any>Msg messages. 49 * These parts form a JSON structure (a string) in Trezor's memory, which is signed to produce a BinanceSignedTx. 50 * @start 51 * @next BinanceTxRequest 52 * @next Failure 53*/ 54message BinanceSignTx { 55 repeated uint32 address_n = 1; // BIP-32-style path to derive the key from master node 56 optional uint32 msg_count = 2; // count of Binance<Any>Msg to be included in this tx 57 optional sint64 account_number = 3 [jstype = JS_STRING]; 58 optional string chain_id = 4; 59 optional string memo = 5; 60 optional sint64 sequence = 6 [jstype = JS_STRING]; 61 optional sint64 source = 7 [jstype = JS_STRING]; 62} 63 64/** 65 * Response: Trezor requests the next message or signals that it is ready to send a BinanceSignedTx. 66 * @next BinanceTransferMsg 67 * @next BinanceOrderMsg 68 * @next BinanceCancelMsg 69 */ 70message BinanceTxRequest { 71} 72 73/** 74 * Request: Ask the device to include a Binance transfer msg in the tx. 75 * @next BinanceSignedTx 76 * @next Failure 77 */ 78message BinanceTransferMsg { 79 repeated BinanceInputOutput inputs = 1; 80 repeated BinanceInputOutput outputs = 2; 81 82 message BinanceInputOutput { 83 optional string address = 1; 84 repeated BinanceCoin coins = 2; 85 optional OutputAddressType address_type = 3; 86 optional ExchangeType exchange_type = 4; 87 } 88 89 message BinanceCoin { 90 optional sint64 amount = 1 [jstype = JS_STRING]; 91 optional string denom = 2; 92 } 93} 94 95/** 96 * Request: Ask the device to include a Binance order msg in the tx. 97 * @next BinanceSignedTx 98 * @next Failure 99 */ 100message BinanceOrderMsg { 101 optional string id = 1; 102 optional BinanceOrderType ordertype = 2; 103 optional sint64 price = 3 [jstype = JS_STRING]; 104 optional sint64 quantity = 4 [jstype = JS_STRING]; 105 optional string sender = 5; 106 optional BinanceOrderSide side = 6; 107 optional string symbol = 7; 108 optional BinanceTimeInForce timeinforce = 8; 109 110 enum BinanceOrderType { 111 OT_UNKNOWN = 0; 112 MARKET = 1; 113 LIMIT = 2; 114 OT_RESERVED = 3; 115 } 116 117 enum BinanceOrderSide { 118 SIDE_UNKNOWN = 0; 119 BUY = 1; 120 SELL = 2; 121 } 122 123 enum BinanceTimeInForce { 124 TIF_UNKNOWN = 0; 125 GTE = 1; 126 TIF_RESERVED = 2; 127 IOC = 3; 128 } 129} 130 131/** 132 * Request: Ask the device to include a Binance cancel msg in the tx. 133 * @next BinanceSignedTx 134 * @next Failure 135 */ 136message BinanceCancelMsg { 137 optional string refid = 1; 138 optional string sender = 2; 139 optional string symbol = 3; 140} 141 142/** 143 * Response: A transaction signature and public key corresponding to the address_n path in BinanceSignTx. 144 * @end 145 */ 146message BinanceSignedTx { 147 optional bytes signature = 1; 148 optional bytes public_key = 2; 149} 150 151