@zyfai/sdk 0.1.9 → 0.1.10

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.js CHANGED
@@ -57,7 +57,6 @@ var ENDPOINTS = {
57
57
  AUTH_CHALLENGE: "/auth/challenge",
58
58
  // User
59
59
  USER_ME: "/users/me",
60
- USER_INITIALIZE: "/users/initialize",
61
60
  USER_WITHDRAW: "/users/withdraw",
62
61
  PARTIAL_WITHDRAW: "/users/partial-withdraw",
63
62
  USER_ADD_WALLET_TO_SDK: "/users/add-wallet-to-sdk",
@@ -77,6 +76,8 @@ var ENDPOINTS = {
77
76
  DATA_REBALANCE_FREQUENCY: (walletAddress) => `/data/rebalance-frequency?walletAddress=${walletAddress}`
78
77
  };
79
78
  var DATA_ENDPOINTS = {
79
+ // User Initialization
80
+ USER_INITIALIZE: "/earnings/initialize",
80
81
  // Earnings
81
82
  ONCHAIN_EARNINGS: (walletAddress) => `/usercheck/onchain-earnings?walletAddress=${walletAddress}`,
82
83
  CALCULATE_ONCHAIN_EARNINGS: "/usercheck/calculate-onchain-earnings",
@@ -762,19 +763,18 @@ var ZyfaiSDK = class {
762
763
  async initializeUser(smartWallet, chainId) {
763
764
  try {
764
765
  await this.authenticateUser();
765
- const response = await this.httpClient.post(
766
- ENDPOINTS.USER_INITIALIZE,
766
+ const response = await this.httpClient.dataPost(
767
+ DATA_ENDPOINTS.USER_INITIALIZE,
767
768
  {
768
- smartWallet,
769
- chainId
769
+ walletAddress: smartWallet
770
770
  }
771
771
  );
772
772
  return {
773
- success: true,
773
+ success: response.status === "success" || true,
774
774
  userId: response.userId || response.id,
775
- smartWallet: response.smartWallet,
776
- chainId: response.chainId,
777
- message: response.message
775
+ smartWallet: response.smartWallet || smartWallet,
776
+ chainId: response.chainId || chainId,
777
+ message: response.message || response.status || "User initialized successfully"
778
778
  };
779
779
  } catch (error) {
780
780
  throw new Error(`Failed to initialize user: ${error.message}`);
package/dist/index.mjs CHANGED
@@ -18,7 +18,6 @@ var ENDPOINTS = {
18
18
  AUTH_CHALLENGE: "/auth/challenge",
19
19
  // User
20
20
  USER_ME: "/users/me",
21
- USER_INITIALIZE: "/users/initialize",
22
21
  USER_WITHDRAW: "/users/withdraw",
23
22
  PARTIAL_WITHDRAW: "/users/partial-withdraw",
24
23
  USER_ADD_WALLET_TO_SDK: "/users/add-wallet-to-sdk",
@@ -38,6 +37,8 @@ var ENDPOINTS = {
38
37
  DATA_REBALANCE_FREQUENCY: (walletAddress) => `/data/rebalance-frequency?walletAddress=${walletAddress}`
39
38
  };
40
39
  var DATA_ENDPOINTS = {
40
+ // User Initialization
41
+ USER_INITIALIZE: "/earnings/initialize",
41
42
  // Earnings
42
43
  ONCHAIN_EARNINGS: (walletAddress) => `/usercheck/onchain-earnings?walletAddress=${walletAddress}`,
43
44
  CALCULATE_ONCHAIN_EARNINGS: "/usercheck/calculate-onchain-earnings",
@@ -742,19 +743,18 @@ var ZyfaiSDK = class {
742
743
  async initializeUser(smartWallet, chainId) {
743
744
  try {
744
745
  await this.authenticateUser();
745
- const response = await this.httpClient.post(
746
- ENDPOINTS.USER_INITIALIZE,
746
+ const response = await this.httpClient.dataPost(
747
+ DATA_ENDPOINTS.USER_INITIALIZE,
747
748
  {
748
- smartWallet,
749
- chainId
749
+ walletAddress: smartWallet
750
750
  }
751
751
  );
752
752
  return {
753
- success: true,
753
+ success: response.status === "success" || true,
754
754
  userId: response.userId || response.id,
755
- smartWallet: response.smartWallet,
756
- chainId: response.chainId,
757
- message: response.message
755
+ smartWallet: response.smartWallet || smartWallet,
756
+ chainId: response.chainId || chainId,
757
+ message: response.message || response.status || "User initialized successfully"
758
758
  };
759
759
  } catch (error) {
760
760
  throw new Error(`Failed to initialize user: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyfai/sdk",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "TypeScript SDK for ZyFAI Yield Optimization Engine - Deploy Safe smart wallets, manage session keys, and interact with DeFi protocols",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",