maticnetwork / dagger.js

Simple library to connect with dagger server and manage subscriptions for Ethereum Blockchain.
https://matic.network/dagger
MIT License
218 stars 42 forks source link

latest:addr/0x3693.../tx/in not working #19

Closed fbslo closed 5 years ago

fbslo commented 5 years ago

I have this code:

var Dagger = require("eth-dagger");

// connect to Dagger ETH ropsten network over web socket
var dagger = new Dagger('wss://ropsten.dagger.matic.network');

// confirmed (irreversible) incoming transaction
dagger.on("confirmed:addr/0x3693f7449BD461F74975D571E7e3Bc031eF73586/tx/in", function(result) {
  console.log('Confirmed'+ result)
});

// latest incoming transaction
dagger.on("latest:addr/0x3693f7449BD461F74975D571E7e3Bc031eF73586/tx/in", function(result) {
  console.log('Latest: ' + result)
});

When I run it, it return only:

reconnecting...
Confirmed[object Object]

Here is tx: https://ropsten.etherscan.io/tx/0x746ec51d25b5235217bf690e03da6ebbcfe8e9e22b0a0a7b21c2df5f285d2a65

0xAshish commented 5 years ago

yup, that's correct, you need to store that object somewhere if you want to see what's inside the object try

dagger.on("latest:addr/0x3693f7449BD461F74975D571E7e3Bc031eF73586/tx/in", function(result) {
  console.log('Latest: ' + JSON.stringify(result))
});

@fbslo

fbslo commented 5 years ago

Thank you 👍 It's working now 😃

P.S. It should be JSON.stringify(result) 😉