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 "cx.h"
|
||||
#include "tokens.h"
|
||||
#include "shared_context.h"
|
||||
|
||||
/*************************************************************************************************
|
||||
* 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 <stdint.h>
|
||||
|
||||
#include "os.h"
|
||||
#include "cx.h"
|
||||
#include "ethUstream.h"
|
||||
#include "tokens.h"
|
||||
#include "extra_info.h"
|
||||
#include "tx_content.h"
|
||||
#include "chainConfig.h"
|
||||
#include "nft.h"
|
||||
#ifdef HAVE_NBGL
|
||||
@@ -13,8 +18,6 @@
|
||||
|
||||
#define MAX_BIP32_PATH 10
|
||||
|
||||
#define WEI_TO_ETHER 18
|
||||
|
||||
#define SELECTOR_LENGTH 4
|
||||
|
||||
#define PLUGIN_ID_LENGTH 30
|
||||
@@ -95,11 +98,6 @@ typedef struct publicKeyContext_t {
|
||||
bool getChaincode;
|
||||
} publicKeyContext_t;
|
||||
|
||||
typedef union extraInfo_t {
|
||||
tokenDefinition_t token;
|
||||
nftInfo_t nft;
|
||||
} extraInfo_t;
|
||||
|
||||
typedef struct transactionContext_t {
|
||||
bip32_path_t bip32;
|
||||
uint8_t hash[INT256_LENGTH];
|
||||
@@ -226,16 +224,6 @@ typedef enum {
|
||||
|
||||
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;
|
||||
#ifdef HAVE_STARKWARE
|
||||
extern bool quantumSet;
|
||||
@@ -244,8 +232,6 @@ extern bool quantumSet;
|
||||
extern uint32_t eth2WithdrawalIndex;
|
||||
#endif
|
||||
|
||||
extern caller_app_t *caller_app;
|
||||
|
||||
void reset_app_context(void);
|
||||
const uint8_t *parseBip32(const uint8_t *dataBuffer, uint8_t *dataLength, bip32_path_t *bip32);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "chainConfig.h"
|
||||
#include "shared_context.h"
|
||||
#include "stdint.h"
|
||||
#include "caller_api.h"
|
||||
|
||||
#define RUN_APPLICATION 1
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "cx.h"
|
||||
#include "uint256.h"
|
||||
|
||||
#define WEI_TO_ETHER 18
|
||||
|
||||
#define ADDRESS_LENGTH 20
|
||||
#define INT128_LENGTH 16
|
||||
#define INT256_LENGTH 32
|
||||
|
||||
Reference in New Issue
Block a user