2019-02-25 13:00:27 +00:00
|
|
|
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";
|
|
|
|
|
2021-12-08 09:10:58 +00:00
|
|
|
/** 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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2019-02-25 13:00:27 +00:00
|
|
|
/**
|
|
|
|
* 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
|
2023-09-14 10:19:14 +00:00
|
|
|
optional bool chunkify = 3; // display the address in chunks of 4 characters
|
2019-02-25 13:00:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: A Binance address.
|
|
|
|
* @end
|
|
|
|
*/
|
|
|
|
message BinanceAddress {
|
2021-01-14 11:05:03 +00:00
|
|
|
required string address = 1; // prefixed bech32 Binance address
|
2019-02-25 13:00:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 {
|
2021-01-14 11:05:03 +00:00
|
|
|
required bytes public_key = 1;
|
2019-02-25 13:00:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Starts the Binance transaction protocol flow.
|
2019-05-26 20:20:14 +00:00
|
|
|
* A transaction consists of these common fields and a series of Binance<Any>Msg messages.
|
2019-02-25 13:00:27 +00:00
|
|
|
* 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
|
2021-12-08 09:10:58 +00:00
|
|
|
required uint32 msg_count = 2; // count of Binance<Any>Msg to be included in this tx
|
|
|
|
required sint64 account_number = 3;
|
2019-02-25 13:00:27 +00:00
|
|
|
optional string chain_id = 4;
|
|
|
|
optional string memo = 5;
|
2021-12-08 09:10:58 +00:00
|
|
|
required sint64 sequence = 6;
|
|
|
|
required sint64 source = 7;
|
2023-09-14 10:19:14 +00:00
|
|
|
optional bool chunkify = 8; // display the address in chunks of 4 characters
|
2019-02-25 13:00:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 {
|
2019-03-13 15:59:26 +00:00
|
|
|
repeated BinanceInputOutput inputs = 1;
|
|
|
|
repeated BinanceInputOutput outputs = 2;
|
2023-09-14 10:19:14 +00:00
|
|
|
optional bool chunkify = 3; // display the address in chunks of 4 characters
|
2019-02-25 13:00:27 +00:00
|
|
|
|
2019-03-13 15:59:26 +00:00
|
|
|
message BinanceInputOutput {
|
2021-12-08 09:10:58 +00:00
|
|
|
required string address = 1;
|
2019-03-13 15:59:26 +00:00
|
|
|
repeated BinanceCoin coins = 2;
|
2019-02-25 13:00:27 +00:00
|
|
|
}
|
|
|
|
|
2019-03-13 15:59:26 +00:00
|
|
|
message BinanceCoin {
|
2021-12-08 09:10:58 +00:00
|
|
|
required sint64 amount = 1;
|
|
|
|
required string denom = 2;
|
2019-02-25 13:00:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask the device to include a Binance order msg in the tx.
|
|
|
|
* @next BinanceSignedTx
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message BinanceOrderMsg {
|
|
|
|
optional string id = 1;
|
2021-12-08 09:10:58 +00:00
|
|
|
required BinanceOrderType ordertype = 2;
|
|
|
|
required sint64 price = 3;
|
|
|
|
required sint64 quantity = 4;
|
2019-02-25 13:00:27 +00:00
|
|
|
optional string sender = 5;
|
2021-12-08 09:10:58 +00:00
|
|
|
required BinanceOrderSide side = 6;
|
2019-02-25 13:00:27 +00:00
|
|
|
optional string symbol = 7;
|
2021-12-08 09:10:58 +00:00
|
|
|
required BinanceTimeInForce timeinforce = 8;
|
2019-02-25 13:00:27 +00:00
|
|
|
|
2019-03-13 15:59:26 +00:00
|
|
|
enum BinanceOrderType {
|
2019-02-25 13:00:27 +00:00
|
|
|
OT_UNKNOWN = 0;
|
|
|
|
MARKET = 1;
|
|
|
|
LIMIT = 2;
|
|
|
|
OT_RESERVED = 3;
|
|
|
|
}
|
|
|
|
|
2019-03-13 15:59:26 +00:00
|
|
|
enum BinanceOrderSide {
|
2019-02-25 13:00:27 +00:00
|
|
|
SIDE_UNKNOWN = 0;
|
|
|
|
BUY = 1;
|
|
|
|
SELL = 2;
|
|
|
|
}
|
|
|
|
|
2019-03-13 15:59:26 +00:00
|
|
|
enum BinanceTimeInForce {
|
2019-02-25 13:00:27 +00:00
|
|
|
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 {
|
2021-01-14 11:05:03 +00:00
|
|
|
required bytes signature = 1;
|
|
|
|
required bytes public_key = 2;
|
2019-02-25 13:00:27 +00:00
|
|
|
}
|
|
|
|
|