@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/compute.js CHANGED
@@ -2364,6 +2364,28 @@ async function createAuthorizationList(options) {
2364
2364
  });
2365
2365
  return [signedAuthorization];
2366
2366
  }
2367
+ var TRANSIENT_PATTERNS = [
2368
+ "indexing is in progress",
2369
+ "is not in the chain"
2370
+ ];
2371
+ function isTransientReceiptError(error) {
2372
+ const msg = error instanceof Error ? error.message : String(error);
2373
+ return TRANSIENT_PATTERNS.some((p) => msg.includes(p));
2374
+ }
2375
+ async function waitForReceipt(publicClient, hash, logger, { maxRetries = 5, baseDelayMs = 2e3 } = {}) {
2376
+ for (let attempt = 0; ; attempt++) {
2377
+ try {
2378
+ return await publicClient.waitForTransactionReceipt({ hash });
2379
+ } catch (error) {
2380
+ if (!isTransientReceiptError(error) || attempt >= maxRetries) throw error;
2381
+ const delay = baseDelayMs * 2 ** attempt;
2382
+ logger.debug(
2383
+ `Receipt not available yet (attempt ${attempt + 1}/${maxRetries}), retrying in ${delay}ms...`
2384
+ );
2385
+ await new Promise((r) => setTimeout(r, delay));
2386
+ }
2387
+ }
2388
+ }
2367
2389
  async function executeBatch(options, logger = noopLogger) {
2368
2390
  const {
2369
2391
  walletClient,
@@ -2431,7 +2453,7 @@ async function executeBatch(options, logger = noopLogger) {
2431
2453
  }
2432
2454
  const hash = await walletClient.sendTransaction(txRequest);
2433
2455
  logger.info(`Transaction sent: ${hash}`);
2434
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
2456
+ const receipt = await waitForReceipt(publicClient, hash, logger);
2435
2457
  if (receipt.status === "reverted") {
2436
2458
  let revertReason = "Unknown reason";
2437
2459
  try {
@@ -4667,7 +4689,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4667
4689
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4668
4690
  var CanUpdateAppProfilePermission = "0x036fef61";
4669
4691
  function getDefaultClientId() {
4670
- const version = true ? "0.4.0-dev.2" : "0.0.0";
4692
+ const version = true ? "0.4.0-dev.4" : "0.0.0";
4671
4693
  return `ecloud-sdk/v${version}`;
4672
4694
  }
4673
4695
  var UserApiClient = class {