Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
continue;
}
if (!contractAbi) {
// ABI not found for contract.
return;
}
relevantLogs.push(log);
abiDecoder.addABI(contractAbi);
}
if (relevantLogs.length > 0) {
decodedEvents = decodedEvents.concat(
abiDecoder.decodeLogs(relevantLogs)
);
}
}
return this.getFormattedEvents(decodedEvents);
}
};
logger.error('**** No contract found for contract address: ' + txReceipt.logs[i].address + ' at log index(' + i + ') in TxHash: ' + txReceipt.transactionHash + '');
continue;
}
// ABI not found
if (!contractAbi) {
logger.error("ABI not found for contract: "+contractAddr);
return;
}
relevantLogs.push(txReceipt.logs[i]);
abiDecoder.addABI(contractAbi);
}
if(relevantLogs.length > 0) {
decodedEvents = abiDecoder.decodeLogs(relevantLogs);
}
}
return this.getFormattedEvents(decodedEvents);
}
logs.push(logsInTheBlock.map(log => {
log = log.filter(a => this.contractAddresses.indexOf(a.address) >= 0);
let decodedLogs = abiDecoder.decodeLogs(log);
// Formating decoded logs to add extra data needed.
decodedLogs = decodedLogs.map((dLog, i) => {
return this.constructLogs(dLog, i, log, logsInTheBlock);
});
return decodedLogs;
}).filter(a => a.length > 0));
}
test("should emit log indicating transfer success", async () => {
const receipt = await web3Utils.getTransactionReceiptAsync(txHash);
const [transferLog] = compact(ABIDecoder.decodeLogs(receipt.logs));
expect(transferLog.name).toBe("Transfer");
});
test("emits log indicating successful fill", async () => {
const txHash = await orderApi.fillAsync(debtOrder);
const receipt = await web3Wrapper.getTransactionReceiptAsync(txHash);
const [debtOrderFilledLog] = _.compact(ABIDecoder.decodeLogs(receipt.logs));
expect(debtOrderFilledLog.name).toBe("LogDebtOrderFilled");
});
});
0,
0,
0,
0,
config.NULL_ADDRESS,
config.NULL_ADDRESS,
ownerSignature.signature,
txOptions
);
const txReceipt = await auxiliaryWeb3.eth.getTransactionReceipt(result.transactionHash);
abiDecoder.addABI(abiBinProvider.getABI('GnosisSafe'));
abiDecoder.addABI(abiBinProvider.getABI('TokenHolder'));
const decodedResult = abiDecoder.decodeLogs(txReceipt.logs);
const sessionsLoggedOutEvent = JSON.parse(JSON.stringify(decodedResult));
assert.strictEqual(sessionsLoggedOutEvent[0].name, 'SessionsLoggedOut', 'Incorrect event emitted');
assert.strictEqual(sessionsLoggedOutEvent[0].events[0].value, '2', 'Incorrect sessionwindow value');
});
export const getDecodedTxEventLogs = async (provider: string, txHash: string): Promise => {
const httpProvider = new HttpProvider(provider)
const ethClient = new Eth(httpProvider)
const txReceipt = await ethClient.getTransactionReceipt(txHash)
if (!txReceipt) {
throw Error(`Unable to retrieve transaction receipt for hash: '${txHash}'`)
}
return abiDecoder.decodeLogs(txReceipt.logs) as TDecodedLog[]
}
eth_getTransactionReceipt: (args, results, _, contracts) => {
let params = results;
if (results.length && results[0] && results[0].logs) {
const decodedLogs = abiDecoder.decodeLogs(results[0].logs);
params[0].logsDecoded = decodedLogs;
}
params = results.length ? results[0] : null;
return {
params,
};
},
eth_gasPrice: (args, results) => {
.get((err, result) => {
if (err) {
reject(err);
}
ABIDecoder.addABI(collateralizer.abi);
const decodedResults = ABIDecoder.decodeLogs(result);
ABIDecoder.removeABI(collateralizer.abi);
const collateralReturnedEvent = _.find(decodedResults, (log: any) => {
const foundEvent = _.find(log.events, (event: any) => {
return event.name === "agreementID" && event.value === agreementId;
});
return log.name === eventName && foundEvent;
});
resolve(!_.isUndefined(collateralReturnedEvent));
});
});