@zyfai/sdk 0.2.24 → 0.2.26
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 +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +29 -18
- package/dist/index.mjs +29 -18
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -22,7 +22,6 @@ interface DeploySafeResponse {
|
|
|
22
22
|
txHash: string;
|
|
23
23
|
status: "deployed" | "failed";
|
|
24
24
|
}
|
|
25
|
-
/** @internal */
|
|
26
25
|
interface UpdateUserProfileRequest {
|
|
27
26
|
strategy?: string;
|
|
28
27
|
protocols?: string[];
|
|
@@ -34,7 +33,7 @@ interface UpdateUserProfileRequest {
|
|
|
34
33
|
crosschainStrategy?: boolean;
|
|
35
34
|
splitting?: boolean;
|
|
36
35
|
minSplits?: number;
|
|
37
|
-
asset?: "
|
|
36
|
+
asset?: "USDC" | "WETH";
|
|
38
37
|
}
|
|
39
38
|
interface UpdateUserProfileResponse {
|
|
40
39
|
success: boolean;
|
|
@@ -52,7 +51,7 @@ interface UpdateUserProfileResponse {
|
|
|
52
51
|
splitting?: boolean;
|
|
53
52
|
minSplits?: number;
|
|
54
53
|
customization?: Record<string, any>;
|
|
55
|
-
asset?: "
|
|
54
|
+
asset?: "USDC" | "WETH";
|
|
56
55
|
}
|
|
57
56
|
/** @internal */
|
|
58
57
|
interface AddSessionKeyResponse {
|
|
@@ -917,7 +916,7 @@ declare class ZyfaiSDK {
|
|
|
917
916
|
* console.log("Chains:", user.user.chains);
|
|
918
917
|
* ```
|
|
919
918
|
*/
|
|
920
|
-
getUserDetails(asset?: "
|
|
919
|
+
getUserDetails(asset?: "USDC" | "WETH"): Promise<UpdateUserProfileResponse>;
|
|
921
920
|
/**
|
|
922
921
|
* Get total value locked (TVL) across all Zyfai accounts
|
|
923
922
|
*
|
|
@@ -1314,4 +1313,4 @@ declare class ZyfaiSDK {
|
|
|
1314
1313
|
registerAgentOnIdentityRegistry(smartWallet: string, chainId: SupportedChainId): Promise<RegisterAgentResponse>;
|
|
1315
1314
|
}
|
|
1316
1315
|
|
|
1317
|
-
export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type ApyPosition, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type LogDepositResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, type PolicyData, type Pool, type Portfolio, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, type SDKConfig, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
|
|
1316
|
+
export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type ApyPosition, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type LogDepositResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, type PolicyData, type Pool, type Portfolio, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, type SDKConfig, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ interface DeploySafeResponse {
|
|
|
22
22
|
txHash: string;
|
|
23
23
|
status: "deployed" | "failed";
|
|
24
24
|
}
|
|
25
|
-
/** @internal */
|
|
26
25
|
interface UpdateUserProfileRequest {
|
|
27
26
|
strategy?: string;
|
|
28
27
|
protocols?: string[];
|
|
@@ -34,7 +33,7 @@ interface UpdateUserProfileRequest {
|
|
|
34
33
|
crosschainStrategy?: boolean;
|
|
35
34
|
splitting?: boolean;
|
|
36
35
|
minSplits?: number;
|
|
37
|
-
asset?: "
|
|
36
|
+
asset?: "USDC" | "WETH";
|
|
38
37
|
}
|
|
39
38
|
interface UpdateUserProfileResponse {
|
|
40
39
|
success: boolean;
|
|
@@ -52,7 +51,7 @@ interface UpdateUserProfileResponse {
|
|
|
52
51
|
splitting?: boolean;
|
|
53
52
|
minSplits?: number;
|
|
54
53
|
customization?: Record<string, any>;
|
|
55
|
-
asset?: "
|
|
54
|
+
asset?: "USDC" | "WETH";
|
|
56
55
|
}
|
|
57
56
|
/** @internal */
|
|
58
57
|
interface AddSessionKeyResponse {
|
|
@@ -917,7 +916,7 @@ declare class ZyfaiSDK {
|
|
|
917
916
|
* console.log("Chains:", user.user.chains);
|
|
918
917
|
* ```
|
|
919
918
|
*/
|
|
920
|
-
getUserDetails(asset?: "
|
|
919
|
+
getUserDetails(asset?: "USDC" | "WETH"): Promise<UpdateUserProfileResponse>;
|
|
921
920
|
/**
|
|
922
921
|
* Get total value locked (TVL) across all Zyfai accounts
|
|
923
922
|
*
|
|
@@ -1314,4 +1313,4 @@ declare class ZyfaiSDK {
|
|
|
1314
1313
|
registerAgentOnIdentityRegistry(smartWallet: string, chainId: SupportedChainId): Promise<RegisterAgentResponse>;
|
|
1315
1314
|
}
|
|
1316
1315
|
|
|
1317
|
-
export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type ApyPosition, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type LogDepositResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, type PolicyData, type Pool, type Portfolio, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, type SDKConfig, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
|
|
1316
|
+
export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type ApyPosition, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type LogDepositResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, type PolicyData, type Pool, type Portfolio, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, type SDKConfig, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
|
package/dist/index.js
CHANGED
|
@@ -769,6 +769,15 @@ function convertStrategyToPublic(obj) {
|
|
|
769
769
|
return result;
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
|
+
function convertAssetInternally(asset) {
|
|
773
|
+
if (asset === "USDC") {
|
|
774
|
+
return "usdc";
|
|
775
|
+
}
|
|
776
|
+
if (asset === "WETH") {
|
|
777
|
+
return "eth";
|
|
778
|
+
}
|
|
779
|
+
throw new Error(`Invalid asset: ${asset}. Must be "USDC" or "WETH".`);
|
|
780
|
+
}
|
|
772
781
|
function convertStrategiesToPublic(array) {
|
|
773
782
|
return array.map((item) => convertStrategyToPublic(item));
|
|
774
783
|
}
|
|
@@ -908,7 +917,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
908
917
|
async updateUserProfile(request) {
|
|
909
918
|
try {
|
|
910
919
|
await this.authenticateUser();
|
|
911
|
-
const asset = request.asset || "
|
|
920
|
+
const asset = request.asset || "USDC";
|
|
921
|
+
const internalAsset = convertAssetInternally(asset);
|
|
912
922
|
let rebalanceStrategy;
|
|
913
923
|
if (request.strategy) {
|
|
914
924
|
if (!isValidPublicStrategy(request.strategy)) {
|
|
@@ -931,7 +941,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
931
941
|
if (request.protocols !== void 0) assetSettings.protocols = request.protocols;
|
|
932
942
|
const payload = {
|
|
933
943
|
assetTypeSettings: {
|
|
934
|
-
[
|
|
944
|
+
[internalAsset]: assetSettings
|
|
935
945
|
}
|
|
936
946
|
};
|
|
937
947
|
if (request.omniAccount !== void 0) payload.omniAccount = request.omniAccount;
|
|
@@ -968,11 +978,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
968
978
|
async pauseAgent() {
|
|
969
979
|
try {
|
|
970
980
|
await this.updateUserProfile({
|
|
971
|
-
asset: "
|
|
981
|
+
asset: "USDC",
|
|
972
982
|
protocols: []
|
|
973
983
|
});
|
|
974
984
|
const response = await this.updateUserProfile({
|
|
975
|
-
asset: "
|
|
985
|
+
asset: "WETH",
|
|
976
986
|
protocols: []
|
|
977
987
|
});
|
|
978
988
|
return response;
|
|
@@ -1000,8 +1010,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
1000
1010
|
*/
|
|
1001
1011
|
async resumeAgent() {
|
|
1002
1012
|
try {
|
|
1003
|
-
const userDetailsUSDC = await this.getUserDetails("
|
|
1004
|
-
const userDetailsETH = await this.getUserDetails("
|
|
1013
|
+
const userDetailsUSDC = await this.getUserDetails("USDC");
|
|
1014
|
+
const userDetailsETH = await this.getUserDetails("WETH");
|
|
1005
1015
|
const chains = userDetailsUSDC.chains && userDetailsUSDC.chains.length > 0 ? userDetailsUSDC.chains : [8453, 42161];
|
|
1006
1016
|
const allProtocols = await this.httpClient.get(
|
|
1007
1017
|
ENDPOINTS.PROTOCOLS()
|
|
@@ -1025,11 +1035,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
1025
1035
|
const usdcProtocols = filterProtocolsByStrategy(usdcStrategy);
|
|
1026
1036
|
const ethProtocols = filterProtocolsByStrategy(ethStrategy);
|
|
1027
1037
|
await this.updateUserProfile({
|
|
1028
|
-
asset: "
|
|
1038
|
+
asset: "USDC",
|
|
1029
1039
|
protocols: usdcProtocols
|
|
1030
1040
|
});
|
|
1031
1041
|
const updatedUserDetailsETH = await this.updateUserProfile({
|
|
1032
|
-
asset: "
|
|
1042
|
+
asset: "WETH",
|
|
1033
1043
|
protocols: ethProtocols
|
|
1034
1044
|
});
|
|
1035
1045
|
return updatedUserDetailsETH;
|
|
@@ -1631,7 +1641,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
1631
1641
|
});
|
|
1632
1642
|
await this.updateUserProfile({
|
|
1633
1643
|
protocols: protocolIds,
|
|
1634
|
-
asset: "
|
|
1644
|
+
asset: "WETH"
|
|
1635
1645
|
});
|
|
1636
1646
|
} catch (error) {
|
|
1637
1647
|
console.warn(
|
|
@@ -2008,26 +2018,27 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2008
2018
|
* console.log("Chains:", user.user.chains);
|
|
2009
2019
|
* ```
|
|
2010
2020
|
*/
|
|
2011
|
-
async getUserDetails(asset = "
|
|
2021
|
+
async getUserDetails(asset = "USDC") {
|
|
2012
2022
|
try {
|
|
2013
2023
|
await this.authenticateUser();
|
|
2014
2024
|
const response = await this.httpClient.get(ENDPOINTS.USER_ME);
|
|
2025
|
+
const internalAsset = convertAssetInternally(asset);
|
|
2015
2026
|
const convertedResponse = convertStrategyToPublic(response);
|
|
2016
2027
|
return {
|
|
2017
2028
|
success: true,
|
|
2018
2029
|
agentName: convertedResponse.agentName,
|
|
2019
2030
|
smartWallet: convertedResponse.smartWallet,
|
|
2020
|
-
chains: convertedResponse.assetTypeSettings?.[
|
|
2031
|
+
chains: convertedResponse.assetTypeSettings?.[internalAsset]?.chains || [],
|
|
2021
2032
|
hasActiveSessionKey: convertedResponse.hasActiveSessionKey || false,
|
|
2022
2033
|
omniAccount: convertedResponse.omniAccount,
|
|
2023
2034
|
asset,
|
|
2024
|
-
autoSelectProtocols: convertedResponse.assetTypeSettings?.[
|
|
2025
|
-
strategy: convertedResponse.assetTypeSettings?.[
|
|
2026
|
-
autocompounding: convertedResponse.assetTypeSettings?.[
|
|
2027
|
-
crosschainStrategy: convertedResponse.assetTypeSettings?.[
|
|
2028
|
-
splitting: convertedResponse.assetTypeSettings?.[
|
|
2029
|
-
minSplits: convertedResponse.assetTypeSettings?.[
|
|
2030
|
-
protocols: convertedResponse.assetTypeSettings?.[
|
|
2035
|
+
autoSelectProtocols: convertedResponse.assetTypeSettings?.[internalAsset]?.autoSelectProtocols,
|
|
2036
|
+
strategy: convertedResponse.assetTypeSettings?.[internalAsset]?.rebalanceStrategy,
|
|
2037
|
+
autocompounding: convertedResponse.assetTypeSettings?.[internalAsset]?.autocompounding,
|
|
2038
|
+
crosschainStrategy: convertedResponse.assetTypeSettings?.[internalAsset]?.crosschainStrategy,
|
|
2039
|
+
splitting: convertedResponse.assetTypeSettings?.[internalAsset]?.splitting,
|
|
2040
|
+
minSplits: convertedResponse.assetTypeSettings?.[internalAsset]?.minSplits || 0,
|
|
2041
|
+
protocols: convertedResponse.assetTypeSettings?.[internalAsset]?.protocols || [],
|
|
2031
2042
|
customization: convertedResponse.customization
|
|
2032
2043
|
};
|
|
2033
2044
|
} catch (error) {
|
package/dist/index.mjs
CHANGED
|
@@ -747,6 +747,15 @@ function convertStrategyToPublic(obj) {
|
|
|
747
747
|
return result;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
+
function convertAssetInternally(asset) {
|
|
751
|
+
if (asset === "USDC") {
|
|
752
|
+
return "usdc";
|
|
753
|
+
}
|
|
754
|
+
if (asset === "WETH") {
|
|
755
|
+
return "eth";
|
|
756
|
+
}
|
|
757
|
+
throw new Error(`Invalid asset: ${asset}. Must be "USDC" or "WETH".`);
|
|
758
|
+
}
|
|
750
759
|
function convertStrategiesToPublic(array) {
|
|
751
760
|
return array.map((item) => convertStrategyToPublic(item));
|
|
752
761
|
}
|
|
@@ -886,7 +895,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
886
895
|
async updateUserProfile(request) {
|
|
887
896
|
try {
|
|
888
897
|
await this.authenticateUser();
|
|
889
|
-
const asset = request.asset || "
|
|
898
|
+
const asset = request.asset || "USDC";
|
|
899
|
+
const internalAsset = convertAssetInternally(asset);
|
|
890
900
|
let rebalanceStrategy;
|
|
891
901
|
if (request.strategy) {
|
|
892
902
|
if (!isValidPublicStrategy(request.strategy)) {
|
|
@@ -909,7 +919,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
909
919
|
if (request.protocols !== void 0) assetSettings.protocols = request.protocols;
|
|
910
920
|
const payload = {
|
|
911
921
|
assetTypeSettings: {
|
|
912
|
-
[
|
|
922
|
+
[internalAsset]: assetSettings
|
|
913
923
|
}
|
|
914
924
|
};
|
|
915
925
|
if (request.omniAccount !== void 0) payload.omniAccount = request.omniAccount;
|
|
@@ -946,11 +956,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
946
956
|
async pauseAgent() {
|
|
947
957
|
try {
|
|
948
958
|
await this.updateUserProfile({
|
|
949
|
-
asset: "
|
|
959
|
+
asset: "USDC",
|
|
950
960
|
protocols: []
|
|
951
961
|
});
|
|
952
962
|
const response = await this.updateUserProfile({
|
|
953
|
-
asset: "
|
|
963
|
+
asset: "WETH",
|
|
954
964
|
protocols: []
|
|
955
965
|
});
|
|
956
966
|
return response;
|
|
@@ -978,8 +988,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
978
988
|
*/
|
|
979
989
|
async resumeAgent() {
|
|
980
990
|
try {
|
|
981
|
-
const userDetailsUSDC = await this.getUserDetails("
|
|
982
|
-
const userDetailsETH = await this.getUserDetails("
|
|
991
|
+
const userDetailsUSDC = await this.getUserDetails("USDC");
|
|
992
|
+
const userDetailsETH = await this.getUserDetails("WETH");
|
|
983
993
|
const chains = userDetailsUSDC.chains && userDetailsUSDC.chains.length > 0 ? userDetailsUSDC.chains : [8453, 42161];
|
|
984
994
|
const allProtocols = await this.httpClient.get(
|
|
985
995
|
ENDPOINTS.PROTOCOLS()
|
|
@@ -1003,11 +1013,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
1003
1013
|
const usdcProtocols = filterProtocolsByStrategy(usdcStrategy);
|
|
1004
1014
|
const ethProtocols = filterProtocolsByStrategy(ethStrategy);
|
|
1005
1015
|
await this.updateUserProfile({
|
|
1006
|
-
asset: "
|
|
1016
|
+
asset: "USDC",
|
|
1007
1017
|
protocols: usdcProtocols
|
|
1008
1018
|
});
|
|
1009
1019
|
const updatedUserDetailsETH = await this.updateUserProfile({
|
|
1010
|
-
asset: "
|
|
1020
|
+
asset: "WETH",
|
|
1011
1021
|
protocols: ethProtocols
|
|
1012
1022
|
});
|
|
1013
1023
|
return updatedUserDetailsETH;
|
|
@@ -1609,7 +1619,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
1609
1619
|
});
|
|
1610
1620
|
await this.updateUserProfile({
|
|
1611
1621
|
protocols: protocolIds,
|
|
1612
|
-
asset: "
|
|
1622
|
+
asset: "WETH"
|
|
1613
1623
|
});
|
|
1614
1624
|
} catch (error) {
|
|
1615
1625
|
console.warn(
|
|
@@ -1986,26 +1996,27 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
1986
1996
|
* console.log("Chains:", user.user.chains);
|
|
1987
1997
|
* ```
|
|
1988
1998
|
*/
|
|
1989
|
-
async getUserDetails(asset = "
|
|
1999
|
+
async getUserDetails(asset = "USDC") {
|
|
1990
2000
|
try {
|
|
1991
2001
|
await this.authenticateUser();
|
|
1992
2002
|
const response = await this.httpClient.get(ENDPOINTS.USER_ME);
|
|
2003
|
+
const internalAsset = convertAssetInternally(asset);
|
|
1993
2004
|
const convertedResponse = convertStrategyToPublic(response);
|
|
1994
2005
|
return {
|
|
1995
2006
|
success: true,
|
|
1996
2007
|
agentName: convertedResponse.agentName,
|
|
1997
2008
|
smartWallet: convertedResponse.smartWallet,
|
|
1998
|
-
chains: convertedResponse.assetTypeSettings?.[
|
|
2009
|
+
chains: convertedResponse.assetTypeSettings?.[internalAsset]?.chains || [],
|
|
1999
2010
|
hasActiveSessionKey: convertedResponse.hasActiveSessionKey || false,
|
|
2000
2011
|
omniAccount: convertedResponse.omniAccount,
|
|
2001
2012
|
asset,
|
|
2002
|
-
autoSelectProtocols: convertedResponse.assetTypeSettings?.[
|
|
2003
|
-
strategy: convertedResponse.assetTypeSettings?.[
|
|
2004
|
-
autocompounding: convertedResponse.assetTypeSettings?.[
|
|
2005
|
-
crosschainStrategy: convertedResponse.assetTypeSettings?.[
|
|
2006
|
-
splitting: convertedResponse.assetTypeSettings?.[
|
|
2007
|
-
minSplits: convertedResponse.assetTypeSettings?.[
|
|
2008
|
-
protocols: convertedResponse.assetTypeSettings?.[
|
|
2013
|
+
autoSelectProtocols: convertedResponse.assetTypeSettings?.[internalAsset]?.autoSelectProtocols,
|
|
2014
|
+
strategy: convertedResponse.assetTypeSettings?.[internalAsset]?.rebalanceStrategy,
|
|
2015
|
+
autocompounding: convertedResponse.assetTypeSettings?.[internalAsset]?.autocompounding,
|
|
2016
|
+
crosschainStrategy: convertedResponse.assetTypeSettings?.[internalAsset]?.crosschainStrategy,
|
|
2017
|
+
splitting: convertedResponse.assetTypeSettings?.[internalAsset]?.splitting,
|
|
2018
|
+
minSplits: convertedResponse.assetTypeSettings?.[internalAsset]?.minSplits || 0,
|
|
2019
|
+
protocols: convertedResponse.assetTypeSettings?.[internalAsset]?.protocols || [],
|
|
2009
2020
|
customization: convertedResponse.customization
|
|
2010
2021
|
};
|
|
2011
2022
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyfai/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.26",
|
|
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",
|