RippleLibSharp Account Transactions Example
Import the necessary libraries
using System.Threading;
using System.Threading.Tasks;
using RippleLibSharp.Commands.Accounts;
using RippleLibSharp.Keys;
using RippleLibSharp.Network;
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;
}
Retrieve transactions for an account
RippleAddress account = new RippleAddress("");
string ledger_index_min = null;
string ledger_index_max = null;
int? limit = null;
bool forward = false;
var task = AccountTransactions.GetResult(account, network, token);
task.Wait(token);
Response<AccountTxResult> response = task.Result;
AccountTxResult accountTxResult = response.result;
RippleTxStructure[] transactions = accountTxResult.transactions;