Giter VIP home page Giter VIP logo

infura-events's People

Watchers

 avatar  avatar

Forkers

smitrajput

infura-events's Issues

How do you trigger the event?

Hi @dattnguyen82, thanks for share the repo. I have seen your medium's post and I tested your repo and it worked well with my own contract address. However, when i tried to put in practice your implementation with my own code, the event does not emit. So, i do not see how do you trigger your event?

I appreciate your response.

This is my solidity implementation:

pragma solidity ^0.4.23;

contract SimpleStorage {
uint v1;
uint v2;

constructor() public {
v1 = 0;
v2 = 0;
}
event simpleEvent(uint x, uint y);

function set(uint x, uint y) public {
v1 = x;
v2 = y;
}

function () public {
require (v1 < v2);
emit simpleEvent(v1, v2);
}
}

This is my web3js method to call the contract:

instance.methods
.set(1, 6)
.send({ from: "0xE8d5487CaEbFB3F3e93304161cAd0d5d3078B033" });

var event = instance.events
.simpleEvent()
.on("data", function(event) {
let simpleEvent = event.returnValues;
// Podemos acceder a los 3 objetos de este evento mediante el objeto event.returnValues:
console.log("A new zombie was born!", simpleEvent.x, simpleEvent.y);
})
.on("error", console.error);
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.