forked from trezor/trezor-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
messages-nem.proto
201 lines (193 loc) · 9.15 KB
/
messages-nem.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
syntax = "proto2";
package hw.trezor.messages.nem;
// Sugar for easier handling in Java
option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageNem";
/**
* Request: Ask device for NEM address corresponding to address_n path
* @start
* @next NEMAddress
* @next Failure
*/
message NEMGetAddress {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional uint32 network = 2 [default=0x68]; // Network ID (0x68 = Mainnet, 0x98 = Testnet, 0x60 = Mijin)
optional bool show_display = 3; // Optionally show on display before sending the result
optional bool chunkify = 4; // display the address in chunks of 4 characters
}
/**
* Response: Contains NEM address derived from device private seed
* @end
*/
message NEMAddress {
required string address = 1; // NEM address in Base32 encoding
}
/**
* Request: Ask device to sign transaction
* @start
* @next NEMSignedTx
* @next Failure
*/
message NEMSignTx {
required NEMTransactionCommon transaction = 1; // Common part of transaction
optional NEMTransactionCommon multisig = 2; // Common part of inner transaction for multisig transactions
optional NEMTransfer transfer = 3; // Transfer transaction part
optional bool cosigning = 4; // Whether cosigning or initiating the multisig transaction
optional NEMProvisionNamespace provision_namespace = 5; // Provision namespace part
optional NEMMosaicCreation mosaic_creation = 6; // Mosaic definition creation part
optional NEMMosaicSupplyChange supply_change = 7; // Mosaic supply change part
optional NEMAggregateModification aggregate_modification = 8; // Aggregate modification part
optional NEMImportanceTransfer importance_transfer = 9; // Importance transfer part
optional bool chunkify = 10; // display the address in chunks of 4 characters
/**
* Structure representing the common part for NEM transactions
*/
message NEMTransactionCommon {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional uint32 network = 2 [default=0x68]; // Network ID (0x68 = Mainnet, 0x98 = Testnet, 0x60 = Mijin)
required uint32 timestamp = 3; // Number of seconds elapsed since the creation of the nemesis block
required uint64 fee = 4; // Fee for the transaction
required uint32 deadline = 5; // Deadline of the transaction
optional bytes signer = 6; // Public key of the account (for multisig transactions)
}
/**
* Structure representing the transfer transaction part for NEM transactions
*/
message NEMTransfer {
required string recipient = 1; // Address of the recipient
required uint64 amount = 2; // Amount of micro NEM that is transferred
optional bytes payload = 3; // Actual message data (unencrypted)
optional bytes public_key = 4; // Public key of the recipient (for encrypted payloads)
repeated NEMMosaic mosaics = 5; // Attached mosaics
/**
* Structure representing the mosaic attachment for NEM transfer transactions
*/
message NEMMosaic {
required string namespace = 1; // Fully qualified name of the namespace
required string mosaic = 2; // Name of the mosaic definition
required uint64 quantity = 3; // Mosaic quantity, always given in smallest units
}
}
/**
* Structure representing the provision namespace part for NEM transactions
*/
message NEMProvisionNamespace {
required string namespace = 1; // New part concatenated to the parent
optional string parent = 2; // Parent namespace (for child namespaces)
required string sink = 3; // Rental fee sink address
required uint64 fee = 4; // Rental fee
}
/**
* Structure representing the mosaic definition creation part for NEM transactions
*/
message NEMMosaicCreation {
required NEMMosaicDefinition definition = 1; // Mosaic definition
required string sink = 2; // Creation fee sink address
required uint64 fee = 3; // Creation fee
/**
* Structure representing a mosaic definition
*/
message NEMMosaicDefinition {
optional string name = 1; // User-friendly name of the mosaic (for whitelisted mosaics)
optional string ticker = 2; // Ticker of the mosaic (for whitelisted mosaics)
required string namespace = 3; // Fully qualified name of the namespace
required string mosaic = 4; // Name of the mosaic definition
optional uint32 divisibility = 5; // Number of decimal places that a mosaic can be divided into
optional NEMMosaicLevy levy = 6; // Levy type
optional uint64 fee = 7; // Levy fee (interpretation depends on levy type)
optional string levy_address = 8; // Levy address
optional string levy_namespace = 9; // Fully qualified name of the namespace of the levy mosaic
optional string levy_mosaic = 10; // Name of the levy mosaic
optional uint64 supply = 11; // Initial supply to create, always given in entire units
optional bool mutable_supply = 12; // Mutable supply
optional bool transferable = 13; // Mosaic allows transfers among accounts other than the creator
required string description = 14; // Mosaic description
repeated uint32 networks = 15; // Networks that the mosaic is valid on (for whitelisted mosaics)
/**
* Type of levy which will be used for mosaic
*/
enum NEMMosaicLevy {
MosaicLevy_Absolute = 1;
MosaicLevy_Percentile = 2;
}
}
}
/**
* Structure representing the mosaic supply change part for NEM transactions
*/
message NEMMosaicSupplyChange {
required string namespace = 1; // Fully qualified name of the namespace
required string mosaic = 2; // Name of the mosaic definition
required NEMSupplyChangeType type = 3; // Type of supply change
required uint64 delta = 4; // Supply delta
/**
* Type of supply change which will be applied to mosaic
*/
enum NEMSupplyChangeType {
SupplyChange_Increase = 1;
SupplyChange_Decrease = 2;
}
}
/**
* Structure representing the aggregate modification part for NEM transactions
*/
message NEMAggregateModification {
repeated NEMCosignatoryModification modifications = 1; // Cosignatory modifications
optional sint32 relative_change = 2; // Relative change of the minimum cosignatories
/**
* Structure representing the cosignatory modification for aggregate modification transactions
*/
message NEMCosignatoryModification {
required NEMModificationType type = 1; // Type of cosignatory modification
required bytes public_key = 2; // Public key of the cosignatory
/**
* Type of cosignatory modification
*/
enum NEMModificationType {
CosignatoryModification_Add = 1;
CosignatoryModification_Delete = 2;
}
}
}
/**
* Structure representing the importance transfer part for NEM transactions
*/
message NEMImportanceTransfer {
required NEMImportanceTransferMode mode = 1; // Mode of importance transfer
required bytes public_key = 2; // Public key of the remote account
/**
* Mode of importance transfer
*/
enum NEMImportanceTransferMode {
ImportanceTransfer_Activate = 1;
ImportanceTransfer_Deactivate = 2;
}
}
}
/**
* Response: Contains NEM transaction data and signature
* @end
*/
message NEMSignedTx {
required bytes data = 1; // Transaction data
required bytes signature = 2; // Signature for the transaction
}
/**
* Request: Ask device to decrypt NEM transaction payload
* @start
* @next NEMDecryptedMessage
* @next Failure
*/
message NEMDecryptMessage {
repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
optional uint32 network = 2; // Network ID (0x68 = Mainnet, 0x98 = Testnet, 0x60 = Mijin)
optional bytes public_key = 3; // Public key of the other party
optional bytes payload = 4; // Actual message data (encrypted)
}
/**
* Response: Contains decrypted NEM transaction payload
* @end
*/
message NEMDecryptedMessage {
required bytes payload = 1; // Actual message data (unencrypted)
}