2024-03-26 09:03:52 +00:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
namespace CodexPlugin
|
2024-03-25 14:46:45 +00:00
|
|
|
|
{
|
|
|
|
|
public class DebugInfo
|
|
|
|
|
{
|
|
|
|
|
public string[] Addrs { get; set; } = Array.Empty<string>();
|
2024-03-26 07:58:16 +00:00
|
|
|
|
public string Spr { get; set; } = string.Empty;
|
|
|
|
|
public string Id { get; set; } = string.Empty;
|
|
|
|
|
public string[] AnnounceAddresses { get; set; } = Array.Empty<string>();
|
2024-03-26 09:03:52 +00:00
|
|
|
|
public DebugInfoVersion Version { get; set; } = new();
|
|
|
|
|
public DebugInfoTable Table { get; set; } = new();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DebugInfoVersion
|
|
|
|
|
{
|
|
|
|
|
public string Version { get; set; } = string.Empty;
|
|
|
|
|
public string Revision { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public bool IsValid()
|
|
|
|
|
{
|
|
|
|
|
return !string.IsNullOrEmpty(Version) && !string.IsNullOrEmpty(Revision);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return JsonConvert.SerializeObject(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DebugInfoTable
|
|
|
|
|
{
|
|
|
|
|
public DebugInfoTableNode LocalNode { get; set; } = new();
|
|
|
|
|
public DebugInfoTableNode[] Nodes { get; set; } = Array.Empty<DebugInfoTableNode>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DebugInfoTableNode
|
|
|
|
|
{
|
|
|
|
|
public string NodeId { get; set; } = string.Empty;
|
|
|
|
|
public string PeerId { get; set; } = string.Empty;
|
|
|
|
|
public string Record { get; set; } = string.Empty;
|
|
|
|
|
public string Address { get; set; } = string.Empty;
|
|
|
|
|
public bool Seen { get; set; }
|
2024-03-25 14:46:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DebugPeer
|
|
|
|
|
{
|
2024-03-26 07:58:16 +00:00
|
|
|
|
public bool IsPeerFound { get; set; }
|
2024-03-26 09:31:49 +00:00
|
|
|
|
public string PeerId { get; set; } = string.Empty;
|
|
|
|
|
public string[] Addresses { get; set; } = Array.Empty<string>();
|
2024-03-25 14:46:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LocalDataset
|
|
|
|
|
{
|
|
|
|
|
public ContentId Cid { get; set; } = new ContentId();
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-26 10:39:59 +00:00
|
|
|
|
public class SalesRequestStorageRequest
|
|
|
|
|
{
|
|
|
|
|
public string Duration { get; set; } = string.Empty;
|
|
|
|
|
public string ProofProbability { get; set; } = string.Empty;
|
|
|
|
|
public string Reward { get; set; } = string.Empty;
|
|
|
|
|
public string Collateral { get; set; } = string.Empty;
|
|
|
|
|
public string? Expiry { get; set; }
|
|
|
|
|
public uint? Nodes { get; set; }
|
|
|
|
|
public uint? Tolerance { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-25 14:46:45 +00:00
|
|
|
|
public class ContentId
|
|
|
|
|
{
|
|
|
|
|
public ContentId()
|
|
|
|
|
{
|
|
|
|
|
Id = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentId(string id)
|
|
|
|
|
{
|
|
|
|
|
Id = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Id { get; }
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
|
{
|
|
|
|
|
return obj is ContentId id && Id == id.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
|
|
|
|
return HashCode.Combine(Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|