FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

View File

@@ -0,0 +1,13 @@
Copyright 2025 Solana Mobile Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,3 @@
# `@solana-mobile/wallet-standard-mobile`
This is a plugin that registers a [`@wallet-standard/wallet-standard`](https://github.com/wallet-standard/wallet-standard) for mobile wallets. It enables web apps to use a native wallet app on a mobile device to sign messages and transactions, and to send transactions if the wallet offers support for sending transactions.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"type":"commonjs"}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"type":"module"}

View File

@@ -0,0 +1,95 @@
import { SolanaSignAndSendTransactionFeature, SolanaSignInFeature, SolanaSignMessageFeature, SolanaSignTransactionFeature } from "@solana/wallet-standard-features";
import { AppIdentity, AuthorizationResult, GetCapabilitiesAPI } from "@solana-mobile/mobile-wallet-adapter-protocol";
import { IdentifierArray, IdentifierString, Wallet, WalletAccount } from "@wallet-standard/base";
import { StandardConnectFeature, StandardDisconnectFeature, StandardEventsFeature } from "@wallet-standard/features";
//#region src/wallet.d.ts
type WalletCapabilities = Awaited<ReturnType<GetCapabilitiesAPI['getCapabilities']>>;
type Authorization = AuthorizationResult & Readonly<{
chain: IdentifierString;
capabilities: WalletCapabilities;
}>;
interface AuthorizationCache {
clear(): Promise<void>;
get(): Promise<Authorization | undefined>;
set(authorization: Authorization): Promise<void>;
}
interface ChainSelector {
select(chains: IdentifierArray): Promise<IdentifierString>;
}
declare const SolanaMobileWalletAdapterWalletName = "Mobile Wallet Adapter";
declare const SolanaMobileWalletAdapterRemoteWalletName = "Remote Mobile Wallet Adapter";
interface SolanaMobileWalletAdapterWallet extends Wallet {
url: string;
}
interface SolanaMobileWalletAdapterAuthorization {
get isAuthorized(): boolean;
get currentAuthorization(): Authorization | undefined;
get cachedAuthorizationResult(): Promise<Authorization | undefined>;
}
declare class LocalSolanaMobileWalletAdapterWallet implements SolanaMobileWalletAdapterWallet, SolanaMobileWalletAdapterAuthorization {
#private;
get version(): "1.0.0";
get name(): string;
get url(): string;
get icon(): `data:image/svg+xml;base64,${string}` | `data:image/webp;base64,${string}` | `data:image/png;base64,${string}` | `data:image/gif;base64,${string}`;
get chains(): IdentifierArray;
get features(): StandardConnectFeature & StandardDisconnectFeature & StandardEventsFeature & SolanaSignMessageFeature & SolanaSignInFeature & (SolanaSignAndSendTransactionFeature | SolanaSignTransactionFeature);
get accounts(): WalletAccount[];
constructor(config: {
appIdentity: AppIdentity;
authorizationCache: AuthorizationCache;
chains: IdentifierArray;
chainSelector: ChainSelector;
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapterWallet) => Promise<void>;
});
get connected(): boolean;
get isAuthorized(): boolean;
get currentAuthorization(): Authorization | undefined;
get cachedAuthorizationResult(): Promise<Authorization | undefined>;
}
declare class RemoteSolanaMobileWalletAdapterWallet implements SolanaMobileWalletAdapterWallet, SolanaMobileWalletAdapterAuthorization {
#private;
get version(): "1.0.0";
get name(): string;
get url(): string;
get icon(): `data:image/svg+xml;base64,${string}` | `data:image/webp;base64,${string}` | `data:image/png;base64,${string}` | `data:image/gif;base64,${string}`;
get chains(): IdentifierArray;
get features(): StandardConnectFeature & StandardDisconnectFeature & StandardEventsFeature & SolanaSignMessageFeature & SolanaSignInFeature & (SolanaSignAndSendTransactionFeature | SolanaSignTransactionFeature);
get accounts(): WalletAccount[];
constructor(config: {
appIdentity: AppIdentity;
authorizationCache: AuthorizationCache;
chains: IdentifierArray;
chainSelector: ChainSelector;
remoteHostAuthority: string;
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapterWallet) => Promise<void>;
});
get connected(): boolean;
get isAuthorized(): boolean;
get currentAuthorization(): Authorization | undefined;
get cachedAuthorizationResult(): Promise<Authorization | undefined>;
}
//#endregion
//#region src/initialize.d.ts
declare function registerMwa(config: {
appIdentity: AppIdentity;
authorizationCache: AuthorizationCache;
chains: IdentifierArray;
chainSelector: ChainSelector;
remoteHostAuthority?: string;
onWalletNotFound: (mobileWalletAdapter: SolanaMobileWalletAdapterWallet) => Promise<void>;
}): void;
//#endregion
//#region src/createDefaultWalletNotFoundHandler.d.ts
declare function defaultErrorModalWalletNotFoundHandler(): Promise<void>;
declare function createDefaultWalletNotFoundHandler(): (mobileWalletAdapter: SolanaMobileWalletAdapterWallet) => Promise<void>;
//#endregion
//#region src/createDefaultAuthorizationCache.d.ts
declare function createDefaultAuthorizationCache(): AuthorizationCache;
//#endregion
//#region src/createDefaultChainSelector.d.ts
declare function createDefaultChainSelector(): ChainSelector;
//#endregion
export { Authorization, AuthorizationCache, ChainSelector, LocalSolanaMobileWalletAdapterWallet, RemoteSolanaMobileWalletAdapterWallet, SolanaMobileWalletAdapterRemoteWalletName, SolanaMobileWalletAdapterWallet, SolanaMobileWalletAdapterWalletName, createDefaultAuthorizationCache, createDefaultChainSelector, createDefaultWalletNotFoundHandler, defaultErrorModalWalletNotFoundHandler, registerMwa };
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/wallet.ts","../../src/initialize.ts","../../src/createDefaultWalletNotFoundHandler.ts","../../src/createDefaultAuthorizationCache.ts","../../src/createDefaultChainSelector.ts"],"mappings":";;;;;;KAqDK,kBAAA,GAAqB,OAAA,CAAQ,UAAA,CAAW,kBAAA;AAAA,KAEjC,aAAA,GAAgB,mBAAA,GACxB,QAAA;EACI,KAAA,EAAO,gBAAA;EACP,YAAA,EAAc,kBAAA;AAAA;AAAA,UAGL,kBAAA;EACb,KAAA,IAAS,OAAA;EACT,GAAA,IAAO,OAAA,CAAQ,aAAA;EACf,GAAA,CAAI,aAAA,EAAe,aAAA,GAAgB,OAAA;AAAA;AAAA,UAGtB,aAAA;EACb,MAAA,CAAO,MAAA,EAAQ,eAAA,GAAkB,OAAA,CAAQ,gBAAA;AAAA;AAAA,cAGhC,mCAAA;AAAA,cACA,yCAAA;AAAA,UAeI,+BAAA,SAAwC,MAAA;EACrD,GAAA;AAAA;AAAA,UAGM,sCAAA;EAAA,IACF,YAAA;EAAA,IACA,oBAAA,IAAwB,aAAA;EAAA,IACxB,yBAAA,IAA6B,OAAA,CAAQ,aAAA;AAAA;AAAA,cAGhC,oCAAA,YACE,+BAAA,EAAiC,sCAAA;EAAA;MAuBxC,OAAA,CAAA;EAAA,IAIA,IAAA,CAAA;EAAA,IAIA,GAAA,CAAA;EAAA,IAIA,IAAA,CAAA;EAAA,IAIA,MAAA,CAAA,GAAM,eAAA;EAAA,IAIN,QAAA,CAAA,GAAY,sBAAA,GACZ,yBAAA,GACA,qBAAA,GACA,wBAAA,GACA,mBAAA,IACC,mCAAA,GAAsC,4BAAA;EAAA,IA0BvC,QAAA,CAAA,GAAQ,aAAA;cAIA,MAAA;IACR,WAAA,EAAa,WAAA;IACb,kBAAA,EAAoB,kBAAA;IACpB,MAAA,EAAQ,eAAA;IACR,aAAA,EAAe,aAAA;IACf,gBAAA,GAAmB,mBAAA,EAAqB,+BAAA,KAAoC,OAAA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
"name": "@solana-mobile/wallet-standard-mobile",
"description": "A wallet-standard wallet for mobile wallet apps that conform to the Solana Mobile Wallet Adapter protocol",
"version": "0.5.2",
"author": "Marco Martinez <marco.martinez@solana.com>",
"repository": "https://github.com/solana-mobile/mobile-wallet-adapter",
"license": "Apache-2.0",
"exports": {
"edge-light": {
"import": "./lib/esm/index.js",
"require": "./lib/cjs/index.js"
},
"workerd": {
"import": "./lib/esm/index.js",
"require": "./lib/cjs/index.js"
},
"browser": {
"import": "./lib/esm/index.browser.js",
"require": "./lib/cjs/index.browser.js"
},
"node": {
"import": "./lib/esm/index.js",
"require": "./lib/cjs/index.js"
},
"react-native": "./lib/cjs/index.native.js",
"types": "./lib/types/index.d.ts"
},
"browser": {
"./lib/cjs/index.js": "./lib/cjs/index.browser.js",
"./lib/esm/index.js": "./lib/esm/index.browser.js"
},
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"react-native": "lib/cjs/index.native.js",
"types": "lib/types/index.d.ts",
"type": "module",
"files": [
"lib",
"LICENSE"
],
"sideEffects": false,
"publishConfig": {
"access": "public"
},
"dependencies": {
"@solana/wallet-standard-chains": "^1.1.1",
"@solana/wallet-standard-features": "^1.3.0",
"@wallet-standard/base": "^1.0.1",
"@wallet-standard/features": "^1.0.3",
"@wallet-standard/wallet": "^1.1.0",
"bs58": "^6.0.0",
"js-base64": "^3.7.5",
"qrcode": "^1.5.4",
"tslib": "^2.8.1",
"@solana-mobile/mobile-wallet-adapter-protocol": "^2.2.8"
},
"optionalDependencies": {
"@react-native-async-storage/async-storage": "^1.17.7"
},
"devDependencies": {
"@types/qrcode": "^1.5.5",
"agadoo": "^3.0.0",
"cross-env": "^10.1.0",
"shx": "^0.4.0"
},
"scripts": {
"clean": "shx rm -rf lib/*",
"build": "pnpm clean && tsdown --config ../../tsdown.config.ts",
"build:watch": "pnpm clean && tsdown --config ../../tsdown.config.ts --watch",
"check-types": "tsc -p tsconfig.json --noEmit",
"postbuild": "printf '%s' '{\"type\":\"commonjs\"}' > lib/cjs/package.json && printf '%s' '{\"type\":\"module\"}' > lib/esm/package.json"
}
}