@zyfai/sdk 0.2.30 → 0.2.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -269,9 +269,11 @@ interface HistoryResponse {
269
269
  total: number;
270
270
  }
271
271
  type TokenEarnings = Record<string, string>;
272
+ type ChainTokenEarnings = Record<string, TokenEarnings>;
272
273
  interface OnchainEarnings {
273
274
  walletAddress: string;
274
275
  totalEarningsByToken: TokenEarnings;
276
+ totalEarningsByChain?: ChainTokenEarnings;
275
277
  lastCheckTimestamp?: string;
276
278
  lastLogDate?: Record<string, string | null>;
277
279
  }
@@ -1086,6 +1088,7 @@ declare class ZyfaiSDK {
1086
1088
  * ```typescript
1087
1089
  * const earnings = await sdk.getOnchainEarnings("0x...");
1088
1090
  * console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
1091
+ * console.log("Total on Arbitrum:", earnings.data.totalEarningsByChain?.["42161"]);
1089
1092
  * ```
1090
1093
  */
1091
1094
  getOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
@@ -1100,6 +1103,7 @@ declare class ZyfaiSDK {
1100
1103
  * ```typescript
1101
1104
  * const earnings = await sdk.calculateOnchainEarnings("0x...");
1102
1105
  * console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
1106
+ * console.log("Per-chain total:", earnings.data.totalEarningsByChain);
1103
1107
  * ```
1104
1108
  */
1105
1109
  calculateOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
@@ -1506,4 +1510,4 @@ type BankrProvider = ReturnType<typeof createBankrProvider>;
1506
1510
 
1507
1511
  declare const VAULT_ADDRESS: "0xD580071c47d4a667858B5FafAb85BC9C609beC5D";
1508
1512
 
1509
- export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type ApyPosition, type BankrProvider, type BankrProviderConfig, 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 PortfolioDetailed, type PortfolioDetailedResponse, 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, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
1513
+ export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type ApyPosition, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, 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 PortfolioDetailed, type PortfolioDetailedResponse, 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, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
package/dist/index.d.ts CHANGED
@@ -269,9 +269,11 @@ interface HistoryResponse {
269
269
  total: number;
270
270
  }
271
271
  type TokenEarnings = Record<string, string>;
272
+ type ChainTokenEarnings = Record<string, TokenEarnings>;
272
273
  interface OnchainEarnings {
273
274
  walletAddress: string;
274
275
  totalEarningsByToken: TokenEarnings;
276
+ totalEarningsByChain?: ChainTokenEarnings;
275
277
  lastCheckTimestamp?: string;
276
278
  lastLogDate?: Record<string, string | null>;
277
279
  }
@@ -1086,6 +1088,7 @@ declare class ZyfaiSDK {
1086
1088
  * ```typescript
1087
1089
  * const earnings = await sdk.getOnchainEarnings("0x...");
1088
1090
  * console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
1091
+ * console.log("Total on Arbitrum:", earnings.data.totalEarningsByChain?.["42161"]);
1089
1092
  * ```
1090
1093
  */
1091
1094
  getOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
@@ -1100,6 +1103,7 @@ declare class ZyfaiSDK {
1100
1103
  * ```typescript
1101
1104
  * const earnings = await sdk.calculateOnchainEarnings("0x...");
1102
1105
  * console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
1106
+ * console.log("Per-chain total:", earnings.data.totalEarningsByChain);
1103
1107
  * ```
1104
1108
  */
1105
1109
  calculateOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
@@ -1506,4 +1510,4 @@ type BankrProvider = ReturnType<typeof createBankrProvider>;
1506
1510
 
1507
1511
  declare const VAULT_ADDRESS: "0xD580071c47d4a667858B5FafAb85BC9C609beC5D";
1508
1512
 
1509
- export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type ApyPosition, type BankrProvider, type BankrProviderConfig, 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 PortfolioDetailed, type PortfolioDetailedResponse, 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, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
1513
+ export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type ApyPosition, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, 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 PortfolioDetailed, type PortfolioDetailedResponse, 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, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
package/dist/index.js CHANGED
@@ -2473,6 +2473,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2473
2473
  * ```typescript
2474
2474
  * const earnings = await sdk.getOnchainEarnings("0x...");
2475
2475
  * console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
2476
+ * console.log("Total on Arbitrum:", earnings.data.totalEarningsByChain?.["42161"]);
2476
2477
  * ```
2477
2478
  */
2478
2479
  async getOnchainEarnings(walletAddress) {
@@ -2488,6 +2489,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2488
2489
  data: {
2489
2490
  walletAddress,
2490
2491
  totalEarningsByToken: response.total_earnings_by_token || {},
2492
+ totalEarningsByChain: response.total_earnings_by_chain || {},
2491
2493
  lastCheckTimestamp: response.last_check_timestamp,
2492
2494
  lastLogDate: response.last_log_date
2493
2495
  }
@@ -2509,6 +2511,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2509
2511
  * ```typescript
2510
2512
  * const earnings = await sdk.calculateOnchainEarnings("0x...");
2511
2513
  * console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
2514
+ * console.log("Per-chain total:", earnings.data.totalEarningsByChain);
2512
2515
  * ```
2513
2516
  */
2514
2517
  async calculateOnchainEarnings(walletAddress) {
@@ -2526,6 +2529,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2526
2529
  data: {
2527
2530
  walletAddress,
2528
2531
  totalEarningsByToken: data.total_earnings_by_token || {},
2532
+ totalEarningsByChain: data.total_earnings_by_chain || {},
2529
2533
  lastCheckTimestamp: data.last_check_timestamp,
2530
2534
  lastLogDate: data.last_log_date
2531
2535
  }
@@ -3194,6 +3198,9 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3194
3198
  if (!this.walletClient?.account) {
3195
3199
  throw new Error("Wallet not connected. Call connectAccount first.");
3196
3200
  }
3201
+ if (Number(amount) <= 2) {
3202
+ throw new Error("Minimum deposit amount is 2.00 USDC");
3203
+ }
3197
3204
  const userAddress = this.walletClient.account.address;
3198
3205
  const chainConfig = getChainConfig(chainId, this.rpcUrls);
3199
3206
  const tokenAddress = getDefaultTokenAddress(chainId, asset);
package/dist/index.mjs CHANGED
@@ -2449,6 +2449,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2449
2449
  * ```typescript
2450
2450
  * const earnings = await sdk.getOnchainEarnings("0x...");
2451
2451
  * console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
2452
+ * console.log("Total on Arbitrum:", earnings.data.totalEarningsByChain?.["42161"]);
2452
2453
  * ```
2453
2454
  */
2454
2455
  async getOnchainEarnings(walletAddress) {
@@ -2464,6 +2465,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2464
2465
  data: {
2465
2466
  walletAddress,
2466
2467
  totalEarningsByToken: response.total_earnings_by_token || {},
2468
+ totalEarningsByChain: response.total_earnings_by_chain || {},
2467
2469
  lastCheckTimestamp: response.last_check_timestamp,
2468
2470
  lastLogDate: response.last_log_date
2469
2471
  }
@@ -2485,6 +2487,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2485
2487
  * ```typescript
2486
2488
  * const earnings = await sdk.calculateOnchainEarnings("0x...");
2487
2489
  * console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
2490
+ * console.log("Per-chain total:", earnings.data.totalEarningsByChain);
2488
2491
  * ```
2489
2492
  */
2490
2493
  async calculateOnchainEarnings(walletAddress) {
@@ -2502,6 +2505,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
2502
2505
  data: {
2503
2506
  walletAddress,
2504
2507
  totalEarningsByToken: data.total_earnings_by_token || {},
2508
+ totalEarningsByChain: data.total_earnings_by_chain || {},
2505
2509
  lastCheckTimestamp: data.last_check_timestamp,
2506
2510
  lastLogDate: data.last_log_date
2507
2511
  }
@@ -3170,6 +3174,9 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3170
3174
  if (!this.walletClient?.account) {
3171
3175
  throw new Error("Wallet not connected. Call connectAccount first.");
3172
3176
  }
3177
+ if (Number(amount) <= 2) {
3178
+ throw new Error("Minimum deposit amount is 2.00 USDC");
3179
+ }
3173
3180
  const userAddress = this.walletClient.account.address;
3174
3181
  const chainConfig = getChainConfig(chainId, this.rpcUrls);
3175
3182
  const tokenAddress = getDefaultTokenAddress(chainId, asset);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyfai/sdk",
3
- "version": "0.2.30",
3
+ "version": "0.2.32",
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",