@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.js CHANGED
@@ -2368,6 +2368,28 @@ async function createAuthorizationList(options) {
2368
2368
  });
2369
2369
  return [signedAuthorization];
2370
2370
  }
2371
+ var TRANSIENT_PATTERNS = [
2372
+ "indexing is in progress",
2373
+ "is not in the chain"
2374
+ ];
2375
+ function isTransientReceiptError(error) {
2376
+ const msg = error instanceof Error ? error.message : String(error);
2377
+ return TRANSIENT_PATTERNS.some((p) => msg.includes(p));
2378
+ }
2379
+ async function waitForReceipt(publicClient, hash, logger, { maxRetries = 5, baseDelayMs = 2e3 } = {}) {
2380
+ for (let attempt = 0; ; attempt++) {
2381
+ try {
2382
+ return await publicClient.waitForTransactionReceipt({ hash });
2383
+ } catch (error) {
2384
+ if (!isTransientReceiptError(error) || attempt >= maxRetries) throw error;
2385
+ const delay = baseDelayMs * 2 ** attempt;
2386
+ logger.debug(
2387
+ `Receipt not available yet (attempt ${attempt + 1}/${maxRetries}), retrying in ${delay}ms...`
2388
+ );
2389
+ await new Promise((r) => setTimeout(r, delay));
2390
+ }
2391
+ }
2392
+ }
2371
2393
  async function executeBatch(options, logger = noopLogger) {
2372
2394
  const {
2373
2395
  walletClient,
@@ -2435,7 +2457,7 @@ async function executeBatch(options, logger = noopLogger) {
2435
2457
  }
2436
2458
  const hash = await walletClient.sendTransaction(txRequest);
2437
2459
  logger.info(`Transaction sent: ${hash}`);
2438
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
2460
+ const receipt = await waitForReceipt(publicClient, hash, logger);
2439
2461
  if (receipt.status === "reverted") {
2440
2462
  let revertReason = "Unknown reason";
2441
2463
  try {
@@ -4811,7 +4833,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
4811
4833
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
4812
4834
  var CanUpdateAppProfilePermission = "0x036fef61";
4813
4835
  function getDefaultClientId() {
4814
- const version = true ? "0.4.0-dev.3" : "0.0.0";
4836
+ const version = true ? "0.4.0-dev.4" : "0.0.0";
4815
4837
  return `ecloud-sdk/v${version}`;
4816
4838
  }
4817
4839
  var UserApiClient = class {