xrpld
Loading...
Searching...
No Matches
xrpl::test::JSONRPCClient Class Reference
Inheritance diagram for xrpl::test::JSONRPCClient:
Collaboration diagram for xrpl::test::JSONRPCClient:

Public Member Functions

 JSONRPCClient (Config const &cfg, unsigned rpcVersion)
json::Value invoke (std::string const &cmd, json::Value const &params) override
 Submit a command synchronously.
unsigned version () const override
 Get RPC 1.0 or RPC 2.0.

Static Private Member Functions

static boost::asio::ip::tcp::endpoint getEndpoint (BasicConfig const &cfg)
template<class ConstBufferSequence>
static std::string bufferString (ConstBufferSequence const &b)

Private Attributes

boost::asio::ip::tcp::endpoint ep_
boost::asio::io_context ios_
boost::asio::ip::tcp::socket stream_
boost::beast::multi_buffer bin_
boost::beast::multi_buffer bout_
unsigned rpcVersion_

Detailed Description

Definition at line 37 of file JSONRPCClient.cpp.

Constructor & Destructor Documentation

◆ JSONRPCClient()

xrpl::test::JSONRPCClient::JSONRPCClient ( Config const & cfg,
unsigned rpcVersion )
explicit

Definition at line 88 of file JSONRPCClient.cpp.

Member Function Documentation

◆ getEndpoint()

boost::asio::ip::tcp::endpoint xrpl::test::JSONRPCClient::getEndpoint ( BasicConfig const & cfg)
staticprivate

Definition at line 40 of file JSONRPCClient.cpp.

◆ bufferString()

template<class ConstBufferSequence>
std::string xrpl::test::JSONRPCClient::bufferString ( ConstBufferSequence const & b)
staticprivate

Definition at line 71 of file JSONRPCClient.cpp.

◆ invoke()

json::Value xrpl::test::JSONRPCClient::invoke ( std::string const & cmd,
json::Value const & params )
overridevirtual

Submit a command synchronously.

The arguments to the function and the returned JSON are in a normalized format, the same whether the client is using the JSON-RPC over HTTP/S or WebSocket transport.

Parameters
cmdThe command to execute
paramsjson::Value of null or object type with zero or more key/value pairs.
Returns
The server response in normalized format.

Implements xrpl::test::AbstractClient.

Definition at line 101 of file JSONRPCClient.cpp.

◆ version()

unsigned xrpl::test::JSONRPCClient::version ( ) const
nodiscardoverridevirtual

Get RPC 1.0 or RPC 2.0.

Implements xrpl::test::AbstractClient.

Definition at line 150 of file JSONRPCClient.cpp.

Member Data Documentation

◆ ep_

boost::asio::ip::tcp::endpoint xrpl::test::JSONRPCClient::ep_
private

Definition at line 80 of file JSONRPCClient.cpp.

◆ ios_

boost::asio::io_context xrpl::test::JSONRPCClient::ios_
private

Definition at line 81 of file JSONRPCClient.cpp.

◆ stream_

boost::asio::ip::tcp::socket xrpl::test::JSONRPCClient::stream_
private

Definition at line 82 of file JSONRPCClient.cpp.

◆ bin_

boost::beast::multi_buffer xrpl::test::JSONRPCClient::bin_
private

Definition at line 83 of file JSONRPCClient.cpp.

◆ bout_

boost::beast::multi_buffer xrpl::test::JSONRPCClient::bout_
private

Definition at line 84 of file JSONRPCClient.cpp.

◆ rpcVersion_

unsigned xrpl::test::JSONRPCClient::rpcVersion_
private

Definition at line 85 of file JSONRPCClient.cpp.