Merge nft and tokens into a single asset header

This commit is contained in:
Francois Beutin
2024-01-16 17:17:42 +01:00
parent e64a04da51
commit 5bf5023e35
12 changed files with 27 additions and 32 deletions

View File

@@ -20,6 +20,17 @@
#include <stdint.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_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;

View File

@@ -18,7 +18,7 @@
#include <stdint.h>
#include <string.h>
#include "tokens.h"
#include "asset_info.h"
#include "common_utils.h"
void array_hexstr(char *strbuf, const void *bin, unsigned int len) {

View File

@@ -5,7 +5,7 @@
#include "os.h"
#include "cx.h"
#include "tokens.h"
#include "asset_info.h"
#include "tx_content.h"
/*************************************************************************************************

View File

@@ -1,9 +0,0 @@
#pragma once
#include "tokens.h"
#include "nft.h"
typedef union extraInfo_t {
tokenDefinition_t token;
nftInfo_t nft;
} extraInfo_t;

View File

@@ -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;