Decode ABI for events in VM mode

pull/1/head
Alex Beregszaszi 9 years ago
parent 5ed7199549
commit 2021ef1d38
  1. 15
      assets/js/universal-dapp.js

@ -183,11 +183,20 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
for (var i in response.vm.logs) {
// [address, topics, mem]
var log = response.vm.logs[i];
var abi = eventABI[log[1][0].toString('hex')];
var event = abi.event;
var decoded;
var event = eventABI[log[1][0].toString('hex')].event;
try {
var types = abi.inputs.map(function (item) {
return item.type;
});
decoded = EthJS.ABI.rawDecode(types, log[2]);
} catch (e) {
decoded = '0x' + log[2].toString('hex');
}
// FIXME: parse based on ABI (match event name + decode values)
parseLogs(null, { event: event, args: '0x' + log[2].toString('hex') });
parseLogs(null, { event: event, args: decoded });
}
});
} else {

Loading…
Cancel
Save