SteemRadar.js - A New Major Release, New Features, Update 1.0.0

in #utopian-io5 years ago (edited)

Repository

https://github.com/gigatoride/steemradar.js

SteemRadar

logo.png
Logo design by @gigatoride only licensed for contributions related to this project

New Features

Support multiple funds tracking (Real-Time)

commit

multi-track.png

This is a new feature for funds tracking to support multi-track
Also, the code is now shorter and more readable the whole operation dependent upon the tracking of each transfer and saving the latest as a previous variable and then match the latest with previous

The following code is the pushing and matching process

const previousTrxData = nextTarget.operations[0][1];
const transactions = await api.getTransactions();
for (const trx of transactions) {
  const [latestTrxType, latestTrxData] = trx.operations[0];
  const isUnique = latestCatch !== trx.transaction_id;
  if (isUnique && latestTrxType === 'transfer') {
    const isSenderMatch = opts.multi
      ? linkedAccounts.includes(latestTrxData.from)
      : latestTrxData.from === previousTrxData.to;
    if (isSenderMatch) {
      latestCatch = trx.transaction_id;
      nextTarget = trx;
      linkedAccounts.push(latestTrxData.to);
      yield trx;
    }
    if (targetTrx && !exchanges.includes(previousTrxData.to)) out = true;

Scan for blockchain posts

commit

A new method for blockchain scans for the latest posts that recently published on steem blockchain in real-time
it keeps tracking by the author's names or the whole blockchain accounts

The verify process as the following it first checks this isn't a duplicate and then checks it is a post without parent author I mean then it matches the user input with the blockchain transaction author name or just optional if authors are false!

const isUnique = latestCatch !== trx.transaction_id;
const isPost = txType === 'comment' && !txData.parent_author;
const isAuthorExist = (authors && authors.includes(txData.author)) || !authors;

if (isUnique && isPost && isAuthorExist) {
  trx.transaction_id = latestCatch;
 yield trx;
}

Scan for blockchain comments

commit

A new method related to the previous one to keep scanning for latest users comments by authors or parent authors or even both of them.

The verify process as the following it first checks this isn't a duplicate and then checks it is a comment with the parent author which is the opposite in this case then it matches the user input with the blockchain transaction author & parent author name or just optional if authors are false!

const isUnique = latestCatch !== trx.transaction_id;
const isComment = txType === 'comment' && txData.parent_author;
const isParentAuthorExist = (parentAuthors && parentAuthors.includes(txData.parentAuthor)) || !parentAuthors;
const isAuthorExist = (authors && authors.includes(txData.author)) || !authors;
if (isUnique && isComment && isParentAuthorExist && isAuthorExist) {
  trx.transaction_id = latestCatch;
  yield trx;
}

Full support for utopian.io contributions posts

commit

In the previous code, I've been using the node-utopian-rocks API wrapper or I can say directly utopian.rocks API

Each scanning instance is making many requests if I've raised the milliseconds for every check it can miss some posts
also, the low milliseconds can be some type of brute force on the API so the previous code wasn't the perfect solution

As the scanning process needs a stable flow of data some times the utopian.rocks API is not available or functioning

I've made a decision to rely on the blockchain and to analyze each post by metadata like tag and the main category for each post instead of utopian.rock API. as it going to be faster and more reliable

The following is the supported categories for this method:

  • development
  • copywriting
  • graphics
  • analysis
  • social
  • documentation
  • blog
  • bug-hunting
  • ideas
  • video-tutorials
  • tutorials
  • anti-abuse
Please note that task requests aren't currently supported will be added soon

line1.png

Improvements & Bug Fixes

Better utils with built-in modules

commit1
commit2

  • isProfane
  • isBlacklisted

Update 1.0.1 for bug fix with some methods

commit

This commit is a patch forgetProfanitity() And getBlacklisted() to fix some errors with the scan process.
Also a fix for utils isProfane() to use .some method instead of .everyas it tests whether at least one word in the words array passes the profane test implemented by the profanity function. It returns a Boolean value.
Also, it fixes isBlacklisted() missing chunk push for rawData

Better readable code, Built-in utilities, Less dependency!

commit

As I've mentioned in the previous contribution post. in what's next part.

  • Add isValidAccountNames to utils for shorter code
  • Add get to method names
  • Apply built-in readable streams utility
  • Describe if/else statements with variables
  • Improve code readability
  • Merge exchanges to config with the ability to customize it
  • Add optional/null signs for jsdoc
  • Remove most of the dependencies

line2.png

Testing

Clone the repository:

git clone https://github.com/gigatoride/steemradar.js.git

Run test command:

npm test

tests.jpg

line1.png

Commits

on Jun 13, 2019 - Jun 20, 2019
https://github.com/gigatoride/steemradar.js/commits/master

line2.png

Github Account

https://github.com/gigatoride

Sort:  

Thank you for your contribution!

  1. You may add the unit tests part of the CI using travers-ci i.e. showing a green tag on the project page along with others.
  2. The tests you added previously may seem weak, which doesn't test your latest changes.
  3. Lack of Sample code to use your aliases
  4. Have you considered statusCode of 301 and 302 redirection? which might not mean Request Failed
  5. You might want to extract the for (const trx of transactions) { and use a filter call back to remove the duplication code in getPosts, getComments.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Thanks for the review.

  • The blockchain aliases pattern mostly the same as the one in README.md
    Also parameters documented here
  • statusCode 301 and 302 redirects are not expected from that API as I know but I will consider it.
  • The rest will be taken into account for the next update.

Thank you for your review, @justyy! Keep up the good work!

Hi @gigatoride!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Congratulations @gigatoride! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published more than 10 posts. Your next target is to reach 20 posts.
You received more than 500 as payout for your posts. Your next target is to reach a total payout of 1000

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

The Steem community has lost an epic member! Farewell @woflhart!
SteemitBoard - Witness Update
Do not miss the coming Rocky Mountain Steem Meetup and get a new community badge!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Hey, @gigatoride!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!