@zyfai/sdk 0.2.49 → 0.2.51
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 +12 -2
- package/dist/index.d.mts +33 -8
- package/dist/index.d.ts +33 -8
- package/dist/index.js +71 -20
- package/dist/index.mjs +71 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -546,6 +546,7 @@ console.log(portfolio.portfolioByAssetType?.usdc?.balanceWithFee);
|
|
|
546
546
|
|
|
547
547
|
portfolio.positions?.forEach((slot) => {
|
|
548
548
|
console.log(slot.pool, slot.underlyingAmount, slot.underlyingAmountWithFee);
|
|
549
|
+
console.log(slot.pool_apy, slot.pool_apy_withFee);
|
|
549
550
|
});
|
|
550
551
|
```
|
|
551
552
|
|
|
@@ -553,6 +554,7 @@ portfolio.positions?.forEach((slot) => {
|
|
|
553
554
|
|
|
554
555
|
- Pending fee = `current_earnings × 0.1` (unrealised yield only)
|
|
555
556
|
- `balanceWithFee` / `underlyingAmountWithFee` = live − pending fee share
|
|
557
|
+
- `pool_apy_withFee` = `pool_apy × 0.9`
|
|
556
558
|
- If earnings cannot be fetched, `*WithFee` equals the gross value
|
|
557
559
|
|
|
558
560
|
**Note**: Portfolio balances are live; earnings used for the fee may come from a
|
|
@@ -739,8 +741,15 @@ console.log("Chain ID:", firstTopup.chainId);
|
|
|
739
741
|
const history = await sdk.getHistory(walletAddress, 8453, {
|
|
740
742
|
limit: 50,
|
|
741
743
|
fromDate: "2024-01-01",
|
|
744
|
+
assetType: "eth",
|
|
745
|
+
});
|
|
746
|
+
history.data.forEach((tx) => {
|
|
747
|
+
console.log(tx.action, tx.transactionHash);
|
|
748
|
+
if (tx.rebalanceLog) {
|
|
749
|
+
console.log(tx.rebalanceLog.oldApy, tx.rebalanceLog.oldApy_withFee);
|
|
750
|
+
console.log(tx.rebalanceLog.newApy, tx.rebalanceLog.newApy_withFee);
|
|
751
|
+
}
|
|
742
752
|
});
|
|
743
|
-
history.data.forEach((tx) => console.log(tx.type, tx.amount));
|
|
744
753
|
```
|
|
745
754
|
|
|
746
755
|
### 9. Earnings & Performance
|
|
@@ -802,7 +811,7 @@ console.log("Avg rZFI Merkl APR:", apyHistory.averageRzfiMerklApr);
|
|
|
802
811
|
// Per-chain breakdowns: { "8453": { "USDC": 4.59 }, "42161": { "WETH": 1.82 } }
|
|
803
812
|
console.log("By chain:", apyHistory.weightedApyAfterFeeByChain);
|
|
804
813
|
console.log("By chain (with rZFI):", apyHistory.weightedApyWithRzfiAfterFeeByChain);
|
|
805
|
-
// Each date entry has positions (with tokenSymbol), and per-token weighted_apy, fee, etc.
|
|
814
|
+
// Each date entry has positions (with tokenSymbol and apy_withFee = apy × 0.9), and per-token weighted_apy, fee, etc.
|
|
806
815
|
```
|
|
807
816
|
|
|
808
817
|
### 10. Opportunities & Strategies
|
|
@@ -835,6 +844,7 @@ aggressiveOpps.data.forEach((o) => {
|
|
|
835
844
|
// Get same-chain rebalances, optionally filter by chainId and tokenSymbol
|
|
836
845
|
const apyPerStrategy = await sdk.getAPYPerStrategy(false, 7, "conservative", 8453, "USDC");
|
|
837
846
|
console.log("APY per strategy:", apyPerStrategy.data);
|
|
847
|
+
// Each item includes average_apy_withFee and average_apy_with_rzfi_withFee
|
|
838
848
|
```
|
|
839
849
|
|
|
840
850
|
### 12. SDK API Key Management
|
package/dist/index.d.mts
CHANGED
|
@@ -184,6 +184,8 @@ interface PositionSlot {
|
|
|
184
184
|
/** Net underlying amount after this position's share of pending Zyfi fee. */
|
|
185
185
|
underlyingAmountWithFee?: string;
|
|
186
186
|
pool_apy?: number;
|
|
187
|
+
/** Net pool APY after Zyfi performance fee (gross × 0.9). */
|
|
188
|
+
pool_apy_withFee?: number;
|
|
187
189
|
pool_tvl?: number;
|
|
188
190
|
liquidity?: number;
|
|
189
191
|
}
|
|
@@ -215,11 +217,11 @@ interface APYPerStrategy {
|
|
|
215
217
|
created_at: string;
|
|
216
218
|
strategy: string;
|
|
217
219
|
token_symbol?: string;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
average_apy_without_fee?: number;
|
|
221
|
-
average_apy_with_rzfi_without_fee?: number;
|
|
220
|
+
average_apy_withFee: number;
|
|
221
|
+
average_apy_with_rzfi_withFee: number;
|
|
222
222
|
events_average_apy?: Record<string, number>;
|
|
223
|
+
events_average_apy_withFee?: Record<string, number>;
|
|
224
|
+
events_average_apy_with_rzfi_withFee?: Record<string, number>;
|
|
223
225
|
}
|
|
224
226
|
interface APYPerStrategyResponse {
|
|
225
227
|
success: boolean;
|
|
@@ -265,6 +267,19 @@ interface HistoryPosition {
|
|
|
265
267
|
protocol_icon?: string;
|
|
266
268
|
protocol_name?: string;
|
|
267
269
|
}
|
|
270
|
+
interface HistoryFeeData {
|
|
271
|
+
gasCostInToken?: string;
|
|
272
|
+
gasDeducted?: boolean;
|
|
273
|
+
actualGasCost?: string;
|
|
274
|
+
}
|
|
275
|
+
interface HistoryRebalanceLog {
|
|
276
|
+
oldApy?: string;
|
|
277
|
+
newApy?: string;
|
|
278
|
+
oldApy_withFee?: string;
|
|
279
|
+
newApy_withFee?: string;
|
|
280
|
+
oldOpportunity?: string;
|
|
281
|
+
newOpportunity?: string;
|
|
282
|
+
}
|
|
268
283
|
interface HistoryEntry {
|
|
269
284
|
id?: string;
|
|
270
285
|
action?: string;
|
|
@@ -272,11 +287,14 @@ interface HistoryEntry {
|
|
|
272
287
|
strategy?: string;
|
|
273
288
|
positions?: HistoryPosition[];
|
|
274
289
|
chainId?: number;
|
|
290
|
+
tokenId?: string;
|
|
275
291
|
transactionHash?: string;
|
|
276
292
|
destinationChainId?: number;
|
|
277
293
|
sourceChains?: number[];
|
|
278
294
|
crosschain?: boolean;
|
|
279
295
|
rebalance?: boolean;
|
|
296
|
+
feeData?: HistoryFeeData;
|
|
297
|
+
rebalanceLog?: HistoryRebalanceLog;
|
|
280
298
|
zkProofIpfsHash?: string;
|
|
281
299
|
validationRegistryTxHash?: string;
|
|
282
300
|
validationRegistryChainId?: number;
|
|
@@ -366,6 +384,8 @@ interface OpportunitiesResponse {
|
|
|
366
384
|
}
|
|
367
385
|
interface ApyPosition {
|
|
368
386
|
apy: number;
|
|
387
|
+
/** Net APY after Zyfi performance fee (gross × 0.9). */
|
|
388
|
+
apy_withFee?: number;
|
|
369
389
|
balance: number;
|
|
370
390
|
chainId: number;
|
|
371
391
|
protocol: string;
|
|
@@ -1190,7 +1210,8 @@ declare class ZyfaiSDK {
|
|
|
1190
1210
|
getPositions(userAddress: string, chainId?: SupportedChainId): Promise<PortfolioResponse>;
|
|
1191
1211
|
/**
|
|
1192
1212
|
* Get portfolio positions and balances for a user, enriched with
|
|
1193
|
-
* net-of-pending-fee fields (`balanceWithFee`, `underlyingAmountWithFee`)
|
|
1213
|
+
* net-of-pending-fee fields (`balanceWithFee`, `underlyingAmountWithFee`)
|
|
1214
|
+
* and net APY (`pool_apy_withFee` = `pool_apy × 0.9`).
|
|
1194
1215
|
*
|
|
1195
1216
|
* Pending fee is derived from onchain `current` earnings × fee rate.
|
|
1196
1217
|
* Gross balances are unchanged. If earnings cannot be fetched, `*WithFee`
|
|
@@ -1310,12 +1331,15 @@ declare class ZyfaiSDK {
|
|
|
1310
1331
|
*
|
|
1311
1332
|
* @param walletAddress - Smart wallet address
|
|
1312
1333
|
* @param chainId - Chain ID
|
|
1313
|
-
* @param options - Optional pagination and
|
|
1334
|
+
* @param options - Optional pagination, date, and assetType filters
|
|
1314
1335
|
* @returns Transaction history
|
|
1315
1336
|
*
|
|
1316
1337
|
* @example
|
|
1317
1338
|
* ```typescript
|
|
1318
|
-
* const history = await sdk.getHistory("0x...", 8453, {
|
|
1339
|
+
* const history = await sdk.getHistory("0x...", 8453, {
|
|
1340
|
+
* limit: 50,
|
|
1341
|
+
* assetType: "eth",
|
|
1342
|
+
* });
|
|
1319
1343
|
* history.data.forEach(tx => console.log(tx.type, tx.amount));
|
|
1320
1344
|
* ```
|
|
1321
1345
|
*/
|
|
@@ -1324,6 +1348,7 @@ declare class ZyfaiSDK {
|
|
|
1324
1348
|
offset?: number;
|
|
1325
1349
|
fromDate?: string;
|
|
1326
1350
|
toDate?: string;
|
|
1351
|
+
assetType?: "usdc" | "eth" | "eurc";
|
|
1327
1352
|
}): Promise<HistoryResponse>;
|
|
1328
1353
|
/**
|
|
1329
1354
|
* Get onchain earnings for a wallet
|
|
@@ -1864,4 +1889,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
|
|
|
1864
1889
|
*/
|
|
1865
1890
|
declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
|
|
1866
1891
|
|
|
1867
|
-
export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, 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 DepegEvent, type DeploySafeResponse, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, 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, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
|
|
1892
|
+
export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, 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 DepegEvent, type DeploySafeResponse, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, 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, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
|
package/dist/index.d.ts
CHANGED
|
@@ -184,6 +184,8 @@ interface PositionSlot {
|
|
|
184
184
|
/** Net underlying amount after this position's share of pending Zyfi fee. */
|
|
185
185
|
underlyingAmountWithFee?: string;
|
|
186
186
|
pool_apy?: number;
|
|
187
|
+
/** Net pool APY after Zyfi performance fee (gross × 0.9). */
|
|
188
|
+
pool_apy_withFee?: number;
|
|
187
189
|
pool_tvl?: number;
|
|
188
190
|
liquidity?: number;
|
|
189
191
|
}
|
|
@@ -215,11 +217,11 @@ interface APYPerStrategy {
|
|
|
215
217
|
created_at: string;
|
|
216
218
|
strategy: string;
|
|
217
219
|
token_symbol?: string;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
average_apy_without_fee?: number;
|
|
221
|
-
average_apy_with_rzfi_without_fee?: number;
|
|
220
|
+
average_apy_withFee: number;
|
|
221
|
+
average_apy_with_rzfi_withFee: number;
|
|
222
222
|
events_average_apy?: Record<string, number>;
|
|
223
|
+
events_average_apy_withFee?: Record<string, number>;
|
|
224
|
+
events_average_apy_with_rzfi_withFee?: Record<string, number>;
|
|
223
225
|
}
|
|
224
226
|
interface APYPerStrategyResponse {
|
|
225
227
|
success: boolean;
|
|
@@ -265,6 +267,19 @@ interface HistoryPosition {
|
|
|
265
267
|
protocol_icon?: string;
|
|
266
268
|
protocol_name?: string;
|
|
267
269
|
}
|
|
270
|
+
interface HistoryFeeData {
|
|
271
|
+
gasCostInToken?: string;
|
|
272
|
+
gasDeducted?: boolean;
|
|
273
|
+
actualGasCost?: string;
|
|
274
|
+
}
|
|
275
|
+
interface HistoryRebalanceLog {
|
|
276
|
+
oldApy?: string;
|
|
277
|
+
newApy?: string;
|
|
278
|
+
oldApy_withFee?: string;
|
|
279
|
+
newApy_withFee?: string;
|
|
280
|
+
oldOpportunity?: string;
|
|
281
|
+
newOpportunity?: string;
|
|
282
|
+
}
|
|
268
283
|
interface HistoryEntry {
|
|
269
284
|
id?: string;
|
|
270
285
|
action?: string;
|
|
@@ -272,11 +287,14 @@ interface HistoryEntry {
|
|
|
272
287
|
strategy?: string;
|
|
273
288
|
positions?: HistoryPosition[];
|
|
274
289
|
chainId?: number;
|
|
290
|
+
tokenId?: string;
|
|
275
291
|
transactionHash?: string;
|
|
276
292
|
destinationChainId?: number;
|
|
277
293
|
sourceChains?: number[];
|
|
278
294
|
crosschain?: boolean;
|
|
279
295
|
rebalance?: boolean;
|
|
296
|
+
feeData?: HistoryFeeData;
|
|
297
|
+
rebalanceLog?: HistoryRebalanceLog;
|
|
280
298
|
zkProofIpfsHash?: string;
|
|
281
299
|
validationRegistryTxHash?: string;
|
|
282
300
|
validationRegistryChainId?: number;
|
|
@@ -366,6 +384,8 @@ interface OpportunitiesResponse {
|
|
|
366
384
|
}
|
|
367
385
|
interface ApyPosition {
|
|
368
386
|
apy: number;
|
|
387
|
+
/** Net APY after Zyfi performance fee (gross × 0.9). */
|
|
388
|
+
apy_withFee?: number;
|
|
369
389
|
balance: number;
|
|
370
390
|
chainId: number;
|
|
371
391
|
protocol: string;
|
|
@@ -1190,7 +1210,8 @@ declare class ZyfaiSDK {
|
|
|
1190
1210
|
getPositions(userAddress: string, chainId?: SupportedChainId): Promise<PortfolioResponse>;
|
|
1191
1211
|
/**
|
|
1192
1212
|
* Get portfolio positions and balances for a user, enriched with
|
|
1193
|
-
* net-of-pending-fee fields (`balanceWithFee`, `underlyingAmountWithFee`)
|
|
1213
|
+
* net-of-pending-fee fields (`balanceWithFee`, `underlyingAmountWithFee`)
|
|
1214
|
+
* and net APY (`pool_apy_withFee` = `pool_apy × 0.9`).
|
|
1194
1215
|
*
|
|
1195
1216
|
* Pending fee is derived from onchain `current` earnings × fee rate.
|
|
1196
1217
|
* Gross balances are unchanged. If earnings cannot be fetched, `*WithFee`
|
|
@@ -1310,12 +1331,15 @@ declare class ZyfaiSDK {
|
|
|
1310
1331
|
*
|
|
1311
1332
|
* @param walletAddress - Smart wallet address
|
|
1312
1333
|
* @param chainId - Chain ID
|
|
1313
|
-
* @param options - Optional pagination and
|
|
1334
|
+
* @param options - Optional pagination, date, and assetType filters
|
|
1314
1335
|
* @returns Transaction history
|
|
1315
1336
|
*
|
|
1316
1337
|
* @example
|
|
1317
1338
|
* ```typescript
|
|
1318
|
-
* const history = await sdk.getHistory("0x...", 8453, {
|
|
1339
|
+
* const history = await sdk.getHistory("0x...", 8453, {
|
|
1340
|
+
* limit: 50,
|
|
1341
|
+
* assetType: "eth",
|
|
1342
|
+
* });
|
|
1319
1343
|
* history.data.forEach(tx => console.log(tx.type, tx.amount));
|
|
1320
1344
|
* ```
|
|
1321
1345
|
*/
|
|
@@ -1324,6 +1348,7 @@ declare class ZyfaiSDK {
|
|
|
1324
1348
|
offset?: number;
|
|
1325
1349
|
fromDate?: string;
|
|
1326
1350
|
toDate?: string;
|
|
1351
|
+
assetType?: "usdc" | "eth" | "eurc";
|
|
1327
1352
|
}): Promise<HistoryResponse>;
|
|
1328
1353
|
/**
|
|
1329
1354
|
* Get onchain earnings for a wallet
|
|
@@ -1864,4 +1889,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
|
|
|
1864
1889
|
*/
|
|
1865
1890
|
declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
|
|
1866
1891
|
|
|
1867
|
-
export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, 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 DepegEvent, type DeploySafeResponse, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, 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, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
|
|
1892
|
+
export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, 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 DepegEvent, type DeploySafeResponse, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, 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, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
|
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ var ENDPOINTS = {
|
|
|
81
81
|
// Data (v1)
|
|
82
82
|
DATA_POSITION: (walletAddress) => `/data/position?walletAddress=${walletAddress}`,
|
|
83
83
|
DATA_PORTFOLIO: (walletAddress) => `/data/wallet-portfolio?walletAddress=${walletAddress}`,
|
|
84
|
-
DATA_HISTORY: (walletAddress, chainId) => `/data/history?walletAddress=${walletAddress}&chainId=${chainId}`,
|
|
84
|
+
DATA_HISTORY: (walletAddress, chainId, assetType) => `/data/history?walletAddress=${walletAddress}&chainId=${chainId}${assetType ? `&assetType=${assetType}` : ""}`,
|
|
85
85
|
DATA_TVL: "/data/usd-tvl",
|
|
86
86
|
DATA_VOLUME: (assetType) => `/data/volume?assetType=${assetType}`,
|
|
87
87
|
DATA_FIRST_TOPUP: (walletAddress, chainId) => `/data/first-topup?walletAddress=${walletAddress}&chainId=${chainId}`,
|
|
@@ -990,19 +990,19 @@ function convertStrategyToPublicAndNaming(obj) {
|
|
|
990
990
|
}
|
|
991
991
|
}
|
|
992
992
|
if (result.average_apy_without_fee !== void 0) {
|
|
993
|
-
result.
|
|
993
|
+
result.average_apy_withFee = result.average_apy_without_fee;
|
|
994
994
|
delete result.average_apy_without_fee;
|
|
995
995
|
}
|
|
996
996
|
if (result.average_apy_with_rzfi_without_fee !== void 0) {
|
|
997
|
-
result.
|
|
997
|
+
result.average_apy_with_rzfi_withFee = result.average_apy_with_rzfi_without_fee;
|
|
998
998
|
delete result.average_apy_with_rzfi_without_fee;
|
|
999
999
|
}
|
|
1000
1000
|
if (result.events_average_apy_without_fee !== void 0) {
|
|
1001
|
-
result.
|
|
1001
|
+
result.events_average_apy_withFee = result.events_average_apy_without_fee;
|
|
1002
1002
|
delete result.events_average_apy_without_fee;
|
|
1003
1003
|
}
|
|
1004
1004
|
if (result.events_average_apy_with_rzfi_without_fee !== void 0) {
|
|
1005
|
-
result.
|
|
1005
|
+
result.events_average_apy_with_rzfi_withFee = result.events_average_apy_with_rzfi_without_fee;
|
|
1006
1006
|
delete result.events_average_apy_with_rzfi_without_fee;
|
|
1007
1007
|
}
|
|
1008
1008
|
return result;
|
|
@@ -1098,6 +1098,14 @@ function humanAmountToRaw(human, decimals) {
|
|
|
1098
1098
|
const fracPart = BigInt(frac.padEnd(decimals, "0").slice(0, decimals) || "0");
|
|
1099
1099
|
return wholePart * 10n ** BigInt(decimals) + fracPart;
|
|
1100
1100
|
}
|
|
1101
|
+
function applyApyFee(apy) {
|
|
1102
|
+
return apy * (1 - ZYFI_FEE_RATE);
|
|
1103
|
+
}
|
|
1104
|
+
function applyApyFeeToString(apy) {
|
|
1105
|
+
const parsed = Number.parseFloat(apy);
|
|
1106
|
+
if (!Number.isFinite(parsed)) return apy;
|
|
1107
|
+
return String(applyApyFee(parsed));
|
|
1108
|
+
}
|
|
1101
1109
|
function formatHumanAmount(value) {
|
|
1102
1110
|
if (!Number.isFinite(value) || value === 0) return "0";
|
|
1103
1111
|
const fixed = value.toFixed(18);
|
|
@@ -1228,22 +1236,37 @@ function enrichPositions(positions, byChainByToken) {
|
|
|
1228
1236
|
});
|
|
1229
1237
|
});
|
|
1230
1238
|
return positions.map((position, index) => {
|
|
1239
|
+
const enriched = { ...position };
|
|
1240
|
+
if (typeof position.pool_apy === "number") {
|
|
1241
|
+
enriched.pool_apy_withFee = applyApyFee(position.pool_apy);
|
|
1242
|
+
}
|
|
1231
1243
|
const underlying = position.underlyingAmount;
|
|
1232
1244
|
if (underlying === void 0) {
|
|
1233
|
-
return
|
|
1245
|
+
return enriched;
|
|
1234
1246
|
}
|
|
1235
1247
|
const feeShare = feeShareByIndex.get(index) ?? 0;
|
|
1236
1248
|
const decimals = resolvePositionDecimals(position);
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
)
|
|
1244
|
-
};
|
|
1249
|
+
enriched.underlyingAmountWithFee = applyFeeToDecimalWei(
|
|
1250
|
+
underlying,
|
|
1251
|
+
feeShare,
|
|
1252
|
+
decimals
|
|
1253
|
+
);
|
|
1254
|
+
return enriched;
|
|
1245
1255
|
});
|
|
1246
1256
|
}
|
|
1257
|
+
function enrichApyPosition(position) {
|
|
1258
|
+
return {
|
|
1259
|
+
...position,
|
|
1260
|
+
apy_withFee: applyApyFee(position.apy)
|
|
1261
|
+
};
|
|
1262
|
+
}
|
|
1263
|
+
function enrichRebalanceLog(log) {
|
|
1264
|
+
return {
|
|
1265
|
+
...log,
|
|
1266
|
+
...log.oldApy !== void 0 ? { oldApy_withFee: applyApyFeeToString(log.oldApy) } : {},
|
|
1267
|
+
...log.newApy !== void 0 ? { newApy_withFee: applyApyFeeToString(log.newApy) } : {}
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1247
1270
|
function enrichPortfolioWithFees(portfolio, currentEarningsByChain) {
|
|
1248
1271
|
const { byToken, byChainByToken } = computePendingFees(currentEarningsByChain);
|
|
1249
1272
|
const portfolioByAssetType = portfolio.portfolioByAssetType ? Object.fromEntries(
|
|
@@ -2822,7 +2845,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2822
2845
|
}
|
|
2823
2846
|
/**
|
|
2824
2847
|
* Get portfolio positions and balances for a user, enriched with
|
|
2825
|
-
* net-of-pending-fee fields (`balanceWithFee`, `underlyingAmountWithFee`)
|
|
2848
|
+
* net-of-pending-fee fields (`balanceWithFee`, `underlyingAmountWithFee`)
|
|
2849
|
+
* and net APY (`pool_apy_withFee` = `pool_apy × 0.9`).
|
|
2826
2850
|
*
|
|
2827
2851
|
* Pending fee is derived from onchain `current` earnings × fee rate.
|
|
2828
2852
|
* Gross balances are unchanged. If earnings cannot be fetched, `*WithFee`
|
|
@@ -3132,12 +3156,15 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3132
3156
|
*
|
|
3133
3157
|
* @param walletAddress - Smart wallet address
|
|
3134
3158
|
* @param chainId - Chain ID
|
|
3135
|
-
* @param options - Optional pagination and
|
|
3159
|
+
* @param options - Optional pagination, date, and assetType filters
|
|
3136
3160
|
* @returns Transaction history
|
|
3137
3161
|
*
|
|
3138
3162
|
* @example
|
|
3139
3163
|
* ```typescript
|
|
3140
|
-
* const history = await sdk.getHistory("0x...", 8453, {
|
|
3164
|
+
* const history = await sdk.getHistory("0x...", 8453, {
|
|
3165
|
+
* limit: 50,
|
|
3166
|
+
* assetType: "eth",
|
|
3167
|
+
* });
|
|
3141
3168
|
* history.data.forEach(tx => console.log(tx.type, tx.amount));
|
|
3142
3169
|
* ```
|
|
3143
3170
|
*/
|
|
@@ -3149,13 +3176,24 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3149
3176
|
if (!chainId) {
|
|
3150
3177
|
throw new Error("Chain ID is required");
|
|
3151
3178
|
}
|
|
3152
|
-
let endpoint = ENDPOINTS.DATA_HISTORY(
|
|
3179
|
+
let endpoint = ENDPOINTS.DATA_HISTORY(
|
|
3180
|
+
walletAddress,
|
|
3181
|
+
chainId,
|
|
3182
|
+
options?.assetType
|
|
3183
|
+
);
|
|
3153
3184
|
if (options?.limit) endpoint += `&limit=${options.limit}`;
|
|
3154
3185
|
if (options?.offset) endpoint += `&offset=${options.offset}`;
|
|
3155
3186
|
if (options?.fromDate) endpoint += `&fromDate=${options.fromDate}`;
|
|
3156
3187
|
if (options?.toDate) endpoint += `&toDate=${options.toDate}`;
|
|
3157
3188
|
const response = await this.httpClient.get(endpoint);
|
|
3158
|
-
const convertedData = convertStrategiesToPublic(
|
|
3189
|
+
const convertedData = convertStrategiesToPublic(
|
|
3190
|
+
response.data || []
|
|
3191
|
+
).map(
|
|
3192
|
+
(entry) => entry.rebalanceLog ? {
|
|
3193
|
+
...entry,
|
|
3194
|
+
rebalanceLog: enrichRebalanceLog(entry.rebalanceLog)
|
|
3195
|
+
} : entry
|
|
3196
|
+
);
|
|
3159
3197
|
return {
|
|
3160
3198
|
success: true,
|
|
3161
3199
|
walletAddress,
|
|
@@ -3581,10 +3619,23 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3581
3619
|
DATA_ENDPOINTS.DAILY_APY_HISTORY_WEIGHTED(walletAddress, days)
|
|
3582
3620
|
);
|
|
3583
3621
|
const data = response.data || response;
|
|
3622
|
+
const rawHistory = data.history || {};
|
|
3623
|
+
const history = Object.fromEntries(
|
|
3624
|
+
Object.entries(rawHistory).map(([date, entry]) => {
|
|
3625
|
+
const day = entry;
|
|
3626
|
+
return [
|
|
3627
|
+
date,
|
|
3628
|
+
{
|
|
3629
|
+
...day,
|
|
3630
|
+
positions: (day.positions || []).map(enrichApyPosition)
|
|
3631
|
+
}
|
|
3632
|
+
];
|
|
3633
|
+
})
|
|
3634
|
+
);
|
|
3584
3635
|
return {
|
|
3585
3636
|
success: true,
|
|
3586
3637
|
walletAddress,
|
|
3587
|
-
history
|
|
3638
|
+
history,
|
|
3588
3639
|
totalDays: data.total_days || data.totalDays || 0,
|
|
3589
3640
|
requestedDays: data.requested_days || data.requestedDays,
|
|
3590
3641
|
weightedApyWithRzfiAfterFee: data.average_final_weighted_apy_after_fee_with_rzfi,
|
package/dist/index.mjs
CHANGED
|
@@ -29,7 +29,7 @@ var ENDPOINTS = {
|
|
|
29
29
|
// Data (v1)
|
|
30
30
|
DATA_POSITION: (walletAddress) => `/data/position?walletAddress=${walletAddress}`,
|
|
31
31
|
DATA_PORTFOLIO: (walletAddress) => `/data/wallet-portfolio?walletAddress=${walletAddress}`,
|
|
32
|
-
DATA_HISTORY: (walletAddress, chainId) => `/data/history?walletAddress=${walletAddress}&chainId=${chainId}`,
|
|
32
|
+
DATA_HISTORY: (walletAddress, chainId, assetType) => `/data/history?walletAddress=${walletAddress}&chainId=${chainId}${assetType ? `&assetType=${assetType}` : ""}`,
|
|
33
33
|
DATA_TVL: "/data/usd-tvl",
|
|
34
34
|
DATA_VOLUME: (assetType) => `/data/volume?assetType=${assetType}`,
|
|
35
35
|
DATA_FIRST_TOPUP: (walletAddress, chainId) => `/data/first-topup?walletAddress=${walletAddress}&chainId=${chainId}`,
|
|
@@ -958,19 +958,19 @@ function convertStrategyToPublicAndNaming(obj) {
|
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
960
|
if (result.average_apy_without_fee !== void 0) {
|
|
961
|
-
result.
|
|
961
|
+
result.average_apy_withFee = result.average_apy_without_fee;
|
|
962
962
|
delete result.average_apy_without_fee;
|
|
963
963
|
}
|
|
964
964
|
if (result.average_apy_with_rzfi_without_fee !== void 0) {
|
|
965
|
-
result.
|
|
965
|
+
result.average_apy_with_rzfi_withFee = result.average_apy_with_rzfi_without_fee;
|
|
966
966
|
delete result.average_apy_with_rzfi_without_fee;
|
|
967
967
|
}
|
|
968
968
|
if (result.events_average_apy_without_fee !== void 0) {
|
|
969
|
-
result.
|
|
969
|
+
result.events_average_apy_withFee = result.events_average_apy_without_fee;
|
|
970
970
|
delete result.events_average_apy_without_fee;
|
|
971
971
|
}
|
|
972
972
|
if (result.events_average_apy_with_rzfi_without_fee !== void 0) {
|
|
973
|
-
result.
|
|
973
|
+
result.events_average_apy_with_rzfi_withFee = result.events_average_apy_with_rzfi_without_fee;
|
|
974
974
|
delete result.events_average_apy_with_rzfi_without_fee;
|
|
975
975
|
}
|
|
976
976
|
return result;
|
|
@@ -1066,6 +1066,14 @@ function humanAmountToRaw(human, decimals) {
|
|
|
1066
1066
|
const fracPart = BigInt(frac.padEnd(decimals, "0").slice(0, decimals) || "0");
|
|
1067
1067
|
return wholePart * 10n ** BigInt(decimals) + fracPart;
|
|
1068
1068
|
}
|
|
1069
|
+
function applyApyFee(apy) {
|
|
1070
|
+
return apy * (1 - ZYFI_FEE_RATE);
|
|
1071
|
+
}
|
|
1072
|
+
function applyApyFeeToString(apy) {
|
|
1073
|
+
const parsed = Number.parseFloat(apy);
|
|
1074
|
+
if (!Number.isFinite(parsed)) return apy;
|
|
1075
|
+
return String(applyApyFee(parsed));
|
|
1076
|
+
}
|
|
1069
1077
|
function formatHumanAmount(value) {
|
|
1070
1078
|
if (!Number.isFinite(value) || value === 0) return "0";
|
|
1071
1079
|
const fixed = value.toFixed(18);
|
|
@@ -1196,22 +1204,37 @@ function enrichPositions(positions, byChainByToken) {
|
|
|
1196
1204
|
});
|
|
1197
1205
|
});
|
|
1198
1206
|
return positions.map((position, index) => {
|
|
1207
|
+
const enriched = { ...position };
|
|
1208
|
+
if (typeof position.pool_apy === "number") {
|
|
1209
|
+
enriched.pool_apy_withFee = applyApyFee(position.pool_apy);
|
|
1210
|
+
}
|
|
1199
1211
|
const underlying = position.underlyingAmount;
|
|
1200
1212
|
if (underlying === void 0) {
|
|
1201
|
-
return
|
|
1213
|
+
return enriched;
|
|
1202
1214
|
}
|
|
1203
1215
|
const feeShare = feeShareByIndex.get(index) ?? 0;
|
|
1204
1216
|
const decimals = resolvePositionDecimals(position);
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
)
|
|
1212
|
-
};
|
|
1217
|
+
enriched.underlyingAmountWithFee = applyFeeToDecimalWei(
|
|
1218
|
+
underlying,
|
|
1219
|
+
feeShare,
|
|
1220
|
+
decimals
|
|
1221
|
+
);
|
|
1222
|
+
return enriched;
|
|
1213
1223
|
});
|
|
1214
1224
|
}
|
|
1225
|
+
function enrichApyPosition(position) {
|
|
1226
|
+
return {
|
|
1227
|
+
...position,
|
|
1228
|
+
apy_withFee: applyApyFee(position.apy)
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
function enrichRebalanceLog(log) {
|
|
1232
|
+
return {
|
|
1233
|
+
...log,
|
|
1234
|
+
...log.oldApy !== void 0 ? { oldApy_withFee: applyApyFeeToString(log.oldApy) } : {},
|
|
1235
|
+
...log.newApy !== void 0 ? { newApy_withFee: applyApyFeeToString(log.newApy) } : {}
|
|
1236
|
+
};
|
|
1237
|
+
}
|
|
1215
1238
|
function enrichPortfolioWithFees(portfolio, currentEarningsByChain) {
|
|
1216
1239
|
const { byToken, byChainByToken } = computePendingFees(currentEarningsByChain);
|
|
1217
1240
|
const portfolioByAssetType = portfolio.portfolioByAssetType ? Object.fromEntries(
|
|
@@ -2790,7 +2813,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
2790
2813
|
}
|
|
2791
2814
|
/**
|
|
2792
2815
|
* Get portfolio positions and balances for a user, enriched with
|
|
2793
|
-
* net-of-pending-fee fields (`balanceWithFee`, `underlyingAmountWithFee`)
|
|
2816
|
+
* net-of-pending-fee fields (`balanceWithFee`, `underlyingAmountWithFee`)
|
|
2817
|
+
* and net APY (`pool_apy_withFee` = `pool_apy × 0.9`).
|
|
2794
2818
|
*
|
|
2795
2819
|
* Pending fee is derived from onchain `current` earnings × fee rate.
|
|
2796
2820
|
* Gross balances are unchanged. If earnings cannot be fetched, `*WithFee`
|
|
@@ -3100,12 +3124,15 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3100
3124
|
*
|
|
3101
3125
|
* @param walletAddress - Smart wallet address
|
|
3102
3126
|
* @param chainId - Chain ID
|
|
3103
|
-
* @param options - Optional pagination and
|
|
3127
|
+
* @param options - Optional pagination, date, and assetType filters
|
|
3104
3128
|
* @returns Transaction history
|
|
3105
3129
|
*
|
|
3106
3130
|
* @example
|
|
3107
3131
|
* ```typescript
|
|
3108
|
-
* const history = await sdk.getHistory("0x...", 8453, {
|
|
3132
|
+
* const history = await sdk.getHistory("0x...", 8453, {
|
|
3133
|
+
* limit: 50,
|
|
3134
|
+
* assetType: "eth",
|
|
3135
|
+
* });
|
|
3109
3136
|
* history.data.forEach(tx => console.log(tx.type, tx.amount));
|
|
3110
3137
|
* ```
|
|
3111
3138
|
*/
|
|
@@ -3117,13 +3144,24 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3117
3144
|
if (!chainId) {
|
|
3118
3145
|
throw new Error("Chain ID is required");
|
|
3119
3146
|
}
|
|
3120
|
-
let endpoint = ENDPOINTS.DATA_HISTORY(
|
|
3147
|
+
let endpoint = ENDPOINTS.DATA_HISTORY(
|
|
3148
|
+
walletAddress,
|
|
3149
|
+
chainId,
|
|
3150
|
+
options?.assetType
|
|
3151
|
+
);
|
|
3121
3152
|
if (options?.limit) endpoint += `&limit=${options.limit}`;
|
|
3122
3153
|
if (options?.offset) endpoint += `&offset=${options.offset}`;
|
|
3123
3154
|
if (options?.fromDate) endpoint += `&fromDate=${options.fromDate}`;
|
|
3124
3155
|
if (options?.toDate) endpoint += `&toDate=${options.toDate}`;
|
|
3125
3156
|
const response = await this.httpClient.get(endpoint);
|
|
3126
|
-
const convertedData = convertStrategiesToPublic(
|
|
3157
|
+
const convertedData = convertStrategiesToPublic(
|
|
3158
|
+
response.data || []
|
|
3159
|
+
).map(
|
|
3160
|
+
(entry) => entry.rebalanceLog ? {
|
|
3161
|
+
...entry,
|
|
3162
|
+
rebalanceLog: enrichRebalanceLog(entry.rebalanceLog)
|
|
3163
|
+
} : entry
|
|
3164
|
+
);
|
|
3127
3165
|
return {
|
|
3128
3166
|
success: true,
|
|
3129
3167
|
walletAddress,
|
|
@@ -3549,10 +3587,23 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3549
3587
|
DATA_ENDPOINTS.DAILY_APY_HISTORY_WEIGHTED(walletAddress, days)
|
|
3550
3588
|
);
|
|
3551
3589
|
const data = response.data || response;
|
|
3590
|
+
const rawHistory = data.history || {};
|
|
3591
|
+
const history = Object.fromEntries(
|
|
3592
|
+
Object.entries(rawHistory).map(([date, entry]) => {
|
|
3593
|
+
const day = entry;
|
|
3594
|
+
return [
|
|
3595
|
+
date,
|
|
3596
|
+
{
|
|
3597
|
+
...day,
|
|
3598
|
+
positions: (day.positions || []).map(enrichApyPosition)
|
|
3599
|
+
}
|
|
3600
|
+
];
|
|
3601
|
+
})
|
|
3602
|
+
);
|
|
3552
3603
|
return {
|
|
3553
3604
|
success: true,
|
|
3554
3605
|
walletAddress,
|
|
3555
|
-
history
|
|
3606
|
+
history,
|
|
3556
3607
|
totalDays: data.total_days || data.totalDays || 0,
|
|
3557
3608
|
requestedDays: data.requested_days || data.requestedDays,
|
|
3558
3609
|
weightedApyWithRzfiAfterFee: data.average_final_weighted_apy_after_fee_with_rzfi,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyfai/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.51",
|
|
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",
|