@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/index.cjs CHANGED
@@ -2517,6 +2517,28 @@ async function createAuthorizationList(options) {
2517
2517
  });
2518
2518
  return [signedAuthorization];
2519
2519
  }
2520
+ var TRANSIENT_PATTERNS = [
2521
+ "indexing is in progress",
2522
+ "is not in the chain"
2523
+ ];
2524
+ function isTransientReceiptError(error) {
2525
+ const msg = error instanceof Error ? error.message : String(error);
2526
+ return TRANSIENT_PATTERNS.some((p) => msg.includes(p));
2527
+ }
2528
+ async function waitForReceipt(publicClient, hash, logger, { maxRetries = 5, baseDelayMs = 2e3 } = {}) {
2529
+ for (let attempt = 0; ; attempt++) {
2530
+ try {
2531
+ return await publicClient.waitForTransactionReceipt({ hash });
2532
+ } catch (error) {
2533
+ if (!isTransientReceiptError(error) || attempt >= maxRetries) throw error;
2534
+ const delay = baseDelayMs * 2 ** attempt;
2535
+ logger.debug(
2536
+ `Receipt not available yet (attempt ${attempt + 1}/${maxRetries}), retrying in ${delay}ms...`
2537
+ );
2538
+ await new Promise((r) => setTimeout(r, delay));
2539
+ }
2540
+ }
2541
+ }
2520
2542
  async function executeBatch(options, logger = noopLogger) {
2521
2543
  const {
2522
2544
  walletClient,
@@ -2584,7 +2606,7 @@ async function executeBatch(options, logger = noopLogger) {
2584
2606
  }
2585
2607
  const hash = await walletClient.sendTransaction(txRequest);
2586
2608
  logger.info(`Transaction sent: ${hash}`);
2587
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
2609
+ const receipt = await waitForReceipt(publicClient, hash, logger);
2588
2610
  if (receipt.status === "reverted") {
2589
2611
  let revertReason = "Unknown reason";
2590
2612
  try {
@@ -4960,7 +4982,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4960
4982
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4961
4983
  var CanUpdateAppProfilePermission = "0x036fef61";
4962
4984
  function getDefaultClientId() {
4963
- const version = true ? "0.4.0-dev.3" : "0.0.0";
4985
+ const version = true ? "0.4.0-dev.4" : "0.0.0";
4964
4986
  return `ecloud-sdk/v${version}`;
4965
4987
  }
4966
4988
  var UserApiClient = class {