New common function to get the NFT contract address

This commit is contained in:
Alexandre Paillier
2022-02-15 14:11:22 +01:00
parent 2e63a428b2
commit ce2df92741
4 changed files with 16 additions and 35 deletions

View File

@@ -237,6 +237,12 @@ void getEthDisplayableAddress(uint8_t *in,
getEthAddressStringFromBinary(in, out + 2, sha3, chainId);
}
uint8_t *getNftContractAddress(const ethQueryContractUI_t *const msg) {
// In case of no PROVIDE_NFT_INFO, we already have the address from the SET_PLUGIN
return ((msg->item1) ? ((uint8_t *) msg->item1->nft.contractAddress)
: msg->pluginSharedRO->txContent->destination);
}
bool adjustDecimals(char *src,
uint32_t srcLength,
char *target,

View File

@@ -22,6 +22,8 @@
#include "cx.h"
#include "chainConfig.h"
#include "eth_plugin_interface.h"
/**
* @brief Decode an RLP encoded field - see
* https://github.com/ethereum/wiki/wiki/RLP
@@ -57,6 +59,8 @@ void getEthDisplayableAddress(uint8_t *in,
cx_sha3_t *sha3,
uint64_t chainId);
uint8_t *getNftContractAddress(const ethQueryContractUI_t *const msg);
bool adjustDecimals(char *src,
uint32_t srcLength,
char *target,