import type { TezosCoinConfig } from './config';
import type { APIAccount } from './network/types';
import type { TezosOperationMode } from './types/model';
/**
 * Dust margin in mutez to prevent transaction failures on send max operations
 * This ensures a small safety buffer remains in the account after send max
 * Based on production behavior where ~281-287 mutez typically remain
 * Increased to 500 to handle edge cases and fee estimation variations
 */
export declare const DUST_MARGIN_MUTEZ = 500;
export declare const STAKE_USE_ALL_RESERVE_MUTEZ = 10000n;
/** Stake "Use Max": staked and unstaked-frozen funds count toward `balance` but aren't (re-)stakeable until finalized, so subtract both. */
export declare function computeMaxStakeAmount(balance: bigint, stakedBalance: bigint, unstakedBalance: bigint, fees: bigint): bigint;
/**
 * Splits a Tezos native balance (which includes frozen funds) into spendable and locked
 * (staked + unstaked). `locked` is clamped to `total` so spendable stays >= 0 across TzKT reorgs.
 */
export declare function partitionNativeBalance(total: bigint, staked: bigint, unstaked: bigint): {
    spendable: bigint;
    locked: bigint;
};
/**
 * Suggested fee returned by Taquito for a minimal amount pre-estimation (mutez)
 * Used as a stable fallback for send-max when RPC estimation is unavailable.
 */
export declare const MIN_SUGGESTED_FEE_SMALL_TRANSFER = 489;
/**
 * Typical operation size (bytes) for a simple XTZ transfer used to approximate
 * the increased fee component when computing send-max in fallback mode.
 * Chosen to match Taquito’s behavior closely in integration tests.
 */
export declare const OP_SIZE_XTZ_TRANSFER = 154;
/** Minimal asset shape from `TransactionIntent` for FA2 detection */
export type TezosAssetLike = {
    type: string;
    assetReference?: string;
};
/**
 * Parse FA1.2 / FA2 token contract + token id from coin-framework `assetReference`
 * (`KT1…` or `KT1…:tokenId` as produced by getBlock / listOperations).
 */
export declare function parseTezosTokenAsset(asset: TezosAssetLike | undefined): {
    contractAddress: string;
    tokenId: number;
} | null;
/**
 * Resolves Tezos operation mode from intent type and asset (native XTZ vs token).
 */
export declare function resolveTezosOperationMode(intentType: string, asset: TezosAssetLike | undefined): TezosOperationMode;
/**
 * Creates a mock signer for Taquito operations (estimation and crafting)
 */
export declare function createMockSigner(publicKeyHash: string, publicKey: string): {
    publicKeyHash: () => Promise<string>;
    publicKey: () => Promise<string>;
    sign: () => Promise<never>;
    secretKey: () => Promise<never>;
};
/**
 * Normalize a Tezos public key to base58 format (edpk/sppk/p2pk) based on the
 * sender address prefix (tz1/tz2/tz3). Accepts either an already base58-encoded
 * key or a hex key returned by the Ledger app. Returns undefined if input is
 * empty or cannot be parsed.
 */
export declare function normalizePublicKeyForAddress(maybeKey: string | undefined, address: string): string | undefined;
/**
 * Converts a DER-encoded secp256k1/P-256 ECDSA signature (returned by the Tezos Ledger
 * app for tz2/tz3 accounts) to the raw 64-byte r||s format the Tezos protocol expects.
 * Format: 0x30 <totalLen> 0x02 <rLen> <r_bytes> 0x02 <sLen> <s_bytes>
 */
export declare function convertSecp256k1DERToRaw(derHex: string): string;
export declare function normalizeTo32Bytes(bytes: Buffer): Buffer;
/**
 * Creates default fallback estimation values
 */
export declare function createFallbackEstimation(config: TezosCoinConfig): {
    fees: bigint;
    gasLimit: bigint;
    storageLimit: bigint;
    estimatedFees: bigint;
};
/**
 * Whether an account has nothing on-chain that would spare a recipient the allocation
 * (storage) burn. Manager-key accounts (`user`/`delegate`) with a zero balance and truly
 * non-existent (`empty`) accounts count as empty. A registered baker (`delegate`) is always
 * allocated on-chain, so a zero-balance one is unusual — but keying on `hasManagerKey` keeps
 * the reveal/storage logic consistent for both wallet and baker recipients.
 */
export declare function hasEmptyBalance(account: APIAccount): boolean;
//# sourceMappingURL=utils.d.ts.map