import type { User, AuthProvider } from '@bounded-sh/core'; import type { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js'; import { defaultInjectedProvider, type InjectedSolanaProvider, type InjectedWalletConfig } from './injected-wallet-types'; export { defaultInjectedProvider }; export type { InjectedSolanaProvider, InjectedWalletConfig }; export declare class InjectedWalletProvider implements AuthProvider { private config; private networkUrl; private configuredNetwork; private authenticatedAddress; constructor(config?: InjectedWalletConfig, networkUrl?: string | null, configuredNetwork?: string | null); /** * Replace the wallet config without disturbing the account binding. Used to retire a ONE-SHOT gesture hook once the login * that supplied it is over: that closure owns a specific piece of UI, so a * later operation must never be left waiting on it. */ setWalletConfig(config: InjectedWalletConfig): void; private resolveProvider; /** * Connect for an operation on an EXISTING session. A restored session holds * an address but no wallet connection, so every signing path starts by * reconnecting - silently when the wallet still trusts us. * * When the silent connect finds nothing (an MWA authorization that expired, * was cleared, or belongs to another chain), reconnecting means an * interactive round trip out to the wallet app - the same intent navigation * as the signature that follows, and it needs its own transient activation. * Taking a gesture for it is what makes a restored mobile session usable: * without one the reconnect is dispatched from whatever activation is left * after the caller's own awaits (a governed write has already been to the * server by then), Chrome blocks it, and the protocol reports the wallet as * missing rather than as needing authorization. */ private connectForAction; /** Connect the injected wallet (if needed) and return its Solana address. */ private connectAddress; login(): Promise; /** * DS2-0369: refuse to sign when the browser wallet's currently selected account * differs from the account this session was authenticated with. Signing under a * switched account would produce a message/transaction from an identity the * Bounded session never proved. Require a fresh wallet sign-in to rebind. */ private assertAuthenticatedAccount; /** * Give the caller a chance to collect a fresh user gesture immediately * before a wallet call. Solana Mobile needs one per operation (each * dispatches an Android intent through window.location.assign, and the * originating tap is spent by the time preparation finishes). A rejection * aborts the operation before anything is signed. No-op when the app * supplied no hook, which is every injected-wallet app. */ private freshActivation; /** * The gesture half of freshActivation, on its own because a reconnect needs * it too: finish the provider's async work, then collect the tap. */ private requireFreshTap; /** * DS2-0369 on the way BACK. The check before a wallet call is not enough for * a wallet that re-authorizes INSIDE it: Solana Mobile does exactly that on * both transports, and discards the account the request named, so it can * return a transaction signed by an account this session never proved. Read * the account again once the wallet answers, before that answer is used. * * LF-003: the message must MEAN the same thing, not BE the same bytes. A * wallet is allowed to guard the transaction it signs - Phantom injects * Lighthouse assertions on mainnet - and doing so recompiles the message and * renumbers every account index, which no byte comparison can survive. What * cannot change is what our own instructions do; `describeInstructionDivergence` * is the check for that, and it is strictly stronger than a length-and-bytes * diff for everything except the parts a wallet is entitled to touch. */ private assertSignedByAuthenticatedAccount; private markAuthMethod; restoreSession(): Promise; logout(): Promise; signMessage(message: string): Promise; signTransaction(transaction: Transaction | VersionedTransaction): Promise; signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, _feePayer?: PublicKey): Promise; getNativeMethods(): Promise; private getRpcUrl; }