Skip to content

Commit

Permalink
Merge pull request #1003 from oraichain/hotfix-mainnet-v0.50
Browse files Browse the repository at this point in the history
fix crash mainnet v0.50
  • Loading branch information
haunv3 authored Nov 14, 2024
2 parents 39b52cc + 8ee79a5 commit 6fbc525
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 74 deletions.
97 changes: 48 additions & 49 deletions src/components/Tx/TxData/TxMessage/TxMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,55 +305,54 @@ const TxMessage = ({ key, msg, data, ind }) => {
return !data ? null : getInfoPriceRow(label, data.value, denom);
};

const getRawLog = (rawLog, index) => {
let messageParse = [];
try {
messageParse = tryParseMessage(JSON.parse(rawLog));
} catch (error) {
messageParse = [{ error: rawLog }];
} finally {
if (!index) messageParse = [messageParse[0]];
else messageParse = messageParse.filter(msg => msg.msg_index === index);
return (
<InfoRow label='RawLog'>
{!isLargeScreen ? (
<ReactJson
style={{ backgroundColor: "transparent" }}
name={false}
theme={activeThemeId === themeIds.DARK ? "monokai" : "rjv-default"}
displayObjectSize={false}
displayDataTypes={false}
collapsed={4}
src={messageParse}
/>
) : (
messageParse.map((msg, key) => {
const { events = [] } = msg || { events: [] };
return (
<div className={cx("message")}>
<span className={cx("message-title")}>Event {key + 1}:</span>
{events.map(event => (
<div className={cx("event")}>
<h2 className={cx("event-type")}>{event.type}</h2>
<table className={cx("event-attribute")}>
<tbody>
{event.attributes?.map(attr => (
<tr>
<td>{attr.key}</td>
<td>{ValueItem(attr.value)}</td>
</tr>
))}
</tbody>
</table>
</div>
))}
</div>
);
})
)}
</InfoRow>
);
}
const getRawLog = (data, value, index) => {
let messageParse = data.messages;
console.log({
messageParse,
index,
});

if (!index) messageParse = [messageParse[0]];
else messageParse = messageParse.filter(msg => msg.msg_index === index);
return (
<InfoRow label='RawLog'>
{!isLargeScreen ? (
<ReactJson
style={{ backgroundColor: "transparent" }}
name={false}
theme={activeThemeId === themeIds.DARK ? "monokai" : "rjv-default"}
displayObjectSize={false}
displayDataTypes={false}
collapsed={4}
src={messageParse}
/>
) : (
messageParse.map((msg, key) => {
const { events = [] } = msg || { events: [] };
return (
<di1v className={cx("message")}>
<span className={cx("message-title")}>Event {key + 1}:</span>
{events.map(event => (
<div className={cx("event")}>
<h2 className={cx("event-type")}>{event.type}</h2>
<table className={cx("event-attribute")}>
<tbody>
{event.attributes?.map(attr => (
<tr>
<td>{attr.key}</td>
<td>{ValueItem(attr.value)}</td>
</tr>
))}
</tbody>
</table>
</div>
))}
</di1v>
);
})
)}
</InfoRow>
);
};

const getInfoRowSummary = (label, value) => (
Expand Down
50 changes: 25 additions & 25 deletions src/components/Tx/TxData/TxMessage/TxMessageContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const TxMessageContent = ({
<div className={cx("card")} key={"card-index"}>
<div className={cx("card-body")}>
{getInfoRow("Data Source", item?.name)}
<InfoRow label='Result'>
{/* <InfoRow label='Result'>
<ReactJson
style={{ backgroundColor: "transparent" }}
name={false}
Expand All @@ -269,7 +269,7 @@ const TxMessageContent = ({
// src={tryParseMessage(JSON.parse(atob(item?.result)))}
src={tryParseMessageBinary(item?.result)}
/>
</InfoRow>
</InfoRow> */}
{getInfoRow("Result Status", item?.status)}
</div>
</div>
Expand All @@ -289,7 +289,7 @@ const TxMessageContent = ({
<div className={cx("card")} key={"card-index"}>
<div className={cx("card-body")}>
{getInfoRow("Data Source", item?.name)}
<InfoRow label='Result'>
{/* <InfoRow label='Result'>
<ReactJson
style={{ backgroundColor: "transparent" }}
name={false}
Expand All @@ -300,7 +300,7 @@ const TxMessageContent = ({
// src={tryParseMessage(JSON.parse(atob(item?.result)))}
src={tryParseMessageBinary(item?.result)}
/>
</InfoRow>
</InfoRow> */}
{getInfoRow("Result Status", item?.status)}
</div>
</div>
Expand Down Expand Up @@ -343,7 +343,7 @@ const TxMessageContent = ({
{getInfoRow("Label", value?.label)}
{getAddressRow("Sender", value?.sender, value?.sender_tag)}
{getCurrencyRowFromObject("Init funds", value?.init_funds ?? value?.funds)}
<InfoRow label='Message'>
{/* <InfoRow label='Message'>
<ReactJson
style={{ backgroundColor: "transparent" }}
name={false}
Expand All @@ -352,7 +352,7 @@ const TxMessageContent = ({
displayDataTypes={false}
src={tryParseMessage(value?.init_msg ?? value?.msg)}
/>
</InfoRow>
</InfoRow> */}
{getInfoRow("Contract Address", getContractAddress(data?.raw_log))}
</>
)}
Expand All @@ -368,7 +368,7 @@ const TxMessageContent = ({
{getPriceInfoFromRawData(wasmAttributes, "pnl", "Pnl", quote)}
{getPriceInfoFromRawData(wasmAttributes, "withdraw_amount", "Withdraw amount", quote)}
{getFundsRow("Sent funds", key, data?.messages?.[ind]?.sent_funds, data?.result, data?.amount)}
<InfoRow label='Message'>
{/* <InfoRow label='Message'>
<ReactJson
style={{ backgroundColor: "transparent" }}
name={false}
Expand All @@ -377,7 +377,7 @@ const TxMessageContent = ({
displayDataTypes={false}
src={tryParseMessage(value?.msg)}
/>
</InfoRow>
</InfoRow> */}
{getTransferRow("Transfer", key, data?.events, data?.result)}
{getMultiRoyaltyRow("Royalty", key, data?.raw_log, data?.result)}
{checkAttributeEvents(data?.raw_log, "send_packet") && getIBCProgressRow("IBC Progress", data)}
Expand All @@ -401,20 +401,20 @@ const TxMessageContent = ({
<>
{getAddressRow("Signer", value?.signer)}
{getInfoRow("Client ID", value?.client_id)}
{getInfoRow("Block", value?.header.signed_header.header.version.block)}
{getInfoRow("App", value?.header.signed_header.header.version.app)}
{getInfoRow("Chain ID", value?.header.signed_header.header.chain_id)}
{getInfoRow("Height", value?.header.signed_header.header.height)}
{getInfoRow("Time", value?.header.signed_header.header.time)}
{getInfoRow("Last Commit Hash", value?.header.signed_header.header.last_commit_hash)}
{getInfoRow("Data Hash", value?.header.signed_header.header.data_hash)}
{getInfoRow("Validators Hash", value?.header.signed_header.header.validators_hash)}
{getInfoRow("Next Validators Hash", value?.header.signed_header.header.next_validators_hash)}
{getInfoRow("Consensus Hash", value?.header.signed_header.header.consensus_hash)}
{getInfoRow("App Hash", value?.header.signed_header.header.app_hash)}
{getInfoRow("Last Results Hash", value?.header.signed_header.header.last_results_hash)}
{getInfoRow("Evidence Hash", value?.header.signed_header.header.evidence_hash)}
{getInfoRow("Proposer Address", value?.header.signed_header.header.proposer_address)}
{getInfoRow("Block", value?.client_message?.signed_header.header.version.block)}
{getInfoRow("App", value?.client_message?.signed_header.header.version.app)}
{getInfoRow("Chain ID", value?.client_message?.signed_header.header.chain_id)}
{getInfoRow("Height", value?.client_message?.signed_header.header.height)}
{getInfoRow("Time", value?.client_message?.signed_header.header.time)}
{getInfoRow("Last Commit Hash", value?.client_message?.signed_header.header.last_commit_hash)}
{getInfoRow("Data Hash", value?.client_message?.signed_header.header.data_hash)}
{getInfoRow("Validators Hash", value?.client_message?.signed_header.header.validators_hash)}
{getInfoRow("Next Validators Hash", value?.client_message?.signed_header.header.next_validators_hash)}
{getInfoRow("Consensus Hash", value?.client_message?.signed_header.header.consensus_hash)}
{getInfoRow("App Hash", value?.client_message?.signed_header.header.app_hash)}
{getInfoRow("Last Results Hash", value?.client_message?.signed_header.header.last_results_hash)}
{getInfoRow("Evidence Hash", value?.client_message?.signed_header.header.evidence_hash)}
{getInfoRow("Proposer Address", value?.client_message?.signed_header.header.proposer_address)}
</>
)}
{compareTypeMessage(type, [txTypes.COSMOS_SDK.MSG_IBC_RECV_PACKET, txTypes.COSMOS_SDK_NEW_VERSION.MSG_IBC_RECV_PACKET]) && (
Expand Down Expand Up @@ -610,7 +610,7 @@ const TxMessageContent = ({
{getInfoRow("Code ID", value?.code_id)}
{getAddressRow("Contract", value?.contract)}
{getAddressRow("Sender", value?.sender)}
<InfoRow label='Migrate Msg'>
{/* <InfoRow label='Migrate Msg'>
<ReactJson
style={{ backgroundColor: "transparent" }}
name={false}
Expand All @@ -619,10 +619,10 @@ const TxMessageContent = ({
displayDataTypes={false}
src={value?.migrate_msg}
/>
</InfoRow>
</InfoRow> */}
</>
)}
{getRawLog(data?.raw_log, ind)}
{getRawLog(data, value, ind)}
</div>
</>
);
Expand Down

0 comments on commit 6fbc525

Please sign in to comment.