@zyfai/sdk 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -424,6 +424,7 @@ Fund your Safe smart wallet. The SDK selects the token address from the chain an
424
424
  - **Ethereum Mainnet (1), Base (8453), Arbitrum (42161)**: USDC (default) or WETH
425
425
  - **Ethereum Mainnet (1), Base (8453)**: EURC (6 decimals; not available on Arbitrum)
426
426
  - **Ethereum Mainnet (1) only**: USDT and PYUSD (6 decimals)
427
+ - **Ethereum Mainnet (1), Arbitrum (42161)**: WBTC (8 decimals; not available on Base — cbBTC is a separate asset)
427
428
  - **Base (8453) only**: NVDAc (8 decimals) — tokenized NVIDIA equity, see [Tokenized equities](#tokenized-equities-nvdac)
428
429
 
429
430
  **Minimum portfolio balance (enforced on Safe balance + deposit amount):**
@@ -431,9 +432,10 @@ Fund your Safe smart wallet. The SDK selects the token address from the chain an
431
432
  - Ethereum Mainnet (1) / USDC, EURC, USDT, or PYUSD: 10,000 units
432
433
  - Base (8453) and Arbitrum (42161) / USDC or EURC: 10 units (EURC is not on Arbitrum)
433
434
  - WETH: about **$10,000** of ETH on Ethereum Mainnet, **$10** on Base and Arbitrum
435
+ - WBTC: about **$10,000** of BTC on Ethereum Mainnet, **$10** on Arbitrum
434
436
  - NVDAc: about **$10** on Base
435
437
 
436
- Minimums for WETH and NVDAc are quoted in dollars and converted at deposit time from the live USD price (Data API `GET /api/v2/price?token=eth` and `?token=nvdac`, same API key as the SDK), so the on-chain threshold moves with the market.
438
+ Minimums for WETH, WBTC and NVDAc are quoted in dollars and converted at deposit time from the live USD price (Data API `GET /api/v2/price?token=eth`, `?token=wbtc` and `?token=nvdac`, same API key as the SDK), so the on-chain threshold moves with the market.
437
439
 
438
440
  Top-ups smaller than the minimum are allowed if the Safe already holds enough of the asset to meet it after the deposit.
439
441
 
@@ -480,8 +482,8 @@ if (credited.status === "credited") {
480
482
  **Note:**
481
483
 
482
484
  - Amount must be in least decimal units. For USDC (6 decimals): 1 USDC = 1000000
483
- - `asset` is required (`"USDC"`, `"WETH"`, `"EURC"`, `"USDT"`, `"PYUSD"`, or `"NVDAc"` — EURC on Mainnet/Base, USDT and PYUSD on Mainnet, NVDAc on Base); token address is selected from that for the chain. Depositing an asset on a chain where it does not exist throws before any transfer.
484
- - The total Safe balance must meet the per-asset minimum after the deposit (see above). WETH uses a live ETH/USD price, so the wei threshold moves with the market.
485
+ - `asset` is required (`"USDC"`, `"WETH"`, `"EURC"`, `"USDT"`, `"PYUSD"`, `"NVDAc"`, or `"WBTC"` — EURC on Mainnet/Base, USDT and PYUSD on Mainnet, NVDAc on Base, WBTC on Mainnet/Arbitrum); token address is selected from that for the chain. Depositing an asset on a chain where it does not exist throws before any transfer.
486
+ - The total Safe balance must meet the per-asset minimum after the deposit (see above). WETH and WBTC use a live USD price, so the least-unit threshold moves with the market. WBTC has 8 decimals: 1 WBTC = 100000000.
485
487
  - Call `connectAccount()` on the **same** `ZyfaiSDK` instance before `sendDeposit()`. The SDK uses that session's JWT to submit a permit or register a wallet transfer.
486
488
  - `sendDeposit(userAddress, chainId, amount, asset)` funds the Safe directly when the wallet already holds the collateral. Pass an object with `spendToken` when the wallet holds a different token or the same token on another chain: the execution API quotes Relay, the wallet signs, and the Safe receives `asset`. Same-chain ETH into WETH wraps in the wallet (`spendToken: "ETH"`). `sendDirectDeposit` and `sendSwapDeposit` are the two steps `sendDeposit` chooses between. Optional `slippageBps` on a swap defaults to 200 (max 500) and is fixed when the funding order is created. Omit it to use the server default. A later `sendSwapDeposit({ orderId })` ignores a new `slippageBps` and signs the stored order.
487
489
 
@@ -500,7 +502,7 @@ if (credited.status === "credited") {
500
502
  - `sendDeposit()` confirms the transfer (or the Relay fill) and registers its lifecycle, then returns its ID. Call `waitForDepositPosition()` when the UI should wait until allocation finishes. `waitForDepositCredit()` is the shorter wait for credited balance only.
501
503
  - `depositFunds()` remains a compatibility wrapper that calls both steps and waits through the normal completion window; it **rejects** if credit is not confirmed in that window (track in-flight deposits with `getDepositStatus()` or call `waitForDepositCredit()` with a longer `timeoutMs`).
502
504
  - If first-deposit protocol patching fails, funding still proceeds. If registration fails after a wallet transfer, use the transfer hash to retry `logDeposit()` after `connectAccount()`.
503
- - **First deposit only** (before transfer + `log_deposit`): if the USDC profile has no `chains` yet, the SDK patches protocols for **USDC, WETH, EURC, USDT, PYUSD, and NVDAc**, each across the chains it exists on (EURC on Mainnet/Base, USDT and PYUSD on Mainnet, NVDAc on Base → `assetTypeSettings.[usdc|eth|eurc|usdt|pyusd|nvdac]`). Pass optional `strategy` (`"conservative"` default, `"aggressive"` or `"yieldmaxxing"`) — same role as the former `deploySafe` strategy argument. Later deposits skip this.
505
+ - **First deposit only** (before transfer + `log_deposit`): if the USDC profile has no `chains` yet, the SDK patches protocols for **USDC, WETH, EURC, USDT, PYUSD, NVDAc, and WBTC**, each across the chains it exists on (EURC on Mainnet/Base, USDT and PYUSD on Mainnet, NVDAc on Base, WBTC on Mainnet/Arbitrum → `assetTypeSettings.[usdc|eth|eurc|usdt|pyusd|nvdac|wbtc]`). Pass optional `strategy` (`"conservative"` default, `"aggressive"` or `"yieldmaxxing"`) — same role as the former `deploySafe` strategy argument. That first write also opts each configured asset into vaults added later (`autoSelectProtocols`). Later deposits skip this.
504
506
  - **`strategy` is ignored on later deposits, and no error is raised.** Re-running the patch would overwrite a protocol selection the user may have customised, so passing `"yieldmaxxing"` to an account that has already deposited leaves it on its current strategy. To change an existing account, use `setStrategyWithProtocols` or `setAssetStrategy` (not `updateUserProfile` alone):
505
507
 
506
508
  ```typescript
@@ -899,7 +901,7 @@ console.log("Active protocols:", userDetails.user.protocols.length); // Should b
899
901
 
900
902
  **Note**:
901
903
  - User must be authenticated (automatically done via `connectAccount()`)
902
- - Clears protocols for USDC, WETH, EURC, USDT, PYUSD, and NVDAc
904
+ - Clears protocols for USDC, WETH, EURC, USDT, PYUSD, NVDAc, and WBTC
903
905
  - To resume operations, call `resumeAgent()` or `updateUserProfile()` with the desired protocols
904
906
 
905
907
  #### Splitting Management
@@ -956,10 +958,14 @@ if (result.success) {
956
958
  const tvl = await sdk.getTVL();
957
959
  console.log("Total TVL:", tvl.totalTvl);
958
960
 
959
- const volume = await sdk.getVolume();
961
+ const volume = await sdk.getVolume(); // "usdc" (default), "eth", "eurc", or "usdt"
960
962
  console.log("Total Volume:", volume.volumeInUSD);
963
+
964
+ const usdtVolume = await sdk.getVolume("usdt");
961
965
  ```
962
966
 
967
+ `volumeInUSD` is summed in the asset's own units: dollars for `usdc` and `usdt`, ETH for `eth`, EUR for `eurc`.
968
+
963
969
  #### Get Active Wallets
964
970
 
965
971
  ```typescript
@@ -1020,7 +1026,7 @@ console.log("Chain ID:", firstTopup.chainId);
1020
1026
  const history = await sdk.getHistory(walletAddress, 8453, {
1021
1027
  limit: 50,
1022
1028
  fromDate: "2024-01-01",
1023
- assetType: "eth",
1029
+ assetType: "eth", // usdc | eth | eurc | usdt | pyusd | nvdac | wbtc
1024
1030
  });
1025
1031
  history.data.forEach((tx) => {
1026
1032
  console.log(tx.action, tx.transactionHash);
@@ -1105,7 +1111,7 @@ console.log("By chain (with rZFI):", apyHistory.weightedApyWithRzfiAfterFeeByCha
1105
1111
  #### Get Conservative Opportunities (Low Risk)
1106
1112
 
1107
1113
  ```typescript
1108
- // Filter by chain and/or asset
1114
+ // Live pools. Pass "not_live" as the third argument for retired pools.
1109
1115
  const conservativeOpps = await sdk.getConservativeOpportunities(8453, "USDC");
1110
1116
  conservativeOpps.data.forEach((o) => {
1111
1117
  console.log(`${o.protocolName} - ${o.poolName}: ${o.apy}% APY`);
@@ -1173,7 +1179,7 @@ console.log(profile.protocols); // Ipor + Superform
1173
1179
  | Parameter | Default | Notes |
1174
1180
  | --- | --- | --- |
1175
1181
  | `asset` | — | Required |
1176
- | `strategy` | the asset's current one | Omit it to recompute the protocol list without changing strategy |
1182
+ | `strategy` | the asset's current one | Omit it to recompute the protocol list without changing strategy. Passing one opts the asset into vaults added later |
1177
1183
  | `chains` | every chain the asset exists on | **Additive** — chains already enabled are kept, so this cannot disable one |
1178
1184
 
1179
1185
  This is the method to reach for when changing an existing account's strategy,
package/dist/index.d.mts CHANGED
@@ -17,7 +17,17 @@ type Strategy = "conservative" | "aggressive" | "yieldmaxxing";
17
17
  /** Strategy labels returned on opportunity rows (includes renamed public tiers). */
18
18
  type OpportunityStrategyType = "conservative" | "balanced" | "advanced" | Strategy;
19
19
  /** Public asset symbols supported by the SDK */
20
- type SupportedAsset = "USDC" | "WETH" | "EURC" | "USDT" | "PYUSD" | "NVDAc";
20
+ type SupportedAsset = "USDC" | "WETH" | "EURC" | "USDT" | "PYUSD" | "NVDAc" | "WBTC";
21
+ /**
22
+ * Asset filter accepted by `getVolume`.
23
+ *
24
+ * The backend sums deposits in the asset's own units, so only the USD
25
+ * stablecoins (`usdc`, `usdt`) read 1:1 as dollars. Volatile assets are
26
+ * left out until the endpoint prices them.
27
+ */
28
+ type VolumeAssetType = "usdc" | "eth" | "eurc" | "usdt";
29
+ /** Asset filter accepted by `getHistory` — one per {@link SupportedAsset}. */
30
+ type HistoryAssetType = "usdc" | "eth" | "eurc" | "usdt" | "pyusd" | "nvdac" | "wbtc";
21
31
  /** Optional per-chain RPC URLs for on-chain reads and writes. */
22
32
  interface RpcUrlsConfig {
23
33
  /** Ethereum mainnet */
@@ -1653,7 +1663,9 @@ declare class ZyfaiSDK {
1653
1663
  * @param params.asset - Asset to configure
1654
1664
  * @param params.strategy - Strategy to apply; defaults to the one already
1655
1665
  * stored for this asset (`"conservative"` on a fresh account), which lets
1656
- * you recompute a protocol list without changing the strategy
1666
+ * you recompute a protocol list without changing the strategy. Passing a
1667
+ * strategy also opts the asset into vaults added later. Omitting it does
1668
+ * not change that opt-in.
1657
1669
  * @param params.chains - Chains to enable. Defaults to every chain the asset
1658
1670
  * exists on. **Additive**: chains already enabled are kept, so this cannot
1659
1671
  * be used to disable one.
@@ -1681,7 +1693,8 @@ declare class ZyfaiSDK {
1681
1693
  * Apply a strategy and auto-select matching protocols for one or all managed
1682
1694
  * assets ({@link getManagedAssets}). Prefer this over
1683
1695
  * {@link updateUserProfile} when changing strategy so protocols stay aligned
1684
- * with the tier (including `yieldmaxxing` async venues).
1696
+ * with the tier (including `yieldmaxxing` async venues). The chosen strategy
1697
+ * also opts those assets into vaults added later.
1685
1698
  *
1686
1699
  * @group Portfolio and execution
1687
1700
  */
@@ -1756,7 +1769,7 @@ declare class ZyfaiSDK {
1756
1769
  * @param userAddress - Owner EOA (not the Safe)
1757
1770
  * @param chainId - Chain for the transfer
1758
1771
  * @param amount - Amount in least units (string integer)
1759
- * @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `NVDAc`)
1772
+ * @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `USDT`, `PYUSD`, `NVDAc`, `WBTC`)
1760
1773
  * @param strategy - Optional first-deposit {@link Strategy}
1761
1774
  * @returns Transfer receipt and deposit registration
1762
1775
  *
@@ -2457,15 +2470,18 @@ declare class ZyfaiSDK {
2457
2470
  *
2458
2471
  * @remarks Data API. Partner API key only.
2459
2472
  *
2460
- * @returns Total volume in USD
2473
+ * @param assetType - `"usdc"` (default), `"eth"`, `"eurc"`, or `"usdt"`
2474
+ * @returns Cumulative deposit volume, summed in the asset's own units
2475
+ * (dollars for `usdc` and `usdt`)
2461
2476
  *
2462
2477
  * @example
2463
2478
  * ```typescript
2464
2479
  * const volume = await sdk.getVolume();
2480
+ * const usdtVolume = await sdk.getVolume("usdt");
2465
2481
  * console.log("Total Volume:", volume.volumeInUSD);
2466
2482
  * ```
2467
2483
  */
2468
- getVolume(assetType?: "usdc" | "eth" | "eurc"): Promise<VolumeResponse>;
2484
+ getVolume(assetType?: VolumeAssetType): Promise<VolumeResponse>;
2469
2485
  /**
2470
2486
  * Get active wallets for a specific chain.
2471
2487
  *
@@ -2544,7 +2560,7 @@ declare class ZyfaiSDK {
2544
2560
  offset?: number;
2545
2561
  fromDate?: string;
2546
2562
  toDate?: string;
2547
- assetType?: "usdc" | "eth" | "eurc";
2563
+ assetType?: HistoryAssetType;
2548
2564
  }): Promise<HistoryResponse>;
2549
2565
  /**
2550
2566
  * Get onchain earnings for a wallet.
@@ -2614,6 +2630,8 @@ declare class ZyfaiSDK {
2614
2630
  /**
2615
2631
  * Get conservative (low-risk) yield opportunities.
2616
2632
  *
2633
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
2634
+ *
2617
2635
  * @group Analytics and opportunities
2618
2636
  *
2619
2637
  * @remarks Data API. Partner API key only.
@@ -2632,6 +2650,8 @@ declare class ZyfaiSDK {
2632
2650
  /**
2633
2651
  * Get balanced (high-risk, high-reward) yield opportunities.
2634
2652
  *
2653
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
2654
+ *
2635
2655
  * @param chainId - Optional chain ID filter
2636
2656
  * @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
2637
2657
  * @returns List of balanced opportunities
@@ -2656,6 +2676,8 @@ declare class ZyfaiSDK {
2656
2676
  * on Ipor and three on Superform; track the redemption through
2657
2677
  * `getPortfolio().portfolio.pendingAsyncWithdrawals`.
2658
2678
  *
2679
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
2680
+ *
2659
2681
  * @param chainId - Optional chain ID filter
2660
2682
  * @param asset - Optional asset filter (e.g. "USDC", "WETH")
2661
2683
  * @returns List of advanced opportunities
@@ -3332,4 +3354,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
3332
3354
  */
3333
3355
  declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
3334
3356
 
3335
- export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstPermitDepositStatus, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, 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, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, type RzfiClaimTransaction, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
3357
+ export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstPermitDepositStatus, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryAssetType, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, 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, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, type RzfiClaimTransaction, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeAssetType, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
package/dist/index.d.ts CHANGED
@@ -17,7 +17,17 @@ type Strategy = "conservative" | "aggressive" | "yieldmaxxing";
17
17
  /** Strategy labels returned on opportunity rows (includes renamed public tiers). */
18
18
  type OpportunityStrategyType = "conservative" | "balanced" | "advanced" | Strategy;
19
19
  /** Public asset symbols supported by the SDK */
20
- type SupportedAsset = "USDC" | "WETH" | "EURC" | "USDT" | "PYUSD" | "NVDAc";
20
+ type SupportedAsset = "USDC" | "WETH" | "EURC" | "USDT" | "PYUSD" | "NVDAc" | "WBTC";
21
+ /**
22
+ * Asset filter accepted by `getVolume`.
23
+ *
24
+ * The backend sums deposits in the asset's own units, so only the USD
25
+ * stablecoins (`usdc`, `usdt`) read 1:1 as dollars. Volatile assets are
26
+ * left out until the endpoint prices them.
27
+ */
28
+ type VolumeAssetType = "usdc" | "eth" | "eurc" | "usdt";
29
+ /** Asset filter accepted by `getHistory` — one per {@link SupportedAsset}. */
30
+ type HistoryAssetType = "usdc" | "eth" | "eurc" | "usdt" | "pyusd" | "nvdac" | "wbtc";
21
31
  /** Optional per-chain RPC URLs for on-chain reads and writes. */
22
32
  interface RpcUrlsConfig {
23
33
  /** Ethereum mainnet */
@@ -1653,7 +1663,9 @@ declare class ZyfaiSDK {
1653
1663
  * @param params.asset - Asset to configure
1654
1664
  * @param params.strategy - Strategy to apply; defaults to the one already
1655
1665
  * stored for this asset (`"conservative"` on a fresh account), which lets
1656
- * you recompute a protocol list without changing the strategy
1666
+ * you recompute a protocol list without changing the strategy. Passing a
1667
+ * strategy also opts the asset into vaults added later. Omitting it does
1668
+ * not change that opt-in.
1657
1669
  * @param params.chains - Chains to enable. Defaults to every chain the asset
1658
1670
  * exists on. **Additive**: chains already enabled are kept, so this cannot
1659
1671
  * be used to disable one.
@@ -1681,7 +1693,8 @@ declare class ZyfaiSDK {
1681
1693
  * Apply a strategy and auto-select matching protocols for one or all managed
1682
1694
  * assets ({@link getManagedAssets}). Prefer this over
1683
1695
  * {@link updateUserProfile} when changing strategy so protocols stay aligned
1684
- * with the tier (including `yieldmaxxing` async venues).
1696
+ * with the tier (including `yieldmaxxing` async venues). The chosen strategy
1697
+ * also opts those assets into vaults added later.
1685
1698
  *
1686
1699
  * @group Portfolio and execution
1687
1700
  */
@@ -1756,7 +1769,7 @@ declare class ZyfaiSDK {
1756
1769
  * @param userAddress - Owner EOA (not the Safe)
1757
1770
  * @param chainId - Chain for the transfer
1758
1771
  * @param amount - Amount in least units (string integer)
1759
- * @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `NVDAc`)
1772
+ * @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `USDT`, `PYUSD`, `NVDAc`, `WBTC`)
1760
1773
  * @param strategy - Optional first-deposit {@link Strategy}
1761
1774
  * @returns Transfer receipt and deposit registration
1762
1775
  *
@@ -2457,15 +2470,18 @@ declare class ZyfaiSDK {
2457
2470
  *
2458
2471
  * @remarks Data API. Partner API key only.
2459
2472
  *
2460
- * @returns Total volume in USD
2473
+ * @param assetType - `"usdc"` (default), `"eth"`, `"eurc"`, or `"usdt"`
2474
+ * @returns Cumulative deposit volume, summed in the asset's own units
2475
+ * (dollars for `usdc` and `usdt`)
2461
2476
  *
2462
2477
  * @example
2463
2478
  * ```typescript
2464
2479
  * const volume = await sdk.getVolume();
2480
+ * const usdtVolume = await sdk.getVolume("usdt");
2465
2481
  * console.log("Total Volume:", volume.volumeInUSD);
2466
2482
  * ```
2467
2483
  */
2468
- getVolume(assetType?: "usdc" | "eth" | "eurc"): Promise<VolumeResponse>;
2484
+ getVolume(assetType?: VolumeAssetType): Promise<VolumeResponse>;
2469
2485
  /**
2470
2486
  * Get active wallets for a specific chain.
2471
2487
  *
@@ -2544,7 +2560,7 @@ declare class ZyfaiSDK {
2544
2560
  offset?: number;
2545
2561
  fromDate?: string;
2546
2562
  toDate?: string;
2547
- assetType?: "usdc" | "eth" | "eurc";
2563
+ assetType?: HistoryAssetType;
2548
2564
  }): Promise<HistoryResponse>;
2549
2565
  /**
2550
2566
  * Get onchain earnings for a wallet.
@@ -2614,6 +2630,8 @@ declare class ZyfaiSDK {
2614
2630
  /**
2615
2631
  * Get conservative (low-risk) yield opportunities.
2616
2632
  *
2633
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
2634
+ *
2617
2635
  * @group Analytics and opportunities
2618
2636
  *
2619
2637
  * @remarks Data API. Partner API key only.
@@ -2632,6 +2650,8 @@ declare class ZyfaiSDK {
2632
2650
  /**
2633
2651
  * Get balanced (high-risk, high-reward) yield opportunities.
2634
2652
  *
2653
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
2654
+ *
2635
2655
  * @param chainId - Optional chain ID filter
2636
2656
  * @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
2637
2657
  * @returns List of balanced opportunities
@@ -2656,6 +2676,8 @@ declare class ZyfaiSDK {
2656
2676
  * on Ipor and three on Superform; track the redemption through
2657
2677
  * `getPortfolio().portfolio.pendingAsyncWithdrawals`.
2658
2678
  *
2679
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
2680
+ *
2659
2681
  * @param chainId - Optional chain ID filter
2660
2682
  * @param asset - Optional asset filter (e.g. "USDC", "WETH")
2661
2683
  * @returns List of advanced opportunities
@@ -3332,4 +3354,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
3332
3354
  */
3333
3355
  declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
3334
3356
 
3335
- export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstPermitDepositStatus, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, 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, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, type RzfiClaimTransaction, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
3357
+ export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstPermitDepositStatus, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryAssetType, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, 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, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, type RzfiClaimTransaction, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeAssetType, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
package/dist/index.js CHANGED
@@ -204,27 +204,28 @@ var DATA_ENDPOINTS = {
204
204
  if (endDate) url += `&endDate=${endDate}`;
205
205
  return url;
206
206
  },
207
- // Opportunities
207
+ // Opportunities. Omitted status means live pools. Pass not_live to
208
+ // read retired rows. The data API returns both when status is absent.
208
209
  OPPORTUNITIES_SAFE: (chainId, asset, status) => {
209
210
  const params = [];
210
211
  if (chainId !== void 0) params.push(`chainId=${chainId}`);
211
212
  if (asset) params.push(`asset=${asset}`);
212
- if (status) params.push(`status=${status}`);
213
- return params.length > 0 ? `/opportunities/safe?${params.join("&")}` : "/opportunities/safe";
213
+ params.push(`status=${status ?? "live"}`);
214
+ return `/opportunities/safe?${params.join("&")}`;
214
215
  },
215
216
  OPPORTUNITIES_DEGEN: (chainId, asset, status) => {
216
217
  const params = [];
217
218
  if (chainId !== void 0) params.push(`chainId=${chainId}`);
218
219
  if (asset) params.push(`asset=${asset}`);
219
- if (status) params.push(`status=${status}`);
220
- return params.length > 0 ? `/opportunities/degen-strategies?${params.join("&")}` : "/opportunities/degen-strategies";
220
+ params.push(`status=${status ?? "live"}`);
221
+ return `/opportunities/degen-strategies?${params.join("&")}`;
221
222
  },
222
223
  OPPORTUNITIES_ASYNC: (chainId, asset, status) => {
223
224
  const params = [];
224
225
  if (chainId !== void 0) params.push(`chainId=${chainId}`);
225
226
  if (asset) params.push(`asset=${asset}`);
226
- if (status) params.push(`status=${status}`);
227
- return params.length > 0 ? `/opportunities/async?${params.join("&")}` : "/opportunities/async";
227
+ params.push(`status=${status ?? "live"}`);
228
+ return `/opportunities/async?${params.join("&")}`;
228
229
  },
229
230
  // APY History
230
231
  DAILY_APY_HISTORY_WEIGHTED: (walletAddress, days) => `/daily-apy-history/weighted-multi-asset/${walletAddress}${days ? `?days=${days}` : ""}`,
@@ -795,9 +796,9 @@ var MIN_PORTFOLIO_BALANCE = {
795
796
  }
796
797
  };
797
798
  var MIN_PORTFOLIO_USD = {
798
- 1: { WETH: 10000n },
799
+ 1: { WETH: 10000n, WBTC: 10000n },
799
800
  8453: { WETH: 10n, NVDAc: 10n },
800
- 42161: { WETH: 10n }
801
+ 42161: { WETH: 10n, WBTC: 10n }
801
802
  };
802
803
  var DEPOSIT_CREDIT_INTERVAL_MS = {
803
804
  1: 2e3,
@@ -1040,6 +1041,28 @@ var ASSET_CONFIGS = {
1040
1041
  // Base
1041
1042
  },
1042
1043
  enabled: true
1044
+ },
1045
+ // Wrapped Bitcoin. 8 decimals; volatile, so its minimum is quoted in USD.
1046
+ // cbBTC on Base is a separate asset and is not aliased here.
1047
+ WBTC: {
1048
+ symbol: "WBTC",
1049
+ assetType: "wbtc",
1050
+ displayName: "WBTC",
1051
+ icon: "https://etherscan.io/token/images/wbtc_28.png",
1052
+ decimals: 8,
1053
+ priceTokenSymbol: "wbtc",
1054
+ tokenSymbols: ["WBTC"],
1055
+ tokenSymbolsByChainId: {
1056
+ 1: "WBTC",
1057
+ 42161: "WBTC"
1058
+ },
1059
+ addresses: {
1060
+ 1: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
1061
+ // Ethereum
1062
+ 42161: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"
1063
+ // Arbitrum
1064
+ },
1065
+ enabled: true
1043
1066
  }
1044
1067
  };
1045
1068
  var resolveAssetSymbol = (asset) => {
@@ -1348,7 +1371,8 @@ var MANAGED_ASSET_ORDER = [
1348
1371
  "EURC",
1349
1372
  "USDT",
1350
1373
  "PYUSD",
1351
- "NVDAc"
1374
+ "NVDAc",
1375
+ "WBTC"
1352
1376
  ];
1353
1377
  function getManagedAssets() {
1354
1378
  const enabled = Object.entries(ASSET_CONFIGS).filter(([, config]) => config?.enabled === true).map(([key]) => key);
@@ -1634,6 +1658,10 @@ function toPublicStrategyOrUndefined(internalStrategy) {
1634
1658
  function isValidPublicStrategy(strategy) {
1635
1659
  return strategy === "conservative" || strategy === "aggressive" || strategy === "yieldmaxxing";
1636
1660
  }
1661
+ function shouldDefaultAutoSelectNewVaults(input) {
1662
+ if (input.requestedStrategy !== void 0) return true;
1663
+ return !input.hasChains && !input.hasProtocols;
1664
+ }
1637
1665
  function convertStrategyToPublic(obj) {
1638
1666
  if (!obj.strategy) {
1639
1667
  const result = { ...obj };
@@ -1673,7 +1701,7 @@ function removeUnusedFields(obj) {
1673
1701
  }
1674
1702
  function convertAssetInternally(asset) {
1675
1703
  const assetType = ASSET_CONFIGS[asset]?.assetType;
1676
- if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac") {
1704
+ if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac" || assetType === "wbtc") {
1677
1705
  return assetType;
1678
1706
  }
1679
1707
  throw new Error(
@@ -3343,20 +3371,26 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3343
3371
  internalStrategy
3344
3372
  );
3345
3373
  const mandateChainId = chains.find((c) => !existingChains.includes(c)) ?? chains[0];
3374
+ const autoSelectNewVaults = shouldDefaultAutoSelectNewVaults({
3375
+ requestedStrategy: strategy,
3376
+ hasChains: existingChains.length > 0,
3377
+ hasProtocols: (userDetails.protocols?.length ?? 0) > 0
3378
+ });
3346
3379
  return await this.persistDiscoveredAssetProfile(
3347
3380
  asset,
3348
3381
  effectiveChains,
3349
3382
  withPools,
3350
3383
  strategy,
3351
3384
  mandateChainId,
3352
- existingChains
3385
+ existingChains,
3386
+ autoSelectNewVaults
3353
3387
  );
3354
3388
  }
3355
3389
  /**
3356
3390
  * Persist protocol discovery for one asset (user PATCH or agent deposit-setup).
3357
3391
  * @internal
3358
3392
  */
3359
- async persistDiscoveredAssetProfile(asset, effectiveChains, withPools, strategy, agentDepositChainId, existingChains = []) {
3393
+ async persistDiscoveredAssetProfile(asset, effectiveChains, withPools, strategy, agentDepositChainId, existingChains = [], autoSelectNewVaults = false) {
3360
3394
  const internalAsset = convertAssetInternally(asset);
3361
3395
  const assetSettings = {
3362
3396
  chains: effectiveChains,
@@ -3365,11 +3399,15 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3365
3399
  if (strategy !== void 0) {
3366
3400
  assetSettings.rebalanceStrategy = toInternalStrategy(strategy);
3367
3401
  }
3402
+ if (autoSelectNewVaults) {
3403
+ assetSettings.autoSelectProtocols = true;
3404
+ }
3368
3405
  const configureProfile = () => this.updateUserProfile({
3369
3406
  asset,
3370
3407
  protocols: withPools,
3371
3408
  chains: effectiveChains,
3372
- ...strategy !== void 0 && { strategy }
3409
+ ...strategy !== void 0 && { strategy },
3410
+ ...autoSelectNewVaults && { autoSelectProtocols: true }
3373
3411
  });
3374
3412
  if (this.sessionChannel === "agent") {
3375
3413
  const chainId = agentDepositChainId ?? effectiveChains[effectiveChains.length - 1] ?? effectiveChains[0];
@@ -3413,7 +3451,9 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3413
3451
  * @param params.asset - Asset to configure
3414
3452
  * @param params.strategy - Strategy to apply; defaults to the one already
3415
3453
  * stored for this asset (`"conservative"` on a fresh account), which lets
3416
- * you recompute a protocol list without changing the strategy
3454
+ * you recompute a protocol list without changing the strategy. Passing a
3455
+ * strategy also opts the asset into vaults added later. Omitting it does
3456
+ * not change that opt-in.
3417
3457
  * @param params.chains - Chains to enable. Defaults to every chain the asset
3418
3458
  * exists on. **Additive**: chains already enabled are kept, so this cannot
3419
3459
  * be used to disable one.
@@ -3472,7 +3512,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3472
3512
  * Apply a strategy and auto-select matching protocols for one or all managed
3473
3513
  * assets ({@link getManagedAssets}). Prefer this over
3474
3514
  * {@link updateUserProfile} when changing strategy so protocols stay aligned
3475
- * with the tier (including `yieldmaxxing` async venues).
3515
+ * with the tier (including `yieldmaxxing` async venues). The chosen strategy
3516
+ * also opts those assets into vaults added later.
3476
3517
  *
3477
3518
  * @group Portfolio and execution
3478
3519
  */
@@ -3646,7 +3687,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3646
3687
  * @param userAddress - Owner EOA (not the Safe)
3647
3688
  * @param chainId - Chain for the transfer
3648
3689
  * @param amount - Amount in least units (string integer)
3649
- * @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `NVDAc`)
3690
+ * @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `USDT`, `PYUSD`, `NVDAc`, `WBTC`)
3650
3691
  * @param strategy - Optional first-deposit {@link Strategy}
3651
3692
  * @returns Transfer receipt and deposit registration
3652
3693
  *
@@ -3677,7 +3718,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3677
3718
  }
3678
3719
  if (!asset) {
3679
3720
  throw new Error(
3680
- "Asset is required (USDC, WETH, EURC, USDT, PYUSD, or NVDAc)"
3721
+ "Asset is required (USDC, WETH, EURC, USDT, PYUSD, NVDAc, or WBTC)"
3681
3722
  );
3682
3723
  }
3683
3724
  if (strategy !== void 0 && !isValidPublicStrategy(strategy)) {
@@ -5611,11 +5652,14 @@ var _ZyfaiSDK = class _ZyfaiSDK {
5611
5652
  *
5612
5653
  * @remarks Data API. Partner API key only.
5613
5654
  *
5614
- * @returns Total volume in USD
5655
+ * @param assetType - `"usdc"` (default), `"eth"`, `"eurc"`, or `"usdt"`
5656
+ * @returns Cumulative deposit volume, summed in the asset's own units
5657
+ * (dollars for `usdc` and `usdt`)
5615
5658
  *
5616
5659
  * @example
5617
5660
  * ```typescript
5618
5661
  * const volume = await sdk.getVolume();
5662
+ * const usdtVolume = await sdk.getVolume("usdt");
5619
5663
  * console.log("Total Volume:", volume.volumeInUSD);
5620
5664
  * ```
5621
5665
  */
@@ -5976,6 +6020,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
5976
6020
  /**
5977
6021
  * Get conservative (low-risk) yield opportunities.
5978
6022
  *
6023
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
6024
+ *
5979
6025
  * @group Analytics and opportunities
5980
6026
  *
5981
6027
  * @remarks Data API. Partner API key only.
@@ -6023,6 +6069,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
6023
6069
  /**
6024
6070
  * Get balanced (high-risk, high-reward) yield opportunities.
6025
6071
  *
6072
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
6073
+ *
6026
6074
  * @param chainId - Optional chain ID filter
6027
6075
  * @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
6028
6076
  * @returns List of balanced opportunities
@@ -6083,6 +6131,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
6083
6131
  * on Ipor and three on Superform; track the redemption through
6084
6132
  * `getPortfolio().portfolio.pendingAsyncWithdrawals`.
6085
6133
  *
6134
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
6135
+ *
6086
6136
  * @param chainId - Optional chain ID filter
6087
6137
  * @param asset - Optional asset filter (e.g. "USDC", "WETH")
6088
6138
  * @returns List of advanced opportunities
package/dist/index.mjs CHANGED
@@ -130,27 +130,28 @@ var DATA_ENDPOINTS = {
130
130
  if (endDate) url += `&endDate=${endDate}`;
131
131
  return url;
132
132
  },
133
- // Opportunities
133
+ // Opportunities. Omitted status means live pools. Pass not_live to
134
+ // read retired rows. The data API returns both when status is absent.
134
135
  OPPORTUNITIES_SAFE: (chainId, asset, status) => {
135
136
  const params = [];
136
137
  if (chainId !== void 0) params.push(`chainId=${chainId}`);
137
138
  if (asset) params.push(`asset=${asset}`);
138
- if (status) params.push(`status=${status}`);
139
- return params.length > 0 ? `/opportunities/safe?${params.join("&")}` : "/opportunities/safe";
139
+ params.push(`status=${status ?? "live"}`);
140
+ return `/opportunities/safe?${params.join("&")}`;
140
141
  },
141
142
  OPPORTUNITIES_DEGEN: (chainId, asset, status) => {
142
143
  const params = [];
143
144
  if (chainId !== void 0) params.push(`chainId=${chainId}`);
144
145
  if (asset) params.push(`asset=${asset}`);
145
- if (status) params.push(`status=${status}`);
146
- return params.length > 0 ? `/opportunities/degen-strategies?${params.join("&")}` : "/opportunities/degen-strategies";
146
+ params.push(`status=${status ?? "live"}`);
147
+ return `/opportunities/degen-strategies?${params.join("&")}`;
147
148
  },
148
149
  OPPORTUNITIES_ASYNC: (chainId, asset, status) => {
149
150
  const params = [];
150
151
  if (chainId !== void 0) params.push(`chainId=${chainId}`);
151
152
  if (asset) params.push(`asset=${asset}`);
152
- if (status) params.push(`status=${status}`);
153
- return params.length > 0 ? `/opportunities/async?${params.join("&")}` : "/opportunities/async";
153
+ params.push(`status=${status ?? "live"}`);
154
+ return `/opportunities/async?${params.join("&")}`;
154
155
  },
155
156
  // APY History
156
157
  DAILY_APY_HISTORY_WEIGHTED: (walletAddress, days) => `/daily-apy-history/weighted-multi-asset/${walletAddress}${days ? `?days=${days}` : ""}`,
@@ -726,9 +727,9 @@ var MIN_PORTFOLIO_BALANCE = {
726
727
  }
727
728
  };
728
729
  var MIN_PORTFOLIO_USD = {
729
- 1: { WETH: 10000n },
730
+ 1: { WETH: 10000n, WBTC: 10000n },
730
731
  8453: { WETH: 10n, NVDAc: 10n },
731
- 42161: { WETH: 10n }
732
+ 42161: { WETH: 10n, WBTC: 10n }
732
733
  };
733
734
  var DEPOSIT_CREDIT_INTERVAL_MS = {
734
735
  1: 2e3,
@@ -979,6 +980,28 @@ var ASSET_CONFIGS = {
979
980
  // Base
980
981
  },
981
982
  enabled: true
983
+ },
984
+ // Wrapped Bitcoin. 8 decimals; volatile, so its minimum is quoted in USD.
985
+ // cbBTC on Base is a separate asset and is not aliased here.
986
+ WBTC: {
987
+ symbol: "WBTC",
988
+ assetType: "wbtc",
989
+ displayName: "WBTC",
990
+ icon: "https://etherscan.io/token/images/wbtc_28.png",
991
+ decimals: 8,
992
+ priceTokenSymbol: "wbtc",
993
+ tokenSymbols: ["WBTC"],
994
+ tokenSymbolsByChainId: {
995
+ 1: "WBTC",
996
+ 42161: "WBTC"
997
+ },
998
+ addresses: {
999
+ 1: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
1000
+ // Ethereum
1001
+ 42161: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"
1002
+ // Arbitrum
1003
+ },
1004
+ enabled: true
982
1005
  }
983
1006
  };
984
1007
  var resolveAssetSymbol = (asset) => {
@@ -1292,7 +1315,8 @@ var MANAGED_ASSET_ORDER = [
1292
1315
  "EURC",
1293
1316
  "USDT",
1294
1317
  "PYUSD",
1295
- "NVDAc"
1318
+ "NVDAc",
1319
+ "WBTC"
1296
1320
  ];
1297
1321
  function getManagedAssets() {
1298
1322
  const enabled = Object.entries(ASSET_CONFIGS).filter(([, config]) => config?.enabled === true).map(([key]) => key);
@@ -1592,6 +1616,10 @@ function toPublicStrategyOrUndefined(internalStrategy) {
1592
1616
  function isValidPublicStrategy(strategy) {
1593
1617
  return strategy === "conservative" || strategy === "aggressive" || strategy === "yieldmaxxing";
1594
1618
  }
1619
+ function shouldDefaultAutoSelectNewVaults(input) {
1620
+ if (input.requestedStrategy !== void 0) return true;
1621
+ return !input.hasChains && !input.hasProtocols;
1622
+ }
1595
1623
  function convertStrategyToPublic(obj) {
1596
1624
  if (!obj.strategy) {
1597
1625
  const result = { ...obj };
@@ -1631,7 +1659,7 @@ function removeUnusedFields(obj) {
1631
1659
  }
1632
1660
  function convertAssetInternally(asset) {
1633
1661
  const assetType = ASSET_CONFIGS[asset]?.assetType;
1634
- if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac") {
1662
+ if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac" || assetType === "wbtc") {
1635
1663
  return assetType;
1636
1664
  }
1637
1665
  throw new Error(
@@ -3301,20 +3329,26 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3301
3329
  internalStrategy
3302
3330
  );
3303
3331
  const mandateChainId = chains.find((c) => !existingChains.includes(c)) ?? chains[0];
3332
+ const autoSelectNewVaults = shouldDefaultAutoSelectNewVaults({
3333
+ requestedStrategy: strategy,
3334
+ hasChains: existingChains.length > 0,
3335
+ hasProtocols: (userDetails.protocols?.length ?? 0) > 0
3336
+ });
3304
3337
  return await this.persistDiscoveredAssetProfile(
3305
3338
  asset,
3306
3339
  effectiveChains,
3307
3340
  withPools,
3308
3341
  strategy,
3309
3342
  mandateChainId,
3310
- existingChains
3343
+ existingChains,
3344
+ autoSelectNewVaults
3311
3345
  );
3312
3346
  }
3313
3347
  /**
3314
3348
  * Persist protocol discovery for one asset (user PATCH or agent deposit-setup).
3315
3349
  * @internal
3316
3350
  */
3317
- async persistDiscoveredAssetProfile(asset, effectiveChains, withPools, strategy, agentDepositChainId, existingChains = []) {
3351
+ async persistDiscoveredAssetProfile(asset, effectiveChains, withPools, strategy, agentDepositChainId, existingChains = [], autoSelectNewVaults = false) {
3318
3352
  const internalAsset = convertAssetInternally(asset);
3319
3353
  const assetSettings = {
3320
3354
  chains: effectiveChains,
@@ -3323,11 +3357,15 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3323
3357
  if (strategy !== void 0) {
3324
3358
  assetSettings.rebalanceStrategy = toInternalStrategy(strategy);
3325
3359
  }
3360
+ if (autoSelectNewVaults) {
3361
+ assetSettings.autoSelectProtocols = true;
3362
+ }
3326
3363
  const configureProfile = () => this.updateUserProfile({
3327
3364
  asset,
3328
3365
  protocols: withPools,
3329
3366
  chains: effectiveChains,
3330
- ...strategy !== void 0 && { strategy }
3367
+ ...strategy !== void 0 && { strategy },
3368
+ ...autoSelectNewVaults && { autoSelectProtocols: true }
3331
3369
  });
3332
3370
  if (this.sessionChannel === "agent") {
3333
3371
  const chainId = agentDepositChainId ?? effectiveChains[effectiveChains.length - 1] ?? effectiveChains[0];
@@ -3371,7 +3409,9 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3371
3409
  * @param params.asset - Asset to configure
3372
3410
  * @param params.strategy - Strategy to apply; defaults to the one already
3373
3411
  * stored for this asset (`"conservative"` on a fresh account), which lets
3374
- * you recompute a protocol list without changing the strategy
3412
+ * you recompute a protocol list without changing the strategy. Passing a
3413
+ * strategy also opts the asset into vaults added later. Omitting it does
3414
+ * not change that opt-in.
3375
3415
  * @param params.chains - Chains to enable. Defaults to every chain the asset
3376
3416
  * exists on. **Additive**: chains already enabled are kept, so this cannot
3377
3417
  * be used to disable one.
@@ -3430,7 +3470,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3430
3470
  * Apply a strategy and auto-select matching protocols for one or all managed
3431
3471
  * assets ({@link getManagedAssets}). Prefer this over
3432
3472
  * {@link updateUserProfile} when changing strategy so protocols stay aligned
3433
- * with the tier (including `yieldmaxxing` async venues).
3473
+ * with the tier (including `yieldmaxxing` async venues). The chosen strategy
3474
+ * also opts those assets into vaults added later.
3434
3475
  *
3435
3476
  * @group Portfolio and execution
3436
3477
  */
@@ -3604,7 +3645,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3604
3645
  * @param userAddress - Owner EOA (not the Safe)
3605
3646
  * @param chainId - Chain for the transfer
3606
3647
  * @param amount - Amount in least units (string integer)
3607
- * @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `NVDAc`)
3648
+ * @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `USDT`, `PYUSD`, `NVDAc`, `WBTC`)
3608
3649
  * @param strategy - Optional first-deposit {@link Strategy}
3609
3650
  * @returns Transfer receipt and deposit registration
3610
3651
  *
@@ -3635,7 +3676,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3635
3676
  }
3636
3677
  if (!asset) {
3637
3678
  throw new Error(
3638
- "Asset is required (USDC, WETH, EURC, USDT, PYUSD, or NVDAc)"
3679
+ "Asset is required (USDC, WETH, EURC, USDT, PYUSD, NVDAc, or WBTC)"
3639
3680
  );
3640
3681
  }
3641
3682
  if (strategy !== void 0 && !isValidPublicStrategy(strategy)) {
@@ -5569,11 +5610,14 @@ var _ZyfaiSDK = class _ZyfaiSDK {
5569
5610
  *
5570
5611
  * @remarks Data API. Partner API key only.
5571
5612
  *
5572
- * @returns Total volume in USD
5613
+ * @param assetType - `"usdc"` (default), `"eth"`, `"eurc"`, or `"usdt"`
5614
+ * @returns Cumulative deposit volume, summed in the asset's own units
5615
+ * (dollars for `usdc` and `usdt`)
5573
5616
  *
5574
5617
  * @example
5575
5618
  * ```typescript
5576
5619
  * const volume = await sdk.getVolume();
5620
+ * const usdtVolume = await sdk.getVolume("usdt");
5577
5621
  * console.log("Total Volume:", volume.volumeInUSD);
5578
5622
  * ```
5579
5623
  */
@@ -5934,6 +5978,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
5934
5978
  /**
5935
5979
  * Get conservative (low-risk) yield opportunities.
5936
5980
  *
5981
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
5982
+ *
5937
5983
  * @group Analytics and opportunities
5938
5984
  *
5939
5985
  * @remarks Data API. Partner API key only.
@@ -5981,6 +6027,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
5981
6027
  /**
5982
6028
  * Get balanced (high-risk, high-reward) yield opportunities.
5983
6029
  *
6030
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
6031
+ *
5984
6032
  * @param chainId - Optional chain ID filter
5985
6033
  * @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
5986
6034
  * @returns List of balanced opportunities
@@ -6041,6 +6089,8 @@ var _ZyfaiSDK = class _ZyfaiSDK {
6041
6089
  * on Ipor and three on Superform; track the redemption through
6042
6090
  * `getPortfolio().portfolio.pendingAsyncWithdrawals`.
6043
6091
  *
6092
+ * Omitting `status` requests live pools only. Pass `"not_live"` for retired pools.
6093
+ *
6044
6094
  * @param chainId - Optional chain ID filter
6045
6095
  * @param asset - Optional asset filter (e.g. "USDC", "WETH")
6046
6096
  * @returns List of advanced opportunities
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyfai/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "TypeScript SDK for self-custodial Zyfai yield agents: discover DeFi opportunities and manage deposits, withdrawals, positions, and strategies across Ethereum, Base, and Arbitrum",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",