"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.XrpFullBlock = void 0;
const XrpBlock_1 = require("../blocks/XrpBlock");
const XrpTransaction_1 = require("../transactions/XrpTransaction");
class XrpFullBlock extends XrpBlock_1.XrpBlock {
    get transactions() {
        if (!this.data.result.ledger.transactions)
            return [];
        const transactions = [];
        for (const txData of this.data.result.ledger.transactions) {
            if (typeof txData === "string") {
                // Maybe raise invalid node response error
                return [];
            }
            const { metaData: _ } = txData, txDataRest = __rest(txData, ["metaData"]);
            const modifiedTxData = {
                result: Object.assign(Object.assign({}, txDataRest), { 
                    // TODO: this is due to xrpl.js lib mistakes
                    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
                    // @ts-ignore
                    hash: txData.hash, ledger_index: this.number, meta: txData.metaData, validated: this.isValid, date: this.data.result.ledger.close_time }),
                // TODO: this is due to xrpl.js lib mistakes
                id: "",
                type: "",
            };
            transactions.push(new XrpTransaction_1.XrpTransaction(modifiedTxData));
        }
        return transactions;
    }
}
exports.XrpFullBlock = XrpFullBlock;
//# sourceMappingURL=XrpFullBlock.js.map