import { IAssetAccount, IAssetAccountDto } from '../interfaces/assetAccount'; import { Checksum } from '../types/checksum'; declare const BIGINT_FIELDS: readonly ["balance", "earned", "spent", "reserved"]; type BigIntField = (typeof BIGINT_FIELDS)[number]; /** * Hydrate a raw DTO record into a canonical {@link IAssetAccountDto}. * * Handles two legacy markers introduced before the * `asset-account-store-generalization` refactor: * * - **missing `assetId`** → defaults to `'joule'`. * - **`number` balance fields** → multiplied by * {@link JOULE_MICROUNITS_PER_UNIT} (rounded) and stored as decimal- * string `bigint` microunits. * * Already-upgraded DTOs round-trip unchanged. The function never throws — * unrecognized field shapes coerce to `'0'` so the caller gets a fully * populated DTO it can persist on next write. * * @see asset-account-store-generalization spec, Requirements 1.4, 2.5, 2.6. */ export declare function hydrateAssetAccountDto(raw: Record): IAssetAccountDto; /** * Generalized per-(member, asset) account. * * `bigint` microunit balances eliminate floating-point drift from * charge / credit paths. The legacy {@link EnergyAccount} class is * preserved untouched during this additive phase; a future phase will * fold it onto this base via re-export alias. * * @see asset-account-store-generalization spec, Phase 3. */ export declare class AssetAccount implements IAssetAccount { readonly memberId: Checksum; readonly assetId: string; readonly createdAt: Date; balance: bigint; earned: bigint; spent: bigint; reserved: bigint; reputation: number; lastUpdated: Date; constructor(memberId: Checksum, assetId?: string, createdAt?: Date, balance?: bigint, earned?: bigint, spent?: bigint, reserved?: bigint, reputation?: number, lastUpdated?: Date); /** Available = balance - reserved, floored at 0. */ get availableBalance(): bigint; /** Net = earned - spent. May be negative. */ get netAsset(): bigint; canAfford(amount: bigint): boolean; reserve(amount: bigint): void; release(amount: bigint): void; charge(amount: bigint): void; credit(amount: bigint): void; updateReputation(newReputation: number): void; toDto(): IAssetAccountDto; /** * Build an {@link AssetAccount} from a DTO. Accepts both fully-upgraded * {@link IAssetAccountDto} and legacy `IEnergyAccountDto`-shaped records: * the input is run through {@link hydrateAssetAccountDto} first. */ static fromDto(dto: Record): AssetAccount; toJson(): string; static fromJson(json: string): AssetAccount; } export declare const ASSET_ACCOUNT_BIGINT_FIELDS: readonly BigIntField[]; export {}; //# sourceMappingURL=assetAccount.d.ts.map