From e2b25a7e6c89f313479b96d985df5bfb890da440 Mon Sep 17 00:00:00 2001 From: "davidzagi93@gmail.com" Date: Wed, 18 Aug 2021 15:17:48 +0100 Subject: [PATCH] creating a KnownTransaction function --- .../terminal/src/lib/remix-ui-terminal.tsx | 64 +++++++++++++++---- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx index 8fd6cf8268..6933a2cfdb 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -663,16 +663,14 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { )} - {console.log(opts['decoded input'], 'opts["decoded input"]')} - {console.log(opts.log, 'opts log')} - {/* {opts['decoded input'] && ( + {opts['decoded input'] && ( decode input {opts['decoded input']} - )} */} + )} {opts['decoded output'] && ( decode output @@ -681,7 +679,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { )} - {/* {opts.logs && ( + {opts.logs && ( logs @@ -690,7 +688,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { - )} */} + )} {opts.val && ( val @@ -718,11 +716,11 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { } } - const renderUnKnownTransactions = (tx, receipt, resolvedData, logs, index) => { + const renderUnKnownTransactions = (tx, receipt, index) => { const from = tx.from - const to = tx.to ? tx.to : resolvedData.contractName + '.' + resolvedData.fn + const to = tx.to const obj = { from, to } - const txType = resolvedData ? 'knownTx' : 'unknown' + (tx.isCall ? 'Call' : 'Tx') + const txType = 'unknown' + (tx.isCall ? 'Call' : 'Tx') console.log('render unknown transaction ') return ( @@ -732,7 +730,44 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { {context({ from, to, tx }, props.blockchain)} { console.log('under context and checkTxStatus')}
-
debug(event, tx)}>Debug
+
debug(event, tx)}>Debug
+
+ + + {showTableHash.includes(tx.hash) ? showTable({ + hash: tx.hash, + status: receipt !== null ? receipt.status : null, + isCall: tx.isCall, + contractAddress: tx.contractAddress, + data: tx, + from, + to, + gas: tx.gas, + input: tx.input, + 'decoded output': ' - ', + val: tx.value, + transactionCost: tx.transactionCost, + executionCost: tx.executionCost + }) : null} + { console.log('end')} +
+ ) + } + + const renderKnownTransactions = (tx, receipt, resolvedData, logs, index) => { + const from = tx.from + const to = resolvedData.contractName + '.' + resolvedData.fn + const obj = { from, to } + const txType = 'knownTx' + console.log('render unknown transaction ') + return ( + +
txDetails(event, tx, obj)}> + {/* onClick={e => txDetails(e, tx, data, obj)} */} + {checkTxStatus(receipt, txType)} + {context({ from, to, tx }, props.blockchain)} +
+
debug(event, tx)}>Debug
@@ -854,10 +889,15 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
[block:{x.message} - 0 {'transactions'} ]
) - } else if (x.name === 'unknownTransaction' || x.name === 'knownTransaction') { + } else if (x.name === 'unknownTransaction') { return x.message.filter(x => x.tx.hash.includes(searchInput) || x.tx.from.includes(searchInput) || (x.tx.to.includes(searchInput))).map((trans) => { console.log({ trans }, 'first output from deploy') - return (
{renderUnKnownTransactions(trans.tx, trans.receipt, trans.resolvedData, trans.logs, index)}
) + return (
{renderUnKnownTransactions(trans.tx, trans.receipt, index)}
) + }) + } else if (x.name === 'knownTransaction') { + return x.message.map((trans) => { + console.log({ trans }, 'first output from deploy') + return (
{renderKnownTransactions(trans.tx, trans.receipt, trans.resolvedData, trans.logs, index)}
) }) } else { console.log({ x }, 'second output from deploy')