Skip to content

Commit 6df9c40

Browse files
authored
Merge pull request #53 from loomnetwork/sdk-update
SDK Update
2 parents e95b4b7 + f3bf3c9 commit 6df9c40

37 files changed

+594
-178
lines changed

UnityProject/Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll.meta

Lines changed: 15 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
2.22 MB
Binary file not shown.

UnityProject/Assets/LoomSDK/Plugins/Loom.Nethereum.Minimal.Packed.dll.meta renamed to UnityProject/Assets/LoomSDK/Plugins/Loom.BouncyCastle.Crypto.dll.meta

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
120 KB
Binary file not shown.

UnityProject/Assets/LoomSDK/Plugins/Loom.Nethereum.Minimal.dll.meta

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/LoomSDK/Plugins/Loom.Nethereum.Minimal.Packed.xml renamed to UnityProject/Assets/LoomSDK/Plugins/Loom.Nethereum.Minimal.xml

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/LoomSDK/Plugins/Loom.Nethereum.Minimal.Packed.xml.meta renamed to UnityProject/Assets/LoomSDK/Plugins/Loom.Nethereum.Minimal.xml.meta

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityProject/Assets/LoomSDK/Source/Editor/CheckProject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#if !NET_4_6
2-
#error Loom SDK requires .NET 4.6. Please go to Build Settings -> Player Settings -> Configuration and set Scripting Runtime Version to .NET 4.6
1+
#if !NET_4_6 && !NET_STANDARD_2_0
2+
#error Loom SDK requires .NET 4.x. Please go to Build Settings -> Player Settings -> Configuration and set Scripting Runtime Version to .NET 4.x Equivalent
33
#endif
44

55
using UnityEditor;

UnityProject/Assets/LoomSDK/Source/Runtime/Internal/BaseRpcClient.cs renamed to UnityProject/Assets/LoomSDK/Source/Runtime/BaseRpcClient.cs

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
using System.Runtime.CompilerServices;
55
using System.Text;
66
using System.Threading.Tasks;
7+
using Loom.Client.Internal;
78
using UnityEngine;
89

910
namespace Loom.Client.Internal
1011
{
11-
internal abstract class BaseRpcClient : IRpcClient, ILogProducer
12+
public abstract class BaseRpcClient : IRpcClient, ILogProducer
1213
{
1314
private ILogger logger = NullLogger.Instance;
1415
private RpcConnectionState? lastConnectionState;
@@ -18,11 +19,14 @@ internal abstract class BaseRpcClient : IRpcClient, ILogProducer
1819
/// <summary>
1920
/// Logger to be used for logging, defaults to <see cref="NullLogger"/>.
2021
/// </summary>
21-
public virtual ILogger Logger {
22-
get {
22+
public virtual ILogger Logger
23+
{
24+
get
25+
{
2326
return this.logger;
2427
}
25-
set {
28+
set
29+
{
2630
if (value == null)
2731
{
2832
value = NullLogger.Instance;
@@ -58,27 +62,51 @@ protected void NotifyConnectionStateChanged()
5862
ConnectionStateChanged?.Invoke(this, state);
5963
}
6064

61-
protected void AssertIsConnected() {
65+
protected void HandleJsonRpcResponseError(JsonRpcResponse partialMsg)
66+
{
67+
if (partialMsg.Error.Data.EndsWith("Tx already exists in cache"))
68+
{
69+
throw new TxAlreadyExistsInCacheException(int.Parse(partialMsg.Error.Code), partialMsg.Error.Data);
70+
}
71+
72+
throw new RpcClientException(
73+
String.Format(
74+
"JSON-RPC Error {0} ({1}): {2}",
75+
partialMsg.Error.Code,
76+
partialMsg.Error.Message,
77+
partialMsg.Error.Data
78+
),
79+
long.Parse(partialMsg.Error.Code),
80+
this
81+
);
82+
}
83+
84+
protected void AssertIsConnected()
85+
{
6286
RpcConnectionState connectionState = this.ConnectionState;
6387
if (connectionState == RpcConnectionState.Connected)
6488
return;
65-
89+
6690
throw new RpcClientException(
6791
$"Client must be in {nameof(RpcConnectionState.Connected)} state, " +
68-
$"current state is {connectionState}");
92+
$"current state is {connectionState}",
93+
1,
94+
this
95+
);
6996
}
7097

71-
protected void AssertNotAlreadyConnectedOrConnecting() {
98+
protected void AssertNotAlreadyConnectedOrConnecting()
99+
{
72100
RpcConnectionState connectionState = this.ConnectionState;
73101

74102
if (connectionState == RpcConnectionState.Connecting)
75103
{
76-
throw new RpcClientException("An attempt to connect while in process of connecting");
104+
throw new RpcClientException("An attempt to connect while in process of connecting", 1, this);
77105
}
78106

79107
if (connectionState == RpcConnectionState.Connected)
80108
{
81-
throw new RpcClientException("An attempt to connect when already connected");
109+
throw new RpcClientException("An attempt to connect when already connected", 1, this);
82110
}
83111
}
84112

0 commit comments

Comments
 (0)