import { TransactionReceiptStatus as e } from "../../../types/transactions.types.mjs";
import "../../../types/index.mjs";
import { waitLittle as t } from "../../utils/time.utils.mjs";
//#region libs/shared/common/src/functions/web3/functionCalls/recoverTransactionFromError.ts
var n = 1 * 1e3, r = 30 * 1e3, i = async (i, a, o = 0) => {
	if ((await i.getTransactionReceipt(a))?.status !== e.Succeeded) return;
	o > 0 && await i.waitForTransaction(a, o);
	let s = r / n, c = null;
	for (let e = 0; e < s; e += 1) {
		try {
			if (c = await i.getTransaction(a), c) break;
		} catch {}
		e < s - 1 && await t(n);
	}
	return c ?? void 0;
};
//#endregion
export { i as recoverTransactionFromError };
