mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
3xpl websocket client in case anyone wanted one. Don't bother using it though, their websocket service is a piece of shit that's totally broken which I only found out after wasting a day on it.
This commit is contained in:
38
ThreeXplCliClient/ThreeXplClient.cs
Normal file
38
ThreeXplCliClient/ThreeXplClient.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Text.Json;
|
||||
using Spectre.Console;
|
||||
using ThreeXplWsClient.Events;
|
||||
|
||||
namespace ThreeXplCliClient;
|
||||
|
||||
public class ThreeXplClient
|
||||
{
|
||||
private List<string> _addresses =
|
||||
[
|
||||
"MC8TiBEsnQVjxbvLtTsUXjTBZTQaR8fe8X",
|
||||
"ltc1qks2m7hvmhs3c20zrfvptv9pvk82p8g70sgw5mk"
|
||||
];
|
||||
public async Task Start()
|
||||
{
|
||||
var client = new ThreeXplWsClient.ThreeXplWsClient();
|
||||
client.OnThreeXplPush += OnThreeXplEvent;
|
||||
await client.StartWsClient();
|
||||
while (true)
|
||||
{
|
||||
var prompt = AnsiConsole.Ask<string>("Channel: ");
|
||||
client.SendSubscribeRequest(prompt);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnThreeXplEvent(object sender, ThreeXplPushModel e, int connectionId)
|
||||
{
|
||||
AnsiConsole.MarkupLine("[blue]Received event from 3xpl[/]");
|
||||
foreach (var txn in e.Pub.Data.Data)
|
||||
{
|
||||
if (txn.Address == null) return;
|
||||
if (_addresses.Contains(txn.Address))
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[green]Saw txn I'm interested in: {txn.Address}, effect {txn.Effect}, currency {txn.Currency}[/]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user