Browse Source

Version 0.4.2

master v0.4.2
Ezerous 4 years ago
parent
commit
bcdaa2f5c0
  1. 4
      package.json
  2. 15
      src/contracts/contractsSaga.js
  3. 751
      yarn.lock

4
package.json

@ -1,6 +1,6 @@
{
"name": "@ezerous/drizzle",
"version": "0.4.1",
"version": "0.4.2",
"description": "A reactive data-store for web3 and smart contracts.",
"license": "MIT",
"author": "Ezerous <ezerous@gmail.com>",
@ -11,6 +11,6 @@
"is-plain-object": "~5.0.0",
"redux": "~4.0.5",
"redux-saga": "~1.1.3",
"web3": "~1.3.0"
"web3": "~1.3.4"
}
}

15
src/contracts/contractsSaga.js

@ -6,6 +6,18 @@ import * as TransactionsActions from '../transactions/transactionsActions'
/*
* Events
*/
// Patch for EVENT_FIRED being called multiple times for the same event
let eventSet = new Set();
function isEventUnique(event){
const size = eventSet.size;
eventSet.add(event.event + '-' + event.transactionHash);
if(eventSet.size>size)
return true;
return false;
}
export function createContractEventChannel ({
contract,
eventName,
@ -14,8 +26,9 @@ export function createContractEventChannel ({
const name = contract.contractName
return eventChannel(emit => {
const eventListener = contract.events[eventName](eventOptions)
const eventListener = contract.events[eventName]()
.on('data', event => {
if(isEventUnique(event))
emit({ type: ContractActions.CONTRACT_EVENT_FIRED, name, event })
})
.on('changed', event => {

751
yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save