Skip to content

Commit

Permalink
Feat next release 0920 (#79)
Browse files Browse the repository at this point in the history
* updated unstable naming

* tipo

* increased version
  • Loading branch information
darkfriend77 authored Mar 2, 2024
1 parent 6f30480 commit ed35a3d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 32 deletions.
35 changes: 18 additions & 17 deletions Substrate.NetApi.TestNode/ExtrinsicsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
4 changes: 2 additions & 2 deletions Substrate.NetApi/Modules/UnstableCalls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task<string> TransactionUnstableSubmitAndWatchAsync(Action<string,
public async Task<string> TransactionUnstableSubmitAndWatchAsync(Action<string, TransactionEventInfo> callback, string parameters, CancellationToken token)
{
var subscriptionId =
await _client.InvokeAsync<string>("transaction_unstable_submitAndWatch", new object[] { parameters }, token);
await _client.InvokeAsync<string>("transactionWatch_unstable_submitAndWatch", new object[] { parameters }, token);
_client.Listener.RegisterCallBackHandler(subscriptionId, callback);
return subscriptionId;
}
Expand All @@ -66,7 +66,7 @@ public async Task<bool> TransactionUnstableUnwatchAsync(string subscriptionId)
public async Task<bool> TransactionUnstableUnwatchAsync(string subscriptionId, CancellationToken token)
{
var result =
await _client.InvokeAsync<bool>("transaction_unstable_unwatch", new object[] { subscriptionId }, token);
await _client.InvokeAsync<bool>("transactionWatch_unstable_unwatch", new object[] { subscriptionId }, token);
if (result) _client.Listener.UnregisterHeaderHandler(subscriptionId);
return result;
}
Expand Down
13 changes: 1 addition & 12 deletions Substrate.NetApi/SubscriptionListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,12 @@ public void AuthorSubmitAndWatchExtrinsic(string subscription, ExtrinsicStatus r
GenericCallBack(subscription, result);
}

/// <summary>
/// TODO: Probablly deprecated, Authors the submit and watch extrinsic.
/// </summary>
/// <param name="subscription"></param>
/// <param name="result"></param>
[JsonRpcMethod("transaction_unstable_submitExtrinsic")]
public void TransactionUnstableSubmitExtrinsic(string subscription, TransactionEventInfo result)
{
GenericCallBack(subscription, result);
}

/// <summary>
/// Transaction unstable watch eventc.
/// </summary>
/// <param name="subscription"></param>
/// <param name="result"></param>
[JsonRpcMethod("transaction_unstable_watchEvent")]
[JsonRpcMethod("transactionWatch_unstable_watchEvent")]
public void TransactionUnstableWatchEventc(string subscription, TransactionEventInfo result)
{
GenericCallBack(subscription, result);
Expand Down
2 changes: 1 addition & 1 deletion Substrate.NetApi/Substrate.NetApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<PackageId>Substrate.NET.API</PackageId>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
<Version>0.9.19</Version>
<Version>0.9.20</Version>
<Company>Substrate Gaming</Company>
<Authors>Substrate Gaming</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down

0 comments on commit ed35a3d

Please sign in to comment.