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

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/compute.cjs CHANGED
@@ -2400,6 +2400,28 @@ async function createAuthorizationList(options) {
2400
2400
  });
2401
2401
  return [signedAuthorization];
2402
2402
  }
2403
+ var TRANSIENT_PATTERNS = [
2404
+ "indexing is in progress",
2405
+ "is not in the chain"
2406
+ ];
2407
+ function isTransientReceiptError(error) {
2408
+ const msg = error instanceof Error ? error.message : String(error);
2409
+ return TRANSIENT_PATTERNS.some((p) => msg.includes(p));
2410
+ }
2411
+ async function waitForReceipt(publicClient, hash, logger, { maxRetries = 5, baseDelayMs = 2e3 } = {}) {
2412
+ for (let attempt = 0; ; attempt++) {
2413
+ try {
2414
+ return await publicClient.waitForTransactionReceipt({ hash });
2415
+ } catch (error) {
2416
+ if (!isTransientReceiptError(error) || attempt >= maxRetries) throw error;
2417
+ const delay = baseDelayMs * 2 ** attempt;
2418
+ logger.debug(
2419
+ `Receipt not available yet (attempt ${attempt + 1}/${maxRetries}), retrying in ${delay}ms...`
2420
+ );
2421
+ await new Promise((r) => setTimeout(r, delay));
2422
+ }
2423
+ }
2424
+ }
2403
2425
  async function executeBatch(options, logger = noopLogger) {
2404
2426
  const {
2405
2427
  walletClient,
@@ -2467,7 +2489,7 @@ async function executeBatch(options, logger = noopLogger) {
2467
2489
  }
2468
2490
  const hash = await walletClient.sendTransaction(txRequest);
2469
2491
  logger.info(`Transaction sent: ${hash}`);
2470
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
2492
+ const receipt = await waitForReceipt(publicClient, hash, logger);
2471
2493
  if (receipt.status === "reverted") {
2472
2494
  let revertReason = "Unknown reason";
2473
2495
  try {
@@ -4703,7 +4725,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4703
4725
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4704
4726
  var CanUpdateAppProfilePermission = "0x036fef61";
4705
4727
  function getDefaultClientId() {
4706
- const version = true ? "0.4.0-dev.3" : "0.0.0";
4728
+ const version = true ? "0.4.0-dev.5" : "0.0.0";
4707
4729
  return `ecloud-sdk/v${version}`;
4708
4730
  }
4709
4731
  var UserApiClient = class {
@@ -5072,6 +5094,8 @@ async function watchUntilRunning(options, logger) {
5072
5094
  }
5073
5095
  return false;
5074
5096
  };
5097
+ const startTime = Date.now();
5098
+ let lastLoggedStatus;
5075
5099
  while (true) {
5076
5100
  try {
5077
5101
  const info = await userApiClient.getInfos([appId], 1);
@@ -5082,6 +5106,11 @@ async function watchUntilRunning(options, logger) {
5082
5106
  const appInfo = info[0];
5083
5107
  const currentStatus = appInfo.status;
5084
5108
  const currentIP = appInfo.ip || "";
5109
+ const elapsed = Math.round((Date.now() - startTime) / 1e3);
5110
+ if (currentStatus !== lastLoggedStatus) {
5111
+ logger.info(`Status: ${currentStatus} (${elapsed}s)`);
5112
+ lastLoggedStatus = currentStatus;
5113
+ }
5085
5114
  if (stopCondition(currentStatus, currentIP)) {
5086
5115
  return currentIP || void 0;
5087
5116
  }