@pooflabs/web 0.0.69 → 0.0.70-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/providers/phantom-wallet-provider.d.ts +2 -0
- package/dist/auth/providers/solana-mobile-wallet-provider.d.ts +85 -0
- package/dist/{index-CitlpjWv.esm.js → index-CGCShasV.esm.js} +1222 -14
- package/dist/index-CGCShasV.esm.js.map +1 -0
- package/dist/{index-DG-p1jRT.js → index-DUOitTCO.js} +1226 -18
- package/dist/index-DUOitTCO.js.map +1 -0
- package/dist/{index-C-ADfv7y.js → index-DaaCdje_.js} +1361 -940
- package/dist/index-DaaCdje_.js.map +1 -0
- package/dist/{index-BMWeM64T.esm.js → index-DarQ4sGV.esm.js} +1358 -939
- package/dist/index-DarQ4sGV.esm.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +17 -2
- package/dist/index-BMWeM64T.esm.js.map +0 -1
- package/dist/index-C-ADfv7y.js.map +0 -1
- package/dist/index-CitlpjWv.esm.js.map +0 -1
- package/dist/index-DG-p1jRT.js.map +0 -1
package/dist/auth/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { PhantomWalletProvider, PhantomWalletConfig, PhantomProviderType, } from
|
|
|
2
2
|
export { PrivyWalletProvider } from "./providers/privy-wallet-provider";
|
|
3
3
|
export { MockAuthProvider, DEFAULT_TEST_ADDRESS, } from "./providers/mock-auth-provider";
|
|
4
4
|
export { OffchainAuthProvider, OffchainAuthProviderConfig, } from "./providers/offchain-auth-provider";
|
|
5
|
+
export { SolanaMobileWalletProvider, SolanaMobileWalletConfig, isMobileWalletAvailable, registerMobileWalletAdapter, } from "./providers/solana-mobile-wallet-provider";
|
|
5
6
|
import { AuthProvider, User, ClientConfig } from "@pooflabs/core";
|
|
6
7
|
/**
|
|
7
8
|
* Clears the session if it was created before auth method tracking (legacy session).
|
|
@@ -29,6 +29,8 @@ export declare class PhantomWalletProvider implements AuthProvider {
|
|
|
29
29
|
private initPromise;
|
|
30
30
|
/** Callback to swap to a Privy provider when the user clicks "Log in with email" */
|
|
31
31
|
onSwitchToPrivy: (() => Promise<AuthProvider>) | null;
|
|
32
|
+
/** Callback to swap to a Mobile Wallet Adapter provider when the user clicks "Connect Mobile Wallet" */
|
|
33
|
+
onSwitchToMWA: (() => Promise<AuthProvider>) | null;
|
|
32
34
|
constructor(networkUrl?: string | null, config?: PhantomWalletConfig);
|
|
33
35
|
private initializeAsync;
|
|
34
36
|
/**
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { EVMTransaction, SolTransaction, TransactionResult, User, AuthProvider, SetOptions } from '@pooflabs/core';
|
|
2
|
+
import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
+
export interface SolanaMobileWalletConfig {
|
|
4
|
+
/** App identity shown to the wallet during authorization */
|
|
5
|
+
appIdentity?: {
|
|
6
|
+
name?: string;
|
|
7
|
+
uri?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
};
|
|
10
|
+
/** Solana cluster: 'mainnet-beta' | 'devnet' | 'testnet' */
|
|
11
|
+
cluster?: string;
|
|
12
|
+
/** Theme for any UI elements: 'light' or 'dark' */
|
|
13
|
+
theme?: 'light' | 'dark';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Detects whether the current environment is a mobile browser capable of
|
|
17
|
+
* Mobile Wallet Adapter (MWA) communication.
|
|
18
|
+
*
|
|
19
|
+
* Returns true on Android browsers (Chrome, etc.) where MWA intents work,
|
|
20
|
+
* or inside a Seeker/Saga in-app browser context.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isMobileWalletAvailable(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Registers Mobile Wallet Adapter as a wallet-standard wallet so it appears
|
|
25
|
+
* in wallet selection UIs and can be discovered by other wallet-standard consumers.
|
|
26
|
+
*
|
|
27
|
+
* Call this once at app startup (in a browser-only / non-SSR context).
|
|
28
|
+
*
|
|
29
|
+
* @param config - App identity and optional remote host authority for desktop QR code support
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerMobileWalletAdapter(config?: {
|
|
32
|
+
appIdentity?: {
|
|
33
|
+
name?: string;
|
|
34
|
+
uri?: string;
|
|
35
|
+
icon?: string;
|
|
36
|
+
};
|
|
37
|
+
chains?: string[];
|
|
38
|
+
remoteHostAuthority?: string;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* SolanaMobileWalletProvider implements the AuthProvider interface using the
|
|
42
|
+
* Solana Mobile Wallet Adapter (MWA) protocol's low-level `transact` API.
|
|
43
|
+
*
|
|
44
|
+
* This enables TaroBase dApps to work with any MWA-compliant wallet on Solana
|
|
45
|
+
* mobile devices (Seeker, Saga) — including the native Seed Vault Wallet,
|
|
46
|
+
* Phantom, Solflare, and any other wallet that implements the MWA protocol.
|
|
47
|
+
*
|
|
48
|
+
* By using `transact()` directly (instead of the wallet-adapter wrapper),
|
|
49
|
+
* login combines authorize + signMessage into a single wallet session —
|
|
50
|
+
* meaning one popup/approval instead of two.
|
|
51
|
+
*/
|
|
52
|
+
export declare class SolanaMobileWalletProvider implements AuthProvider {
|
|
53
|
+
private static instance;
|
|
54
|
+
private networkUrl;
|
|
55
|
+
private config;
|
|
56
|
+
private authToken;
|
|
57
|
+
private walletUriBase;
|
|
58
|
+
private base64Address;
|
|
59
|
+
private authorizedPublicKey;
|
|
60
|
+
private publicKeyObj;
|
|
61
|
+
private appIdentity;
|
|
62
|
+
private chain;
|
|
63
|
+
constructor(networkUrl?: string | null, config?: SolanaMobileWalletConfig);
|
|
64
|
+
static getInstance(networkUrl: string | null, config: SolanaMobileWalletConfig): SolanaMobileWalletProvider;
|
|
65
|
+
/** Config for transact() — routes to the same wallet if we've already authorized */
|
|
66
|
+
private getAssociationConfig;
|
|
67
|
+
/** Reauthorize within a transact callback using a stored auth_token */
|
|
68
|
+
private reauthorizeWallet;
|
|
69
|
+
/** Persist auth result from an authorize/reauthorize call */
|
|
70
|
+
private storeAuthResult;
|
|
71
|
+
login(): Promise<User | null>;
|
|
72
|
+
restoreSession(): Promise<User | null>;
|
|
73
|
+
logout(): Promise<void>;
|
|
74
|
+
signMessage(message: string): Promise<string>;
|
|
75
|
+
signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
76
|
+
signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, feePayer?: PublicKey): Promise<string>;
|
|
77
|
+
runTransaction(_evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
78
|
+
getNativeMethods(): Promise<any>;
|
|
79
|
+
private getRpcUrl;
|
|
80
|
+
}
|
|
81
|
+
declare global {
|
|
82
|
+
interface Window {
|
|
83
|
+
CUSTOM_TAROBASE_APP_ID_HEADER?: string;
|
|
84
|
+
}
|
|
85
|
+
}
|