"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BitcoinError = void 0;
const BitcoinErrorCode_1 = require("./BitcoinErrorCode");
function getMessage(code) {
    switch (code) {
        case BitcoinErrorCode_1.BitcoinErrorCode.Base58ChecksumFailed:
            return 'Base58Check checksum failed';
        case BitcoinErrorCode_1.BitcoinErrorCode.PubKeyInvalid:
            return 'Invalid pubkey';
        case BitcoinErrorCode_1.BitcoinErrorCode.PubKeyHashInvalid:
            return 'Invalid pubkeyhash';
        case BitcoinErrorCode_1.BitcoinErrorCode.SigEncodingInvalid:
            return 'Signatures requires BIP66 DER encoding';
        case BitcoinErrorCode_1.BitcoinErrorCode.SigHashTypeInvalid:
            return 'Invalid Signature SIGHASH type';
        case BitcoinErrorCode_1.BitcoinErrorCode.MultiSigSetupInvalid:
            return 'MultiSig structure is invalid';
        case BitcoinErrorCode_1.BitcoinErrorCode.Hash160Invalid:
            return 'Hash160 requires 20-byte Buffer';
        case BitcoinErrorCode_1.BitcoinErrorCode.Hash256Invalid:
            return 'return Hash256 requires 32-byte Buffer';
        default:
            return 'Unknown';
    }
}
class BitcoinError extends Error {
    // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
    constructor(code, data) {
        super(getMessage(code));
        this.code = code;
        this.data = data;
    }
}
exports.BitcoinError = BitcoinError;
//# sourceMappingURL=BitcoinError.js.map