"use strict";
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransactionProgressType = exports.BroadcastingProgress = exports.PreparedBlockSigningInputProgress = exports.PreparedTransactionSigningHashProgress = exports.SigningTransactionProgress = exports.PreparedTransactionProgress = exports.GeneratingRemainderDepositAddressProgress = exports.BuildingTransactionProgress = exports.TransactionProgress = exports.TransactionProgressWalletEvent = exports.TransactionInclusionWalletEvent = exports.SpentOutputWalletEvent = exports.NewOutputWalletEvent = exports.LedgerAddressGenerationWalletEvent = exports.WalletEvent = exports.WalletEventType = void 0;
/**
 * 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 = {}));
exports.WalletEventType = WalletEventType;
/**
 * The base class for wallet events.
 */
class WalletEvent {
    /**
     * @param type The type of wallet event.
     */
    constructor(type) {
        this.type = type;
    }
}
exports.WalletEvent = WalletEvent;
/**
 * A 'ledger address generation' wallet event.
 */
class LedgerAddressGenerationWalletEvent extends WalletEvent {
    /**
     * @param address The generated address.
     */
    constructor(address) {
        super(WalletEventType.LedgerAddressGeneration);
        this.address = address;
    }
}
exports.LedgerAddressGenerationWalletEvent = LedgerAddressGenerationWalletEvent;
/**
 * A 'new output' wallet event.
 */
class NewOutputWalletEvent extends WalletEvent {
    /**
     * @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.
     */
    constructor(output, transaction, transactionInputs) {
        super(WalletEventType.NewOutput);
        this.output = output;
        this.transaction = transaction;
        this.transactionInputs = transactionInputs;
    }
}
exports.NewOutputWalletEvent = NewOutputWalletEvent;
/**
 * A 'spent output' wallet event.
 */
class SpentOutputWalletEvent extends WalletEvent {
    /**
     * @param output The spent output.
     */
    constructor(output) {
        super(WalletEventType.SpentOutput);
        this.output = output;
    }
}
exports.SpentOutputWalletEvent = SpentOutputWalletEvent;
/**
 * A 'transaction inclusion' wallet event.
 */
class TransactionInclusionWalletEvent extends WalletEvent {
    /**
     * @param transactionId The transaction ID.
     * @param inclusionState The inclusion state of the transaction.
     */
    constructor(transactionId, inclusionState) {
        super(WalletEventType.TransactionInclusion);
        this.transactionId = transactionId;
        this.inclusionState = inclusionState;
    }
}
exports.TransactionInclusionWalletEvent = TransactionInclusionWalletEvent;
/**
 * 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 = {}));
exports.TransactionProgressType = TransactionProgressType;
/**
 * A 'transaction progress' wallet event.
 */
class TransactionProgressWalletEvent extends WalletEvent {
    /**
     * @param progress The progress of the transaction.
     */
    constructor(progress) {
        super(WalletEventType.TransactionProgress);
        this.progress = progress;
    }
}
exports.TransactionProgressWalletEvent = TransactionProgressWalletEvent;
/**
 * The base class for transaction progresses.
 */
class TransactionProgress {
    /**
     * @param type The type of transaction progress.
     */
    constructor(type) {
        this.type = type;
    }
}
exports.TransactionProgress = TransactionProgress;
/**
 * A 'building transaction' progress.
 */
class BuildingTransactionProgress extends TransactionProgress {
    constructor() {
        super(TransactionProgressType.BuildingTransaction);
    }
}
exports.BuildingTransactionProgress = BuildingTransactionProgress;
/**
 * A 'generating remainder deposit address' progress.
 */
class GeneratingRemainderDepositAddressProgress extends TransactionProgress {
    /**
     * @param address The generated remainder deposit address.
     */
    constructor(address) {
        super(TransactionProgressType.GeneratingRemainderDepositAddress);
        this.address = address;
    }
}
exports.GeneratingRemainderDepositAddressProgress = GeneratingRemainderDepositAddressProgress;
/**
 * A 'prepared transaction' progress.
 */
class PreparedTransactionProgress extends TransactionProgress {
    /**
     * @param transaction The prepared transaction.
     * @param inputsData Input signing parameters.
     * @param remainders Remainder outputs parameters.
     */
    constructor(transaction, inputsData, remainders) {
        super(TransactionProgressType.PreparedTransaction);
        this.transaction = transaction;
        this.inputsData = inputsData;
        this.remainders = remainders;
    }
}
exports.PreparedTransactionProgress = PreparedTransactionProgress;
/**
 * A 'signing transaction' progress.
 */
class SigningTransactionProgress extends TransactionProgress {
    constructor() {
        super(TransactionProgressType.SigningTransaction);
    }
}
exports.SigningTransactionProgress = SigningTransactionProgress;
/**
 * A 'prepared transaction hash' progress.
 */
class PreparedTransactionSigningHashProgress extends TransactionProgress {
    /**
     * @param signingHash The signing hash of the transaction.
     */
    constructor(signingHash) {
        super(TransactionProgressType.PreparedTransactionSigningHash);
        this.signingHash = signingHash;
    }
}
exports.PreparedTransactionSigningHashProgress = PreparedTransactionSigningHashProgress;
/**
 * A 'prepared block input' progress.
 */
class PreparedBlockSigningInputProgress extends TransactionProgress {
    /**
     * @param signingHash The signing hash of the block.
     */
    constructor(signingInput) {
        super(TransactionProgressType.PreparedBlockSigningInput);
        this.blockSigningInput = signingInput;
    }
}
exports.PreparedBlockSigningInputProgress = PreparedBlockSigningInputProgress;
/**
 * A 'broadcasting' progress.
 */
class BroadcastingProgress extends TransactionProgress {
    constructor() {
        super(TransactionProgressType.Broadcasting);
    }
}
exports.BroadcastingProgress = BroadcastingProgress;
//# sourceMappingURL=event.js.map