truffle-assertions
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -97,8 +97,7 @@ const AssertionError = require('assertion-error'); | ||
createTransactionResult = async (contract, transactionHash) => { | ||
const transactionReceipt = web3.eth.getTransactionReceipt(transactionHash); | ||
const blockNumber = transactionReceipt.blockNumber; | ||
/* Web3 1.x uses contract.getPastEvents, Web3 0.x uses contract.allEvents() */ | ||
/* TODO: truffle-assertions 1.0 will only support Web3 1.x / Truffle v5 */ | ||
if (contract.getPastEvents) { | ||
const transactionReceipt = await web3.eth.getTransactionReceipt(transactionHash); | ||
const { blockNumber } = transactionReceipt; | ||
const eventList = await contract.getPastEvents("allEvents", {fromBlock: blockNumber, toBlock: blockNumber}); | ||
@@ -112,2 +111,4 @@ return { | ||
return new Promise((resolve, reject) => { | ||
const transactionReceipt = web3.eth.getTransactionReceipt(transactionHash); | ||
const { blockNumber } = transactionReceipt; | ||
contract.allEvents({fromBlock: blockNumber, toBlock: blockNumber}).get((error, events) => { | ||
@@ -114,0 +115,0 @@ if (error) reject(error); |
{ | ||
"name": "truffle-assertions", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "Additional assertions and utilities for testing Ethereum smart contracts in Truffle unit tests", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
15756
163