-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f1fea22
Showing
8 changed files
with
5,744 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Exchange communication | ||
* | ||
* @keepkey_version 2.0.0 | ||
*/ | ||
|
||
// Sugar for easier handling in Java | ||
option java_package = "com.keepkey.device-protocol"; | ||
option java_outer_classname = "KeepKeyExchange"; | ||
|
||
/** | ||
* Structure representing address for various coin types (BTC, LTC, and etc). | ||
* @used in ExchangeResponse | ||
*/ | ||
message ExchangeAddress { | ||
optional string coin_type = 1; | ||
optional string address = 2; | ||
optional string dest_tag = 3; | ||
optional string rs_address = 4; | ||
} | ||
|
||
/** | ||
* Structure representing exchange response version 2 | ||
*/ | ||
message ExchangeResponseV2 { | ||
optional ExchangeAddress deposit_address = 1; | ||
optional bytes deposit_amount = 2; | ||
optional int64 expiration = 3; | ||
optional bytes quoted_rate = 4; | ||
optional ExchangeAddress withdrawal_address = 5; | ||
optional bytes withdrawal_amount = 6; | ||
optional ExchangeAddress return_address = 7; | ||
optional bytes api_key = 8; | ||
optional bytes miner_fee = 9; | ||
optional bytes order_id = 10; | ||
} | ||
|
||
message SignedExchangeResponse { | ||
optional ExchangeResponse response = 1; /* deprecated - latest firmware version throws error if this field is used */ | ||
optional bytes signature = 2; | ||
optional ExchangeResponseV2 responseV2 = 3; | ||
} | ||
|
||
/** | ||
* Structure representing exchange response version 1 (deprecated) | ||
*/ | ||
message ExchangeResponse { | ||
optional ExchangeAddress deposit_address = 1; | ||
optional uint64 deposit_amount = 2; | ||
optional int64 expiration = 3; | ||
optional uint64 quoted_rate = 4; | ||
optional ExchangeAddress withdrawal_address = 5; | ||
optional uint64 withdrawal_amount = 6; | ||
optional ExchangeAddress return_address = 7; | ||
optional bytes api_key = 8; | ||
optional uint64 miner_fee = 9; | ||
optional bytes order_id = 10; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:generate protoc --go_out=import_path=keepkey:. types.proto exchange.proto messages.proto | ||
package keepkey | ||
|
||
import ( | ||
"reflect" | ||
|
||
"github.com/golang/protobuf/proto" | ||
) | ||
|
||
func Type(msg proto.Message) uint16 { | ||
return uint16(MessageType_value["MessageType_"+reflect.TypeOf(msg).Elem().Name()]) | ||
} | ||
|
||
func Name(kind uint16) string { | ||
return MessageType_name[int32(kind)] | ||
} |
Oops, something went wrong.