@erc7824/nitrolite
Version:
The Nitrolite SDK empowers developers to build high-performance, scalable web3 applications using state channels. It's designed to provide near-instant transactions and significantly improved user experiences by minimizing direct blockchain interactions.
20 lines (19 loc) • 698 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.waitForTransaction = waitForTransaction;
const errors_1 = require("../../errors");
async function waitForTransaction(publicClient, hash) {
const operationName = 'waitForTransaction';
try {
const receipt = await publicClient.waitForTransactionReceipt({ hash });
if (receipt.status === 'reverted') {
throw new Error(`Transaction reverted`);
}
return receipt;
}
catch (error) {
if (error instanceof errors_1.Errors.NitroliteError)
throw error;
throw new errors_1.Errors.TransactionError(operationName, error, { hash });
}
}