feat(tron): add sign personal message
What changed, and why it matters
This commit adds a new feature to the Keystone 3 hardware wallet: the ability to sign personal messages on the Tron blockchain, similar to how it already handles Ethereum personal messages. The change touches the Rust signing code, the C UI code that shows the message on the device screen, and the simulator. It is a feature addition rather than a bug fix, and there is no vendor statement that this is a security patch. The main security-relevant concern is that any new signing path must correctly validate what it signs and show it clearly to the user, otherwise a malicious app could trick the wallet into signing something the user did not intend.
Treat this as a feature commit, not a confirmed vulnerability. Reviewers should verify that (1) the personal-message prefix and hash exactly match the Tron/TRC-20 ecosystem convention expected by wallets, (2) the UI always shows the raw or UTF-8 message and the signing address before signing, (3) the signing path cannot be reached without user confirmation, (4) message length is bounded to avoid stack/heap issues, and (5) the refactor of sign_tx_request to return only the signature does not break any downstream consumer that previously expected a full signed transaction.
Security signals we found
New cryptographic signing path added for Tron personal messages
Message prefix follows Ethereum-style convention (\x19TRON Signed Message:\n + decimal length)
Signature format uses secp256k1 r||s||rec_id+27, same as Ethereum personal sign
UI adds a dedicated review screen for Tron personal messages
Parsing path derives a 'from' address from the xpub/derivation path for display
No input-length limits are visible in the new signing helper
No explicit domain/chain-id binding in the personal-message format
Refactor of existing Tron transaction signing to return signature-only for tx requests
Evidence from the diff
The commit implements Tron personal-message signing. In rust/apps/tron it adds sign_personal_message, which prefixes the message with “\x19TRON Signed Message:\n” plus the decimal length, hashes with Keccak-256, and produces a 65-byte Ethereum-style signature (r||s||rec_id+27). It also adds parse_personal_message to build a display struct containing the raw hex, a UTF-8 rendering (blanked for CJK), and an optional from address derived from a public key. The rust_c layer exposes tron_parse_personal_message and branches tron_check_sign_request / tron_sign_request on a new DataType::PersonalMessage. The C UI adds a REMAPVIEW_TRX_PERSONAL_MESSAGE view, registers it in the view handler map, and renders the message for user confirmation before signing. The existing transaction signing path is refactored to share a do_sign_digest helper and now returns only the signature bytes for transaction requests (sign_signature_only), while the full signed transaction is still produced by sign().
Changed components
rust/apps/tron/src/lib.rsrust/apps/tron/src/structs.rsrust/apps/tron/src/address.rsrust/apps/tron/src/transaction/signer.rsrust/rust_c/src/tron/mod.rsrust/rust_c/src/tron/structs.rsrust/rust_c/src/common/ur.rsrust/rust_c/src/common/ur_ext.rssrc/ui/gui_chain/multi/web3/gui_trx.csrc/ui/gui_chain/multi/web3/gui_trx.hsrc/ui/gui_chain/gui_chain.csrc/ui/gui_chain/gui_chain.hsrc/ui/gui_analyze/gui_resolve_ur.csrc/ui/gui_analyze/multi/web3/gui_general_analyze.csrc/ui/gui_analyze/multi/web3/gui_general_analyze.hui_simulator/simulator_model.hInspect captured patch +450 / −23
diff --git a/rust/apps/tron/src/address.rs b/rust/apps/tron/src/address.rs
index a179e8d..49754f5 100644
--- a/rust/apps/tron/src/address.rs
+++ b/rust/apps/tron/src/address.rs
@@ -3,6 +3,7 @@ use alloc::format;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use bitcoin::base58;
+use bitcoin::secp256k1::PublicKey;
use cryptoxide::hashing::keccak256;
use keystore::algorithms::secp256k1::derive_public_key;
@@ -54,6 +55,17 @@ pub fn get_address(path: String, extended_pub_key: &String) -> Result<String> {
Ok(address.to_string())
}
+pub fn public_key_to_address(public_key: &PublicKey) -> String {
+ let pubkey_bytes = public_key.serialize_uncompressed();
+ let hash = keccak256(&pubkey_bytes[1..]);
+
+ let mut address_bytes = [0u8; 21];
+ address_bytes[0] = 0x41;
+ address_bytes[1..].copy_from_slice(&hash[hash.len() - 20..]);
+
+ base58::encode_check(&address_bytes)
+}
+
#[cfg(test)]
mod tests {
extern crate std;
diff --git a/rust/apps/tron/src/lib.rs b/rust/apps/tron/src/lib.rs
index 50171d1..4bd8b29 100644
--- a/rust/apps/tron/src/lib.rs
+++ b/rust/apps/tron/src/lib.rs
@@ -9,6 +9,7 @@ extern crate std;
use crate::errors::{Result, TronError};
use alloc::string::String;
+use cryptoxide::hashing;
use ur_registry::pb::protoc;
mod address;
@@ -16,6 +17,7 @@ pub mod errors;
mod pb;
mod transaction;
mod utils;
+pub mod structs;
pub use crate::address::get_address;
pub use crate::transaction::parser::{DetailTx, OverviewTx, ParsedTx, TxParser};
@@ -25,6 +27,9 @@ use alloc::vec::Vec;
use app_utils::keystone;
use transaction::checker::TxChecker;
use transaction::signer::Signer;
+use bitcoin::secp256k1::{PublicKey};
+use crate::structs::{PersonalMessage};
+
pub fn sign_raw_tx(
raw_tx: protoc::Payload,
@@ -64,8 +69,8 @@ fn decode_to_wrapped(sign_data: &[u8], path: String) -> Result<WrappedTron> {
pub fn sign_tx_request(sign_data: &[u8], hd_path: &String, seed: &[u8]) -> errors::Result<String> {
let tx = decode_to_wrapped(sign_data, hd_path.clone())?;
- let (signed_hex, _) = tx.sign(seed)?;
- Ok(signed_hex)
+ let sig = tx.sign_signature_only(seed)?;
+ Ok(sig)
}
pub fn parse_tx_request(sign_data: &[u8], path: &String) -> Result<ParsedTx> {
@@ -84,6 +89,53 @@ pub fn check_tx_request(sign_data: &[u8], path: &str, xpub: &str) -> errors::Res
Ok(())
}
+pub fn sign_personal_message(
+ sign_data: &[u8],
+ path: &String,
+ seed: &[u8]
+) -> errors::Result<String> {
+ let prefix = b"\x19TRON Signed Message:\n";
+ let len_str = sign_data.len().to_string();
+
+ let mut message_to_hash = Vec::with_capacity(prefix.len() + len_str.len() + sign_data.len());
+ message_to_hash.extend_from_slice(prefix);
+ message_to_hash.extend_from_slice(len_str.as_bytes());
+ message_to_hash.extend_from_slice(sign_data);
+
+ let hash = hashing::keccak256(&message_to_hash);
+
+ let message = bitcoin::secp256k1::Message::from_digest_slice(&hash)
+ .map_err(|e| TronError::SignFailure(e.to_string()))?;
+
+ let (rec_id, rs) = keystore::algorithms::secp256k1::sign_message_by_seed(seed, path, &message)
+ .map_err(|e| TronError::SignFailure(e.to_string()))?;
+
+ let mut sig_bytes = [0u8; 65];
+ sig_bytes[..64].copy_from_slice(&rs);
+ sig_bytes[64] = (rec_id as u8) + 27;
+
+ Ok(hex::encode(sig_bytes))
+}
+
+pub fn parse_personal_message(
+ tx_hex: &[u8],
+ from_key: Option<PublicKey>,
+) -> Result<PersonalMessage> {
+
+ let raw_message = hex::encode(tx_hex);
+ let utf8_message = match String::from_utf8(tx_hex.to_vec()) {
+ Ok(utf8_message) => {
+ if app_utils::is_cjk(&utf8_message) {
+ "".to_string()
+ } else {
+ utf8_message
+ }
+ }
+ Err(_e) => "".to_string(),
+ };
+ PersonalMessage::from(raw_message, utf8_message, from_key)
+}
+
#[cfg(test)]
mod test {
use super::*;
diff --git a/rust/apps/tron/src/structs.rs b/rust/apps/tron/src/structs.rs
new file mode 100644
index 0000000..e9bc648
--- /dev/null
+++ b/rust/apps/tron/src/structs.rs
@@ -0,0 +1,27 @@
+use crate::address::public_key_to_address;
+use crate::errors::Result;
+use alloc::string::{String};
+
+use bitcoin::secp256k1::PublicKey;
+
+#[derive(Clone, Debug)]
+pub struct PersonalMessage {
+ pub raw_message: String,
+ pub utf8_message: String,
+ pub from: Option<String>,
+}
+
+impl PersonalMessage {
+ pub fn from(
+ raw_message: String,
+ utf8_message: String,
+ from: Option<PublicKey>,
+ ) -> Result<Self> {
+ Ok(Self {
+ raw_message,
+ utf8_message,
+ from: from.map(|key| public_key_to_address(&key)),
+ })
+ }
+}
+
diff --git a/rust/apps/tron/src/transaction/signer.rs b/rust/apps/tron/src/transaction/signer.rs
index 2f9e244..9e47ffa 100644
--- a/rust/apps/tron/src/transaction/signer.rs
+++ b/rust/apps/tron/src/transaction/signer.rs
@@ -11,27 +11,49 @@ use prost::Message;
pub trait Signer {
fn sign(&self, seed: &[u8]) -> Result<(String, String)>;
+ fn sign_signature_only(&self, seed: &[u8]) -> Result<String>;
}
-impl Signer for WrappedTron {
- fn sign(&self, seed: &[u8]) -> Result<(String, String)> {
+impl WrappedTron {
+ fn do_sign_digest(&self, seed: &[u8]) -> Result<[u8; 65]> {
let sig_hash = self.signature_hash()?;
- let mut tx = self.tron_tx.to_owned();
+
let message = bitcoin::secp256k1::Message::from_digest_slice(sig_hash.as_slice())
.map_err(|e| TronError::SignFailure(e.to_string()))?;
- let (rec_id, signature) =
- &secp256k1::sign_message_by_seed(seed, &self.hd_path.to_owned(), &message)?;
+
+ let (rec_id, signature) = secp256k1::sign_message_by_seed(
+ seed,
+ &self.hd_path,
+ &message
+ )?;
+
let mut sig_bytes = [0u8; 65];
- sig_bytes[..64].copy_from_slice(signature);
+ sig_bytes[..64].copy_from_slice(&signature);
sig_bytes[64..].copy_from_slice(&rec_id.to_le_bytes()[..1]);
- let count: usize = tx
- .raw_data
- .to_owned()
+
+ Ok(sig_bytes)
+ }
+}
+
+impl Signer for WrappedTron {
+ fn sign(&self, seed: &[u8]) -> Result<(String, String)> {
+ let sig_hash = self.signature_hash()?;
+ let sig_bytes = self.do_sign_digest(seed)?;
+
+ let mut tx = self.tron_tx.to_owned();
+ let count: usize = tx.raw_data.as_ref()
.map_or(0, |raw_data| raw_data.contract.len());
+
tx.signature = vec![sig_bytes.to_vec(); count];
+
let tx_hex = tx.encode_to_vec();
Ok((hex::encode(tx_hex), hex::encode(sig_hash)))
}
+
+ fn sign_signature_only(&self, seed: &[u8]) -> Result<String> {
+ let sig_bytes = self.do_sign_digest(seed)?;
+ Ok(hex::encode(sig_bytes))
+ }
}
#[cfg(test)]
@@ -43,6 +65,20 @@ mod tests {
use crate::transaction::signer::Signer;
use crate::transaction::wrapped_tron::WrappedTron;
+ #[test]
+ fn test_sign_signature_only_trc20() {
+ let hex = "1f8b08000000000000031590bf4ac3501c46359452bba871299d4a102a42c8bffbbbf7c6499b1403b6b14d52b42e92e426b5c53636462979029d7d01477707279f40147c0007df41707130856f3870a6f355387ebd9f1a098b1abd34c99230b9acbf70158eaf1099b4db26368427ae5af29c639bdf0e98a652d50fc4500922110121a21efb548c028010142d8814bdbed995106a4a8a0e4d492e26c98defb78ffb3f79a7dcfa5ae505cf21b6359f4447fdc5a1678ce99c9e0dd1558726999b8f269d09ceea82e7b96408dab58bd23c358deccc1fdf38f97cc114ec6746a40e1c41f05cc87b89814edbada9756bda07b3d9893ab2b46eff22746c3c76a6bb2b6a49d129d9b3abfb3e8be3400335f4090d3506818c303042402f0c669851888160504286502c2b408b001d01f5fd40d6286c3c7f3ed46a773fef45486bab5a1ab8a6c7af2d6f395f62ad6c3dfee2c66bef1f257dc3fe50010000";
+ let pubkey_str = "xpub6C3ndD75jvoARyqUBTvrsMZaprs2ZRF84kRTt5r9oxKQXn5oFChRRgrP2J8QhykhKACBLF2HxwAh4wccFqFsuJUBBcwyvkyqfzJU5gfn5pY";
+ let payload = prepare_payload(hex);
+ let context = prepare_parse_context(pubkey_str);
+ let tx = WrappedTron::from_payload(payload, &context).unwrap();
+ let seed = hex::decode("5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4").unwrap();
+ let sig = tx.sign_signature_only(&seed).unwrap();
+ assert_eq!("d01233804064a481a7e50cfa81007b6a5de8c933e0c08e09fd9bf045c7b70b7f20e262098f42a121cd3de494962215a835e38d220d25eeeefb7df1376bf74b8600", sig);
+ assert_eq!(sig.len(), 130);
+ assert!(sig.chars().all(|c| c.is_ascii_hexdigit()));
+ }
+
#[test]
fn test_sign_trx_transfer() {
// https://tronscan.org/#/transaction/0f89c6365796afa96ae05fab57207a4d8c5cc801b92ac2099c7dd9dcd5a91df0
diff --git a/rust/rust_c/src/common/ur.rs b/rust/rust_c/src/common/ur.rs
index 08b96b1..1f3d451 100644
--- a/rust/rust_c/src/common/ur.rs
+++ b/rust/rust_c/src/common/ur.rs
@@ -228,6 +228,8 @@ pub enum ViewType {
EthTypedData,
#[cfg(feature = "tron")]
TronTx,
+ #[cfg(feature = "tron")]
+ TronPersonalMessage,
#[cfg(feature = "solana")]
SolanaTx,
#[cfg(feature = "solana")]
diff --git a/rust/rust_c/src/common/ur_ext.rs b/rust/rust_c/src/common/ur_ext.rs
index d78f7e0..d279b90 100644
--- a/rust/rust_c/src/common/ur_ext.rs
+++ b/rust/rust_c/src/common/ur_ext.rs
@@ -233,7 +233,10 @@ impl InferViewType for AvaxSignRequest {
#[cfg(feature = "tron")]
impl InferViewType for TronSignRequest {
fn infer(&self) -> Result<ViewType, URError> {
- Ok(ViewType::TronTx)
+ match self.get_data_type() {
+ ur_registry::tron::tron_sign_request::DataType::Transaction => Ok(ViewType::TronTx),
+ ur_registry::tron::tron_sign_request::DataType::PersonalMessage=> Ok(ViewType::TronPersonalMessage),
+ }
}
}
diff --git a/rust/rust_c/src/tron/mod.rs b/rust/rust_c/src/tron/mod.rs
index d9d31d7..cf354c3 100644
--- a/rust/rust_c/src/tron/mod.rs
+++ b/rust/rust_c/src/tron/mod.rs
@@ -12,12 +12,16 @@ use alloc::slice;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use cty::c_char;
-use structs::DisplayTron;
+use structs::{DisplayTron, TransactionType};
use crate::extract_ptr_with_type;
use ur_registry::traits::{RegistryItem, To};
use ur_registry::tron::tron_sign_request::TronSignRequest;
use ur_registry::tron::tron_signature::TronSignature;
+use structs::{DisplayTRONPersonalMessage,};
+use app_tron::structs::{PersonalMessage};
+use keystore::algorithms::secp256k1::derive_public_key;
+use alloc::{format};
use app_tron::TxParser;
@@ -53,9 +57,20 @@ pub unsafe extern "C" fn tron_check_sign_request(
let sign_data = req.get_sign_data();
let path = req.get_derivation_path().get_path().unwrap_or_default();
- match app_tron::check_tx_request(&sign_data, &path, xpub_str) {
- Ok(_) => TransactionCheckResult::new().c_ptr(),
- Err(e) => TransactionCheckResult::from(e).c_ptr(),
+ let transaction_type = TransactionType::from(req.get_data_type());
+ match transaction_type {
+ TransactionType::Transaction => {
+ match app_tron::check_tx_request(&sign_data, &path, xpub_str) {
+ Ok(_) => TransactionCheckResult::new().c_ptr(),
+ Err(e) => TransactionCheckResult::from(e).c_ptr(),
+ }
+ }
+ TransactionType::PersonalMessage => {
+ TransactionCheckResult::new().c_ptr()
+ }
+ _ => TransactionCheckResult::from(RustCError::UnsupportedTransaction(
+ "Unsupported Transaction Type".to_string(),
+ )).c_ptr(),
}
}
@@ -91,15 +106,26 @@ pub unsafe extern "C" fn tron_sign_request(
let seed_slice = extract_array!(seed, u8, seed_len as usize);
let sign_res = (|| -> Result<Vec<u8>, KeystoneError> {
- let json_bytes = req.get_sign_data();
+ let sign_data = req.get_sign_data();
let request_id = req.get_request_id();
let path = req
.get_derivation_path()
.get_path()
.unwrap_or_else(|| String::from(TRON_DEFAULT_PATH));
- let signed_tx_hex = app_tron::sign_tx_request(&json_bytes, &path, seed_slice)
- .map_err(|e| KeystoneError::SignTxFailed(e.to_string()))?;
+ let signed_tx_hex = match TransactionType::from(req.get_data_type()) {
+ TransactionType::Transaction => {
+ app_tron::sign_tx_request(&sign_data, &path, seed_slice,)
+ .map_err(|e| KeystoneError::SignTxFailed(e.to_string()))?
+ }
+ TransactionType::PersonalMessage => {
+ app_tron::sign_personal_message(&sign_data, &path, seed_slice)
+ .map_err(|e| KeystoneError::SignTxFailed(e.to_string()))?
+ }
+ _ => {
+ return Err(KeystoneError::SignTxFailed("Unsupported Transaction Type".to_string()));
+ }
+ };
let signed_tx_bytes = hex::decode(signed_tx_hex)
.map_err(|_| KeystoneError::SignTxFailed("Invalid Hex output".to_string()))?;
@@ -199,3 +225,57 @@ pub unsafe extern "C" fn tron_get_address(
Err(e) => SimpleResponse::from(e).simple_c_ptr(),
}
}
+
+fn parse_trx_sub_path(path: String) -> Option<String> {
+ let root_path = "44'/195'/";
+ match path.strip_prefix(root_path) {
+ Some(path) => path.find('/').map(|index| path[index + 1..].to_string()),
+ None => None,
+ }
+}
+
+fn try_get_trx_public_key(
+ xpub: String,
+ trx_sign_request: &TronSignRequest,
+) -> Result<bitcoin::secp256k1::PublicKey, RustCError> {
+ match trx_sign_request.get_derivation_path().get_path() {
+ None => Err(RustCError::InvalidHDPath),
+ Some(path) => {
+ if let Some(sub_path) = parse_trx_sub_path(path.clone()) {
+ derive_public_key(&xpub, &format!("m/{sub_path}")).map_err(|_e| {
+ RustCError::UnexpectedError("unable to derive TRX pubkey".to_string())
+ })
+ } else {
+ Err(RustCError::InvalidHDPath)
+ }
+ }
+ }
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn tron_parse_personal_message(
+ ptr: PtrUR,
+ xpub: PtrString,
+) -> PtrT<TransactionParseResult<DisplayTRONPersonalMessage>> {
+ let crypto_trx = extract_ptr_with_type!(ptr, TronSignRequest);
+ let xpub = recover_c_char(xpub);
+
+ let pubkey = try_get_trx_public_key(xpub, crypto_trx).ok();
+ let transaction_type = TransactionType::from(crypto_trx.get_data_type());
+
+ match transaction_type {
+ TransactionType::PersonalMessage => {
+ match app_tron::parse_personal_message(&crypto_trx.get_sign_data(), pubkey) {
+ Ok(tx) => {
+ TransactionParseResult::success(DisplayTRONPersonalMessage::from(tx).c_ptr())
+ .c_ptr()
+ }
+ Err(e) => TransactionParseResult::from(e).c_ptr(),
+ }
+ }
+ _ => TransactionParseResult::from(RustCError::UnsupportedTransaction(
+ "TypedTransaction or TypedData".to_string(),
+ ))
+ .c_ptr(),
+ }
+}
diff --git a/rust/rust_c/src/tron/structs.rs b/rust/rust_c/src/tron/structs.rs
index 7ed50ab..928678d 100644
--- a/rust/rust_c/src/tron/structs.rs
+++ b/rust/rust_c/src/tron/structs.rs
@@ -6,6 +6,9 @@ use crate::common::structs::TransactionParseResult;
use crate::common::types::{PtrString, PtrT};
use crate::common::utils::convert_c_char;
use crate::{check_and_free_ptr, free_str_ptr, impl_c_ptr, make_free_method};
+use ur_registry::tron::tron_sign_request::DataType;
+use app_tron::structs::{PersonalMessage};
+use core::ptr::null_mut;
#[repr(C)]
pub struct DisplayTron {
@@ -102,4 +105,51 @@ impl Free for DisplayTron {
}
}
+#[derive(Debug)]
+pub enum TransactionType {
+ Transaction,
+ PersonalMessage,
+}
+
+impl From<DataType> for TransactionType {
+ fn from(value: DataType) -> Self {
+ match value {
+ DataType::Transaction => TransactionType::Transaction,
+ DataType::PersonalMessage => TransactionType::PersonalMessage,
+ }
+ }
+}
+
+#[repr(C)]
+pub struct DisplayTRONPersonalMessage {
+ raw_message: PtrString,
+ utf8_message: PtrString,
+ from: PtrString,
+}
+
+impl From<PersonalMessage> for DisplayTRONPersonalMessage {
+ fn from(message: PersonalMessage) -> Self {
+ Self {
+ raw_message: convert_c_char(message.raw_message),
+ utf8_message: if message.utf8_message.is_empty() {
+ null_mut()
+ } else {
+ convert_c_char(message.utf8_message)
+ },
+ from: message.from.map(convert_c_char).unwrap_or(null_mut()),
+ }
+ }
+}
+
+impl_c_ptr!(DisplayTRONPersonalMessage);
+
+impl Free for DisplayTRONPersonalMessage {
+ unsafe fn free(&self) {
+ free_str_ptr!(self.raw_message);
+ free_str_ptr!(self.utf8_message);
+ free_str_ptr!(self.from);
+ }
+}
+
make_free_method!(TransactionParseResult<DisplayTron>);
+make_free_method!(TransactionParseResult<DisplayTRONPersonalMessage>);
diff --git a/src/ui/gui_analyze/gui_resolve_ur.c b/src/ui/gui_analyze/gui_resolve_ur.c
index fb627c3..88a0fb5 100644
--- a/src/ui/gui_analyze/gui_resolve_ur.c
+++ b/src/ui/gui_analyze/gui_resolve_ur.c
@@ -35,6 +35,7 @@ static SetChainData_t g_chainViewArray[] = {
{REMAPVIEW_ETH_PERSONAL_MESSAGE, (SetChainDataFunc)GuiSetEthUrData},
{REMAPVIEW_ETH_TYPEDDATA, (SetChainDataFunc)GuiSetEthUrData},
{REMAPVIEW_TRX, (SetChainDataFunc)GuiSetTrxUrData},
+ {REMAPVIEW_TRX_PERSONAL_MESSAGE, (SetChainDataFunc)GuiSetTrxUrData},
{REMAPVIEW_COSMOS, (SetChainDataFunc)GuiSetCosmosUrData},
{REMAPVIEW_SUI, (SetChainDataFunc)GuiSetSuiUrData},
{REMAPVIEW_SUI_SIGN_MESSAGE_HASH, (SetChainDataFunc)GuiSetSuiUrData},
diff --git a/src/ui/gui_analyze/multi/web3/gui_general_analyze.c b/src/ui/gui_analyze/multi/web3/gui_general_analyze.c
index c7f3bbc..e269262 100644
--- a/src/ui/gui_analyze/multi/web3/gui_general_analyze.c
+++ b/src/ui/gui_analyze/multi/web3/gui_general_analyze.c
@@ -11,6 +11,7 @@ static GetLabelDataLenFunc GuiArTextLenFuncGet(char *type);
static GetTableDataFunc GuiEthTableFuncGet(char *type);
static GetTableDataFunc GuiAdaTabelFuncGet(char *type);
static GetLabelDataFunc GuiTrxTextFuncGet(char *type);
+static GetLabelDataFunc GuiTrxPersonalMessageTextFuncGet(char *type);
static GetLabelDataFunc GuiCosmosTextFuncGet(char *type);
static GetLabelDataFunc GuiSuiTextFuncGet(char *type);
static GetLabelDataLenFunc GuiSuiTextLenFuncGet(char *type);
@@ -24,6 +25,7 @@ static GetLabelDataFunc GuiEthTypedDataTextFuncGet(char *type);
static GetLabelDataFunc GuiEthPersonalMessageTextFuncGet(char *type);
static GetLabelDataFunc GuiEthTextFuncGet(char *type);
static GetContSizeFunc GetEthObjPos(char *type);
+static GetContSizeFunc GetTrxPersonalMessageObjPos(char *type);
static GetContSizeFunc GetCosmosObjPos(char *type);
static GetListItemKeyFunc GetCosmosListItemKey(char *type);
static GetListLenFunc GetCosmosListLen(char *type);
@@ -61,6 +63,8 @@ GetContSizeFunc GetOtherChainPos(char *type, GuiRemapViewType remapIndex)
return GetCosmosObjPos(type);
case REMAPVIEW_SOL_MESSAGE:
return GetSolObjPos(type);
+ case REMAPVIEW_TRX_PERSONAL_MESSAGE:
+ return GetTrxPersonalMessageObjPos(type);
default:
break;
}
@@ -161,6 +165,10 @@ GetObjStateFunc GuiOtherChainStateFuncGet(char *type)
return GetTrxContractExist;
} else if (!strcmp(type, "GetTrxTokenExist")) {
return GetTrxTokenExist;
+ } else if (!strcmp(type, "GetTrxMessageFromExist")) {
+ return GetTrxMessageFromExist;
+ } else if (!strcmp(type, "GetTrxMessageFromNotExist")) {
+ return GetTrxMessageFromNotExist;
} else if (!strcmp(type, "GetCosmosChannelExist")) {
return GetCosmosChannelExist;
} else if (!strcmp(type, "GetCosmosOldValidatorExist")) {
@@ -232,6 +240,8 @@ GetLabelDataFunc GuiOtherChainTextFuncGet(char *type, GuiRemapViewType remapInde
return GuiEthTypedDataTextFuncGet(type);
case REMAPVIEW_TRX:
return GuiTrxTextFuncGet(type);
+ case REMAPVIEW_TRX_PERSONAL_MESSAGE:
+ return GuiTrxPersonalMessageTextFuncGet(type);
case REMAPVIEW_COSMOS:
return GuiCosmosTextFuncGet(type);
case REMAPVIEW_SUI:
@@ -446,6 +456,18 @@ static GetLabelDataFunc GuiTrxTextFuncGet(char *type)
return NULL;
}
+static GetLabelDataFunc GuiTrxPersonalMessageTextFuncGet(char *type)
+{
+ if (!strcmp(type, "GetTrxMessageFrom")) {
+ return GetTrxMessageFrom;
+ } else if (!strcmp(type, "GetTrxMessageUtf8")) {
+ return GetTrxMessageUtf8;
+ } else if (!strcmp(type, "GetTrxMessageRaw")) {
+ return GetTrxMessageRaw;
+ }
+ return NULL;
+}
+
static GetLabelDataFunc GuiCosmosTextFuncGet(char *type)
{
if (!strcmp(type, "GetCosmosValue")) {
@@ -672,6 +694,14 @@ static GetContSizeFunc GetEthObjPos(char *type)
return NULL;
}
+static GetContSizeFunc GetTrxPersonalMessageObjPos(char *type)
+{
+ if (!strcmp(type, "GetTrxMessagePos")) {
+ return GetTrxMessagePos;
+ }
+ return NULL;
+}
+
static GetContSizeFunc GetCosmosObjPos(char *type)
{
if (!strcmp(type, "GetCosmosDetailMethodLabelPos")) {
diff --git a/src/ui/gui_analyze/multi/web3/gui_general_analyze.h b/src/ui/gui_analyze/multi/web3/gui_general_analyze.h
index 583019d..0753301 100644
--- a/src/ui/gui_analyze/multi/web3/gui_general_analyze.h
+++ b/src/ui/gui_analyze/multi/web3/gui_general_analyze.h
@@ -32,6 +32,13 @@
NULL,\
FreeTrxMemory,\
},\
+ {\
+ REMAPVIEW_TRX_PERSONAL_MESSAGE,\
+ "{\"table\":{\"utf8_message\":{\"type\":\"container\",\"pos\":[0,39],\"size\":[408,500],\"align\":2,\"bg_color\":16777215,\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text\":\"From\",\"pos\":[24,16],\"exist_func\":\"GetTrxMessageFromExist\",\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetTrxMessageFrom\",\"pos\":[24,54],\"text_width\":360,\"exist_func\":\"GetTrxMessageFromExist\",\"font\":\"openSansEnIllustrate\"},{\"type\":\"custom_container\",\"bg_color\":0,\"bg_opa\":0,\"exist_func\":\"GetTrxMessageFromNotExist\",\"pos\":[0,0],\"custom_show_func\":\"GuiCustomPathNotice\"},{\"type\":\"label\",\"text\":\"Message\",\"pos_func\":\"GetTrxMessagePos\",\"align_to\":-2,\"align\":13,\"text_color\":16777215,\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"container\",\"size\":[360,332],\"pos\":[0,11],\"align_to\":-2,\"align\":13,\"aflag\":16,\"bg_opa\":0,\"children\":[{\"type\":\"label\",\"text_func\":\"GetTrxMessageUtf8\",\"pos\":[0,0],\"text_width\":360,\"font\":\"openSansEnIllustrate\",\"text_color\":16777215}]}]},\"raw_message\":{\"type\":\"container\",\"pos\":[0,39],\"size\":[408,500],\"align\":2,\"bg_color\":16777215,\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text\":\"Raw Message\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"container\",\"pos\":[24,54],\"size\":[360,450],\"align\":1,\"aflag\":16,\"bg_opa\":0,\"children\":[{\"type\":\"label\",\"text_func\":\"GetTrxMessageRaw\",\"pos\":[0,0],\"text_width\":360,\"font\":\"illustrate\"}]}]}}}", \
+ GuiGetTrxPersonalMessage,\
+ GetTrxPersonalMessageType,\
+ FreeTrxMemory,\
+ },\
{\
REMAPVIEW_COSMOS,\
"{\"table\":{\"tx\":{\"name\":\"cosmos_tx_page\",\"type\":\"tabview\",\"pos\":[36,0],\"size\":[408,900],\"bg_color\":0,\"children\":[{\"type\":\"tabview_child\",\"index\":1,\"tab_name\":\"Overview\",\"font\":\"openSansEnIllustrate\",\"children\":[{\"type\":\"list\",\"exist_func\":\"GetCosmosMsgListExist\",\"len_func\":\"GetCosmosMsgLen\",\"item_key_func\":\"GetCosmosMsgKey\",\"item_map\":{\"default\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,402],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Value\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Value\",\"pos\":[24,96],\"text_color\":16090890,\"text_width\":2000,\"font\":\"openSansEnLittleTitle\"},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,144],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,144],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"From\",\"pos\":[24,182],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"From\",\"text_width\":360,\"pos\":[24,220],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"To\",\"pos\":[24,288],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"To\",\"text_width\":360,\"pos\":[24,326],\"font\":\"openSansEnIllustrate\"}]},\"Undelegate\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,402],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Value\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Value\",\"pos\":[24,96],\"text_color\":16090890,\"font\":\"openSansEnLittleTitle\"},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,144],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,144],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Validator\",\"pos\":[24,182],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Validator\",\"text_width\":360,\"pos\":[24,220],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"To\",\"pos\":[24,288],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"To\",\"text_width\":360,\"pos\":[24,326],\"font\":\"openSansEnIllustrate\"}]},\"Re-delegate\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,402],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Value\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Value\",\"pos\":[24,96],\"text_color\":16090890,\"font\":\"openSansEnLittleTitle\"},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,144],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,144],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"To\",\"pos\":[24,182],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"To\",\"text_width\":360,\"pos\":[24,220],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"New Validator\",\"pos\":[24,288],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"New Validator\",\"text_width\":360,\"pos\":[24,326],\"font\":\"openSansEnIllustrate\"}]},\"Withdraw Reward\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,320],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,62],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"To\",\"pos\":[24,100],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"To\",\"text_width\":360,\"pos\":[24,138],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Validator\",\"pos\":[24,206],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Validator\",\"text_width\":360,\"pos\":[24,244],\"font\":\"openSansEnIllustrate\"}]},\"Vote\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,290],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Proposal\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Proposal\",\"pos\":[123,62],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Voted\",\"pos\":[24,100],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Voted\",\"pos\":[95,100],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,138],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,138],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Voter\",\"pos\":[24,176],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Voter\",\"pos\":[24,214],\"text_width\":360,\"font\":\"openSansEnIllustrate\"}]}}},{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,106],\"bg_opa\":31,\"radius\":24,\"exist_func\":\"GetCosmosValueExist\",\"children\":[{\"type\":\"label\",\"text\":\"Value\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosValue\",\"pos\":[24,50],\"text_color\":16090890,\"text_width\":2000,\"font\":\"openSansEnLittleTitle\"}]},{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,106],\"bg_opa\":31,\"radius\":24,\"exist_func\":\"GetCosmosVoteExist\",\"children\":[{\"type\":\"label\",\"text\":\"Proposal\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosProposal\",\"pos\":[123,16],\"text_color\":16090890,\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Voted\",\"pos\":[24,54],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosVoted\",\"pos\":[95,54],\"text_color\":16090890,\"font\":\"openSansEnIllustrate\"}]},{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,62],\"align_to\":-2,\"align\":13,\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text\":\"Network\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosNetwork\",\"pos\":[120,16],\"font\":\"openSansEnIllustrate\"}]},{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,62],\"align_to\":-2,\"align\":13,\"bg_opa\":31,\"radius\":24,\"exist_func\":\"GetCosmosMethodExist\",\"children\":[{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosMethod\",\"pos\":[120,16],\"font\":\"openSansEnIllustrate\"}]},{\"type\":\"container\",\"pos\":[0,16],\"size_func\":\"GetCosmosOverviewAddrSize\",\"align_to\":-2,\"align\":13,\"bg_opa\":31,\"radius\":24,\"exist_func\":\"GetCosmosAddrExist\",\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosAddress1Label\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosAddress1Value\",\"text_width\":360,\"pos\":[24,54],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text_func\":\"GetCosmosAddress2Label\",\"pos\":[24,130],\"text_opa\":144,\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosAddress2Exist\"},{\"type\":\"label\",\"text_func\":\"GetCosmosAddress2Value\",\"text_width\":360,\"pos\":[0,8],\"align_to\":-2,\"align\":13,\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosAddress2Exist\"}]}]},{\"type\":\"tabview_child\",\"index\":2,\"tab_name\":\"Details\",\"font\":\"openSansEnIllustrate\",\"children\":[{\"type\":\"list\",\"exist_func\":\"GetCosmosMsgListExist\",\"len_func\":\"GetCosmosMsgLen\",\"item_key_func\":\"GetCosmosMsgKey\",\"item_map\":{\"default\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,358],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Value\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Value\",\"pos\":[92,62],\"text_color\":16090890,\"text_width\":2000,\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,100],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,100],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"From\",\"pos\":[24,138],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"From\",\"text_width\":360,\"pos\":[24,176],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"To\",\"pos\":[24,244],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"To\",\"text_width\":360,\"pos\":[24,282],\"font\":\"openSansEnIllustrate\"}]},\"IBC Transfer\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,396],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Value\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Value\",\"pos\":[92,62],\"text_color\":16090890,\"text_width\":2000,\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,100],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,100],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"From\",\"pos\":[24,138],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"From\",\"text_width\":360,\"pos\":[24,176],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"To\",\"pos\":[24,244],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"To\",\"text_width\":360,\"pos\":[24,282],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Source Channel\",\"pos\":[24,350],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Source Channel\",\"text_width\":360,\"pos\":[187,350],\"font\":\"openSansEnIllustrate\"}]},\"Undelegate\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,358],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Value\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Value\",\"pos\":[92,62],\"text_color\":16090890,\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,100],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,100],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Validator\",\"pos\":[24,138],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Validator\",\"text_width\":360,\"pos\":[24,176],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"To\",\"pos\":[24,244],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"To\",\"text_width\":360,\"pos\":[24,282],\"font\":\"openSansEnIllustrate\"}]},\"Re-delegate\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,464],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Value\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Value\",\"pos\":[92,62],\"text_color\":16090890,\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,100],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,100],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"To\",\"pos\":[24,138],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"To\",\"text_width\":360,\"pos\":[24,176],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Old Validator\",\"pos\":[24,244],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Old Validator\",\"text_width\":360,\"pos\":[24,282],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"New Validator\",\"pos\":[24,350],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"New Validator\",\"text_width\":360,\"pos\":[24,388],\"font\":\"openSansEnIllustrate\"}]},\"Withdraw Reward\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,322],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,62],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"To\",\"pos\":[24,100],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"To\",\"text_width\":360,\"pos\":[24,138],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Validator\",\"pos\":[24,206],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Validator\",\"text_width\":360,\"pos\":[24,244],\"font\":\"openSansEnIllustrate\"}]},\"Vote\":{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,290],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text_func\":\"GetCosmosIndex\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16090890},{\"type\":\"label\",\"text\":\"Proposal\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Proposal\",\"pos\":[123,62],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Voted\",\"pos\":[24,100],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Voted\",\"pos\":[95,100],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Method\",\"pos\":[24,138],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Method\",\"pos\":[113,138],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Voter\",\"pos\":[24,176],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosTextOfKind\",\"text_key\":\"Voter\",\"pos\":[24,214],\"text_width\":360,\"font\":\"openSansEnIllustrate\"}]}}},{\"type\":\"container\",\"pos\":[0,16],\"size_func\":\"GetCosmosDetailMsgSize\",\"exist_func\":\"GetCosmosMethodExist\",\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text\":\"Value\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144,\"exist_func\":\"GetCosmosValueExist\"},{\"type\":\"label\",\"text_func\":\"GetCosmosValue\",\"pos\":[92,16],\"text_color\":16090890,\"text_width\":2000,\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosValueExist\"},{\"type\":\"label\",\"text\":\"Proposal\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144,\"exist_func\":\"GetCosmosVoteExist\"},{\"type\":\"label\",\"text_func\":\"GetCosmosProposal\",\"pos\":[123,16],\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosVoteExist\"},{\"type\":\"label\",\"text\":\"Voted\",\"pos\":[24,62],\"font\":\"openSansEnIllustrate\",\"text_opa\":144,\"exist_func\":\"GetCosmosVoteExist\"},{\"type\":\"label\",\"text_func\":\"GetCosmosVoted\",\"pos\":[95,62],\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosVoteExist\"},{\"type\":\"label\",\"text\":\"Method\",\"pos_func\":\"GetCosmosDetailMethodLabelPos\",\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosMethod\",\"pos_func\":\"GetCosmosDetailMethodValuePos\",\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text_func\":\"GetCosmosAddress1Label\",\"pos_func\":\"GetCosmosDetailAddress1LabelPos\",\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosAddress1Value\",\"text_width\":360,\"pos_func\":\"GetCosmosDetailAddress1ValuePos\",\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Old Validator\",\"pos\":[24,222],\"text_opa\":144,\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosOldValidatorExist\"},{\"type\":\"label\",\"text_func\":\"GetCosmosOldValidator\",\"text_width\":360,\"pos\":[24,260],\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosOldValidatorExist\"},{\"type\":\"label\",\"text_func\":\"GetCosmosAddress2Label\",\"pos_func\":\"GetCosmosDetailAddress2LabelPos\",\"text_opa\":144,\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosAddress2Exist\"},{\"type\":\"label\",\"text_func\":\"GetCosmosAddress2Value\",\"text_width\":360,\"pos_func\":\"GetCosmosDetailAddress2ValuePos\",\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosAddress2Exist\"},{\"type\":\"label\",\"text\":\"Source Channel\",\"pos\":[24,336],\"text_opa\":144,\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosChannelExist\"},{\"type\":\"label\",\"text_func\":\"GetCosmosChannel\",\"pos\":[187,336],\"font\":\"openSansEnIllustrate\",\"exist_func\":\"GetCosmosChannelExist\"}]},{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,170],\"bg_opa\":31,\"radius\":24,\"align\":13,\"align_to\":-2,\"children\":[{\"type\":\"label\",\"text\":\"Max Fee\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosMaxFee\",\"pos\":[118,16],\"text_width\":2000,\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\" · Max Fee Price * Gas Limit\",\"pos\":[24,54],\"font\":\"openSansDesc\",\"text_opa\":144},{\"type\":\"label\",\"text\":\"Fee\",\"pos\":[24,86],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosFee\",\"pos\":[73,86],\"text_width\":2000,\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Gas Limit\",\"pos\":[24,124],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosGasLimit\",\"pos\":[127,124],\"font\":\"openSansEnIllustrate\"}]},{\"type\":\"container\",\"pos\":[0,12],\"size\":[408,100],\"bg_opa\":31,\"radius\":24,\"align\":13,\"align_to\":-2,\"children\":[{\"type\":\"label\",\"text\":\"Network\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosNetwork\",\"pos\":[120,16],\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Chain ID\",\"pos\":[24,54],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosChainId\",\"pos\":[120,54],\"font\":\"openSansEnIllustrate\"}]}]}]},\"unknown\":{\"name\":\"cosmos_unknown_page\",\"type\":\"container\",\"pos\":[36,0],\"size\":[408,600],\"bg_color\":0,\"children\":[{\"type\":\"container\",\"pos\":[0,80],\"size\":[408,170],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text\":\"Max Fee\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosDetailItemValue\",\"text_key\":\"Max Fee\",\"pos\":[118,16],\"text_width\":2000,\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\" · Max Fee Price * Gas Limit\",\"pos\":[24,54],\"font\":\"openSansDesc\",\"text_opa\":144},{\"type\":\"label\",\"text\":\"Fee\",\"pos\":[24,86],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosDetailItemValue\",\"text_key\":\"Fee\",\"pos\":[73,86],\"text_width\":2000,\"font\":\"openSansEnIllustrate\"},{\"type\":\"label\",\"text\":\"Gas Limit\",\"pos\":[24,124],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosDetailItemValue\",\"text_key\":\"Gas Limit\",\"pos\":[127,124],\"font\":\"openSansEnIllustrate\"}]},{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,62],\"bg_opa\":31,\"radius\":24,\"align\":13,\"align_to\":-2,\"children\":[{\"type\":\"label\",\"text\":\"Network\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosDetailItemValue\",\"text_key\":\"Network\",\"pos\":[120,16],\"font\":\"openSansEnIllustrate\"}]},{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,62],\"bg_opa\":31,\"radius\":24,\"align\":13,\"align_to\":-2,\"children\":[{\"type\":\"label\",\"text\":\"Message\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosDetailItemValue\",\"text_key\":\"Message\",\"pos\":[120,16],\"font\":\"openSansEnIllustrate\",\"text_color\":16105777}]}]},\"msg\":{\"name\":\"cosmos_msg_page\",\"type\":\"container\",\"pos\":[36,0],\"size\":[408,600],\"bg_color\":0,\"children\":[{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,62],\"bg_opa\":31,\"radius\":24,\"children\":[{\"type\":\"label\",\"text\":\"Network\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosDetailItemValue\",\"text_key\":\"Network\",\"pos\":[120,16],\"font\":\"openSansEnIllustrate\"}]},{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,130],\"bg_opa\":31,\"radius\":24,\"align\":13,\"align_to\":-2,\"children\":[{\"type\":\"label\",\"text\":\"Signer\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosDetailItemValue\",\"text_key\":\"Signer\",\"text_width\":360,\"pos\":[24,54],\"font\":\"openSansEnIllustrate\"}]},{\"type\":\"container\",\"pos\":[0,16],\"size\":[408,250],\"bg_opa\":31,\"radius\":24,\"align\":13,\"align_to\":-2,\"children\":[{\"type\":\"label\",\"text\":\"Message\",\"pos\":[24,16],\"font\":\"openSansEnIllustrate\",\"text_opa\":144},{\"type\":\"label\",\"text_func\":\"GetCosmosDetailItemValue\",\"text_key\":\"Message\",\"pos\":[24,54],\"font\":\"openSansEnIllustrate\"}]}]}}}", \
diff --git a/src/ui/gui_chain/gui_chain.c b/src/ui/gui_chain/gui_chain.c
index a096201..8cc3716 100644
--- a/src/ui/gui_chain/gui_chain.c
+++ b/src/ui/gui_chain/gui_chain.c
@@ -37,6 +37,7 @@ bool CheckViewTypeIsAllow(uint8_t viewType)
case REMAPVIEW_APT:
case REMAPVIEW_AVAX:
case REMAPVIEW_TRX:
+ case REMAPVIEW_TRX_PERSONAL_MESSAGE:
return true;
default:
return false;
@@ -65,6 +66,7 @@ static const ViewHandlerEntry g_viewHandlerMap[] = {
{EthTypedData, GuiGetEthSignQrCodeData, GuiGetEthSignUrDataUnlimited, GuiGetEthCheckResult, CHAIN_ETH, REMAPVIEW_ETH_TYPEDDATA},
{EthBatchTx, GuiGetEthBatchTxSignQrCodeData, NULL, NULL, CHAIN_ETH, REMAPVIEW_ETH_BATCH_TX},
{TronTx, GuiGetTrxSignQrCodeData, GuiGetTrxSignUrDataUnlimited, GuiGetTrxCheckResult, CHAIN_TRX, REMAPVIEW_TRX},
+ {TronPersonalMessage, GuiGetTrxSignQrCodeData, GuiGetTrxSignUrDataUnlimited, GuiGetTrxCheckResult, CHAIN_TRX, REMAPVIEW_TRX_PERSONAL_MESSAGE},
// avax
{AvaxTx, GuiGetAvaxSignQrCodeData, GuiGetAvaxSignUrDataUnlimited, GuiGetAvaxCheckResult, CHAIN_AVAX, REMAPVIEW_AVAX},
@@ -140,7 +142,7 @@ GuiChainCoinType ViewTypeToChainTypeSwitch(uint8_t viewType)
#ifdef WEB3_VERSION
bool IsMessageType(uint8_t type)
{
- return type == EthPersonalMessage || type == EthTypedData || IsCosmosMsg(type) || type == SolanaMessage || IsAptosMsg(type) || type == BtcMsg || type == ArweaveMessage || type == CardanoSignData || type == CardanoSignCip8Data;
+ return type == EthPersonalMessage || type == EthTypedData || type == TronPersonalMessage || IsCosmosMsg(type) || type == SolanaMessage || IsAptosMsg(type) || type == BtcMsg || type == ArweaveMessage || type == CardanoSignData || type == CardanoSignCip8Data;
}
bool isCatalystVotingRegistration(uint8_t type)
diff --git a/src/ui/gui_chain/gui_chain.h b/src/ui/gui_chain/gui_chain.h
index 19201b9..6c1e256 100644
--- a/src/ui/gui_chain/gui_chain.h
+++ b/src/ui/gui_chain/gui_chain.h
@@ -112,6 +112,7 @@ typedef enum {
REMAPVIEW_ETH_TYPEDDATA,
REMAPVIEW_ETH_BATCH_TX,
REMAPVIEW_TRX,
+ REMAPVIEW_TRX_PERSONAL_MESSAGE,
REMAPVIEW_COSMOS,
REMAPVIEW_SUI,
REMAPVIEW_SUI_SIGN_MESSAGE_HASH,
diff --git a/src/ui/gui_chain/multi/web3/gui_trx.c b/src/ui/gui_chain/multi/web3/gui_trx.c
index 208f23f..d27511e 100644
--- a/src/ui/gui_chain/multi/web3/gui_trx.c
+++ b/src/ui/gui_chain/multi/web3/gui_trx.c
@@ -12,19 +12,31 @@ static bool g_isMulti = false;
static URParseResult *g_urResult = NULL;
static URParseMultiResult *g_urMultiResult = NULL;
static void *g_parseResult = NULL;
+static ViewType g_viewType = ViewTypeUnKnown;
void GuiSetTrxUrData(URParseResult *urResult, URParseMultiResult *urMultiResult, bool multi)
{
g_urResult = urResult;
g_urMultiResult = urMultiResult;
g_isMulti = multi;
+ g_viewType = g_isMulti ? g_urMultiResult->t : g_urResult->t;
}
#define CHECK_FREE_PARSE_RESULT(result) \
if (result != NULL) \
- { \
- free_TransactionParseResult_DisplayTron((PtrT_TransactionParseResult_DisplayTron)result); \
- result = NULL; \
+ { \
+ switch (g_viewType) \
+ { \
+ case TronTx: \
+ free_TransactionParseResult_DisplayTron((PtrT_TransactionParseResult_DisplayTron)result); \
+ break; \
+ case TronPersonalMessage: \
+ free_TransactionParseResult_DisplayTRONPersonalMessage((PtrT_TransactionParseResult_DisplayTRONPersonalMessage)result); \
+ break; \
+ default: \
+ break; \
+ } \
+ result = NULL; \
}
void *GuiGetTrxData(void)
@@ -163,3 +175,98 @@ UREncodeResult *GuiGetTrxSignUrDataUnlimited(void)
{
return GuiGetTrxSignUrDataDynamic(true);
}
+
+void *GuiGetTrxPersonalMessage(void)
+{
+ CHECK_FREE_PARSE_RESULT(g_parseResult);
+
+ uint8_t mfp[4];
+ void *data = g_isMulti ? g_urMultiResult->data : g_urResult->data;
+ char *trxXpub = GetCurrentAccountPublicKey(XPUB_TYPE_TRX);
+ GetMasterFingerPrint(mfp);
+
+ TransactionCheckResult *result = NULL;
+ do {
+ result = tron_check_sign_request(data, trxXpub, mfp, sizeof(mfp));
+ CHECK_CHAIN_BREAK(result);
+
+ PtrT_TransactionParseResult_DisplayTRONPersonalMessage parseResult = tron_parse_personal_message(data, trxXpub);
+
+ CHECK_CHAIN_BREAK(parseResult);
+
+ g_parseResult = (void *)parseResult;
+ } while (0);
+
+ free_TransactionCheckResult(result);
+ return g_parseResult;
+}
+
+void GetTrxPersonalMessageType(void *indata, void *param, uint32_t maxLen)
+{
+ printf("DEBUG: GetTrxPersonalMessageType param: %p\n", param);
+ if (param == NULL) {
+ strcpy_s((char *)indata, maxLen, "raw_message");
+ return;
+ }
+ DisplayTRONPersonalMessage *message = (DisplayTRONPersonalMessage *)param;
+ if (message->utf8_message != NULL && strlen(message->utf8_message) > 0) {
+ strcpy_s((char *)indata, maxLen, "utf8_message");
+ } else {
+ strcpy_s((char *)indata, maxLen, "raw_message");
+ }
+}
+
+void GetTrxMessageFrom(void *indata, void *param, uint32_t maxLen)
+{
+ DisplayTRONPersonalMessage *message = (DisplayTRONPersonalMessage *)param;
+ if (message->from == NULL) {
+ strcpy_s((char *)indata, maxLen, "");
+ return;
+ }
+ if (strlen(message->from) >= maxLen) {
+ snprintf((char *)indata, maxLen - 3, "%s", message->from);
+ strcat((char *)indata, "...");
+ } else {
+ strcpy_s((char *)indata, maxLen, message->from);
+ }
+}
+void GetTrxMessageUtf8(void *indata, void *param, uint32_t maxLen)
+{
+ DisplayTRONPersonalMessage *message = (DisplayTRONPersonalMessage *)param;
+ if (strlen(message->utf8_message) >= maxLen) {
+ snprintf((char *)indata, maxLen - 3, "%s", message->utf8_message);
+ strcat((char *)indata, "...");
+ } else {
+ snprintf((char *)indata, maxLen, "%s", message->utf8_message);
+ }
+}
+
+void GetTrxMessageRaw(void *indata, void *param, uint32_t maxLen)
+{
+ int len = strlen("\n#F5C131 The data is not parseable. Please#\n#F5C131 refer to the software wallet interface#\n#F5C131 for viewing.#");
+ DisplayTRONPersonalMessage *message = (DisplayTRONPersonalMessage *)param;
+ if (strlen(message->raw_message) >= maxLen - len) {
+ snprintf((char *)indata, maxLen - 3 - len, "%s", message->raw_message);
+ strcat((char *)indata, "...");
+ } else {
+ snprintf((char *)indata, maxLen, "%s%s", message->raw_message, "\n#F5C131 The data is not parseable. Please#\n#F5C131 refer to the software wallet interface#\n#F5C131 for viewing.#");
+ }
+}
+
+bool GetTrxMessageFromExist(void *indata, void *param)
+{
+ if (param == NULL) return false;
+ DisplayTRONPersonalMessage *trx = (DisplayTRONPersonalMessage *)param;
+ return trx->from != NULL;
+}
+
+bool GetTrxMessageFromNotExist(void *indata, void *param)
+{
+ return !GetTrxMessageFromExist(indata, param);
+}
+
+void GetTrxMessagePos(uint16_t *x, uint16_t *y, void *param)
+{
+ *x = GetTrxMessageFromExist(NULL, param) ? 0 : 24;
+ *y = 11;
+}
\ No newline at end of file
diff --git a/src/ui/gui_chain/multi/web3/gui_trx.h b/src/ui/gui_chain/multi/web3/gui_trx.h
index 681c5d1..89f80c7 100644
--- a/src/ui/gui_chain/multi/web3/gui_trx.h
+++ b/src/ui/gui_chain/multi/web3/gui_trx.h
@@ -14,3 +14,13 @@ bool GetTrxTokenExist(void *indata, void *param);
void GetTrxToken(void *indata, void *param, uint32_t maxLen);
UREncodeResult *GuiGetTrxSignQrCodeData(void);
UREncodeResult *GuiGetTrxSignUrDataUnlimited(void);
+
+void *GuiGetTrxPersonalMessage(void);
+void GetTrxPersonalMessageType(void *indata, void *param, uint32_t maxLen);
+void GetTrxMessageFrom(void *indata, void *param, uint32_t maxLen);
+void GetTrxMessageUtf8(void *indata, void *param, uint32_t maxLen);
+void GetTrxMessageRaw(void *indata, void *param, uint32_t maxLen);
+bool GetTrxMessageFromExist(void *indata, void *param);
+bool GetTrxMessageFromNotExist(void *indata, void *param);
+void GetTrxMessagePos(uint16_t *x, uint16_t *y, void *param);
+
diff --git a/ui_simulator/simulator_model.h b/ui_simulator/simulator_model.h
index 75af22e..1d6bb21 100644
--- a/ui_simulator/simulator_model.h
+++ b/ui_simulator/simulator_model.h
@@ -104,6 +104,13 @@ extern bool g_reboot;
NULL, \
FreeTrxMemory, \
}, \
+ { \
+ REMAPVIEW_TRX_PERSONAL_MESSAGE, \
+ PC_SIMULATOR_PATH "/page_trx_person.json", \
+ GuiGetTrxPersonalMessage, \
+ GetTrxPersonalMessageType, \
+ FreeTrxMemory, \
+ }, \
{ \
REMAPVIEW_COSMOS, \
PC_SIMULATOR_PATH "/page_cosmos.json", \
Why this scored 39/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.