import type { SolanaAsset, SolanaCluster, SolanaDepositsResponse, SolanaNativeBalance, SolanaTokenBalance,
  SolanaTransferApproval, SolanaTransferInput, SolanaTransferIntent, SolanaWallet, SolanaWalletSession, SuvryErrorCode } from './contracts.js';
export type { DecimalAmount, BaseUnits, SolanaCluster, SolanaAddress, SolanaSignature, SolanaAsset,
  SolanaTransactionFormat, SolanaWallet, SolanaWalletSession, SolanaTransferState, SolanaTransferQuote,
  SolanaTokenTransfer, SolanaTransferReceipt, SolanaTransferIntent, SolanaTransferInput, SolanaTransferApproval,
  SolanaNativeBalance, SolanaTokenBalance, SolanaDeposit, SolanaDepositsResponse, SuvryErrorCode } from './contracts.js';
export const walletContractVersion: 1;
export const suvryErrorCodes: readonly SuvryErrorCode[];
export class SuvryError extends Error {
  readonly code: SuvryErrorCode;
  readonly status?: number;
  readonly retryAfter?: number;
  readonly requestId?: string;
  constructor(code: SuvryErrorCode, options?: { status?: number; retryAfter?: number });
}
export interface Wallet { readonly id: string; readonly address: `0x${string}` }
export type EvmChainId = 11155111;
export interface EvmSessionNetwork { readonly schemaVersion: 1; readonly chainId: EvmChainId }
export interface WalletSession {
  token: string; userId: string; expiresIn: number;
  readonly evmNetwork?: EvmSessionNetwork;
  configuration: {
    projectId: string; iframeURL: string; hotStorageURL: string; coldStorageURL: string;
    shieldPublishableKey: string; chainId: 1; recoveryMethod: 'password';
  };
  accounts: readonly Wallet[];
}
export interface WalletSnapshot {
  readonly status: 'disconnected' | 'connecting' | 'needs_wallet' | 'needs_recovery' | 'ready' | 'error';
  readonly wallet: Wallet | null;
  readonly evmNetwork?: EvmSessionNetwork;
  readonly error: SuvryError | null;
  readonly isBusy: boolean;
}
export interface ClientOptions {
  projectId: string;
  getSession: (options: { signal: AbortSignal; chainId?: EvmChainId }) => Promise<WalletSession>;
  timeoutMs?: number;
  diagnostics?: boolean;
}
export interface SuvryClient {
  getSnapshot(): WalletSnapshot;
  getServerSnapshot(): WalletSnapshot;
  subscribe(listener: () => void): () => void;
  connect(): Promise<void>;
  createWallet(password: string): Promise<Wallet>;
  recoverWallet(password: string): Promise<Wallet>;
  signMessage(message: string): Promise<{ signature: `0x${string}`; verified: true }>;
  switchEvmChain(chainId: EvmChainId): Promise<EvmSessionNetwork>;
  getEvmPolicy(): Promise<EvmPolicyResponse>;
  getBalance(): Promise<EvmBalancesResponse>;
  getDeposits(): Promise<EvmDepositsResponse>;
  getTransfers(): Promise<{ readonly intents: readonly EvmTransferIntent[] }>;
  prepareTransfer(input: { to: `0x${string}`; amount: string; token?: `0x${string}`; idempotencyKey?: string }): Promise<EvmTransferIntent>;
  approveTransfer(intentId: string): Promise<EvmTransferApproval>;
  submitTransfer(intentId: string): Promise<EvmTransferIntent>;
  cancelTransfer(intentId: string): Promise<EvmTransferIntent>;
  disconnect(): void;
  destroy(): void;
}
export function createSuvryClient(options: ClientOptions): SuvryClient;

export type LoginMethod = 'email' | 'wallet' | 'walletconnect' | 'google' | 'discord' | 'telegram' | 'facebook' | 'instagram' | 'apple' | 'x' | 'line';
export interface LoginSettings { title: string; subtitle?: string; theme: 'light' | 'dark'; methods: LoginMethod[]; revision: number; managed?: boolean; logo?: string | null }
export interface LoginProof { code: string; verifier: string }
export type HeadlessAuthStatus = 'idle' | 'starting' | 'awaiting_code' | 'verifying' | 'completing' | 'redirecting' | 'authenticated' | 'cancelled' | 'error';
export interface HeadlessAuthSnapshot {
  readonly status: HeadlessAuthStatus;
  readonly method: LoginMethod | null;
  readonly isBusy: boolean;
  readonly error: SuvryLoginError | null;
}
export interface LoginDetails { email?: string; connector?: 'browser' | 'metamask' | 'walletconnect' }
export interface LoginStartResult { requiresCode?: true; completed?: true; redirecting?: true }
export interface WalletConnectMetadata { name: string; description: string; url: string; icons: string[] }
export interface Eip1193Provider { request(args: { method: string; params?: unknown[] }): Promise<unknown> }
export interface WalletConnectProvider extends Eip1193Provider { enable?(): Promise<string[]>; cancelPending?(): void }
export interface LoginOptions {
  /** Fresh server-issued verifier for a single account-linking proof. */
  proofVerifier?: string;
  projectId: string;
  onComplete(proof: LoginProof): Promise<void> | void;
  redirectUri?: string;
  flow?: 'redirect' | 'popup';
  /** Defaults to Suvry's public WalletConnect project ID. Use your own ID if your app's origin is not allowlisted. */
  walletConnectProjectId?: string;
  /** EIP-155 chain IDs requested by WalletConnect. Defaults to Ethereum mainnet (1). */
  walletConnectChains?: readonly number[];
  walletConnectMetadata?: WalletConnectMetadata;
  /** Optional callback for a custom WalletConnect QR or deep-link UI. */
  onWalletConnectUri?(uri: string): void;
  walletConnectProvider?: WalletConnectProvider;
  walletProvider?: Eip1193Provider;
}
export class SuvryLoginError extends Error { readonly code: string }
export interface SuvryAuthClient {
  getSnapshot(): HeadlessAuthSnapshot;
  subscribe(listener: () => void): () => void;
  start(method: LoginMethod, details?: LoginDetails): Promise<LoginStartResult>;
  verifyEmail(code: string): Promise<{ completed: true }>;
  resume(): Promise<{ handled: boolean; completed?: boolean; popup?: boolean }>;
  cancel(): void;
  destroy(): void;
}
/** Browser-only managed login controller for custom UI. It returns a one-time proof to onComplete; your server owns the application session. */
export function createSuvryAuth(options: LoginOptions): SuvryAuthClient;
export interface SuvryLoginClient {
  mount(host: HTMLElement, settings?: LoginSettings): Promise<void>;
  cancel(): void;
  destroy(): void;
}
export function createSuvryLogin(options: LoginOptions): SuvryLoginClient;
export function fetchLoginSettings(projectId: string, signal?: AbortSignal): Promise<LoginSettings>;

export type EvmTransferState = 'prepared' | 'approving' | 'signed' | 'submitting' | 'pending' | 'uncertain' | 'confirmed' | 'reverted' | 'replaced' | 'dropped' | 'cancelled' | 'expired';
export interface EvmAsset { readonly kind: 'native' | 'erc20'; readonly symbol: string; readonly decimals: number; readonly address?: `0x${string}` }
export interface EvmTokenPolicy { readonly address: `0x${string}`; readonly symbol: string; readonly decimals: number; readonly codeHash: `0x${string}`; readonly maxAmountBaseUnits: string }
export interface EvmPolicy { readonly schemaVersion: 1; readonly revision: number; readonly enabled: boolean; readonly chainId: 11155111; readonly maxNativeValueWei: string; readonly maxFeeWei: string; readonly tokens: readonly EvmTokenPolicy[] }
export interface EvmTransferLimits { readonly maxNativeAmount: string; readonly maxFeeWei: string; readonly maxGas: string; readonly maxTotalDebitWei?: string; readonly tokens: readonly { readonly address: `0x${string}`; readonly symbol: string; readonly decimals: number; readonly maxAmount: string; readonly codeHash?: `0x${string}` }[] }
export interface EvmPolicyResponse { readonly projectId: string; readonly userId: string; readonly accountId: string; readonly address: `0x${string}`; readonly policy: EvmPolicy; readonly limits: EvmTransferLimits }
export interface EvmTransaction { readonly type: 'eip1559'; readonly chainId: '0xaa36a7'; readonly nonce: `0x${string}`; readonly to: `0x${string}`; readonly value: `0x${string}`; readonly data: `0x${string}`; readonly gas: `0x${string}`; readonly maxFeePerGas: `0x${string}`; readonly maxPriorityFeePerGas: `0x${string}`; readonly accessList: readonly [] }
export interface EvmTransferQuote {
  readonly schemaVersion: 1; readonly chainId: 11155111;
  readonly context: { readonly projectId: string; readonly userId: string; readonly walletId: string };
  readonly from: `0x${string}`; readonly to: `0x${string}`; readonly asset: EvmAsset; readonly amount: string; readonly amountUnits: string;
  readonly transaction: EvmTransaction; readonly balance: string; readonly nativeBalance: string;
  readonly maxFee: string; readonly totalDebit: string; readonly preparedAt: number; readonly expiresAt: number;
  readonly blockNumber: string; readonly blockHash: `0x${string}`; readonly hash: `0x${string}`;
}
export interface EvmTransferReceipt { readonly hash: `0x${string}`; readonly state: 'unknown' | 'pending' | 'confirming' | 'confirmed' | 'failed' | 'reorged' | 'dropped' | 'replaced'; readonly confirmations: number; readonly blockNumber?: string; readonly blockHash?: `0x${string}`; readonly gasUsed?: string; readonly effectiveGasPrice?: string; readonly explorerUrl?: string }
export interface EvmTransferIntent {
  readonly schemaVersion: 1; readonly id: string; readonly projectId: string; readonly userId: string; readonly accountId: string;
  readonly from: `0x${string}`; readonly origin: string; readonly chainId: 11155111; readonly policyRevision: number; readonly expiresAt: number;
  readonly quote: EvmTransferQuote; readonly state: EvmTransferState; readonly transactionHash: `0x${string}` | null;
  readonly receipt: EvmTransferReceipt | null; readonly createdAt: number; readonly updatedAt: number; readonly limits?: EvmTransferLimits;
}
export interface EvmBalance { readonly chainId: 11155111; readonly address: `0x${string}`; readonly asset: EvmAsset; readonly balance: string; readonly formatted: string; readonly nativeBalance: string; readonly blockNumber: string; readonly observedAt: number }
export interface EvmBalancesResponse { readonly chainId: 11155111; readonly address: `0x${string}`; readonly balances: readonly EvmBalance[]; readonly updatedAt: number }
export interface EvmDeposit { readonly id: string; readonly chainId: 11155111; readonly transactionHash: `0x${string}`; readonly blockNumber: string; readonly blockHash: `0x${string}`; readonly from: `0x${string}`; readonly to: `0x${string}`; readonly asset: EvmAsset; readonly amount: string; readonly logIndex: string | null; readonly confirmations: number; readonly state: 'confirmed' | 'confirming' | 'reorged'; readonly removed: boolean }
export interface EvmDepositsResponse { readonly chainId: 11155111; readonly address: `0x${string}`; readonly events: readonly EvmDeposit[]; readonly updatedAt: number; readonly scope: string }
export interface EvmTransferApproval { readonly id: string; readonly transactionHash: `0x${string}`; readonly from: `0x${string}` }

export interface SolanaWalletSnapshot extends Omit<WalletSnapshot, 'wallet' | 'evmNetwork'> {
  readonly chainType: 'SVM';
  readonly cluster: SolanaCluster;
  readonly wallet: SolanaWallet | null;
}
export interface SolanaClientOptions extends Omit<ClientOptions, 'getSession'> {
  getSession: (options: { signal: AbortSignal; cluster: SolanaCluster }) => Promise<SolanaWalletSession>;
}
export interface SuvrySolanaClient {
  getSnapshot(): SolanaWalletSnapshot;
  getServerSnapshot(): SolanaWalletSnapshot;
  subscribe(listener: () => void): () => void;
  connect(): Promise<void>;
  createWallet(password: string): Promise<SolanaWallet>;
  recoverWallet(password: string): Promise<SolanaWallet>;
  getBalance(asset?: 'sol'): Promise<SolanaNativeBalance>;
  getBalance(asset: 'spl' | 'token2022'): Promise<SolanaTokenBalance>;
  getBalance(asset: SolanaAsset): Promise<SolanaNativeBalance | SolanaTokenBalance>;
  getDeposits(asset?: SolanaAsset): Promise<SolanaDepositsResponse>;
  getTransfers(): Promise<{ readonly intents: readonly SolanaTransferIntent[] }>;
  getTransfer(intentId: string): Promise<SolanaTransferIntent>;
  prepareTransfer(input: SolanaTransferInput): Promise<SolanaTransferIntent>;
  approveTransfer(intentId: string): Promise<SolanaTransferApproval>;
  submitTransfer(intentId: string): Promise<SolanaTransferIntent>;
  cancelTransfer(intentId: string): Promise<SolanaTransferIntent>;
  disconnect(): void;
  destroy(): void;
}
export function createSuvrySolanaClient(options: SolanaClientOptions): SuvrySolanaClient;

export { createSepoliaProvider, createDevnetWalletStandard } from './standards.js';
export type { SepoliaProvider, DevnetWalletAccount, WalletNetwork } from './standards.js';

export type {MainnetId,MainnetNetwork,MainnetWallet,MainnetWalletSession,MainnetIntent,MainnetDeposit,MainnetSnapshot,MainnetClientOptions,SuvryMainnetClient} from './contracts.js';
export function createSuvryMainnetClient(options:import('./contracts.js').MainnetClientOptions):import('./contracts.js').SuvryMainnetClient;

export type SuvrySupportStatus = 'available' | 'preview' | 'setup-required' | 'planned';
export type SuvryLoginMethod = "email" | "wallet" | "walletconnect" | "google" | "discord" | "telegram" | "facebook" | "instagram" | "apple" | "x" | "line";
export interface SuvrySupportFeature {readonly id:string;readonly label:string;readonly category:string;readonly status:SuvrySupportStatus;readonly summary:string;readonly environment:string;readonly network:string;readonly assets:readonly string[];readonly platforms:readonly string[];readonly accountType:string;readonly providerSetup:string;readonly plan:string;readonly documentation:string;readonly requires:{readonly project:boolean;readonly provider:boolean};readonly planRights:{readonly state:'included'|'conditional'|'not-offered';readonly plans:readonly string[]};readonly evidence:readonly string[];readonly tasks:readonly string[];}
export interface SuvrySupportSnapshot {readonly schemaVersion:2;readonly revision:string;readonly asOf:string;readonly scope:string;readonly publicSdkVersion:string;readonly consumers:readonly string[];readonly highlights:readonly string[];readonly features:readonly SuvrySupportFeature[];readonly loginMethods:readonly {readonly id:SuvryLoginMethod;readonly label:string;readonly action:string;readonly icon:string;readonly feature:string}[];readonly recoveryMethods:readonly {readonly id:string;readonly label:string;readonly feature:string}[];}
export declare const supportMatrixHash:string;
export declare const supportMatrixRevision:string;
export declare function getSuvryCapabilities():SuvrySupportSnapshot;
export declare function getFeatureSupport(id:string):SuvrySupportFeature;
export declare function statusLabel(status:SuvrySupportStatus|string):string;
export declare function isFeatureReleased(id:string):boolean;
export declare function canUseFeature(id:string,context?:{projectReady?:boolean;providerConfigured?:boolean;plan?:string}):boolean;
export declare function getLoginMethods():readonly {readonly id:SuvryLoginMethod;readonly label:string;readonly action:string;readonly icon:string;readonly feature:string;readonly status:SuvrySupportStatus;readonly setupRequired:boolean}[];
export declare function getRecoveryMethods():readonly {readonly id:string;readonly label:string;readonly feature:string;readonly status:SuvrySupportStatus;readonly enabled:boolean}[];
export declare function selectSupportFeatures(filter?:{query?:string;status?:SuvrySupportStatus|'all'}):readonly SuvrySupportFeature[];
