Skip to content

Commit 4be2298

Browse files
committed
fix merge bug:cannot get contract-event
1 parent 48dc8de commit 4be2298

2 files changed

Lines changed: 24 additions & 23 deletions

File tree

solidity-example/solidity-TableTxs.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ contract DBTest {
111111
{
112112
string memory y = (db.getValueByIndex(handle, i, j));
113113
xxx = concat(xxx, y);
114-
xxx = concat(xxx, ", ");
114+
if(j != col - 1)
115+
xxx = concat(xxx, ", ");
115116
}
116117
xxx = concat(xxx, ";\n");
117118
}

src/eventManager.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -162,29 +162,29 @@ function onMessage(that,dataRes){
162162
}
163163
}
164164
}
165-
else if(data.type === "contract_event" && that.cache[data.ContractAddress] !== undefined){
166-
if(data.hasOwnProperty("ContractEventTopics")){
167-
data.ContractEventTopics.map(function(topic,index){
168-
data.ContractEventTopics[index] = "0x" + data.ContractEventTopics[index].toLowerCase();
169-
});
170-
}
171-
if(data.hasOwnProperty("ContractEventInfo") && data.ContractEventInfo !== ""){
172-
data.ContractEventInfo = "0x" + data.ContractEventInfo;
173-
}
174-
let key = data.ContractEventTopics[0];
175-
if(that.cache[key]){
176-
let contractObj = that.cache[data.ContractAddress];
177-
let currentEvent = contractObj.options.jsonInterface.find(function (json) {
178-
return (json.type === 'event' && json.signature === '0x'+ key.replace('0x',''));
179-
});
180-
let output = contractObj._decodeEventABI(currentEvent, data);
181-
that.cache[key](null, output);
182-
// delete that.cache[key];
183-
// let keyIndex = contractObj.registeredEvent.indexOf(key);
184-
// contractObj.registeredEvent.splice(keyIndex,1);
185-
}
186-
}
187165
}
166+
else if(data.type === "contract_event" && that.cache[data.ContractAddress] !== undefined){
167+
if(data.hasOwnProperty("ContractEventTopics")){
168+
data.ContractEventTopics.map(function(topic,index){
169+
data.ContractEventTopics[index] = "0x" + data.ContractEventTopics[index].toLowerCase();
170+
});
171+
}
172+
if(data.hasOwnProperty("ContractEventInfo") && data.ContractEventInfo !== ""){
173+
data.ContractEventInfo = "0x" + data.ContractEventInfo;
174+
}
175+
let key = data.ContractEventTopics[0];
176+
if(that.cache[key]){
177+
let contractObj = that.cache[data.ContractAddress];
178+
let currentEvent = contractObj.options.jsonInterface.find(function (json) {
179+
return (json.type === 'event' && json.signature === '0x'+ key.replace('0x',''));
180+
});
181+
let output = contractObj._decodeEventABI(currentEvent, data);
182+
that.cache[key](null, output);
183+
// delete that.cache[key];
184+
// let keyIndex = contractObj.registeredEvent.indexOf(key);
185+
// contractObj.registeredEvent.splice(keyIndex,1);
186+
}
187+
}
188188
}
189189

190190
function _isChainsqlType(data){

0 commit comments

Comments
 (0)