GithubHelp home page GithubHelp logo

rahul-webd / eosio-statereceiver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from worldwide-asset-exchange/eosio-statereceiver

0.0 0.0 1.0 376 KB

License: MIT License

Shell 0.08% JavaScript 99.92%

eosio-statereceiver's Introduction

EOSIO state receiver

example workflow codecov

const StateReceiver = require('@waxio/eosio-statereceiver');

const sr = new StateReceiver({
  startBlock: 200,
  socketAddresses: [process.env.SOCKET_ADDRESS || 'ws://localhost:8080'],
  eosEndpoint: process.env.EOS_ENDPOINT || 'http://localhost:8888',
  deserializerActions: ['eosio.token::transfer'],
});

// sample trace handler
sr.registerTraceHandler({
  contractName: 'eosio.token',
  actionName: 'transfer',
  async processTrace(block_num, traces) {
    //
  },
});

sr.onError = (err) => {
  sr.stop();
  console.error(`State receiver stop due to ERROR:`, err);
};

sr.start();

Example can be found in state-receiver.js.

Running example:

export SOCKET_ADDRESS=http://localhost:8080
export EOS_ENDPOINT=http://localhost:8888

npm run dev

sample working log

$ npm run dev

> @waxio/[email protected] dev /home/ubuntu/eosio-statereceiver
> npm run state-receiver


> @waxio/[email protected] state-receiver /home/ubuntu/eosio-statereceiver
> node ./examples/state-receiver.js

Creating eosApi with endpoint: http://state-node-host:8888
Websocket connecting to: http://state-node-host:8080
Receiving abi...
Requesting blocks, Start : 20284880, End : 4294967295, Max Messages In Flight : 5
20284884 bridge.wax::nft2wax hg.wam
20284890 bridge.wax::nft2wax hg.wam
Received 918 B/s; Queue size: 20
Received 946.5 B/s; Queue size: 39
25077 returnvalue::returnstruct return value {"value1":"test value1 value1","value2":35594}
25264 returnvalue::returnstring return value "test test action return string"
...

eosio-statereceiver's People

Contributors

lukestokes avatar manh-vv avatar michaeljyeates avatar n8d avatar porkchop avatar rahul-webd avatar

Forkers

ankh2054

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.