Skip to content

docs(mwa): add quick-start, method reference, cache guide, and migration guide#6

Open
Zurcusa wants to merge 11 commits into
pr/5-adapter-sessionfrom
pr/6-mwa-docs
Open

docs(mwa): add quick-start, method reference, cache guide, and migration guide#6
Zurcusa wants to merge 11 commits into
pr/5-adapter-sessionfrom
pr/6-mwa-docs

Conversation

@Zurcusa
Copy link
Copy Markdown
Owner

@Zurcusa Zurcusa commented May 5, 2026

⚠️ NOTE: This is a standalone documentation PR targeting pr/5-adapter-session. Merge after PR #5.

Status Type ⚠️ Core Change Issue
Ready Documentation No

Problem

The MWA v2 SDK has no user-facing documentation. Developers have to read source code to understand the API.

Solution

Five markdown docs under docs/:

  • mwa-quick-start.md — install, configure, first wallet connection
  • mwa-method-reference.md — all 13 public methods with signatures, return types, result variants, concurrency behavior
  • mwa-cache-guide.md — IAuthorizationCache interface, default/custom implementations, validation rules
  • mwa-migration-v1-to-v2.md — Logout→Disconnect/Deauthorize, cache changes, new methods
  • sign-and-send-investigation.md — Backpack sign_and_send_transactions failure analysis with cross-wallet comparison (Phantom, Solflare, Backpack)

Also removes docs/ from .gitignore (was incorrectly ignored).

Links to the published demo app: https://github.com/Zurcusa/unity-solana-mwa-example

Known Issue: Backpack sign_and_send_transactions

⚠️ sign_and_send_transactions fails with Backpack wallet. The transaction is successfully created, signed, and submitted on-chain — the issue is only in receiving the response back in the dApp. Backpack's WebSocket server crashes during the RPC submission phase, corrupting the local association before the response can be delivered. Phantom and Solflare handle the same flow correctly. sign_transactions works with all wallets including Backpack. Full investigation in docs/sign-and-send-investigation.md.

Deploy Notes

Documentation only. No code changes.

Testing Matrix

Tested on Pixel 7 emulator and Solana Seeker (real device).

Wallets Tested

Wallet Networks
Seed Vault (Solana Phone) DevNet, MainNet
Phantom DevNet, MainNet
Solflare DevNet, MainNet
Backpack MainNet
Jupiter MainNet

Functionality Coverage

Feature Emulator (Pixel 7) Solana Seeker
Login Passed Passed
Disconnect Passed Passed
Reconnect Passed Passed
Deauthorize Passed Passed
Sign Transaction Passed Passed
Sign All Transactions Passed Passed
Sign Message Passed Passed
Sign and Send ⚠️ Backpack fails (see Known Issue) ⚠️ Backpack fails (see Known Issue)
Get Capabilities Passed Passed
Sign-In With Solana (SIWS) Passed Passed

Zurcusa added 10 commits May 11, 2026 16:44
- Guard null/empty address in PrimaryAccountPublicKeyBytes
- Private constructors on DeauthorizeResult and ReconnectResult
- Null-result check in JsonRpc20Client.ReceiverRaw
- Cache auth token refresh in sign_and_send authorize action
- LogoutSuppressed + OnWalletDisconnected on auth revocation paths
- Fix base64 → base58 typo in method reference
- Return base58-encoded signatures instead of base64 (Solana RPC compat)
- Remove duplicate sendOptions wire field (MWA v2 spec uses "options" only)
- Gate Debug.Log wire messages behind UNITY_EDITOR || MWA_VERBOSE_WIRE
- Remove unused LegacyPkKey constant from PlayerPrefsAuthorizationCache
- Make _warnedThisSession static for once-per-session semantics
- Add SIWS fallback length guard for signed payloads < 64 bytes
- Enable BouncyCastle for Editor platform (fixes EditMode test loading)
- Add namespace to JsonRpcErrorCodes
- Fix SchemaVersion default to match ExpectedSchemaVersion (2)
- Fix DeauthorizeTests missing _gate reflection init (4 test failures)
- Fix ConcurrencyTests assertion for GetUninitializedObject compatibility
- Fix ReconnectTests platform guard for non-Android EditMode runs
- Remove invalid LegacyPk_DeletedOnConstruction test
- DeauthorizeRequestWireTest: use RpcMethodNames.Deauthorize in assertion
  instead of hardcoded string
- ReconnectTests: promote _gate lookup to static field with OneTimeSetUp
  guard so reflection drift fails fast with a clear message
LoginWithSignInInternal SIWS fallback was the last AuthorizeAsync call
site that discarded the return value, losing token rotations.
- Null-safe constructor: default solanaWalletOptions to prevent NPE
- Validate payload elements are non-null before sending to wallet
- Treat missing auth_token in clone_authorization as protocol error
- Use LoadValidCachedRecordAsync in ReloadAuthTokenFromCacheIfNeeded
  to enforce schema/chain validation on cached records
- Guard null authorization in ReconnectInternal success path
- Remove unused using in ConcurrencyTests
@Zurcusa Zurcusa force-pushed the pr/5-adapter-session branch from 8f9883c to fbbfc6c Compare May 11, 2026 13:51
Semaphore gate:
- Wrap _Login, _SignAllTransactions, SignMessage, GetCapabilities in
  TryAcquireGate/ReleaseGate to prevent concurrent state corruption

Bug fixes:
- Preserve WaitForCommitmentToSendNextTransaction when backfilling MinContextSlot
- Set WalletBase.Account on LoginWithSignIn success
- Default null mwaOptions in SolanaWalletAdapter so cache injection works

Upstream PR magicblock-labs#283 test compat:
- Update IAdapterOperationsContractTests for v2 AuthorizeAsync API
- Rewrite SolanaMobileWalletAdapterPrefsTests for v2 cache-based migration
- Fix MobileWalletAdapterClientLifecycleTests Authorize → AuthorizeAsync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant