/**
 * Unfrack UTxO Optimization Module
 *
 * Implements Unfrack.It principles for efficient wallet structure:
 * - Token bundling: Group tokens into optimally-sized UTxOs
 * - Fungible isolation: Place each fungible token on its own UTxO
 * - NFT grouping: Group NFTs by policy ID
 * - ADA optimization: Roll up or subdivide ADA-only
 *
 * Named in respect to the Unfrack.It website
 */
import * as Effect from "effect/Effect";
import type * as CoreAddress from "../../Address.js";
import * as CoreAssets from "../../Assets.js";
import type * as TxOut from "../../TxOut.js";
import type { UnfrackOptions } from "./TransactionBuilder.js";
/**
 * Token classification for unfracking decisions
 */
export interface TokenInfo {
    readonly policyId: string;
    readonly assetName: string;
    readonly quantity: bigint;
    readonly isFungible: boolean;
}
/**
 * Extract tokens from assets
 */
export declare const extractTokens: (assets: CoreAssets.Assets) => ReadonlyArray<TokenInfo>;
/**
 * Group tokens by policy ID
 */
export declare const groupByPolicy: (tokens: ReadonlyArray<TokenInfo>) => Map<string, ReadonlyArray<TokenInfo>>;
/**
 * Bundle result - multiple UTxOs each containing bundled tokens
 */
export interface TokenBundle {
    readonly tokens: ReadonlyArray<TokenInfo>;
    readonly adaAmount: bigint;
}
/**
 * Calculate bundles based on unfrack configuration
 * Now calculates proper minUTxO for each bundle using CBOR
 */
export declare const calculateTokenBundles: (tokens: ReadonlyArray<TokenInfo>, options: UnfrackOptions, changeAddress: CoreAddress.Address, coinsPerUtxoByte: bigint) => Effect.Effect<ReadonlyArray<TokenBundle>, Error, never>;
/**
 * Calculate ADA subdivision if needed
 */
/**
 * Calculate ADA subdivision amounts based on percentages
 */
export declare const calculateAdaSubdivision: (leftoverAda: bigint, options: UnfrackOptions) => Effect.Effect<ReadonlyArray<bigint>, never, never>;
/**
 * Create optimized change outputs using unfracking strategies
 * Now uses CBOR-based minUTxO calculation for each bundle
 */
/**
 * Result of unfrack change output creation
 */
export type UnfrackResult = {
    /**
     * The change outputs if unfrack was affordable, undefined otherwise
     */
    changeOutputs?: ReadonlyArray<TxOut.TransactionOutput>;
    /**
     * Total minimum lovelace required for all outputs
     * This is the sum of minUTxO for all N outputs
     */
    totalMinLovelace: bigint;
};
/**
 * Creates optimal change outputs by distributing change assets across multiple UTxOs.
 *
 * ## First Principles:
 *
 * 1. **Single Responsibility**: Create valid change outputs that optimally distribute the given assets
 * 2. **Validity Guarantee**: All outputs MUST meet their minUTxO requirements (protocol constraint)
 * 3. **Asset Conservation**: All input assets must appear in outputs (no assets lost)
 * 4. **Token Separation**: Tokens are bundled by policy to avoid mixing unnecessary assets
 * 5. **ADA Efficiency**: Remaining ADA is either separated (if significant) or distributed (if small)
 *
 * ## Strategy:
 *
 * 1. **No tokens**: Return single ADA-only output
 * 2. **With tokens**:
 *    - Create token bundles with minimum required ADA (minUTxO)
 *    - Calculate remaining ADA after bundles
 *    - If remaining >= threshold AND affordable: Create separate ADA output (subdivision)
 *    - Otherwise: Distribute remaining across bundles (spread)
 *
 * ## Affordability Check:
 *
 * Before creating a separate ADA output, verify that:
 * - remaining >= subdivideThreshold (user preference)
 * - remaining >= minUTxO for ADA-only output (protocol requirement)
 *
 * If either check fails, fall back to spreading the remaining ADA across token bundles.
 * This ensures all outputs are always valid.
 *
 * @since 2.0.0
 * @category builders
 */
export declare const createUnfrackedChangeOutputs: (changeAddress: CoreAddress.Address, changeAssets: CoreAssets.Assets, options: UnfrackOptions | undefined, coinsPerUtxoByte: bigint) => Effect.Effect<ReadonlyArray<TxOut.TransactionOutput>, Error, never>;
//# sourceMappingURL=Unfrack.d.ts.map