Radiator v0.4.5 - STEEM Ruby API Client: Steem Engine Support

6개월 전

Repository

https://github.com/inertia186/radiator

One of the major advantages to using Radiator is HTTP Persistence. This is the idea that the API client maintains a persistent connection to the server and only recreates the connection as needed or when there's a service interruption.

This means that instead of connecting to the server for each request, it keeps the connection open over the course of the application lifetime. For applications that use Steem Engine, this can be particularly useful.

The normal Steem Engine request/response lifecycle on the public RPC node can take between 1 and 4 seconds, depending on how busy the side-chain is. But using Radiator, I've gotten this down to 200 milliseconds after the first initialization.

To update your applications:

bundle update

Changes in v0.4.5


Generalized Side-Chain Support

Steem Smart Contract side-chains are now supported by Radiator. The default side-chain is Steem Engine.

This will fetch the latest block from the side-chain ...

rpc = Radiator::SSC::Blockchain.new
rpc.latest_block_info

This will fetch block 1 ...

rpc.block_info(1)

Or a specific transaction ...

rpc.transaction_info('9d288aab2eb66064dc0d4492cb281512386e2293')

You can also do contract queries. This will look up the tokens contract:

rpc = Radiator::SSC::Contracts.new
rpc.contract('tokens')

This will look up a specific record in a contract result ...

rpc.find_one(
  contract: "tokens",
  table: "balances",
  query: {
    symbol: "STINGY",
    account: "inertia"
  }
)

Or get multiple results ...

rpc.find(
  contract: "tokens",
  table: "balances",
  query: {
    symbol: "STINGY"
  }
)

Side-chain Streaming

Streaming side-chain transactions are also now supported:

# Default side-chain is Steem Engine.
stream = Radiator::SSC::Stream.new
stream.transactions do |tx, trx_id|
  puts "[#{trx_id}] #{tx.to_json}"
end

Even whole side-chain blocks:

stream.blocks do |bk, num|
  puts "[#{num}] #{bk.to_json}"
end

Resources

Previous Changes

Github

https://github.com/inertia186

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
STEEMKR.COM IS SPONSORED BY
ADVERTISEMENT
Sort Order:  trending

Thank you very much for your contribution.

  1. It is a nice piece of work, although at first I'd like to give suggestions on putting more description on your commit messages and split your changes over several commits. Creating a feature branch then merge it to your master branch, which will make your commit history a bit more oraganised and clean.
  2. Nice to see that you have unit tests - and I am curious to know that will this test be too fragile? if the balance changes somehow?
  3. You probably can fork your http object and test more functionalities of your Stream class.

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]

·

... I am curious to know that will this test be too fragile? if the balance changes somehow?

Short answer: yes, with an "if." Long answer: no, with a "but."

The tests are wrapped in a vcr_cassette closure that records the first request to a .yml file. Subsequent test runs will not be affected by real-world changes on the side-chain until the .yml file is deleted. I have a task called rake clean:vcr that deletes all of these .yml files, which I use for picking up real-world changes. In that situation, yes, this test would break.

This approach means Continuous Integrations won't break, which is all I want. Typically, I only delete the .yml files as a last step. I actually recommend some fragile tests like this to help test around null hypothesis assumptions.

Good point about the Stream class. Thanks for the suggestions.

·

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

I'm sure someone will know how to use this! :) Thanks for building things.

·

Most of the time, I build stuff I need. I release it for people who might need it too. And in doing so, I sometimes get feedback on ways to improve it.

In this case, I have three or four projects that needed this particular solution. And rather than write it four different ways, I can just use this. I also get the benefit of certain design solutions that basically come along for free because I already solved those problems here.

Hi @inertia ! We are so excited to connect with you again as moonSTEEM V2 is NOW LIVE and BIGGER !

Try your luck, possibility to win more than 300 STEEM every round !
FREE Upvote player lottery worth 0.78$ every 2 and half hours !

🚀🌕 PLAY NOW on moonSTEEM.com !

Earn tokens by playing, delegating, bringing friends, investing and get a share of profits !
Invest in the Bankroll and get even more profits !

Hi, @inertia!

You just got a 1.1% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Hi @inertia!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 6.605 which ranks you at #144 across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 187 contributions, your post is ranked at #8.

Evaluation of your UA score:
  • You've built up a nice network.
  • The readers appreciate your great work!
  • Good user engagement!

Feel free to join our @steem-ua Discord server

Hey, @inertia!

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!

@inertia You have received a 100% upvote from @intro.bot because this post did not use any bidbots and you have not used bidbots in the last 30 days!

Upvoting this comment will help keep this service running.

Hello @inertia, not sure where to contact you but I'm planning of creating a bot similar to what you built for dramatoken where a user issues a specific command and the bot catches this to issue a steem engine token.

·

Sounds like fun. Are you going to write the bot in ruby?

·
·

Are you okay to share the code for drama token bot? I'm more comfortable with JS but I'm willing to use Ruby since drama token's bot is already working/implented most of what I need.

It's for Asher's ENGAGE token.

·
·
·

You might take a look at:

https://steemit.com/steem-engine/@inertia/the-stingy-oracle-goes-open-source

That will only help you work out distribution. It doesn't follow commands. To figure out commands, you can look at:

https://steemit.com/radiator/@inertia/freakazoid-cleverbot-integration-for-steem

·
·
·
·

Thanks for the direction. This is noted. I'm also looking at holger80's implementation. It's in Python.

Neat! Me dumb, but me know Inertia is smart.

What is good ROI Inertia Bot recommended to delegate to? Booster?

usa