creating a KnownTransaction function

pull/1342/head
davidzagi93@gmail.com 3 years ago
parent 0989045e84
commit 98e0c5212e
  1. 64
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx

@ -663,16 +663,14 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
</td>
</tr>
)}
{console.log(opts['decoded input'], 'opts["decoded input"]')}
{console.log(opts.log, 'opts log')}
{/* {opts['decoded input'] && (
{opts['decoded input'] && (
<tr className='tr'>
<td className='td' data-shared={`key_${opts.hash}`}> decode input </td>
<td className='td' data-id={`txLoggerTableHash${opts.hash}`} data-shared={`pair_${opts.hash}`}>{opts['decoded input']}
<CopyToClipboard content={opts['decoded input']}/>
</td>
</tr>
)} */}
)}
{opts['decoded output'] && (
<tr className='tr'>
<td className='td' data-shared={`key_${opts.hash}`}> decode output </td>
@ -681,7 +679,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
</td>
</tr>
)}
{/* {opts.logs && (
{opts.logs && (
<tr className='tr'>
<td className='td' data-shared={`key_${opts.hash}`}> logs </td>
<td className='td' data-id={`txLoggerTableHash${opts.hash}`} data-shared={`pair_${opts.hash}`}>
@ -690,7 +688,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
<CopyToClipboard content={JSON.stringify(opts.logs.raw || '0')}/>
</td>
</tr>
)} */}
)}
{opts.val && (
<tr className='tr'>
<td className='td' data-shared={`key_${opts.hash}`}> val </td>
@ -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 (
<span id={`tx${tx.hash}`} key={index}>
@ -732,7 +730,44 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
{context({ from, to, tx }, props.blockchain)}
{ console.log('under context and checkTxStatus')}
<div className='buttons'>
<div className='debug btn btn-primary btn-sm' onClick={(event) => debug(event, tx)}>Debug</div>
<div className='debug btn btn-primary btn-sm' data-shared='txLoggerDebugButton' data-id={`txLoggerDebugButton${tx.hash}`} onClick={(event) => debug(event, tx)}>Debug</div>
</div>
<i className = {`arrow fas ${(showTableHash.includes(tx.hash)) ? 'fa-angle-up' : 'fa-angle-down'}`}></i>
</div>
{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')}
</span>
)
}
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 (
<span id={`tx${tx.hash}`} key={index}>
<div className="log" onClick={(event) => txDetails(event, tx, obj)}>
{/* onClick={e => txDetails(e, tx, data, obj)} */}
{checkTxStatus(receipt, txType)}
{context({ from, to, tx }, props.blockchain)}
<div className='buttons'>
<div className='debug btn btn-primary btn-sm' data-shared='txLoggerDebugButton' data-id={`txLoggerDebugButton${tx.hash}`} onClick={(event) => debug(event, tx)}>Debug</div>
</div>
<i className = {`arrow fas ${(showTableHash.includes(tx.hash)) ? 'fa-angle-up' : 'fa-angle-down'}`}></i>
</div>
@ -854,10 +889,15 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
<span className='tx'><div className='txItem'>[<span className='txItemTitle'>block:{x.message} - </span> 0 {'transactions'} ] </div></span></span>
</div>
)
} 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 (<div className='px-4 block' data-id={`block_tx${trans.tx.hash}`} key={index}> {renderUnKnownTransactions(trans.tx, trans.receipt, trans.resolvedData, trans.logs, index)} </div>)
return (<div className='px-4 block' data-id={`block_tx${trans.tx.hash}`} key={index}> {renderUnKnownTransactions(trans.tx, trans.receipt, index)} </div>)
})
} else if (x.name === 'knownTransaction') {
return x.message.map((trans) => {
console.log({ trans }, 'first output from deploy')
return (<div className='px-4 block' data-id={`block_tx${trans.tx.hash}`} key={index}> {renderKnownTransactions(trans.tx, trans.receipt, trans.resolvedData, trans.logs, index)} </div>)
})
} else {
console.log({ x }, 'second output from deploy')

Loading…
Cancel
Save