"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTransactionBroadcastError = exports.TransactionBroadcastError = void 0;
const errors_1 = require("@ledgerhq/errors");
exports.TransactionBroadcastError = (0, errors_1.createCustomErrorClass)("TransactionBroadcastError");
const createTransactionBroadcastError = (error, urls, data) => {
    return new exports.TransactionBroadcastError(error.message, {
        url: url(error.message, urls.txBroadcastErrors) ?? urls.faq,
        ...data,
    });
};
exports.createTransactionBroadcastError = createTransactionBroadcastError;
function url(message, urls) {
    if (message.includes("-25: bad-tnxs-inputs-missingorspent") ||
        message.includes("-25: Missing inputs")) {
        return urls.badTxns;
    }
    if (message.includes("blobs limit in txpool is full")) {
        return urls.blobsLimit;
    }
    if (message.includes("txn-mempool-conflict")) {
        return urls.txnMempoolConflict;
    }
}
//# sourceMappingURL=transactionBroadcastErrors.js.map