@layr-labs/ecloud-sdk 0.4.0-dev.3 → 0.4.0-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.cjs CHANGED
@@ -715,7 +715,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
715
715
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
716
716
  var CanUpdateAppProfilePermission = "0x036fef61";
717
717
  function getDefaultClientId() {
718
- const version = true ? "0.4.0-dev.3" : "0.0.0";
718
+ const version = true ? "0.4.0-dev.4" : "0.0.0";
719
719
  return `ecloud-sdk/v${version}`;
720
720
  }
721
721
  var UserApiClient = class {
@@ -2692,6 +2692,28 @@ async function checkERC7702Delegation(publicClient, account, delegatorAddress) {
2692
2692
  const expectedCode = `0xef0100${delegatorAddress.slice(2)}`;
2693
2693
  return code.toLowerCase() === expectedCode.toLowerCase();
2694
2694
  }
2695
+ var TRANSIENT_PATTERNS = [
2696
+ "indexing is in progress",
2697
+ "is not in the chain"
2698
+ ];
2699
+ function isTransientReceiptError(error) {
2700
+ const msg = error instanceof Error ? error.message : String(error);
2701
+ return TRANSIENT_PATTERNS.some((p) => msg.includes(p));
2702
+ }
2703
+ async function waitForReceipt(publicClient, hash, logger, { maxRetries = 5, baseDelayMs = 2e3 } = {}) {
2704
+ for (let attempt = 0; ; attempt++) {
2705
+ try {
2706
+ return await publicClient.waitForTransactionReceipt({ hash });
2707
+ } catch (error) {
2708
+ if (!isTransientReceiptError(error) || attempt >= maxRetries) throw error;
2709
+ const delay = baseDelayMs * 2 ** attempt;
2710
+ logger.debug(
2711
+ `Receipt not available yet (attempt ${attempt + 1}/${maxRetries}), retrying in ${delay}ms...`
2712
+ );
2713
+ await new Promise((r) => setTimeout(r, delay));
2714
+ }
2715
+ }
2716
+ }
2695
2717
  async function executeBatch(options, logger = noopLogger) {
2696
2718
  const {
2697
2719
  walletClient,
@@ -2759,7 +2781,7 @@ async function executeBatch(options, logger = noopLogger) {
2759
2781
  }
2760
2782
  const hash = await walletClient.sendTransaction(txRequest);
2761
2783
  logger.info(`Transaction sent: ${hash}`);
2762
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
2784
+ const receipt = await waitForReceipt(publicClient, hash, logger);
2763
2785
  if (receipt.status === "reverted") {
2764
2786
  let revertReason = "Unknown reason";
2765
2787
  try {