diff --git a/src/shared_context.h b/src/shared_context.h index c3d6cf6..40113d3 100644 --- a/src/shared_context.h +++ b/src/shared_context.h @@ -7,11 +7,9 @@ #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" +#include "asset_info.h" #ifdef HAVE_NBGL #include "nbgl_types.h" #endif diff --git a/src/swap_utils.c b/src/swap_utils.c index 8cc0054..2fa4a5a 100644 --- a/src/swap_utils.c +++ b/src/swap_utils.c @@ -19,7 +19,7 @@ #include #include -#include "tokens.h" +#include "asset_info.h" #include "swap_utils.h" bool parse_swap_config(const uint8_t *config, uint8_t config_len, char *ticker, uint8_t *decimals) { diff --git a/src_common/tokens.h b/src_common/asset_info.h similarity index 78% rename from src_common/tokens.h rename to src_common/asset_info.h index 9fd32df..a2ce393 100644 --- a/src_common/tokens.h +++ b/src_common/asset_info.h @@ -20,6 +20,17 @@ #include #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_ITEMS 2 @@ -31,3 +42,10 @@ typedef struct tokenDefinition_t { char ticker[MAX_TICKER_LEN]; uint8_t decimals; } tokenDefinition_t; + +// UNION + +typedef union extraInfo_t { + tokenDefinition_t token; + nftInfo_t nft; +} extraInfo_t; diff --git a/src_common/common_utils.c b/src_common/common_utils.c index 92debc6..84a424e 100644 --- a/src_common/common_utils.c +++ b/src_common/common_utils.c @@ -18,7 +18,7 @@ #include #include -#include "tokens.h" +#include "asset_info.h" #include "common_utils.h" void array_hexstr(char *strbuf, const void *bin, unsigned int len) { diff --git a/src_common/eth_plugin_interface.h b/src_common/eth_plugin_interface.h index 28fd9b5..9c93dfd 100644 --- a/src_common/eth_plugin_interface.h +++ b/src_common/eth_plugin_interface.h @@ -5,7 +5,7 @@ #include "os.h" #include "cx.h" -#include "tokens.h" +#include "asset_info.h" #include "tx_content.h" /************************************************************************************************* diff --git a/src_common/extra_info.h b/src_common/extra_info.h deleted file mode 100644 index 1221ef3..0000000 --- a/src_common/extra_info.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "tokens.h" -#include "nft.h" - -typedef union extraInfo_t { - tokenDefinition_t token; - nftInfo_t nft; -} extraInfo_t; diff --git a/src_common/nft.h b/src_common/nft.h deleted file mode 100644 index 6404dc4..0000000 --- a/src_common/nft.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include - -#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; diff --git a/src_features/provideNFTInformation/cmd_provideNFTInfo.c b/src_features/provideNFTInformation/cmd_provideNFTInfo.c index 3e82d57..5ddcf1e 100644 --- a/src_features/provideNFTInformation/cmd_provideNFTInfo.c +++ b/src_features/provideNFTInformation/cmd_provideNFTInfo.c @@ -2,7 +2,7 @@ #include "shared_context.h" #include "apdu_constants.h" -#include "tokens.h" +#include "asset_info.h" #include "common_utils.h" #include "common_ui.h" #include "os_io_seproxyhal.h" diff --git a/src_features/setPlugin/cmd_setPlugin.c b/src_features/setPlugin/cmd_setPlugin.c index 9575eb3..f28c843 100644 --- a/src_features/setPlugin/cmd_setPlugin.c +++ b/src_features/setPlugin/cmd_setPlugin.c @@ -1,6 +1,6 @@ #include "shared_context.h" #include "apdu_constants.h" -#include "tokens.h" +#include "asset_info.h" #include "eth_plugin_interface.h" #include "eth_plugin_internal.h" #include "plugin_utils.h" diff --git a/src_plugins/erc1155/erc1155_plugin.h b/src_plugins/erc1155/erc1155_plugin.h index eb174bd..a60dab6 100644 --- a/src_plugins/erc1155/erc1155_plugin.h +++ b/src_plugins/erc1155/erc1155_plugin.h @@ -7,7 +7,7 @@ #include #include "ethUstream.h" #include "uint256.h" -#include "nft.h" +#include "asset_info.h" // Internal plugin for EIP 1155: https://eips.ethereum.org/EIPS/eip-1155 diff --git a/src_plugins/erc721/erc721_plugin.h b/src_plugins/erc721/erc721_plugin.h index 62870fa..685c5e9 100644 --- a/src_plugins/erc721/erc721_plugin.h +++ b/src_plugins/erc721/erc721_plugin.h @@ -6,7 +6,7 @@ #include #include #include "ethUstream.h" -#include "nft.h" +#include "asset_info.h" // Internal plugin for EIP 721: https://eips.ethereum.org/EIPS/eip-721 diff --git a/tools/build_sdk.py b/tools/build_sdk.py index bf11995..746e0f2 100755 --- a/tools/build_sdk.py +++ b/tools/build_sdk.py @@ -154,12 +154,10 @@ if __name__ == "__main__": # some nodes will be extracted from these headers and merged into a new # one, copied to sdk headers_to_merge = [ - "src_common/tokens.h", + "src_common/asset_info.h", "src_common/common_utils.h", "src_common/tx_content.h", "src_common/plugin_utils.h", - "src_common/nft.h", - "src_common/extra_info.h", "src_common/caller_api.h", ] nodes_to_extract = {