@owney/sdk 0.7.9 → 0.7.11
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 +28 -2
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +28 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -885,7 +885,7 @@ var VIEM_CHAIN = { 8453: import_chains.base, 42161: import_chains.arbitrum, 1: i
|
|
|
885
885
|
var SPLITTING_ASSETS = ["USDC", "WETH"];
|
|
886
886
|
var POOL_POLICY_CHAIN_IDS = [8453, 42161, 1];
|
|
887
887
|
var EARNINGS_REFRESH_COOLDOWN_MS = 60 * 60 * 1e3;
|
|
888
|
-
var ZyfaiAgent = class {
|
|
888
|
+
var ZyfaiAgent = class _ZyfaiAgent {
|
|
889
889
|
id = "zyfai";
|
|
890
890
|
supportedChainIds = [8453, 42161, 1];
|
|
891
891
|
supportedAssets = [
|
|
@@ -1755,9 +1755,30 @@ var ZyfaiAgent = class {
|
|
|
1755
1755
|
const raw = await this.sdk.getDailyApyHistory(smartWallet, days);
|
|
1756
1756
|
return mapApyHistory(raw, chainId, tokenSymbol);
|
|
1757
1757
|
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Owney speaks asset symbols ("USDC" / "WETH"); Zyfai's history endpoint
|
|
1760
|
+
* takes lowercase `assetType` and denominates WETH as "eth" (the same
|
|
1761
|
+
* spelling `resolveWithdrawnAmounts` normalizes on the way in). Anything
|
|
1762
|
+
* unrecognised returns undefined so the request stays unfiltered rather
|
|
1763
|
+
* than silently narrowing to nothing.
|
|
1764
|
+
*/
|
|
1765
|
+
static toZyfaiAssetType(tokenSymbol) {
|
|
1766
|
+
switch (tokenSymbol?.toUpperCase()) {
|
|
1767
|
+
case "USDC":
|
|
1768
|
+
return "usdc";
|
|
1769
|
+
case "WETH":
|
|
1770
|
+
case "ETH":
|
|
1771
|
+
return "eth";
|
|
1772
|
+
case "EURC":
|
|
1773
|
+
return "eurc";
|
|
1774
|
+
default:
|
|
1775
|
+
return void 0;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1758
1778
|
async getHistory(state, chainId, options) {
|
|
1759
1779
|
const { smartWallet, chainId: validChainId } = await this.resolveSmartWallet(state, chainId);
|
|
1760
1780
|
const limit = options?.limit ?? 10;
|
|
1781
|
+
const assetType = _ZyfaiAgent.toZyfaiAssetType(options?.tokenSymbol);
|
|
1761
1782
|
const cursor = options?.cursor ? decodeHistoryCursor(options.cursor) : null;
|
|
1762
1783
|
const toDate = cursor?.toDate ?? options?.toDate ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1763
1784
|
let offset = cursor?.rawOffset ?? 0;
|
|
@@ -1771,7 +1792,12 @@ var ZyfaiAgent = class {
|
|
|
1771
1792
|
limit: backendPageSize,
|
|
1772
1793
|
offset,
|
|
1773
1794
|
fromDate: options?.fromDate,
|
|
1774
|
-
toDate
|
|
1795
|
+
toDate,
|
|
1796
|
+
// Filtering server-side means the pages coming back are already the
|
|
1797
|
+
// asset the caller asked for, so the loop below fills `limit` from
|
|
1798
|
+
// relevant entries instead of spending its budget on the other
|
|
1799
|
+
// asset's rows and handing back a page that filters to nothing.
|
|
1800
|
+
assetType
|
|
1775
1801
|
});
|
|
1776
1802
|
raw.data.forEach((entry, idx) => {
|
|
1777
1803
|
if (entry.chainId === validChainId) {
|
package/dist/index.d.cts
CHANGED
|
@@ -73,6 +73,15 @@ type HistoryFilters = {
|
|
|
73
73
|
limit?: number;
|
|
74
74
|
/** Opaque cursor returned by a previous getHistory call. */
|
|
75
75
|
cursor?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
|
|
78
|
+
* single asset. Without it the page blends every asset on the chain, so a
|
|
79
|
+
* consumer showing one asset at a time has to filter client-side — and a
|
|
80
|
+
* page whose entries all belong to the *other* asset then renders empty
|
|
81
|
+
* even though matching entries exist further back. Agents whose backends
|
|
82
|
+
* cannot filter by asset ignore this and return the whole chain's history.
|
|
83
|
+
*/
|
|
84
|
+
tokenSymbol?: string;
|
|
76
85
|
};
|
|
77
86
|
type HistoryOptions = {
|
|
78
87
|
agentId?: AgentId;
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,15 @@ type HistoryFilters = {
|
|
|
73
73
|
limit?: number;
|
|
74
74
|
/** Opaque cursor returned by a previous getHistory call. */
|
|
75
75
|
cursor?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
|
|
78
|
+
* single asset. Without it the page blends every asset on the chain, so a
|
|
79
|
+
* consumer showing one asset at a time has to filter client-side — and a
|
|
80
|
+
* page whose entries all belong to the *other* asset then renders empty
|
|
81
|
+
* even though matching entries exist further back. Agents whose backends
|
|
82
|
+
* cannot filter by asset ignore this and return the whole chain's history.
|
|
83
|
+
*/
|
|
84
|
+
tokenSymbol?: string;
|
|
76
85
|
};
|
|
77
86
|
type HistoryOptions = {
|
|
78
87
|
agentId?: AgentId;
|
package/dist/index.js
CHANGED
|
@@ -852,7 +852,7 @@ var VIEM_CHAIN = { 8453: base, 42161: arbitrum, 1: mainnet };
|
|
|
852
852
|
var SPLITTING_ASSETS = ["USDC", "WETH"];
|
|
853
853
|
var POOL_POLICY_CHAIN_IDS = [8453, 42161, 1];
|
|
854
854
|
var EARNINGS_REFRESH_COOLDOWN_MS = 60 * 60 * 1e3;
|
|
855
|
-
var ZyfaiAgent = class {
|
|
855
|
+
var ZyfaiAgent = class _ZyfaiAgent {
|
|
856
856
|
id = "zyfai";
|
|
857
857
|
supportedChainIds = [8453, 42161, 1];
|
|
858
858
|
supportedAssets = [
|
|
@@ -1722,9 +1722,30 @@ var ZyfaiAgent = class {
|
|
|
1722
1722
|
const raw = await this.sdk.getDailyApyHistory(smartWallet, days);
|
|
1723
1723
|
return mapApyHistory(raw, chainId, tokenSymbol);
|
|
1724
1724
|
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Owney speaks asset symbols ("USDC" / "WETH"); Zyfai's history endpoint
|
|
1727
|
+
* takes lowercase `assetType` and denominates WETH as "eth" (the same
|
|
1728
|
+
* spelling `resolveWithdrawnAmounts` normalizes on the way in). Anything
|
|
1729
|
+
* unrecognised returns undefined so the request stays unfiltered rather
|
|
1730
|
+
* than silently narrowing to nothing.
|
|
1731
|
+
*/
|
|
1732
|
+
static toZyfaiAssetType(tokenSymbol) {
|
|
1733
|
+
switch (tokenSymbol?.toUpperCase()) {
|
|
1734
|
+
case "USDC":
|
|
1735
|
+
return "usdc";
|
|
1736
|
+
case "WETH":
|
|
1737
|
+
case "ETH":
|
|
1738
|
+
return "eth";
|
|
1739
|
+
case "EURC":
|
|
1740
|
+
return "eurc";
|
|
1741
|
+
default:
|
|
1742
|
+
return void 0;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1725
1745
|
async getHistory(state, chainId, options) {
|
|
1726
1746
|
const { smartWallet, chainId: validChainId } = await this.resolveSmartWallet(state, chainId);
|
|
1727
1747
|
const limit = options?.limit ?? 10;
|
|
1748
|
+
const assetType = _ZyfaiAgent.toZyfaiAssetType(options?.tokenSymbol);
|
|
1728
1749
|
const cursor = options?.cursor ? decodeHistoryCursor(options.cursor) : null;
|
|
1729
1750
|
const toDate = cursor?.toDate ?? options?.toDate ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1730
1751
|
let offset = cursor?.rawOffset ?? 0;
|
|
@@ -1738,7 +1759,12 @@ var ZyfaiAgent = class {
|
|
|
1738
1759
|
limit: backendPageSize,
|
|
1739
1760
|
offset,
|
|
1740
1761
|
fromDate: options?.fromDate,
|
|
1741
|
-
toDate
|
|
1762
|
+
toDate,
|
|
1763
|
+
// Filtering server-side means the pages coming back are already the
|
|
1764
|
+
// asset the caller asked for, so the loop below fills `limit` from
|
|
1765
|
+
// relevant entries instead of spending its budget on the other
|
|
1766
|
+
// asset's rows and handing back a page that filters to nothing.
|
|
1767
|
+
assetType
|
|
1742
1768
|
});
|
|
1743
1769
|
raw.data.forEach((entry, idx) => {
|
|
1744
1770
|
if (entry.chainId === validChainId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owney/sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.11",
|
|
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.
|
|
26
|
+
"@zyfai/sdk": "0.2.50",
|
|
27
27
|
"siwe": "^3.0.0",
|
|
28
28
|
"viem": "^2.48.1"
|
|
29
29
|
},
|