import { d as SolanaRelayer, C as CavosSolana } from './CavosSolana-BgzBk_2P.mjs'; import { Account } from 'starknet'; import { S as StellarRelayer, C as CavosStellar } from './CavosStellar-DxAYL2pU.mjs'; import { D as DeviceUnwrapKey } from './DeviceUnwrapKey-Ct-JUQrB.mjs'; import { Keypair } from '@stellar/stellar-sdk'; import { I as Identity, P as PrivacyOperations, A as AuthProvider, W as WalletRegistry, S as SocialRecoveryCredential, a as SocialRecoveryClient, E as EnclaveDekPort, D as DeviceFactor, b as WrapStore, c as Ed25519Seed, d as PasskeyPrfProvider, V as VaultClient, e as PrivacySdk } from './VaultClient-CkzLCyXH.mjs'; import { C as ChainCall, E as ExecuteOptions, M as MessageSignature, S as StarknetSignedTransaction } from './signing-BC_pkVbS.mjs'; import { S as StarknetSpend, a as StarknetPrivacyConfig } from './nativeConnect-DPJqSwJj.mjs'; /** Starknet network presets and well-known addresses for the kit. */ declare const STARKNET_NETWORKS: { readonly sepolia: { readonly chainId: "0x534e5f5345504f4c4941"; readonly rpcUrl: "https://api.cartridge.gg/x/starknet/sepolia"; }; readonly mainnet: { readonly chainId: "0x534e5f4d41494e"; readonly rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet"; }; }; type StarknetNetwork = keyof typeof STARKNET_NETWORKS; /** Cavos-hosted SNIP-29 paymaster (same service @cavos/react uses). */ declare const CAVOS_PAYMASTER_URL: Record; /** * OpenZeppelin `AccountUpgradeable` v3.0.0 class hash (Scarb 2.13.1, * `--release`), declared on mainnet and Sepolia. Pinned forever: the account * address derives from it, and `ensureEnclave` clears the local wrap when the * derived address differs from the registered one. Later implementation changes go through the account's * `upgrade`, which keeps the address. */ declare const OZ_ACCOUNT_CLASS_HASH = "0x01d1777db36cdd06dd62cfde77b1b6ae06412af95d57a13dc40ac77b8a702381"; interface ConnectStarknetOptions { network: StarknetNetwork; auth?: AuthProvider; identity?: Identity; appSalt: string; appId?: string; environment?: "development" | "production"; backendUrl?: string; registry?: WalletRegistry; /** Cavos paymaster API key. Sponsors the deploy and every sponsored execute. */ paymasterApiKey: string; paymasterUrl?: string; rpcUrl?: string; credential?: SocialRecoveryCredential; socialRecovery?: SocialRecoveryClient; recovery?: EnclaveDekPort; factor?: DeviceFactor; wrapStore?: WrapStore; importSpend?: (seed: Ed25519Seed, keyId: string) => Promise; passkey?: PasskeyPrfProvider; /** Keep the key in the Cavos vault instead of this page's storage. */ vault?: VaultClient; /** * Private transfers (STRK20) for a key held in this page. With a vault the * pool, prover, discovery and relay come from the app's Cavos settings, so * passing this together with `vault` is refused. */ privacy?: StarknetPrivacyConfig; /** Required with `privacy`: `() => import("@starkware-libs/starknet-privacy-sdk")`, so the app's own bundler resolves it. */ privacySdk?: () => Promise; } /** * Native Starknet account: the standard OpenZeppelin `AccountUpgradeable`, whose * stark key is HKDF of the MasterDEK. There is no on-chain device list; a new * device restores the DEK off-chain and derives the same key. * * Connect never deploys. The first `execute` deploys the account and runs the * calls in one sponsored transaction. */ declare class CavosStarknet { readonly chain: "starknet"; readonly identity: Identity; readonly address: string; readonly network: StarknetNetwork; /** Private balance, deposits, transfers and withdrawals in a STRK20 pool. Nothing here returns a key or a note. */ readonly privacy: PrivacyOperations; isNewAccount: boolean; onAuthorizationNeeded?: () => Promise; private statusValue; private deployed; private readonly provider; private readonly accountValue?; private readonly starkPublicKey?; private readonly passkeyRestore; private readonly statusListeners; /** * An object, not positions: this list grows with every capability, and each * time it grew positionally something downstream silently read the wrong * argument. */ private constructor(); get status(): ConnectStatus; get isDeployed(): boolean; /** The starknet.js account. Throws on a device that holds no key. */ get account(): Account; /** The stark public key (hex) the account was deployed with. */ get publicKey(): string; onStatusChange(listener: () => void): () => void; private setStatus; static connect(opts: ConnectStarknetOptions): Promise; hasPasskey(): Promise; /** Ready means one thing here: this device holds the stark key. There is no on-chain signer set to wait for. */ isReady(): Promise; /** * Execute a multicall, signed silently by the account key. Sponsored by * default; `fee: 'self'` pays from the account's own balance. * * **Lazy deploy**: on an undeployed account the first execute deploys it and * runs the calls in one sponsored transaction, then the status becomes * `ready`. A self-funded first execute is refused, because the account has no * balance to deploy itself with. */ execute(calls: ChainCall[], opts?: ExecuteOptions): Promise<{ transactionHash: string; }>; private deployAndExecute; /** * Sign an arbitrary message off-chain as SNIP-12 revision 1 typed data. Nothing * is submitted and no gas is paid, so it works before the account is deployed. * A verifier recomputes the message hash from `typedData` and the account * address, then checks the stark signature, or calls the deployed account's * `is_valid_signature`. */ signMessage(message: string | Uint8Array): Promise; /** * Build + sign a multicall WITHOUT submitting it. Returns the signed invoke * (calldata + 2-felt stark signature + nonce + resource bounds). A relayer * can broadcast it later via the account's `invokeFunction`. * * The signature binds to the nonce and resource bounds at sign time — if any * other transaction from this account is submitted first, this signature is * invalid. Broadcast promptly. */ signTransaction(calls: ChainCall[]): Promise; /** Upgrade this account to a reviewed class. The address and storage are kept; the account authorizes it as a self-call. */ upgrade(newClassHash: string, opts?: ExecuteOptions): Promise<{ transactionHash: string; }>; private refuseKeyRotation; } /** The chains the unified `Cavos.connect` can target. */ type Chain = "starknet" | "solana" | "stellar"; /** * Environment selector. `Cavos.connect` resolves it to the chain's concrete * network: starknet → sepolia/mainnet, solana → solana-devnet/solana-mainnet. */ type NetworkEnv = "mainnet" | "testnet"; /** * Chain status indicates whether an account is deployed, ready, or needs restoring. * - `undeployed`: Address derived but no on-chain account exists yet. * - `ready`: This device holds the spend key (and the account exists, where it has to be deployed). * - `needs-device-approval`: This device holds no spend key yet; restore it with the enclave or a passkey. */ type ChainStatus = "undeployed" | "ready" | "needs-device-approval"; /** A connected wallet: discriminated by `chain`, so `execute()` stays native. */ type CavosWallet = CavosStarknet | CavosSolana | CavosStellar; /** * Multi-chain session returned by `Cavos.connect` when multiple chains are configured. * The session IS the default chain's wallet, augmented with methods * to access other configured chains without re-connecting. * * Type-narrow on `wallet.chain` before calling chain-specific `execute()`. */ interface CavosSession { /** The configured chains for this session. */ readonly chains: Chain[]; /** The default chain for this session. */ readonly defaultChain: Chain; /** * Get the wallet for a specific configured chain. Throws if the chain is not * in the session's configured `chains`. */ wallet(chain: Chain): CavosWallet; /** * Get the status of a specific configured chain. Returns the wallet's * `status` property for that chain. */ chainStatus(chain: Chain): ChainStatus; /** * Get the address for a specific configured chain. */ chainAddress(chain: Chain): string; } interface ConnectOptions { /** * Target chain (single-chain mode). The returned wallet is discriminated by this value. * @deprecated Use `chains` and `defaultChain` for multi-chain sessions. * When `chains` is provided, this is ignored. If only `chain` is provided, * it's treated as `chains: [chain], defaultChain: chain` but connect still * does NOT deploy on connect (lazy deploy on first execute). */ chain?: Chain; /** * Chains to configure for this session. Connect derives addresses for all * configured chains but NEVER deploys on connect. Deployment happens lazily * on the first `execute` call for each chain. */ chains?: Chain[]; /** * Default chain for the session. Must be in `chains`. When using the * single-chain `chain` option, `defaultChain` defaults to that chain. */ defaultChain?: Chain; /** Environment. Resolved to sepolia/devnet (testnet) or mainnet per chain. */ network: NetworkEnv; /** Authenticated user (pass `identity` directly, or an `auth` provider). */ auth?: AuthProvider; identity?: Identity; appSalt: string; /** * Cavos App ID. When set (with `backendUrl`), the kit uses the hosted * WalletRegistry by default for real multi-device support. */ appId?: string; /** Cavos console environment. Defaults to production when omitted. */ environment?: "development" | "production"; /** Cavos backend base URL. Defaults to https://cavos.xyz. */ backendUrl?: string; /** * Off-chain user_id -> wallet map. Defaults to the hosted HttpWalletRegistry * when `appId` is set, else an in-memory registry (single-device only). */ registry?: WalletRegistry; rpcUrl?: string; /** * Per-chain RPC overrides. With more than one configured chain a single * `rpcUrl` cannot be right — pointing Starknet at a Solana node answers * `starknet_call` with "Method not found" — so this wins over `rpcUrl` for * the chain it names. */ rpcUrls?: Partial>; /** Cavos paymaster API key (sponsors deploy + execute). Required for Starknet. */ paymasterApiKey?: string; paymasterUrl?: string; /** Gasless sponsorship relayer (defaults to the hosted one when `appId` set). */ relayer?: SolanaRelayer; /** * Where Toll lives, for `fee: { token }` — the user pays their own fee, in a * token they already hold. Omit it and that route is simply unavailable. */ /** * Overrides where the token fee route settles. Defaults to the hosted * service, so `fee: { token }` needs no configuration. */ tollUrl?: string; socialRecovery?: SocialRecoveryClient; socialRecoveryCredential?: SocialRecoveryCredential; /** * When the app is not using the enclave, a synced passkey derives the * MasterDEK. The same credential on a new device produces the same address. */ passkeyPrf?: PasskeyPrfProvider; /** Gasless sponsorship relayer (defaults to the hosted one when `appId` set). */ stellarRelayer?: StellarRelayer; /** Self-funded source/fee-payer Stellar keypair when no relayer is configured. */ stellarSourceKeypair?: Keypair; /** * This device's ECDH unwrap key for the Stellar control-key envelope. Defaults * to a persisted `WebCryptoDeviceUnwrapKey` in the browser; pass your own on * React Native / server. */ stellarDeviceKey?: DeviceUnwrapKey; /** Create/load the Stellar ECDH unwrap key (native / tests). */ createStellarDeviceKey?: (keyId: string) => Promise; /** * Keep the signing keys in the Cavos vault, an iframe on a Cavos origin, * instead of this page's storage. Needs `appId`. */ vault?: boolean | { url?: string; }; } /** * Whether this device can already operate the wallet, or needs it restored. * - `undeployed`: Address derived but no on-chain account exists yet. First execute will deploy. * - `ready`: This device holds the spend key. * - `needs-device-approval`: This device holds no spend key yet. */ type ConnectStatus = "undeployed" | "ready" | "needs-device-approval"; /** * Unified entry point. Pick a `chain` (or `chains` + `defaultChain`) and a * `network` environment; the kit resolves the concrete network and returns * a chain-native wallet. The result is a discriminated union (`wallet.chain`), * so `execute()` keeps each chain's native signature. * * Every chain is native: the account key is derived from a MasterDEK, recovery * is off-chain (enclave or passkey), and there is no on-chain device list. * * **Lazy deploy**: Connect NEVER deploys on connect. The first `execute` call * on an undeployed chain triggers deployment + the user operation atomically. * * const wallet = await Cavos.connect({ chain: "solana", network: "testnet", identity, appSalt, appId }); * if (wallet.chain === "starknet") await wallet.execute(calls); // deploys here if needed * else await wallet.execute(amount, dest); * * **Multi-chain**: * * const wallet = await Cavos.connect({ * chains: ["solana", "stellar"], * defaultChain: "stellar", * network: "testnet", * identity, * appSalt, * appId, * }); * // wallet.chain is "stellar" (the default) * // wallet.wallet("solana") → CavosSolana * // wallet.chainStatus("solana") → "undeployed" | "ready" | "needs-device-approval" */ declare function connect(opts: ConnectOptions): Promise; /** The unified entry point: `Cavos.connect` returns the chain-native wallet for each configured chain. */ declare const Cavos: { connect: typeof connect; }; export { type Chain as C, type NetworkEnv as N, OZ_ACCOUNT_CLASS_HASH as O, STARKNET_NETWORKS as S, type CavosWallet as a, type CavosSession as b, type ConnectOptions as c, CAVOS_PAYMASTER_URL as d, Cavos as e, CavosStarknet as f, type ConnectStarknetOptions as g, type ConnectStatus as h, type StarknetNetwork as i };