@zyfai/sdk 1.3.0 → 1.3.2
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.js +19 -5
- package/dist/index.mjs +19 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1001,10 +1001,12 @@ var ASSET_CONFIGS = {
|
|
|
1001
1001
|
decimals: 6,
|
|
1002
1002
|
tokenSymbols: ["USDT"],
|
|
1003
1003
|
tokenSymbolsByChainId: {
|
|
1004
|
-
1: "USDT"
|
|
1004
|
+
1: "USDT",
|
|
1005
|
+
42161: "USDT"
|
|
1005
1006
|
},
|
|
1006
1007
|
addresses: {
|
|
1007
|
-
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
|
|
1008
|
+
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
1009
|
+
42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
|
|
1008
1010
|
},
|
|
1009
1011
|
enabled: true
|
|
1010
1012
|
},
|
|
@@ -1631,6 +1633,20 @@ function toInternalStrategy(publicStrategy) {
|
|
|
1631
1633
|
);
|
|
1632
1634
|
}
|
|
1633
1635
|
}
|
|
1636
|
+
function toDataStrategy(publicStrategy) {
|
|
1637
|
+
switch (publicStrategy) {
|
|
1638
|
+
case "conservative":
|
|
1639
|
+
return "safe";
|
|
1640
|
+
case "aggressive":
|
|
1641
|
+
return "degen";
|
|
1642
|
+
case "yieldmaxxing":
|
|
1643
|
+
return "async";
|
|
1644
|
+
default:
|
|
1645
|
+
throw new Error(
|
|
1646
|
+
`Invalid public strategy: ${publicStrategy}. Must be ${PUBLIC_STRATEGIES}.`
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1634
1650
|
function toPublicStrategy(internalStrategy) {
|
|
1635
1651
|
if (internalStrategy === "safe_strategy" || internalStrategy === "safe") {
|
|
1636
1652
|
return "conservative";
|
|
@@ -5620,13 +5636,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5620
5636
|
*/
|
|
5621
5637
|
async getAPYPerStrategy(crossChain = false, days = 7, strategy = "conservative", chainId, tokenSymbol) {
|
|
5622
5638
|
try {
|
|
5623
|
-
const internalStrategy = toInternalStrategy(strategy);
|
|
5624
|
-
const internalStrategyShort = internalStrategy === "safe_strategy" ? "safe" : "degen";
|
|
5625
5639
|
const response = await this.httpClient.dataGet(
|
|
5626
5640
|
DATA_ENDPOINTS.APY_PER_STRATEGY({
|
|
5627
5641
|
isCrossChain: crossChain,
|
|
5628
5642
|
days,
|
|
5629
|
-
strategy:
|
|
5643
|
+
strategy: toDataStrategy(strategy),
|
|
5630
5644
|
chainId,
|
|
5631
5645
|
tokenSymbol
|
|
5632
5646
|
})
|
package/dist/index.mjs
CHANGED
|
@@ -940,10 +940,12 @@ var ASSET_CONFIGS = {
|
|
|
940
940
|
decimals: 6,
|
|
941
941
|
tokenSymbols: ["USDT"],
|
|
942
942
|
tokenSymbolsByChainId: {
|
|
943
|
-
1: "USDT"
|
|
943
|
+
1: "USDT",
|
|
944
|
+
42161: "USDT"
|
|
944
945
|
},
|
|
945
946
|
addresses: {
|
|
946
|
-
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
|
|
947
|
+
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
948
|
+
42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
|
|
947
949
|
},
|
|
948
950
|
enabled: true
|
|
949
951
|
},
|
|
@@ -1589,6 +1591,20 @@ function toInternalStrategy(publicStrategy) {
|
|
|
1589
1591
|
);
|
|
1590
1592
|
}
|
|
1591
1593
|
}
|
|
1594
|
+
function toDataStrategy(publicStrategy) {
|
|
1595
|
+
switch (publicStrategy) {
|
|
1596
|
+
case "conservative":
|
|
1597
|
+
return "safe";
|
|
1598
|
+
case "aggressive":
|
|
1599
|
+
return "degen";
|
|
1600
|
+
case "yieldmaxxing":
|
|
1601
|
+
return "async";
|
|
1602
|
+
default:
|
|
1603
|
+
throw new Error(
|
|
1604
|
+
`Invalid public strategy: ${publicStrategy}. Must be ${PUBLIC_STRATEGIES}.`
|
|
1605
|
+
);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1592
1608
|
function toPublicStrategy(internalStrategy) {
|
|
1593
1609
|
if (internalStrategy === "safe_strategy" || internalStrategy === "safe") {
|
|
1594
1610
|
return "conservative";
|
|
@@ -5578,13 +5594,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5578
5594
|
*/
|
|
5579
5595
|
async getAPYPerStrategy(crossChain = false, days = 7, strategy = "conservative", chainId, tokenSymbol) {
|
|
5580
5596
|
try {
|
|
5581
|
-
const internalStrategy = toInternalStrategy(strategy);
|
|
5582
|
-
const internalStrategyShort = internalStrategy === "safe_strategy" ? "safe" : "degen";
|
|
5583
5597
|
const response = await this.httpClient.dataGet(
|
|
5584
5598
|
DATA_ENDPOINTS.APY_PER_STRATEGY({
|
|
5585
5599
|
isCrossChain: crossChain,
|
|
5586
5600
|
days,
|
|
5587
|
-
strategy:
|
|
5601
|
+
strategy: toDataStrategy(strategy),
|
|
5588
5602
|
chainId,
|
|
5589
5603
|
tokenSymbol
|
|
5590
5604
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyfai/sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "TypeScript SDK for self-custodial Zyfai yield agents: discover DeFi opportunities and manage deposits, withdrawals, positions, and strategies across Ethereum, Base, and Arbitrum",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|