@zyfai/sdk 0.2.23 → 0.2.24
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 +23 -10
- package/dist/index.d.mts +101 -114
- package/dist/index.d.ts +101 -114
- package/dist/index.js +262 -192
- package/dist/index.mjs +262 -192
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -682,36 +682,47 @@ history.data.forEach((tx) => console.log(tx.type, tx.amount));
|
|
|
682
682
|
|
|
683
683
|
#### Get Onchain Earnings
|
|
684
684
|
|
|
685
|
+
Earnings are returned per-token (multi-asset support).
|
|
686
|
+
|
|
685
687
|
```typescript
|
|
686
688
|
const earnings = await sdk.getOnchainEarnings(walletAddress);
|
|
687
|
-
|
|
688
|
-
console.log("
|
|
689
|
-
console.log("Lifetime
|
|
689
|
+
// Per-token earnings: { "USDC": "0.020667", "WETH": "0.000009" }
|
|
690
|
+
console.log("Total by token:", earnings.data.totalEarningsByToken);
|
|
691
|
+
console.log("Lifetime by token:", earnings.data.lifetimeEarningsByToken);
|
|
692
|
+
console.log("By chain:", earnings.data.currentEarningsByChain);
|
|
690
693
|
```
|
|
691
694
|
|
|
692
695
|
#### Calculate Onchain Earnings (Refresh)
|
|
693
696
|
|
|
694
697
|
```typescript
|
|
695
698
|
const updated = await sdk.calculateOnchainEarnings(walletAddress);
|
|
696
|
-
console.log("Updated earnings:", updated.data.
|
|
699
|
+
console.log("Updated earnings:", updated.data.totalEarningsByToken);
|
|
697
700
|
```
|
|
698
701
|
|
|
699
702
|
#### Get Daily Earnings
|
|
700
703
|
|
|
704
|
+
Daily earnings snapshots with per-token breakdowns.
|
|
705
|
+
|
|
701
706
|
```typescript
|
|
702
707
|
const daily = await sdk.getDailyEarnings(
|
|
703
708
|
walletAddress,
|
|
704
709
|
"2024-01-01",
|
|
705
710
|
"2024-01-31"
|
|
706
711
|
);
|
|
707
|
-
daily.data.forEach((d) =>
|
|
712
|
+
daily.data.forEach((d) => {
|
|
713
|
+
console.log(d.snapshot_date, d.total_earnings_by_token);
|
|
714
|
+
});
|
|
708
715
|
```
|
|
709
716
|
|
|
710
717
|
#### Get Daily APY History
|
|
711
718
|
|
|
719
|
+
Returns per-position APY breakdowns with per-token weighted averages.
|
|
720
|
+
|
|
712
721
|
```typescript
|
|
713
722
|
const apyHistory = await sdk.getDailyApyHistory(walletAddress, "30D");
|
|
714
|
-
|
|
723
|
+
// Per-token weighted APY: { "USDC": 4.64, "WETH": 1.94 }
|
|
724
|
+
console.log("Weighted APY after fee:", apyHistory.weightedApyAfterFee);
|
|
725
|
+
// Each date entry has positions (with tokenSymbol), and per-token weighted_apy, fee, etc.
|
|
715
726
|
```
|
|
716
727
|
|
|
717
728
|
### 10. Opportunities & Strategies
|
|
@@ -719,7 +730,8 @@ console.log("Average Weighted APY:", apyHistory.averageWeightedApy);
|
|
|
719
730
|
#### Get Conservative Opportunities (Low Risk)
|
|
720
731
|
|
|
721
732
|
```typescript
|
|
722
|
-
|
|
733
|
+
// Filter by chain and/or asset
|
|
734
|
+
const conservativeOpps = await sdk.getConservativeOpportunities(8453, "USDC");
|
|
723
735
|
conservativeOpps.data.forEach((o) => {
|
|
724
736
|
console.log(`${o.protocolName} - ${o.poolName}: ${o.apy}% APY`);
|
|
725
737
|
});
|
|
@@ -728,7 +740,8 @@ conservativeOpps.data.forEach((o) => {
|
|
|
728
740
|
#### Get Aggressive Opportunities (High Risk)
|
|
729
741
|
|
|
730
742
|
```typescript
|
|
731
|
-
|
|
743
|
+
// Filter by chain and/or asset
|
|
744
|
+
const aggressiveOpps = await sdk.getAggressiveOpportunities(8453, "WETH");
|
|
732
745
|
aggressiveOpps.data.forEach((o) => {
|
|
733
746
|
console.log(`${o.protocolName} - ${o.poolName}: ${o.apy}% APY`);
|
|
734
747
|
});
|
|
@@ -739,8 +752,8 @@ aggressiveOpps.data.forEach((o) => {
|
|
|
739
752
|
#### Get APY Per Strategy
|
|
740
753
|
|
|
741
754
|
```typescript
|
|
742
|
-
// Get same-chain rebalances
|
|
743
|
-
const apyPerStrategy = await sdk.getAPYPerStrategy(false, 7, "conservative");
|
|
755
|
+
// Get same-chain rebalances, optionally filter by chainId and tokenSymbol
|
|
756
|
+
const apyPerStrategy = await sdk.getAPYPerStrategy(false, 7, "conservative", 8453, "USDC");
|
|
744
757
|
console.log("APY per strategy:", apyPerStrategy.data);
|
|
745
758
|
```
|
|
746
759
|
|
package/dist/index.d.mts
CHANGED
|
@@ -28,17 +28,16 @@ interface UpdateUserProfileRequest {
|
|
|
28
28
|
protocols?: string[];
|
|
29
29
|
autoSelectProtocols?: boolean;
|
|
30
30
|
omniAccount?: boolean;
|
|
31
|
+
chains?: number[];
|
|
31
32
|
autocompounding?: boolean;
|
|
32
33
|
agentName?: string;
|
|
33
34
|
crosschainStrategy?: boolean;
|
|
34
35
|
splitting?: boolean;
|
|
35
36
|
minSplits?: number;
|
|
36
|
-
|
|
37
|
+
asset?: "usdc" | "eth";
|
|
37
38
|
}
|
|
38
|
-
/** @internal */
|
|
39
39
|
interface UpdateUserProfileResponse {
|
|
40
40
|
success: boolean;
|
|
41
|
-
userId: string;
|
|
42
41
|
smartWallet?: Address;
|
|
43
42
|
chains?: number[];
|
|
44
43
|
strategy?: string;
|
|
@@ -49,9 +48,11 @@ interface UpdateUserProfileResponse {
|
|
|
49
48
|
agentName?: string;
|
|
50
49
|
crosschainStrategy?: boolean;
|
|
51
50
|
executorProxy?: boolean;
|
|
51
|
+
hasActiveSessionKey?: boolean;
|
|
52
52
|
splitting?: boolean;
|
|
53
53
|
minSplits?: number;
|
|
54
54
|
customization?: Record<string, any>;
|
|
55
|
+
asset?: "usdc" | "eth";
|
|
55
56
|
}
|
|
56
57
|
/** @internal */
|
|
57
58
|
interface AddSessionKeyResponse {
|
|
@@ -129,6 +130,19 @@ interface Portfolio {
|
|
|
129
130
|
splitting?: boolean;
|
|
130
131
|
minSplits?: number;
|
|
131
132
|
executorProxy?: boolean;
|
|
133
|
+
assetTypeSettings?: AssetTypeSettings;
|
|
134
|
+
}
|
|
135
|
+
interface AssetTypeSettings {
|
|
136
|
+
[assetType: string]: {
|
|
137
|
+
rebalanceStrategy?: string;
|
|
138
|
+
autocompounding?: boolean;
|
|
139
|
+
crosschainStrategy?: boolean;
|
|
140
|
+
splitting?: boolean;
|
|
141
|
+
minSplits?: number;
|
|
142
|
+
chains?: number[];
|
|
143
|
+
autoSelectProtocols?: boolean;
|
|
144
|
+
protocols?: string[];
|
|
145
|
+
};
|
|
132
146
|
}
|
|
133
147
|
interface PositionSlot {
|
|
134
148
|
chain?: string;
|
|
@@ -149,44 +163,9 @@ interface PortfolioResponse {
|
|
|
149
163
|
userAddress: string;
|
|
150
164
|
portfolio: Portfolio;
|
|
151
165
|
}
|
|
152
|
-
interface UserDetails {
|
|
153
|
-
id: string;
|
|
154
|
-
address: string;
|
|
155
|
-
smartWallet: string;
|
|
156
|
-
chains: number[];
|
|
157
|
-
protocols: Protocol[];
|
|
158
|
-
hasActiveSessionKey: boolean;
|
|
159
|
-
email?: string;
|
|
160
|
-
strategy?: string;
|
|
161
|
-
telegramId?: string;
|
|
162
|
-
walletType?: string;
|
|
163
|
-
autoSelectProtocols: boolean;
|
|
164
|
-
autocompounding?: boolean;
|
|
165
|
-
omniAccount?: boolean;
|
|
166
|
-
crosschainStrategy?: boolean;
|
|
167
|
-
agentName?: string;
|
|
168
|
-
customization?: Record<string, any>;
|
|
169
|
-
executorProxy?: boolean;
|
|
170
|
-
splitting?: boolean;
|
|
171
|
-
minSplits?: number;
|
|
172
|
-
registered?: boolean;
|
|
173
|
-
}
|
|
174
|
-
interface UserDetailsResponse {
|
|
175
|
-
success: boolean;
|
|
176
|
-
user: UserDetails;
|
|
177
|
-
}
|
|
178
|
-
interface TVLBreakdown {
|
|
179
|
-
chain_id: number;
|
|
180
|
-
protocol_id: string | null;
|
|
181
|
-
protocol_name: string | null;
|
|
182
|
-
pool: string | null;
|
|
183
|
-
total_balance: number;
|
|
184
|
-
}
|
|
185
166
|
interface TVLResponse {
|
|
186
167
|
success: boolean;
|
|
187
168
|
totalTvl: number;
|
|
188
|
-
byChain?: Record<number, number>;
|
|
189
|
-
breakdown?: TVLBreakdown[];
|
|
190
169
|
}
|
|
191
170
|
interface APYPerStrategy {
|
|
192
171
|
id: string;
|
|
@@ -201,8 +180,12 @@ interface APYPerStrategy {
|
|
|
201
180
|
total_rebalances: number;
|
|
202
181
|
created_at: string;
|
|
203
182
|
strategy: string;
|
|
183
|
+
token_symbol?: string;
|
|
204
184
|
average_apy_with_fee: number;
|
|
205
185
|
average_apy_with_rzfi_with_fee: number;
|
|
186
|
+
average_apy_without_fee?: number;
|
|
187
|
+
average_apy_with_rzfi_without_fee?: number;
|
|
188
|
+
events_average_apy?: Record<string, number>;
|
|
206
189
|
}
|
|
207
190
|
interface APYPerStrategyResponse {
|
|
208
191
|
success: boolean;
|
|
@@ -271,15 +254,15 @@ interface HistoryResponse {
|
|
|
271
254
|
data: HistoryEntry[];
|
|
272
255
|
total: number;
|
|
273
256
|
}
|
|
257
|
+
type TokenEarnings = Record<string, string>;
|
|
274
258
|
interface OnchainEarnings {
|
|
275
259
|
walletAddress: string;
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
unrealizedEarnings
|
|
280
|
-
currentEarningsByChain?: Record<string, number>;
|
|
281
|
-
unrealizedEarningsByChain?: Record<string, number>;
|
|
260
|
+
totalEarningsByToken: TokenEarnings;
|
|
261
|
+
lifetimeEarningsByToken: TokenEarnings;
|
|
262
|
+
currentEarningsByChain: Record<string, TokenEarnings>;
|
|
263
|
+
unrealizedEarnings: Record<string, TokenEarnings>;
|
|
282
264
|
lastCheckTimestamp?: string;
|
|
265
|
+
lastLogDate?: Record<string, string | null>;
|
|
283
266
|
}
|
|
284
267
|
interface OnchainEarningsResponse {
|
|
285
268
|
success: boolean;
|
|
@@ -288,14 +271,14 @@ interface OnchainEarningsResponse {
|
|
|
288
271
|
interface DailyEarning {
|
|
289
272
|
wallet_address?: string;
|
|
290
273
|
snapshot_date: string;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
274
|
+
current_earnings_by_token: TokenEarnings;
|
|
275
|
+
lifetime_earnings_by_token: TokenEarnings;
|
|
276
|
+
unrealized_earnings_by_token: TokenEarnings;
|
|
277
|
+
total_earnings_by_token: TokenEarnings;
|
|
278
|
+
daily_current_delta_by_token: TokenEarnings;
|
|
279
|
+
daily_lifetime_delta_by_token: TokenEarnings;
|
|
280
|
+
daily_unrealized_delta_by_token: TokenEarnings;
|
|
281
|
+
daily_total_delta_by_token: TokenEarnings;
|
|
299
282
|
created_at?: string;
|
|
300
283
|
}
|
|
301
284
|
interface DailyEarningsResponse {
|
|
@@ -345,13 +328,23 @@ interface OpportunitiesResponse {
|
|
|
345
328
|
strategyType: "conservative" | "aggressive";
|
|
346
329
|
data: Opportunity[];
|
|
347
330
|
}
|
|
348
|
-
interface
|
|
349
|
-
date: string;
|
|
331
|
+
interface ApyPosition {
|
|
350
332
|
apy: number;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
protocol
|
|
354
|
-
pool
|
|
333
|
+
balance: number;
|
|
334
|
+
chainId: number;
|
|
335
|
+
protocol: string;
|
|
336
|
+
pool: string;
|
|
337
|
+
strategy: string;
|
|
338
|
+
tokenSymbol?: string;
|
|
339
|
+
}
|
|
340
|
+
type TokenApy = Record<string, number>;
|
|
341
|
+
interface DailyApyEntry {
|
|
342
|
+
positions: ApyPosition[];
|
|
343
|
+
weighted_apy: TokenApy;
|
|
344
|
+
fee: TokenApy;
|
|
345
|
+
weighted_apy_after_fee: TokenApy;
|
|
346
|
+
rzfi_merkl_apr: TokenApy;
|
|
347
|
+
final_weighted_apy: TokenApy;
|
|
355
348
|
}
|
|
356
349
|
interface DailyApyHistoryResponse {
|
|
357
350
|
success: boolean;
|
|
@@ -359,8 +352,8 @@ interface DailyApyHistoryResponse {
|
|
|
359
352
|
history: Record<string, DailyApyEntry>;
|
|
360
353
|
totalDays: number;
|
|
361
354
|
requestedDays?: number;
|
|
362
|
-
weightedApyWithRzfiAfterFee?:
|
|
363
|
-
weightedApyAfterFee?:
|
|
355
|
+
weightedApyWithRzfiAfterFee?: TokenApy;
|
|
356
|
+
weightedApyAfterFee?: TokenApy;
|
|
364
357
|
}
|
|
365
358
|
interface RebalanceFrequencyResponse {
|
|
366
359
|
success: boolean;
|
|
@@ -516,7 +509,7 @@ interface ChainConfig {
|
|
|
516
509
|
publicClient: PublicClient;
|
|
517
510
|
}
|
|
518
511
|
declare const DEFAULT_TOKEN_ADDRESSES: Record<SupportedChainId, string>;
|
|
519
|
-
declare const getDefaultTokenAddress: (chainId: SupportedChainId) => string;
|
|
512
|
+
declare const getDefaultTokenAddress: (chainId: SupportedChainId, asset?: string) => string;
|
|
520
513
|
/**
|
|
521
514
|
* Get chain configuration for a given chain ID.
|
|
522
515
|
*
|
|
@@ -592,23 +585,23 @@ declare class ZyfaiSDK {
|
|
|
592
585
|
*/
|
|
593
586
|
pauseAgent(): Promise<UpdateUserProfileResponse>;
|
|
594
587
|
/**
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
588
|
+
* Resume the agent by restoring protocols based on user's strategy for each asset
|
|
589
|
+
* Fetches available protocols and assigns them based on each asset's strategy
|
|
590
|
+
*
|
|
591
|
+
* @returns Response indicating success and updated user details
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```typescript
|
|
595
|
+
* const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
|
|
596
|
+
*
|
|
597
|
+
* // Connect account first
|
|
598
|
+
* await sdk.connectAccount();
|
|
599
|
+
*
|
|
600
|
+
* // Resume the agent
|
|
601
|
+
* const result = await sdk.resumeAgent();
|
|
602
|
+
* console.log('Agent resumed:', result.success);
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
612
605
|
resumeAgent(): Promise<UpdateUserProfileResponse>;
|
|
613
606
|
/**
|
|
614
607
|
* Enable splitting for the user's account
|
|
@@ -811,7 +804,7 @@ declare class ZyfaiSDK {
|
|
|
811
804
|
* );
|
|
812
805
|
* ```
|
|
813
806
|
*/
|
|
814
|
-
depositFunds(userAddress: string, chainId: SupportedChainId, amount: string): Promise<DepositResponse>;
|
|
807
|
+
depositFunds(userAddress: string, chainId: SupportedChainId, amount: string, asset?: string): Promise<DepositResponse>;
|
|
815
808
|
/**
|
|
816
809
|
* Log a deposit that was executed client-side
|
|
817
810
|
*
|
|
@@ -877,7 +870,7 @@ declare class ZyfaiSDK {
|
|
|
877
870
|
* );
|
|
878
871
|
* ```
|
|
879
872
|
*/
|
|
880
|
-
withdrawFunds(userAddress: string, chainId: SupportedChainId, amount?: string): Promise<WithdrawResponse>;
|
|
873
|
+
withdrawFunds(userAddress: string, chainId: SupportedChainId, amount?: string, tokenSymbol?: string): Promise<WithdrawResponse>;
|
|
881
874
|
/**
|
|
882
875
|
* Get available DeFi protocols and pools for a specific chain
|
|
883
876
|
*
|
|
@@ -924,7 +917,7 @@ declare class ZyfaiSDK {
|
|
|
924
917
|
* console.log("Chains:", user.user.chains);
|
|
925
918
|
* ```
|
|
926
919
|
*/
|
|
927
|
-
getUserDetails(): Promise<
|
|
920
|
+
getUserDetails(asset?: "usdc" | "eth"): Promise<UpdateUserProfileResponse>;
|
|
928
921
|
/**
|
|
929
922
|
* Get total value locked (TVL) across all Zyfai accounts
|
|
930
923
|
*
|
|
@@ -943,15 +936,17 @@ declare class ZyfaiSDK {
|
|
|
943
936
|
* @param crossChain - Whether to get cross-chain APY (true = omni account, false = simple account)
|
|
944
937
|
* @param days - Time period: 7, 14, or 30
|
|
945
938
|
* @param strategy - Strategy type: "conservative" (default) or "aggressive"
|
|
939
|
+
* @param chainId - Optional chain ID filter
|
|
940
|
+
* @param tokenSymbol - Optional token symbol filter (e.g. "USDC", "WETH", "WBTC")
|
|
946
941
|
* @returns APY per strategy for a specific chain
|
|
947
942
|
*
|
|
948
943
|
* @example
|
|
949
944
|
* ```typescript
|
|
950
|
-
* const apyPerStrategy = await sdk.getAPYPerStrategy(false, 7, "conservative");
|
|
945
|
+
* const apyPerStrategy = await sdk.getAPYPerStrategy(false, 7, "conservative", 8453, "USDC");
|
|
951
946
|
* console.log("APY per strategy per chain:", apyPerStrategy.data);
|
|
952
947
|
* ```
|
|
953
948
|
*/
|
|
954
|
-
getAPYPerStrategy(crossChain?: boolean, days?: number, strategy?: Strategy): Promise<APYPerStrategyResponse>;
|
|
949
|
+
getAPYPerStrategy(crossChain?: boolean, days?: number, strategy?: Strategy, chainId?: number, tokenSymbol?: string): Promise<APYPerStrategyResponse>;
|
|
955
950
|
/**
|
|
956
951
|
* Get total volume across all Zyfai accounts
|
|
957
952
|
*
|
|
@@ -963,7 +958,7 @@ declare class ZyfaiSDK {
|
|
|
963
958
|
* console.log("Total Volume:", volume.volumeInUSD);
|
|
964
959
|
* ```
|
|
965
960
|
*/
|
|
966
|
-
getVolume(): Promise<VolumeResponse>;
|
|
961
|
+
getVolume(assetType?: "usdc" | "eth"): Promise<VolumeResponse>;
|
|
967
962
|
/**
|
|
968
963
|
* Get active wallets for a specific chain
|
|
969
964
|
*
|
|
@@ -1028,12 +1023,12 @@ declare class ZyfaiSDK {
|
|
|
1028
1023
|
* Get onchain earnings for a wallet
|
|
1029
1024
|
*
|
|
1030
1025
|
* @param walletAddress - Smart wallet address
|
|
1031
|
-
* @returns Onchain earnings data
|
|
1026
|
+
* @returns Onchain earnings data with per-token breakdowns
|
|
1032
1027
|
*
|
|
1033
1028
|
* @example
|
|
1034
1029
|
* ```typescript
|
|
1035
1030
|
* const earnings = await sdk.getOnchainEarnings("0x...");
|
|
1036
|
-
* console.log("Total
|
|
1031
|
+
* console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
|
|
1037
1032
|
* ```
|
|
1038
1033
|
*/
|
|
1039
1034
|
getOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
|
|
@@ -1042,12 +1037,12 @@ declare class ZyfaiSDK {
|
|
|
1042
1037
|
* This triggers a recalculation of earnings on the backend
|
|
1043
1038
|
*
|
|
1044
1039
|
* @param walletAddress - Smart wallet address
|
|
1045
|
-
* @returns Updated onchain earnings data
|
|
1040
|
+
* @returns Updated onchain earnings data with per-token breakdowns
|
|
1046
1041
|
*
|
|
1047
1042
|
* @example
|
|
1048
1043
|
* ```typescript
|
|
1049
1044
|
* const earnings = await sdk.calculateOnchainEarnings("0x...");
|
|
1050
|
-
* console.log("
|
|
1045
|
+
* console.log("Total USDC:", earnings.data.totalEarningsByToken["USDC"]);
|
|
1051
1046
|
* ```
|
|
1052
1047
|
*/
|
|
1053
1048
|
calculateOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
|
|
@@ -1062,55 +1057,44 @@ declare class ZyfaiSDK {
|
|
|
1062
1057
|
* @example
|
|
1063
1058
|
* ```typescript
|
|
1064
1059
|
* const daily = await sdk.getDailyEarnings("0x...", "2024-01-01", "2024-01-31");
|
|
1065
|
-
* daily.data.forEach(d => console.log(d.
|
|
1060
|
+
* daily.data.forEach(d => console.log(d.snapshot_date, d.total_earnings_by_token));
|
|
1066
1061
|
* ```
|
|
1067
1062
|
*/
|
|
1068
1063
|
getDailyEarnings(walletAddress: string, startDate?: string, endDate?: string): Promise<DailyEarningsResponse>;
|
|
1069
|
-
/**
|
|
1070
|
-
* Get Debank portfolio for a wallet across multiple chains
|
|
1071
|
-
* Note: This is a paid endpoint and may require authorization
|
|
1072
|
-
*
|
|
1073
|
-
* @param walletAddress - Smart wallet address
|
|
1074
|
-
* @returns Multi-chain portfolio data
|
|
1075
|
-
*
|
|
1076
|
-
* @example
|
|
1077
|
-
* ```typescript
|
|
1078
|
-
* const portfolio = await sdk.getDebankPortfolio("0x...");
|
|
1079
|
-
* console.log("Total value:", portfolio.totalValueUsd);
|
|
1080
|
-
* ```
|
|
1081
|
-
*/
|
|
1082
|
-
getDebankPortfolio(walletAddress: string): Promise<DebankPortfolioResponse>;
|
|
1083
1064
|
/**
|
|
1084
1065
|
* Get conservative (low-risk) yield opportunities
|
|
1085
1066
|
*
|
|
1086
1067
|
* @param chainId - Optional chain ID filter
|
|
1068
|
+
* @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
|
|
1087
1069
|
* @returns List of conservative yield opportunities
|
|
1088
1070
|
*
|
|
1089
1071
|
* @example
|
|
1090
1072
|
* ```typescript
|
|
1091
|
-
* const opportunities = await sdk.getConservativeOpportunities(8453);
|
|
1073
|
+
* const opportunities = await sdk.getConservativeOpportunities(8453, "USDC");
|
|
1092
1074
|
* opportunities.data.forEach(o => console.log(o.protocolName, o.apy));
|
|
1093
1075
|
* ```
|
|
1094
1076
|
*/
|
|
1095
|
-
getConservativeOpportunities(chainId?: number): Promise<OpportunitiesResponse>;
|
|
1077
|
+
getConservativeOpportunities(chainId?: number, asset?: string, status?: "live" | "not_live"): Promise<OpportunitiesResponse>;
|
|
1096
1078
|
/**
|
|
1097
1079
|
* Get aggressive (high-risk, high-reward) yield opportunities
|
|
1098
1080
|
*
|
|
1099
1081
|
* @param chainId - Optional chain ID filter
|
|
1082
|
+
* @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
|
|
1100
1083
|
* @returns List of aggressive opportunities
|
|
1101
1084
|
*
|
|
1102
1085
|
* @example
|
|
1103
1086
|
* ```typescript
|
|
1104
|
-
* const opportunities = await sdk.getAggressiveOpportunities(8453);
|
|
1087
|
+
* const opportunities = await sdk.getAggressiveOpportunities(8453, "WETH");
|
|
1105
1088
|
* opportunities.data.forEach(o => console.log(o.protocolName, o.apy));
|
|
1106
1089
|
* ```
|
|
1107
1090
|
*/
|
|
1108
|
-
getAggressiveOpportunities(chainId?: number): Promise<OpportunitiesResponse>;
|
|
1091
|
+
getAggressiveOpportunities(chainId?: number, asset?: string, status?: "live" | "not_live"): Promise<OpportunitiesResponse>;
|
|
1109
1092
|
/**
|
|
1110
1093
|
* Get active conservative opportunities (status = "live") with risk and utilization data
|
|
1111
1094
|
* Returns pool info, liquidity depth (true if > 1M), utilization rate, stability metrics, avg APY, and collateral
|
|
1112
1095
|
*
|
|
1113
1096
|
* @param chainId - Optional chain ID filter
|
|
1097
|
+
* @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
|
|
1114
1098
|
* @returns Active conservative opportunities with risk data
|
|
1115
1099
|
*
|
|
1116
1100
|
* @example
|
|
@@ -1119,12 +1103,13 @@ declare class ZyfaiSDK {
|
|
|
1119
1103
|
* console.log(JSON.stringify(opps, null, 2));
|
|
1120
1104
|
* ```
|
|
1121
1105
|
*/
|
|
1122
|
-
getActiveConservativeOppsRisk(chainId?: number): Promise<any>;
|
|
1106
|
+
getActiveConservativeOppsRisk(chainId?: number, asset?: string): Promise<any>;
|
|
1123
1107
|
/**
|
|
1124
1108
|
* Get active aggressive opportunities (status = "live") with risk and utilization data
|
|
1125
1109
|
* Returns pool info, liquidity depth (true if > 1M), utilization rate, stability metrics, avg APY, and collateral
|
|
1126
1110
|
*
|
|
1127
1111
|
* @param chainId - Optional chain ID filter
|
|
1112
|
+
* @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
|
|
1128
1113
|
* @returns Active aggressive opportunities with risk data
|
|
1129
1114
|
*
|
|
1130
1115
|
* @example
|
|
@@ -1133,35 +1118,37 @@ declare class ZyfaiSDK {
|
|
|
1133
1118
|
* console.log(JSON.stringify(opps, null, 2));
|
|
1134
1119
|
* ```
|
|
1135
1120
|
*/
|
|
1136
|
-
getActiveAggressiveOppsRisk(chainId?: number): Promise<any>;
|
|
1121
|
+
getActiveAggressiveOppsRisk(chainId?: number, asset?: string): Promise<any>;
|
|
1137
1122
|
/**
|
|
1138
1123
|
* Get conservative pool status with derived health, risk, APY trend, and yield consistency
|
|
1139
1124
|
* Builds on getActiveConservativeOppsRisk and computes higher-level status indicators
|
|
1140
1125
|
*
|
|
1141
1126
|
* @param chainId - Optional chain ID filter
|
|
1127
|
+
* @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
|
|
1142
1128
|
* @returns Conservative pools with status data
|
|
1143
1129
|
*/
|
|
1144
|
-
getConservativePoolStatus(chainId?: number): Promise<any>;
|
|
1130
|
+
getConservativePoolStatus(chainId?: number, asset?: string): Promise<any>;
|
|
1145
1131
|
/**
|
|
1146
1132
|
* Get aggressive pool status with derived health, risk, APY trend, and yield consistency
|
|
1147
1133
|
* Builds on getActiveAggressiveOppsRisk and computes higher-level status indicators
|
|
1148
1134
|
*
|
|
1149
1135
|
* @param chainId - Optional chain ID filter
|
|
1136
|
+
* @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
|
|
1150
1137
|
* @returns Aggressive pools with status data
|
|
1151
1138
|
*/
|
|
1152
|
-
getAggressivePoolStatus(chainId?: number): Promise<any>;
|
|
1139
|
+
getAggressivePoolStatus(chainId?: number, asset?: string): Promise<any>;
|
|
1153
1140
|
private derivePoolStatus;
|
|
1154
1141
|
/**
|
|
1155
1142
|
* Get daily APY history with weighted average for a wallet
|
|
1156
1143
|
*
|
|
1157
1144
|
* @param walletAddress - Smart wallet address
|
|
1158
1145
|
* @param days - Period: "7D", "14D", or "30D" (default: "7D")
|
|
1159
|
-
* @returns Daily APY history with weighted averages
|
|
1146
|
+
* @returns Daily APY history with per-position breakdowns and weighted averages
|
|
1160
1147
|
*
|
|
1161
1148
|
* @example
|
|
1162
1149
|
* ```typescript
|
|
1163
1150
|
* const apyHistory = await sdk.getDailyApyHistory("0x...", "30D");
|
|
1164
|
-
* console.log("
|
|
1151
|
+
* console.log("Weighted APY after fee:", apyHistory.weightedApyAfterFee); // { "USDC": 4.64, "WETH": 1.94 }
|
|
1165
1152
|
* ```
|
|
1166
1153
|
*/
|
|
1167
1154
|
getDailyApyHistory(walletAddress: string, days?: "7D" | "14D" | "30D"): Promise<DailyApyHistoryResponse>;
|
|
@@ -1327,4 +1314,4 @@ declare class ZyfaiSDK {
|
|
|
1327
1314
|
registerAgentOnIdentityRegistry(smartWallet: string, chainId: SupportedChainId): Promise<RegisterAgentResponse>;
|
|
1328
1315
|
}
|
|
1329
1316
|
|
|
1330
|
-
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 LogDepositResponse, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, type PolicyData, type Pool, type Portfolio, 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
|
|
1317
|
+
export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type ApyPosition, 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 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 VolumeResponse, type WalletTVL, type WithdrawResponse, ZyfaiSDK, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
|