import { createCustomErrorClass } from "@ledgerhq/errors";
export const TransactionBroadcastError = createCustomErrorClass("TransactionBroadcastError");
export const createTransactionBroadcastError = (error, urls, data) => {
    return new TransactionBroadcastError(error.message, {
        url: url(error.message, urls.txBroadcastErrors) ?? urls.faq,
        ...data,
    });
};
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