@owney/sdk 0.7.10-beta.0 → 0.7.12-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
@@ -1531,7 +1531,7 @@ var VIEM_CHAIN = { 8453: import_chains.base, 42161: import_chains.arbitrum, 1: i
1531
1531
  var SPLITTING_ASSETS = ["USDC", "WETH"];
1532
1532
  var POOL_POLICY_CHAIN_IDS = [8453, 42161, 1];
1533
1533
  var EARNINGS_REFRESH_COOLDOWN_MS = 60 * 60 * 1e3;
1534
- var ZyfaiAgent = class {
1534
+ var ZyfaiAgent = class _ZyfaiAgent {
1535
1535
  id = "zyfai";
1536
1536
  supportedChainIds = [8453, 42161, 1];
1537
1537
  supportedAssets = [
@@ -2430,9 +2430,30 @@ var ZyfaiAgent = class {
2430
2430
  const raw = await this.sdk.getDailyApyHistory(smartWallet, days);
2431
2431
  return mapApyHistory(raw, chainId, tokenSymbol);
2432
2432
  }
2433
+ /**
2434
+ * Owney speaks asset symbols ("USDC" / "WETH"); Zyfai's history endpoint
2435
+ * takes lowercase `assetType` and denominates WETH as "eth" (the same
2436
+ * spelling `resolveWithdrawnAmounts` normalizes on the way in). Anything
2437
+ * unrecognised returns undefined so the request stays unfiltered rather
2438
+ * than silently narrowing to nothing.
2439
+ */
2440
+ static toZyfaiAssetType(tokenSymbol) {
2441
+ switch (tokenSymbol?.toUpperCase()) {
2442
+ case "USDC":
2443
+ return "usdc";
2444
+ case "WETH":
2445
+ case "ETH":
2446
+ return "eth";
2447
+ case "EURC":
2448
+ return "eurc";
2449
+ default:
2450
+ return void 0;
2451
+ }
2452
+ }
2433
2453
  async getHistory(state, chainId, options) {
2434
2454
  const { smartWallet, chainId: validChainId } = await this.resolveSmartWallet(state, chainId);
2435
2455
  const limit = options?.limit ?? 10;
2456
+ const assetType = _ZyfaiAgent.toZyfaiAssetType(options?.tokenSymbol);
2436
2457
  const cursor = options?.cursor ? decodeHistoryCursor(options.cursor) : null;
2437
2458
  const toDate = cursor?.toDate ?? options?.toDate ?? (/* @__PURE__ */ new Date()).toISOString();
2438
2459
  let offset = cursor?.rawOffset ?? 0;
@@ -2446,7 +2467,12 @@ var ZyfaiAgent = class {
2446
2467
  limit: backendPageSize,
2447
2468
  offset,
2448
2469
  fromDate: options?.fromDate,
2449
- toDate
2470
+ toDate,
2471
+ // Filtering server-side means the pages coming back are already the
2472
+ // asset the caller asked for, so the loop below fills `limit` from
2473
+ // relevant entries instead of spending its budget on the other
2474
+ // asset's rows and handing back a page that filters to nothing.
2475
+ assetType
2450
2476
  });
2451
2477
  raw.data.forEach((entry, idx) => {
2452
2478
  if (entry.chainId === validChainId) {
package/dist/index.d.cts CHANGED
@@ -83,6 +83,15 @@ type HistoryFilters = {
83
83
  limit?: number;
84
84
  /** Opaque cursor returned by a previous getHistory call. */
85
85
  cursor?: string;
86
+ /**
87
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
88
+ * single asset. Without it the page blends every asset on the chain, so a
89
+ * consumer showing one asset at a time has to filter client-side — and a
90
+ * page whose entries all belong to the *other* asset then renders empty
91
+ * even though matching entries exist further back. Agents whose backends
92
+ * cannot filter by asset ignore this and return the whole chain's history.
93
+ */
94
+ tokenSymbol?: string;
86
95
  };
87
96
  type HistoryOptions = {
88
97
  agentId?: AgentId;
package/dist/index.d.ts CHANGED
@@ -83,6 +83,15 @@ type HistoryFilters = {
83
83
  limit?: number;
84
84
  /** Opaque cursor returned by a previous getHistory call. */
85
85
  cursor?: string;
86
+ /**
87
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
88
+ * single asset. Without it the page blends every asset on the chain, so a
89
+ * consumer showing one asset at a time has to filter client-side — and a
90
+ * page whose entries all belong to the *other* asset then renders empty
91
+ * even though matching entries exist further back. Agents whose backends
92
+ * cannot filter by asset ignore this and return the whole chain's history.
93
+ */
94
+ tokenSymbol?: string;
86
95
  };
87
96
  type HistoryOptions = {
88
97
  agentId?: AgentId;
package/dist/index.js CHANGED
@@ -861,7 +861,7 @@ var VIEM_CHAIN = { 8453: base, 42161: arbitrum, 1: mainnet };
861
861
  var SPLITTING_ASSETS = ["USDC", "WETH"];
862
862
  var POOL_POLICY_CHAIN_IDS = [8453, 42161, 1];
863
863
  var EARNINGS_REFRESH_COOLDOWN_MS = 60 * 60 * 1e3;
864
- var ZyfaiAgent = class {
864
+ var ZyfaiAgent = class _ZyfaiAgent {
865
865
  id = "zyfai";
866
866
  supportedChainIds = [8453, 42161, 1];
867
867
  supportedAssets = [
@@ -1760,9 +1760,30 @@ var ZyfaiAgent = class {
1760
1760
  const raw = await this.sdk.getDailyApyHistory(smartWallet, days);
1761
1761
  return mapApyHistory(raw, chainId, tokenSymbol);
1762
1762
  }
1763
+ /**
1764
+ * Owney speaks asset symbols ("USDC" / "WETH"); Zyfai's history endpoint
1765
+ * takes lowercase `assetType` and denominates WETH as "eth" (the same
1766
+ * spelling `resolveWithdrawnAmounts` normalizes on the way in). Anything
1767
+ * unrecognised returns undefined so the request stays unfiltered rather
1768
+ * than silently narrowing to nothing.
1769
+ */
1770
+ static toZyfaiAssetType(tokenSymbol) {
1771
+ switch (tokenSymbol?.toUpperCase()) {
1772
+ case "USDC":
1773
+ return "usdc";
1774
+ case "WETH":
1775
+ case "ETH":
1776
+ return "eth";
1777
+ case "EURC":
1778
+ return "eurc";
1779
+ default:
1780
+ return void 0;
1781
+ }
1782
+ }
1763
1783
  async getHistory(state, chainId, options) {
1764
1784
  const { smartWallet, chainId: validChainId } = await this.resolveSmartWallet(state, chainId);
1765
1785
  const limit = options?.limit ?? 10;
1786
+ const assetType = _ZyfaiAgent.toZyfaiAssetType(options?.tokenSymbol);
1766
1787
  const cursor = options?.cursor ? decodeHistoryCursor(options.cursor) : null;
1767
1788
  const toDate = cursor?.toDate ?? options?.toDate ?? (/* @__PURE__ */ new Date()).toISOString();
1768
1789
  let offset = cursor?.rawOffset ?? 0;
@@ -1776,7 +1797,12 @@ var ZyfaiAgent = class {
1776
1797
  limit: backendPageSize,
1777
1798
  offset,
1778
1799
  fromDate: options?.fromDate,
1779
- toDate
1800
+ toDate,
1801
+ // Filtering server-side means the pages coming back are already the
1802
+ // asset the caller asked for, so the loop below fills `limit` from
1803
+ // relevant entries instead of spending its budget on the other
1804
+ // asset's rows and handing back a page that filters to nothing.
1805
+ assetType
1780
1806
  });
1781
1807
  raw.data.forEach((entry, idx) => {
1782
1808
  if (entry.chainId === validChainId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.7.10-beta.0",
3
+ "version": "0.7.12-beta.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@surf_liquid/core-sdk": "^0.4.0",
27
- "@zyfai/sdk": "0.2.48",
27
+ "@zyfai/sdk": "0.2.50",
28
28
  "ethers": "^6.17.0",
29
29
  "siwe": "^3.0.0",
30
30
  "viem": "^2.48.1"