Skip to content

Commit

Permalink
fix(walletconnect): fix random id range and parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonboukheir committed Jun 12, 2022
1 parent 8bf0758 commit c35e2ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"GUID:533d98c0995854feb940a5ba96ec4e3f",
"GUID:2ee6601452ca245499e63674423f6541",
"GUID:427b0dd64d04a4a02b8413b20fc93483",
"GUID:70d524b45145c40acbd35603c8e43743"
"GUID:70d524b45145c40acbd35603c8e43743",
"GUID:d8b63aba1907145bea998dd612889d6b"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public static JsonRpcRequest SessionRequest(WalletConnectSessionRequest sessionR
/// <summary>
/// Gets a random, valid JsonRpcRequest id.
/// </summary>
/// <returns>a <see cref="ulong"/> in the range [1, <see cref="ulong.MaxValue"/>]</returns>
/// <returns>a <see cref="ulong"/> in the range [1, <see cref="uint.MaxValue"/>]</returns>
public static ulong GetRandomId()
{
ulong x = 0;
while (x == 0)
x = AlgoSdk.Crypto.Random.Bytes<ulong>();
x = AlgoSdk.Crypto.Random.Bytes<uint>();
return x;
}

Expand Down
4 changes: 3 additions & 1 deletion Runtime/CareBoo.AlgoSdk.WalletConnect/WebSocketExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ public static void Send(this IWebSocketClient client, NetworkMessage networkMess
CancellationToken cancellationToken = default
)
{
if (cancellationToken.IsCancellationRequested)
throw new OperationCanceledException();
if (client == null)
return null;
throw new ArgumentNullException(nameof(client));
WebSocketEvent evt = client.Poll();
while (evt.Type == WebSocketEventType.Nothing)
{
Expand Down

0 comments on commit c35e2ed

Please sign in to comment.