import { BIP340KeygenResult, EcdsaKeygenResult, EcdsaSignature, MessageHash, type EcdsaPublicKey } from '#internal/node';
import { BackupLocation, type BitcoinConfig, DynamicApiClient, WalletOperation, type KeyShareBackupInfo, type ThresholdSignatureScheme } from '@dynamic-labs-wallet/core';
import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
import type { ServerKeyShare } from './mpc/index.js';
import type { ServerInitKeygenResult } from './mpc/types.js';
import type { DynamicWalletClientProps, WalletProperties } from './types.js';
export declare class DynamicWalletClient {
    environmentId: string;
    debug: boolean;
    protected logger: import("@dynamic-labs/logger").Logger;
    protected apiClient: DynamicApiClient;
    protected walletMap: Record<string, WalletProperties>;
    protected baseMPCRelayApiUrl?: string;
    protected baseJWTAuthToken?: string;
    protected baseApiUrl?: string;
    protected isApiClientAuthenticated: boolean;
    protected forwardMPCEnabled: boolean;
    constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator, }: DynamicWalletClientProps);
    initializeForwardMPCClient(): Promise<void>;
    private ensureApiClientAuthenticated;
    authenticateApiToken(authToken: string): Promise<void>;
    dynamicServerInitializeKeyGen({ chainName, externalServerKeygenIds, thresholdSignatureScheme, dynamicRequestId, skipLock, bitcoinConfig, onError, onCeremonyComplete, }: {
        chainName: string;
        externalServerKeygenIds: string[];
        thresholdSignatureScheme: ThresholdSignatureScheme;
        dynamicRequestId: string;
        skipLock?: boolean;
        bitcoinConfig?: BitcoinConfig;
        onError?: (error: Error) => void;
        onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
    }): Promise<import("@dynamic-labs-wallet/core").KeygenCompleteResponse>;
    externalServerInitializeKeyGen({ chainName, thresholdSignatureScheme, }: {
        chainName: string;
        thresholdSignatureScheme: ThresholdSignatureScheme;
    }): Promise<ServerInitKeygenResult[]>;
    derivePublicKey({ chainName, keyShare, derivationPath, bitcoinConfig, }: {
        chainName: string;
        keyShare: ServerKeyShare;
        derivationPath: Uint32Array | undefined;
        bitcoinConfig?: BitcoinConfig;
    }): Promise<string | EcdsaPublicKey | Uint8Array | undefined>;
    externalServerKeyGen({ chainName, roomId, dynamicServerKeygenIds, externalServerInitKeygenResults, thresholdSignatureScheme, bitcoinConfig, }: {
        chainName: string;
        roomId: string;
        dynamicServerKeygenIds: string[];
        externalServerInitKeygenResults: ServerInitKeygenResult[];
        thresholdSignatureScheme: ThresholdSignatureScheme;
        bitcoinConfig?: BitcoinConfig;
    }): Promise<{
        rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
        externalServerKeyGenResults: ServerKeyShare[];
    }>;
    keyGen({ chainName, thresholdSignatureScheme, skipLock, bitcoinConfig, onError, onCeremonyComplete, }: {
        chainName: string;
        thresholdSignatureScheme: ThresholdSignatureScheme;
        skipLock?: boolean;
        bitcoinConfig?: BitcoinConfig;
        onError?: (error: Error) => void;
        onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
    }): Promise<{
        rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
        externalServerKeyShares: ServerKeyShare[];
    }>;
    importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, onError, onCeremonyComplete, }: {
        chainName: string;
        privateKey: string;
        thresholdSignatureScheme: ThresholdSignatureScheme;
        onError?: (error: Error) => void;
        onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
    }): Promise<{
        rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
        externalServerKeyShares: ServerKeyShare[];
    }>;
    dynamicServerSign({ walletId, message, isFormatted, context, bitcoinConfig, onError, }: {
        walletId: string;
        message: string | Uint8Array;
        isFormatted?: boolean;
        context?: SignMessageContext;
        bitcoinConfig?: BitcoinConfig;
        onError?: (error: Error) => void;
    }): Promise<import("@dynamic-labs-wallet/core").OpenRoomResponse>;
    externalServerSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted, bitcoinConfig, }: {
        chainName: string;
        message: string | Uint8Array;
        roomId: string;
        keyShare: ServerKeyShare;
        derivationPath: Uint32Array | undefined;
        isFormatted?: boolean;
        bitcoinConfig?: BitcoinConfig;
    }): Promise<Uint8Array | EcdsaSignature>;
    forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage, dynamicRequestId, isFormatted, }: {
        chainName: string;
        message: string | Uint8Array;
        roomId: string;
        keyShare: ServerKeyShare;
        derivationPath: Uint32Array | undefined;
        formattedMessage: string | Uint8Array | MessageHash;
        dynamicRequestId: string;
        isFormatted?: boolean;
    }): Promise<Uint8Array | EcdsaSignature>;
    sign({ accountAddress, externalServerKeyShares, message, chainName, password, isFormatted, context, onError, bitcoinConfig, }: {
        accountAddress: string;
        externalServerKeyShares?: ServerKeyShare[];
        message: string | Uint8Array;
        chainName: string;
        password?: string;
        isFormatted?: boolean;
        context?: SignMessageContext;
        bitcoinConfig?: BitcoinConfig;
        onError?: (error: Error) => void;
    }): Promise<Uint8Array | EcdsaSignature>;
    refreshWalletAccountShares({ accountAddress, chainName, password, externalServerKeyShares, backUpToClientShareService, }: {
        accountAddress: string;
        chainName: string;
        password?: string;
        externalServerKeyShares?: ServerKeyShare[];
        backUpToClientShareService?: boolean;
    }): Promise<(EcdsaKeygenResult | BIP340KeygenResult)[]>;
    getExportId({ chainName, serverKeyShare, }: {
        chainName: string;
        serverKeyShare: ServerKeyShare;
    }): Promise<string>;
    /**
     * Helper function to create client shares required to complete a reshare ceremony.
     * @param {string} chainName - The chain to create shares for
     * @param {WalletProperties} wallet - The wallet to reshare
     * @param {ThresholdSignatureScheme} oldThresholdSignatureScheme - The current threshold signature scheme
     * @param {ThresholdSignatureScheme} newThresholdSignatureScheme - The target threshold signature scheme
     * @returns {Promise<{
     *   newClientInitKeygenResults: ClientInitKeygenResult[],
     *   newClientKeygenIds: string[],
     *   existingClientKeygenIds: string[],
     *   existingClientKeyShares: ClientKeyShare[]
     * }>} Object containing new and existing client keygen results, IDs and shares
     * @todo Support higher to lower reshare strategies
     */
    reshareStrategy({ chainName, wallet, oldThresholdSignatureScheme, newThresholdSignatureScheme, }: {
        chainName: string;
        wallet: WalletProperties;
        oldThresholdSignatureScheme: ThresholdSignatureScheme;
        newThresholdSignatureScheme: ThresholdSignatureScheme;
    }): Promise<{
        newExternalServerInitKeygenResults: ServerInitKeygenResult[];
        newExternalServerKeygenIds: string[];
        existingExternalServerKeygenIds: string[];
        existingExternalServerKeyShares: ServerKeyShare[];
    }>;
    reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password, externalServerKeyShares, backUpToClientShareService, }: {
        chainName: string;
        accountAddress: string;
        oldThresholdSignatureScheme: ThresholdSignatureScheme;
        newThresholdSignatureScheme: ThresholdSignatureScheme;
        password?: string;
        externalServerKeyShares?: ServerKeyShare[];
        backUpToClientShareService?: boolean;
    }): Promise<(EcdsaKeygenResult | BIP340KeygenResult)[]>;
    exportKey({ accountAddress, chainName, password, externalServerKeyShares, bitcoinConfig, }: {
        accountAddress: string;
        chainName: string;
        password?: string;
        externalServerKeyShares?: ServerKeyShare[];
        bitcoinConfig?: BitcoinConfig;
    }): Promise<{
        derivedPrivateKey: string | undefined;
    }>;
    offlineExportKey({ chainName, keyShares, derivationPath, }: {
        chainName: string;
        keyShares: ServerKeyShare[];
        derivationPath?: string;
    }): Promise<{
        derivedPrivateKey: string | undefined;
    }>;
    encryptKeyShare({ keyShare, password, }: {
        keyShare: ServerKeyShare;
        password?: string;
    }): Promise<string>;
    ensureCeremonyCompletionBeforeBackup({ accountAddress, }: {
        accountAddress: string;
    }): Promise<void>;
    storeEncryptedBackupByWallet({ accountAddress, externalServerKeyShares, password, backUpToClientShareService, }: {
        accountAddress: string;
        externalServerKeyShares?: ServerKeyShare[];
        password?: string;
        backUpToClientShareService: boolean;
    }): Promise<string[]>;
    storeEncryptedBackupByWalletWithRetry({ accountAddress, externalServerKeyShares, password, backUpToClientShareService, }: {
        accountAddress: string;
        externalServerKeyShares?: ServerKeyShare[];
        password?: string;
        backUpToClientShareService: boolean;
    }): Promise<void>;
    getExternalServerKeyShares({ accountAddress, password, }: {
        accountAddress: string;
        password?: string;
    }): Promise<any[]>;
    updatePassword({ accountAddress, existingPassword, newPassword, backUpToClientShareService, }: {
        accountAddress: string;
        existingPassword?: string;
        newPassword?: string;
        backUpToClientShareService: boolean;
    }): Promise<void>;
    decryptKeyShare({ keyShare, password, }: {
        keyShare: string;
        password?: string;
    }): Promise<ServerKeyShare>;
    /**
     * Helper function to determine keyshare recovery strategy for dynamic shares.
     * For REFRESH operations, retrieves enough shares to meet the client threshold.
     * For all other operations, retrieves just 1 share.
     *
     * @param clientKeyShareBackupInfo - Information about backed up key shares
     * @param thresholdSignatureScheme - The signature scheme being used (2-of-2, 2-of-3, etc)
     * @param walletOperation - The operation being performed (REFRESH, SIGN_MESSAGE, etc)
     * @param shareCount - The number of shares to recover if specified for reshare operations
     * @returns @shares: Object mapping backup locations to arrays of share IDs to recover
     * @returns @requiredShareCount: The number of shares required to recover
     */
    recoverStrategy({ externalServerKeySharesBackupInfo, thresholdSignatureScheme, walletOperation, shareCount, }: {
        externalServerKeySharesBackupInfo: KeyShareBackupInfo;
        thresholdSignatureScheme: ThresholdSignatureScheme;
        walletOperation: WalletOperation;
        shareCount?: number;
    }): {
        shares: Partial<Record<BackupLocation, string[]>>;
        requiredShareCount: number;
    };
    /**
     * Attempts to recover key shares from backup if they are not provided.
     * The recovered shares will be stored in the wallet map for use in signing operations.
     * @param accountAddress - The account address to recover shares for
     * @param password - The password to decrypt the shares
     * @param walletOperation - The wallet operation being performed
     * @param externalServerKeyShares - The provided key shares (if any)
     * @param errorMessage - The error message to throw if recovery fails
     * @throws Error if recovery is needed but fails
     */
    protected ensureKeySharesRecovered({ accountAddress, password, walletOperation, externalServerKeyShares, errorMessage, }: {
        accountAddress: string;
        password?: string;
        walletOperation: WalletOperation;
        externalServerKeyShares?: ServerKeyShare[];
        errorMessage: string;
    }): Promise<void>;
    recoverEncryptedBackupByWallet({ accountAddress, password, walletOperation, shareCount, storeRecoveredShares, }: {
        accountAddress: string;
        password?: string;
        walletOperation: WalletOperation;
        shareCount?: number;
        storeRecoveredShares?: boolean;
    }): Promise<any[]>;
    exportExternalServerKeyShares({ accountAddress, password, }: {
        accountAddress: string;
        password?: string;
    }): Promise<any[]>;
    /**
     * Helper function to check if the required wallet fields are present and valid
     * @param accountAddress - The account address of the wallet to check
     * @param walletOperation - The wallet operation that determines required fields
     * @returns boolean indicating if wallet needs to be re-fetched and restored from server
     */
    private checkWalletFields;
    /**
     * verifyPassword attempts to recover and decrypt a single client key share using the provided password.
     * If successful, the key share is encrypted with the new password. This method solely performs the recovery
     * and decryption without storing the restored key shares. If unsuccessful, it throws an error.
     */
    verifyPassword({ accountAddress, password, walletOperation, }: {
        accountAddress: string;
        password?: string;
        walletOperation?: WalletOperation;
    }): Promise<void>;
    isPasswordEncrypted({ accountAddress, }: {
        accountAddress: string;
    }): Promise<boolean>;
    /**
     * check if the operation requires a password
     */
    requiresPasswordForOperation({ accountAddress, walletOperation, }: {
        accountAddress: string;
        walletOperation?: WalletOperation;
    }): Promise<boolean>;
    /**
     * check if the operation requires restoring backup shares
     */
    requiresRestoreBackupSharesForOperation({ accountAddress, walletOperation, }: {
        accountAddress: string;
        walletOperation?: WalletOperation;
    }): Promise<boolean>;
    getWalletExternalServerKeyShareBackupInfo({ accountAddress, }: {
        accountAddress: string;
    }): Promise<KeyShareBackupInfo>;
    getWallet({ accountAddress, walletOperation, shareCount, password, }: {
        accountAddress: string;
        walletOperation?: WalletOperation;
        shareCount?: number;
        password?: string;
    }): Promise<WalletProperties>;
    /**
     * Get a single wallet by address
     * First tries the efficient getWaasWalletByAddress endpoint, falls back to getUser() if not available
     */
    getWalletByAddress(accountAddress: string): Promise<WalletProperties | null>;
    /**
     * Get all wallets (kept for backward compatibility but now uses lazy loading)
     * @deprecated Consider using getWalletByAddress for better performance with large wallet counts
     */
    getWallets(): Promise<any>;
}
//# sourceMappingURL=client.d.ts.map