From ed35a3d188d9f69e5c3146a2a4e41f45e2871897 Mon Sep 17 00:00:00 2001 From: Cedric Decoster Date: Sat, 2 Mar 2024 13:38:33 +0100 Subject: [PATCH] Feat next release 0920 (#79) * updated unstable naming * tipo * increased version --- Substrate.NetApi.TestNode/ExtrinsicsTest.cs | 35 +++++++++++---------- Substrate.NetApi/Modules/UnstableCalls.cs | 4 +-- Substrate.NetApi/SubscriptionListener.cs | 13 +------- Substrate.NetApi/Substrate.NetApi.csproj | 2 +- 4 files changed, 22 insertions(+), 32 deletions(-) diff --git a/Substrate.NetApi.TestNode/ExtrinsicsTest.cs b/Substrate.NetApi.TestNode/ExtrinsicsTest.cs index e705ac7..14ad47b 100644 --- a/Substrate.NetApi.TestNode/ExtrinsicsTest.cs +++ b/Substrate.NetApi.TestNode/ExtrinsicsTest.cs @@ -106,26 +106,27 @@ public async Task Extrinsic_TransactionUnstableSubmitAndWatchAsync() var method = new Method(0, "System", 0, "remark", new byte[] { 0x04, 0xFF }); var taskCompletionSource = new TaskCompletionSource<(bool, Hash)>(); - _ = await _substrateClient.Unstable.TransactionUnstableSubmitAndWatchAsync((string subscriptionId, TransactionEventInfo extrinsicUpdate) => - { - switch (extrinsicUpdate.TransactionEvent) - { - case TransactionEvent.Finalized: - taskCompletionSource.SetResult((true, extrinsicUpdate.Hash)); - break; + _ = await _substrateClient.Unstable.TransactionUnstableSubmitAndWatchAsync( + (subscriptionId, extrinsicUpdate) => + { + switch (extrinsicUpdate.TransactionEvent) + { + case TransactionEvent.Finalized: + taskCompletionSource.SetResult((true, extrinsicUpdate.Hash)); + break; - case TransactionEvent.Dropped: - Assert.Fail("Extrinsic was dropped!"); - break; + case TransactionEvent.Dropped: + Assert.Fail("Extrinsic was dropped!"); + break; - case TransactionEvent.Invalid: - Assert.Fail("Extrinsic was invalid!"); - break; + case TransactionEvent.Invalid: + Assert.Fail("Extrinsic was invalid!"); + break; - case TransactionEvent.Error: - Assert.Fail("Extrinsic was errored!"); - break; - } + case TransactionEvent.Error: + Assert.Fail("Extrinsic was errored!"); + break; + } }, method, Alice, _chargeType, 64, CancellationToken.None); var finished = await Task.WhenAny(taskCompletionSource.Task, Task.Delay(TimeSpan.FromMinutes(1))); diff --git a/Substrate.NetApi/Modules/UnstableCalls.cs b/Substrate.NetApi/Modules/UnstableCalls.cs index d8901bf..927fa7f 100644 --- a/Substrate.NetApi/Modules/UnstableCalls.cs +++ b/Substrate.NetApi/Modules/UnstableCalls.cs @@ -51,7 +51,7 @@ public async Task TransactionUnstableSubmitAndWatchAsync(Action TransactionUnstableSubmitAndWatchAsync(Action callback, string parameters, CancellationToken token) { var subscriptionId = - await _client.InvokeAsync("transaction_unstable_submitAndWatch", new object[] { parameters }, token); + await _client.InvokeAsync("transactionWatch_unstable_submitAndWatch", new object[] { parameters }, token); _client.Listener.RegisterCallBackHandler(subscriptionId, callback); return subscriptionId; } @@ -66,7 +66,7 @@ public async Task TransactionUnstableUnwatchAsync(string subscriptionId) public async Task TransactionUnstableUnwatchAsync(string subscriptionId, CancellationToken token) { var result = - await _client.InvokeAsync("transaction_unstable_unwatch", new object[] { subscriptionId }, token); + await _client.InvokeAsync("transactionWatch_unstable_unwatch", new object[] { subscriptionId }, token); if (result) _client.Listener.UnregisterHeaderHandler(subscriptionId); return result; } diff --git a/Substrate.NetApi/SubscriptionListener.cs b/Substrate.NetApi/SubscriptionListener.cs index 3299038..e590d0d 100644 --- a/Substrate.NetApi/SubscriptionListener.cs +++ b/Substrate.NetApi/SubscriptionListener.cs @@ -147,23 +147,12 @@ public void AuthorSubmitAndWatchExtrinsic(string subscription, ExtrinsicStatus r GenericCallBack(subscription, result); } - /// - /// TODO: Probablly deprecated, Authors the submit and watch extrinsic. - /// - /// - /// - [JsonRpcMethod("transaction_unstable_submitExtrinsic")] - public void TransactionUnstableSubmitExtrinsic(string subscription, TransactionEventInfo result) - { - GenericCallBack(subscription, result); - } - /// /// Transaction unstable watch eventc. /// /// /// - [JsonRpcMethod("transaction_unstable_watchEvent")] + [JsonRpcMethod("transactionWatch_unstable_watchEvent")] public void TransactionUnstableWatchEventc(string subscription, TransactionEventInfo result) { GenericCallBack(subscription, result); diff --git a/Substrate.NetApi/Substrate.NetApi.csproj b/Substrate.NetApi/Substrate.NetApi.csproj index 3f924a5..dab35c4 100644 --- a/Substrate.NetApi/Substrate.NetApi.csproj +++ b/Substrate.NetApi/Substrate.NetApi.csproj @@ -3,7 +3,7 @@ Substrate.NET.API netstandard2.0;netstandard2.1;net6.0 - 0.9.19 + 0.9.20 Substrate Gaming Substrate Gaming true