@zeroxyz/sdk 0.1.1 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@ All notable changes to `@zeroxyz/sdk` will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) — with the pre-1.0 caveat that minor versions may include breaking changes.
6
6
 
7
+ ## 0.2.0
8
+
9
+ ### Changed
10
+
11
+ - The default per-leg fetch timeout is now **180s** (was 60s). It applies to each HTTP leg (the 402 probe and the paid retry), not as a wall-clock deadline. Sized from production: across 30 days of successful runs p50 is ~0.9s and p99 ~29s, but the slow tail is all legitimate generative media — Grok video (~95s), MiniMax music (~136s), Nano Banana / GPT-5 images (~80s) — which 60s false-timed-out _after_ payment had settled. 180s covers the full observed working range with headroom; it is nearly free because the timeout is a ceiling, not a wait (fast calls still return in ms). Override per-client via `timeout` or per-call via `FetchOptions.timeoutMs`. (#565)
12
+
13
+ ### Added
14
+
15
+ - `client.fetch()` now records a failed run when a fetch leg times out. Previously a per-leg timeout threw `ZeroTimeoutError` with no trace, so a slow-but-broken capability accrued zero failure signal (and a paid leg that timed out after settlement left no row for the spend). Both the probe and paid-retry legs now record a status-null (→ `network`) run as a best-effort side-effect before re-throwing the original `ZeroTimeoutError` — the typed-error retry/cancel contract is unchanged. Note: the recorded row has `payment: null` (no txHash on a mid-flight timeout), so it restores the reliability signal, not a financial trail. No-op without a `capabilityId`/credentials. (#566)
16
+
7
17
  ## 0.1.1
8
18
 
9
19
  ### Fixed
@@ -1100,7 +1100,7 @@ var Payments = class {
1100
1100
 
1101
1101
  // package.json
1102
1102
  var package_default = {
1103
- version: "0.1.1"};
1103
+ version: "0.2.0"};
1104
1104
 
1105
1105
  // src/version.ts
1106
1106
  var SDK_VERSION = package_default.version;
@@ -2084,7 +2084,7 @@ var Wallet = class {
2084
2084
 
2085
2085
  // src/options.ts
2086
2086
  var DEFAULT_BASE_URL = "https://api.zero.xyz";
2087
- var DEFAULT_TIMEOUT_MS = 6e4;
2087
+ var DEFAULT_TIMEOUT_MS = 18e4;
2088
2088
  var DEFAULT_MAX_RETRIES = 2;
2089
2089
 
2090
2090
  // src/auth/credentials.ts
@@ -2370,6 +2370,16 @@ var recordErrorFetchRun = async (client, opts, result) => {
2370
2370
  } catch {
2371
2371
  }
2372
2372
  };
2373
+ var recordTimeoutRun = async (client, opts, err, startedAt, capabilityIdRequested) => {
2374
+ const result = errorFetchResult(
2375
+ startedAt,
2376
+ err.message,
2377
+ "timeout",
2378
+ capabilityIdRequested,
2379
+ "network_error"
2380
+ );
2381
+ await recordErrorFetchRun(client, opts, result);
2382
+ };
2373
2383
  var sniffJsonShapeBytes = (buf) => {
2374
2384
  let i = 0;
2375
2385
  if (buf.length >= 3 && buf[0] === 239 && buf[1] === 187 && buf[2] === 191) {
@@ -2414,6 +2424,16 @@ var clientFetch = async (client, url, opts = {}) => {
2414
2424
  try {
2415
2425
  response = await configuredFetch(url, requestInit);
2416
2426
  } catch (err) {
2427
+ if (err instanceof ZeroTimeoutError) {
2428
+ await recordTimeoutRun(
2429
+ client,
2430
+ opts,
2431
+ err,
2432
+ startedAt,
2433
+ capabilityIdRequested
2434
+ );
2435
+ throw err;
2436
+ }
2417
2437
  if (err instanceof ZeroError) throw err;
2418
2438
  const errMessage = err instanceof Error ? err.message : String(err);
2419
2439
  const result2 = errorFetchResult(
@@ -2473,6 +2493,15 @@ var clientFetch = async (client, url, opts = {}) => {
2473
2493
  );
2474
2494
  await recordErrorFetchRun(client, opts, result2);
2475
2495
  return result2;
2496
+ } else if (err instanceof ZeroTimeoutError) {
2497
+ await recordTimeoutRun(
2498
+ client,
2499
+ opts,
2500
+ err,
2501
+ startedAt,
2502
+ capabilityIdRequested
2503
+ );
2504
+ throw err;
2476
2505
  } else {
2477
2506
  throw err;
2478
2507
  }
@@ -3078,5 +3107,5 @@ exports.coerceTempoChainId = coerceTempoChainId;
3078
3107
  exports.createManagedAccount = createManagedAccount;
3079
3108
  exports.paymentHasAnchor = paymentHasAnchor;
3080
3109
  exports.tempoChainLabelFromId = tempoChainLabelFromId;
3081
- //# sourceMappingURL=chunk-XQRINGOJ.cjs.map
3082
- //# sourceMappingURL=chunk-XQRINGOJ.cjs.map
3110
+ //# sourceMappingURL=chunk-LHS7KBN7.cjs.map
3111
+ //# sourceMappingURL=chunk-LHS7KBN7.cjs.map