@zyfai/sdk 0.1.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.
@@ -0,0 +1,769 @@
1
+ import { Chain, PublicClient } from 'viem';
2
+
3
+ /**
4
+ * ZyFAI SDK Types
5
+ */
6
+ type Address = `0x${string}`;
7
+ type Hex = `0x${string}`;
8
+ type Environment = "staging" | "production";
9
+ interface SDKConfig {
10
+ /** API key for the Execution API (Utkir's backend) */
11
+ apiKey: string;
12
+ /** API key for the Data API (Sunny's backend) - defaults to apiKey if not provided */
13
+ dataApiKey?: string;
14
+ /** Environment: 'staging' or 'production' (default: 'production') */
15
+ environment?: Environment;
16
+ /** Bundler API key for Safe deployment (e.g., Pimlico) */
17
+ bundlerApiKey?: string;
18
+ }
19
+ interface DeploySafeResponse {
20
+ success: boolean;
21
+ safeAddress: Address;
22
+ txHash: string;
23
+ status: "deployed" | "failed";
24
+ }
25
+ /** @internal */
26
+ interface UpdateUserProfileRequest {
27
+ smartWallet?: string;
28
+ chains?: number[];
29
+ protocols?: string[];
30
+ autoSelectProtocols?: boolean;
31
+ }
32
+ /** @internal */
33
+ interface UpdateUserProfileResponse {
34
+ success: boolean;
35
+ userId: string;
36
+ smartWallet?: Address;
37
+ chains?: number[];
38
+ }
39
+ /** @internal */
40
+ interface AddSessionKeyResponse {
41
+ id: string;
42
+ hash: string;
43
+ signer: string;
44
+ nonces: number[];
45
+ expiresAt: string;
46
+ txHash?: string;
47
+ isActive: boolean;
48
+ isEnabled: boolean;
49
+ permissionId?: string;
50
+ permissionEnableHash?: string;
51
+ customHash?: string;
52
+ }
53
+ interface SessionKeyResponse {
54
+ success: boolean;
55
+ sessionKeyAddress: Address;
56
+ signature: Hex;
57
+ sessionNonces?: bigint[];
58
+ userId?: string;
59
+ sessionActivation?: AddSessionKeyResponse;
60
+ }
61
+ interface SmartWalletResponse {
62
+ address: Address;
63
+ isDeployed: boolean;
64
+ }
65
+ interface Protocol {
66
+ id: string;
67
+ name: string;
68
+ type: string;
69
+ description?: string;
70
+ imageUrl?: string;
71
+ website?: string;
72
+ strategies?: string[];
73
+ chains: number[];
74
+ pools?: Pool[];
75
+ }
76
+ interface Pool {
77
+ id: string;
78
+ name: string;
79
+ asset: string;
80
+ apy?: number;
81
+ tvl?: string;
82
+ }
83
+ interface ProtocolsResponse {
84
+ success: boolean;
85
+ chainId: number;
86
+ protocols: Protocol[];
87
+ }
88
+ interface Position {
89
+ id?: string;
90
+ chain?: string;
91
+ strategy?: string;
92
+ smartWallet?: Address;
93
+ positions: PositionSlot[];
94
+ hasActiveSessionKey?: boolean;
95
+ hasBalance?: boolean;
96
+ crosschainStrategy?: boolean;
97
+ }
98
+ interface PositionSlot {
99
+ chain?: string;
100
+ protocol_id?: string;
101
+ protocol_name?: string;
102
+ pool?: string;
103
+ token_id?: string;
104
+ token_symbol?: string;
105
+ token_icon?: string;
106
+ amount?: string;
107
+ underlyingAmount?: string;
108
+ pool_apy?: number;
109
+ pool_tvl?: string;
110
+ }
111
+ interface PositionsResponse {
112
+ success: boolean;
113
+ userAddress: string;
114
+ totalValueUsd: number;
115
+ positions: Position[];
116
+ }
117
+ interface UserDetails {
118
+ id: string;
119
+ address: string;
120
+ smartWallet: string;
121
+ chains: number[];
122
+ protocols: Protocol[];
123
+ hasActiveSessionKey: boolean;
124
+ email?: string;
125
+ strategy?: string;
126
+ telegramId?: string;
127
+ walletType?: string;
128
+ autoSelectProtocols: boolean;
129
+ autocompounding?: boolean;
130
+ omniAccount?: boolean;
131
+ crosschainStrategy?: boolean;
132
+ agentName?: string;
133
+ customization?: Record<string, string[]>;
134
+ }
135
+ interface UserDetailsResponse {
136
+ success: boolean;
137
+ user: UserDetails;
138
+ }
139
+ interface TVLResponse {
140
+ success: boolean;
141
+ totalTvl: number;
142
+ byChain?: Record<string, number>;
143
+ }
144
+ interface VolumeResponse {
145
+ success: boolean;
146
+ volumeInUSD: string;
147
+ }
148
+ interface ActiveWallet {
149
+ smartWallet: string;
150
+ chains: number[];
151
+ hasBalance: boolean;
152
+ }
153
+ interface ActiveWalletsResponse {
154
+ success: boolean;
155
+ chainId: number;
156
+ wallets: ActiveWallet[];
157
+ count: number;
158
+ }
159
+ interface SmartWalletsByEOAResponse {
160
+ success: boolean;
161
+ eoa: string;
162
+ smartWallets: string[];
163
+ }
164
+ interface FirstTopupResponse {
165
+ success: boolean;
166
+ walletAddress: string;
167
+ date: string;
168
+ amount?: string;
169
+ chainId?: number;
170
+ }
171
+ interface HistoryEntry {
172
+ id?: string;
173
+ timestamp: string;
174
+ type: string;
175
+ amount: string;
176
+ token?: string;
177
+ txHash?: string;
178
+ chainId?: number;
179
+ protocol?: string;
180
+ pool?: string;
181
+ }
182
+ interface HistoryResponse {
183
+ success: boolean;
184
+ walletAddress: string;
185
+ data: HistoryEntry[];
186
+ total: number;
187
+ }
188
+ interface OnchainEarnings {
189
+ walletAddress: string;
190
+ totalEarnings: number;
191
+ currentEarnings: number;
192
+ lifetimeEarnings: number;
193
+ unrealizedEarnings?: number;
194
+ currentEarningsByChain?: Record<string, number>;
195
+ unrealizedEarningsByChain?: Record<string, number>;
196
+ lastCheckTimestamp?: string;
197
+ }
198
+ interface OnchainEarningsResponse {
199
+ success: boolean;
200
+ data: OnchainEarnings;
201
+ }
202
+ interface DailyEarning {
203
+ date: string;
204
+ earnings: number;
205
+ balance?: number;
206
+ apy?: number;
207
+ }
208
+ interface DailyEarningsResponse {
209
+ success: boolean;
210
+ walletAddress: string;
211
+ data: DailyEarning[];
212
+ count: number;
213
+ filters: {
214
+ startDate: string | null;
215
+ endDate: string | null;
216
+ };
217
+ }
218
+ interface PortfolioToken {
219
+ symbol: string;
220
+ amount: number;
221
+ valueUsd: number;
222
+ price?: number;
223
+ }
224
+ interface ChainPortfolio {
225
+ chainId: number;
226
+ chainName: string;
227
+ totalValueUsd: number;
228
+ tokens: PortfolioToken[];
229
+ }
230
+ interface DebankPortfolioResponse {
231
+ success: boolean;
232
+ walletAddress: string;
233
+ totalValueUsd: number;
234
+ chains: Record<string, ChainPortfolio>;
235
+ }
236
+ interface Opportunity {
237
+ id: string;
238
+ protocolId: string;
239
+ protocolName: string;
240
+ poolName: string;
241
+ chainId: number;
242
+ apy: number;
243
+ tvl?: number;
244
+ asset?: string;
245
+ risk?: string;
246
+ strategyType: "safe" | "degen";
247
+ status?: string;
248
+ }
249
+ interface OpportunitiesResponse {
250
+ success: boolean;
251
+ chainId?: number;
252
+ strategyType: "safe" | "degen";
253
+ data: Opportunity[];
254
+ }
255
+ interface DailyApyEntry {
256
+ date: string;
257
+ apy: number;
258
+ weightedApy?: number;
259
+ balance?: number;
260
+ protocol?: string;
261
+ pool?: string;
262
+ }
263
+ interface DailyApyHistoryResponse {
264
+ success: boolean;
265
+ walletAddress: string;
266
+ history: Record<string, DailyApyEntry>;
267
+ totalDays: number;
268
+ requestedDays?: number;
269
+ averageWeightedApy?: number;
270
+ }
271
+ interface RebalanceInfo {
272
+ id: string;
273
+ timestamp: string;
274
+ fromProtocol?: string;
275
+ toProtocol?: string;
276
+ fromPool?: string;
277
+ toPool?: string;
278
+ amount?: string;
279
+ isCrossChain: boolean;
280
+ fromChainId?: number;
281
+ toChainId?: number;
282
+ }
283
+ interface RebalanceInfoResponse {
284
+ success: boolean;
285
+ data: RebalanceInfo[];
286
+ count: number;
287
+ }
288
+ interface RebalanceFrequencyResponse {
289
+ success: boolean;
290
+ walletAddress: string;
291
+ tier: string;
292
+ frequency: number;
293
+ description?: string;
294
+ }
295
+ interface DepositResponse {
296
+ success: boolean;
297
+ txHash: string;
298
+ smartWallet: string;
299
+ amount: string;
300
+ status: "pending" | "confirmed" | "failed";
301
+ }
302
+ interface WithdrawResponse {
303
+ success: boolean;
304
+ txHash: string;
305
+ type: "full" | "partial";
306
+ amount: string;
307
+ receiver: string;
308
+ status: "pending" | "confirmed" | "failed";
309
+ }
310
+ interface PolicyData {
311
+ policy: Address;
312
+ initData: Hex;
313
+ }
314
+ interface ERC7739Context {
315
+ appDomainSeparator: Hex;
316
+ contentName: string[];
317
+ }
318
+ interface ERC7739Data {
319
+ allowedERC7739Content: ERC7739Context[];
320
+ erc1271Policies: PolicyData[];
321
+ }
322
+ interface ActionData {
323
+ actionTargetSelector: Hex;
324
+ actionTarget: Address;
325
+ actionPolicies: PolicyData[];
326
+ }
327
+ interface Session {
328
+ sessionValidator: Address;
329
+ sessionValidatorInitData: Hex;
330
+ salt: Hex;
331
+ userOpPolicies: PolicyData[];
332
+ erc7739Policies: ERC7739Data;
333
+ actions: ActionData[];
334
+ permitERC4337Paymaster: boolean;
335
+ chainId: bigint;
336
+ }
337
+
338
+ type SupportedChainId = 8453 | 42161 | 9745;
339
+ interface ChainConfig {
340
+ chain: Chain;
341
+ rpcUrl: string;
342
+ publicClient: PublicClient;
343
+ }
344
+ /**
345
+ * Get chain configuration for a given chain ID
346
+ */
347
+ declare const getChainConfig: (chainId: SupportedChainId) => ChainConfig;
348
+ /**
349
+ * Check if a chain ID is supported
350
+ */
351
+ declare const isSupportedChain: (chainId: number) => chainId is SupportedChainId;
352
+ /**
353
+ * Get all supported chain IDs
354
+ */
355
+ declare const getSupportedChainIds: () => SupportedChainId[];
356
+
357
+ /**
358
+ * ZyFAI SDK Main Class
359
+ */
360
+
361
+ declare class ZyfaiSDK {
362
+ private httpClient;
363
+ private signer;
364
+ private walletClient;
365
+ private bundlerApiKey?;
366
+ private isAuthenticated;
367
+ private authenticatedUserId;
368
+ private environment;
369
+ constructor(config: SDKConfig | string);
370
+ /**
371
+ * Authenticate user with SIWE (Sign-In with Ethereum) & JWT token
372
+ * This is required for accessing user-specific endpoints like session-keys/config
373
+ * Uses the connected wallet address for authentication
374
+ *
375
+ * @returns Promise that resolves when authentication is complete
376
+ */
377
+ private authenticateUser;
378
+ /**
379
+ * Update user profile with Smart Wallet address and chain configuration
380
+ * This method requires SIWE authentication and is automatically called after deploySafe
381
+ *
382
+ * @param request - User profile update data
383
+ * @returns Updated user profile information
384
+ *
385
+ * @example
386
+ * ```typescript
387
+ * await sdk.updateUserProfile({
388
+ * smartWallet: "0x1396730...",
389
+ * chains: [8453, 42161],
390
+ * });
391
+ * ```
392
+ */
393
+ updateUserProfile(request: UpdateUserProfileRequest): Promise<UpdateUserProfileResponse>;
394
+ /**
395
+ * Connect account for signing transactions
396
+ * Accepts either a private key string or a modern wallet provider
397
+ *
398
+ * @param account - Private key string or wallet provider object
399
+ * @param chainId - Target chain ID (default: 42161 - Arbitrum)
400
+ * @returns The connected EOA address
401
+ *
402
+ * @example
403
+ * // With private key
404
+ * await sdk.connectAccount('0x...');
405
+ *
406
+ * @example
407
+ * // With wallet provider (e.g., from wagmi, web3-react, etc.)
408
+ * const provider = await connector.getProvider();
409
+ * await sdk.connectAccount(provider);
410
+ */
411
+ connectAccount(account: string | any, chainId?: SupportedChainId): Promise<Address>;
412
+ /**
413
+ * Get wallet client (throws if not connected)
414
+ * @private
415
+ */
416
+ private getWalletClient;
417
+ /**
418
+ * Get smart wallet address for a user
419
+ * Returns the deterministic Safe address for an EOA, or the address itself if already a Safe
420
+ *
421
+ * @param userAddress - User's EOA address
422
+ * @param chainId - Target chain ID
423
+ * @returns Smart wallet information including address and deployment status
424
+ */
425
+ getSmartWalletAddress(userAddress: string, chainId: SupportedChainId): Promise<SmartWalletResponse>;
426
+ /**
427
+ * Deploy Safe Smart Wallet for a user
428
+ *
429
+ * @param userAddress - User's EOA address (the connected EOA, not the smart wallet address)
430
+ * @param chainId - Target chain ID
431
+ * @returns Deployment response with Safe address and transaction hash
432
+ */
433
+ deploySafe(userAddress: string, chainId: SupportedChainId): Promise<DeploySafeResponse>;
434
+ /**
435
+ * Create session key with auto-fetched configuration from ZyFAI API
436
+ * This is the simplified method that automatically fetches session configuration
437
+ *
438
+ * @param userAddress - User's EOA or Safe address
439
+ * @param chainId - Target chain ID
440
+ * @returns Session key response with signature and nonces
441
+ *
442
+ * @example
443
+ * ```typescript
444
+ * // Simple usage - no need to configure sessions manually
445
+ * const result = await sdk.createSessionKey(userAddress, 8453);
446
+ * console.log("Session created:", result.signature);
447
+ * ```
448
+ */
449
+ createSessionKey(userAddress: string, chainId: SupportedChainId): Promise<SessionKeyResponse>;
450
+ /**
451
+ * Internal method to sign session key
452
+ * @private
453
+ */
454
+ private signSessionKey;
455
+ /**
456
+ * Activate session key via ZyFAI API
457
+ */
458
+ private activateSessionKey;
459
+ /**
460
+ * Convert session nonces from bigint[] to number[]
461
+ */
462
+ private normalizeSessionNonces;
463
+ /**
464
+ * Deposit funds from EOA to Safe smart wallet
465
+ * Transfers tokens from the connected wallet to the user's Safe and logs the deposit
466
+ *
467
+ * @param userAddress - User's address (owner of the Safe)
468
+ * @param chainId - Target chain ID
469
+ * @param tokenAddress - Token contract address to deposit
470
+ * @param amount - Amount in least decimal units (e.g., "100000000" for 100 USDC with 6 decimals)
471
+ * @returns Deposit response with transaction hash
472
+ *
473
+ * @example
474
+ * ```typescript
475
+ * // Deposit 100 USDC (6 decimals) to Safe on Arbitrum
476
+ * const result = await sdk.depositFunds(
477
+ * "0xUser...",
478
+ * 42161,
479
+ * "0xaf88d065e77c8cc2239327c5edb3a432268e5831", // USDC
480
+ * "100000000" // 100 USDC = 100 * 10^6
481
+ * );
482
+ * ```
483
+ */
484
+ depositFunds(userAddress: string, chainId: SupportedChainId, tokenAddress: string, amount: string): Promise<DepositResponse>;
485
+ /**
486
+ * Withdraw funds from Safe smart wallet
487
+ * Triggers a withdrawal request to the ZyFAI API
488
+ *
489
+ * @param userAddress - User's address (owner of the Safe)
490
+ * @param chainId - Target chain ID
491
+ * @param amount - Optional: Amount in least decimal units to withdraw (partial withdrawal). If not specified, withdraws all funds
492
+ * @param receiver - Optional: Receiver address. If not specified, sends to Safe owner
493
+ * @returns Withdraw response with transaction hash
494
+ *
495
+ * @example
496
+ * ```typescript
497
+ * // Full withdrawal
498
+ * const result = await sdk.withdrawFunds("0xUser...", 42161);
499
+ *
500
+ * // Partial withdrawal of 50 USDC (6 decimals)
501
+ * const result = await sdk.withdrawFunds(
502
+ * "0xUser...",
503
+ * 42161,
504
+ * "50000000", // 50 USDC = 50 * 10^6
505
+ * "0xReceiver..."
506
+ * );
507
+ * ```
508
+ */
509
+ withdrawFunds(userAddress: string, chainId: SupportedChainId, amount?: string, receiver?: string): Promise<WithdrawResponse>;
510
+ /**
511
+ * Get available DeFi protocols and pools for a specific chain
512
+ *
513
+ * @param chainId - Target chain ID
514
+ * @returns List of available protocols with their pools and APY data
515
+ *
516
+ * @example
517
+ * ```typescript
518
+ * const protocols = await sdk.getAvailableProtocols(42161);
519
+ * protocols.forEach(protocol => {
520
+ * console.log(`${protocol.name}: ${protocol.minApy}% - ${protocol.maxApy}% APY`);
521
+ * });
522
+ * ```
523
+ */
524
+ getAvailableProtocols(chainId: SupportedChainId): Promise<ProtocolsResponse>;
525
+ /**
526
+ * Get all active DeFi positions for a user
527
+ *
528
+ * @param userAddress - User's EOA address
529
+ * @param chainId - Optional: Filter by specific chain ID
530
+ * @returns User's positions across all protocols
531
+ *
532
+ * @example
533
+ * ```typescript
534
+ * // Get all positions across all chains
535
+ * const positions = await sdk.getPositions(userAddress);
536
+ *
537
+ * // Get positions on a specific chain
538
+ * const arbPositions = await sdk.getPositions(userAddress, 42161);
539
+ * ```
540
+ */
541
+ getPositions(userAddress: string, chainId?: SupportedChainId): Promise<PositionsResponse>;
542
+ /**
543
+ * Get current authenticated user details
544
+ * Requires SIWE authentication
545
+ *
546
+ * @returns User details including smart wallet, chains, protocols, etc.
547
+ *
548
+ * @example
549
+ * ```typescript
550
+ * await sdk.connectAccount(privateKey, chainId);
551
+ * const user = await sdk.getUserDetails();
552
+ * console.log("Smart Wallet:", user.user.smartWallet);
553
+ * console.log("Chains:", user.user.chains);
554
+ * ```
555
+ */
556
+ getUserDetails(): Promise<UserDetailsResponse>;
557
+ /**
558
+ * Get total value locked (TVL) across all ZyFAI accounts
559
+ *
560
+ * @returns Total TVL in USD and breakdown by chain
561
+ *
562
+ * @example
563
+ * ```typescript
564
+ * const tvl = await sdk.getTVL();
565
+ * console.log("Total TVL:", tvl.totalTvl);
566
+ * ```
567
+ */
568
+ getTVL(): Promise<TVLResponse>;
569
+ /**
570
+ * Get total volume across all ZyFAI accounts
571
+ *
572
+ * @returns Total volume in USD
573
+ *
574
+ * @example
575
+ * ```typescript
576
+ * const volume = await sdk.getVolume();
577
+ * console.log("Total Volume:", volume.volumeInUSD);
578
+ * ```
579
+ */
580
+ getVolume(): Promise<VolumeResponse>;
581
+ /**
582
+ * Get active wallets for a specific chain
583
+ *
584
+ * @param chainId - Chain ID to filter wallets
585
+ * @returns List of active wallets on the specified chain
586
+ *
587
+ * @example
588
+ * ```typescript
589
+ * const wallets = await sdk.getActiveWallets(8453); // Base
590
+ * console.log("Active wallets:", wallets.count);
591
+ * ```
592
+ */
593
+ getActiveWallets(chainId: number): Promise<ActiveWalletsResponse>;
594
+ /**
595
+ * Get smart wallets associated with an EOA address
596
+ *
597
+ * @param eoaAddress - EOA (externally owned account) address
598
+ * @returns List of smart wallets owned by the EOA
599
+ *
600
+ * @example
601
+ * ```typescript
602
+ * const result = await sdk.getSmartWalletsByEOA("0x...");
603
+ * console.log("Smart wallets:", result.smartWallets);
604
+ * ```
605
+ */
606
+ getSmartWalletsByEOA(eoaAddress: string): Promise<SmartWalletsByEOAResponse>;
607
+ /**
608
+ * Get the first topup (deposit) information for a wallet
609
+ *
610
+ * @param walletAddress - Smart wallet address
611
+ * @param chainId - Chain ID
612
+ * @returns First topup date and details
613
+ *
614
+ * @example
615
+ * ```typescript
616
+ * const firstTopup = await sdk.getFirstTopup("0x...", 8453);
617
+ * console.log("First deposit date:", firstTopup.date);
618
+ * ```
619
+ */
620
+ getFirstTopup(walletAddress: string, chainId: number): Promise<FirstTopupResponse>;
621
+ /**
622
+ * Get transaction history for a wallet
623
+ *
624
+ * @param walletAddress - Smart wallet address
625
+ * @param chainId - Chain ID
626
+ * @param options - Optional pagination and date filters
627
+ * @returns Transaction history
628
+ *
629
+ * @example
630
+ * ```typescript
631
+ * const history = await sdk.getHistory("0x...", 8453, { limit: 50 });
632
+ * history.data.forEach(tx => console.log(tx.type, tx.amount));
633
+ * ```
634
+ */
635
+ getHistory(walletAddress: string, chainId: SupportedChainId, options?: {
636
+ limit?: number;
637
+ offset?: number;
638
+ fromDate?: string;
639
+ toDate?: string;
640
+ }): Promise<HistoryResponse>;
641
+ /**
642
+ * Get onchain earnings for a wallet
643
+ *
644
+ * @param walletAddress - Smart wallet address
645
+ * @returns Onchain earnings data including total, current, and lifetime
646
+ *
647
+ * @example
648
+ * ```typescript
649
+ * const earnings = await sdk.getOnchainEarnings("0x...");
650
+ * console.log("Total earnings:", earnings.data.totalEarnings);
651
+ * ```
652
+ */
653
+ getOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
654
+ /**
655
+ * Calculate/refresh onchain earnings for a wallet
656
+ * This triggers a recalculation of earnings on the backend
657
+ *
658
+ * @param walletAddress - Smart wallet address
659
+ * @returns Updated onchain earnings data
660
+ *
661
+ * @example
662
+ * ```typescript
663
+ * const earnings = await sdk.calculateOnchainEarnings("0x...");
664
+ * console.log("Calculated earnings:", earnings.data.totalEarnings);
665
+ * ```
666
+ */
667
+ calculateOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
668
+ /**
669
+ * Get daily earnings for a wallet within a date range
670
+ *
671
+ * @param walletAddress - Smart wallet address
672
+ * @param startDate - Start date (YYYY-MM-DD format)
673
+ * @param endDate - End date (YYYY-MM-DD format)
674
+ * @returns Daily earnings breakdown
675
+ *
676
+ * @example
677
+ * ```typescript
678
+ * const daily = await sdk.getDailyEarnings("0x...", "2024-01-01", "2024-01-31");
679
+ * daily.data.forEach(d => console.log(d.date, d.earnings));
680
+ * ```
681
+ */
682
+ getDailyEarnings(walletAddress: string, startDate?: string, endDate?: string): Promise<DailyEarningsResponse>;
683
+ /**
684
+ * Get Debank portfolio for a wallet across multiple chains
685
+ * Note: This is a paid endpoint and may require authorization
686
+ *
687
+ * @param walletAddress - Smart wallet address
688
+ * @returns Multi-chain portfolio data
689
+ *
690
+ * @example
691
+ * ```typescript
692
+ * const portfolio = await sdk.getDebankPortfolio("0x...");
693
+ * console.log("Total value:", portfolio.totalValueUsd);
694
+ * ```
695
+ */
696
+ getDebankPortfolio(walletAddress: string): Promise<DebankPortfolioResponse>;
697
+ /**
698
+ * Get safe (low-risk) yield opportunities
699
+ *
700
+ * @param chainId - Optional chain ID filter
701
+ * @returns List of safe yield opportunities
702
+ *
703
+ * @example
704
+ * ```typescript
705
+ * const opportunities = await sdk.getSafeOpportunities(8453);
706
+ * opportunities.data.forEach(o => console.log(o.protocolName, o.apy));
707
+ * ```
708
+ */
709
+ getSafeOpportunities(chainId?: number): Promise<OpportunitiesResponse>;
710
+ /**
711
+ * Get degen (high-risk, high-reward) yield strategies
712
+ *
713
+ * @param chainId - Optional chain ID filter
714
+ * @returns List of degen strategies
715
+ *
716
+ * @example
717
+ * ```typescript
718
+ * const strategies = await sdk.getDegenStrategies(8453);
719
+ * strategies.data.forEach(s => console.log(s.protocolName, s.apy));
720
+ * ```
721
+ */
722
+ getDegenStrategies(chainId?: number): Promise<OpportunitiesResponse>;
723
+ /**
724
+ * Get daily APY history with weighted average for a wallet
725
+ *
726
+ * @param walletAddress - Smart wallet address
727
+ * @param days - Period: "7D", "14D", or "30D" (default: "7D")
728
+ * @returns Daily APY history with weighted averages
729
+ *
730
+ * @example
731
+ * ```typescript
732
+ * const apyHistory = await sdk.getDailyApyHistory("0x...", "30D");
733
+ * console.log("Average APY:", apyHistory.averageWeightedApy);
734
+ * ```
735
+ */
736
+ getDailyApyHistory(walletAddress: string, days?: "7D" | "14D" | "30D"): Promise<DailyApyHistoryResponse>;
737
+ /**
738
+ * Get rebalance information
739
+ * Shows yield generated by rebalancing strategies
740
+ *
741
+ * @param isCrossChain - Filter by cross-chain or same-chain rebalances
742
+ * @returns List of rebalance events
743
+ *
744
+ * @example
745
+ * ```typescript
746
+ * // Get same-chain rebalance info
747
+ * const rebalances = await sdk.getRebalanceInfo(false);
748
+ * console.log("Rebalance count:", rebalances.count);
749
+ * ```
750
+ */
751
+ getRebalanceInfo(isCrossChain?: boolean): Promise<RebalanceInfoResponse>;
752
+ /**
753
+ * Get rebalance frequency/tier for a wallet
754
+ * Determines how often the wallet can be rebalanced based on tier
755
+ *
756
+ * @param walletAddress - Smart wallet address
757
+ * @returns Rebalance frequency tier and details
758
+ *
759
+ * @example
760
+ * ```typescript
761
+ * const frequency = await sdk.getRebalanceFrequency("0x...");
762
+ * console.log("Tier:", frequency.tier);
763
+ * console.log("Max rebalances/day:", frequency.frequency);
764
+ * ```
765
+ */
766
+ getRebalanceFrequency(walletAddress: string): Promise<RebalanceFrequencyResponse>;
767
+ }
768
+
769
+ export { type ActionData, type ActiveWallet, type ActiveWalletsResponse, type Address, type ChainConfig, type ChainPortfolio, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DeploySafeResponse, type DepositResponse, type ERC7739Context, type ERC7739Data, type Environment, type FirstTopupResponse, type Hex, type HistoryEntry, 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 RebalanceInfo, type RebalanceInfoResponse, type SDKConfig, type Session, type SessionKeyResponse, type SmartWalletResponse, type SmartWalletsByEOAResponse, type SupportedChainId, type TVLResponse, type UserDetails, type UserDetailsResponse, type VolumeResponse, type WithdrawResponse, ZyfaiSDK, getChainConfig, getSupportedChainIds, isSupportedChain };