Solidity
如何下載或訪問(‘web3/lib/web3/event.js’);
以下測試腳本需要(‘web3/lib/web3/event.js’);
const SolidityEvent = require('web3/lib/web3/event.js'); function decodeLogs (logs, contract, address) { return logs.map(log => { const event = new SolidityEvent(null, contract.events[log.topics[0]], address); return event.decode(log); }); } module.exports = { decodeLogs, };
有誰知道我在哪裡可以找到該庫或者該庫是否隨 web3 下載一起安裝???
提前致謝 !!
安裝
truffle
並使用npm install web3
命令安裝web3。有關環境設置,請參閱本文。
答:只需要web3
const SolidityEvent = require('web3'); function decodeLogs (logs, contract, address) { return logs.map(log => { const event = new SolidityEvent(null, contract.events[log.topics[0]], address); return event.decode(log); }); } module.exports = { decodeLogs, };