Additional endpoints for SteemPlus backend
We have added three new endpoints to help us get data from SteemSQL, for a better flexibility in our extension. It might look like there is not much code behind this update, but I can guarantee that the complex SQL request kept us sweating for a good while.
New Features
Here are the new routes pushed in this update:
/api/get-received-witness-votes/[username]
: Get all the votes received by a witness along with a timestamp, voters Vests and Proxied Vests, for further filtering and sorting.
Result for @stoodkev
[{"timestamp":"2018-03-12T19:35:39.000Z","account":"ahugehug","totalVests":1741.36062,"accountVests":1741.36062,"proxiedVests":0}, ...]
/api/get-incoming-delegations/[username]
: Gets incoming delegations for @username. It returns a timestamp, the names of delegators, and the number of Vests being delegated.
Result for @stoodkev
[{"delegator":"steem-plus","vesting_shares":1026195.2327,"delegation_date":"2017-11-30T18:29:48.000Z"}, ... ]
/api/get-wallet-content/[username]
: Gets the 500 last items from @username's wallet, including incoming and outgoing transfers and claimed rewards.
Result for @stoodkev
[{"timestamp":"2018-04-23T09:58:27.000Z","reward_steem":0,"reward_sbd":0,"reward_vests":0,"amount":110.276,"amount_symbol":"SBD","type":"transfer_to","memo":"","to_from":"steem-plus"}, ... ]
Additionally, in order to protect the API from abuses, we implemented express-rate-limit
. It allows us to control the maximum number of calls to the API possible from the same IP address during a certain timeframe.
Commits
/api/get-received-witness-votes/[username]: This commit contains the definition of this route as well as the IP rate feature.
For more information consult the updated README and the full list of commits.
Coming soon
- More wallet transactions
- Rewards information
- User statistics
Wanna contribute?
Join us on Discord
Installation procedures
- Subscribe to SteemSQL (10 SBD/month)
- Clone this repository
npm install
- Set the environment variables (information received by transfer when you subscribe to SteemSQL). These environment variables are
LOGIN
,PASSWORD
,SQL_API
andDB
. npm run start
- You should be able to test it on
localhost:3000
.
Big shoutout to @jerrybanfield and his budgets project that allow us the speed up the development of SteemPlus!
@stoodkev and @cedricguillas for @steem-plus
Powered by @adsactly
Powered by @utopian-io
Like what I do? Vote @stoodkev for witness!
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for your contribution. @steemsql is not free anymore and thus we should be very careful in this as this potentially will make the API server a proxy between users and steemsql.
However, as I understand this, it is useful to separate logics from the presentation, as you are using the APIs in Chrome extension, thus intelligent users may view-source and get the API directly.
On here, line 86, you are missing a (NOLOCK) which might impose load to the steemsql server. And I am not sure this is the 'correct' way to get incoming delegation as you are making assumptions that the ID increases as the timestamp increases. You might want to look at alternative solution such as here
Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.
[utopian-moderator]
Hey @stoodkev! Thank you for the great work you've done!
We're already looking forward to your next contribution!
Fully Decentralized Rewards
We hope you will take the time to share your expertise and knowledge by rating contributions made by others on Utopian.io to help us reward the best contributions together.
Utopian Witness!
Vote for Utopian Witness! We are made of developers, system administrators, entrepreneurs, artists, content creators, thinkers. We embrace every nationality, mindset and belief.
Want to chat? Join us on Discord https://discord.me/utopian-io
@stoodkev i found couple errors with semicolon and EOL check this repository https://github.com/michal13171/steemplus-api