"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.compareByBalanceThenFiat = exports.hasBalance = void 0;
function hasBalance(balanceData) {
    return !!balanceData && balanceData.balance !== undefined && balanceData.balance.gt(0);
}
exports.hasBalance = hasBalance;
function compareByBalanceThenFiat(a, b) {
    const ah = hasBalance(a);
    const bh = hasBalance(b);
    if (ah && !bh)
        return -1;
    if (!ah && bh)
        return 1;
    const aFiat = a?.fiatValue ?? 0;
    const bFiat = b?.fiatValue ?? 0;
    return bFiat - aFiat;
}
exports.compareByBalanceThenFiat = compareByBalanceThenFiat;
//# sourceMappingURL=sortByBalance.js.map