You are viewing a single comment's thread from:

RE: Tutorial - User Wallet History with Steem.js #12

in #utopian-io6 years ago

Very nice and concise tutorial.

I noticed you don't use promises, is there a reason for this? Steem-js api comes with bluebird as a dependency. It already provides Async methods. For example, filtering can be done as:

steem.api.getAccountHistoryAsync(ACCOUNT_NAME, -1, 50)
        .filter( tx => tx[1].op[0] === WALLET_FILTER )
        .each((transfer) => {
             displayTransactions(transfer)
        })

You may want to checkout my tutorial from awhile ago that shows account history traversal by date using generator functions and promises.

https://utopian.io/utopian-io/@r351574nc3/tutorial-viewing-steemit-account-history

Sort:  

hey, I did not realise Steem-js had bluebird as a dependency, that's pretty cool. I avoid using promises in the tutorials because I feel promises are less approachable to newer developers. As per your example, it does produce far cleaner code. I'm totally going to look at where I can implement some of this style into my projects and dig through your other tutorials. Thanks!

Coin Marketplace

STEEM 0.19
TRX 0.17
JST 0.033
BTC 64475.77
ETH 2770.60
USDT 1.00
SBD 2.66