@zyfai/sdk 1.3.0 → 1.4.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/README.md +1 -0
- package/dist/index.d.mts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +34 -8
- package/dist/index.mjs +34 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1027,6 +1027,7 @@ const history = await sdk.getHistory(walletAddress, 8453, {
|
|
|
1027
1027
|
limit: 50,
|
|
1028
1028
|
fromDate: "2024-01-01",
|
|
1029
1029
|
assetType: "eth", // usdc | eth | eurc | usdt | pyusd | nvdac | wbtc
|
|
1030
|
+
// rebalanceLegs: true marks async rebalance request, claim, and redeploy rows
|
|
1030
1031
|
});
|
|
1031
1032
|
history.data.forEach((tx) => {
|
|
1032
1033
|
console.log(tx.action, tx.transactionHash);
|
package/dist/index.d.mts
CHANGED
|
@@ -1049,6 +1049,12 @@ interface CustomizeBatchRequest {
|
|
|
1049
1049
|
interface CustomizeBatchResponse {
|
|
1050
1050
|
success: boolean;
|
|
1051
1051
|
}
|
|
1052
|
+
interface GetAvailablePoolsOptions {
|
|
1053
|
+
/** Omit pools whose status is not live. Default false. */
|
|
1054
|
+
liveOnly?: boolean;
|
|
1055
|
+
/** Include each pool's status. Default false. */
|
|
1056
|
+
includeStatus?: boolean;
|
|
1057
|
+
}
|
|
1052
1058
|
interface GetPoolsResponse {
|
|
1053
1059
|
success: boolean;
|
|
1054
1060
|
pools: string[];
|
|
@@ -2561,6 +2567,8 @@ declare class ZyfaiSDK {
|
|
|
2561
2567
|
fromDate?: string;
|
|
2562
2568
|
toDate?: string;
|
|
2563
2569
|
assetType?: HistoryAssetType;
|
|
2570
|
+
/** Mark async rebalance request, claim, and redeploy rows as rebalance. */
|
|
2571
|
+
rebalanceLegs?: boolean;
|
|
2564
2572
|
}): Promise<HistoryResponse>;
|
|
2565
2573
|
/**
|
|
2566
2574
|
* Get onchain earnings for a wallet.
|
|
@@ -2927,6 +2935,7 @@ declare class ZyfaiSDK {
|
|
|
2927
2935
|
*
|
|
2928
2936
|
* @param protocolId - The protocol UUID
|
|
2929
2937
|
* @param strategy - Optional {@link Strategy} filter
|
|
2938
|
+
* @param options - `liveOnly` omits not-live pools. `includeStatus` adds each pool's status. Both default off.
|
|
2930
2939
|
* @returns List of available pool names
|
|
2931
2940
|
*
|
|
2932
2941
|
* @example
|
|
@@ -2942,7 +2951,7 @@ declare class ZyfaiSDK {
|
|
|
2942
2951
|
* );
|
|
2943
2952
|
* ```
|
|
2944
2953
|
*/
|
|
2945
|
-
getAvailablePools(protocolId: string, strategy?: Strategy): Promise<GetPoolsResponse>;
|
|
2954
|
+
getAvailablePools(protocolId: string, strategy?: Strategy, options?: GetAvailablePoolsOptions): Promise<GetPoolsResponse>;
|
|
2946
2955
|
/**
|
|
2947
2956
|
* Simulate the best yield positions for a given amount, splitting it across
|
|
2948
2957
|
* the top-ranked pools (up to minSplit positions) for the requested chains/strategy.
|
|
@@ -3354,4 +3363,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
|
|
|
3354
3363
|
*/
|
|
3355
3364
|
declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
|
|
3356
3365
|
|
|
3357
|
-
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstPermitDepositStatus, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryAssetType, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, type RzfiClaimTransaction, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeAssetType, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
|
|
3366
|
+
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstPermitDepositStatus, type FirstTopupResponse, type GetAvailablePoolsOptions, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryAssetType, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, type RzfiClaimTransaction, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeAssetType, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
|
package/dist/index.d.ts
CHANGED
|
@@ -1049,6 +1049,12 @@ interface CustomizeBatchRequest {
|
|
|
1049
1049
|
interface CustomizeBatchResponse {
|
|
1050
1050
|
success: boolean;
|
|
1051
1051
|
}
|
|
1052
|
+
interface GetAvailablePoolsOptions {
|
|
1053
|
+
/** Omit pools whose status is not live. Default false. */
|
|
1054
|
+
liveOnly?: boolean;
|
|
1055
|
+
/** Include each pool's status. Default false. */
|
|
1056
|
+
includeStatus?: boolean;
|
|
1057
|
+
}
|
|
1052
1058
|
interface GetPoolsResponse {
|
|
1053
1059
|
success: boolean;
|
|
1054
1060
|
pools: string[];
|
|
@@ -2561,6 +2567,8 @@ declare class ZyfaiSDK {
|
|
|
2561
2567
|
fromDate?: string;
|
|
2562
2568
|
toDate?: string;
|
|
2563
2569
|
assetType?: HistoryAssetType;
|
|
2570
|
+
/** Mark async rebalance request, claim, and redeploy rows as rebalance. */
|
|
2571
|
+
rebalanceLegs?: boolean;
|
|
2564
2572
|
}): Promise<HistoryResponse>;
|
|
2565
2573
|
/**
|
|
2566
2574
|
* Get onchain earnings for a wallet.
|
|
@@ -2927,6 +2935,7 @@ declare class ZyfaiSDK {
|
|
|
2927
2935
|
*
|
|
2928
2936
|
* @param protocolId - The protocol UUID
|
|
2929
2937
|
* @param strategy - Optional {@link Strategy} filter
|
|
2938
|
+
* @param options - `liveOnly` omits not-live pools. `includeStatus` adds each pool's status. Both default off.
|
|
2930
2939
|
* @returns List of available pool names
|
|
2931
2940
|
*
|
|
2932
2941
|
* @example
|
|
@@ -2942,7 +2951,7 @@ declare class ZyfaiSDK {
|
|
|
2942
2951
|
* );
|
|
2943
2952
|
* ```
|
|
2944
2953
|
*/
|
|
2945
|
-
getAvailablePools(protocolId: string, strategy?: Strategy): Promise<GetPoolsResponse>;
|
|
2954
|
+
getAvailablePools(protocolId: string, strategy?: Strategy, options?: GetAvailablePoolsOptions): Promise<GetPoolsResponse>;
|
|
2946
2955
|
/**
|
|
2947
2956
|
* Simulate the best yield positions for a given amount, splitting it across
|
|
2948
2957
|
* the top-ranked pools (up to minSplit positions) for the requested chains/strategy.
|
|
@@ -3354,4 +3363,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
|
|
|
3354
3363
|
*/
|
|
3355
3364
|
declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
|
|
3356
3365
|
|
|
3357
|
-
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstPermitDepositStatus, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryAssetType, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, type RzfiClaimTransaction, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeAssetType, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
|
|
3366
|
+
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstPermitDepositStatus, type FirstTopupResponse, type GetAvailablePoolsOptions, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryAssetType, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, type RzfiClaimTransaction, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeAssetType, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
|
package/dist/index.js
CHANGED
|
@@ -187,7 +187,13 @@ var ENDPOINTS = {
|
|
|
187
187
|
},
|
|
188
188
|
// Customization
|
|
189
189
|
CUSTOMIZE_BATCH: "/customization/customize-batch",
|
|
190
|
-
CUSTOMIZATION_POOLS: (protocolId, strategy) =>
|
|
190
|
+
CUSTOMIZATION_POOLS: (protocolId, strategy, options) => {
|
|
191
|
+
const query = [`protocolId=${protocolId}`];
|
|
192
|
+
if (strategy) query.push(`strategy=${strategy}`);
|
|
193
|
+
if (options?.liveOnly) query.push("liveOnly=true");
|
|
194
|
+
if (options?.includeStatus) query.push("includeStatus=true");
|
|
195
|
+
return `/customization/pools?${query.join("&")}`;
|
|
196
|
+
},
|
|
191
197
|
CUSTOMIZATION_SELECTED_POOLS: (protocolId, chainId) => `/customization/selected-pools?protocolId=${protocolId}&chainId=${chainId}`
|
|
192
198
|
};
|
|
193
199
|
var DATA_ENDPOINTS = {
|
|
@@ -1001,10 +1007,12 @@ var ASSET_CONFIGS = {
|
|
|
1001
1007
|
decimals: 6,
|
|
1002
1008
|
tokenSymbols: ["USDT"],
|
|
1003
1009
|
tokenSymbolsByChainId: {
|
|
1004
|
-
1: "USDT"
|
|
1010
|
+
1: "USDT",
|
|
1011
|
+
42161: "USDT"
|
|
1005
1012
|
},
|
|
1006
1013
|
addresses: {
|
|
1007
|
-
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
|
|
1014
|
+
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
1015
|
+
42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
|
|
1008
1016
|
},
|
|
1009
1017
|
enabled: true
|
|
1010
1018
|
},
|
|
@@ -1631,6 +1639,20 @@ function toInternalStrategy(publicStrategy) {
|
|
|
1631
1639
|
);
|
|
1632
1640
|
}
|
|
1633
1641
|
}
|
|
1642
|
+
function toDataStrategy(publicStrategy) {
|
|
1643
|
+
switch (publicStrategy) {
|
|
1644
|
+
case "conservative":
|
|
1645
|
+
return "safe";
|
|
1646
|
+
case "aggressive":
|
|
1647
|
+
return "degen";
|
|
1648
|
+
case "yieldmaxxing":
|
|
1649
|
+
return "async";
|
|
1650
|
+
default:
|
|
1651
|
+
throw new Error(
|
|
1652
|
+
`Invalid public strategy: ${publicStrategy}. Must be ${PUBLIC_STRATEGIES}.`
|
|
1653
|
+
);
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1634
1656
|
function toPublicStrategy(internalStrategy) {
|
|
1635
1657
|
if (internalStrategy === "safe_strategy" || internalStrategy === "safe") {
|
|
1636
1658
|
return "conservative";
|
|
@@ -5620,13 +5642,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5620
5642
|
*/
|
|
5621
5643
|
async getAPYPerStrategy(crossChain = false, days = 7, strategy = "conservative", chainId, tokenSymbol) {
|
|
5622
5644
|
try {
|
|
5623
|
-
const internalStrategy = toInternalStrategy(strategy);
|
|
5624
|
-
const internalStrategyShort = internalStrategy === "safe_strategy" ? "safe" : "degen";
|
|
5625
5645
|
const response = await this.httpClient.dataGet(
|
|
5626
5646
|
DATA_ENDPOINTS.APY_PER_STRATEGY({
|
|
5627
5647
|
isCrossChain: crossChain,
|
|
5628
5648
|
days,
|
|
5629
|
-
strategy:
|
|
5649
|
+
strategy: toDataStrategy(strategy),
|
|
5630
5650
|
chainId,
|
|
5631
5651
|
tokenSymbol
|
|
5632
5652
|
})
|
|
@@ -5838,6 +5858,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5838
5858
|
if (options?.offset) endpoint += `&offset=${options.offset}`;
|
|
5839
5859
|
if (options?.fromDate) endpoint += `&fromDate=${options.fromDate}`;
|
|
5840
5860
|
if (options?.toDate) endpoint += `&toDate=${options.toDate}`;
|
|
5861
|
+
if (options?.rebalanceLegs) endpoint += `&rebalanceLegs=true`;
|
|
5841
5862
|
const response = await this.httpClient.get(endpoint);
|
|
5842
5863
|
const convertedData = convertStrategiesToPublic(
|
|
5843
5864
|
response.data || []
|
|
@@ -6686,6 +6707,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
6686
6707
|
*
|
|
6687
6708
|
* @param protocolId - The protocol UUID
|
|
6688
6709
|
* @param strategy - Optional {@link Strategy} filter
|
|
6710
|
+
* @param options - `liveOnly` omits not-live pools. `includeStatus` adds each pool's status. Both default off.
|
|
6689
6711
|
* @returns List of available pool names
|
|
6690
6712
|
*
|
|
6691
6713
|
* @example
|
|
@@ -6701,7 +6723,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
6701
6723
|
* );
|
|
6702
6724
|
* ```
|
|
6703
6725
|
*/
|
|
6704
|
-
async getAvailablePools(protocolId, strategy) {
|
|
6726
|
+
async getAvailablePools(protocolId, strategy, options) {
|
|
6705
6727
|
try {
|
|
6706
6728
|
let internalStrategy;
|
|
6707
6729
|
if (strategy) {
|
|
@@ -6713,7 +6735,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
6713
6735
|
internalStrategy = toInternalStrategy(strategy);
|
|
6714
6736
|
}
|
|
6715
6737
|
const response = await this.httpClient.get(
|
|
6716
|
-
ENDPOINTS.CUSTOMIZATION_POOLS(
|
|
6738
|
+
ENDPOINTS.CUSTOMIZATION_POOLS(
|
|
6739
|
+
protocolId,
|
|
6740
|
+
internalStrategy,
|
|
6741
|
+
options
|
|
6742
|
+
)
|
|
6717
6743
|
);
|
|
6718
6744
|
return response;
|
|
6719
6745
|
} catch (error) {
|
package/dist/index.mjs
CHANGED
|
@@ -113,7 +113,13 @@ var ENDPOINTS = {
|
|
|
113
113
|
},
|
|
114
114
|
// Customization
|
|
115
115
|
CUSTOMIZE_BATCH: "/customization/customize-batch",
|
|
116
|
-
CUSTOMIZATION_POOLS: (protocolId, strategy) =>
|
|
116
|
+
CUSTOMIZATION_POOLS: (protocolId, strategy, options) => {
|
|
117
|
+
const query = [`protocolId=${protocolId}`];
|
|
118
|
+
if (strategy) query.push(`strategy=${strategy}`);
|
|
119
|
+
if (options?.liveOnly) query.push("liveOnly=true");
|
|
120
|
+
if (options?.includeStatus) query.push("includeStatus=true");
|
|
121
|
+
return `/customization/pools?${query.join("&")}`;
|
|
122
|
+
},
|
|
117
123
|
CUSTOMIZATION_SELECTED_POOLS: (protocolId, chainId) => `/customization/selected-pools?protocolId=${protocolId}&chainId=${chainId}`
|
|
118
124
|
};
|
|
119
125
|
var DATA_ENDPOINTS = {
|
|
@@ -940,10 +946,12 @@ var ASSET_CONFIGS = {
|
|
|
940
946
|
decimals: 6,
|
|
941
947
|
tokenSymbols: ["USDT"],
|
|
942
948
|
tokenSymbolsByChainId: {
|
|
943
|
-
1: "USDT"
|
|
949
|
+
1: "USDT",
|
|
950
|
+
42161: "USDT"
|
|
944
951
|
},
|
|
945
952
|
addresses: {
|
|
946
|
-
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
|
|
953
|
+
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
954
|
+
42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
|
|
947
955
|
},
|
|
948
956
|
enabled: true
|
|
949
957
|
},
|
|
@@ -1589,6 +1597,20 @@ function toInternalStrategy(publicStrategy) {
|
|
|
1589
1597
|
);
|
|
1590
1598
|
}
|
|
1591
1599
|
}
|
|
1600
|
+
function toDataStrategy(publicStrategy) {
|
|
1601
|
+
switch (publicStrategy) {
|
|
1602
|
+
case "conservative":
|
|
1603
|
+
return "safe";
|
|
1604
|
+
case "aggressive":
|
|
1605
|
+
return "degen";
|
|
1606
|
+
case "yieldmaxxing":
|
|
1607
|
+
return "async";
|
|
1608
|
+
default:
|
|
1609
|
+
throw new Error(
|
|
1610
|
+
`Invalid public strategy: ${publicStrategy}. Must be ${PUBLIC_STRATEGIES}.`
|
|
1611
|
+
);
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1592
1614
|
function toPublicStrategy(internalStrategy) {
|
|
1593
1615
|
if (internalStrategy === "safe_strategy" || internalStrategy === "safe") {
|
|
1594
1616
|
return "conservative";
|
|
@@ -5578,13 +5600,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5578
5600
|
*/
|
|
5579
5601
|
async getAPYPerStrategy(crossChain = false, days = 7, strategy = "conservative", chainId, tokenSymbol) {
|
|
5580
5602
|
try {
|
|
5581
|
-
const internalStrategy = toInternalStrategy(strategy);
|
|
5582
|
-
const internalStrategyShort = internalStrategy === "safe_strategy" ? "safe" : "degen";
|
|
5583
5603
|
const response = await this.httpClient.dataGet(
|
|
5584
5604
|
DATA_ENDPOINTS.APY_PER_STRATEGY({
|
|
5585
5605
|
isCrossChain: crossChain,
|
|
5586
5606
|
days,
|
|
5587
|
-
strategy:
|
|
5607
|
+
strategy: toDataStrategy(strategy),
|
|
5588
5608
|
chainId,
|
|
5589
5609
|
tokenSymbol
|
|
5590
5610
|
})
|
|
@@ -5796,6 +5816,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5796
5816
|
if (options?.offset) endpoint += `&offset=${options.offset}`;
|
|
5797
5817
|
if (options?.fromDate) endpoint += `&fromDate=${options.fromDate}`;
|
|
5798
5818
|
if (options?.toDate) endpoint += `&toDate=${options.toDate}`;
|
|
5819
|
+
if (options?.rebalanceLegs) endpoint += `&rebalanceLegs=true`;
|
|
5799
5820
|
const response = await this.httpClient.get(endpoint);
|
|
5800
5821
|
const convertedData = convertStrategiesToPublic(
|
|
5801
5822
|
response.data || []
|
|
@@ -6644,6 +6665,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
6644
6665
|
*
|
|
6645
6666
|
* @param protocolId - The protocol UUID
|
|
6646
6667
|
* @param strategy - Optional {@link Strategy} filter
|
|
6668
|
+
* @param options - `liveOnly` omits not-live pools. `includeStatus` adds each pool's status. Both default off.
|
|
6647
6669
|
* @returns List of available pool names
|
|
6648
6670
|
*
|
|
6649
6671
|
* @example
|
|
@@ -6659,7 +6681,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
6659
6681
|
* );
|
|
6660
6682
|
* ```
|
|
6661
6683
|
*/
|
|
6662
|
-
async getAvailablePools(protocolId, strategy) {
|
|
6684
|
+
async getAvailablePools(protocolId, strategy, options) {
|
|
6663
6685
|
try {
|
|
6664
6686
|
let internalStrategy;
|
|
6665
6687
|
if (strategy) {
|
|
@@ -6671,7 +6693,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
6671
6693
|
internalStrategy = toInternalStrategy(strategy);
|
|
6672
6694
|
}
|
|
6673
6695
|
const response = await this.httpClient.get(
|
|
6674
|
-
ENDPOINTS.CUSTOMIZATION_POOLS(
|
|
6696
|
+
ENDPOINTS.CUSTOMIZATION_POOLS(
|
|
6697
|
+
protocolId,
|
|
6698
|
+
internalStrategy,
|
|
6699
|
+
options
|
|
6700
|
+
)
|
|
6675
6701
|
);
|
|
6676
6702
|
return response;
|
|
6677
6703
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyfai/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
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",
|