/** * Wallet adapters for NEAR wallet integrations. * * Provides adapter functions to integrate with popular NEAR wallets: * - `@hot-labs/near-connect` (NEAR Connect) * - `@near-wallet-selector/core` (deprecated) * * These adapters use duck typing / structural compatibility to work with * wallet interfaces. While the actual wallet packages use `@near-js` types * (which are classes), our types (plain objects) are structurally compatible * and work correctly at runtime. See `tests/wallets/type-compatibility.test.ts` * for verification. */ import type { WalletConnection } from "../core/types.js"; import type { NearConnectConnector } from "./types.js"; type WalletSelectorWallet = { getAccounts(): Promise>; signAndSendTransaction(params: { signerId?: string; receiverId?: string; actions: unknown[]; }): Promise; signMessage?(params: { message: string; recipient: string; nonce: Buffer; callbackUrl?: string; state?: string; }): Promise; }; /** * Adapter for @near-wallet-selector/core * * Converts a wallet-selector Wallet instance to the WalletConnection interface. * * @deprecated NEAR Wallet Selector is deprecated. Use {@link fromNearConnect} with * `@hot-labs/near-connect` (NEAR Connect) instead. * * @param wallet - Wallet instance from wallet-selector * @returns WalletConnection interface compatible with near-kit * * @example * ```typescript * import { Near } from 'near-kit' * import { setupWalletSelector } from '@near-wallet-selector/core' * import { fromWalletSelector } from 'near-kit/wallets' * * const selector = await setupWalletSelector({ * network: 'mainnet', * modules: [...] * }) * const wallet = await selector.wallet() * * const near = new Near({ * network: 'mainnet', * wallet: fromWalletSelector(wallet) * }) * ``` */ export declare function fromWalletSelector(wallet: WalletSelectorWallet): WalletConnection; /** * Adapter for @hot-labs/near-connect (NEAR Connect) * * Converts a NEAR Connect NearConnector instance to the WalletConnection interface. * * @param connector - NearConnector instance from NEAR Connect * @returns WalletConnection interface compatible with near-kit * * @example * ```typescript * import { Near } from 'near-kit' * import { NearConnector } from '@hot-labs/near-connect' * import { fromNearConnect } from 'near-kit/wallets' * * const connector = new NearConnector({ network: 'mainnet' }) * * // Wait for user to connect their wallet * connector.on('wallet:signIn', async () => { * const near = new Near({ * network: 'mainnet', * wallet: fromNearConnect(connector) * }) * * // Use near-kit with the connected wallet * await near.call('contract.near', 'method', { arg: 'value' }) * }) * ``` */ export declare function fromNearConnect(connector: NearConnectConnector): WalletConnection; /** * @deprecated Renamed to {@link fromNearConnect}. This alias will be removed in a future major version. */ export declare const fromHotConnect: typeof fromNearConnect; export {}; //# sourceMappingURL=adapters.d.ts.map