@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/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- version=0.4.0-dev.2
2
- commit=642294ce4a815ad45fa195ccdc4dfe09450ca97b
1
+ version=0.4.0-dev.4
2
+ commit=bf8030ad9b47488c941acfea27429377b6f3ffd3
package/dist/billing.cjs CHANGED
@@ -1845,6 +1845,28 @@ async function checkERC7702Delegation(publicClient, account, delegatorAddress) {
1845
1845
  const expectedCode = `0xef0100${delegatorAddress.slice(2)}`;
1846
1846
  return code.toLowerCase() === expectedCode.toLowerCase();
1847
1847
  }
1848
+ var TRANSIENT_PATTERNS = [
1849
+ "indexing is in progress",
1850
+ "is not in the chain"
1851
+ ];
1852
+ function isTransientReceiptError(error) {
1853
+ const msg = error instanceof Error ? error.message : String(error);
1854
+ return TRANSIENT_PATTERNS.some((p) => msg.includes(p));
1855
+ }
1856
+ async function waitForReceipt(publicClient, hash, logger, { maxRetries = 5, baseDelayMs = 2e3 } = {}) {
1857
+ for (let attempt = 0; ; attempt++) {
1858
+ try {
1859
+ return await publicClient.waitForTransactionReceipt({ hash });
1860
+ } catch (error) {
1861
+ if (!isTransientReceiptError(error) || attempt >= maxRetries) throw error;
1862
+ const delay = baseDelayMs * 2 ** attempt;
1863
+ logger.debug(
1864
+ `Receipt not available yet (attempt ${attempt + 1}/${maxRetries}), retrying in ${delay}ms...`
1865
+ );
1866
+ await new Promise((r) => setTimeout(r, delay));
1867
+ }
1868
+ }
1869
+ }
1848
1870
  async function executeBatch(options, logger = noopLogger) {
1849
1871
  const {
1850
1872
  walletClient,
@@ -1912,7 +1934,7 @@ async function executeBatch(options, logger = noopLogger) {
1912
1934
  }
1913
1935
  const hash = await walletClient.sendTransaction(txRequest);
1914
1936
  logger.info(`Transaction sent: ${hash}`);
1915
- const receipt = await publicClient.waitForTransactionReceipt({ hash });
1937
+ const receipt = await waitForReceipt(publicClient, hash, logger);
1916
1938
  if (receipt.status === "reverted") {
1917
1939
  let revertReason = "Unknown reason";
1918
1940
  try {