Skip to content

Commit 5bf5023

Browse files
Merge nft and tokens into a single asset header
1 parent e64a04d commit 5bf5023

File tree

12 files changed

+27
-32
lines changed

12 files changed

+27
-32
lines changed

src/shared_context.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
#include "os.h"
88
#include "cx.h"
99
#include "ethUstream.h"
10-
#include "tokens.h"
11-
#include "extra_info.h"
1210
#include "tx_content.h"
1311
#include "chainConfig.h"
14-
#include "nft.h"
12+
#include "asset_info.h"
1513
#ifdef HAVE_NBGL
1614
#include "nbgl_types.h"
1715
#endif

src/swap_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <string.h>
2020
#include <stdbool.h>
2121

22-
#include "tokens.h"
22+
#include "asset_info.h"
2323
#include "swap_utils.h"
2424

2525
bool parse_swap_config(const uint8_t *config, uint8_t config_len, char *ticker, uint8_t *decimals) {

src_common/tokens.h renamed to src_common/asset_info.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
#include <stdint.h>
2121
#include "common_utils.h"
2222

23+
// NFT
24+
25+
#define COLLECTION_NAME_MAX_LEN 70
26+
27+
typedef struct nftInfo_t {
28+
uint8_t contractAddress[ADDRESS_LENGTH]; // must be first item
29+
char collectionName[COLLECTION_NAME_MAX_LEN + 1];
30+
} nftInfo_t;
31+
32+
// TOKENS
33+
2334
#define MAX_TICKER_LEN 11 // 10 characters + '\0'
2435
#define MAX_ITEMS 2
2536

@@ -31,3 +42,10 @@ typedef struct tokenDefinition_t {
3142
char ticker[MAX_TICKER_LEN];
3243
uint8_t decimals;
3344
} tokenDefinition_t;
45+
46+
// UNION
47+
48+
typedef union extraInfo_t {
49+
tokenDefinition_t token;
50+
nftInfo_t nft;
51+
} extraInfo_t;

src_common/common_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <stdint.h>
1919
#include <string.h>
2020

21-
#include "tokens.h"
21+
#include "asset_info.h"
2222
#include "common_utils.h"
2323

2424
void array_hexstr(char *strbuf, const void *bin, unsigned int len) {

src_common/eth_plugin_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include "os.h"
77
#include "cx.h"
8-
#include "tokens.h"
8+
#include "asset_info.h"
99
#include "tx_content.h"
1010

1111
/*************************************************************************************************

src_common/extra_info.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

src_common/nft.h

Lines changed: 0 additions & 10 deletions
This file was deleted.

src_features/provideNFTInformation/cmd_provideNFTInfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "shared_context.h"
44
#include "apdu_constants.h"
5-
#include "tokens.h"
5+
#include "asset_info.h"
66
#include "common_utils.h"
77
#include "common_ui.h"
88
#include "os_io_seproxyhal.h"

src_features/setPlugin/cmd_setPlugin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "shared_context.h"
22
#include "apdu_constants.h"
3-
#include "tokens.h"
3+
#include "asset_info.h"
44
#include "eth_plugin_interface.h"
55
#include "eth_plugin_internal.h"
66
#include "plugin_utils.h"

src_plugins/erc1155/erc1155_plugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <stdint.h>
88
#include "ethUstream.h"
99
#include "uint256.h"
10-
#include "nft.h"
10+
#include "asset_info.h"
1111

1212
// Internal plugin for EIP 1155: https://eips.ethereum.org/EIPS/eip-1155
1313

0 commit comments

Comments
 (0)