feat(mwa-v2): refactor wire protocol, client, and cache for MWA v2#4
Open
Zurcusa wants to merge 3 commits into
Open
feat(mwa-v2): refactor wire protocol, client, and cache for MWA v2#4Zurcusa wants to merge 3 commits into
Zurcusa wants to merge 3 commits into
Conversation
41b02b1 to
974d62d
Compare
974d62d to
21cacf8
Compare
cf349d8 to
650bfe6
Compare
This was referenced May 4, 2026
83e8569 to
4753dff
Compare
This was referenced May 7, 2026
4753dff to
58bcdfd
Compare
74f57aa to
314f641
Compare
58bcdfd to
6e74e5e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The current
MobileWalletAdapterClientuses the v1 MWA wire protocol with flatclusterstrings and a simpleAuthorizationResultAccountsresponse shape. It lacks:DeauthorizeAsyncandSignAndSendTransactionsAsyncwire methodsSolution
Wire protocol (
JsonRequest.cs): Addchain,cluster(backward compat),features,sign_in_payload, andsendOptionsfields.Client (
MobileWalletAdapterClient.cs): Rewrite with:AuthorizeAsync(chain, authToken, features, addresses, signInPayload, ct)— v2 authorize with SIWSDeauthorizeAsync(authToken, ct)— async deauthorize with cancellationSignAndSendTransactionsAsync(payloads, options, ct)— batch sign-and-sendCloneAuthorizationAsync(authToken, ct)— clone authorization for multi-sessionAuthorize/Reauthorizepreserved as[Obsolete]shimsResponse model (
AuthorizationResult.cs): Refactored to v2 shape withList<AccountInfo>,WalletIcon,SignInResult. ShimPublicKey/AccountLabelproperties preserved as[Obsolete].Parser (
AuthorizationResponseParser.cs): Permissive parser with size caps (64KB icons, 128-char display addresses, 32 chains max, 16 accounts max) and structured logging gated byLogVerbosity.Cache (
PlayerPrefsAuthorizationCache.cs): DefaultIAuthorizationCachebacked by UnityPlayerPrefswith scoped key support, corrupt-JSON recovery, and legacy key cleanup. Closes #272.Tests: 9 new EditMode test suites added to
Tests/EditMode/(MwaParser/, MwaCache/, MwaClient/) with 10 JSON fixtures. Updated existingMobileWalletAdapterClientTestsfor the new API. AddedSolana.Unity.Wallet.dllandSolana.Unity.Rpc.dllto the test assembly definition.Other changes
CapabilitiesResultwith additional capability fieldsDeploy Notes
Backward compatibility: The old
Authorize/Reauthorizemethods andPublicKey/AccountLabelproperties are preserved as[Obsolete]shims. Existing code compiles with deprecation warnings. These shims are removed in PR #5 when the adapter is rewritten.Testing Matrix
Tested on Pixel 7 emulator and Solana Seeker (real device).
Wallets Tested
Functionality Coverage