@layr-labs/ecloud-sdk 0.4.0-dev.2 → 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.js CHANGED
@@ -604,7 +604,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
604
604
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
605
605
  var CanUpdateAppProfilePermission = "0x036fef61";
606
606
  function getDefaultClientId() {
607
- const version = true ? "0.4.0-dev.2" : "0.0.0";
607
+ const version = true ? "0.4.0-dev.4" : "0.0.0";
608
608
  return `ecloud-sdk/v${version}`;
609
609
  }
610
610
  var UserApiClient = class {
@@ -2581,6 +2581,28 @@ async function checkERC7702Delegation(publicClient, account, delegatorAddress) {
2581
2581
  const expectedCode = `0xef0100${delegatorAddress.slice(2)}`;
2582
2582
  return code.toLowerCase() === expectedCode.toLowerCase();
2583
2583
  }
2584
+ var TRANSIENT_PATTERNS = [
2585
+ "indexing is in progress",
2586
+ "is not in the chain"
2587
+ ];
2588
+ function isTransientReceiptError(error) {
2589
+ const msg = error instanceof Error ? error.message : String(error);
2590
+ return TRANSIENT_PATTERNS.some((p) => msg.includes(p));
2591
+ }
2592
+ async function waitForReceipt(publicClient, hash, logger, { maxRetries = 5, baseDelayMs = 2e3 } = {}) {
2593
+ for (let attempt = 0; ; attempt++) {
2594
+ try {
2595
+ return await publicClient.waitForTransactionReceipt({ hash });
2596
+ } catch (error) {
2597
+ if (!isTransientReceiptError(error) || attempt >= maxRetries) throw error;
2598
+ const delay = baseDelayMs * 2 ** attempt;
2599
+ logger.debug(
2600
+ `Receipt not available yet (attempt ${attempt + 1}/${maxRetries}), retrying in ${delay}ms...`
2601
+ );
2602
+ await new Promise((r) => setTimeout(r, delay));
2603
+ }
2604
+ }
2605
+ }
2584
2606
  async function executeBatch(options, logger = noopLogger) {
2585
2607
  const {
2586
2608
  walletClient,
@@ -2648,7 +2670,7 @@ async function executeBatch(options, logger = noopLogger) {
2648
2670
  }
2649
2671
  const hash = await walletClient.sendTransaction(txRequest);
2650
2672
  logger.info(`Transaction sent: ${hash}`);
2651
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
2673
+ const receipt = await waitForReceipt(publicClient, hash, logger);
2652
2674
  if (receipt.status === "reverted") {
2653
2675
  let revertReason = "Unknown reason";
2654
2676
  try {