Created
December 6, 2017 12:08
-
-
Save jdkanani/78d6a87ba6e0b4b4f4bb41fca3fd559d to your computer and use it in GitHub Desktop.
Dagger example 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// web3 contract | |
var web3Contract = new web3.eth.Contract(abi, address); | |
// dagger contract | |
var contract = dagger.contract(web3Contract); | |
var filter = contract.events.Transfer({filter: {from: '0x123456...'}, room: 'latest'}); | |
// watch | |
filter.watch(function(data, removed){ | |
// data.returnValues.to : address to which it has been transferred to | |
// data.returnValues.value : value which has been transferred | |
}); | |
// watch only once | |
filter.watchOnce(function(data, removed){ | |
// data.returnValues.to : address to which it has been transferred to | |
// data.returnValues.value : value which has been transferred | |
}); | |
// stop watching | |
filter.stopWatching(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment