@zyfai/sdk 0.2.11 → 0.2.13

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 CHANGED
@@ -462,12 +462,39 @@ The SDK provides access to various analytics and data endpoints:
462
462
 
463
463
  #### Get User Details
464
464
 
465
+ Fetch complete authenticated user profile including smart wallet, chains, protocols, and all configuration settings:
466
+
465
467
  ```typescript
466
468
  const user = await sdk.getUserDetails();
469
+
467
470
  console.log("Smart Wallet:", user.user.smartWallet);
468
471
  console.log("Active Chains:", user.user.chains);
469
472
  console.log("Active Protocols:", user.user.protocols);
470
- ```
473
+ console.log("Strategy:", user.user.strategy); // "conservative" | "aggressive"
474
+ console.log("Has Active Session:", user.user.hasActiveSessionKey);
475
+
476
+ // Feature flags
477
+ console.log("Auto-compounding:", user.user.autocompounding);
478
+ console.log("Auto-select Protocols:", user.user.autoSelectProtocols);
479
+ console.log("Omni Account:", user.user.omniAccount);
480
+ console.log("Cross-chain Strategy:", user.user.crosschainStrategy);
481
+ console.log("Executor Proxy:", user.user.executorProxy);
482
+ console.log("Splitting:", user.user.splitting);
483
+ console.log("Min Splits:", user.user.minSplits);
484
+
485
+ // Optional fields
486
+ console.log("Email:", user.user.email);
487
+ console.log("Telegram ID:", user.user.telegramId);
488
+ console.log("Agent Name:", user.user.agentName);
489
+ console.log("Wallet Type:", user.user.walletType);
490
+ ```
491
+
492
+ **Available Fields:**
493
+ - **Core Info**: `id`, `address`, `smartWallet`, `chains`, `protocols`
494
+ - **Strategy**: `strategy` (conservative or aggressive)
495
+ - **Session**: `hasActiveSessionKey` (boolean)
496
+ - **Features**: `autocompounding`, `autoSelectProtocols`, `omniAccount`, `crosschainStrategy`, `executorProxy`, `splitting`, `minSplits`
497
+ - **Optional**: `email`, `telegramId`, `agentName`, `walletType`, `customization`, `registered`
471
498
 
472
499
  #### Pause Agent
473
500
 
@@ -726,26 +753,28 @@ All examples are available in the `examples/` directory:
726
753
  8. **`get-positions.ts`** - Get active positions for a wallet
727
754
  9. **`get-user-details.ts`** - Get authenticated user details
728
755
  10. **`pause-agent.ts`** - Pause agent by clearing all protocols
729
- 11. **`get-tvl-volume.ts`** - Get TVL and trading volume
730
- 12. **`get-active-wallets.ts`** - Get active wallets by chain
731
- 13. **`get-smart-wallets-by-eoa.ts`** - Get smart wallets by EOA
732
- 14. **`get-first-topup.ts`** - Get first deposit information
733
- 15. **`get-history.ts`** - Get transaction history
756
+ 11. **`update-profile-with-protocols.ts`** - Configure user profile with protocols, chains, and advanced features
757
+ 12. **`customize-batch.ts`** - Configure specific pools for protocols across chains
758
+ 13. **`get-tvl-volume.ts`** - Get TVL and trading volume
759
+ 14. **`get-active-wallets.ts`** - Get active wallets by chain
760
+ 15. **`get-smart-wallets-by-eoa.ts`** - Get smart wallets by EOA
761
+ 16. **`get-first-topup.ts`** - Get first deposit information
762
+ 17. **`get-history.ts`** - Get transaction history
734
763
 
735
764
  ### Analytics & Earnings
736
765
 
737
- 16. **`get-onchain-earnings.ts`** - Get/calculate onchain earnings
738
- 17. **`get-daily-earnings.ts`** - Get daily earnings breakdown
739
- 18. **`get-apy-history.ts`** - Get daily APY history with weighted averages
766
+ 18. **`get-onchain-earnings.ts`** - Get/calculate onchain earnings
767
+ 19. **`get-daily-earnings.ts`** - Get daily earnings breakdown
768
+ 20. **`get-apy-history.ts`** - Get daily APY history with weighted averages
740
769
 
741
770
  ### Opportunities & Rebalancing
742
771
 
743
- 19. **`get-opportunities.ts`** - Get conservative and aggressive yield opportunities
744
- 20. **`get-rebalance-info.ts`** - Get rebalance events and frequency tier
772
+ 21. **`get-opportunities.ts`** - Get conservative and aggressive yield opportunities
773
+ 22. **`get-rebalance-info.ts`** - Get rebalance events and frequency tier
745
774
 
746
775
  ### Premium Features
747
776
 
748
- 21. **`get-debank-portfolio.ts`** - Get Debank multi-chain portfolio
777
+ 23. **`get-debank-portfolio.ts`** - Get Debank multi-chain portfolio
749
778
 
750
779
  ### Quick Start: Run the End-to-End Example
751
780
 
package/dist/index.d.mts CHANGED
@@ -23,14 +23,17 @@ interface DeploySafeResponse {
23
23
  }
24
24
  /** @internal */
25
25
  interface UpdateUserProfileRequest {
26
- smartWallet?: string;
27
26
  strategy?: string;
28
- chains?: number[];
29
27
  protocols?: string[];
30
28
  autoSelectProtocols?: boolean;
31
- customization?: Record<string, string[]>;
29
+ omniAccount?: boolean;
30
+ autocompounding?: boolean;
31
+ agentName?: string;
32
+ crosschainStrategy?: boolean;
33
+ executorProxy?: boolean;
32
34
  splitting?: boolean;
33
35
  minSplits?: number;
36
+ customization?: Record<string, any>;
34
37
  }
35
38
  /** @internal */
36
39
  interface UpdateUserProfileResponse {
@@ -39,6 +42,16 @@ interface UpdateUserProfileResponse {
39
42
  smartWallet?: Address;
40
43
  chains?: number[];
41
44
  strategy?: string;
45
+ protocols?: string[];
46
+ autoSelectProtocols?: boolean;
47
+ omniAccount?: boolean;
48
+ autocompounding?: boolean;
49
+ agentName?: string;
50
+ crosschainStrategy?: boolean;
51
+ executorProxy?: boolean;
52
+ splitting?: boolean;
53
+ minSplits?: number;
54
+ customization?: Record<string, any>;
42
55
  }
43
56
  /** @internal */
44
57
  interface AddSessionKeyResponse {
@@ -143,9 +156,11 @@ interface UserDetails {
143
156
  omniAccount?: boolean;
144
157
  crosschainStrategy?: boolean;
145
158
  agentName?: string;
146
- customization?: Record<string, string[]>;
159
+ customization?: Record<string, any>;
160
+ executorProxy?: boolean;
147
161
  splitting?: boolean;
148
162
  minSplits?: number;
163
+ registered?: boolean;
149
164
  }
150
165
  interface UserDetailsResponse {
151
166
  success: boolean;
@@ -431,6 +446,27 @@ interface RegisterAgentResponse {
431
446
  chainId: number;
432
447
  smartWallet: string;
433
448
  }
449
+ interface CustomizationConfig {
450
+ protocolId: string;
451
+ pools: string[];
452
+ chainId: number;
453
+ autoselect: boolean;
454
+ }
455
+ interface CustomizeBatchRequest {
456
+ customizations: CustomizationConfig[];
457
+ }
458
+ interface CustomizeBatchResponse {
459
+ success: boolean;
460
+ }
461
+ interface GetPoolsResponse {
462
+ success: boolean;
463
+ pools: string[];
464
+ }
465
+ interface GetSelectedPoolsResponse {
466
+ success: boolean;
467
+ pools: string[];
468
+ autoselect: boolean;
469
+ }
434
470
  interface PolicyData {
435
471
  policy: Address;
436
472
  initData: Hex;
@@ -1133,6 +1169,86 @@ declare class ZyfaiSDK {
1133
1169
  * ```
1134
1170
  */
1135
1171
  getBestOpportunity(walletAddress: Address, chainId: SupportedChainId): Promise<BestOpportunityResponse>;
1172
+ /**
1173
+ * Configure protocol and pool customizations in batch.
1174
+ *
1175
+ * Allows granular control over which pools to use for each protocol on each chain.
1176
+ * This is useful for advanced users who want to target specific pools with desired APY/risk profiles.
1177
+ *
1178
+ * @param customizations - Array of customization configurations
1179
+ * @returns Response indicating success
1180
+ *
1181
+ * @example
1182
+ * ```typescript
1183
+ * // Configure multiple protocols across different chains
1184
+ * await sdk.customizeBatch([
1185
+ * {
1186
+ * protocolId: "protocol-uuid-1",
1187
+ * pools: ["USDC Pool", "WETH Pool"],
1188
+ * chainId: 8453, // Base
1189
+ * autoselect: false
1190
+ * },
1191
+ * {
1192
+ * protocolId: "protocol-uuid-1",
1193
+ * pools: ["USDC Vault"],
1194
+ * chainId: 42161, // Arbitrum
1195
+ * autoselect: false
1196
+ * },
1197
+ * {
1198
+ * protocolId: "protocol-uuid-2",
1199
+ * pools: [], // Empty array when autoselect is true
1200
+ * chainId: 8453,
1201
+ * autoselect: true // Let engine auto-select best pools
1202
+ * }
1203
+ * ]);
1204
+ * ```
1205
+ */
1206
+ customizeBatch(customizations: CustomizationConfig[]): Promise<CustomizeBatchResponse>;
1207
+ /**
1208
+ * Get available pools for a protocol.
1209
+ *
1210
+ * Returns the list of pools available for a given protocol, optionally filtered by strategy.
1211
+ *
1212
+ * @param protocolId - The protocol UUID
1213
+ * @param strategy - Optional strategy filter ("conservative" or "aggressive")
1214
+ * @returns List of available pool names
1215
+ *
1216
+ * @example
1217
+ * ```typescript
1218
+ * // Get all available pools for a protocol
1219
+ * const pools = await sdk.getAvailablePools("protocol-uuid");
1220
+ * console.log("Available pools:", pools.pools);
1221
+ *
1222
+ * // Get pools for conservative strategy only
1223
+ * const conservativePools = await sdk.getAvailablePools(
1224
+ * "protocol-uuid",
1225
+ * "conservative"
1226
+ * );
1227
+ * ```
1228
+ */
1229
+ getAvailablePools(protocolId: string, strategy?: "conservative" | "aggressive"): Promise<GetPoolsResponse>;
1230
+ /**
1231
+ * Get currently selected pools for a protocol on a specific chain.
1232
+ *
1233
+ * Returns the pools that are currently configured for the authenticated user
1234
+ * for a given protocol and chain combination.
1235
+ *
1236
+ * @param protocolId - The protocol UUID
1237
+ * @param chainId - The chain ID
1238
+ * @returns Currently selected pools and autoselect status
1239
+ *
1240
+ * @example
1241
+ * ```typescript
1242
+ * const selected = await sdk.getSelectedPools(
1243
+ * "protocol-uuid",
1244
+ * 8453 // Base
1245
+ * );
1246
+ *
1247
+ * console.log("Selected pools:", selected.pools);
1248
+ * console.log("Autoselect enabled:", selected.autoselect);
1249
+ * ```
1250
+ */
1251
+ getSelectedPools(protocolId: string, chainId: number): Promise<GetSelectedPoolsResponse>;
1136
1252
  /**
1137
1253
  * Supported chain IDs for the Identity Registry (ERC-8004)
1138
1254
  */
@@ -1163,4 +1279,4 @@ declare class ZyfaiSDK {
1163
1279
  registerAgentOnIdentityRegistry(smartWallet: string, chainId: SupportedChainId): Promise<RegisterAgentResponse>;
1164
1280
  }
1165
1281
 
1166
- export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type FirstTopupResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, type PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, 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 UserDetails, type UserDetailsResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
1282
+ export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, 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 OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, type PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, 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 UserDetails, type UserDetailsResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
package/dist/index.d.ts CHANGED
@@ -23,14 +23,17 @@ interface DeploySafeResponse {
23
23
  }
24
24
  /** @internal */
25
25
  interface UpdateUserProfileRequest {
26
- smartWallet?: string;
27
26
  strategy?: string;
28
- chains?: number[];
29
27
  protocols?: string[];
30
28
  autoSelectProtocols?: boolean;
31
- customization?: Record<string, string[]>;
29
+ omniAccount?: boolean;
30
+ autocompounding?: boolean;
31
+ agentName?: string;
32
+ crosschainStrategy?: boolean;
33
+ executorProxy?: boolean;
32
34
  splitting?: boolean;
33
35
  minSplits?: number;
36
+ customization?: Record<string, any>;
34
37
  }
35
38
  /** @internal */
36
39
  interface UpdateUserProfileResponse {
@@ -39,6 +42,16 @@ interface UpdateUserProfileResponse {
39
42
  smartWallet?: Address;
40
43
  chains?: number[];
41
44
  strategy?: string;
45
+ protocols?: string[];
46
+ autoSelectProtocols?: boolean;
47
+ omniAccount?: boolean;
48
+ autocompounding?: boolean;
49
+ agentName?: string;
50
+ crosschainStrategy?: boolean;
51
+ executorProxy?: boolean;
52
+ splitting?: boolean;
53
+ minSplits?: number;
54
+ customization?: Record<string, any>;
42
55
  }
43
56
  /** @internal */
44
57
  interface AddSessionKeyResponse {
@@ -143,9 +156,11 @@ interface UserDetails {
143
156
  omniAccount?: boolean;
144
157
  crosschainStrategy?: boolean;
145
158
  agentName?: string;
146
- customization?: Record<string, string[]>;
159
+ customization?: Record<string, any>;
160
+ executorProxy?: boolean;
147
161
  splitting?: boolean;
148
162
  minSplits?: number;
163
+ registered?: boolean;
149
164
  }
150
165
  interface UserDetailsResponse {
151
166
  success: boolean;
@@ -431,6 +446,27 @@ interface RegisterAgentResponse {
431
446
  chainId: number;
432
447
  smartWallet: string;
433
448
  }
449
+ interface CustomizationConfig {
450
+ protocolId: string;
451
+ pools: string[];
452
+ chainId: number;
453
+ autoselect: boolean;
454
+ }
455
+ interface CustomizeBatchRequest {
456
+ customizations: CustomizationConfig[];
457
+ }
458
+ interface CustomizeBatchResponse {
459
+ success: boolean;
460
+ }
461
+ interface GetPoolsResponse {
462
+ success: boolean;
463
+ pools: string[];
464
+ }
465
+ interface GetSelectedPoolsResponse {
466
+ success: boolean;
467
+ pools: string[];
468
+ autoselect: boolean;
469
+ }
434
470
  interface PolicyData {
435
471
  policy: Address;
436
472
  initData: Hex;
@@ -1133,6 +1169,86 @@ declare class ZyfaiSDK {
1133
1169
  * ```
1134
1170
  */
1135
1171
  getBestOpportunity(walletAddress: Address, chainId: SupportedChainId): Promise<BestOpportunityResponse>;
1172
+ /**
1173
+ * Configure protocol and pool customizations in batch.
1174
+ *
1175
+ * Allows granular control over which pools to use for each protocol on each chain.
1176
+ * This is useful for advanced users who want to target specific pools with desired APY/risk profiles.
1177
+ *
1178
+ * @param customizations - Array of customization configurations
1179
+ * @returns Response indicating success
1180
+ *
1181
+ * @example
1182
+ * ```typescript
1183
+ * // Configure multiple protocols across different chains
1184
+ * await sdk.customizeBatch([
1185
+ * {
1186
+ * protocolId: "protocol-uuid-1",
1187
+ * pools: ["USDC Pool", "WETH Pool"],
1188
+ * chainId: 8453, // Base
1189
+ * autoselect: false
1190
+ * },
1191
+ * {
1192
+ * protocolId: "protocol-uuid-1",
1193
+ * pools: ["USDC Vault"],
1194
+ * chainId: 42161, // Arbitrum
1195
+ * autoselect: false
1196
+ * },
1197
+ * {
1198
+ * protocolId: "protocol-uuid-2",
1199
+ * pools: [], // Empty array when autoselect is true
1200
+ * chainId: 8453,
1201
+ * autoselect: true // Let engine auto-select best pools
1202
+ * }
1203
+ * ]);
1204
+ * ```
1205
+ */
1206
+ customizeBatch(customizations: CustomizationConfig[]): Promise<CustomizeBatchResponse>;
1207
+ /**
1208
+ * Get available pools for a protocol.
1209
+ *
1210
+ * Returns the list of pools available for a given protocol, optionally filtered by strategy.
1211
+ *
1212
+ * @param protocolId - The protocol UUID
1213
+ * @param strategy - Optional strategy filter ("conservative" or "aggressive")
1214
+ * @returns List of available pool names
1215
+ *
1216
+ * @example
1217
+ * ```typescript
1218
+ * // Get all available pools for a protocol
1219
+ * const pools = await sdk.getAvailablePools("protocol-uuid");
1220
+ * console.log("Available pools:", pools.pools);
1221
+ *
1222
+ * // Get pools for conservative strategy only
1223
+ * const conservativePools = await sdk.getAvailablePools(
1224
+ * "protocol-uuid",
1225
+ * "conservative"
1226
+ * );
1227
+ * ```
1228
+ */
1229
+ getAvailablePools(protocolId: string, strategy?: "conservative" | "aggressive"): Promise<GetPoolsResponse>;
1230
+ /**
1231
+ * Get currently selected pools for a protocol on a specific chain.
1232
+ *
1233
+ * Returns the pools that are currently configured for the authenticated user
1234
+ * for a given protocol and chain combination.
1235
+ *
1236
+ * @param protocolId - The protocol UUID
1237
+ * @param chainId - The chain ID
1238
+ * @returns Currently selected pools and autoselect status
1239
+ *
1240
+ * @example
1241
+ * ```typescript
1242
+ * const selected = await sdk.getSelectedPools(
1243
+ * "protocol-uuid",
1244
+ * 8453 // Base
1245
+ * );
1246
+ *
1247
+ * console.log("Selected pools:", selected.pools);
1248
+ * console.log("Autoselect enabled:", selected.autoselect);
1249
+ * ```
1250
+ */
1251
+ getSelectedPools(protocolId: string, chainId: number): Promise<GetSelectedPoolsResponse>;
1136
1252
  /**
1137
1253
  * Supported chain IDs for the Identity Registry (ERC-8004)
1138
1254
  */
@@ -1163,4 +1279,4 @@ declare class ZyfaiSDK {
1163
1279
  registerAgentOnIdentityRegistry(smartWallet: string, chainId: SupportedChainId): Promise<RegisterAgentResponse>;
1164
1280
  }
1165
1281
 
1166
- export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type FirstTopupResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, type PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, 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 UserDetails, type UserDetailsResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
1282
+ export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, 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 OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, type PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, 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 UserDetails, type UserDetailsResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
package/dist/index.js CHANGED
@@ -78,7 +78,11 @@ var ENDPOINTS = {
78
78
  // Best Opportunity
79
79
  BEST_OPPORTUNITY: (walletAddress, chainId) => `/data/best-opportunity?walletAddress=${walletAddress}&chainId=${chainId}`,
80
80
  // Agent Identity Registry
81
- AGENT_TOKEN_URI: "/users/me/agent-token-uri"
81
+ AGENT_TOKEN_URI: "/users/me/agent-token-uri",
82
+ // Customization
83
+ CUSTOMIZE_BATCH: "/customization/customize-batch",
84
+ CUSTOMIZATION_POOLS: (protocolId, strategy) => `/customization/pools?protocolId=${protocolId}${strategy ? `&strategy=${strategy}` : ""}`,
85
+ CUSTOMIZATION_SELECTED_POOLS: (protocolId, chainId) => `/customization/selected-pools?protocolId=${protocolId}&chainId=${chainId}`
82
86
  };
83
87
  var DATA_ENDPOINTS = {
84
88
  // User Initialization
@@ -794,7 +798,17 @@ var _ZyfaiSDK = class _ZyfaiSDK {
794
798
  userId: response.userId || response.id,
795
799
  smartWallet: response.smartWallet,
796
800
  chains: response.chains,
797
- strategy: response.strategy
801
+ strategy: response.strategy,
802
+ protocols: response.protocols,
803
+ autoSelectProtocols: response.autoSelectProtocols,
804
+ omniAccount: response.omniAccount,
805
+ autocompounding: response.autocompounding,
806
+ agentName: response.agentName,
807
+ crosschainStrategy: response.crosschainStrategy,
808
+ executorProxy: response.executorProxy,
809
+ splitting: response.splitting,
810
+ minSplits: response.minSplits,
811
+ customization: response.customization
798
812
  };
799
813
  } catch (error) {
800
814
  throw new Error(
@@ -1750,8 +1764,10 @@ var _ZyfaiSDK = class _ZyfaiSDK {
1750
1764
  crosschainStrategy: convertedResponse.crosschainStrategy,
1751
1765
  agentName: convertedResponse.agentName,
1752
1766
  customization: convertedResponse.customization,
1767
+ executorProxy: convertedResponse.executorProxy,
1753
1768
  splitting: convertedResponse.splitting,
1754
- minSplits: convertedResponse.minSplits
1769
+ minSplits: convertedResponse.minSplits,
1770
+ registered: convertedResponse.registered
1755
1771
  }
1756
1772
  };
1757
1773
  } catch (error) {
@@ -2583,6 +2599,134 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2583
2599
  );
2584
2600
  }
2585
2601
  }
2602
+ // ============================================================================
2603
+ // Protocol/Pool Customization
2604
+ // ============================================================================
2605
+ /**
2606
+ * Configure protocol and pool customizations in batch.
2607
+ *
2608
+ * Allows granular control over which pools to use for each protocol on each chain.
2609
+ * This is useful for advanced users who want to target specific pools with desired APY/risk profiles.
2610
+ *
2611
+ * @param customizations - Array of customization configurations
2612
+ * @returns Response indicating success
2613
+ *
2614
+ * @example
2615
+ * ```typescript
2616
+ * // Configure multiple protocols across different chains
2617
+ * await sdk.customizeBatch([
2618
+ * {
2619
+ * protocolId: "protocol-uuid-1",
2620
+ * pools: ["USDC Pool", "WETH Pool"],
2621
+ * chainId: 8453, // Base
2622
+ * autoselect: false
2623
+ * },
2624
+ * {
2625
+ * protocolId: "protocol-uuid-1",
2626
+ * pools: ["USDC Vault"],
2627
+ * chainId: 42161, // Arbitrum
2628
+ * autoselect: false
2629
+ * },
2630
+ * {
2631
+ * protocolId: "protocol-uuid-2",
2632
+ * pools: [], // Empty array when autoselect is true
2633
+ * chainId: 8453,
2634
+ * autoselect: true // Let engine auto-select best pools
2635
+ * }
2636
+ * ]);
2637
+ * ```
2638
+ */
2639
+ async customizeBatch(customizations) {
2640
+ try {
2641
+ await this.authenticateUser();
2642
+ const response = await this.httpClient.post(
2643
+ ENDPOINTS.CUSTOMIZE_BATCH,
2644
+ customizations
2645
+ );
2646
+ return response;
2647
+ } catch (error) {
2648
+ throw new Error(
2649
+ `Failed to save customizations: ${error.message}`
2650
+ );
2651
+ }
2652
+ }
2653
+ /**
2654
+ * Get available pools for a protocol.
2655
+ *
2656
+ * Returns the list of pools available for a given protocol, optionally filtered by strategy.
2657
+ *
2658
+ * @param protocolId - The protocol UUID
2659
+ * @param strategy - Optional strategy filter ("conservative" or "aggressive")
2660
+ * @returns List of available pool names
2661
+ *
2662
+ * @example
2663
+ * ```typescript
2664
+ * // Get all available pools for a protocol
2665
+ * const pools = await sdk.getAvailablePools("protocol-uuid");
2666
+ * console.log("Available pools:", pools.pools);
2667
+ *
2668
+ * // Get pools for conservative strategy only
2669
+ * const conservativePools = await sdk.getAvailablePools(
2670
+ * "protocol-uuid",
2671
+ * "conservative"
2672
+ * );
2673
+ * ```
2674
+ */
2675
+ async getAvailablePools(protocolId, strategy) {
2676
+ try {
2677
+ let internalStrategy;
2678
+ if (strategy) {
2679
+ if (!isValidPublicStrategy(strategy)) {
2680
+ throw new Error(
2681
+ `Invalid strategy: ${strategy}. Must be "conservative" or "aggressive".`
2682
+ );
2683
+ }
2684
+ internalStrategy = toInternalStrategy(strategy);
2685
+ }
2686
+ const response = await this.httpClient.get(
2687
+ ENDPOINTS.CUSTOMIZATION_POOLS(protocolId, internalStrategy)
2688
+ );
2689
+ return response;
2690
+ } catch (error) {
2691
+ throw new Error(
2692
+ `Failed to get available pools: ${error.message}`
2693
+ );
2694
+ }
2695
+ }
2696
+ /**
2697
+ * Get currently selected pools for a protocol on a specific chain.
2698
+ *
2699
+ * Returns the pools that are currently configured for the authenticated user
2700
+ * for a given protocol and chain combination.
2701
+ *
2702
+ * @param protocolId - The protocol UUID
2703
+ * @param chainId - The chain ID
2704
+ * @returns Currently selected pools and autoselect status
2705
+ *
2706
+ * @example
2707
+ * ```typescript
2708
+ * const selected = await sdk.getSelectedPools(
2709
+ * "protocol-uuid",
2710
+ * 8453 // Base
2711
+ * );
2712
+ *
2713
+ * console.log("Selected pools:", selected.pools);
2714
+ * console.log("Autoselect enabled:", selected.autoselect);
2715
+ * ```
2716
+ */
2717
+ async getSelectedPools(protocolId, chainId) {
2718
+ try {
2719
+ await this.authenticateUser();
2720
+ const response = await this.httpClient.get(
2721
+ ENDPOINTS.CUSTOMIZATION_SELECTED_POOLS(protocolId, chainId)
2722
+ );
2723
+ return response;
2724
+ } catch (error) {
2725
+ throw new Error(
2726
+ `Failed to get selected pools: ${error.message}`
2727
+ );
2728
+ }
2729
+ }
2586
2730
  /**
2587
2731
  * Check if a chain ID supports the Identity Registry
2588
2732
  */
package/dist/index.mjs CHANGED
@@ -37,7 +37,11 @@ var ENDPOINTS = {
37
37
  // Best Opportunity
38
38
  BEST_OPPORTUNITY: (walletAddress, chainId) => `/data/best-opportunity?walletAddress=${walletAddress}&chainId=${chainId}`,
39
39
  // Agent Identity Registry
40
- AGENT_TOKEN_URI: "/users/me/agent-token-uri"
40
+ AGENT_TOKEN_URI: "/users/me/agent-token-uri",
41
+ // Customization
42
+ CUSTOMIZE_BATCH: "/customization/customize-batch",
43
+ CUSTOMIZATION_POOLS: (protocolId, strategy) => `/customization/pools?protocolId=${protocolId}${strategy ? `&strategy=${strategy}` : ""}`,
44
+ CUSTOMIZATION_SELECTED_POOLS: (protocolId, chainId) => `/customization/selected-pools?protocolId=${protocolId}&chainId=${chainId}`
41
45
  };
42
46
  var DATA_ENDPOINTS = {
43
47
  // User Initialization
@@ -772,7 +776,17 @@ var _ZyfaiSDK = class _ZyfaiSDK {
772
776
  userId: response.userId || response.id,
773
777
  smartWallet: response.smartWallet,
774
778
  chains: response.chains,
775
- strategy: response.strategy
779
+ strategy: response.strategy,
780
+ protocols: response.protocols,
781
+ autoSelectProtocols: response.autoSelectProtocols,
782
+ omniAccount: response.omniAccount,
783
+ autocompounding: response.autocompounding,
784
+ agentName: response.agentName,
785
+ crosschainStrategy: response.crosschainStrategy,
786
+ executorProxy: response.executorProxy,
787
+ splitting: response.splitting,
788
+ minSplits: response.minSplits,
789
+ customization: response.customization
776
790
  };
777
791
  } catch (error) {
778
792
  throw new Error(
@@ -1728,8 +1742,10 @@ var _ZyfaiSDK = class _ZyfaiSDK {
1728
1742
  crosschainStrategy: convertedResponse.crosschainStrategy,
1729
1743
  agentName: convertedResponse.agentName,
1730
1744
  customization: convertedResponse.customization,
1745
+ executorProxy: convertedResponse.executorProxy,
1731
1746
  splitting: convertedResponse.splitting,
1732
- minSplits: convertedResponse.minSplits
1747
+ minSplits: convertedResponse.minSplits,
1748
+ registered: convertedResponse.registered
1733
1749
  }
1734
1750
  };
1735
1751
  } catch (error) {
@@ -2561,6 +2577,134 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2561
2577
  );
2562
2578
  }
2563
2579
  }
2580
+ // ============================================================================
2581
+ // Protocol/Pool Customization
2582
+ // ============================================================================
2583
+ /**
2584
+ * Configure protocol and pool customizations in batch.
2585
+ *
2586
+ * Allows granular control over which pools to use for each protocol on each chain.
2587
+ * This is useful for advanced users who want to target specific pools with desired APY/risk profiles.
2588
+ *
2589
+ * @param customizations - Array of customization configurations
2590
+ * @returns Response indicating success
2591
+ *
2592
+ * @example
2593
+ * ```typescript
2594
+ * // Configure multiple protocols across different chains
2595
+ * await sdk.customizeBatch([
2596
+ * {
2597
+ * protocolId: "protocol-uuid-1",
2598
+ * pools: ["USDC Pool", "WETH Pool"],
2599
+ * chainId: 8453, // Base
2600
+ * autoselect: false
2601
+ * },
2602
+ * {
2603
+ * protocolId: "protocol-uuid-1",
2604
+ * pools: ["USDC Vault"],
2605
+ * chainId: 42161, // Arbitrum
2606
+ * autoselect: false
2607
+ * },
2608
+ * {
2609
+ * protocolId: "protocol-uuid-2",
2610
+ * pools: [], // Empty array when autoselect is true
2611
+ * chainId: 8453,
2612
+ * autoselect: true // Let engine auto-select best pools
2613
+ * }
2614
+ * ]);
2615
+ * ```
2616
+ */
2617
+ async customizeBatch(customizations) {
2618
+ try {
2619
+ await this.authenticateUser();
2620
+ const response = await this.httpClient.post(
2621
+ ENDPOINTS.CUSTOMIZE_BATCH,
2622
+ customizations
2623
+ );
2624
+ return response;
2625
+ } catch (error) {
2626
+ throw new Error(
2627
+ `Failed to save customizations: ${error.message}`
2628
+ );
2629
+ }
2630
+ }
2631
+ /**
2632
+ * Get available pools for a protocol.
2633
+ *
2634
+ * Returns the list of pools available for a given protocol, optionally filtered by strategy.
2635
+ *
2636
+ * @param protocolId - The protocol UUID
2637
+ * @param strategy - Optional strategy filter ("conservative" or "aggressive")
2638
+ * @returns List of available pool names
2639
+ *
2640
+ * @example
2641
+ * ```typescript
2642
+ * // Get all available pools for a protocol
2643
+ * const pools = await sdk.getAvailablePools("protocol-uuid");
2644
+ * console.log("Available pools:", pools.pools);
2645
+ *
2646
+ * // Get pools for conservative strategy only
2647
+ * const conservativePools = await sdk.getAvailablePools(
2648
+ * "protocol-uuid",
2649
+ * "conservative"
2650
+ * );
2651
+ * ```
2652
+ */
2653
+ async getAvailablePools(protocolId, strategy) {
2654
+ try {
2655
+ let internalStrategy;
2656
+ if (strategy) {
2657
+ if (!isValidPublicStrategy(strategy)) {
2658
+ throw new Error(
2659
+ `Invalid strategy: ${strategy}. Must be "conservative" or "aggressive".`
2660
+ );
2661
+ }
2662
+ internalStrategy = toInternalStrategy(strategy);
2663
+ }
2664
+ const response = await this.httpClient.get(
2665
+ ENDPOINTS.CUSTOMIZATION_POOLS(protocolId, internalStrategy)
2666
+ );
2667
+ return response;
2668
+ } catch (error) {
2669
+ throw new Error(
2670
+ `Failed to get available pools: ${error.message}`
2671
+ );
2672
+ }
2673
+ }
2674
+ /**
2675
+ * Get currently selected pools for a protocol on a specific chain.
2676
+ *
2677
+ * Returns the pools that are currently configured for the authenticated user
2678
+ * for a given protocol and chain combination.
2679
+ *
2680
+ * @param protocolId - The protocol UUID
2681
+ * @param chainId - The chain ID
2682
+ * @returns Currently selected pools and autoselect status
2683
+ *
2684
+ * @example
2685
+ * ```typescript
2686
+ * const selected = await sdk.getSelectedPools(
2687
+ * "protocol-uuid",
2688
+ * 8453 // Base
2689
+ * );
2690
+ *
2691
+ * console.log("Selected pools:", selected.pools);
2692
+ * console.log("Autoselect enabled:", selected.autoselect);
2693
+ * ```
2694
+ */
2695
+ async getSelectedPools(protocolId, chainId) {
2696
+ try {
2697
+ await this.authenticateUser();
2698
+ const response = await this.httpClient.get(
2699
+ ENDPOINTS.CUSTOMIZATION_SELECTED_POOLS(protocolId, chainId)
2700
+ );
2701
+ return response;
2702
+ } catch (error) {
2703
+ throw new Error(
2704
+ `Failed to get selected pools: ${error.message}`
2705
+ );
2706
+ }
2707
+ }
2564
2708
  /**
2565
2709
  * Check if a chain ID supports the Identity Registry
2566
2710
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyfai/sdk",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
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",