Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ LICENSE.meta
README.md.meta
package.json.meta

docs/
.claude/

# Unity generated
.utmp/
**/[Ll]ibrary/
Expand All @@ -51,3 +48,4 @@ docs/
**/[Ll]ogs/
**/[Uu]ser[Ss]ettings/
*.log

2 changes: 1 addition & 1 deletion Packages/BouncyCastle.Cryptography.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Runtime/codebase/SolanaMobileStack/AuthorizationRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Solana.Unity.SolanaMobileStack
[Preserve]
public sealed class AuthorizationRecord
{
public int SchemaVersion { get; set; } = 1;
public int SchemaVersion { get; set; } = 2;

public string AuthToken { get; set; }

Expand Down
2 changes: 2 additions & 0 deletions Runtime/codebase/SolanaMobileStack/JsonRpc20Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ protected Task<T> SendRequest<T>(JsonRequest jsonRequest)
protected Task<JToken> SendRequestRaw(JsonRequest jsonRequest)
{
var message = JsonConvert.SerializeObject(jsonRequest);
#if UNITY_EDITOR || MWA_VERBOSE_WIRE
UnityEngine.Debug.Log($"[MWA Wire] → {message}");
#endif
var messageBytes = System.Text.Encoding.UTF8.GetBytes(message);
_messageSender.Send(messageBytes);
var rawTaskCompletionSource = new TaskCompletionSource<JToken>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ public class JsonRequestParams
[JsonProperty("options", NullValueHandling = NullValueHandling.Ignore)]
public JObject Options { get; set; }

[JsonProperty("sendOptions", NullValueHandling = NullValueHandling.Ignore)]
public JObject SendOptions { get; set; }

[RequiredMember]
public JsonRequestParams()
{
Expand Down
19 changes: 10 additions & 9 deletions Runtime/codebase/SolanaMobileStack/JsonRpcErrorCodes.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// ReSharper disable once CheckNamespace

public static class JsonRpcErrorCodes
namespace Solana.Unity.SolanaMobileStack
{
public const int AuthorizationFailed = -1;
public const int InvalidPayloads = -2;
public const int NotSigned = -3;
public const int NotSubmitted = -4;
public const int TooManyPayloads = -6;
public const int ChainNotSupported = -7;
public static class JsonRpcErrorCodes
{
public const int AuthorizationFailed = -1;
public const int InvalidPayloads = -2;
public const int NotSigned = -3;
public const int NotSubmitted = -4;
public const int TooManyPayloads = -6;
public const int ChainNotSupported = -7;
}
}
11 changes: 10 additions & 1 deletion Runtime/codebase/SolanaMobileStack/JsonRpcErrorCodes.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Runtime/codebase/SolanaMobileStack/MobileWalletAdapterClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ public async Task<JToken> SignAndSendTransactionsAsync(
{
if (base64Payloads == null || base64Payloads.Length == 0)
throw new ArgumentException("At least one payload is required", nameof(base64Payloads));
if (base64Payloads.Any(p => string.IsNullOrEmpty(p)))
throw new ArgumentException("Payload entries must not be null or empty", nameof(base64Payloads));
ct.ThrowIfCancellationRequested();
UnityEngine.Debug.Log($"[MWA Client] sign_and_send_transactions: {base64Payloads.Length} payload(s)");

Expand Down Expand Up @@ -155,8 +157,7 @@ public async Task<JToken> SignAndSendTransactionsAsync(
Params = new JsonRequest.JsonRequestParams
{
Payloads = new List<string>(base64Payloads),
Options = wireOptions,
SendOptions = wireOptions
Options = wireOptions
},
Id = NextMessageId()
};
Expand Down Expand Up @@ -226,7 +227,10 @@ public async Task<string> CloneAuthorizationAsync(string authToken, Cancellation
};

JToken raw = await SendRequestRaw(request);
return (string)raw?["auth_token"];
var token = (string)raw?["auth_token"];
if (string.IsNullOrEmpty(token))
throw new JsonRpcException(0, "clone_authorization response missing auth_token", raw);
return token;
}

private JsonRequest PrepareDeauthorizeRequest(string authToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ public sealed class PlayerPrefsAuthorizationCache : IAuthorizationCache
{
internal const string DefaultKey = "SolanaUnity.MWA.AuthorizationRecord.v1";

private const string LegacyPkKey = "pk";

private bool _warnedThisSession;
private static bool _warnedThisSession;

private readonly string _key;

Expand Down
11 changes: 10 additions & 1 deletion Runtime/codebase/SolanaMobileStack/RpcMethodNames.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading