RippleLibSharp Book Offers Example
Import the necessary libraries
using System.Threading;
using RippleLibSharp.Commands.Stipulate;
using RippleLibSharp.Network;
using RippleLibSharp.Transactions;
using RippleLibSharp.Result;
Connect to the xrp ledger
var tokenSource = new CancellationTokenSource();
var token = tokenSource.Token;
ConnectionSettings connectInfo = new ConnectionSettings
{
ServerUrls = new string[] { "wss://s1.ripple.com:443", "wss://s2.ripple.com:443" },
LocalUrl = "localhost",
UserAgent = "optional spoof browser user agent",
Reconnect = true
};
NetworkInterface network = new NetworkInterface(connectInfo);
bool didConnect = network.Connect();
if (!didConnect) {
return;
}
RippleCurrency base_currency = new RippleCurrency(1.0m);
RippleCurrency counter_currency = new RippleCurrency(1.0m, "", "ICE");
uint? limit = 200;
var task = BookOffers.GetResult(
counter_currency,
base_currency,
limit,
network,
token);
Offer[] offers = task?.Result?.result?.offers;