// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * All of the wallet event types.
 */
var WalletEventType;
(function (WalletEventType) {
    /** Nano Ledger has generated an address. */
    WalletEventType[WalletEventType["LedgerAddressGeneration"] = 0] = "LedgerAddressGeneration";
    /** A new output was created. */
    WalletEventType[WalletEventType["NewOutput"] = 1] = "NewOutput";
    /** An output was spent. */
    WalletEventType[WalletEventType["SpentOutput"] = 2] = "SpentOutput";
    /** A transaction was included into the ledger. */
    WalletEventType[WalletEventType["TransactionInclusion"] = 3] = "TransactionInclusion";
    /** A progress update while submitting a transaction. */
    WalletEventType[WalletEventType["TransactionProgress"] = 4] = "TransactionProgress";
})(WalletEventType || (WalletEventType = {}));
/**
 * The base class for wallet events.
 */
var WalletEvent = /** @class */ (function () {
    /**
     * @param type The type of wallet event.
     */
    function WalletEvent(type) {
        this.type = type;
    }
    return WalletEvent;
}());
/**
 * A 'ledger address generation' wallet event.
 */
var LedgerAddressGenerationWalletEvent = /** @class */ (function (_super) {
    __extends(LedgerAddressGenerationWalletEvent, _super);
    /**
     * @param address The generated address.
     */
    function LedgerAddressGenerationWalletEvent(address) {
        var _this = _super.call(this, WalletEventType.LedgerAddressGeneration) || this;
        _this.address = address;
        return _this;
    }
    return LedgerAddressGenerationWalletEvent;
}(WalletEvent));
/**
 * A 'new output' wallet event.
 */
var NewOutputWalletEvent = /** @class */ (function (_super) {
    __extends(NewOutputWalletEvent, _super);
    /**
     * @param output The new output.
     * @param transaction The transaction that created the output. Might be pruned and not available.
     * @param transactionInputs The inputs for the transaction that created the output. Might be pruned and not available.
     */
    function NewOutputWalletEvent(output, transaction, transactionInputs) {
        var _this = _super.call(this, WalletEventType.NewOutput) || this;
        _this.output = output;
        _this.transaction = transaction;
        _this.transactionInputs = transactionInputs;
        return _this;
    }
    return NewOutputWalletEvent;
}(WalletEvent));
/**
 * A 'spent output' wallet event.
 */
var SpentOutputWalletEvent = /** @class */ (function (_super) {
    __extends(SpentOutputWalletEvent, _super);
    /**
     * @param output The spent output.
     */
    function SpentOutputWalletEvent(output) {
        var _this = _super.call(this, WalletEventType.SpentOutput) || this;
        _this.output = output;
        return _this;
    }
    return SpentOutputWalletEvent;
}(WalletEvent));
/**
 * A 'transaction inclusion' wallet event.
 */
var TransactionInclusionWalletEvent = /** @class */ (function (_super) {
    __extends(TransactionInclusionWalletEvent, _super);
    /**
     * @param transactionId The transaction ID.
     * @param inclusionState The inclusion state of the transaction.
     */
    function TransactionInclusionWalletEvent(transactionId, inclusionState) {
        var _this = _super.call(this, WalletEventType.TransactionInclusion) || this;
        _this.transactionId = transactionId;
        _this.inclusionState = inclusionState;
        return _this;
    }
    return TransactionInclusionWalletEvent;
}(WalletEvent));
/**
 * All of the transaction progress types.
 */
var TransactionProgressType;
(function (TransactionProgressType) {
    /** Building a transaction. */
    TransactionProgressType[TransactionProgressType["BuildingTransaction"] = 0] = "BuildingTransaction";
    /** Generating remainder value deposit address. */
    TransactionProgressType[TransactionProgressType["GeneratingRemainderDepositAddress"] = 1] = "GeneratingRemainderDepositAddress";
    /** Prepared transaction. */
    TransactionProgressType[TransactionProgressType["PreparedTransaction"] = 2] = "PreparedTransaction";
    /** Signing the transaction. */
    TransactionProgressType[TransactionProgressType["SigningTransaction"] = 3] = "SigningTransaction";
    /** Prepared transaction signing hash hex encoded, required for blindsigning with a Ledger Nano. */
    TransactionProgressType[TransactionProgressType["PreparedTransactionSigningHash"] = 4] = "PreparedTransactionSigningHash";
    /** Prepared block signing input, required for blindsigning with a Ledger Nano. */
    TransactionProgressType[TransactionProgressType["PreparedBlockSigningInput"] = 5] = "PreparedBlockSigningInput";
    /** Broadcasting. */
    TransactionProgressType[TransactionProgressType["Broadcasting"] = 6] = "Broadcasting";
})(TransactionProgressType || (TransactionProgressType = {}));
/**
 * A 'transaction progress' wallet event.
 */
var TransactionProgressWalletEvent = /** @class */ (function (_super) {
    __extends(TransactionProgressWalletEvent, _super);
    /**
     * @param progress The progress of the transaction.
     */
    function TransactionProgressWalletEvent(progress) {
        var _this = _super.call(this, WalletEventType.TransactionProgress) || this;
        _this.progress = progress;
        return _this;
    }
    return TransactionProgressWalletEvent;
}(WalletEvent));
/**
 * The base class for transaction progresses.
 */
var TransactionProgress = /** @class */ (function () {
    /**
     * @param type The type of transaction progress.
     */
    function TransactionProgress(type) {
        this.type = type;
    }
    return TransactionProgress;
}());
/**
 * A 'building transaction' progress.
 */
var BuildingTransactionProgress = /** @class */ (function (_super) {
    __extends(BuildingTransactionProgress, _super);
    function BuildingTransactionProgress() {
        return _super.call(this, TransactionProgressType.BuildingTransaction) || this;
    }
    return BuildingTransactionProgress;
}(TransactionProgress));
/**
 * A 'generating remainder deposit address' progress.
 */
var GeneratingRemainderDepositAddressProgress = /** @class */ (function (_super) {
    __extends(GeneratingRemainderDepositAddressProgress, _super);
    /**
     * @param address The generated remainder deposit address.
     */
    function GeneratingRemainderDepositAddressProgress(address) {
        var _this = _super.call(this, TransactionProgressType.GeneratingRemainderDepositAddress) || this;
        _this.address = address;
        return _this;
    }
    return GeneratingRemainderDepositAddressProgress;
}(TransactionProgress));
/**
 * A 'prepared transaction' progress.
 */
var PreparedTransactionProgress = /** @class */ (function (_super) {
    __extends(PreparedTransactionProgress, _super);
    /**
     * @param transaction The prepared transaction.
     * @param inputsData Input signing parameters.
     * @param remainders Remainder outputs parameters.
     */
    function PreparedTransactionProgress(transaction, inputsData, remainders) {
        var _this = _super.call(this, TransactionProgressType.PreparedTransaction) || this;
        _this.transaction = transaction;
        _this.inputsData = inputsData;
        _this.remainders = remainders;
        return _this;
    }
    return PreparedTransactionProgress;
}(TransactionProgress));
/**
 * A 'signing transaction' progress.
 */
var SigningTransactionProgress = /** @class */ (function (_super) {
    __extends(SigningTransactionProgress, _super);
    function SigningTransactionProgress() {
        return _super.call(this, TransactionProgressType.SigningTransaction) || this;
    }
    return SigningTransactionProgress;
}(TransactionProgress));
/**
 * A 'prepared transaction hash' progress.
 */
var PreparedTransactionSigningHashProgress = /** @class */ (function (_super) {
    __extends(PreparedTransactionSigningHashProgress, _super);
    /**
     * @param signingHash The signing hash of the transaction.
     */
    function PreparedTransactionSigningHashProgress(signingHash) {
        var _this = _super.call(this, TransactionProgressType.PreparedTransactionSigningHash) || this;
        _this.signingHash = signingHash;
        return _this;
    }
    return PreparedTransactionSigningHashProgress;
}(TransactionProgress));
/**
 * A 'prepared block input' progress.
 */
var PreparedBlockSigningInputProgress = /** @class */ (function (_super) {
    __extends(PreparedBlockSigningInputProgress, _super);
    /**
     * @param signingHash The signing hash of the block.
     */
    function PreparedBlockSigningInputProgress(signingInput) {
        var _this = _super.call(this, TransactionProgressType.PreparedBlockSigningInput) || this;
        _this.blockSigningInput = signingInput;
        return _this;
    }
    return PreparedBlockSigningInputProgress;
}(TransactionProgress));
/**
 * A 'broadcasting' progress.
 */
var BroadcastingProgress = /** @class */ (function (_super) {
    __extends(BroadcastingProgress, _super);
    function BroadcastingProgress() {
        return _super.call(this, TransactionProgressType.Broadcasting) || this;
    }
    return BroadcastingProgress;
}(TransactionProgress));
export { WalletEventType, WalletEvent, LedgerAddressGenerationWalletEvent, NewOutputWalletEvent, SpentOutputWalletEvent, TransactionInclusionWalletEvent, TransactionProgressWalletEvent, TransactionProgress, BuildingTransactionProgress, GeneratingRemainderDepositAddressProgress, PreparedTransactionProgress, SigningTransactionProgress, PreparedTransactionSigningHashProgress, PreparedBlockSigningInputProgress, BroadcastingProgress, TransactionProgressType, };
//# sourceMappingURL=event.js.map