@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/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.4" : "0.0.0";
4707
4729
  return `ecloud-sdk/v${version}`;
4708
4730
  }
4709
4731
  var UserApiClient = class {