@zyfai/sdk 0.2.35 → 0.2.37
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 +24 -10
- package/dist/index.d.ts +24 -10
- package/dist/index.js +17 -8
- package/dist/index.mjs +17 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -131,15 +131,19 @@ interface Portfolio {
|
|
|
131
131
|
executorProxy?: boolean;
|
|
132
132
|
assetTypeSettings?: AssetTypeSettings;
|
|
133
133
|
}
|
|
134
|
+
interface PortfolioAssetBalance {
|
|
135
|
+
balance: Hex;
|
|
136
|
+
decimals: number;
|
|
137
|
+
}
|
|
138
|
+
type PortfolioByAssetType = Record<string, PortfolioAssetBalance>;
|
|
139
|
+
type PortfolioByChain = Record<string, PortfolioByAssetType>;
|
|
134
140
|
interface PortfolioDetailed {
|
|
135
141
|
hasBalance?: boolean;
|
|
136
142
|
staleBalances?: string[];
|
|
137
143
|
hasActiveSessionKey?: boolean;
|
|
138
144
|
positions?: PositionSlot[];
|
|
139
|
-
portfolioByAssetType?:
|
|
140
|
-
|
|
141
|
-
decimals: number;
|
|
142
|
-
}>;
|
|
145
|
+
portfolioByAssetType?: PortfolioByAssetType;
|
|
146
|
+
portfolioByChain?: PortfolioByChain;
|
|
143
147
|
}
|
|
144
148
|
interface AssetTypeSettings {
|
|
145
149
|
[assetType: string]: {
|
|
@@ -166,6 +170,7 @@ interface PositionSlot {
|
|
|
166
170
|
underlyingAmount?: string;
|
|
167
171
|
pool_apy?: number;
|
|
168
172
|
pool_tvl?: number;
|
|
173
|
+
liquidity?: number;
|
|
169
174
|
}
|
|
170
175
|
interface PortfolioResponse {
|
|
171
176
|
success: boolean;
|
|
@@ -282,10 +287,12 @@ interface OnchainEarningsResponse {
|
|
|
282
287
|
data: OnchainEarnings;
|
|
283
288
|
}
|
|
284
289
|
interface DailyEarning {
|
|
285
|
-
wallet_address?: string;
|
|
286
290
|
snapshot_date: string;
|
|
287
|
-
|
|
288
|
-
|
|
291
|
+
current_earnings_by_token: ChainTokenEarnings;
|
|
292
|
+
lifetime_earnings_by_token: ChainTokenEarnings;
|
|
293
|
+
unrealized_earnings_by_token: ChainTokenEarnings;
|
|
294
|
+
total_earnings_by_token: ChainTokenEarnings;
|
|
295
|
+
daily_total_delta_by_token: ChainTokenEarnings;
|
|
289
296
|
created_at?: string;
|
|
290
297
|
}
|
|
291
298
|
interface DailyEarningsResponse {
|
|
@@ -1113,7 +1120,11 @@ declare class ZyfaiSDK {
|
|
|
1113
1120
|
*/
|
|
1114
1121
|
calculateOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
|
|
1115
1122
|
/**
|
|
1116
|
-
* Get daily earnings for a wallet within a date range
|
|
1123
|
+
* Get daily earnings for a wallet within a date range (V2)
|
|
1124
|
+
*
|
|
1125
|
+
* Reads from `user_onchain_daily_earnings_v2`. Each entry exposes
|
|
1126
|
+
* per-chain per-token maps for current / lifetime / unrealized / total
|
|
1127
|
+
* earnings plus a daily total delta.
|
|
1117
1128
|
*
|
|
1118
1129
|
* @param walletAddress - Smart wallet address
|
|
1119
1130
|
* @param startDate - Start date (YYYY-MM-DD format)
|
|
@@ -1123,7 +1134,10 @@ declare class ZyfaiSDK {
|
|
|
1123
1134
|
* @example
|
|
1124
1135
|
* ```typescript
|
|
1125
1136
|
* const daily = await sdk.getDailyEarnings("0x...", "2024-01-01", "2024-01-31");
|
|
1126
|
-
* daily.data.forEach(d =>
|
|
1137
|
+
* daily.data.forEach(d => {
|
|
1138
|
+
* // d.total_earnings_by_token = { "8453": { "USDC": "143.10" } }
|
|
1139
|
+
* console.log(d.snapshot_date, d.total_earnings_by_token);
|
|
1140
|
+
* });
|
|
1127
1141
|
* ```
|
|
1128
1142
|
*/
|
|
1129
1143
|
getDailyEarnings(walletAddress: string, startDate?: string, endDate?: string): Promise<DailyEarningsResponse>;
|
|
@@ -1515,4 +1529,4 @@ type BankrProvider = ReturnType<typeof createBankrProvider>;
|
|
|
1515
1529
|
|
|
1516
1530
|
declare const VAULT_ADDRESS: "0xD580071c47d4a667858B5FafAb85BC9C609beC5D";
|
|
1517
1531
|
|
|
1518
|
-
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 };
|
|
1532
|
+
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 PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, 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
|
@@ -131,15 +131,19 @@ interface Portfolio {
|
|
|
131
131
|
executorProxy?: boolean;
|
|
132
132
|
assetTypeSettings?: AssetTypeSettings;
|
|
133
133
|
}
|
|
134
|
+
interface PortfolioAssetBalance {
|
|
135
|
+
balance: Hex;
|
|
136
|
+
decimals: number;
|
|
137
|
+
}
|
|
138
|
+
type PortfolioByAssetType = Record<string, PortfolioAssetBalance>;
|
|
139
|
+
type PortfolioByChain = Record<string, PortfolioByAssetType>;
|
|
134
140
|
interface PortfolioDetailed {
|
|
135
141
|
hasBalance?: boolean;
|
|
136
142
|
staleBalances?: string[];
|
|
137
143
|
hasActiveSessionKey?: boolean;
|
|
138
144
|
positions?: PositionSlot[];
|
|
139
|
-
portfolioByAssetType?:
|
|
140
|
-
|
|
141
|
-
decimals: number;
|
|
142
|
-
}>;
|
|
145
|
+
portfolioByAssetType?: PortfolioByAssetType;
|
|
146
|
+
portfolioByChain?: PortfolioByChain;
|
|
143
147
|
}
|
|
144
148
|
interface AssetTypeSettings {
|
|
145
149
|
[assetType: string]: {
|
|
@@ -166,6 +170,7 @@ interface PositionSlot {
|
|
|
166
170
|
underlyingAmount?: string;
|
|
167
171
|
pool_apy?: number;
|
|
168
172
|
pool_tvl?: number;
|
|
173
|
+
liquidity?: number;
|
|
169
174
|
}
|
|
170
175
|
interface PortfolioResponse {
|
|
171
176
|
success: boolean;
|
|
@@ -282,10 +287,12 @@ interface OnchainEarningsResponse {
|
|
|
282
287
|
data: OnchainEarnings;
|
|
283
288
|
}
|
|
284
289
|
interface DailyEarning {
|
|
285
|
-
wallet_address?: string;
|
|
286
290
|
snapshot_date: string;
|
|
287
|
-
|
|
288
|
-
|
|
291
|
+
current_earnings_by_token: ChainTokenEarnings;
|
|
292
|
+
lifetime_earnings_by_token: ChainTokenEarnings;
|
|
293
|
+
unrealized_earnings_by_token: ChainTokenEarnings;
|
|
294
|
+
total_earnings_by_token: ChainTokenEarnings;
|
|
295
|
+
daily_total_delta_by_token: ChainTokenEarnings;
|
|
289
296
|
created_at?: string;
|
|
290
297
|
}
|
|
291
298
|
interface DailyEarningsResponse {
|
|
@@ -1113,7 +1120,11 @@ declare class ZyfaiSDK {
|
|
|
1113
1120
|
*/
|
|
1114
1121
|
calculateOnchainEarnings(walletAddress: string): Promise<OnchainEarningsResponse>;
|
|
1115
1122
|
/**
|
|
1116
|
-
* Get daily earnings for a wallet within a date range
|
|
1123
|
+
* Get daily earnings for a wallet within a date range (V2)
|
|
1124
|
+
*
|
|
1125
|
+
* Reads from `user_onchain_daily_earnings_v2`. Each entry exposes
|
|
1126
|
+
* per-chain per-token maps for current / lifetime / unrealized / total
|
|
1127
|
+
* earnings plus a daily total delta.
|
|
1117
1128
|
*
|
|
1118
1129
|
* @param walletAddress - Smart wallet address
|
|
1119
1130
|
* @param startDate - Start date (YYYY-MM-DD format)
|
|
@@ -1123,7 +1134,10 @@ declare class ZyfaiSDK {
|
|
|
1123
1134
|
* @example
|
|
1124
1135
|
* ```typescript
|
|
1125
1136
|
* const daily = await sdk.getDailyEarnings("0x...", "2024-01-01", "2024-01-31");
|
|
1126
|
-
* daily.data.forEach(d =>
|
|
1137
|
+
* daily.data.forEach(d => {
|
|
1138
|
+
* // d.total_earnings_by_token = { "8453": { "USDC": "143.10" } }
|
|
1139
|
+
* console.log(d.snapshot_date, d.total_earnings_by_token);
|
|
1140
|
+
* });
|
|
1127
1141
|
* ```
|
|
1128
1142
|
*/
|
|
1129
1143
|
getDailyEarnings(walletAddress: string, startDate?: string, endDate?: string): Promise<DailyEarningsResponse>;
|
|
@@ -1515,4 +1529,4 @@ type BankrProvider = ReturnType<typeof createBankrProvider>;
|
|
|
1515
1529
|
|
|
1516
1530
|
declare const VAULT_ADDRESS: "0xD580071c47d4a667858B5FafAb85BC9C609beC5D";
|
|
1517
1531
|
|
|
1518
|
-
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 };
|
|
1532
|
+
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 PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, 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
|
@@ -92,7 +92,7 @@ var DATA_ENDPOINTS = {
|
|
|
92
92
|
ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/onchain-earnings-v2?walletAddress=${walletAddress}`,
|
|
93
93
|
CALCULATE_ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/calculate-onchain-earnings-v2?walletAddress=${walletAddress}`,
|
|
94
94
|
DAILY_EARNINGS: (walletAddress, startDate, endDate) => {
|
|
95
|
-
let url = `/onchain-earnings/daily-earnings?walletAddress=${walletAddress}`;
|
|
95
|
+
let url = `/onchain-earnings/daily-earnings-v2?walletAddress=${walletAddress}`;
|
|
96
96
|
if (startDate) url += `&startDate=${startDate}`;
|
|
97
97
|
if (endDate) url += `&endDate=${endDate}`;
|
|
98
98
|
return url;
|
|
@@ -2531,7 +2531,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2531
2531
|
}
|
|
2532
2532
|
}
|
|
2533
2533
|
/**
|
|
2534
|
-
* Get daily earnings for a wallet within a date range
|
|
2534
|
+
* Get daily earnings for a wallet within a date range (V2)
|
|
2535
|
+
*
|
|
2536
|
+
* Reads from `user_onchain_daily_earnings_v2`. Each entry exposes
|
|
2537
|
+
* per-chain per-token maps for current / lifetime / unrealized / total
|
|
2538
|
+
* earnings plus a daily total delta.
|
|
2535
2539
|
*
|
|
2536
2540
|
* @param walletAddress - Smart wallet address
|
|
2537
2541
|
* @param startDate - Start date (YYYY-MM-DD format)
|
|
@@ -2541,7 +2545,10 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2541
2545
|
* @example
|
|
2542
2546
|
* ```typescript
|
|
2543
2547
|
* const daily = await sdk.getDailyEarnings("0x...", "2024-01-01", "2024-01-31");
|
|
2544
|
-
* daily.data.forEach(d =>
|
|
2548
|
+
* daily.data.forEach(d => {
|
|
2549
|
+
* // d.total_earnings_by_token = { "8453": { "USDC": "143.10" } }
|
|
2550
|
+
* console.log(d.snapshot_date, d.total_earnings_by_token);
|
|
2551
|
+
* });
|
|
2545
2552
|
* ```
|
|
2546
2553
|
*/
|
|
2547
2554
|
async getDailyEarnings(walletAddress, startDate, endDate) {
|
|
@@ -2552,17 +2559,19 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2552
2559
|
const response = await this.httpClient.dataGet(
|
|
2553
2560
|
DATA_ENDPOINTS.DAILY_EARNINGS(walletAddress, startDate, endDate)
|
|
2554
2561
|
);
|
|
2555
|
-
const
|
|
2556
|
-
wallet_address: entry.wallet_address,
|
|
2562
|
+
const data = (response.data || []).map((entry) => ({
|
|
2557
2563
|
snapshot_date: entry.snapshot_date,
|
|
2558
|
-
|
|
2559
|
-
|
|
2564
|
+
current_earnings_by_token: entry.current_earnings_by_token || {},
|
|
2565
|
+
lifetime_earnings_by_token: entry.lifetime_earnings_by_token || {},
|
|
2566
|
+
unrealized_earnings_by_token: entry.unrealized_earnings_by_token || {},
|
|
2567
|
+
total_earnings_by_token: entry.total_earnings_by_token || {},
|
|
2568
|
+
daily_total_delta_by_token: entry.daily_total_delta_by_token || {},
|
|
2560
2569
|
created_at: entry.created_at
|
|
2561
2570
|
}));
|
|
2562
2571
|
return {
|
|
2563
2572
|
success: true,
|
|
2564
2573
|
walletAddress,
|
|
2565
|
-
data
|
|
2574
|
+
data,
|
|
2566
2575
|
count: response.count || 0,
|
|
2567
2576
|
filters: {
|
|
2568
2577
|
startDate: startDate || null,
|
package/dist/index.mjs
CHANGED
|
@@ -49,7 +49,7 @@ var DATA_ENDPOINTS = {
|
|
|
49
49
|
ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/onchain-earnings-v2?walletAddress=${walletAddress}`,
|
|
50
50
|
CALCULATE_ONCHAIN_EARNINGS: (walletAddress) => `/onchain-earnings/calculate-onchain-earnings-v2?walletAddress=${walletAddress}`,
|
|
51
51
|
DAILY_EARNINGS: (walletAddress, startDate, endDate) => {
|
|
52
|
-
let url = `/onchain-earnings/daily-earnings?walletAddress=${walletAddress}`;
|
|
52
|
+
let url = `/onchain-earnings/daily-earnings-v2?walletAddress=${walletAddress}`;
|
|
53
53
|
if (startDate) url += `&startDate=${startDate}`;
|
|
54
54
|
if (endDate) url += `&endDate=${endDate}`;
|
|
55
55
|
return url;
|
|
@@ -2507,7 +2507,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2507
2507
|
}
|
|
2508
2508
|
}
|
|
2509
2509
|
/**
|
|
2510
|
-
* Get daily earnings for a wallet within a date range
|
|
2510
|
+
* Get daily earnings for a wallet within a date range (V2)
|
|
2511
|
+
*
|
|
2512
|
+
* Reads from `user_onchain_daily_earnings_v2`. Each entry exposes
|
|
2513
|
+
* per-chain per-token maps for current / lifetime / unrealized / total
|
|
2514
|
+
* earnings plus a daily total delta.
|
|
2511
2515
|
*
|
|
2512
2516
|
* @param walletAddress - Smart wallet address
|
|
2513
2517
|
* @param startDate - Start date (YYYY-MM-DD format)
|
|
@@ -2517,7 +2521,10 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2517
2521
|
* @example
|
|
2518
2522
|
* ```typescript
|
|
2519
2523
|
* const daily = await sdk.getDailyEarnings("0x...", "2024-01-01", "2024-01-31");
|
|
2520
|
-
* daily.data.forEach(d =>
|
|
2524
|
+
* daily.data.forEach(d => {
|
|
2525
|
+
* // d.total_earnings_by_token = { "8453": { "USDC": "143.10" } }
|
|
2526
|
+
* console.log(d.snapshot_date, d.total_earnings_by_token);
|
|
2527
|
+
* });
|
|
2521
2528
|
* ```
|
|
2522
2529
|
*/
|
|
2523
2530
|
async getDailyEarnings(walletAddress, startDate, endDate) {
|
|
@@ -2528,17 +2535,19 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2528
2535
|
const response = await this.httpClient.dataGet(
|
|
2529
2536
|
DATA_ENDPOINTS.DAILY_EARNINGS(walletAddress, startDate, endDate)
|
|
2530
2537
|
);
|
|
2531
|
-
const
|
|
2532
|
-
wallet_address: entry.wallet_address,
|
|
2538
|
+
const data = (response.data || []).map((entry) => ({
|
|
2533
2539
|
snapshot_date: entry.snapshot_date,
|
|
2534
|
-
|
|
2535
|
-
|
|
2540
|
+
current_earnings_by_token: entry.current_earnings_by_token || {},
|
|
2541
|
+
lifetime_earnings_by_token: entry.lifetime_earnings_by_token || {},
|
|
2542
|
+
unrealized_earnings_by_token: entry.unrealized_earnings_by_token || {},
|
|
2543
|
+
total_earnings_by_token: entry.total_earnings_by_token || {},
|
|
2544
|
+
daily_total_delta_by_token: entry.daily_total_delta_by_token || {},
|
|
2536
2545
|
created_at: entry.created_at
|
|
2537
2546
|
}));
|
|
2538
2547
|
return {
|
|
2539
2548
|
success: true,
|
|
2540
2549
|
walletAddress,
|
|
2541
|
-
data
|
|
2550
|
+
data,
|
|
2542
2551
|
count: response.count || 0,
|
|
2543
2552
|
filters: {
|
|
2544
2553
|
startDate: startDate || null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyfai/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.37",
|
|
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",
|