Project

xrbp

0.01
No commit activity in last 3 years
No release in over 3 years
Ruby XRP Tools
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.0.5
~> 3.8

Runtime

~> 0.2
~> 2.2
~> 0.9
~> 2.1
~> 2.1
~> 1.2
 Project Readme

XRBP - Ruby XRP Library

XRBP is a rubygem which provides a fault-tolerant interface to the XRP ledger.

With XRP you can connect to one or more rippled servers and use them to transparently read and write data to/from the XRP Ledger:

require 'xrbp'

ws = XRBP::WebSocket::Connection.new "wss://s1.ripple.com:443"
ws.add_plugin :autoconnect, :command_dispatcher

ws.cmd XRBP::WebSocket::Cmds::ServerInfo.new

XRBP provides fully-object-oriented mechanisms to interact with the ledger:

ws.on :ledger do |l|
  puts "Ledger received: "
  puts l
end

XRBP::Model::Ledger.subscribe(:connection => ws)

Supported Features:

Other data types besides ledgers may be syncronized:

puts XRBP::Model::Account.new("rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B").info

Also data from other sources, such as the Ripple DataV2 API

connection = XRBP::WebClient::Connection.new
XRBP::Model::Validator.all(:connection => connection)
                      .each do |v|
  puts v
end

XRPB allows easy access to the following data:

  • XRP ledgers, transactions, account, and objects
  • Network nodes, validators, gateways
  • Markets with quotes
  • & more (see examples/ for more use cases)

Multiple Connections

XRBP facilitates fault-tolerant applications by providing customizable strategies which to leverage multiple rippled servers in communications.

ws = XRBP::WebSocket::RoundRobin.new "wss://s1.ripple.com:443",
                                     "wss://s2.ripple.com:443"

ws.add_plugin :command_dispatcher
ws.connect

puts ws.cmd(XRBP::WebSocket::Cmds::ServerInfo.new)
puts ws.cmd(XRBP::WebSocket::Cmds::ServerInfo.new)

In this case the first ServerInfo command will be sent to s1.ripple.com while the second will be sent to s2.ripple.com.

The following demonstrates prioritized connections:

ws = XRBP::WebSocket::Prioritized.new "wss://s1.ripple.com:443",
                                      "wss://s2.ripple.com:443"

ws.add_plugin :command_dispatcher, :result_parser
ws.parse_results { |res|
  res["result"]["ledger"]
}
ws.connect

puts ws.cmd(XRBP::WebSocket::Cmds::Ledger.new(28327070))

s1.ripple.com will be queried for the specified ledger. If not present s2.ripple.com will be queried.

Installation / Documentation

XRPB may be installed with the following command:

$ gem install xrbp

Documentation is available online

License

Copyright (C) 2019 Dev Null Productions

Made available under the MIT License