fix: now passing resolveData and logs from knownTransaction in Deploy tab

pull/1342/head
davidzagi93@gmail.com 3 years ago
parent 9eaa5e8284
commit 0637a56fea
  1. 4
      libs/remix-ui/terminal/src/lib/actions/terminalAction.ts
  2. 12
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx

@ -197,11 +197,11 @@ export const initListeningOnNetwork = (props, dispatch) => {
compiledContracts = await props._deps.compilersArtefacts.__last.getContracts() compiledContracts = await props._deps.compilersArtefacts.__last.getContracts()
} }
console.log({ compiledContracts }) console.log({ compiledContracts })
await props.eventsDecoder.parseLogs(tx, resolvedTransaction.contractName, compiledContracts, (error, logs) => { await props.eventsDecoder.parseLogs(tx, resolvedTransaction.contractName, compiledContracts, async (error, logs) => {
if (!error) { if (!error) {
console.log({ tx: tx, receipt: receipt, resolvedData: resolvedTransaction, logs: logs }) console.log({ tx: tx, receipt: receipt, resolvedData: resolvedTransaction, logs: logs })
console.log('knownTransaction dispatch') console.log('knownTransaction dispatch')
dispatch({ type: 'knownTransaction', payload: { message: [{ tx: tx, receipt: receipt }] } }) await dispatch({ type: 'knownTransaction', payload: { message: [{ tx: tx, receipt: receipt, resolvedData: resolvedTransaction, logs: logs }] } })
} }
}) })
} else { } else {

@ -714,9 +714,9 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
} }
} }
const renderKnownTransactions = (tx, receipt, index) => { const renderUnKnownTransactions = (tx, receipt, resolvedData, logs, index) => {
const from = tx.from const from = tx.from
const to = tx.to const to = tx.to ? tx.to : resolvedData.contractName + '.' + resolvedData.fn
const obj = { from, to } const obj = { from, to }
const txType = 'unknown' + (tx.isCall ? 'Call' : 'Tx') const txType = 'unknown' + (tx.isCall ? 'Call' : 'Tx')
return ( return (
@ -740,9 +740,9 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
to, to,
gas: tx.gas, gas: tx.gas,
input: tx.input, input: tx.input,
'decoded input': tx.resolvedData && tx.resolvedData.params ? JSON.stringify(typeConversion.stringify(tx.resoparams), null, '\t') : ' - ', 'decoded input': resolvedData && resolvedData.params ? JSON.stringify(typeConversion.stringify(resolvedData.params), null, '\t') : ' - ',
'decoded output': tx.resolvedData && tx.resolvedData.decodedReturnValue ? JSON.stringify(typeConversion.stringify(tx.resolvedData.decodedReturnValue), null, '\t') : ' - ', 'decoded output': resolvedData && resolvedData.decodedReturnValue ? JSON.stringify(typeConversion.stringify(resolvedData.decodedReturnValue), null, '\t') : ' - ',
logs: tx.logs, logs: logs,
val: tx.value, val: tx.value,
transactionCost: tx.transactionCost, transactionCost: tx.transactionCost,
executionCost: tx.executionCost executionCost: tx.executionCost
@ -850,7 +850,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
} else if (x.name === 'unknownTransaction' || x.name === 'knownTransaction') { } else if (x.name === 'unknownTransaction' || x.name === 'knownTransaction') {
return x.message.filter(x => x.tx.hash.includes(searchInput) || x.tx.from.includes(searchInput) || (x.tx.to.includes(searchInput))).map((trans) => { 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') console.log({ trans }, 'first output from deploy')
return (<div className='px-4 block' data-id={`block_tx${trans.tx.hash}`}> {renderKnownTransactions(trans.tx, trans.receipt, index)} </div>) 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>)
}) })
} else { } else {
console.log({ x }, 'second output from deploy') console.log({ x }, 'second output from deploy')

Loading…
Cancel
Save