Remove data needed by plugins from shared_context file
This commit is contained in:
34
src/caller_api.h
Normal file
34
src/caller_api.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Ledger Ethereum App
|
||||||
|
* (c) 2016-2019 Ledger
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef HAVE_NBGL
|
||||||
|
#include "ux.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum { CALLER_TYPE_CLONE, CALLER_TYPE_PLUGIN } e_caller_type;
|
||||||
|
|
||||||
|
typedef struct caller_app_t {
|
||||||
|
const char *name;
|
||||||
|
#ifdef HAVE_NBGL
|
||||||
|
const nbgl_icon_details_t *icon;
|
||||||
|
#endif
|
||||||
|
char type; // does not have to be set by the caller app
|
||||||
|
} caller_app_t;
|
||||||
|
|
||||||
|
extern caller_app_t *caller_app;
|
||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "cx.h"
|
#include "cx.h"
|
||||||
#include "tokens.h"
|
#include "tokens.h"
|
||||||
#include "shared_context.h"
|
|
||||||
|
|
||||||
/*************************************************************************************************
|
/*************************************************************************************************
|
||||||
* Comments provided in this file are quick reminders on the usage of the plugin interface *
|
* Comments provided in this file are quick reminders on the usage of the plugin interface *
|
||||||
|
|||||||
9
src/extra_info.h
Normal file
9
src/extra_info.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "tokens.h"
|
||||||
|
#include "nft.h"
|
||||||
|
|
||||||
|
typedef union extraInfo_t {
|
||||||
|
tokenDefinition_t token;
|
||||||
|
nftInfo_t nft;
|
||||||
|
} extraInfo_t;
|
||||||
@@ -3,8 +3,13 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "os.h"
|
||||||
|
#include "cx.h"
|
||||||
#include "ethUstream.h"
|
#include "ethUstream.h"
|
||||||
#include "tokens.h"
|
#include "tokens.h"
|
||||||
|
#include "extra_info.h"
|
||||||
|
#include "tx_content.h"
|
||||||
#include "chainConfig.h"
|
#include "chainConfig.h"
|
||||||
#include "nft.h"
|
#include "nft.h"
|
||||||
#ifdef HAVE_NBGL
|
#ifdef HAVE_NBGL
|
||||||
@@ -13,8 +18,6 @@
|
|||||||
|
|
||||||
#define MAX_BIP32_PATH 10
|
#define MAX_BIP32_PATH 10
|
||||||
|
|
||||||
#define WEI_TO_ETHER 18
|
|
||||||
|
|
||||||
#define SELECTOR_LENGTH 4
|
#define SELECTOR_LENGTH 4
|
||||||
|
|
||||||
#define PLUGIN_ID_LENGTH 30
|
#define PLUGIN_ID_LENGTH 30
|
||||||
@@ -95,11 +98,6 @@ typedef struct publicKeyContext_t {
|
|||||||
bool getChaincode;
|
bool getChaincode;
|
||||||
} publicKeyContext_t;
|
} publicKeyContext_t;
|
||||||
|
|
||||||
typedef union extraInfo_t {
|
|
||||||
tokenDefinition_t token;
|
|
||||||
nftInfo_t nft;
|
|
||||||
} extraInfo_t;
|
|
||||||
|
|
||||||
typedef struct transactionContext_t {
|
typedef struct transactionContext_t {
|
||||||
bip32_path_t bip32;
|
bip32_path_t bip32;
|
||||||
uint8_t hash[INT256_LENGTH];
|
uint8_t hash[INT256_LENGTH];
|
||||||
@@ -226,16 +224,6 @@ typedef enum {
|
|||||||
|
|
||||||
extern pluginType_t pluginType;
|
extern pluginType_t pluginType;
|
||||||
|
|
||||||
typedef enum { CALLER_TYPE_CLONE, CALLER_TYPE_PLUGIN } e_caller_type;
|
|
||||||
|
|
||||||
typedef struct caller_app_t {
|
|
||||||
const char *name;
|
|
||||||
#ifdef HAVE_NBGL
|
|
||||||
const nbgl_icon_details_t *icon;
|
|
||||||
#endif
|
|
||||||
char type; // does not have to be set by the caller app
|
|
||||||
} caller_app_t;
|
|
||||||
|
|
||||||
extern uint8_t appState;
|
extern uint8_t appState;
|
||||||
#ifdef HAVE_STARKWARE
|
#ifdef HAVE_STARKWARE
|
||||||
extern bool quantumSet;
|
extern bool quantumSet;
|
||||||
@@ -244,8 +232,6 @@ extern bool quantumSet;
|
|||||||
extern uint32_t eth2WithdrawalIndex;
|
extern uint32_t eth2WithdrawalIndex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern caller_app_t *caller_app;
|
|
||||||
|
|
||||||
void reset_app_context(void);
|
void reset_app_context(void);
|
||||||
const uint8_t *parseBip32(const uint8_t *dataBuffer, uint8_t *dataLength, bip32_path_t *bip32);
|
const uint8_t *parseBip32(const uint8_t *dataBuffer, uint8_t *dataLength, bip32_path_t *bip32);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "chainConfig.h"
|
#include "chainConfig.h"
|
||||||
#include "shared_context.h"
|
#include "shared_context.h"
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
#include "caller_api.h"
|
||||||
|
|
||||||
#define RUN_APPLICATION 1
|
#define RUN_APPLICATION 1
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
#include "cx.h"
|
#include "cx.h"
|
||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
|
|
||||||
|
#define WEI_TO_ETHER 18
|
||||||
|
|
||||||
#define ADDRESS_LENGTH 20
|
#define ADDRESS_LENGTH 20
|
||||||
#define INT128_LENGTH 16
|
#define INT128_LENGTH 16
|
||||||
#define INT256_LENGTH 32
|
#define INT256_LENGTH 32
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "ui_signing.h"
|
#include "ui_signing.h"
|
||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
#include "domain_name.h"
|
#include "domain_name.h"
|
||||||
|
#include "caller_api.h"
|
||||||
#include "network_icons.h"
|
#include "network_icons.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "ui_nbgl.h"
|
#include "ui_nbgl.h"
|
||||||
#include "nbgl_use_case.h"
|
#include "nbgl_use_case.h"
|
||||||
#include "glyphs.h"
|
#include "glyphs.h"
|
||||||
|
#include "caller_api.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
|
|
||||||
char g_stax_shared_buffer[SHARED_BUFFER_SIZE] = {0};
|
char g_stax_shared_buffer[SHARED_BUFFER_SIZE] = {0};
|
||||||
|
|||||||
@@ -157,9 +157,10 @@ if __name__ == "__main__":
|
|||||||
"src/tokens.h",
|
"src/tokens.h",
|
||||||
"src/utils.h",
|
"src/utils.h",
|
||||||
"src/tx_content.h",
|
"src/tx_content.h",
|
||||||
"src/shared_context.h",
|
|
||||||
"src/eth_plugin_internal.h",
|
"src/eth_plugin_internal.h",
|
||||||
"src/nft.h",
|
"src/nft.h",
|
||||||
|
"src/extra_info.h",
|
||||||
|
"src/caller_api.h",
|
||||||
]
|
]
|
||||||
nodes_to_extract = {
|
nodes_to_extract = {
|
||||||
"#define": ["MAX_TICKER_LEN",
|
"#define": ["MAX_TICKER_LEN",
|
||||||
|
|||||||
Reference in New Issue
Block a user