"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.XrpBlock = void 0;
const constants_1 = require("../../utils/constants");
const BlockBase_1 = require("../BlockBase");
class XrpBlock extends BlockBase_1.BlockBase {
    get data() {
        return this.privateData;
    }
    get number() {
        return this.data.result.ledger_index;
    }
    get blockHash() {
        return this.data.result.ledger_hash;
    }
    get stdBlockHash() {
        return this.blockHash;
    }
    get previousBlockHash() {
        return this.data.result.ledger.parent_hash;
    }
    get stdPreviousBlockHash() {
        return this.previousBlockHash;
    }
    get unixTimestamp() {
        return constants_1.XRP_UTD + this.data.result.ledger.close_time;
    }
    get transactionIds() {
        if (!this.data.result.ledger.transactions)
            return [];
        if (this.data.result.ledger.transactions.length === 0)
            return [];
        if (typeof this.data.result.ledger.transactions[0] === "string")
            return this.data.result.ledger.transactions;
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        return this.data.result.ledger.transactions.map((tx) => tx.hash);
    }
    get stdTransactionIds() {
        return this.transactionIds;
    }
    get transactionCount() {
        var _a;
        return ((_a = this.data.result.ledger.transactions) === null || _a === void 0 ? void 0 : _a.length) || 0;
    }
    // problematic ???invalid in BlockBase ???
    get isValid() {
        return this.data.result.validated === true ? true : false;
    }
}
exports.XrpBlock = XrpBlock;
//# sourceMappingURL=XrpBlock.js.map