Merge nft and tokens into a single asset header
This commit is contained in:
@@ -7,11 +7,9 @@
|
|||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "cx.h"
|
#include "cx.h"
|
||||||
#include "ethUstream.h"
|
#include "ethUstream.h"
|
||||||
#include "tokens.h"
|
|
||||||
#include "extra_info.h"
|
|
||||||
#include "tx_content.h"
|
#include "tx_content.h"
|
||||||
#include "chainConfig.h"
|
#include "chainConfig.h"
|
||||||
#include "nft.h"
|
#include "asset_info.h"
|
||||||
#ifdef HAVE_NBGL
|
#ifdef HAVE_NBGL
|
||||||
#include "nbgl_types.h"
|
#include "nbgl_types.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "tokens.h"
|
#include "asset_info.h"
|
||||||
#include "swap_utils.h"
|
#include "swap_utils.h"
|
||||||
|
|
||||||
bool parse_swap_config(const uint8_t *config, uint8_t config_len, char *ticker, uint8_t *decimals) {
|
bool parse_swap_config(const uint8_t *config, uint8_t config_len, char *ticker, uint8_t *decimals) {
|
||||||
|
|||||||
@@ -20,6 +20,17 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "common_utils.h"
|
#include "common_utils.h"
|
||||||
|
|
||||||
|
// NFT
|
||||||
|
|
||||||
|
#define COLLECTION_NAME_MAX_LEN 70
|
||||||
|
|
||||||
|
typedef struct nftInfo_t {
|
||||||
|
uint8_t contractAddress[ADDRESS_LENGTH]; // must be first item
|
||||||
|
char collectionName[COLLECTION_NAME_MAX_LEN + 1];
|
||||||
|
} nftInfo_t;
|
||||||
|
|
||||||
|
// TOKENS
|
||||||
|
|
||||||
#define MAX_TICKER_LEN 11 // 10 characters + '\0'
|
#define MAX_TICKER_LEN 11 // 10 characters + '\0'
|
||||||
#define MAX_ITEMS 2
|
#define MAX_ITEMS 2
|
||||||
|
|
||||||
@@ -31,3 +42,10 @@ typedef struct tokenDefinition_t {
|
|||||||
char ticker[MAX_TICKER_LEN];
|
char ticker[MAX_TICKER_LEN];
|
||||||
uint8_t decimals;
|
uint8_t decimals;
|
||||||
} tokenDefinition_t;
|
} tokenDefinition_t;
|
||||||
|
|
||||||
|
// UNION
|
||||||
|
|
||||||
|
typedef union extraInfo_t {
|
||||||
|
tokenDefinition_t token;
|
||||||
|
nftInfo_t nft;
|
||||||
|
} extraInfo_t;
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "tokens.h"
|
#include "asset_info.h"
|
||||||
#include "common_utils.h"
|
#include "common_utils.h"
|
||||||
|
|
||||||
void array_hexstr(char *strbuf, const void *bin, unsigned int len) {
|
void array_hexstr(char *strbuf, const void *bin, unsigned int len) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "cx.h"
|
#include "cx.h"
|
||||||
#include "tokens.h"
|
#include "asset_info.h"
|
||||||
#include "tx_content.h"
|
#include "tx_content.h"
|
||||||
|
|
||||||
/*************************************************************************************************
|
/*************************************************************************************************
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "tokens.h"
|
|
||||||
#include "nft.h"
|
|
||||||
|
|
||||||
typedef union extraInfo_t {
|
|
||||||
tokenDefinition_t token;
|
|
||||||
nftInfo_t nft;
|
|
||||||
} extraInfo_t;
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define COLLECTION_NAME_MAX_LEN 70
|
|
||||||
|
|
||||||
typedef struct nftInfo_t {
|
|
||||||
uint8_t contractAddress[ADDRESS_LENGTH]; // must be first item
|
|
||||||
char collectionName[COLLECTION_NAME_MAX_LEN + 1];
|
|
||||||
} nftInfo_t;
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "shared_context.h"
|
#include "shared_context.h"
|
||||||
#include "apdu_constants.h"
|
#include "apdu_constants.h"
|
||||||
#include "tokens.h"
|
#include "asset_info.h"
|
||||||
#include "common_utils.h"
|
#include "common_utils.h"
|
||||||
#include "common_ui.h"
|
#include "common_ui.h"
|
||||||
#include "os_io_seproxyhal.h"
|
#include "os_io_seproxyhal.h"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "shared_context.h"
|
#include "shared_context.h"
|
||||||
#include "apdu_constants.h"
|
#include "apdu_constants.h"
|
||||||
#include "tokens.h"
|
#include "asset_info.h"
|
||||||
#include "eth_plugin_interface.h"
|
#include "eth_plugin_interface.h"
|
||||||
#include "eth_plugin_internal.h"
|
#include "eth_plugin_internal.h"
|
||||||
#include "plugin_utils.h"
|
#include "plugin_utils.h"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "ethUstream.h"
|
#include "ethUstream.h"
|
||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
#include "nft.h"
|
#include "asset_info.h"
|
||||||
|
|
||||||
// Internal plugin for EIP 1155: https://eips.ethereum.org/EIPS/eip-1155
|
// Internal plugin for EIP 1155: https://eips.ethereum.org/EIPS/eip-1155
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "ethUstream.h"
|
#include "ethUstream.h"
|
||||||
#include "nft.h"
|
#include "asset_info.h"
|
||||||
|
|
||||||
// Internal plugin for EIP 721: https://eips.ethereum.org/EIPS/eip-721
|
// Internal plugin for EIP 721: https://eips.ethereum.org/EIPS/eip-721
|
||||||
|
|
||||||
|
|||||||
@@ -154,12 +154,10 @@ if __name__ == "__main__":
|
|||||||
# some nodes will be extracted from these headers and merged into a new
|
# some nodes will be extracted from these headers and merged into a new
|
||||||
# one, copied to sdk
|
# one, copied to sdk
|
||||||
headers_to_merge = [
|
headers_to_merge = [
|
||||||
"src_common/tokens.h",
|
"src_common/asset_info.h",
|
||||||
"src_common/common_utils.h",
|
"src_common/common_utils.h",
|
||||||
"src_common/tx_content.h",
|
"src_common/tx_content.h",
|
||||||
"src_common/plugin_utils.h",
|
"src_common/plugin_utils.h",
|
||||||
"src_common/nft.h",
|
|
||||||
"src_common/extra_info.h",
|
|
||||||
"src_common/caller_api.h",
|
"src_common/caller_api.h",
|
||||||
]
|
]
|
||||||
nodes_to_extract = {
|
nodes_to_extract = {
|
||||||
|
|||||||
Reference in New Issue
Block a user