@zyfai/sdk 0.2.17 → 0.2.19

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.d.mts CHANGED
@@ -192,8 +192,8 @@ interface APYPerStrategy {
192
192
  total_rebalances: number;
193
193
  created_at: string;
194
194
  strategy: string;
195
- average_apy_without_fee: number;
196
- average_apy_with_rzfi_without_fee: number;
195
+ average_apy_with_fee: number;
196
+ average_apy_with_rzfi_with_fee: number;
197
197
  }
198
198
  interface APYPerStrategyResponse {
199
199
  success: boolean;
package/dist/index.d.ts CHANGED
@@ -192,8 +192,8 @@ interface APYPerStrategy {
192
192
  total_rebalances: number;
193
193
  created_at: string;
194
194
  strategy: string;
195
- average_apy_without_fee: number;
196
- average_apy_with_rzfi_without_fee: number;
195
+ average_apy_with_fee: number;
196
+ average_apy_with_rzfi_with_fee: number;
197
197
  }
198
198
  interface APYPerStrategyResponse {
199
199
  success: boolean;
package/dist/index.js CHANGED
@@ -671,6 +671,35 @@ function convertStrategyToPublic(obj) {
671
671
  function convertStrategiesToPublic(array) {
672
672
  return array.map((item) => convertStrategyToPublic(item));
673
673
  }
674
+ function convertStrategyToPublicAndNaming(obj) {
675
+ const result = { ...obj };
676
+ if (result.strategy) {
677
+ try {
678
+ result.strategy = toPublicStrategy(result.strategy);
679
+ } catch {
680
+ }
681
+ }
682
+ if (result.average_apy_without_fee !== void 0) {
683
+ result.average_apy_with_fee = result.average_apy_without_fee;
684
+ delete result.average_apy_without_fee;
685
+ }
686
+ if (result.average_apy_with_rzfi_without_fee !== void 0) {
687
+ result.average_apy_with_rzfi_with_fee = result.average_apy_with_rzfi_without_fee;
688
+ delete result.average_apy_with_rzfi_without_fee;
689
+ }
690
+ if (result.events_average_apy_without_fee !== void 0) {
691
+ result.events_average_apy_with_fee = result.events_average_apy_without_fee;
692
+ delete result.events_average_apy_without_fee;
693
+ }
694
+ if (result.events_average_apy_with_rzfi_without_fee !== void 0) {
695
+ result.events_average_apy_with_rzfi_with_fee = result.events_average_apy_with_rzfi_without_fee;
696
+ delete result.events_average_apy_with_rzfi_without_fee;
697
+ }
698
+ return result;
699
+ }
700
+ function convertStrategiesToPublicAndNaming(array) {
701
+ return array.map((item) => convertStrategyToPublicAndNaming(item));
702
+ }
674
703
 
675
704
  // src/core/ZyfaiSDK.ts
676
705
  var import_siwe = require("siwe");
@@ -876,8 +905,13 @@ var _ZyfaiSDK = class _ZyfaiSDK {
876
905
  const hasMatchingChain = protocol.chains.some(
877
906
  (chain) => chains.includes(chain)
878
907
  );
879
- const hasMatchingStrategy = protocol.strategies?.includes(convertedStrategy);
880
- return hasMatchingChain && hasMatchingStrategy;
908
+ if (!hasMatchingChain) {
909
+ return false;
910
+ }
911
+ if (convertedStrategy === "degen_strategy") {
912
+ return protocol.strategies?.includes("safe_strategy") || protocol.strategies?.includes("degen_strategy");
913
+ }
914
+ return protocol.strategies?.includes("safe_strategy");
881
915
  }).map((protocol) => protocol.id);
882
916
  const response = await this.updateUserProfile({
883
917
  protocols: filteredProtocolIds
@@ -1878,7 +1912,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
1878
1912
  const response = await this.httpClient.dataGet(
1879
1913
  DATA_ENDPOINTS.APY_PER_STRATEGY(crossChain, days, internalStrategyShort)
1880
1914
  );
1881
- const convertedData = convertStrategiesToPublic(
1915
+ const convertedData = convertStrategiesToPublicAndNaming(
1882
1916
  response.data || []
1883
1917
  );
1884
1918
  return {
package/dist/index.mjs CHANGED
@@ -649,6 +649,35 @@ function convertStrategyToPublic(obj) {
649
649
  function convertStrategiesToPublic(array) {
650
650
  return array.map((item) => convertStrategyToPublic(item));
651
651
  }
652
+ function convertStrategyToPublicAndNaming(obj) {
653
+ const result = { ...obj };
654
+ if (result.strategy) {
655
+ try {
656
+ result.strategy = toPublicStrategy(result.strategy);
657
+ } catch {
658
+ }
659
+ }
660
+ if (result.average_apy_without_fee !== void 0) {
661
+ result.average_apy_with_fee = result.average_apy_without_fee;
662
+ delete result.average_apy_without_fee;
663
+ }
664
+ if (result.average_apy_with_rzfi_without_fee !== void 0) {
665
+ result.average_apy_with_rzfi_with_fee = result.average_apy_with_rzfi_without_fee;
666
+ delete result.average_apy_with_rzfi_without_fee;
667
+ }
668
+ if (result.events_average_apy_without_fee !== void 0) {
669
+ result.events_average_apy_with_fee = result.events_average_apy_without_fee;
670
+ delete result.events_average_apy_without_fee;
671
+ }
672
+ if (result.events_average_apy_with_rzfi_without_fee !== void 0) {
673
+ result.events_average_apy_with_rzfi_with_fee = result.events_average_apy_with_rzfi_without_fee;
674
+ delete result.events_average_apy_with_rzfi_without_fee;
675
+ }
676
+ return result;
677
+ }
678
+ function convertStrategiesToPublicAndNaming(array) {
679
+ return array.map((item) => convertStrategyToPublicAndNaming(item));
680
+ }
652
681
 
653
682
  // src/core/ZyfaiSDK.ts
654
683
  import { SiweMessage } from "siwe";
@@ -854,8 +883,13 @@ var _ZyfaiSDK = class _ZyfaiSDK {
854
883
  const hasMatchingChain = protocol.chains.some(
855
884
  (chain) => chains.includes(chain)
856
885
  );
857
- const hasMatchingStrategy = protocol.strategies?.includes(convertedStrategy);
858
- return hasMatchingChain && hasMatchingStrategy;
886
+ if (!hasMatchingChain) {
887
+ return false;
888
+ }
889
+ if (convertedStrategy === "degen_strategy") {
890
+ return protocol.strategies?.includes("safe_strategy") || protocol.strategies?.includes("degen_strategy");
891
+ }
892
+ return protocol.strategies?.includes("safe_strategy");
859
893
  }).map((protocol) => protocol.id);
860
894
  const response = await this.updateUserProfile({
861
895
  protocols: filteredProtocolIds
@@ -1856,7 +1890,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
1856
1890
  const response = await this.httpClient.dataGet(
1857
1891
  DATA_ENDPOINTS.APY_PER_STRATEGY(crossChain, days, internalStrategyShort)
1858
1892
  );
1859
- const convertedData = convertStrategiesToPublic(
1893
+ const convertedData = convertStrategiesToPublicAndNaming(
1860
1894
  response.data || []
1861
1895
  );
1862
1896
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyfai/sdk",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "description": "TypeScript SDK for Zyfai Yield Optimization Engine - Deploy Safe smart wallets, manage session keys, and interact with DeFi protocols",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",