@owney/sdk 0.7.15-beta.0 → 0.7.16-beta.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/dist/index.cjs CHANGED
@@ -83,6 +83,23 @@ var SupportedAssets = [
83
83
  }
84
84
  ];
85
85
 
86
+ // src/lib/debug.ts
87
+ var configuredDebug = false;
88
+ function setOwneyDebug(enabled) {
89
+ configuredDebug = enabled;
90
+ }
91
+ function isOwneyDebug() {
92
+ return globalThis.__OWNEY_DEBUG__ === true || configuredDebug;
93
+ }
94
+ function debugLog(scope, message, data) {
95
+ if (!isOwneyDebug()) return;
96
+ if (data === void 0) {
97
+ console.log(`[${scope}] ${message}`);
98
+ } else {
99
+ console.log(`[${scope}] ${message}`, data);
100
+ }
101
+ }
102
+
86
103
  // src/errors.ts
87
104
  var OwneyError = class extends Error {
88
105
  code;
@@ -282,7 +299,7 @@ function mapBalances(raw, _chainId, smartWallet) {
282
299
  )
283
300
  )
284
301
  ),
285
- apy: p.pool_apy,
302
+ apy: netApy(p.pool_apy_withFee, p.pool_apy, "pool_apy_withFee"),
286
303
  tvl: p.pool_tvl,
287
304
  // PositionSlot has no `liquidity` field yet; Zyfai will add it. Narrow
288
305
  // structural read keeps it undefined today and auto-populates later.
@@ -347,6 +364,19 @@ function mapWeightedApyByChain(raw) {
347
364
  }
348
365
  return Object.keys(out).length > 0 ? out : void 0;
349
366
  }
367
+ var warnedGrossApyFallbacks = /* @__PURE__ */ new Set();
368
+ function netApy(net, gross, field) {
369
+ if (net !== void 0 && net !== null) return net;
370
+ if (gross === void 0 || gross === null) return void 0;
371
+ if (!warnedGrossApyFallbacks.has(field)) {
372
+ warnedGrossApyFallbacks.add(field);
373
+ console.warn(
374
+ `[owney] @zyfai/sdk omitted "${field}"; falling back to the gross APY, which does not deduct Zyfai's performance fee and so reads high.`
375
+ );
376
+ }
377
+ debugLog("zyfai:apy", `gross fallback for ${field}`, { gross });
378
+ return gross;
379
+ }
350
380
  function rawPoolApyForChain(entry, chainId, tokenSymbol) {
351
381
  let weightedSum = 0;
352
382
  let totalBalance = 0;
@@ -354,8 +384,9 @@ function rawPoolApyForChain(entry, chainId, tokenSymbol) {
354
384
  if (p.chainId !== chainId) continue;
355
385
  if (tokenSymbol && p.tokenSymbol !== tokenSymbol) continue;
356
386
  const balance = p.balance ?? 0;
357
- if (balance <= 0 || typeof p.apy !== "number") continue;
358
- weightedSum += p.apy * balance;
387
+ const apy = netApy(p.apy_withFee, p.apy, "apy_withFee");
388
+ if (balance <= 0 || typeof apy !== "number") continue;
389
+ weightedSum += apy * balance;
359
390
  totalBalance += balance;
360
391
  }
361
392
  return totalBalance > 0 ? weightedSum / totalBalance : null;
@@ -403,8 +434,12 @@ function mapEntries(rawEntries, chainId) {
403
434
  const matched = positions.find(
404
435
  (p) => p.protocol_name ? rawLog.newOpportunity.includes(`${p.protocol_name} (${p.pool})`) : false
405
436
  );
406
- oldApy = Number(rawLog.oldApy);
407
- newApy = Number(rawLog.newApy);
437
+ oldApy = Number(
438
+ netApy(rawLog.oldApy_withFee, rawLog.oldApy, "oldApy_withFee")
439
+ );
440
+ newApy = Number(
441
+ netApy(rawLog.newApy_withFee, rawLog.newApy, "newApy_withFee")
442
+ );
408
443
  const from = splitOpportunity(rawLog.oldOpportunity);
409
444
  const to = splitOpportunity(rawLog.newOpportunity);
410
445
  rebalanceLog = [
@@ -484,7 +519,11 @@ function mapApyByStrategy(raw) {
484
519
  const chainKey = supported.chainId;
485
520
  const symbolKey = supported.symbol;
486
521
  const bucket = apyPerAsset[chainKey] ?? {};
487
- const apy = entry.average_apy_with_fee ?? entry.average_apy;
522
+ const apy = netApy(
523
+ entry.average_apy_withFee,
524
+ entry.average_apy,
525
+ "average_apy_withFee"
526
+ ) ?? entry.average_apy;
488
527
  bucket[symbolKey] = apy;
489
528
  apyPerAsset[chainKey] = bucket;
490
529
  apySum += apy;
@@ -844,23 +883,6 @@ function protocolsPolicyNeedsUpdate(current, desiredProtocols, desiredAutoSelect
844
883
  return !protocolListsEqual(current.protocols, desiredProtocols);
845
884
  }
846
885
 
847
- // src/lib/debug.ts
848
- var configuredDebug = false;
849
- function setOwneyDebug(enabled) {
850
- configuredDebug = enabled;
851
- }
852
- function isOwneyDebug() {
853
- return globalThis.__OWNEY_DEBUG__ === true || configuredDebug;
854
- }
855
- function debugLog(scope, message, data) {
856
- if (!isOwneyDebug()) return;
857
- if (data === void 0) {
858
- console.log(`[${scope}] ${message}`);
859
- } else {
860
- console.log(`[${scope}] ${message}`, data);
861
- }
862
- }
863
-
864
886
  // src/agents/zyfai/zyfai.agent.ts
865
887
  var ERC7579_IS_MODULE_INSTALLED_ABI = (0, import_viem.parseAbi)([
866
888
  "function isModuleInstalled(uint256 moduleTypeId, address module, bytes additionalContext) view returns (bool)"
@@ -1864,8 +1886,8 @@ var ZyfaiAgent = class _ZyfaiAgent {
1864
1886
 
1865
1887
  // src/lib/routing-api.ts
1866
1888
  var ROUTING_API_BASE_URL = "https://owney-routing-api-243946518160.europe-west4.run.app";
1867
- async function fetchOrgAgentConfig(apiKey, baseUrl = ROUTING_API_BASE_URL) {
1868
- const url = `${baseUrl}/api/v1/agent/org-config`;
1889
+ async function fetchOrgAgentConfig(apiKey) {
1890
+ const url = `${ROUTING_API_BASE_URL}/api/v1/agent/org-config`;
1869
1891
  try {
1870
1892
  const res = await fetch(url, {
1871
1893
  method: "GET",
@@ -1898,8 +1920,8 @@ async function fetchOrgAgentConfig(apiKey, baseUrl = ROUTING_API_BASE_URL) {
1898
1920
  return null;
1899
1921
  }
1900
1922
  }
1901
- async function fetchAgentKeys(apiKey, baseUrl = ROUTING_API_BASE_URL) {
1902
- const url = `${baseUrl}/api/v1/agent/keys`;
1923
+ async function fetchAgentKeys(apiKey) {
1924
+ const url = `${ROUTING_API_BASE_URL}/api/v1/agent/keys`;
1903
1925
  const res = await fetch(url, {
1904
1926
  method: "GET",
1905
1927
  headers: {
@@ -1928,9 +1950,9 @@ async function fetchAgentKeys(apiKey, baseUrl = ROUTING_API_BASE_URL) {
1928
1950
 
1929
1951
  // src/lib/health-report.ts
1930
1952
  var ROUTING_API_BASE_URL2 = "https://owney-routing-api-243946518160.europe-west4.run.app";
1931
- async function reportAgentFailure(apiKey, agentType, errorCode, baseUrl = ROUTING_API_BASE_URL2) {
1953
+ async function reportAgentFailure(apiKey, agentType, errorCode) {
1932
1954
  try {
1933
- await fetch(`${baseUrl}/api/v1/agent/health-report`, {
1955
+ await fetch(`${ROUTING_API_BASE_URL2}/api/v1/agent/health-report`, {
1934
1956
  method: "POST",
1935
1957
  headers: {
1936
1958
  "Content-Type": "application/json",
@@ -1949,12 +1971,12 @@ async function reportAgentFailure(apiKey, agentType, errorCode, baseUrl = ROUTIN
1949
1971
  );
1950
1972
  }
1951
1973
  }
1952
- async function withFailureReporting(apiKey, agentType, fn, baseUrl) {
1974
+ async function withFailureReporting(apiKey, agentType, fn) {
1953
1975
  try {
1954
1976
  return await fn();
1955
1977
  } catch (err) {
1956
1978
  const errorCode = err instanceof OwneyError ? err.code : "SDK_AGENT_FAILURE";
1957
- void reportAgentFailure(apiKey, agentType, errorCode, baseUrl);
1979
+ void reportAgentFailure(apiKey, agentType, errorCode);
1958
1980
  throw err;
1959
1981
  }
1960
1982
  }
@@ -2855,10 +2877,7 @@ var OwneySDK = class {
2855
2877
  async getOrgAgentConfig() {
2856
2878
  if (this.orgAgentConfig !== void 0) return this.orgAgentConfig;
2857
2879
  if (!this.orgAgentConfigPromise) {
2858
- this.orgAgentConfigPromise = fetchOrgAgentConfig(
2859
- this.apiKey,
2860
- this.routingApiBaseUrl
2861
- ).then(
2880
+ this.orgAgentConfigPromise = fetchOrgAgentConfig(this.apiKey).then(
2862
2881
  (config) => {
2863
2882
  this.orgAgentConfig = config;
2864
2883
  return config;
@@ -2898,10 +2917,7 @@ var OwneySDK = class {
2898
2917
  if (this.agents.size > 0) return;
2899
2918
  if (!this.initializingAgentsPromise) {
2900
2919
  this.initializingAgentsPromise = (async () => {
2901
- const agentKeys = await fetchAgentKeys(
2902
- this.apiKey,
2903
- this.routingApiBaseUrl
2904
- );
2920
+ const agentKeys = await fetchAgentKeys(this.apiKey);
2905
2921
  this.disabledAgents.clear();
2906
2922
  for (const { key: key2, agent_type, is_enabled } of agentKeys) {
2907
2923
  const agent = this.createAgent(agent_type, key2);
@@ -3157,8 +3173,7 @@ var OwneySDK = class {
3157
3173
  amount,
3158
3174
  asset,
3159
3175
  callback
3160
- ),
3161
- this.routingApiBaseUrl
3176
+ )
3162
3177
  );
3163
3178
  let approvalAttempted = false;
3164
3179
  for (; ; ) {
@@ -3308,8 +3323,7 @@ var OwneySDK = class {
3308
3323
  return withFailureReporting(
3309
3324
  this.apiKey,
3310
3325
  agent.id,
3311
- () => agent.withdraw(state, chainId, token, amount),
3312
- this.routingApiBaseUrl
3326
+ () => agent.withdraw(state, chainId, token, amount)
3313
3327
  );
3314
3328
  }
3315
3329
  const eligibleAgents = this.getEligibleAgents(chainId, asset);
@@ -3323,12 +3337,7 @@ var OwneySDK = class {
3323
3337
  console.error(`withdraw failed for agent "${agent.id}":`, err);
3324
3338
  agentErrors2[agent.id] = err instanceof Error ? err.message : String(err);
3325
3339
  const code = err instanceof OwneyError ? err.code : "SDK_AGENT_FAILURE";
3326
- void reportAgentFailure(
3327
- this.apiKey,
3328
- agent.id,
3329
- code,
3330
- this.routingApiBaseUrl
3331
- );
3340
+ void reportAgentFailure(this.apiKey, agent.id, code);
3332
3341
  }
3333
3342
  }
3334
3343
  if (Object.keys(results2).length === 0) {
@@ -3397,12 +3406,7 @@ var OwneySDK = class {
3397
3406
  console.error(`withdraw failed for agent "${p.agent.id}":`, err);
3398
3407
  agentErrors[p.agent.id] = err instanceof Error ? err.message : String(err);
3399
3408
  const code = err instanceof OwneyError ? err.code : "SDK_AGENT_FAILURE";
3400
- void reportAgentFailure(
3401
- this.apiKey,
3402
- p.agent.id,
3403
- code,
3404
- this.routingApiBaseUrl
3405
- );
3409
+ void reportAgentFailure(this.apiKey, p.agent.id, code);
3406
3410
  const failedAmount = p.planned;
3407
3411
  p.planned = 0n;
3408
3412
  redistributeShare(plans, i, failedAmount);
package/dist/index.d.cts CHANGED
@@ -9,16 +9,16 @@ interface OwneySDKConfig {
9
9
  */
10
10
  zyfaiRpcUrls?: ZyfaiRpcUrlsConfig;
11
11
  /**
12
- * Optional override for the Owney routing API base URL used by all routing
13
- * calls (defaults to the OWNEY_ROUTING_API_BASE_URL env var, then the
14
- * production URL). Set this to point at a local/staging routing API,
12
+ * Optional override for the Owney routing API base URL used by the sponsored
13
+ * deposit callbacks (defaults to the OWNEY_ROUTING_API_BASE_URL env var, then
14
+ * the production URL). Set this to point at a local/staging routing API,
15
15
  * e.g. "http://localhost:3000", when testing sponsor changes.
16
16
  */
17
17
  routingApiBaseUrl?: string;
18
18
  /**
19
19
  * Optional attribution tag forwarded to Zyfai's /auth/login when the SDK
20
- * authenticates. Replaces the equivalent option on `createOwneySIWX`
21
- * for apps that don't use the AppKit SIWX modal.
20
+ * authenticates (e.g. "delos"). Replaces the equivalent option on
21
+ * `createOwneySIWX` for apps that don't use the AppKit SIWX modal.
22
22
  */
23
23
  referralSource?: string;
24
24
  /**
package/dist/index.d.ts CHANGED
@@ -9,16 +9,16 @@ interface OwneySDKConfig {
9
9
  */
10
10
  zyfaiRpcUrls?: ZyfaiRpcUrlsConfig;
11
11
  /**
12
- * Optional override for the Owney routing API base URL used by all routing
13
- * calls (defaults to the OWNEY_ROUTING_API_BASE_URL env var, then the
14
- * production URL). Set this to point at a local/staging routing API,
12
+ * Optional override for the Owney routing API base URL used by the sponsored
13
+ * deposit callbacks (defaults to the OWNEY_ROUTING_API_BASE_URL env var, then
14
+ * the production URL). Set this to point at a local/staging routing API,
15
15
  * e.g. "http://localhost:3000", when testing sponsor changes.
16
16
  */
17
17
  routingApiBaseUrl?: string;
18
18
  /**
19
19
  * Optional attribution tag forwarded to Zyfai's /auth/login when the SDK
20
- * authenticates. Replaces the equivalent option on `createOwneySIWX`
21
- * for apps that don't use the AppKit SIWX modal.
20
+ * authenticates (e.g. "delos"). Replaces the equivalent option on
21
+ * `createOwneySIWX` for apps that don't use the AppKit SIWX modal.
22
22
  */
23
23
  referralSource?: string;
24
24
  /**
package/dist/index.js CHANGED
@@ -50,6 +50,23 @@ var SupportedAssets = [
50
50
  }
51
51
  ];
52
52
 
53
+ // src/lib/debug.ts
54
+ var configuredDebug = false;
55
+ function setOwneyDebug(enabled) {
56
+ configuredDebug = enabled;
57
+ }
58
+ function isOwneyDebug() {
59
+ return globalThis.__OWNEY_DEBUG__ === true || configuredDebug;
60
+ }
61
+ function debugLog(scope, message, data) {
62
+ if (!isOwneyDebug()) return;
63
+ if (data === void 0) {
64
+ console.log(`[${scope}] ${message}`);
65
+ } else {
66
+ console.log(`[${scope}] ${message}`, data);
67
+ }
68
+ }
69
+
53
70
  // src/errors.ts
54
71
  var OwneyError = class extends Error {
55
72
  code;
@@ -249,7 +266,7 @@ function mapBalances(raw, _chainId, smartWallet) {
249
266
  )
250
267
  )
251
268
  ),
252
- apy: p.pool_apy,
269
+ apy: netApy(p.pool_apy_withFee, p.pool_apy, "pool_apy_withFee"),
253
270
  tvl: p.pool_tvl,
254
271
  // PositionSlot has no `liquidity` field yet; Zyfai will add it. Narrow
255
272
  // structural read keeps it undefined today and auto-populates later.
@@ -314,6 +331,19 @@ function mapWeightedApyByChain(raw) {
314
331
  }
315
332
  return Object.keys(out).length > 0 ? out : void 0;
316
333
  }
334
+ var warnedGrossApyFallbacks = /* @__PURE__ */ new Set();
335
+ function netApy(net, gross, field) {
336
+ if (net !== void 0 && net !== null) return net;
337
+ if (gross === void 0 || gross === null) return void 0;
338
+ if (!warnedGrossApyFallbacks.has(field)) {
339
+ warnedGrossApyFallbacks.add(field);
340
+ console.warn(
341
+ `[owney] @zyfai/sdk omitted "${field}"; falling back to the gross APY, which does not deduct Zyfai's performance fee and so reads high.`
342
+ );
343
+ }
344
+ debugLog("zyfai:apy", `gross fallback for ${field}`, { gross });
345
+ return gross;
346
+ }
317
347
  function rawPoolApyForChain(entry, chainId, tokenSymbol) {
318
348
  let weightedSum = 0;
319
349
  let totalBalance = 0;
@@ -321,8 +351,9 @@ function rawPoolApyForChain(entry, chainId, tokenSymbol) {
321
351
  if (p.chainId !== chainId) continue;
322
352
  if (tokenSymbol && p.tokenSymbol !== tokenSymbol) continue;
323
353
  const balance = p.balance ?? 0;
324
- if (balance <= 0 || typeof p.apy !== "number") continue;
325
- weightedSum += p.apy * balance;
354
+ const apy = netApy(p.apy_withFee, p.apy, "apy_withFee");
355
+ if (balance <= 0 || typeof apy !== "number") continue;
356
+ weightedSum += apy * balance;
326
357
  totalBalance += balance;
327
358
  }
328
359
  return totalBalance > 0 ? weightedSum / totalBalance : null;
@@ -370,8 +401,12 @@ function mapEntries(rawEntries, chainId) {
370
401
  const matched = positions.find(
371
402
  (p) => p.protocol_name ? rawLog.newOpportunity.includes(`${p.protocol_name} (${p.pool})`) : false
372
403
  );
373
- oldApy = Number(rawLog.oldApy);
374
- newApy = Number(rawLog.newApy);
404
+ oldApy = Number(
405
+ netApy(rawLog.oldApy_withFee, rawLog.oldApy, "oldApy_withFee")
406
+ );
407
+ newApy = Number(
408
+ netApy(rawLog.newApy_withFee, rawLog.newApy, "newApy_withFee")
409
+ );
375
410
  const from = splitOpportunity(rawLog.oldOpportunity);
376
411
  const to = splitOpportunity(rawLog.newOpportunity);
377
412
  rebalanceLog = [
@@ -451,7 +486,11 @@ function mapApyByStrategy(raw) {
451
486
  const chainKey = supported.chainId;
452
487
  const symbolKey = supported.symbol;
453
488
  const bucket = apyPerAsset[chainKey] ?? {};
454
- const apy = entry.average_apy_with_fee ?? entry.average_apy;
489
+ const apy = netApy(
490
+ entry.average_apy_withFee,
491
+ entry.average_apy,
492
+ "average_apy_withFee"
493
+ ) ?? entry.average_apy;
455
494
  bucket[symbolKey] = apy;
456
495
  apyPerAsset[chainKey] = bucket;
457
496
  apySum += apy;
@@ -811,23 +850,6 @@ function protocolsPolicyNeedsUpdate(current, desiredProtocols, desiredAutoSelect
811
850
  return !protocolListsEqual(current.protocols, desiredProtocols);
812
851
  }
813
852
 
814
- // src/lib/debug.ts
815
- var configuredDebug = false;
816
- function setOwneyDebug(enabled) {
817
- configuredDebug = enabled;
818
- }
819
- function isOwneyDebug() {
820
- return globalThis.__OWNEY_DEBUG__ === true || configuredDebug;
821
- }
822
- function debugLog(scope, message, data) {
823
- if (!isOwneyDebug()) return;
824
- if (data === void 0) {
825
- console.log(`[${scope}] ${message}`);
826
- } else {
827
- console.log(`[${scope}] ${message}`, data);
828
- }
829
- }
830
-
831
853
  // src/agents/zyfai/zyfai.agent.ts
832
854
  var ERC7579_IS_MODULE_INSTALLED_ABI = parseAbi([
833
855
  "function isModuleInstalled(uint256 moduleTypeId, address module, bytes additionalContext) view returns (bool)"
@@ -1831,8 +1853,8 @@ var ZyfaiAgent = class _ZyfaiAgent {
1831
1853
 
1832
1854
  // src/lib/routing-api.ts
1833
1855
  var ROUTING_API_BASE_URL = "https://owney-routing-api-243946518160.europe-west4.run.app";
1834
- async function fetchOrgAgentConfig(apiKey, baseUrl = ROUTING_API_BASE_URL) {
1835
- const url = `${baseUrl}/api/v1/agent/org-config`;
1856
+ async function fetchOrgAgentConfig(apiKey) {
1857
+ const url = `${ROUTING_API_BASE_URL}/api/v1/agent/org-config`;
1836
1858
  try {
1837
1859
  const res = await fetch(url, {
1838
1860
  method: "GET",
@@ -1865,8 +1887,8 @@ async function fetchOrgAgentConfig(apiKey, baseUrl = ROUTING_API_BASE_URL) {
1865
1887
  return null;
1866
1888
  }
1867
1889
  }
1868
- async function fetchAgentKeys(apiKey, baseUrl = ROUTING_API_BASE_URL) {
1869
- const url = `${baseUrl}/api/v1/agent/keys`;
1890
+ async function fetchAgentKeys(apiKey) {
1891
+ const url = `${ROUTING_API_BASE_URL}/api/v1/agent/keys`;
1870
1892
  const res = await fetch(url, {
1871
1893
  method: "GET",
1872
1894
  headers: {
@@ -1895,9 +1917,9 @@ async function fetchAgentKeys(apiKey, baseUrl = ROUTING_API_BASE_URL) {
1895
1917
 
1896
1918
  // src/lib/health-report.ts
1897
1919
  var ROUTING_API_BASE_URL2 = "https://owney-routing-api-243946518160.europe-west4.run.app";
1898
- async function reportAgentFailure(apiKey, agentType, errorCode, baseUrl = ROUTING_API_BASE_URL2) {
1920
+ async function reportAgentFailure(apiKey, agentType, errorCode) {
1899
1921
  try {
1900
- await fetch(`${baseUrl}/api/v1/agent/health-report`, {
1922
+ await fetch(`${ROUTING_API_BASE_URL2}/api/v1/agent/health-report`, {
1901
1923
  method: "POST",
1902
1924
  headers: {
1903
1925
  "Content-Type": "application/json",
@@ -1916,12 +1938,12 @@ async function reportAgentFailure(apiKey, agentType, errorCode, baseUrl = ROUTIN
1916
1938
  );
1917
1939
  }
1918
1940
  }
1919
- async function withFailureReporting(apiKey, agentType, fn, baseUrl) {
1941
+ async function withFailureReporting(apiKey, agentType, fn) {
1920
1942
  try {
1921
1943
  return await fn();
1922
1944
  } catch (err) {
1923
1945
  const errorCode = err instanceof OwneyError ? err.code : "SDK_AGENT_FAILURE";
1924
- void reportAgentFailure(apiKey, agentType, errorCode, baseUrl);
1946
+ void reportAgentFailure(apiKey, agentType, errorCode);
1925
1947
  throw err;
1926
1948
  }
1927
1949
  }
@@ -2826,10 +2848,7 @@ var OwneySDK = class {
2826
2848
  async getOrgAgentConfig() {
2827
2849
  if (this.orgAgentConfig !== void 0) return this.orgAgentConfig;
2828
2850
  if (!this.orgAgentConfigPromise) {
2829
- this.orgAgentConfigPromise = fetchOrgAgentConfig(
2830
- this.apiKey,
2831
- this.routingApiBaseUrl
2832
- ).then(
2851
+ this.orgAgentConfigPromise = fetchOrgAgentConfig(this.apiKey).then(
2833
2852
  (config) => {
2834
2853
  this.orgAgentConfig = config;
2835
2854
  return config;
@@ -2869,10 +2888,7 @@ var OwneySDK = class {
2869
2888
  if (this.agents.size > 0) return;
2870
2889
  if (!this.initializingAgentsPromise) {
2871
2890
  this.initializingAgentsPromise = (async () => {
2872
- const agentKeys = await fetchAgentKeys(
2873
- this.apiKey,
2874
- this.routingApiBaseUrl
2875
- );
2891
+ const agentKeys = await fetchAgentKeys(this.apiKey);
2876
2892
  this.disabledAgents.clear();
2877
2893
  for (const { key: key2, agent_type, is_enabled } of agentKeys) {
2878
2894
  const agent = this.createAgent(agent_type, key2);
@@ -3128,8 +3144,7 @@ var OwneySDK = class {
3128
3144
  amount,
3129
3145
  asset,
3130
3146
  callback
3131
- ),
3132
- this.routingApiBaseUrl
3147
+ )
3133
3148
  );
3134
3149
  let approvalAttempted = false;
3135
3150
  for (; ; ) {
@@ -3279,8 +3294,7 @@ var OwneySDK = class {
3279
3294
  return withFailureReporting(
3280
3295
  this.apiKey,
3281
3296
  agent.id,
3282
- () => agent.withdraw(state, chainId, token, amount),
3283
- this.routingApiBaseUrl
3297
+ () => agent.withdraw(state, chainId, token, amount)
3284
3298
  );
3285
3299
  }
3286
3300
  const eligibleAgents = this.getEligibleAgents(chainId, asset);
@@ -3294,12 +3308,7 @@ var OwneySDK = class {
3294
3308
  console.error(`withdraw failed for agent "${agent.id}":`, err);
3295
3309
  agentErrors2[agent.id] = err instanceof Error ? err.message : String(err);
3296
3310
  const code = err instanceof OwneyError ? err.code : "SDK_AGENT_FAILURE";
3297
- void reportAgentFailure(
3298
- this.apiKey,
3299
- agent.id,
3300
- code,
3301
- this.routingApiBaseUrl
3302
- );
3311
+ void reportAgentFailure(this.apiKey, agent.id, code);
3303
3312
  }
3304
3313
  }
3305
3314
  if (Object.keys(results2).length === 0) {
@@ -3368,12 +3377,7 @@ var OwneySDK = class {
3368
3377
  console.error(`withdraw failed for agent "${p.agent.id}":`, err);
3369
3378
  agentErrors[p.agent.id] = err instanceof Error ? err.message : String(err);
3370
3379
  const code = err instanceof OwneyError ? err.code : "SDK_AGENT_FAILURE";
3371
- void reportAgentFailure(
3372
- this.apiKey,
3373
- p.agent.id,
3374
- code,
3375
- this.routingApiBaseUrl
3376
- );
3380
+ void reportAgentFailure(this.apiKey, p.agent.id, code);
3377
3381
  const failedAmount = p.planned;
3378
3382
  p.planned = 0n;
3379
3383
  redistributeShare(plans, i, failedAmount);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.7.15-beta.0",
3
+ "version": "0.7.16-beta.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "test:watch": "vitest"
24
24
  },
25
25
  "dependencies": {
26
- "@zyfai/sdk": "0.2.50",
26
+ "@zyfai/sdk": "0.2.52",
27
27
  "siwe": "^3.0.0",
28
28
  "viem": "^2.48.1"
29
29
  },