@zyfai/sdk 1.10.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -203,7 +203,7 @@ interface SmartWalletResponse {
203
203
  isOwner: boolean;
204
204
  }
205
205
  /** Next nested-parent action after wallet connect (integrator-owned). */
206
- type NestedSafeOnboardingStep = "deploy" | "register" | "deposit" | "withdraw" | "ready";
206
+ type NestedSafeOnboardingStep = "deploy" | "deposit" | "withdraw" | "ready";
207
207
  interface NestedSafeOnboardingStatus$1 {
208
208
  isNestedOwner: boolean;
209
209
  childRegistered: boolean;
@@ -1655,7 +1655,7 @@ declare class ZyfaiSDK {
1655
1655
  * @param userAddress - User's EOA address (the connected EOA, not the smart wallet address)
1656
1656
  * @param chainId - Target chain ID
1657
1657
  * @param strategy - Optional strategy selection: "conservative" (default), "aggressive" or "yieldmaxxing"
1658
- * @param createSessionKey - If true, automatically creates a session key after deployment (default: false)
1658
+ * @param createSessionKey - For EOA owners, if true, creates a session key after deployment (default: false). Nested Safe owners always register the session after deploy.
1659
1659
  * @returns Deployment response with Safe address and transaction hash
1660
1660
  *
1661
1661
  * @example
package/dist/index.d.ts CHANGED
@@ -203,7 +203,7 @@ interface SmartWalletResponse {
203
203
  isOwner: boolean;
204
204
  }
205
205
  /** Next nested-parent action after wallet connect (integrator-owned). */
206
- type NestedSafeOnboardingStep = "deploy" | "register" | "deposit" | "withdraw" | "ready";
206
+ type NestedSafeOnboardingStep = "deploy" | "deposit" | "withdraw" | "ready";
207
207
  interface NestedSafeOnboardingStatus$1 {
208
208
  isNestedOwner: boolean;
209
209
  childRegistered: boolean;
@@ -1655,7 +1655,7 @@ declare class ZyfaiSDK {
1655
1655
  * @param userAddress - User's EOA address (the connected EOA, not the smart wallet address)
1656
1656
  * @param chainId - Target chain ID
1657
1657
  * @param strategy - Optional strategy selection: "conservative" (default), "aggressive" or "yieldmaxxing"
1658
- * @param createSessionKey - If true, automatically creates a session key after deployment (default: false)
1658
+ * @param createSessionKey - For EOA owners, if true, creates a session key after deployment (default: false). Nested Safe owners always register the session after deploy.
1659
1659
  * @returns Deployment response with Safe address and transaction hash
1660
1660
  *
1661
1661
  * @example
package/dist/index.js CHANGED
@@ -2081,8 +2081,9 @@ function portfolioHasWithdrawableBalance(portfolio) {
2081
2081
  }
2082
2082
  function deriveNestedSafeOnboardingStep(flags) {
2083
2083
  if (!flags.isNestedOwner) return "deploy";
2084
- if (!flags.childRegistered || !flags.childDeployed) return "deploy";
2085
- if (!flags.sessionActive) return "register";
2084
+ if (!flags.childRegistered || !flags.childDeployed || !flags.sessionActive) {
2085
+ return "deploy";
2086
+ }
2086
2087
  if (!flags.hasPortfolioBalance) return "deposit";
2087
2088
  if (flags.hasPortfolioBalance) return "withdraw";
2088
2089
  return "ready";
@@ -3851,7 +3852,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3851
3852
  * @param userAddress - User's EOA address (the connected EOA, not the smart wallet address)
3852
3853
  * @param chainId - Target chain ID
3853
3854
  * @param strategy - Optional strategy selection: "conservative" (default), "aggressive" or "yieldmaxxing"
3854
- * @param createSessionKey - If true, automatically creates a session key after deployment (default: false)
3855
+ * @param createSessionKey - For EOA owners, if true, creates a session key after deployment (default: false). Nested Safe owners always register the session after deploy.
3855
3856
  * @returns Deployment response with Safe address and transaction hash
3856
3857
  *
3857
3858
  * @example
@@ -3909,6 +3910,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3909
3910
  chainConfig.publicClient
3910
3911
  );
3911
3912
  const nestedSafeOwner = ownerAccountType === "Safe";
3913
+ const registerSession = nestedSafeOwner || Boolean(createSessionKey);
3912
3914
  const safeAddress = await this.getSafeAddressFor(userAddress, chainId);
3913
3915
  if (!safeAddress && !nestedSafeOwner) {
3914
3916
  throw new Error(
@@ -3933,7 +3935,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3933
3935
  }
3934
3936
  await this.updateUserProtocols(strategy);
3935
3937
  let sessionKeyCreated2 = false;
3936
- if (createSessionKey) {
3938
+ if (registerSession) {
3937
3939
  try {
3938
3940
  await this.createSessionKey(userAddress, chainId);
3939
3941
  sessionKeyCreated2 = true;
@@ -3993,7 +3995,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3993
3995
  });
3994
3996
  }
3995
3997
  let sessionKeyCreated = false;
3996
- if (createSessionKey) {
3998
+ if (registerSession) {
3997
3999
  try {
3998
4000
  await this.createSessionKey(userAddress, chainId);
3999
4001
  sessionKeyCreated = true;
package/dist/index.mjs CHANGED
@@ -2036,8 +2036,9 @@ function portfolioHasWithdrawableBalance(portfolio) {
2036
2036
  }
2037
2037
  function deriveNestedSafeOnboardingStep(flags) {
2038
2038
  if (!flags.isNestedOwner) return "deploy";
2039
- if (!flags.childRegistered || !flags.childDeployed) return "deploy";
2040
- if (!flags.sessionActive) return "register";
2039
+ if (!flags.childRegistered || !flags.childDeployed || !flags.sessionActive) {
2040
+ return "deploy";
2041
+ }
2041
2042
  if (!flags.hasPortfolioBalance) return "deposit";
2042
2043
  if (flags.hasPortfolioBalance) return "withdraw";
2043
2044
  return "ready";
@@ -3806,7 +3807,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3806
3807
  * @param userAddress - User's EOA address (the connected EOA, not the smart wallet address)
3807
3808
  * @param chainId - Target chain ID
3808
3809
  * @param strategy - Optional strategy selection: "conservative" (default), "aggressive" or "yieldmaxxing"
3809
- * @param createSessionKey - If true, automatically creates a session key after deployment (default: false)
3810
+ * @param createSessionKey - For EOA owners, if true, creates a session key after deployment (default: false). Nested Safe owners always register the session after deploy.
3810
3811
  * @returns Deployment response with Safe address and transaction hash
3811
3812
  *
3812
3813
  * @example
@@ -3864,6 +3865,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3864
3865
  chainConfig.publicClient
3865
3866
  );
3866
3867
  const nestedSafeOwner = ownerAccountType === "Safe";
3868
+ const registerSession = nestedSafeOwner || Boolean(createSessionKey);
3867
3869
  const safeAddress = await this.getSafeAddressFor(userAddress, chainId);
3868
3870
  if (!safeAddress && !nestedSafeOwner) {
3869
3871
  throw new Error(
@@ -3888,7 +3890,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3888
3890
  }
3889
3891
  await this.updateUserProtocols(strategy);
3890
3892
  let sessionKeyCreated2 = false;
3891
- if (createSessionKey) {
3893
+ if (registerSession) {
3892
3894
  try {
3893
3895
  await this.createSessionKey(userAddress, chainId);
3894
3896
  sessionKeyCreated2 = true;
@@ -3948,7 +3950,7 @@ var _ZyfaiSDK = class _ZyfaiSDK {
3948
3950
  });
3949
3951
  }
3950
3952
  let sessionKeyCreated = false;
3951
- if (createSessionKey) {
3953
+ if (registerSession) {
3952
3954
  try {
3953
3955
  await this.createSessionKey(userAddress, chainId);
3954
3956
  sessionKeyCreated = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyfai/sdk",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
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",