@zyfai/sdk 0.2.33 → 0.2.35
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 +5 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +13 -9
- package/dist/index.mjs +13 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -722,6 +722,11 @@ Returns per-position APY breakdowns with per-token weighted averages.
|
|
|
722
722
|
const apyHistory = await sdk.getDailyApyHistory(walletAddress, "30D");
|
|
723
723
|
// Per-token weighted APY: { "USDC": 4.64, "WETH": 1.94 }
|
|
724
724
|
console.log("Weighted APY after fee:", apyHistory.weightedApyAfterFee);
|
|
725
|
+
console.log("Weighted APY (with rZFI Merkl):", apyHistory.weightedApyWithRzfiAfterFee);
|
|
726
|
+
console.log("Avg rZFI Merkl APR:", apyHistory.averageRzfiMerklApr);
|
|
727
|
+
// Per-chain breakdowns: { "8453": { "USDC": 4.59 }, "42161": { "WETH": 1.82 } }
|
|
728
|
+
console.log("By chain:", apyHistory.weightedApyAfterFeeByChain);
|
|
729
|
+
console.log("By chain (with rZFI):", apyHistory.weightedApyWithRzfiAfterFeeByChain);
|
|
725
730
|
// Each date entry has positions (with tokenSymbol), and per-token weighted_apy, fee, etc.
|
|
726
731
|
```
|
|
727
732
|
|
package/dist/index.d.mts
CHANGED
|
@@ -345,6 +345,7 @@ interface ApyPosition {
|
|
|
345
345
|
tokenSymbol?: string;
|
|
346
346
|
}
|
|
347
347
|
type TokenApy = Record<string, number>;
|
|
348
|
+
type ChainTokenApy = Record<string, TokenApy>;
|
|
348
349
|
interface DailyApyEntry {
|
|
349
350
|
positions: ApyPosition[];
|
|
350
351
|
weighted_apy: TokenApy;
|
|
@@ -361,6 +362,9 @@ interface DailyApyHistoryResponse {
|
|
|
361
362
|
requestedDays?: number;
|
|
362
363
|
weightedApyWithRzfiAfterFee?: TokenApy;
|
|
363
364
|
weightedApyAfterFee?: TokenApy;
|
|
365
|
+
averageRzfiMerklApr?: TokenApy;
|
|
366
|
+
weightedApyAfterFeeByChain?: ChainTokenApy;
|
|
367
|
+
weightedApyWithRzfiAfterFeeByChain?: ChainTokenApy;
|
|
364
368
|
}
|
|
365
369
|
interface RebalanceFrequencyResponse {
|
|
366
370
|
success: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -345,6 +345,7 @@ interface ApyPosition {
|
|
|
345
345
|
tokenSymbol?: string;
|
|
346
346
|
}
|
|
347
347
|
type TokenApy = Record<string, number>;
|
|
348
|
+
type ChainTokenApy = Record<string, TokenApy>;
|
|
348
349
|
interface DailyApyEntry {
|
|
349
350
|
positions: ApyPosition[];
|
|
350
351
|
weighted_apy: TokenApy;
|
|
@@ -361,6 +362,9 @@ interface DailyApyHistoryResponse {
|
|
|
361
362
|
requestedDays?: number;
|
|
362
363
|
weightedApyWithRzfiAfterFee?: TokenApy;
|
|
363
364
|
weightedApyAfterFee?: TokenApy;
|
|
365
|
+
averageRzfiMerklApr?: TokenApy;
|
|
366
|
+
weightedApyAfterFeeByChain?: ChainTokenApy;
|
|
367
|
+
weightedApyWithRzfiAfterFeeByChain?: ChainTokenApy;
|
|
364
368
|
}
|
|
365
369
|
interface RebalanceFrequencyResponse {
|
|
366
370
|
success: boolean;
|
package/dist/index.js
CHANGED
|
@@ -89,8 +89,8 @@ var DATA_ENDPOINTS = {
|
|
|
89
89
|
// User Initialization
|
|
90
90
|
USER_INITIALIZE: "/api/earnings/initialize",
|
|
91
91
|
// Earnings
|
|
92
|
-
ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/onchain-earnings?walletAddress=${walletAddress}`,
|
|
93
|
-
CALCULATE_ONCHAIN_EARNINGS:
|
|
92
|
+
ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/onchain-earnings-v2?walletAddress=${walletAddress}`,
|
|
93
|
+
CALCULATE_ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/calculate-onchain-earnings-v2?walletAddress=${walletAddress}`,
|
|
94
94
|
DAILY_EARNINGS: (walletAddress, startDate, endDate) => {
|
|
95
95
|
let url = `/onchain-earnings/daily-earnings?walletAddress=${walletAddress}`;
|
|
96
96
|
if (startDate) url += `&startDate=${startDate}`;
|
|
@@ -2473,14 +2473,15 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2473
2473
|
const response = await this.httpClient.dataGet(
|
|
2474
2474
|
DATA_ENDPOINTS.ONCHAIN_EARNINGS(walletAddress)
|
|
2475
2475
|
);
|
|
2476
|
+
const data = response.data || response;
|
|
2476
2477
|
return {
|
|
2477
2478
|
success: true,
|
|
2478
2479
|
data: {
|
|
2479
2480
|
walletAddress,
|
|
2480
|
-
totalEarningsByToken:
|
|
2481
|
-
totalEarningsByChain:
|
|
2482
|
-
lastCheckTimestamp:
|
|
2483
|
-
lastLogDate:
|
|
2481
|
+
totalEarningsByToken: data.total_earnings_by_token || {},
|
|
2482
|
+
totalEarningsByChain: data.total_earnings_by_chain || {},
|
|
2483
|
+
lastCheckTimestamp: data.last_check_timestamp,
|
|
2484
|
+
lastLogDate: data.last_log_date
|
|
2484
2485
|
}
|
|
2485
2486
|
};
|
|
2486
2487
|
} catch (error) {
|
|
@@ -2509,8 +2510,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2509
2510
|
throw new Error("Wallet address is required");
|
|
2510
2511
|
}
|
|
2511
2512
|
const response = await this.httpClient.dataPost(
|
|
2512
|
-
DATA_ENDPOINTS.CALCULATE_ONCHAIN_EARNINGS,
|
|
2513
|
-
{
|
|
2513
|
+
DATA_ENDPOINTS.CALCULATE_ONCHAIN_EARNINGS(walletAddress),
|
|
2514
|
+
{}
|
|
2514
2515
|
);
|
|
2515
2516
|
const data = response.data || response;
|
|
2516
2517
|
return {
|
|
@@ -2849,7 +2850,10 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2849
2850
|
totalDays: data.total_days || data.totalDays || 0,
|
|
2850
2851
|
requestedDays: data.requested_days || data.requestedDays,
|
|
2851
2852
|
weightedApyWithRzfiAfterFee: data.average_final_weighted_apy_after_fee_with_rzfi,
|
|
2852
|
-
weightedApyAfterFee: data.average_final_weighted_apy_after_fee
|
|
2853
|
+
weightedApyAfterFee: data.average_final_weighted_apy_after_fee,
|
|
2854
|
+
averageRzfiMerklApr: data.average_rzfi_merkl_apr,
|
|
2855
|
+
weightedApyAfterFeeByChain: data.average_final_weighted_apy_after_fee_by_chain,
|
|
2856
|
+
weightedApyWithRzfiAfterFeeByChain: data.average_final_weighted_apy_after_fee_with_rzfi_by_chain
|
|
2853
2857
|
};
|
|
2854
2858
|
} catch (error) {
|
|
2855
2859
|
throw new Error(
|
package/dist/index.mjs
CHANGED
|
@@ -46,8 +46,8 @@ var DATA_ENDPOINTS = {
|
|
|
46
46
|
// User Initialization
|
|
47
47
|
USER_INITIALIZE: "/api/earnings/initialize",
|
|
48
48
|
// Earnings
|
|
49
|
-
ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/onchain-earnings?walletAddress=${walletAddress}`,
|
|
50
|
-
CALCULATE_ONCHAIN_EARNINGS:
|
|
49
|
+
ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/onchain-earnings-v2?walletAddress=${walletAddress}`,
|
|
50
|
+
CALCULATE_ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/calculate-onchain-earnings-v2?walletAddress=${walletAddress}`,
|
|
51
51
|
DAILY_EARNINGS: (walletAddress, startDate, endDate) => {
|
|
52
52
|
let url = `/onchain-earnings/daily-earnings?walletAddress=${walletAddress}`;
|
|
53
53
|
if (startDate) url += `&startDate=${startDate}`;
|
|
@@ -2449,14 +2449,15 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2449
2449
|
const response = await this.httpClient.dataGet(
|
|
2450
2450
|
DATA_ENDPOINTS.ONCHAIN_EARNINGS(walletAddress)
|
|
2451
2451
|
);
|
|
2452
|
+
const data = response.data || response;
|
|
2452
2453
|
return {
|
|
2453
2454
|
success: true,
|
|
2454
2455
|
data: {
|
|
2455
2456
|
walletAddress,
|
|
2456
|
-
totalEarningsByToken:
|
|
2457
|
-
totalEarningsByChain:
|
|
2458
|
-
lastCheckTimestamp:
|
|
2459
|
-
lastLogDate:
|
|
2457
|
+
totalEarningsByToken: data.total_earnings_by_token || {},
|
|
2458
|
+
totalEarningsByChain: data.total_earnings_by_chain || {},
|
|
2459
|
+
lastCheckTimestamp: data.last_check_timestamp,
|
|
2460
|
+
lastLogDate: data.last_log_date
|
|
2460
2461
|
}
|
|
2461
2462
|
};
|
|
2462
2463
|
} catch (error) {
|
|
@@ -2485,8 +2486,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2485
2486
|
throw new Error("Wallet address is required");
|
|
2486
2487
|
}
|
|
2487
2488
|
const response = await this.httpClient.dataPost(
|
|
2488
|
-
DATA_ENDPOINTS.CALCULATE_ONCHAIN_EARNINGS,
|
|
2489
|
-
{
|
|
2489
|
+
DATA_ENDPOINTS.CALCULATE_ONCHAIN_EARNINGS(walletAddress),
|
|
2490
|
+
{}
|
|
2490
2491
|
);
|
|
2491
2492
|
const data = response.data || response;
|
|
2492
2493
|
return {
|
|
@@ -2825,7 +2826,10 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2825
2826
|
totalDays: data.total_days || data.totalDays || 0,
|
|
2826
2827
|
requestedDays: data.requested_days || data.requestedDays,
|
|
2827
2828
|
weightedApyWithRzfiAfterFee: data.average_final_weighted_apy_after_fee_with_rzfi,
|
|
2828
|
-
weightedApyAfterFee: data.average_final_weighted_apy_after_fee
|
|
2829
|
+
weightedApyAfterFee: data.average_final_weighted_apy_after_fee,
|
|
2830
|
+
averageRzfiMerklApr: data.average_rzfi_merkl_apr,
|
|
2831
|
+
weightedApyAfterFeeByChain: data.average_final_weighted_apy_after_fee_by_chain,
|
|
2832
|
+
weightedApyWithRzfiAfterFeeByChain: data.average_final_weighted_apy_after_fee_with_rzfi_by_chain
|
|
2829
2833
|
};
|
|
2830
2834
|
} catch (error) {
|
|
2831
2835
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyfai/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.35",
|
|
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",
|