From 33b82196f1237a4295dbd1a0bc4a1ca8322b3e0a Mon Sep 17 00:00:00 2001 From: hoak Date: Fri, 1 Oct 2021 15:15:07 +0100 Subject: [PATCH] Bumping solnet dependency versions and adding some missing comments. (#10) --- README.md | 6 +++--- SharedBuildProperties.props | 2 +- Solnet.Pyth.Examples/Solnet.Pyth.Examples.csproj | 6 +++--- Solnet.Pyth/ClientFactory.cs | 1 + Solnet.Pyth/Models/CorporateAction.cs | 4 ++-- Solnet.Pyth/Models/PriceInfo.cs | 4 ++-- Solnet.Pyth/Models/PriceStatus.cs | 10 +++++----- Solnet.Pyth/PythClient.cs | 8 ++++++-- Solnet.Pyth/Solnet.Pyth.csproj | 6 +++--- 9 files changed, 26 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 0c4e52d..2f11f26 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ separate repository so it is contained, as the goal for [Solnet](https://github. - net 5.0 ## Dependencies -- Solnet.Wallet 0.4.8 -- Solnet.Rpc 0.4.8 -- Solnet.Programs 0.4.8 +- Solnet.Wallet v0.4.9 +- Solnet.Rpc v0.4.9 +- Solnet.Programs v0.4.9 ## API diff --git a/SharedBuildProperties.props b/SharedBuildProperties.props index 05eae8a..7805698 100644 --- a/SharedBuildProperties.props +++ b/SharedBuildProperties.props @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> Solnet.Pyth - 0.2.1 + 0.2.2 Copyright 2021 © Solnet blockmountain blockmountain diff --git a/Solnet.Pyth.Examples/Solnet.Pyth.Examples.csproj b/Solnet.Pyth.Examples/Solnet.Pyth.Examples.csproj index 2508abf..64dcb4c 100644 --- a/Solnet.Pyth.Examples/Solnet.Pyth.Examples.csproj +++ b/Solnet.Pyth.Examples/Solnet.Pyth.Examples.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/Solnet.Pyth/ClientFactory.cs b/Solnet.Pyth/ClientFactory.cs index 3a02eb0..e2fac66 100644 --- a/Solnet.Pyth/ClientFactory.cs +++ b/Solnet.Pyth/ClientFactory.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Console; using Solnet.Rpc; namespace Solnet.Pyth diff --git a/Solnet.Pyth/Models/CorporateAction.cs b/Solnet.Pyth/Models/CorporateAction.cs index 4f10329..cbf420e 100644 --- a/Solnet.Pyth/Models/CorporateAction.cs +++ b/Solnet.Pyth/Models/CorporateAction.cs @@ -1,12 +1,12 @@ namespace Solnet.Pyth.Models { /// - /// + /// Represents the corporate action for a product. /// public enum CorporateAction { /// - /// + /// No action. /// NoCorporateAction } diff --git a/Solnet.Pyth/Models/PriceInfo.cs b/Solnet.Pyth/Models/PriceInfo.cs index 9cca97f..4ba1daf 100644 --- a/Solnet.Pyth/Models/PriceInfo.cs +++ b/Solnet.Pyth/Models/PriceInfo.cs @@ -72,7 +72,7 @@ internal static class Layout /// /// The aggregate corporate action. /// - public uint CorporateAction; + public CorporateAction CorporateAction; /// /// The aggregate publish slot. @@ -99,7 +99,7 @@ public static PriceInfo Deserialize(ReadOnlySpan data, double multiplier) ConfidenceComponent = confidenceComponent, Confidence = confidenceComponent * multiplier, Status = (PriceStatus) Enum.Parse(typeof(PriceStatus), data.GetU32(Layout.StatusOffset).ToString()), - CorporateAction = data.GetU32(Layout.CorporateActionOffset), + CorporateAction = (CorporateAction) Enum.Parse(typeof(CorporateAction), data.GetU32(Layout.CorporateActionOffset).ToString()), PublishSlot = data.GetU64(Layout.PublishSlotOffset) }; } diff --git a/Solnet.Pyth/Models/PriceStatus.cs b/Solnet.Pyth/Models/PriceStatus.cs index 33cd8b7..a2e9ae1 100644 --- a/Solnet.Pyth/Models/PriceStatus.cs +++ b/Solnet.Pyth/Models/PriceStatus.cs @@ -1,27 +1,27 @@ namespace Solnet.Pyth.Models { /// - /// + /// Represents the status of the asset for a price account. /// public enum PriceStatus { /// - /// + /// Unknown status. /// Unknown, /// - /// + /// Asset is trading. /// Trading, /// - /// + /// Trading of the asset has been halted. /// Halted, /// - /// + /// Asset is in auction mode. /// Auction } diff --git a/Solnet.Pyth/PythClient.cs b/Solnet.Pyth/PythClient.cs index e6f9569..508c0de 100644 --- a/Solnet.Pyth/PythClient.cs +++ b/Solnet.Pyth/PythClient.cs @@ -42,6 +42,7 @@ internal PythClient(ILogger logger = null, IRpcClient rpcClient = default, #region Streaming JSON RPC + /// public async Task SubscribePriceDataAccountAsync( Action action, string priceAccountAddress, Commitment commitment = Commitment.Finalized) @@ -65,21 +66,23 @@ public async Task SubscribePriceDataAccountAsync( return subOpenOrders; } + /// public Subscription SubscribePriceDataAccount(Action action, string priceAccountAddress, Commitment commitment = Commitment.Finalized) => SubscribePriceDataAccountAsync(action, priceAccountAddress, commitment).Result; + /// public Task UnsubscribePriceDataAccountAsync(string priceAccountAddress) { SubscriptionWrapper subscriptionWrapper = null; foreach (SubscriptionWrapper sub in _priceDataAccountSubscriptions) { - if (sub.Address.Key != priceAccountAddress) - continue; + if (sub.Address.Key != priceAccountAddress) continue; subscriptionWrapper = sub; _priceDataAccountSubscriptions.Remove(sub); + break; } return subscriptionWrapper == null @@ -87,6 +90,7 @@ public Task UnsubscribePriceDataAccountAsync(string priceAccountAddress) : StreamingRpcClient.UnsubscribeAsync(subscriptionWrapper.SubscriptionState); } + /// public void UnsubscribePriceDataAccount(string priceAccountAddress) => UnsubscribePriceDataAccountAsync(priceAccountAddress).Wait(); diff --git a/Solnet.Pyth/Solnet.Pyth.csproj b/Solnet.Pyth/Solnet.Pyth.csproj index 5bddb15..b4db07e 100644 --- a/Solnet.Pyth/Solnet.Pyth.csproj +++ b/Solnet.Pyth/Solnet.Pyth.csproj @@ -9,9 +9,9 @@ - - - + + +