@zyfai/sdk 1.2.0 → 1.3.2
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 +13 -7
- package/dist/index.d.mts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +52 -12
- package/dist/index.mjs +52 -12
- package/package.json +1 -1
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 `"
|
|
484
|
-
- The total Safe balance must meet the per-asset minimum after the deposit (see above). WETH
|
|
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
|
|
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
|
|
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);
|
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 */
|
|
@@ -1759,7 +1769,7 @@ declare class ZyfaiSDK {
|
|
|
1759
1769
|
* @param userAddress - Owner EOA (not the Safe)
|
|
1760
1770
|
* @param chainId - Chain for the transfer
|
|
1761
1771
|
* @param amount - Amount in least units (string integer)
|
|
1762
|
-
* @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `NVDAc`)
|
|
1772
|
+
* @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `USDT`, `PYUSD`, `NVDAc`, `WBTC`)
|
|
1763
1773
|
* @param strategy - Optional first-deposit {@link Strategy}
|
|
1764
1774
|
* @returns Transfer receipt and deposit registration
|
|
1765
1775
|
*
|
|
@@ -2460,15 +2470,18 @@ declare class ZyfaiSDK {
|
|
|
2460
2470
|
*
|
|
2461
2471
|
* @remarks Data API. Partner API key only.
|
|
2462
2472
|
*
|
|
2463
|
-
* @
|
|
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`)
|
|
2464
2476
|
*
|
|
2465
2477
|
* @example
|
|
2466
2478
|
* ```typescript
|
|
2467
2479
|
* const volume = await sdk.getVolume();
|
|
2480
|
+
* const usdtVolume = await sdk.getVolume("usdt");
|
|
2468
2481
|
* console.log("Total Volume:", volume.volumeInUSD);
|
|
2469
2482
|
* ```
|
|
2470
2483
|
*/
|
|
2471
|
-
getVolume(assetType?:
|
|
2484
|
+
getVolume(assetType?: VolumeAssetType): Promise<VolumeResponse>;
|
|
2472
2485
|
/**
|
|
2473
2486
|
* Get active wallets for a specific chain.
|
|
2474
2487
|
*
|
|
@@ -2547,7 +2560,7 @@ declare class ZyfaiSDK {
|
|
|
2547
2560
|
offset?: number;
|
|
2548
2561
|
fromDate?: string;
|
|
2549
2562
|
toDate?: string;
|
|
2550
|
-
assetType?:
|
|
2563
|
+
assetType?: HistoryAssetType;
|
|
2551
2564
|
}): Promise<HistoryResponse>;
|
|
2552
2565
|
/**
|
|
2553
2566
|
* Get onchain earnings for a wallet.
|
|
@@ -3341,4 +3354,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
|
|
|
3341
3354
|
*/
|
|
3342
3355
|
declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
|
|
3343
3356
|
|
|
3344
|
-
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 */
|
|
@@ -1759,7 +1769,7 @@ declare class ZyfaiSDK {
|
|
|
1759
1769
|
* @param userAddress - Owner EOA (not the Safe)
|
|
1760
1770
|
* @param chainId - Chain for the transfer
|
|
1761
1771
|
* @param amount - Amount in least units (string integer)
|
|
1762
|
-
* @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `NVDAc`)
|
|
1772
|
+
* @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `USDT`, `PYUSD`, `NVDAc`, `WBTC`)
|
|
1763
1773
|
* @param strategy - Optional first-deposit {@link Strategy}
|
|
1764
1774
|
* @returns Transfer receipt and deposit registration
|
|
1765
1775
|
*
|
|
@@ -2460,15 +2470,18 @@ declare class ZyfaiSDK {
|
|
|
2460
2470
|
*
|
|
2461
2471
|
* @remarks Data API. Partner API key only.
|
|
2462
2472
|
*
|
|
2463
|
-
* @
|
|
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`)
|
|
2464
2476
|
*
|
|
2465
2477
|
* @example
|
|
2466
2478
|
* ```typescript
|
|
2467
2479
|
* const volume = await sdk.getVolume();
|
|
2480
|
+
* const usdtVolume = await sdk.getVolume("usdt");
|
|
2468
2481
|
* console.log("Total Volume:", volume.volumeInUSD);
|
|
2469
2482
|
* ```
|
|
2470
2483
|
*/
|
|
2471
|
-
getVolume(assetType?:
|
|
2484
|
+
getVolume(assetType?: VolumeAssetType): Promise<VolumeResponse>;
|
|
2472
2485
|
/**
|
|
2473
2486
|
* Get active wallets for a specific chain.
|
|
2474
2487
|
*
|
|
@@ -2547,7 +2560,7 @@ declare class ZyfaiSDK {
|
|
|
2547
2560
|
offset?: number;
|
|
2548
2561
|
fromDate?: string;
|
|
2549
2562
|
toDate?: string;
|
|
2550
|
-
assetType?:
|
|
2563
|
+
assetType?: HistoryAssetType;
|
|
2551
2564
|
}): Promise<HistoryResponse>;
|
|
2552
2565
|
/**
|
|
2553
2566
|
* Get onchain earnings for a wallet.
|
|
@@ -3341,4 +3354,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
|
|
|
3341
3354
|
*/
|
|
3342
3355
|
declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
|
|
3343
3356
|
|
|
3344
|
-
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
|
@@ -796,9 +796,9 @@ var MIN_PORTFOLIO_BALANCE = {
|
|
|
796
796
|
}
|
|
797
797
|
};
|
|
798
798
|
var MIN_PORTFOLIO_USD = {
|
|
799
|
-
1: { WETH: 10000n },
|
|
799
|
+
1: { WETH: 10000n, WBTC: 10000n },
|
|
800
800
|
8453: { WETH: 10n, NVDAc: 10n },
|
|
801
|
-
42161: { WETH: 10n }
|
|
801
|
+
42161: { WETH: 10n, WBTC: 10n }
|
|
802
802
|
};
|
|
803
803
|
var DEPOSIT_CREDIT_INTERVAL_MS = {
|
|
804
804
|
1: 2e3,
|
|
@@ -1001,10 +1001,12 @@ var ASSET_CONFIGS = {
|
|
|
1001
1001
|
decimals: 6,
|
|
1002
1002
|
tokenSymbols: ["USDT"],
|
|
1003
1003
|
tokenSymbolsByChainId: {
|
|
1004
|
-
1: "USDT"
|
|
1004
|
+
1: "USDT",
|
|
1005
|
+
42161: "USDT"
|
|
1005
1006
|
},
|
|
1006
1007
|
addresses: {
|
|
1007
|
-
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
|
|
1008
|
+
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
1009
|
+
42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
|
|
1008
1010
|
},
|
|
1009
1011
|
enabled: true
|
|
1010
1012
|
},
|
|
@@ -1041,6 +1043,28 @@ var ASSET_CONFIGS = {
|
|
|
1041
1043
|
// Base
|
|
1042
1044
|
},
|
|
1043
1045
|
enabled: true
|
|
1046
|
+
},
|
|
1047
|
+
// Wrapped Bitcoin. 8 decimals; volatile, so its minimum is quoted in USD.
|
|
1048
|
+
// cbBTC on Base is a separate asset and is not aliased here.
|
|
1049
|
+
WBTC: {
|
|
1050
|
+
symbol: "WBTC",
|
|
1051
|
+
assetType: "wbtc",
|
|
1052
|
+
displayName: "WBTC",
|
|
1053
|
+
icon: "https://etherscan.io/token/images/wbtc_28.png",
|
|
1054
|
+
decimals: 8,
|
|
1055
|
+
priceTokenSymbol: "wbtc",
|
|
1056
|
+
tokenSymbols: ["WBTC"],
|
|
1057
|
+
tokenSymbolsByChainId: {
|
|
1058
|
+
1: "WBTC",
|
|
1059
|
+
42161: "WBTC"
|
|
1060
|
+
},
|
|
1061
|
+
addresses: {
|
|
1062
|
+
1: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
|
|
1063
|
+
// Ethereum
|
|
1064
|
+
42161: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"
|
|
1065
|
+
// Arbitrum
|
|
1066
|
+
},
|
|
1067
|
+
enabled: true
|
|
1044
1068
|
}
|
|
1045
1069
|
};
|
|
1046
1070
|
var resolveAssetSymbol = (asset) => {
|
|
@@ -1349,7 +1373,8 @@ var MANAGED_ASSET_ORDER = [
|
|
|
1349
1373
|
"EURC",
|
|
1350
1374
|
"USDT",
|
|
1351
1375
|
"PYUSD",
|
|
1352
|
-
"NVDAc"
|
|
1376
|
+
"NVDAc",
|
|
1377
|
+
"WBTC"
|
|
1353
1378
|
];
|
|
1354
1379
|
function getManagedAssets() {
|
|
1355
1380
|
const enabled = Object.entries(ASSET_CONFIGS).filter(([, config]) => config?.enabled === true).map(([key]) => key);
|
|
@@ -1608,6 +1633,20 @@ function toInternalStrategy(publicStrategy) {
|
|
|
1608
1633
|
);
|
|
1609
1634
|
}
|
|
1610
1635
|
}
|
|
1636
|
+
function toDataStrategy(publicStrategy) {
|
|
1637
|
+
switch (publicStrategy) {
|
|
1638
|
+
case "conservative":
|
|
1639
|
+
return "safe";
|
|
1640
|
+
case "aggressive":
|
|
1641
|
+
return "degen";
|
|
1642
|
+
case "yieldmaxxing":
|
|
1643
|
+
return "async";
|
|
1644
|
+
default:
|
|
1645
|
+
throw new Error(
|
|
1646
|
+
`Invalid public strategy: ${publicStrategy}. Must be ${PUBLIC_STRATEGIES}.`
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1611
1650
|
function toPublicStrategy(internalStrategy) {
|
|
1612
1651
|
if (internalStrategy === "safe_strategy" || internalStrategy === "safe") {
|
|
1613
1652
|
return "conservative";
|
|
@@ -1678,7 +1717,7 @@ function removeUnusedFields(obj) {
|
|
|
1678
1717
|
}
|
|
1679
1718
|
function convertAssetInternally(asset) {
|
|
1680
1719
|
const assetType = ASSET_CONFIGS[asset]?.assetType;
|
|
1681
|
-
if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac") {
|
|
1720
|
+
if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac" || assetType === "wbtc") {
|
|
1682
1721
|
return assetType;
|
|
1683
1722
|
}
|
|
1684
1723
|
throw new Error(
|
|
@@ -3664,7 +3703,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3664
3703
|
* @param userAddress - Owner EOA (not the Safe)
|
|
3665
3704
|
* @param chainId - Chain for the transfer
|
|
3666
3705
|
* @param amount - Amount in least units (string integer)
|
|
3667
|
-
* @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `NVDAc`)
|
|
3706
|
+
* @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `USDT`, `PYUSD`, `NVDAc`, `WBTC`)
|
|
3668
3707
|
* @param strategy - Optional first-deposit {@link Strategy}
|
|
3669
3708
|
* @returns Transfer receipt and deposit registration
|
|
3670
3709
|
*
|
|
@@ -3695,7 +3734,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3695
3734
|
}
|
|
3696
3735
|
if (!asset) {
|
|
3697
3736
|
throw new Error(
|
|
3698
|
-
"Asset is required (USDC, WETH, EURC, USDT, PYUSD, or
|
|
3737
|
+
"Asset is required (USDC, WETH, EURC, USDT, PYUSD, NVDAc, or WBTC)"
|
|
3699
3738
|
);
|
|
3700
3739
|
}
|
|
3701
3740
|
if (strategy !== void 0 && !isValidPublicStrategy(strategy)) {
|
|
@@ -5597,13 +5636,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5597
5636
|
*/
|
|
5598
5637
|
async getAPYPerStrategy(crossChain = false, days = 7, strategy = "conservative", chainId, tokenSymbol) {
|
|
5599
5638
|
try {
|
|
5600
|
-
const internalStrategy = toInternalStrategy(strategy);
|
|
5601
|
-
const internalStrategyShort = internalStrategy === "safe_strategy" ? "safe" : "degen";
|
|
5602
5639
|
const response = await this.httpClient.dataGet(
|
|
5603
5640
|
DATA_ENDPOINTS.APY_PER_STRATEGY({
|
|
5604
5641
|
isCrossChain: crossChain,
|
|
5605
5642
|
days,
|
|
5606
|
-
strategy:
|
|
5643
|
+
strategy: toDataStrategy(strategy),
|
|
5607
5644
|
chainId,
|
|
5608
5645
|
tokenSymbol
|
|
5609
5646
|
})
|
|
@@ -5629,11 +5666,14 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5629
5666
|
*
|
|
5630
5667
|
* @remarks Data API. Partner API key only.
|
|
5631
5668
|
*
|
|
5632
|
-
* @
|
|
5669
|
+
* @param assetType - `"usdc"` (default), `"eth"`, `"eurc"`, or `"usdt"`
|
|
5670
|
+
* @returns Cumulative deposit volume, summed in the asset's own units
|
|
5671
|
+
* (dollars for `usdc` and `usdt`)
|
|
5633
5672
|
*
|
|
5634
5673
|
* @example
|
|
5635
5674
|
* ```typescript
|
|
5636
5675
|
* const volume = await sdk.getVolume();
|
|
5676
|
+
* const usdtVolume = await sdk.getVolume("usdt");
|
|
5637
5677
|
* console.log("Total Volume:", volume.volumeInUSD);
|
|
5638
5678
|
* ```
|
|
5639
5679
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -727,9 +727,9 @@ var MIN_PORTFOLIO_BALANCE = {
|
|
|
727
727
|
}
|
|
728
728
|
};
|
|
729
729
|
var MIN_PORTFOLIO_USD = {
|
|
730
|
-
1: { WETH: 10000n },
|
|
730
|
+
1: { WETH: 10000n, WBTC: 10000n },
|
|
731
731
|
8453: { WETH: 10n, NVDAc: 10n },
|
|
732
|
-
42161: { WETH: 10n }
|
|
732
|
+
42161: { WETH: 10n, WBTC: 10n }
|
|
733
733
|
};
|
|
734
734
|
var DEPOSIT_CREDIT_INTERVAL_MS = {
|
|
735
735
|
1: 2e3,
|
|
@@ -940,10 +940,12 @@ var ASSET_CONFIGS = {
|
|
|
940
940
|
decimals: 6,
|
|
941
941
|
tokenSymbols: ["USDT"],
|
|
942
942
|
tokenSymbolsByChainId: {
|
|
943
|
-
1: "USDT"
|
|
943
|
+
1: "USDT",
|
|
944
|
+
42161: "USDT"
|
|
944
945
|
},
|
|
945
946
|
addresses: {
|
|
946
|
-
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
|
|
947
|
+
1: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
948
|
+
42161: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
|
|
947
949
|
},
|
|
948
950
|
enabled: true
|
|
949
951
|
},
|
|
@@ -980,6 +982,28 @@ var ASSET_CONFIGS = {
|
|
|
980
982
|
// Base
|
|
981
983
|
},
|
|
982
984
|
enabled: true
|
|
985
|
+
},
|
|
986
|
+
// Wrapped Bitcoin. 8 decimals; volatile, so its minimum is quoted in USD.
|
|
987
|
+
// cbBTC on Base is a separate asset and is not aliased here.
|
|
988
|
+
WBTC: {
|
|
989
|
+
symbol: "WBTC",
|
|
990
|
+
assetType: "wbtc",
|
|
991
|
+
displayName: "WBTC",
|
|
992
|
+
icon: "https://etherscan.io/token/images/wbtc_28.png",
|
|
993
|
+
decimals: 8,
|
|
994
|
+
priceTokenSymbol: "wbtc",
|
|
995
|
+
tokenSymbols: ["WBTC"],
|
|
996
|
+
tokenSymbolsByChainId: {
|
|
997
|
+
1: "WBTC",
|
|
998
|
+
42161: "WBTC"
|
|
999
|
+
},
|
|
1000
|
+
addresses: {
|
|
1001
|
+
1: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
|
|
1002
|
+
// Ethereum
|
|
1003
|
+
42161: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"
|
|
1004
|
+
// Arbitrum
|
|
1005
|
+
},
|
|
1006
|
+
enabled: true
|
|
983
1007
|
}
|
|
984
1008
|
};
|
|
985
1009
|
var resolveAssetSymbol = (asset) => {
|
|
@@ -1293,7 +1317,8 @@ var MANAGED_ASSET_ORDER = [
|
|
|
1293
1317
|
"EURC",
|
|
1294
1318
|
"USDT",
|
|
1295
1319
|
"PYUSD",
|
|
1296
|
-
"NVDAc"
|
|
1320
|
+
"NVDAc",
|
|
1321
|
+
"WBTC"
|
|
1297
1322
|
];
|
|
1298
1323
|
function getManagedAssets() {
|
|
1299
1324
|
const enabled = Object.entries(ASSET_CONFIGS).filter(([, config]) => config?.enabled === true).map(([key]) => key);
|
|
@@ -1566,6 +1591,20 @@ function toInternalStrategy(publicStrategy) {
|
|
|
1566
1591
|
);
|
|
1567
1592
|
}
|
|
1568
1593
|
}
|
|
1594
|
+
function toDataStrategy(publicStrategy) {
|
|
1595
|
+
switch (publicStrategy) {
|
|
1596
|
+
case "conservative":
|
|
1597
|
+
return "safe";
|
|
1598
|
+
case "aggressive":
|
|
1599
|
+
return "degen";
|
|
1600
|
+
case "yieldmaxxing":
|
|
1601
|
+
return "async";
|
|
1602
|
+
default:
|
|
1603
|
+
throw new Error(
|
|
1604
|
+
`Invalid public strategy: ${publicStrategy}. Must be ${PUBLIC_STRATEGIES}.`
|
|
1605
|
+
);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1569
1608
|
function toPublicStrategy(internalStrategy) {
|
|
1570
1609
|
if (internalStrategy === "safe_strategy" || internalStrategy === "safe") {
|
|
1571
1610
|
return "conservative";
|
|
@@ -1636,7 +1675,7 @@ function removeUnusedFields(obj) {
|
|
|
1636
1675
|
}
|
|
1637
1676
|
function convertAssetInternally(asset) {
|
|
1638
1677
|
const assetType = ASSET_CONFIGS[asset]?.assetType;
|
|
1639
|
-
if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac") {
|
|
1678
|
+
if (assetType === "usdc" || assetType === "eth" || assetType === "eurc" || assetType === "usdt" || assetType === "pyusd" || assetType === "nvdac" || assetType === "wbtc") {
|
|
1640
1679
|
return assetType;
|
|
1641
1680
|
}
|
|
1642
1681
|
throw new Error(
|
|
@@ -3622,7 +3661,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3622
3661
|
* @param userAddress - Owner EOA (not the Safe)
|
|
3623
3662
|
* @param chainId - Chain for the transfer
|
|
3624
3663
|
* @param amount - Amount in least units (string integer)
|
|
3625
|
-
* @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `NVDAc`)
|
|
3664
|
+
* @param asset - Collateral symbol (`USDC`, `WETH`, `EURC`, `USDT`, `PYUSD`, `NVDAc`, `WBTC`)
|
|
3626
3665
|
* @param strategy - Optional first-deposit {@link Strategy}
|
|
3627
3666
|
* @returns Transfer receipt and deposit registration
|
|
3628
3667
|
*
|
|
@@ -3653,7 +3692,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
3653
3692
|
}
|
|
3654
3693
|
if (!asset) {
|
|
3655
3694
|
throw new Error(
|
|
3656
|
-
"Asset is required (USDC, WETH, EURC, USDT, PYUSD, or
|
|
3695
|
+
"Asset is required (USDC, WETH, EURC, USDT, PYUSD, NVDAc, or WBTC)"
|
|
3657
3696
|
);
|
|
3658
3697
|
}
|
|
3659
3698
|
if (strategy !== void 0 && !isValidPublicStrategy(strategy)) {
|
|
@@ -5555,13 +5594,11 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5555
5594
|
*/
|
|
5556
5595
|
async getAPYPerStrategy(crossChain = false, days = 7, strategy = "conservative", chainId, tokenSymbol) {
|
|
5557
5596
|
try {
|
|
5558
|
-
const internalStrategy = toInternalStrategy(strategy);
|
|
5559
|
-
const internalStrategyShort = internalStrategy === "safe_strategy" ? "safe" : "degen";
|
|
5560
5597
|
const response = await this.httpClient.dataGet(
|
|
5561
5598
|
DATA_ENDPOINTS.APY_PER_STRATEGY({
|
|
5562
5599
|
isCrossChain: crossChain,
|
|
5563
5600
|
days,
|
|
5564
|
-
strategy:
|
|
5601
|
+
strategy: toDataStrategy(strategy),
|
|
5565
5602
|
chainId,
|
|
5566
5603
|
tokenSymbol
|
|
5567
5604
|
})
|
|
@@ -5587,11 +5624,14 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5587
5624
|
*
|
|
5588
5625
|
* @remarks Data API. Partner API key only.
|
|
5589
5626
|
*
|
|
5590
|
-
* @
|
|
5627
|
+
* @param assetType - `"usdc"` (default), `"eth"`, `"eurc"`, or `"usdt"`
|
|
5628
|
+
* @returns Cumulative deposit volume, summed in the asset's own units
|
|
5629
|
+
* (dollars for `usdc` and `usdt`)
|
|
5591
5630
|
*
|
|
5592
5631
|
* @example
|
|
5593
5632
|
* ```typescript
|
|
5594
5633
|
* const volume = await sdk.getVolume();
|
|
5634
|
+
* const usdtVolume = await sdk.getVolume("usdt");
|
|
5595
5635
|
* console.log("Total Volume:", volume.volumeInUSD);
|
|
5596
5636
|
* ```
|
|
5597
5637
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyfai/sdk",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
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",
|