Move network features out of ethUtils

This commit is contained in:
Francois Beutin
2024-01-15 18:48:48 +01:00
parent 82d776f771
commit 04d0fde47a
8 changed files with 39 additions and 37 deletions

View File

@@ -348,32 +348,3 @@ bool adjustDecimals(const char *src,
}
return true;
}
// Returns the chain ID. Defaults to 0 if txType was not found (For TX).
uint64_t get_tx_chain_id(void) {
uint64_t chain_id = 0;
switch (txContext.txType) {
case LEGACY:
chain_id = u64_from_BE(txContext.content->v, txContext.content->vLength);
break;
case EIP2930:
case EIP1559:
chain_id = u64_from_BE(tmpContent.txContent.chainID.value,
tmpContent.txContent.chainID.length);
break;
default:
PRINTF("Txtype `%d` not supported while generating chainID\n", txContext.txType);
break;
}
return chain_id;
}
const char *get_displayable_ticker(const uint64_t *chain_id) {
const char *ticker = get_network_ticker_from_chain_id(chain_id);
if (ticker == NULL) {
ticker = chainConfig->coinName;
}
return ticker;
}