/** * Stellar wallet utilities for Privy integration * Stellar chain type is used for Ed25519 signing required by Canton Network */ /** * Stellar/Solana wallet interface representing a Privy Ed25519 wallet */ export interface CantonWallet { /** Wallet address (public key in Stellar/Solana format) */ address: string; /** Raw public key in hex format (camelCase) - only for Stellar */ publicKey?: string; /** Raw public key in hex format (snake_case from Privy API) - only for Stellar */ public_key?: string; /** Chain type: 'stellar' (default) or 'solana' (with export) */ chainType: 'stellar' | 'solana'; /** Wallet client type (e.g., 'privy') */ walletClientType?: string; /** Whether the wallet was imported or created */ imported?: boolean; } /** * Extracts all Ed25519 wallets (Stellar or Solana) from Privy user and wallets array * Combines wallets from both user.linkedAccounts and useWallets hook, * removing duplicates by address. * * @param user - Privy user object * @param wallets - Privy wallets array from useWallets hook * @param chainType - Chain type to filter by: 'stellar' (default) or 'solana' (with export) * @returns Array of unique wallets * * @example * ```ts * const { user } = usePrivy(); * const { wallets } = useWallets(); * const cantonWallets = getCantonWallets(user, wallets, 'stellar'); * console.log(`Found ${cantonWallets.length} wallets`); * ``` */ export declare const getCantonWallets: (user: any, wallets: any[], chainType?: "stellar" | "solana") => CantonWallet[]; /** * Converts Stellar wallet public key to Canton Network base64 format * Handles removal of leading 00 byte and conversion from hex to base64 * * @param wallet - Stellar wallet object containing publicKey * @returns Public key in base64 format ready for Canton Network API * @throws {Error} If wallet is invalid or publicKey is missing/malformed * * @example * ```ts * const publicKeyBase64 = getPublicKeyBase64(stellarWallet); * // Use with Canton Network API * await fetch('/canton/register/prepare', { * body: JSON.stringify({ publicKey: publicKeyBase64 }) * }); * ``` */ export declare const getPublicKeyBase64: (wallet: CantonWallet | any) => string; /** * Type guard to check if a wallet is a Stellar/Solana Ed25519 wallet * @param wallet - Wallet object to check * @returns True if wallet is a valid Ed25519 wallet (Stellar or Solana) * * @example * ```ts * if (isCantonWallet(wallet)) { * console.log('Ed25519 wallet address:', wallet.address); * } * ``` */ export declare const isCantonWallet: (wallet: any) => wallet is CantonWallet; /** * Gets the first Ed25519 wallet from user and wallets array * Convenience function that throws if no wallet is found * * @param user - Privy user object * @param wallets - Privy wallets array from useWallets hook * @param chainType - Chain type to filter by: 'stellar' (default) or 'solana' (with export) * @returns First wallet found * @throws {Error} If no wallet found * * @example * ```ts * try { * const wallet = getFirstCantonWallet(user, wallets, 'stellar'); * console.log('Using wallet:', wallet.address); * } catch (err) { * console.error('No wallet available'); * } * ``` */ export declare const getFirstCantonWallet: (user: any, wallets: any[], chainType?: "stellar" | "solana") => CantonWallet;