Skip to content
This repository has been archived by the owner on Aug 12, 2021. It is now read-only.

feat: Display Tx Msg ID (instead of the suffix of TxHash) #33

Merged
merged 2 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const bpListConfig = {
export const detailWrapperConfig = {
titles: {
block: ['Block Height', 'Time Stamp', 'Block Hash', 'Prev Hash', 'Amount', 'No.Tx', 'BP'],
tx: ['Transaction Hash', 'Block Height', 'Status', 'Type', 'From', 'To', 'Amount', 'Message'],
tx: ['Transaction Hash', 'Transaction MsgId', 'Block Height', 'Status', 'Type', 'From', 'To', 'Amount', 'Memo'],
account: ['Account', 'Balance', 'Staking', 'Transactions'],
bp: [
'Address', 'Consensus PublicKey', 'Consensus Address', 'Votes', 'url', 'Alias',
Expand Down
12 changes: 10 additions & 2 deletions client/src/lib/txMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ const txMapper = (tx) => {
const tempAmount = divider(tx.amount, [10 ** 6], 6).split('.');
tempAmount[0] = tempAmount[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
const Amount = `${tempAmount.join('.')} MED`;
let { txHash } = tx;
let msgId = '0';
if (new RegExp(':\\d+$').test(tx.txHash)) {
const colonIndex = tx.txHash.lastIndexOf(':');
txHash = tx.txHash.slice(0, colonIndex);
msgId = tx.txHash.slice(colonIndex + 1);
}

return {
'Block Height': tx.blockHeight,
'Transaction Hash': tx.txHash,
'Transaction Hash': txHash,
'Transaction MsgId': msgId,
Status: tx.executed ? 'Success' : 'Fail',
From: tx.fromAccount,
To: tx.toAccount,
Type: tx.type ? tx.type.split('/')[1] : '',
Amount,
Message: tx.memo,
Memo: tx.memo,
// Nonce: tx.nonce,
// Signature: tx.sign,
};
Expand Down
3 changes: 2 additions & 1 deletion client/src/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const en = {
marketCap: 'Market Cap',
medPrice: 'MED Price',
medSupply: 'MED Supply',
message: 'Message',
memo: 'Message (Memo)',
name: 'Name',
nonce: 'Nonce',
noTx: 'No.Tx',
Expand All @@ -40,6 +40,7 @@ const en = {
to: 'To',
transactionDetailInfo: 'Transaction Detail Info',
transactionHash: 'TX Hash',
transactionMsgId: 'TX Msg ID',
transactions: 'Transactions',
transactionsInTheBlock: 'Transactions in the block',
transactionsList: 'Transactions List',
Expand Down
3 changes: 2 additions & 1 deletion client/src/locale/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ja = {
marketCap: '市場価格',
medPrice: 'MED成行値段',
medSupply: 'MED総数',
message: 'メッセージ',
memo: 'メッセージ (Memo)',
name: '名前',
nonce: 'ナンス',
noTx: '含まれた取引',
Expand All @@ -40,6 +40,7 @@ const ja = {
to: '受信者',
transactionDetailInfo: '取引履歴の詳細ページ',
transactionHash: '注文コード',
transactionMsgId: '注文 Msg ID',
transactions: '取引詳細',
transactionsInTheBlock: 'ブロックに含まれたトランザクションの内訳',
transactionsList: '取引リスト',
Expand Down
3 changes: 2 additions & 1 deletion client/src/locale/ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ko = {
marketCap: '시장 가격',
medPrice: '메디 시장 가격',
medSupply: '메디 총 개수',
message: '메시지',
memo: '메시지 (메모)',
name: '이름',
nonce: '생성한 거래 수',
noTx: '포함된 거래',
Expand All @@ -40,6 +40,7 @@ const ko = {
to: '받는 사람',
transactionDetailInfo: '거래내역 상세페이지',
transactionHash: '주문 코드',
transactionMsgId: '주문 메시지 ID',
transactions: '거래내역',
transactionsInTheBlock: '블록에 포함된 거래내역',
transactionsList: '거래 목록',
Expand Down
3 changes: 2 additions & 1 deletion client/src/locale/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const zh = {
marketCap: '市场价格',
medPrice: 'MED市场价格',
medSupply: 'MED总量',
message: 'Message',
memo: 'Message (Memo)',
name: '姓名',
nonce: '账户的随机数',
noTx: '所有交易',
Expand All @@ -40,6 +40,7 @@ const zh = {
to: '接收人',
transactionDetailInfo: '交易明显详细信息',
transactionHash: '交易代码',
transactionMsgId: '交易信息ID',
transactions: '交易明细',
transactionsInTheBlock: '包含区块的交易明细',
transactionsList: '交易目录',
Expand Down