@zyfai/sdk 0.2.43 → 0.2.45

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
@@ -295,6 +295,8 @@ Get the Smart Wallet (Safe) address for a user.
295
295
 
296
296
  ##### `deploySafe(userAddress: string, chainId: SupportedChainId, strategy?: Strategy): Promise<DeploySafeResponse>`
297
297
 
298
+ > **Deprecated** for partner integrations. Prefer `depositFunds()` — predeployed Safes and session keys are handled on first deposit. This method remains available for legacy flows and emits a console warning when called.
299
+
298
300
  Deploy a Safe smart wallet for a user. **Deployment is handled by the backend API**, which manages all RPC calls and bundler interactions. This avoids rate limiting issues.
299
301
 
300
302
  **Parameters:**
@@ -320,12 +322,7 @@ Deploy a Safe smart wallet for a user. **Deployment is handled by the backend AP
320
322
 
321
323
  - User must be authenticated (automatically done via `connectAccount()`)
322
324
  - Backend handles all RPC calls, avoiding rate limiting
323
- - After deployment, the SDK automatically patches the user's protocol selection for the target `chainId` and `strategy` on **both USDC and WETH**:
324
- - Fetches protocols compatible with the strategy (`aggressive` includes both `safe` and `degen` protocols)
325
- - Drops any protocol that has no pool available for the asset/chain (via `/customization/pools`)
326
- - **Merges** the new `chainId` with the user's existing chains (never overwrites — safe to call again on a new chain)
327
- - Persists via `updateUserProfile` into `assetTypeSettings.[usdc|eth]`
328
- - No need to call `updateUserProfile` manually after `deploySafe` — the SDK handles it
325
+ - Protocol / asset patching is **not** done in `deploySafe` — it runs once on the account's **first** `depositFunds` call (see Deposit Funds below)
329
326
 
330
327
  ##### `addWalletToSdk(walletAddress: string): Promise<AddWalletToSdkResponse>`
331
328
 
@@ -350,7 +347,9 @@ Add a wallet address to the SDK API key's allowedWallets list. This endpoint req
350
347
 
351
348
  Session keys enable delegated transaction execution without exposing the main private key.
352
349
 
353
- #### Simple Usage (Recommended)
350
+ #### Simple Usage (Legacy — deprecated)
351
+
352
+ > **Deprecated** for partner integrations. Prefer `depositFunds()` — predeployed wallets already have the agent session enabled. This method remains available for legacy flows and emits a console warning when called.
354
353
 
355
354
  The SDK automatically fetches optimal session configuration from Zyfai API:
356
355
 
@@ -380,8 +379,9 @@ console.log("User ID:", result.userId);
380
379
 
381
380
  - User must be authenticated (automatically done via `connectAccount()`)
382
381
  - The SDK proactively checks if the user already has an active session key and returns early without requiring any signature if one exists
383
- - The user record must have `smartWallet` and `chainId` set (automatically handled after calling `deploySafe`)
384
- - Protocol selection is **not** touched by `createSessionKey` — it's set by `deploySafe`
382
+ - The user record must have `smartWallet` and `chainId` set (predeployed assignment / first deposit)
383
+ - Protocol selection is **not** touched by `createSessionKey` — it's set on the first `depositFunds` call
384
+ - **Deprecated**: prefer `depositFunds()` for partner onboarding; `createSessionKey` remains for legacy flows
385
385
  - When `alreadyActive` is `true`, `sessionKeyAddress` and `signature` are not available in the response
386
386
 
387
387
  ### 4. Deposit Funds
@@ -389,22 +389,27 @@ console.log("User ID:", result.userId);
389
389
  Transfer tokens to your Safe smart wallet. Token address is automatically selected based on chain and the requested asset (defaults to USDC):
390
390
 
391
391
  - **Ethereum Mainnet (1), Base (8453), Arbitrum (42161)**: USDC (default) or WETH
392
+ - **Ethereum Mainnet (1), Base (8453)**: EURC (6 decimals; not available on Arbitrum)
392
393
 
393
394
  **Minimum portfolio balance (enforced on Safe balance + deposit amount):**
394
395
 
395
396
  - Ethereum Mainnet (1) / USDC: 5 USDC (test threshold — will be raised before production)
396
397
  - All other (chain, asset) pairs: no minimum enforced
397
398
 
398
- Only deposits on Mainnet in USDC that would leave the Safe below 5 USDC are rejected. Deposits on Base or Arbitrum, or in WETH, have no minimum today.
399
+ Only deposits on Mainnet in USDC that would leave the Safe below 5 USDC are rejected. Deposits on Base or Arbitrum, or in WETH/EURC, have no minimum today.
399
400
 
400
401
  ```typescript
401
402
  // Deposit 10 USDC (6 decimals) to Safe on Base — no minimum on Base
402
403
  const result = await sdk.depositFunds(
403
404
  userAddress,
404
405
  8453, // Chain ID
405
- "10000000" // Amount: 10 USDC = 10 * 10^6
406
+ "10000000", // Amount: 10 USDC = 10 * 10^6
407
+ "USDC"
406
408
  );
407
409
 
410
+ // First deposit with aggressive strategy (protocol patching)
411
+ await sdk.depositFunds(userAddress, 8453, "10000000", "USDC", "aggressive");
412
+
408
413
  if (result.success) {
409
414
  console.log("Deposit successful!");
410
415
  console.log("Transaction Hash:", result.txHash);
@@ -414,9 +419,10 @@ if (result.success) {
414
419
  **Note:**
415
420
 
416
421
  - Amount must be in least decimal units. For USDC (6 decimals): 1 USDC = 1000000
417
- - Token address is automatically selected based on chain (USDC by default; pass `asset: "WETH"` to deposit WETH instead)
422
+ - `asset` is required (`"USDC"`, `"WETH"`, or `"EURC"` — EURC on Mainnet/Base only); token address is selected from that for the chain
418
423
  - On Ethereum Mainnet, the total Safe balance in USDC must be at least 5 USDC after the deposit (test threshold); smaller top-ups are allowed if the Safe already holds enough USDC to meet the minimum
419
424
  - The SDK automatically authenticates via SIWE before logging the deposit with Zyfai's API, so no extra steps are required on your end once the transfer confirms
425
+ - **First deposit only** (before transfer + `log_deposit`): if the USDC profile has no `chains` yet, the SDK patches protocols for **USDC, WETH, and EURC** across all supported chains (EURC on Mainnet/Base only → `assetTypeSettings.[usdc|eth|eurc]`). Pass optional `strategy` (`"conservative"` default or `"aggressive"`) — same role as the former `deploySafe` strategy argument. Later deposits skip this.
420
426
 
421
427
  #### Log External Deposit (For Sponsored Transactions)
422
428
 
@@ -586,8 +592,8 @@ console.log("Active protocols:", userDetails.user.protocols.length); // Should b
586
592
 
587
593
  **Note**:
588
594
  - User must be authenticated (automatically done via `connectAccount()`)
589
- - This sets the user's protocols to an empty array
590
- - To resume operations, call `updateUserProfile()` with the desired protocols
595
+ - Clears protocols for USDC, WETH, and EURC
596
+ - To resume operations, call `resumeAgent()` or `updateUserProfile()` with the desired protocols
591
597
 
592
598
  #### Splitting Management
593
599
 
package/dist/index.d.mts CHANGED
@@ -6,6 +6,8 @@ import { Chain, PublicClient, Address as Address$1 } from 'viem';
6
6
  type Address = `0x${string}`;
7
7
  type Hex = `0x${string}`;
8
8
  type Strategy = "conservative" | "aggressive";
9
+ /** Public asset symbols supported by the SDK */
10
+ type SupportedAsset = "USDC" | "WETH" | "EURC";
9
11
  interface RpcUrlsConfig {
10
12
  1?: string;
11
13
  8453?: string;
@@ -34,7 +36,7 @@ interface UpdateUserProfileRequest {
34
36
  crosschainStrategy?: boolean;
35
37
  splitting?: boolean;
36
38
  minSplits?: number;
37
- asset?: "USDC" | "WETH";
39
+ asset?: SupportedAsset;
38
40
  }
39
41
  interface UpdateUserProfileResponse {
40
42
  success: boolean;
@@ -52,7 +54,7 @@ interface UpdateUserProfileResponse {
52
54
  splitting?: boolean;
53
55
  minSplits?: number;
54
56
  customization?: Record<string, any>;
55
- asset?: "USDC" | "WETH";
57
+ asset?: SupportedAsset;
56
58
  }
57
59
  /** @internal */
58
60
  interface AddSessionKeyResponse {
@@ -83,6 +85,13 @@ interface SessionKeyResponse {
83
85
  interface SmartWalletResponse {
84
86
  address: Address;
85
87
  isDeployed: boolean;
88
+ /**
89
+ * True when userAddress is an OwnableValidator owner of the Safe on-chain.
90
+ * For predeployed (pool) wallets this becomes true only after the first
91
+ * deposit rotates ownership from the backend to the user. Always false when
92
+ * the Safe is not deployed.
93
+ */
94
+ isOwner: boolean;
86
95
  }
87
96
  interface Protocol {
88
97
  id: string;
@@ -699,6 +708,11 @@ declare class ZyfaiSDK {
699
708
  private currentChainId;
700
709
  private rpcUrls?;
701
710
  private referralSource?;
711
+ /**
712
+ * Warn that a legacy method is deprecated in favor of depositFunds.
713
+ * Predeployed wallets no longer require deploySafe / createSessionKey.
714
+ */
715
+ private warnDeprecatedOnboardingMethod;
702
716
  constructor(config: SDKConfig | string);
703
717
  /**
704
718
  * Authenticate user with SIWE (Sign-In with Ethereum) & JWT token
@@ -894,16 +908,23 @@ declare class ZyfaiSDK {
894
908
  private getSafeAddressFor;
895
909
  /**
896
910
  * Get smart wallet address for a user
897
- * Returns the deterministic Safe address for an EOA, or the address itself if already a Safe
911
+ * Returns the Safe address for an EOA (deterministic for legacy wallets,
912
+ * backend-assigned for predeployed pool wallets).
898
913
  *
899
914
  * @param userAddress - User's EOA address
900
915
  * @param chainId - Target chain ID
901
- * @returns Smart wallet information including address and deployment status
916
+ * @returns Smart wallet address, deployment status, and whether userAddress
917
+ * is an on-chain OwnableValidator owner (false for reserved predeployed
918
+ * wallets until the first deposit rotates ownership)
902
919
  */
903
920
  getSmartWalletAddress(userAddress: string, chainId: SupportedChainId): Promise<SmartWalletResponse>;
904
921
  /**
905
922
  * Deploy Safe Smart Wallet for a user
906
923
  *
924
+ * @deprecated Prefer `depositFunds()`. Predeployed Safes and session keys are
925
+ * managed automatically on first deposit. This method remains available for
926
+ * legacy flows.
927
+ *
907
928
  * @param userAddress - User's EOA address (the connected EOA, not the smart wallet address)
908
929
  * @param chainId - Target chain ID
909
930
  * @param strategy - Optional strategy selection: "conservative" (default) or "aggressive"
@@ -912,14 +933,11 @@ declare class ZyfaiSDK {
912
933
  *
913
934
  * @example
914
935
  * ```typescript
915
- * // Deploy with default conservative strategy
916
- * await sdk.deploySafe(userAddress, 8453);
936
+ * // Preferred: depositFunds handles predeployed wallet onboarding
937
+ * await sdk.depositFunds(userAddress, 8453, amount, "USDC");
917
938
  *
918
- * // Deploy with aggressive strategy
919
- * await sdk.deploySafe(userAddress, 8453, "aggressive");
920
- *
921
- * // Deploy and automatically create session key
922
- * await sdk.deploySafe(userAddress, 8453, "conservative", true);
939
+ * // Legacy: deploy with default conservative strategy
940
+ * await sdk.deploySafe(userAddress, 8453);
923
941
  * ```
924
942
  */
925
943
  deploySafe(userAddress: string, chainId: SupportedChainId, strategy?: Strategy, createSessionKey?: boolean): Promise<DeploySafeResponse>;
@@ -927,15 +945,21 @@ declare class ZyfaiSDK {
927
945
  * Create session key with auto-fetched configuration from Zyfai API
928
946
  * This is the simplified method that automatically fetches session configuration
929
947
  *
948
+ * @deprecated Prefer `depositFunds()`. Predeployed wallets already have the
949
+ * agent session enabled; session activation is handled after first deposit.
950
+ * This method remains available for legacy flows.
951
+ *
930
952
  * @param userAddress - User's EOA or Safe address
931
953
  * @param chainId - Target chain ID
932
954
  * @returns Session key response with signature and nonces
933
955
  *
934
956
  * @example
935
957
  * ```typescript
936
- * // Simple usage - no need to configure sessions manually
958
+ * // Preferred: depositFunds handles session onboarding for predeployed wallets
959
+ * await sdk.depositFunds(userAddress, 8453, amount, "USDC");
960
+ *
961
+ * // Legacy:
937
962
  * const result = await sdk.createSessionKey(userAddress, 8453);
938
- * console.log("Session created:", result.signature);
939
963
  * ```
940
964
  */
941
965
  createSessionKey(userAddress: string, chainId: SupportedChainId): Promise<SessionKeyResponse>;
@@ -945,16 +969,17 @@ declare class ZyfaiSDK {
945
969
  */
946
970
  private signSessionKey;
947
971
  /**
948
- * Patch the user's protocol selection for the given chain + strategy on
949
- * both USDC and WETH. Mirrors the front-end customization flow:
950
- * 1. Merge existing chains from `getUserDetails` with the new `chainId`
972
+ * Patch the user's protocol selection on USDC, WETH, and EURC across all
973
+ * supported chains (EURC limited to Mainnet/Base). Mirrors the front-end
974
+ * customization flow:
975
+ * 1. Merge existing chains from `getUserDetails` with the target chains
951
976
  * (never overwrite already-configured chains).
952
977
  * 2. Filter protocols by strategy, chain and asset support.
953
978
  * 3. Drop protocols that don't have any pools available for the
954
979
  * asset/chain/strategy combo.
955
980
  * 4. Persist via `updateUserProfile` (writes `assetTypeSettings`).
956
981
  *
957
- * Called from `deploySafe` — SDK consumers don't handle protocols manually.
982
+ * Called once from `depositFunds` on the account's first deposit.
958
983
  *
959
984
  * @internal
960
985
  */
@@ -984,8 +1009,15 @@ declare class ZyfaiSDK {
984
1009
  * Deposit funds from EOA to Safe smart wallet
985
1010
  * Transfers tokens from the connected wallet to the user's Safe and logs the deposit
986
1011
  *
987
- * Token is automatically selected based on chain (USDC by default):
988
- * - Ethereum Mainnet (1), Base (8453), Arbitrum (42161)
1012
+ * Token address is selected from `asset` for the given chain:
1013
+ * - Ethereum Mainnet (1), Base (8453), Arbitrum (42161): USDC or WETH
1014
+ * - Ethereum Mainnet (1), Base (8453): EURC
1015
+ *
1016
+ * On the account's first deposit (USDC profile has no chains yet), patches
1017
+ * protocol selection for USDC, WETH, and EURC across all supported chains
1018
+ * (EURC on Mainnet/Base only) before the transfer and log_deposit.
1019
+ * Pass `strategy` to select protocols for that first-deposit setup
1020
+ * (same role as the former `deploySafe` strategy argument).
989
1021
  *
990
1022
  * Minimum portfolio balance enforced (Safe balance + deposit amount),
991
1023
  * configured per-chain in `MIN_PORTFOLIO_BALANCE`:
@@ -998,7 +1030,10 @@ declare class ZyfaiSDK {
998
1030
  * @param userAddress - User's address (owner of the Safe)
999
1031
  * @param chainId - Target chain ID
1000
1032
  * @param amount - Amount in least decimal units (e.g., "100000000" for 100 USDC with 6 decimals)
1001
- * @param asset - Optional asset symbol ("USDC" or "WETH"). Defaults to "USDC".
1033
+ * @param asset - Asset symbol: "USDC", "WETH", or "EURC".
1034
+ * EURC is supported on Ethereum Mainnet and Base only.
1035
+ * @param strategy - Optional strategy for first-deposit protocol patching:
1036
+ * "conservative" (default) or "aggressive"
1002
1037
  * @returns Deposit response with transaction hash
1003
1038
  *
1004
1039
  * @example
@@ -1007,11 +1042,15 @@ declare class ZyfaiSDK {
1007
1042
  * const result = await sdk.depositFunds(
1008
1043
  * "0xUser...",
1009
1044
  * 8453,
1010
- * "10000000000" // 10,000 USDC = 10_000 * 10^6
1045
+ * "10000000000",
1046
+ * "USDC"
1011
1047
  * );
1048
+ *
1049
+ * // First deposit with aggressive strategy
1050
+ * await sdk.depositFunds(userAddress, 8453, "10000000000", "USDC", "aggressive");
1012
1051
  * ```
1013
1052
  */
1014
- depositFunds(userAddress: string, chainId: SupportedChainId, amount: string, asset?: string): Promise<DepositResponse>;
1053
+ depositFunds(userAddress: string, chainId: SupportedChainId, amount: string, asset: string, strategy?: Strategy): Promise<DepositResponse>;
1015
1054
  /**
1016
1055
  * Log a deposit that was executed client-side
1017
1056
  *
@@ -1140,7 +1179,7 @@ declare class ZyfaiSDK {
1140
1179
  * console.log("Chains:", user.user.chains);
1141
1180
  * ```
1142
1181
  */
1143
- getUserDetails(asset?: "USDC" | "WETH"): Promise<UpdateUserProfileResponse>;
1182
+ getUserDetails(asset?: SupportedAsset): Promise<UpdateUserProfileResponse>;
1144
1183
  /**
1145
1184
  * Get total value locked (TVL) across all Zyfai accounts
1146
1185
  *
@@ -1181,7 +1220,7 @@ declare class ZyfaiSDK {
1181
1220
  * console.log("Total Volume:", volume.volumeInUSD);
1182
1221
  * ```
1183
1222
  */
1184
- getVolume(assetType?: "usdc" | "eth"): Promise<VolumeResponse>;
1223
+ getVolume(assetType?: "usdc" | "eth" | "eurc"): Promise<VolumeResponse>;
1185
1224
  /**
1186
1225
  * Get active wallets for a specific chain
1187
1226
  *
@@ -1775,4 +1814,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
1775
1814
  */
1776
1815
  declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
1777
1816
 
1778
- export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type ApyPosition, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
1817
+ export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type ApyPosition, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ import { Chain, PublicClient, Address as Address$1 } from 'viem';
6
6
  type Address = `0x${string}`;
7
7
  type Hex = `0x${string}`;
8
8
  type Strategy = "conservative" | "aggressive";
9
+ /** Public asset symbols supported by the SDK */
10
+ type SupportedAsset = "USDC" | "WETH" | "EURC";
9
11
  interface RpcUrlsConfig {
10
12
  1?: string;
11
13
  8453?: string;
@@ -34,7 +36,7 @@ interface UpdateUserProfileRequest {
34
36
  crosschainStrategy?: boolean;
35
37
  splitting?: boolean;
36
38
  minSplits?: number;
37
- asset?: "USDC" | "WETH";
39
+ asset?: SupportedAsset;
38
40
  }
39
41
  interface UpdateUserProfileResponse {
40
42
  success: boolean;
@@ -52,7 +54,7 @@ interface UpdateUserProfileResponse {
52
54
  splitting?: boolean;
53
55
  minSplits?: number;
54
56
  customization?: Record<string, any>;
55
- asset?: "USDC" | "WETH";
57
+ asset?: SupportedAsset;
56
58
  }
57
59
  /** @internal */
58
60
  interface AddSessionKeyResponse {
@@ -83,6 +85,13 @@ interface SessionKeyResponse {
83
85
  interface SmartWalletResponse {
84
86
  address: Address;
85
87
  isDeployed: boolean;
88
+ /**
89
+ * True when userAddress is an OwnableValidator owner of the Safe on-chain.
90
+ * For predeployed (pool) wallets this becomes true only after the first
91
+ * deposit rotates ownership from the backend to the user. Always false when
92
+ * the Safe is not deployed.
93
+ */
94
+ isOwner: boolean;
86
95
  }
87
96
  interface Protocol {
88
97
  id: string;
@@ -699,6 +708,11 @@ declare class ZyfaiSDK {
699
708
  private currentChainId;
700
709
  private rpcUrls?;
701
710
  private referralSource?;
711
+ /**
712
+ * Warn that a legacy method is deprecated in favor of depositFunds.
713
+ * Predeployed wallets no longer require deploySafe / createSessionKey.
714
+ */
715
+ private warnDeprecatedOnboardingMethod;
702
716
  constructor(config: SDKConfig | string);
703
717
  /**
704
718
  * Authenticate user with SIWE (Sign-In with Ethereum) & JWT token
@@ -894,16 +908,23 @@ declare class ZyfaiSDK {
894
908
  private getSafeAddressFor;
895
909
  /**
896
910
  * Get smart wallet address for a user
897
- * Returns the deterministic Safe address for an EOA, or the address itself if already a Safe
911
+ * Returns the Safe address for an EOA (deterministic for legacy wallets,
912
+ * backend-assigned for predeployed pool wallets).
898
913
  *
899
914
  * @param userAddress - User's EOA address
900
915
  * @param chainId - Target chain ID
901
- * @returns Smart wallet information including address and deployment status
916
+ * @returns Smart wallet address, deployment status, and whether userAddress
917
+ * is an on-chain OwnableValidator owner (false for reserved predeployed
918
+ * wallets until the first deposit rotates ownership)
902
919
  */
903
920
  getSmartWalletAddress(userAddress: string, chainId: SupportedChainId): Promise<SmartWalletResponse>;
904
921
  /**
905
922
  * Deploy Safe Smart Wallet for a user
906
923
  *
924
+ * @deprecated Prefer `depositFunds()`. Predeployed Safes and session keys are
925
+ * managed automatically on first deposit. This method remains available for
926
+ * legacy flows.
927
+ *
907
928
  * @param userAddress - User's EOA address (the connected EOA, not the smart wallet address)
908
929
  * @param chainId - Target chain ID
909
930
  * @param strategy - Optional strategy selection: "conservative" (default) or "aggressive"
@@ -912,14 +933,11 @@ declare class ZyfaiSDK {
912
933
  *
913
934
  * @example
914
935
  * ```typescript
915
- * // Deploy with default conservative strategy
916
- * await sdk.deploySafe(userAddress, 8453);
936
+ * // Preferred: depositFunds handles predeployed wallet onboarding
937
+ * await sdk.depositFunds(userAddress, 8453, amount, "USDC");
917
938
  *
918
- * // Deploy with aggressive strategy
919
- * await sdk.deploySafe(userAddress, 8453, "aggressive");
920
- *
921
- * // Deploy and automatically create session key
922
- * await sdk.deploySafe(userAddress, 8453, "conservative", true);
939
+ * // Legacy: deploy with default conservative strategy
940
+ * await sdk.deploySafe(userAddress, 8453);
923
941
  * ```
924
942
  */
925
943
  deploySafe(userAddress: string, chainId: SupportedChainId, strategy?: Strategy, createSessionKey?: boolean): Promise<DeploySafeResponse>;
@@ -927,15 +945,21 @@ declare class ZyfaiSDK {
927
945
  * Create session key with auto-fetched configuration from Zyfai API
928
946
  * This is the simplified method that automatically fetches session configuration
929
947
  *
948
+ * @deprecated Prefer `depositFunds()`. Predeployed wallets already have the
949
+ * agent session enabled; session activation is handled after first deposit.
950
+ * This method remains available for legacy flows.
951
+ *
930
952
  * @param userAddress - User's EOA or Safe address
931
953
  * @param chainId - Target chain ID
932
954
  * @returns Session key response with signature and nonces
933
955
  *
934
956
  * @example
935
957
  * ```typescript
936
- * // Simple usage - no need to configure sessions manually
958
+ * // Preferred: depositFunds handles session onboarding for predeployed wallets
959
+ * await sdk.depositFunds(userAddress, 8453, amount, "USDC");
960
+ *
961
+ * // Legacy:
937
962
  * const result = await sdk.createSessionKey(userAddress, 8453);
938
- * console.log("Session created:", result.signature);
939
963
  * ```
940
964
  */
941
965
  createSessionKey(userAddress: string, chainId: SupportedChainId): Promise<SessionKeyResponse>;
@@ -945,16 +969,17 @@ declare class ZyfaiSDK {
945
969
  */
946
970
  private signSessionKey;
947
971
  /**
948
- * Patch the user's protocol selection for the given chain + strategy on
949
- * both USDC and WETH. Mirrors the front-end customization flow:
950
- * 1. Merge existing chains from `getUserDetails` with the new `chainId`
972
+ * Patch the user's protocol selection on USDC, WETH, and EURC across all
973
+ * supported chains (EURC limited to Mainnet/Base). Mirrors the front-end
974
+ * customization flow:
975
+ * 1. Merge existing chains from `getUserDetails` with the target chains
951
976
  * (never overwrite already-configured chains).
952
977
  * 2. Filter protocols by strategy, chain and asset support.
953
978
  * 3. Drop protocols that don't have any pools available for the
954
979
  * asset/chain/strategy combo.
955
980
  * 4. Persist via `updateUserProfile` (writes `assetTypeSettings`).
956
981
  *
957
- * Called from `deploySafe` — SDK consumers don't handle protocols manually.
982
+ * Called once from `depositFunds` on the account's first deposit.
958
983
  *
959
984
  * @internal
960
985
  */
@@ -984,8 +1009,15 @@ declare class ZyfaiSDK {
984
1009
  * Deposit funds from EOA to Safe smart wallet
985
1010
  * Transfers tokens from the connected wallet to the user's Safe and logs the deposit
986
1011
  *
987
- * Token is automatically selected based on chain (USDC by default):
988
- * - Ethereum Mainnet (1), Base (8453), Arbitrum (42161)
1012
+ * Token address is selected from `asset` for the given chain:
1013
+ * - Ethereum Mainnet (1), Base (8453), Arbitrum (42161): USDC or WETH
1014
+ * - Ethereum Mainnet (1), Base (8453): EURC
1015
+ *
1016
+ * On the account's first deposit (USDC profile has no chains yet), patches
1017
+ * protocol selection for USDC, WETH, and EURC across all supported chains
1018
+ * (EURC on Mainnet/Base only) before the transfer and log_deposit.
1019
+ * Pass `strategy` to select protocols for that first-deposit setup
1020
+ * (same role as the former `deploySafe` strategy argument).
989
1021
  *
990
1022
  * Minimum portfolio balance enforced (Safe balance + deposit amount),
991
1023
  * configured per-chain in `MIN_PORTFOLIO_BALANCE`:
@@ -998,7 +1030,10 @@ declare class ZyfaiSDK {
998
1030
  * @param userAddress - User's address (owner of the Safe)
999
1031
  * @param chainId - Target chain ID
1000
1032
  * @param amount - Amount in least decimal units (e.g., "100000000" for 100 USDC with 6 decimals)
1001
- * @param asset - Optional asset symbol ("USDC" or "WETH"). Defaults to "USDC".
1033
+ * @param asset - Asset symbol: "USDC", "WETH", or "EURC".
1034
+ * EURC is supported on Ethereum Mainnet and Base only.
1035
+ * @param strategy - Optional strategy for first-deposit protocol patching:
1036
+ * "conservative" (default) or "aggressive"
1002
1037
  * @returns Deposit response with transaction hash
1003
1038
  *
1004
1039
  * @example
@@ -1007,11 +1042,15 @@ declare class ZyfaiSDK {
1007
1042
  * const result = await sdk.depositFunds(
1008
1043
  * "0xUser...",
1009
1044
  * 8453,
1010
- * "10000000000" // 10,000 USDC = 10_000 * 10^6
1045
+ * "10000000000",
1046
+ * "USDC"
1011
1047
  * );
1048
+ *
1049
+ * // First deposit with aggressive strategy
1050
+ * await sdk.depositFunds(userAddress, 8453, "10000000000", "USDC", "aggressive");
1012
1051
  * ```
1013
1052
  */
1014
- depositFunds(userAddress: string, chainId: SupportedChainId, amount: string, asset?: string): Promise<DepositResponse>;
1053
+ depositFunds(userAddress: string, chainId: SupportedChainId, amount: string, asset: string, strategy?: Strategy): Promise<DepositResponse>;
1015
1054
  /**
1016
1055
  * Log a deposit that was executed client-side
1017
1056
  *
@@ -1140,7 +1179,7 @@ declare class ZyfaiSDK {
1140
1179
  * console.log("Chains:", user.user.chains);
1141
1180
  * ```
1142
1181
  */
1143
- getUserDetails(asset?: "USDC" | "WETH"): Promise<UpdateUserProfileResponse>;
1182
+ getUserDetails(asset?: SupportedAsset): Promise<UpdateUserProfileResponse>;
1144
1183
  /**
1145
1184
  * Get total value locked (TVL) across all Zyfai accounts
1146
1185
  *
@@ -1181,7 +1220,7 @@ declare class ZyfaiSDK {
1181
1220
  * console.log("Total Volume:", volume.volumeInUSD);
1182
1221
  * ```
1183
1222
  */
1184
- getVolume(assetType?: "usdc" | "eth"): Promise<VolumeResponse>;
1223
+ getVolume(assetType?: "usdc" | "eth" | "eurc"): Promise<VolumeResponse>;
1185
1224
  /**
1186
1225
  * Get active wallets for a specific chain
1187
1226
  *
@@ -1775,4 +1814,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
1775
1814
  */
1776
1815
  declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
1777
1816
 
1778
- export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type ApyPosition, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };
1817
+ export { type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type ApyPosition, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryPosition, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDefaultTokenAddress, getSupportedChainIds, isSupportedChain };