Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development issue #15

Open
BeeSeeChain opened this issue Aug 4, 2018 · 3 comments
Open

Development issue #15

BeeSeeChain opened this issue Aug 4, 2018 · 3 comments

Comments

@BeeSeeChain
Copy link

Hi, i'm using the amazing framework,but i couldn't to getting a event of solidity in VUE,for example:
PlaygroudBattle.sol
contract PlaygroundBattle is Destructible {
address public dbAddress;

event won(bool status,uint amount);

}

The problem is: How should i to do for using "event won() " in DOkwufulueze/eth-vue framework in VUE?

@DOkwufulueze
Copy link
Owner

Hi, @BeeSeeChain

To have Solidity emit events that you can listen to on the dApp, you'll have to run the event within the relevant context. For example, using the event won that you declared in this issue (assuming amount is known), one would expect to see a method where the event is emitted thus:

    won(true, amount)

By running the event as stated above, Solidity emits the won event, which can easily be listened to outside the blockchain.

Let us know if this helps or not [hoping it'll help :)].

@BeeSeeChain
Copy link
Author

Thanks for your reply
but when i'm doing like this in Vue for listening event like this

      let playgroundBattleContractInstance = contract(PlaygroundBattleContractJSON)
      playgroundBattleContractInstance.setProvider(this.$store.state.web3.instance().currentProvider)
      let won = playgroundBattleContractInstance.won()
      won.watch((err, result) => {
        if (err) {
          console.log('could not get event won()')
        } else {
          this.winEvent = result.args
          this.pending = false
        }
      })

i will recived that error :
Uncaught (in promise) TypeError: playgroundBattleContractInstance.won is not a function

so can i do for listening solidity event correctly in DOkwufulueze/eth-vue?how should i write the Code?

@DOkwufulueze
Copy link
Owner

@BeeSeeChain Could you check the logs to see how playgroundBattleContractInstance is structured? That should help you try to read its members correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants