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

Words
248
Reading
2 min
Listen
Play
7y

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