@@ -75,18 +75,6 @@ typedef enum eth_ui_type_e {
75
75
} eth_ui_type_t ;
76
76
77
77
78
- // Scratch objects and utilities available to the plugin READ-WRITE
79
- typedef struct ethPluginSharedRW_s {
80
- cx_sha3_t * sha3 ;
81
- } ethPluginSharedRW_t ;
82
-
83
-
84
- // Transaction data available to the plugin READ-ONLY
85
- typedef struct ethPluginSharedRO_s {
86
- txContent_t * txContent ;
87
- } ethPluginSharedRO_t ;
88
-
89
-
90
78
// Plugin-only memory allocated by the Ethereum application and used by the plugin.
91
79
#define PLUGIN_CONTEXT_SIZE (5 * INT256_LENGTH)
92
80
// It is recommended to cast the raw uin8_t array to a structure meaningful for your plugin
@@ -106,30 +94,35 @@ typedef struct ethPluginSharedRO_s {
106
94
// Init Contract
107
95
108
96
typedef struct ethPluginInitContract_s {
97
+ // READ ONLY //
109
98
eth_plugin_interface_version_t interfaceVersion ;
110
- eth_plugin_result_t result ;
111
-
112
- // in
113
- ethPluginSharedRW_t * pluginSharedRW ;
114
- ethPluginSharedRO_t * pluginSharedRO ;
115
- uint8_t * pluginContext ;
99
+ const txContent_t * txContent ;
116
100
size_t pluginContextLength ;
117
101
const uint8_t * selector ; // 4 bytes selector
118
102
size_t dataSize ;
119
103
104
+ // READ WRITE //
105
+ uint8_t * pluginContext ;
106
+
107
+ // WRITE ONLY //
108
+ eth_plugin_result_t result ;
109
+
120
110
} ethPluginInitContract_t ;
121
111
// void handle_init_contract(ethPluginInitContract_t *parameters);
122
112
123
113
124
114
// Provide parameter
125
115
126
116
typedef struct ethPluginProvideParameter_s {
127
- ethPluginSharedRW_t * pluginSharedRW ;
128
- ethPluginSharedRO_t * pluginSharedRO ;
129
- uint8_t * pluginContext ; // PLUGIN_CONTEXT_SIZE
117
+ // READ ONLY //
118
+ const txContent_t * txContent ;
130
119
const uint8_t * parameter ; // 32 bytes parameter
131
120
uint32_t parameterOffset ;
132
121
122
+ // READ WRITE //
123
+ uint8_t * pluginContext ; // PLUGIN_CONTEXT_SIZE
124
+
125
+ // WRITE ONLY //
133
126
eth_plugin_result_t result ;
134
127
135
128
} ethPluginProvideParameter_t ;
@@ -139,19 +132,22 @@ typedef struct ethPluginProvideParameter_s {
139
132
// Finalize
140
133
141
134
typedef struct ethPluginFinalize_s {
142
- ethPluginSharedRW_t * pluginSharedRW ;
143
- ethPluginSharedRO_t * pluginSharedRO ;
144
- uint8_t * pluginContext ; // PLUGIN_CONTEXT_SIZE
135
+ // READ ONLY //
136
+ const txContent_t * txContent ;
145
137
146
- uint8_t * tokenLookup1 ; // set by the plugin if a token should be looked up
147
- uint8_t * tokenLookup2 ;
148
-
149
- const uint8_t * amount ; // set an uint256 pointer if uiType is UI_AMOUNT_ADDRESS
150
- const uint8_t * address ; // set to the destination address if uiType is UI_AMOUNT_ADDRESS. Set
151
- // to the user's address if uiType is UI_TYPE_GENERIC
138
+ // READ WRITE //
139
+ uint8_t * pluginContext ; // PLUGIN_CONTEXT_SIZE
152
140
141
+ // WRITE ONLY //
142
+ const uint8_t * tokenLookup1 ; // set by the plugin if a token should be looked up
143
+ const uint8_t * tokenLookup2 ;
153
144
eth_ui_type_t uiType ;
154
- uint8_t numScreens ; // ignored if uiType is UI_AMOUNT_ADDRESS
145
+ union {
146
+ const uint8_t * amount ; // set a pointer to the amount (in pluginContext) if uiType is UI_AMOUNT_ADDRESS
147
+ uint8_t numScreens ; // set the number of screens to query if uiType is UI_TYPE_GENERIC
148
+ };
149
+ const uint8_t * address ; // set a pointer to the destination address (in pluginContext) if uiType is UI_AMOUNT_ADDRESS. Set
150
+ // to the user's address if uiType is UI_TYPE_GENERIC
155
151
eth_plugin_result_t result ;
156
152
157
153
} ethPluginFinalize_t ;
@@ -161,16 +157,17 @@ typedef struct ethPluginFinalize_s {
161
157
// Provide token
162
158
163
159
typedef struct ethPluginProvideInfo_s {
164
- ethPluginSharedRW_t * pluginSharedRW ;
165
- ethPluginSharedRO_t * pluginSharedRO ;
166
- uint8_t * pluginContext ; // PLUGIN_CONTEXT_SIZE
167
-
160
+ // READ ONLY //
161
+ const txContent_t * txContent ;
168
162
union extraInfo_t * item1 ; // set by the ETH application, to be saved by the plugin
169
163
union extraInfo_t * item2 ;
170
164
165
+ // READ WRITE //
166
+ uint8_t * pluginContext ; // PLUGIN_CONTEXT_SIZE
167
+
168
+ // WRITE ONLY //
171
169
uint8_t additionalScreens ; // Used by the plugin if it needs to display additional screens
172
170
// based on the information received from the token definitions.
173
-
174
171
eth_plugin_result_t result ;
175
172
176
173
} ethPluginProvideInfo_t ;
@@ -182,15 +179,17 @@ typedef struct ethPluginProvideInfo_s {
182
179
// This is always called on the non aliased contract
183
180
184
181
typedef struct ethQueryContractID_s {
185
- ethPluginSharedRW_t * pluginSharedRW ;
186
- ethPluginSharedRO_t * pluginSharedRO ;
182
+ // READ ONLY //
183
+ const txContent_t * txContent ;
184
+ size_t nameLength ;
185
+ size_t versionLength ;
186
+
187
+ // READ WRITE //
187
188
uint8_t * pluginContext ; // PLUGIN_CONTEXT_SIZE
188
189
190
+ // WRITE ONLY //
189
191
char * name ;
190
- size_t nameLength ;
191
192
char * version ;
192
- size_t versionLength ;
193
-
194
193
eth_plugin_result_t result ;
195
194
196
195
} ethQueryContractID_t ;
@@ -200,19 +199,21 @@ typedef struct ethQueryContractID_s {
200
199
// Query Contract UI
201
200
202
201
typedef struct ethQueryContractUI_s {
203
- ethPluginSharedRW_t * pluginSharedRW ;
204
- ethPluginSharedRO_t * pluginSharedRO ;
202
+ // READ ONLY //
203
+ const txContent_t * txContent ;
205
204
union extraInfo_t * item1 ;
206
205
union extraInfo_t * item2 ;
207
206
char network_ticker [MAX_TICKER_LEN ];
208
- uint8_t * pluginContext ; // PLUGIN_CONTEXT_SIZE
209
207
uint8_t screenIndex ;
210
-
211
- char * title ;
212
208
size_t titleLength ;
213
- char * msg ;
214
209
size_t msgLength ;
215
210
211
+ // READ WRITE //
212
+ uint8_t * pluginContext ; // PLUGIN_CONTEXT_SIZE
213
+
214
+ // WRITE ONLY //
215
+ char * title ;
216
+ char * msg ;
216
217
eth_plugin_result_t result ;
217
218
218
219
} ethQueryContractUI_t ;
0 commit comments