Skip to content

Commit

Permalink
Dto (#86)
Browse files Browse the repository at this point in the history
* up through Mirror

* first pass done
  • Loading branch information
dkackman authored Aug 1, 2023
1 parent 414620f commit a2e0966
Show file tree
Hide file tree
Showing 44 changed files with 414 additions and 49 deletions.
11 changes: 11 additions & 0 deletions src/chia-dotnet/ChiaTypes/AmountFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;

namespace chia.dotnet
{
public record AmountFilter
{
public IEnumerable<ulong> Values { get; init; } = new List<ulong>();

public FilterMode Mode { get; init; } = FilterMode.Exlude;
}
}
11 changes: 11 additions & 0 deletions src/chia-dotnet/ChiaTypes/AmountWithPuzzlehash.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;

namespace chia.dotnet
{
public record AmountWithPuzzlehash
{
public IEnumerable<TransactionType> Values { get; init; } = new List<TransactionType>();

public FilterMode Mode { get; init; } = FilterMode.Exlude;
}
}
12 changes: 0 additions & 12 deletions src/chia-dotnet/ChiaTypes/Announcement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,4 @@ public record Announcement
public string Message { get; init; } = string.Empty;
public string MorphBytes { get; init; } = string.Empty;
}
public record CoinAnnouncement
{
public string CoinId { get; init; } = string.Empty;
public string Message { get; init; } = string.Empty;
public string MorphBytes { get; init; } = string.Empty;
}
public record PuzzleAnnouncement
{
public string PuzzleHash { get; init; } = string.Empty;
public string Message { get; init; } = string.Empty;
public string MorphBytes { get; init; } = string.Empty;
}
}
10 changes: 10 additions & 0 deletions src/chia-dotnet/ChiaTypes/AutoClaimSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace chia.dotnet
{
public record AutoClaimSettings
{
public bool Enabled { get; init; }
public ulong TxFee { get; init; }
public ulong MinAmount { get; init; }
public ushort BatchSize { get; init; }
}
}
11 changes: 11 additions & 0 deletions src/chia-dotnet/ChiaTypes/BlockchainState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ namespace chia.dotnet
/// </summary>
public record BlockchainState
{
public string NodeId { get; init; } = string.Empty;
public ulong Difficulty { get; init; }
public bool GenesisChallengeInitiated { get; init; }
public int MempoolSize { get; init; }
public int MempoolCost { get; init; }
public ulong MempoolFees { get; init; }
public MempoolMinFees MempoolMinFees { get; init; } = new();
public int MempoolMaxTotalCost { get; init; }
public int BlockMaxCost { get; init; }
public BlockRecord? Peak { get; init; }
public BigInteger Space { get; init; }
public ulong SubSlotIters { get; init; }
public SyncState Sync { get; init; } = new();
}

public record MempoolMinFees
{
public double Cost5000000 { get; init; }
}
}
9 changes: 9 additions & 0 deletions src/chia-dotnet/ChiaTypes/CoinAnnouncement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace chia.dotnet
{
public record CoinAnnouncement
{
public string CoinId { get; init; } = string.Empty;
public string Message { get; init; } = string.Empty;
public string MorphBytes { get; init; } = string.Empty;
}
}
8 changes: 8 additions & 0 deletions src/chia-dotnet/ChiaTypes/CoinRecordOrder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace chia.dotnet
{
public enum CoinRecordOrder : byte
{
ConfirmedHeight = 1,
SpentHight = 2
}
}
8 changes: 8 additions & 0 deletions src/chia-dotnet/ChiaTypes/CoinType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace chia.dotnet
{
public enum CoinType : byte
{
Normal = 0,
Clawback = 1
}
}
11 changes: 11 additions & 0 deletions src/chia-dotnet/ChiaTypes/FarmerRewards.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace chia.dotnet
{
public record FarmerRewards
{
public ulong FarmedAmount { get; init; }
public ulong PoolRewardAmount { get; init; }
public ulong FarmerRewardAmount { get; init; }
public ulong FeeAmount { get; init; }
public ulong LastHeightFarmed { get; init; }
}
}
8 changes: 8 additions & 0 deletions src/chia-dotnet/ChiaTypes/FilterMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace chia.dotnet
{
public enum FilterMode : byte
{
Include = 1,
Exlude = 2
}
}
11 changes: 11 additions & 0 deletions src/chia-dotnet/ChiaTypes/HashFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;

namespace chia.dotnet
{
public record HashFilter
{
public IEnumerable<string> Values { get; init; } = new List<string>();

public FilterMode Mode { get; init; } = FilterMode.Exlude;
}
}
12 changes: 12 additions & 0 deletions src/chia-dotnet/ChiaTypes/InternalNode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace chia.dotnet
{
public record InternalNode
{
public string Hash { get; init; } = string.Empty;
public string LeftHash { get; init; } = string.Empty;
public string RightHash { get; init; } = string.Empty;
// TODO - need test case for serialization for this - tuple might not be the right type
public (string, string) Pair { get; init; } = new();
public string Atom { get; init; } = string.Empty;
}
}
9 changes: 9 additions & 0 deletions src/chia-dotnet/ChiaTypes/Layer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace chia.dotnet
{
public record Layer
{
public Side OtherHashSide { get; init; }
public string OtherHash { get; init; } = string.Empty;
public string CombinedHash { get; init; } = string.Empty;
}
}
9 changes: 9 additions & 0 deletions src/chia-dotnet/ChiaTypes/LineageProof.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace chia.dotnet
{
public record LineageProof
{
public string? ParentName { get; init; }
public string? InnerPuzzleHash { get; init; }
public ulong? Amount { get; init; }
}
}
13 changes: 13 additions & 0 deletions src/chia-dotnet/ChiaTypes/Mirror.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Collections.Generic;

namespace chia.dotnet
{
public record Mirror
{
public string CoinId { get; init; } = string.Empty;
public string LauncherId { get; init; } = string.Empty;
public ulong Amount { get; init; }
public IEnumerable<string> Urls { get; init; } = new List<string>();
public bool Ours { get; init; } = true;
}
}
74 changes: 72 additions & 2 deletions src/chia-dotnet/ChiaTypes/NFTInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,93 @@ namespace chia.dotnet
/// </summary>
public record NFTInfo
{
/// <summary>
/// Launcher coin ID
/// </summary>
public string LauncherId { get; init; } = string.Empty;
/// <summary>
/// Current NFT coin ID
/// </summary>
public string NFTCoinID { get; init; } = string.Empty;
/// <summary>
/// Owner DID
/// </summary>
public string? OwnerDID { get; init; }
/// <summary>
/// Percentage of the transaction fee paid to the author, e.g. 1000 = 1%
/// </summary>
public ushort? RoyaltyPercentage { get; init; }
/// <summary>
/// uzzle hash where royalty will be sent to
/// </summary>
public string? RoyaltyPuzzleHash { get; init; } = string.Empty;
/// <summary>
/// A list of content URIs
/// </summary>
public IEnumerable<string> DataUris { get; init; } = new List<string>();
/// <summary>
/// Hash of the content
/// </summary>
public string DataHash { get; init; } = string.Empty;
/// <summary>
/// A list of metadata URIs
/// </summary>
public IEnumerable<string> MetadataUris { get; init; } = new List<string>();
/// <summary>
/// Hash of the metadata
/// </summary>
public string MetaataHash { get; init; } = string.Empty;
/// <summary>
/// A list of license URIs
/// </summary>
public IEnumerable<string> LicenseUris { get; init; } = new List<string>();
public ulong SeriesTotal { get; init; }
public ulong SeriesNumber { get; init; }
/// <summary>
/// Hash of the license
/// </summary>
public string LicenseHash { get; init; } = string.Empty;
/// <summary>
/// How many NFTs in the current edition
/// </summary>
public ulong EditionTotal { get; init; }
/// <summary>
/// Number of the current NFT in the edition
/// </summary>
public ulong EditionNumber { get; init; }
/// <summary>
/// Puzzle hash of the metadata updater in hex
/// </summary>
public string UpdaterPuzhash { get; init; } = string.Empty;
/// <summary>
/// Information saved on the chain in hex
/// </summary>
public string ChainInfo { get; init; } = string.Empty;
/// <summary>
/// Block height of the NFT minting
/// </summary>
public uint MintHeight { get; init; }
/// <summary>
/// If the inner puzzle supports DID
/// </summary>
public bool SupportsDID { get; init; }
/// <summary>
/// Indicate if the NFT is pending for a transaction
/// </summary>
public bool PendingTransaction { get; init; }
/// <summary>
/// Puzzle hash of the singleton launcher in hex
/// </summary>
public string LauncherPuzhash { get; init; } = string.Empty;
/// <summary>
/// DID of the NFT minter
/// </summary>
public string? MinterDID { get; init; }
/// <summary>
/// Serialized off-chain metadata
/// </summary>
public string? OffChainMetadata { get; init; }
/// <summary>
/// The innermost puzzle hash of the NFT
/// </summary>
public string P2Address { get; init; } = string.Empty;
}
}
4 changes: 2 additions & 2 deletions src/chia-dotnet/ChiaTypes/NFTMintingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public record NFTMintingInfo
public string? MetaHash { get; init; }
public IEnumerable<string> LicenseUris { get; init; } = new List<string>();
public string? LicenseHash { get; init; }
public ulong SeriesTotal { get; init; } = 1;
public ulong SeriesNumber { get; init; } = 1;
public ulong EditionTotal { get; init; } = 1;
public ulong EditionNumber { get; init; } = 1;
}
}
5 changes: 3 additions & 2 deletions src/chia-dotnet/ChiaTypes/NodeType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace chia.dotnet
namespace chia.dotnet
{
public enum NodeType
{
Expand All @@ -7,6 +7,7 @@ public enum NodeType
FARMER = 3,
TIMELORD = 4,
INTRODUCER = 5,
WALLET = 6
WALLET = 6,
DATA_LAYER = 7
}
}
11 changes: 11 additions & 0 deletions src/chia-dotnet/ChiaTypes/OfferStore.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;

namespace chia.dotnet
{
public record OfferStore
{
public string StoreID { get; init; } = string.Empty;

public IEnumerable<KeyValuePair<string, string>> Inclusions { get; init; } = new Dictionary<string, string>();
}
}
File renamed without changes.
10 changes: 10 additions & 0 deletions src/chia-dotnet/ChiaTypes/PluginStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Collections.Generic;

namespace chia.dotnet
{
public record PluginStatus
{
public IDictionary<string, IDictionary<string, object>> Uploasders { get; init; } = new Dictionary<string, IDictionary<string, object>>();
public IDictionary<string, IDictionary<string, object>> Downloaders { get; init; } = new Dictionary<string, IDictionary<string, object>>();
}
}
2 changes: 1 addition & 1 deletion src/chia-dotnet/ChiaTypes/PoolState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public record PoolState
public string OwnerPubkey { get; init; } = string.Empty;

// the blockchain doesn't like it when the trailing slash is encoded into the nft (won't be able to decode and find wallet info)
public string? PoolUrl { get => poolUrl is not null ? poolUrl.TrimEnd('/') : null; init => poolUrl = value; }
public string? PoolUrl { get => poolUrl?.TrimEnd('/'); init => poolUrl = value; }

public uint RelativeLockHeight { get; init; }
}
Expand Down
9 changes: 6 additions & 3 deletions src/chia-dotnet/ChiaTypes/PrivateKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
{
public record PrivateKey
{
public string PK { get; init; } = string.Empty;

public string Entropy { get; init; } = string.Empty;
public uint Fingerprint { get; init; }
public string Sk { get; init; } = string.Empty;
public string Pk { get; init; } = string.Empty;
public string FarmerPk { get; init; } = string.Empty;
public string PoolPk { get; init; } = string.Empty;
public string Seed { get; init; } = string.Empty;
}
}
9 changes: 9 additions & 0 deletions src/chia-dotnet/ChiaTypes/PrivateKeyData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace chia.dotnet
{
public record PrivateKeyData
{
public string PK { get; init; } = string.Empty;

public string Entropy { get; init; } = string.Empty;
}
}
12 changes: 0 additions & 12 deletions src/chia-dotnet/ChiaTypes/PrivateKeyDetail.cs

This file was deleted.

12 changes: 12 additions & 0 deletions src/chia-dotnet/ChiaTypes/Proof.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections.Generic;

namespace chia.dotnet
{
public record Proof
{
public string Key { get; init; } = string.Empty;
public string Value { get; init; } = string.Empty;
public string NodeHash { get; init; } = string.Empty;
public IEnumerable<Layer> Layers { get; init; } = new List<Layer>();
}
}
9 changes: 9 additions & 0 deletions src/chia-dotnet/ChiaTypes/PuzzleAnnouncement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace chia.dotnet
{
public record PuzzleAnnouncement
{
public string PuzzleHash { get; init; } = string.Empty;
public string Message { get; init; } = string.Empty;
public string MorphBytes { get; init; } = string.Empty;
}
}
Loading

0 comments on commit a2e0966

Please sign in to comment.