From 2edfb4b4cf6d7026c60d3322fcd5d63eef16ca40 Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Fri, 6 Jun 2025 12:32:33 +0530 Subject: [PATCH] Format public key in create validator tx body --- src/screens/SignTxEmbed.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/screens/SignTxEmbed.tsx b/src/screens/SignTxEmbed.tsx index f3481cf..fbc60d4 100644 --- a/src/screens/SignTxEmbed.tsx +++ b/src/screens/SignTxEmbed.tsx @@ -277,7 +277,26 @@ export const SignTxEmbed = () => { return } - return JSONbig.stringify(transactionDetails.txBody, null, 2) + let txBody = transactionDetails.txBody; + + // If it's a MsgCreateValidator, format pubkey in present in the message + if (txBody.value.messages[0].typeUrl === "/cosmos.staking.v1beta1.MsgCreateValidator") { + txBody = { + ...txBody, + value: { + ...txBody.value, + messages: txBody.value.messages.map((msg) => ({ + ...msg, + value: { + ...msg.value, + pubkey: decodeOptionalPubkey(msg.value.pubkey), + }, + })), + }, + } + } + + return JSONbig.stringify(txBody, null, 2) }, [transactionDetails] );