@zyfai/sdk 0.2.5 → 0.2.7

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
@@ -466,8 +466,32 @@ The SDK provides access to various analytics and data endpoints:
466
466
  const user = await sdk.getUserDetails();
467
467
  console.log("Smart Wallet:", user.user.smartWallet);
468
468
  console.log("Active Chains:", user.user.chains);
469
+ console.log("Active Protocols:", user.user.protocols);
469
470
  ```
470
471
 
472
+ #### Pause Agent
473
+
474
+ Pause the agent by clearing all protocols. This effectively stops automated operations:
475
+
476
+ ```typescript
477
+ // Pause the agent (clears all protocols)
478
+ const result = await sdk.pauseAgent();
479
+
480
+ if (result.success) {
481
+ console.log("Agent paused successfully");
482
+ console.log("User ID:", result.userId);
483
+ }
484
+
485
+ // Verify the agent is paused
486
+ const userDetails = await sdk.getUserDetails();
487
+ console.log("Active protocols:", userDetails.user.protocols.length); // Should be 0
488
+ ```
489
+
490
+ **Note**:
491
+ - User must be authenticated (automatically done via `connectAccount()`)
492
+ - This sets the user's protocols to an empty array
493
+ - To resume operations, call `updateUserProfile()` with the desired protocols
494
+
471
495
  #### Get TVL & Volume
472
496
 
473
497
  ```typescript
@@ -653,26 +677,27 @@ All examples are available in the `examples/` directory:
653
677
  7. **`get-protocols.ts`** - Fetch available protocols for a chain
654
678
  8. **`get-positions.ts`** - Get active positions for a wallet
655
679
  9. **`get-user-details.ts`** - Get authenticated user details
656
- 10. **`get-tvl-volume.ts`** - Get TVL and trading volume
657
- 11. **`get-active-wallets.ts`** - Get active wallets by chain
658
- 12. **`get-smart-wallets-by-eoa.ts`** - Get smart wallets by EOA
659
- 13. **`get-first-topup.ts`** - Get first deposit information
660
- 14. **`get-history.ts`** - Get transaction history
680
+ 10. **`pause-agent.ts`** - Pause agent by clearing all protocols
681
+ 11. **`get-tvl-volume.ts`** - Get TVL and trading volume
682
+ 12. **`get-active-wallets.ts`** - Get active wallets by chain
683
+ 13. **`get-smart-wallets-by-eoa.ts`** - Get smart wallets by EOA
684
+ 14. **`get-first-topup.ts`** - Get first deposit information
685
+ 15. **`get-history.ts`** - Get transaction history
661
686
 
662
687
  ### Analytics & Earnings
663
688
 
664
- 15. **`get-onchain-earnings.ts`** - Get/calculate onchain earnings
665
- 16. **`get-daily-earnings.ts`** - Get daily earnings breakdown
666
- 17. **`get-apy-history.ts`** - Get daily APY history with weighted averages
689
+ 16. **`get-onchain-earnings.ts`** - Get/calculate onchain earnings
690
+ 17. **`get-daily-earnings.ts`** - Get daily earnings breakdown
691
+ 18. **`get-apy-history.ts`** - Get daily APY history with weighted averages
667
692
 
668
693
  ### Opportunities & Rebalancing
669
694
 
670
- 18. **`get-opportunities.ts`** - Get conservative and aggressive yield opportunities
671
- 19. **`get-rebalance-info.ts`** - Get rebalance events and frequency tier
695
+ 19. **`get-opportunities.ts`** - Get conservative and aggressive yield opportunities
696
+ 20. **`get-rebalance-info.ts`** - Get rebalance events and frequency tier
672
697
 
673
698
  ### Premium Features
674
699
 
675
- 20. **`get-debank-portfolio.ts`** - Get Debank multi-chain portfolio
700
+ 21. **`get-debank-portfolio.ts`** - Get Debank multi-chain portfolio
676
701
 
677
702
  ### Quick Start: Run the End-to-End Example
678
703
 
package/dist/index.d.mts CHANGED
@@ -376,6 +376,50 @@ interface SdkKeyTVLResponse {
376
376
  walletsCount: number;
377
377
  };
378
378
  }
379
+ interface OpportunityPosition {
380
+ protocol: string;
381
+ pool: string;
382
+ apy: number;
383
+ tvl?: number;
384
+ }
385
+ interface BestOpportunityDetails {
386
+ protocol: string;
387
+ pool: string;
388
+ apy: number;
389
+ tvl: number;
390
+ zyfiTvl?: number;
391
+ poolApy?: number;
392
+ rewardsApy?: number;
393
+ protocolApy?: number;
394
+ }
395
+ interface BestOpportunityResponse {
396
+ success: boolean;
397
+ error?: string;
398
+ wallet?: Address;
399
+ chainId?: number;
400
+ strategy?: string;
401
+ token?: {
402
+ symbol: string;
403
+ address: string;
404
+ decimals: number;
405
+ };
406
+ currentPosition?: OpportunityPosition | null;
407
+ bestOpportunity?: BestOpportunityDetails | null;
408
+ shouldRebalance?: boolean;
409
+ apyImprovement?: number | null;
410
+ allOpportunities?: Array<{
411
+ protocol: string;
412
+ pool: string;
413
+ apy: number;
414
+ tvl: number;
415
+ zyfiTvl?: number;
416
+ }>;
417
+ userConfig?: {
418
+ autoSelectProtocols: boolean;
419
+ enabledProtocols: string[];
420
+ };
421
+ enabledChains?: number[];
422
+ }
379
423
  interface PolicyData {
380
424
  policy: Address;
381
425
  initData: Hex;
@@ -466,6 +510,25 @@ declare class ZyfaiSDK {
466
510
  * ```
467
511
  */
468
512
  updateUserProfile(request: UpdateUserProfileRequest): Promise<UpdateUserProfileResponse>;
513
+ /**
514
+ * Pause the agent by clearing all protocols
515
+ * Sets the user's protocols to an empty array, effectively pausing automated operations
516
+ *
517
+ * @returns Response indicating success and updated user details
518
+ *
519
+ * @example
520
+ * ```typescript
521
+ * const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
522
+ *
523
+ * // Connect account first
524
+ * await sdk.connectAccount();
525
+ *
526
+ * // Pause the agent
527
+ * const result = await sdk.pauseAgent();
528
+ * console.log('Agent paused:', result.success);
529
+ * ```
530
+ */
531
+ pauseAgent(): Promise<UpdateUserProfileResponse>;
469
532
  /**
470
533
  * Initialize user after Safe deployment
471
534
  * This method is automatically called after deploySafe to initialize user state
@@ -929,6 +992,32 @@ declare class ZyfaiSDK {
929
992
  * ```
930
993
  */
931
994
  getSdkKeyTVL(): Promise<SdkKeyTVLResponse>;
995
+ /**
996
+ * Get the best yield opportunity for a registered wallet.
997
+ *
998
+ * Returns the highest-APY opportunity available based on the wallet's strategy
999
+ * and enabled protocols. This reflects what the rebalance engine would select.
1000
+ *
1001
+ * @param walletAddress - The smart wallet address (must be registered)
1002
+ * @param chainId - The chain ID to check opportunities on
1003
+ * @returns Best opportunity details with comparison to current position
1004
+ *
1005
+ * @example
1006
+ * ```typescript
1007
+ * const result = await sdk.getBestOpportunity(walletAddress, 8453);
1008
+ *
1009
+ * console.log("Current position:", result.currentPosition);
1010
+ * console.log("Best opportunity:", result.bestOpportunity);
1011
+ * console.log("Should rebalance:", result.shouldRebalance);
1012
+ * console.log("APY improvement:", result.apyImprovement);
1013
+ *
1014
+ * // List all available opportunities
1015
+ * result.allOpportunities?.forEach(opp => {
1016
+ * console.log(`${opp.protocol} - ${opp.pool}: ${opp.apy}%`);
1017
+ * });
1018
+ * ```
1019
+ */
1020
+ getBestOpportunity(walletAddress: Address, chainId: SupportedChainId): Promise<BestOpportunityResponse>;
932
1021
  }
933
1022
 
934
- export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, 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 PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, 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 };
1023
+ 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 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
@@ -376,6 +376,50 @@ interface SdkKeyTVLResponse {
376
376
  walletsCount: number;
377
377
  };
378
378
  }
379
+ interface OpportunityPosition {
380
+ protocol: string;
381
+ pool: string;
382
+ apy: number;
383
+ tvl?: number;
384
+ }
385
+ interface BestOpportunityDetails {
386
+ protocol: string;
387
+ pool: string;
388
+ apy: number;
389
+ tvl: number;
390
+ zyfiTvl?: number;
391
+ poolApy?: number;
392
+ rewardsApy?: number;
393
+ protocolApy?: number;
394
+ }
395
+ interface BestOpportunityResponse {
396
+ success: boolean;
397
+ error?: string;
398
+ wallet?: Address;
399
+ chainId?: number;
400
+ strategy?: string;
401
+ token?: {
402
+ symbol: string;
403
+ address: string;
404
+ decimals: number;
405
+ };
406
+ currentPosition?: OpportunityPosition | null;
407
+ bestOpportunity?: BestOpportunityDetails | null;
408
+ shouldRebalance?: boolean;
409
+ apyImprovement?: number | null;
410
+ allOpportunities?: Array<{
411
+ protocol: string;
412
+ pool: string;
413
+ apy: number;
414
+ tvl: number;
415
+ zyfiTvl?: number;
416
+ }>;
417
+ userConfig?: {
418
+ autoSelectProtocols: boolean;
419
+ enabledProtocols: string[];
420
+ };
421
+ enabledChains?: number[];
422
+ }
379
423
  interface PolicyData {
380
424
  policy: Address;
381
425
  initData: Hex;
@@ -466,6 +510,25 @@ declare class ZyfaiSDK {
466
510
  * ```
467
511
  */
468
512
  updateUserProfile(request: UpdateUserProfileRequest): Promise<UpdateUserProfileResponse>;
513
+ /**
514
+ * Pause the agent by clearing all protocols
515
+ * Sets the user's protocols to an empty array, effectively pausing automated operations
516
+ *
517
+ * @returns Response indicating success and updated user details
518
+ *
519
+ * @example
520
+ * ```typescript
521
+ * const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
522
+ *
523
+ * // Connect account first
524
+ * await sdk.connectAccount();
525
+ *
526
+ * // Pause the agent
527
+ * const result = await sdk.pauseAgent();
528
+ * console.log('Agent paused:', result.success);
529
+ * ```
530
+ */
531
+ pauseAgent(): Promise<UpdateUserProfileResponse>;
469
532
  /**
470
533
  * Initialize user after Safe deployment
471
534
  * This method is automatically called after deploySafe to initialize user state
@@ -929,6 +992,32 @@ declare class ZyfaiSDK {
929
992
  * ```
930
993
  */
931
994
  getSdkKeyTVL(): Promise<SdkKeyTVLResponse>;
995
+ /**
996
+ * Get the best yield opportunity for a registered wallet.
997
+ *
998
+ * Returns the highest-APY opportunity available based on the wallet's strategy
999
+ * and enabled protocols. This reflects what the rebalance engine would select.
1000
+ *
1001
+ * @param walletAddress - The smart wallet address (must be registered)
1002
+ * @param chainId - The chain ID to check opportunities on
1003
+ * @returns Best opportunity details with comparison to current position
1004
+ *
1005
+ * @example
1006
+ * ```typescript
1007
+ * const result = await sdk.getBestOpportunity(walletAddress, 8453);
1008
+ *
1009
+ * console.log("Current position:", result.currentPosition);
1010
+ * console.log("Best opportunity:", result.bestOpportunity);
1011
+ * console.log("Should rebalance:", result.shouldRebalance);
1012
+ * console.log("APY improvement:", result.apyImprovement);
1013
+ *
1014
+ * // List all available opportunities
1015
+ * result.allOpportunities?.forEach(opp => {
1016
+ * console.log(`${opp.protocol} - ${opp.pool}: ${opp.apy}%`);
1017
+ * });
1018
+ * ```
1019
+ */
1020
+ getBestOpportunity(walletAddress: Address, chainId: SupportedChainId): Promise<BestOpportunityResponse>;
932
1021
  }
933
1022
 
934
- export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, 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 PolicyData, type Pool, type PortfolioToken, type Position, type PositionSlot, type PositionsResponse, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, 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 };
1023
+ 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 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
@@ -74,7 +74,9 @@ var ENDPOINTS = {
74
74
  DATA_REBALANCE_FREQUENCY: (walletAddress) => `/data/rebalance-frequency?walletAddress=${walletAddress}`,
75
75
  // SDK Keys
76
76
  SDK_ALLOWED_WALLETS: "/data/sdk-allowed-wallets",
77
- SDK_TVL: "/data/sdk-tvl"
77
+ SDK_TVL: "/data/sdk-tvl",
78
+ // Best Opportunity
79
+ BEST_OPPORTUNITY: (walletAddress, chainId) => `/data/best-opportunity?walletAddress=${walletAddress}&chainId=${chainId}`
78
80
  };
79
81
  var DATA_ENDPOINTS = {
80
82
  // User Initialization
@@ -791,6 +793,34 @@ var ZyfaiSDK = class {
791
793
  );
792
794
  }
793
795
  }
796
+ /**
797
+ * Pause the agent by clearing all protocols
798
+ * Sets the user's protocols to an empty array, effectively pausing automated operations
799
+ *
800
+ * @returns Response indicating success and updated user details
801
+ *
802
+ * @example
803
+ * ```typescript
804
+ * const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
805
+ *
806
+ * // Connect account first
807
+ * await sdk.connectAccount();
808
+ *
809
+ * // Pause the agent
810
+ * const result = await sdk.pauseAgent();
811
+ * console.log('Agent paused:', result.success);
812
+ * ```
813
+ */
814
+ async pauseAgent() {
815
+ try {
816
+ const response = await this.updateUserProfile({
817
+ protocols: []
818
+ });
819
+ return response;
820
+ } catch (error) {
821
+ throw new Error(`Failed to pause agent: ${error.message}`);
822
+ }
823
+ }
794
824
  /**
795
825
  * Initialize user after Safe deployment
796
826
  * This method is automatically called after deploySafe to initialize user state
@@ -2262,6 +2292,43 @@ var ZyfaiSDK = class {
2262
2292
  );
2263
2293
  }
2264
2294
  }
2295
+ /**
2296
+ * Get the best yield opportunity for a registered wallet.
2297
+ *
2298
+ * Returns the highest-APY opportunity available based on the wallet's strategy
2299
+ * and enabled protocols. This reflects what the rebalance engine would select.
2300
+ *
2301
+ * @param walletAddress - The smart wallet address (must be registered)
2302
+ * @param chainId - The chain ID to check opportunities on
2303
+ * @returns Best opportunity details with comparison to current position
2304
+ *
2305
+ * @example
2306
+ * ```typescript
2307
+ * const result = await sdk.getBestOpportunity(walletAddress, 8453);
2308
+ *
2309
+ * console.log("Current position:", result.currentPosition);
2310
+ * console.log("Best opportunity:", result.bestOpportunity);
2311
+ * console.log("Should rebalance:", result.shouldRebalance);
2312
+ * console.log("APY improvement:", result.apyImprovement);
2313
+ *
2314
+ * // List all available opportunities
2315
+ * result.allOpportunities?.forEach(opp => {
2316
+ * console.log(`${opp.protocol} - ${opp.pool}: ${opp.apy}%`);
2317
+ * });
2318
+ * ```
2319
+ */
2320
+ async getBestOpportunity(walletAddress, chainId) {
2321
+ try {
2322
+ const response = await this.httpClient.get(
2323
+ ENDPOINTS.BEST_OPPORTUNITY(walletAddress, chainId)
2324
+ );
2325
+ return response;
2326
+ } catch (error) {
2327
+ throw new Error(
2328
+ `Failed to get best opportunity: ${error.message}`
2329
+ );
2330
+ }
2331
+ }
2265
2332
  };
2266
2333
  // Annotate the CommonJS export names for ESM import in node:
2267
2334
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -33,7 +33,9 @@ var ENDPOINTS = {
33
33
  DATA_REBALANCE_FREQUENCY: (walletAddress) => `/data/rebalance-frequency?walletAddress=${walletAddress}`,
34
34
  // SDK Keys
35
35
  SDK_ALLOWED_WALLETS: "/data/sdk-allowed-wallets",
36
- SDK_TVL: "/data/sdk-tvl"
36
+ SDK_TVL: "/data/sdk-tvl",
37
+ // Best Opportunity
38
+ BEST_OPPORTUNITY: (walletAddress, chainId) => `/data/best-opportunity?walletAddress=${walletAddress}&chainId=${chainId}`
37
39
  };
38
40
  var DATA_ENDPOINTS = {
39
41
  // User Initialization
@@ -768,6 +770,34 @@ var ZyfaiSDK = class {
768
770
  );
769
771
  }
770
772
  }
773
+ /**
774
+ * Pause the agent by clearing all protocols
775
+ * Sets the user's protocols to an empty array, effectively pausing automated operations
776
+ *
777
+ * @returns Response indicating success and updated user details
778
+ *
779
+ * @example
780
+ * ```typescript
781
+ * const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
782
+ *
783
+ * // Connect account first
784
+ * await sdk.connectAccount();
785
+ *
786
+ * // Pause the agent
787
+ * const result = await sdk.pauseAgent();
788
+ * console.log('Agent paused:', result.success);
789
+ * ```
790
+ */
791
+ async pauseAgent() {
792
+ try {
793
+ const response = await this.updateUserProfile({
794
+ protocols: []
795
+ });
796
+ return response;
797
+ } catch (error) {
798
+ throw new Error(`Failed to pause agent: ${error.message}`);
799
+ }
800
+ }
771
801
  /**
772
802
  * Initialize user after Safe deployment
773
803
  * This method is automatically called after deploySafe to initialize user state
@@ -2239,6 +2269,43 @@ var ZyfaiSDK = class {
2239
2269
  );
2240
2270
  }
2241
2271
  }
2272
+ /**
2273
+ * Get the best yield opportunity for a registered wallet.
2274
+ *
2275
+ * Returns the highest-APY opportunity available based on the wallet's strategy
2276
+ * and enabled protocols. This reflects what the rebalance engine would select.
2277
+ *
2278
+ * @param walletAddress - The smart wallet address (must be registered)
2279
+ * @param chainId - The chain ID to check opportunities on
2280
+ * @returns Best opportunity details with comparison to current position
2281
+ *
2282
+ * @example
2283
+ * ```typescript
2284
+ * const result = await sdk.getBestOpportunity(walletAddress, 8453);
2285
+ *
2286
+ * console.log("Current position:", result.currentPosition);
2287
+ * console.log("Best opportunity:", result.bestOpportunity);
2288
+ * console.log("Should rebalance:", result.shouldRebalance);
2289
+ * console.log("APY improvement:", result.apyImprovement);
2290
+ *
2291
+ * // List all available opportunities
2292
+ * result.allOpportunities?.forEach(opp => {
2293
+ * console.log(`${opp.protocol} - ${opp.pool}: ${opp.apy}%`);
2294
+ * });
2295
+ * ```
2296
+ */
2297
+ async getBestOpportunity(walletAddress, chainId) {
2298
+ try {
2299
+ const response = await this.httpClient.get(
2300
+ ENDPOINTS.BEST_OPPORTUNITY(walletAddress, chainId)
2301
+ );
2302
+ return response;
2303
+ } catch (error) {
2304
+ throw new Error(
2305
+ `Failed to get best opportunity: ${error.message}`
2306
+ );
2307
+ }
2308
+ }
2242
2309
  };
2243
2310
  export {
2244
2311
  DEFAULT_TOKEN_ADDRESSES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyfai/sdk",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
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",