Default contract type on UI (#3310)

* Added Token and Wallet ABI in Watch Contract #3126

* Improved ABI Validator #3281

* Select contract type on first screen #3126

* Added types decsription

* Add ABI type to Contract metadata // Custom as default type #3310
This commit is contained in:
Nicolas Gotchac
2016-11-10 11:27:35 +01:00
committed by Gav Wood
parent 2f98169539
commit 67ac05ef39
6 changed files with 227 additions and 33 deletions

View File

@@ -136,27 +136,30 @@ export default class Contract {
}
parseEventLogs (logs) {
return logs.map((log) => {
const signature = log.topics[0].substr(2);
const event = this.events.find((evt) => evt.signature === signature);
return logs
.map((log) => {
const signature = log.topics[0].substr(2);
const event = this.events.find((evt) => evt.signature === signature);
if (!event) {
throw new Error(`Unable to find event matching signature ${signature}`);
}
if (!event) {
console.warn(`Unable to find event matching signature ${signature}`);
return null;
}
const decoded = event.decodeLog(log.topics, log.data);
const decoded = event.decodeLog(log.topics, log.data);
log.params = {};
log.event = event.name;
log.params = {};
log.event = event.name;
decoded.params.forEach((param) => {
const { type, value } = param.token;
decoded.params.forEach((param) => {
const { type, value } = param.token;
log.params[param.name] = { type, value };
});
log.params[param.name] = { type, value };
});
return log;
});
return log;
})
.filter((log) => log);
}
parseTransactionEvents (receipt) {