@citizenwallet/sdk
Version:
An sdk to easily work with citizen wallet.
21 lines • 779 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.waitForTxSuccess = void 0;
const ethers_1 = require("ethers");
const waitForTxSuccess = async (config, txHash, timeout = 12000, options) => {
const { accountFactoryAddress } = options ?? {};
try {
const rpc = new ethers_1.JsonRpcProvider(config.getRPCUrl(accountFactoryAddress));
const receipt = await rpc.waitForTransaction(txHash, 1, timeout);
if (!receipt) {
throw new Error("Transaction not found");
}
return receipt.status === 1;
}
catch (error) {
console.error("Error waiting for transaction:", error);
return false;
}
};
exports.waitForTxSuccess = waitForTxSuccess;
//# sourceMappingURL=index.js.map