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

Release 2.3.0 #6

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
29 changes: 29 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: ci

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Run the tests
run: npm test -- --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
node_modules/
coverage/
.DS_Store
logs/*.log
logs/*.json
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
registry=https://npm.pkg.github.com/eosdac
saveExact=true
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 eosDAC
Copyright (c) 2022 WAX

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# EOSIO state receiver

![example workflow](https://github.com/worldwide-asset-exchange/eosio-statereceiver/actions/workflows/coverage.yml/badge.svg)
[![codecov](https://codecov.io/gh/worldwide-asset-exchange/eosio-statereceiver/branch/master/graph/badge.svg?token=NROW4EZKDO)](https://codecov.io/gh/worldwide-asset-exchange/eosio-statereceiver)

```js
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](examples/state-receiver.js).

Running example:

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

npm run dev
```

sample working log

```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"
...
```
245 changes: 0 additions & 245 deletions connection.js

This file was deleted.

Loading