Skip to content

Commit

Permalink
fix(walletconnect): fix WalletConnectRpc.GetRandomId throwing error…
Browse files Browse the repository at this point in the history
… when not in main thread
  • Loading branch information
jasonboukheir committed Jun 12, 2022
1 parent 6f23d10 commit 133fbd6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Runtime/CareBoo.AlgoSdk.WalletConnect/Models/WalletConnectRpc.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Unity.Mathematics;

namespace AlgoSdk.WalletConnect
{
Expand Down Expand Up @@ -50,8 +51,14 @@ 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="int.MaxValue"/>]</returns>
public static ulong GetRandomId() => (ulong)UnityEngine.Random.Range(1, int.MaxValue);
/// <returns>a <see cref="ulong"/> in the range [1, <see cref="ulong.MaxValue"/>]</returns>
public static ulong GetRandomId()
{
ulong x = 0;
while (x == 0)
x = AlgoSdk.Crypto.Random.Bytes<ulong>();
return x;
}

public static class Algorand
{
Expand Down

0 comments on commit 133fbd6

Please sign in to comment.