mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-27 02:12:35 +00:00
Add Binance Chain (#264)
This commit is contained in:
parent
cb238cb1f1
commit
1b12183d25
@ -186,6 +186,20 @@
|
|||||||
"wallet": {},
|
"wallet": {},
|
||||||
"blockchain_link": {}
|
"blockchain_link": {}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Binance Chain",
|
||||||
|
"shortcut": "BNB",
|
||||||
|
"slip44": 714,
|
||||||
|
"curve": "secp256k1",
|
||||||
|
"decimals": 8,
|
||||||
|
"links": {
|
||||||
|
"Homepage": "https://binance.org"
|
||||||
|
},
|
||||||
|
"wallet": {
|
||||||
|
"Trust Wallet": "https://trustwallet.com"
|
||||||
|
},
|
||||||
|
"blockchain_link": {}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Tether",
|
"name": "Tether",
|
||||||
"shortcut": "USDT",
|
"shortcut": "USDT",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
check: messages.pb messages-bitcoin.pb messages-bootloader.pb messages-cardano.pb messages-common.pb messages-crypto.pb messages-debug.pb messages-ethereum.pb messages-lisk.pb messages-management.pb messages-monero.pb messages-nem.pb messages-ripple.pb messages-stellar.pb messages-tezos.pb messages-ontology.pb messages-tron.pb messages-eos.pb
|
check: messages.pb messages-binance.pb messages-bitcoin.pb messages-bootloader.pb messages-cardano.pb messages-common.pb messages-crypto.pb messages-debug.pb messages-ethereum.pb messages-lisk.pb messages-management.pb messages-monero.pb messages-nem.pb messages-ripple.pb messages-stellar.pb messages-tezos.pb messages-ontology.pb messages-tron.pb messages-eos.pb
|
||||||
|
|
||||||
%.pb: %.proto
|
%.pb: %.proto
|
||||||
protoc -I/usr/include -I. $< -o $@
|
protoc -I/usr/include -I. $< -o $@
|
||||||
|
151
protob/messages-binance.proto
Normal file
151
protob/messages-binance.proto
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
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";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 {
|
||||||
|
optional 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 {
|
||||||
|
optional 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
|
||||||
|
optional uint32 msg_count = 2; // count of Binance<Any>Msg to be included in this tx
|
||||||
|
optional sint64 account_number = 3;
|
||||||
|
optional string chain_id = 4;
|
||||||
|
optional string memo = 5;
|
||||||
|
optional sint64 sequence = 6;
|
||||||
|
optional 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 BinanceTxRequest
|
||||||
|
* @next BinanceSignedTx
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message BinanceTransferMsg {
|
||||||
|
repeated InputOutput inputs = 1;
|
||||||
|
repeated InputOutput outputs = 2;
|
||||||
|
|
||||||
|
message Coin {
|
||||||
|
optional sint64 amount = 1;
|
||||||
|
optional string denom = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message InputOutput {
|
||||||
|
optional string address = 1;
|
||||||
|
repeated Coin coins = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask the device to include a Binance order msg in the tx.
|
||||||
|
* @next BinanceTxRequest
|
||||||
|
* @next BinanceSignedTx
|
||||||
|
* @next Failure
|
||||||
|
*/
|
||||||
|
message BinanceOrderMsg {
|
||||||
|
optional string id = 1;
|
||||||
|
optional OrderType ordertype = 2;
|
||||||
|
optional sint64 price = 3;
|
||||||
|
optional sint64 quantity = 4;
|
||||||
|
optional string sender = 5;
|
||||||
|
optional OrderSide side = 6;
|
||||||
|
optional string symbol = 7;
|
||||||
|
optional TimeInForce timeinforce = 8;
|
||||||
|
|
||||||
|
enum OrderType {
|
||||||
|
OT_UNKNOWN = 0;
|
||||||
|
MARKET = 1;
|
||||||
|
LIMIT = 2;
|
||||||
|
OT_RESERVED = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum OrderSide {
|
||||||
|
SIDE_UNKNOWN = 0;
|
||||||
|
BUY = 1;
|
||||||
|
SELL = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TimeInForce {
|
||||||
|
TIF_UNKNOWN = 0;
|
||||||
|
GTE = 1;
|
||||||
|
TIF_RESERVED = 2;
|
||||||
|
IOC = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request: Ask the device to include a Binance cancel msg in the tx.
|
||||||
|
* @next BinanceTxRequest
|
||||||
|
* @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 {
|
||||||
|
optional bytes signature = 1;
|
||||||
|
optional bytes public_key = 2;
|
||||||
|
optional string json = 3;
|
||||||
|
}
|
||||||
|
|
@ -245,4 +245,16 @@ enum MessageType {
|
|||||||
MessageType_EosTxActionRequest = 603 [(wire_out) = true];
|
MessageType_EosTxActionRequest = 603 [(wire_out) = true];
|
||||||
MessageType_EosTxActionAck = 604 [(wire_in) = true];
|
MessageType_EosTxActionAck = 604 [(wire_in) = true];
|
||||||
MessageType_EosSignedTx = 605 [(wire_out) = true];
|
MessageType_EosSignedTx = 605 [(wire_out) = true];
|
||||||
|
|
||||||
|
// Binance
|
||||||
|
MessageType_BinanceGetAddress = 700 [(wire_in) = true];
|
||||||
|
MessageType_BinanceAddress = 701 [(wire_out) = true];
|
||||||
|
MessageType_BinanceGetPublicKey = 702 [(wire_in) = true];
|
||||||
|
MessageType_BinancePublicKey = 703 [(wire_out) = true];
|
||||||
|
MessageType_BinanceSignTx = 704 [(wire_in) = true];
|
||||||
|
MessageType_BinanceTxRequest = 705 [(wire_out) = true];
|
||||||
|
MessageType_BinanceTransferMsg = 706 [(wire_in) = true];
|
||||||
|
MessageType_BinanceOrderMsg = 707 [(wire_in) = true];
|
||||||
|
MessageType_BinanceCancelMsg = 708 [(wire_in) = true];
|
||||||
|
MessageType_BinanceSignedTx = 709 [(wire_out) = true];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user