|
|
@ -1,6 +1,5 @@ |
|
|
|
|
|
|
|
|
|
|
|
export const registerCommandAction = (name, command, activate, dispatch) => { |
|
|
|
export const registerCommandAction = (name, command, activate, dispatch) => { |
|
|
|
console.log(name, ' object key') |
|
|
|
|
|
|
|
const commands: any = {} |
|
|
|
const commands: any = {} |
|
|
|
const _commands: any = {} |
|
|
|
const _commands: any = {} |
|
|
|
_commands[name] = command |
|
|
|
_commands[name] = command |
|
|
@ -55,12 +54,10 @@ export const registerCommandAction = (name, command, activate, dispatch) => { |
|
|
|
item.step = steps.push(item) - 1 |
|
|
|
item.step = steps.push(item) - 1 |
|
|
|
item.args = params |
|
|
|
item.args = params |
|
|
|
// _appendItem(item)
|
|
|
|
// _appendItem(item)
|
|
|
|
console.log({ item }, 'append items') |
|
|
|
|
|
|
|
// self._appendItem(item)
|
|
|
|
// self._appendItem(item)
|
|
|
|
} |
|
|
|
} |
|
|
|
var scopedCommands = _scopeCommands(append) |
|
|
|
var scopedCommands = _scopeCommands(append) |
|
|
|
command(args, scopedCommands, el => append(null, args, blockify(el))) |
|
|
|
command(args, scopedCommands, el => append(null, args, blockify(el))) |
|
|
|
console.log({ args }) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
const help = typeof command.help === 'string' ? command.help : [ |
|
|
|
const help = typeof command.help === 'string' ? command.help : [ |
|
|
|
'// no help available for:', `terminal.command.${name}` |
|
|
|
'// no help available for:', `terminal.command.${name}` |
|
|
@ -84,15 +81,11 @@ export const registerCommandAction = (name, command, activate, dispatch) => { |
|
|
|
var command = _commands[cmd] |
|
|
|
var command = _commands[cmd] |
|
|
|
scopedCommands[cmd] = function _command () { |
|
|
|
scopedCommands[cmd] = function _command () { |
|
|
|
var args = [...arguments] |
|
|
|
var args = [...arguments] |
|
|
|
console.log({ cmd }, { args }, { blockify }) |
|
|
|
|
|
|
|
command(args, scopedCommands, el => append(cmd, args, blockify(el))) |
|
|
|
command(args, scopedCommands, el => append(cmd, args, blockify(el))) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
console.log({ scopedCommands }) |
|
|
|
|
|
|
|
return scopedCommands |
|
|
|
return scopedCommands |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log('david test dispatch') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const filterFnAction = (name, filterFn, dispatch) => { |
|
|
|
export const filterFnAction = (name, filterFn, dispatch) => { |
|
|
@ -145,20 +138,16 @@ export const initListeningOnNetwork = (props, dispatch) => { |
|
|
|
props.txListener.event.register('newBlock', (block) => { |
|
|
|
props.txListener.event.register('newBlock', (block) => { |
|
|
|
if (!block.transactions || (block.transactions && !block.transactions.length)) { |
|
|
|
if (!block.transactions || (block.transactions && !block.transactions.length)) { |
|
|
|
dispatch({ type: 'emptyBlock', payload: { message: 0 } }) |
|
|
|
dispatch({ type: 'emptyBlock', payload: { message: 0 } }) |
|
|
|
console.log({ block }, ' david') |
|
|
|
|
|
|
|
// registerCommandAction('emptyBlock', (args, cmds, append) => {
|
|
|
|
// registerCommandAction('emptyBlock', (args, cmds, append) => {
|
|
|
|
// const data = args[0]
|
|
|
|
// const data = args[0]
|
|
|
|
// console.log({ data }, ' useEffect props')
|
|
|
|
|
|
|
|
// // // var el = renderEmptyBlock(this, data)
|
|
|
|
// // // var el = renderEmptyBlock(this, data)
|
|
|
|
// // // append(el)
|
|
|
|
// // // append(el)
|
|
|
|
// }, { activate: true }, dispatch)
|
|
|
|
// }, { activate: true }, dispatch)
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
registerCommandAction('knownTransaction', function (args) { |
|
|
|
registerCommandAction('knownTransaction', function (args) { |
|
|
|
var data = args[0] |
|
|
|
var data = args[0] |
|
|
|
console.log({ data }) |
|
|
|
|
|
|
|
// let el
|
|
|
|
// let el
|
|
|
|
// if (data.tx.isCall) {
|
|
|
|
// if (data.tx.isCall) {
|
|
|
|
// console.log({ data })
|
|
|
|
|
|
|
|
// // el = renderCall(this, data)
|
|
|
|
// // el = renderCall(this, data)
|
|
|
|
// } else {
|
|
|
|
// } else {
|
|
|
|
// // el = renderKnownTransaction(this, data, blockchain)
|
|
|
|
// // el = renderKnownTransaction(this, data, blockchain)
|
|
|
@ -168,12 +157,14 @@ export const initListeningOnNetwork = (props, dispatch) => { |
|
|
|
}, { activate: true }, dispatch) |
|
|
|
}, { activate: true }, dispatch) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
props.txListener.event.register('newCall', () => { |
|
|
|
props.txListener.event.register('knownTransaction', (block) => { |
|
|
|
console.log('new call action') |
|
|
|
console.log({ block }, ' is call transaction test') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
props.txListener.event.register('newCall', (tx, receipt) => { |
|
|
|
|
|
|
|
log(props, tx, receipt, dispatch) |
|
|
|
// log(this, tx, null)
|
|
|
|
// log(this, tx, null)
|
|
|
|
}) |
|
|
|
}) |
|
|
|
props.txListener.event.register('newTransaction', (tx, receipt) => { |
|
|
|
props.txListener.event.register('newTransaction', (tx, receipt) => { |
|
|
|
console.log('new Transaction now') |
|
|
|
|
|
|
|
log(props, tx, receipt, dispatch) |
|
|
|
log(props, tx, receipt, dispatch) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -184,16 +175,12 @@ export const initListeningOnNetwork = (props, dispatch) => { |
|
|
|
if (props._deps.compilersArtefacts.__last) { |
|
|
|
if (props._deps.compilersArtefacts.__last) { |
|
|
|
compiledContracts = await props._deps.compilersArtefacts.__last.getContracts() |
|
|
|
compiledContracts = await props._deps.compilersArtefacts.__last.getContracts() |
|
|
|
} |
|
|
|
} |
|
|
|
console.log({ compiledContracts }) |
|
|
|
|
|
|
|
await props.eventsDecoder.parseLogs(tx, resolvedTransaction.contractName, compiledContracts, async (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('knownTransaction dispatch') |
|
|
|
|
|
|
|
await dispatch({ type: 'knownTransaction', payload: { message: [{ tx: tx, receipt: receipt, resolvedData: resolvedTransaction, logs: logs }] } }) |
|
|
|
await dispatch({ type: 'knownTransaction', payload: { message: [{ tx: tx, receipt: receipt, resolvedData: resolvedTransaction, logs: logs }] } }) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log('unknownTransaction') |
|
|
|
|
|
|
|
// contract unknown - just displaying raw tx.
|
|
|
|
// contract unknown - just displaying raw tx.
|
|
|
|
// logUnknownTX({ tx: tx, receipt: receipt })
|
|
|
|
// logUnknownTX({ tx: tx, receipt: receipt })
|
|
|
|
await dispatch({ type: 'unknownTransaction', payload: { message: [{ tx: tx, receipt: receipt }] } }) |
|
|
|
await dispatch({ type: 'unknownTransaction', payload: { message: [{ tx: tx, receipt: receipt }] } }) |
|
|
@ -206,8 +193,4 @@ export const initListeningOnNetwork = (props, dispatch) => { |
|
|
|
props.thisState.call('menuicons', 'select', 'debugger') |
|
|
|
props.thisState.call('menuicons', 'select', 'debugger') |
|
|
|
props.thisState.call('debugger', 'debug', hash) |
|
|
|
props.thisState.call('debugger', 'debug', hash) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
props.thisState.on('udapp', 'logHtml', (log) => { |
|
|
|
|
|
|
|
console.log({ log }, ' listen to logHTML call') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|