@pear-protocol/symmio-client 0.2.49 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8849,7 +8849,8 @@ declare function useSymmPortfolio(params: {
8849
8849
  }): _tanstack_react_query.UseQueryResult<_pear_protocol_symm_core.PortfolioResponse, Error>;
8850
8850
 
8851
8851
  type UseSymmNotificationsParams = {
8852
- userAddress?: Address;
8852
+ accountAddress?: Address;
8853
+ address?: Address;
8853
8854
  chainId?: number;
8854
8855
  query?: SymmQueryConfig;
8855
8856
  };
@@ -9153,8 +9154,24 @@ declare const symmKeys: {
9153
9154
  address?: Address;
9154
9155
  chainId?: number;
9155
9156
  } | undefined];
9156
- notifications: (address?: Address, chainId?: number) => readonly ["symm", "notifications", `0x${string}` | undefined, number | undefined];
9157
- unreadCount: (address?: Address, chainId?: number) => readonly ["symm", "unreadCount", `0x${string}` | undefined, number | undefined];
9157
+ notifications: (params?: {
9158
+ accountAddress?: Address;
9159
+ address?: Address;
9160
+ chainId?: number;
9161
+ }) => readonly ["symm", "notifications", {
9162
+ accountAddress?: Address;
9163
+ address?: Address;
9164
+ chainId?: number;
9165
+ } | undefined];
9166
+ unreadCount: (params?: {
9167
+ accountAddress?: Address;
9168
+ address?: Address;
9169
+ chainId?: number;
9170
+ }) => readonly ["symm", "unreadCount", {
9171
+ accountAddress?: Address;
9172
+ address?: Address;
9173
+ chainId?: number;
9174
+ } | undefined];
9158
9175
  availableMargin: (address?: Address, chainId?: number) => readonly ["symm", "availableMargin", `0x${string}` | undefined, number | undefined];
9159
9176
  pendingIds: (address?: Address, chainId?: number) => readonly ["symm", "pendingIds", `0x${string}` | undefined, number | undefined];
9160
9177
  pendingInstantOpens: (accountAddress?: Address, chainId?: number) => readonly ["symm", "pendingInstantOpens", `0x${string}` | undefined, number | undefined];
@@ -8849,7 +8849,8 @@ declare function useSymmPortfolio(params: {
8849
8849
  }): _tanstack_react_query.UseQueryResult<_pear_protocol_symm_core.PortfolioResponse, Error>;
8850
8850
 
8851
8851
  type UseSymmNotificationsParams = {
8852
- userAddress?: Address;
8852
+ accountAddress?: Address;
8853
+ address?: Address;
8853
8854
  chainId?: number;
8854
8855
  query?: SymmQueryConfig;
8855
8856
  };
@@ -9153,8 +9154,24 @@ declare const symmKeys: {
9153
9154
  address?: Address;
9154
9155
  chainId?: number;
9155
9156
  } | undefined];
9156
- notifications: (address?: Address, chainId?: number) => readonly ["symm", "notifications", `0x${string}` | undefined, number | undefined];
9157
- unreadCount: (address?: Address, chainId?: number) => readonly ["symm", "unreadCount", `0x${string}` | undefined, number | undefined];
9157
+ notifications: (params?: {
9158
+ accountAddress?: Address;
9159
+ address?: Address;
9160
+ chainId?: number;
9161
+ }) => readonly ["symm", "notifications", {
9162
+ accountAddress?: Address;
9163
+ address?: Address;
9164
+ chainId?: number;
9165
+ } | undefined];
9166
+ unreadCount: (params?: {
9167
+ accountAddress?: Address;
9168
+ address?: Address;
9169
+ chainId?: number;
9170
+ }) => readonly ["symm", "unreadCount", {
9171
+ accountAddress?: Address;
9172
+ address?: Address;
9173
+ chainId?: number;
9174
+ } | undefined];
9158
9175
  availableMargin: (address?: Address, chainId?: number) => readonly ["symm", "availableMargin", `0x${string}` | undefined, number | undefined];
9159
9176
  pendingIds: (address?: Address, chainId?: number) => readonly ["symm", "pendingIds", `0x${string}` | undefined, number | undefined];
9160
9177
  pendingInstantOpens: (accountAddress?: Address, chainId?: number) => readonly ["symm", "pendingInstantOpens", `0x${string}` | undefined, number | undefined];
@@ -745,8 +745,8 @@ var symmKeys = {
745
745
  fundingPayments: (params) => ["symm", "fundingPayments", params],
746
746
  fundingHistory: (params) => ["symm", "fundingHistory", params],
747
747
  portfolio: (params) => ["symm", "portfolio", params],
748
- notifications: (address, chainId) => ["symm", "notifications", address, chainId],
749
- unreadCount: (address, chainId) => ["symm", "unreadCount", address, chainId],
748
+ notifications: (params) => ["symm", "notifications", params],
749
+ unreadCount: (params) => ["symm", "unreadCount", params],
750
750
  availableMargin: (address, chainId) => ["symm", "availableMargin", address, chainId],
751
751
  pendingIds: (address, chainId) => ["symm", "pendingIds", address, chainId],
752
752
  pendingInstantOpens: (accountAddress, chainId) => ["symm", "pendingInstantOpens", accountAddress, chainId],
@@ -25476,13 +25476,14 @@ function useSymmUpdatePositionMutation(paramsOrOptions, maybeOptions) {
25476
25476
  typedRequest.authToken,
25477
25477
  typedRequest.accountAddress
25478
25478
  );
25479
- if (!authToken) {
25480
- throw new Error("auth token is required to update a position");
25481
- }
25482
- return symmCoreClient.positions.update(positionId, {
25479
+ const requestWithOptionalAuth = authToken ? {
25483
25480
  ...request,
25484
25481
  authToken
25485
- });
25482
+ } : request;
25483
+ return symmCoreClient.positions.update(
25484
+ positionId,
25485
+ requestWithOptionalAuth
25486
+ );
25486
25487
  }
25487
25488
  });
25488
25489
  }
@@ -26040,61 +26041,81 @@ function useSymmPortfolio(params) {
26040
26041
  function useResolvedNotificationsParams(params) {
26041
26042
  const { symmCoreClient, chainId: ctxChainId } = useSymmContext();
26042
26043
  const chainId = params.chainId ?? ctxChainId;
26044
+ const accountAddress = params.accountAddress;
26045
+ const address = accountAddress ? void 0 : params.address;
26043
26046
  return {
26044
26047
  symmCoreClient,
26045
26048
  chainId,
26046
- userAddress: params.userAddress,
26049
+ accountAddress,
26050
+ address,
26047
26051
  query: params.query
26048
26052
  };
26049
26053
  }
26050
26054
  function useSymmNotificationsQuery(params) {
26051
- const { symmCoreClient, chainId, userAddress, query } = useResolvedNotificationsParams(params);
26052
- const internalEnabled = !!symmCoreClient && !!userAddress;
26055
+ const { symmCoreClient, chainId, accountAddress, address, query } = useResolvedNotificationsParams(params);
26056
+ const internalEnabled = !!symmCoreClient && !!(accountAddress || address);
26057
+ const queryParams = {
26058
+ accountAddress,
26059
+ address,
26060
+ chainId
26061
+ };
26053
26062
  return reactQuery.useQuery({
26054
26063
  ...query,
26055
- queryKey: symmKeys.notifications(userAddress, chainId),
26064
+ queryKey: symmKeys.notifications(queryParams),
26056
26065
  queryFn: () => symmCoreClient.notifications.list({
26057
- userAddress,
26066
+ accountAddress,
26067
+ address,
26058
26068
  chainId
26059
26069
  }),
26060
26070
  enabled: internalEnabled && (query?.enabled ?? true)
26061
26071
  });
26062
26072
  }
26063
26073
  function useSymmUnreadCountQuery(params) {
26064
- const { symmCoreClient, chainId, userAddress, query } = useResolvedNotificationsParams(params);
26065
- const internalEnabled = !!symmCoreClient && !!userAddress;
26074
+ const { symmCoreClient, chainId, accountAddress, address, query } = useResolvedNotificationsParams(params);
26075
+ const internalEnabled = !!symmCoreClient && !!(accountAddress || address);
26076
+ const queryParams = {
26077
+ accountAddress,
26078
+ address,
26079
+ chainId
26080
+ };
26066
26081
  return reactQuery.useQuery({
26067
26082
  ...query,
26068
- queryKey: symmKeys.unreadCount(userAddress, chainId),
26083
+ queryKey: symmKeys.unreadCount(queryParams),
26069
26084
  queryFn: () => symmCoreClient.notifications.getUnreadCount({
26070
- userAddress,
26085
+ accountAddress,
26086
+ address,
26071
26087
  chainId
26072
26088
  }),
26073
26089
  enabled: internalEnabled && (query?.enabled ?? true)
26074
26090
  });
26075
26091
  }
26076
26092
  function useSymmMarkReadNotificationMutation(params, options) {
26077
- const { symmCoreClient, chainId, userAddress } = useResolvedNotificationsParams(params);
26093
+ const { symmCoreClient, chainId, accountAddress, address } = useResolvedNotificationsParams(params);
26078
26094
  const queryClient = reactQuery.useQueryClient();
26095
+ const queryParams = {
26096
+ accountAddress,
26097
+ address,
26098
+ chainId
26099
+ };
26079
26100
  return reactQuery.useMutation({
26080
26101
  ...withSymmMutationConfig(options?.mutation, {
26081
26102
  onSuccess: () => {
26082
26103
  queryClient.invalidateQueries({
26083
- queryKey: symmKeys.notifications(userAddress, chainId)
26104
+ queryKey: symmKeys.notifications(queryParams)
26084
26105
  });
26085
26106
  queryClient.invalidateQueries({
26086
- queryKey: symmKeys.unreadCount(userAddress, chainId)
26107
+ queryKey: symmKeys.unreadCount(queryParams)
26087
26108
  });
26088
26109
  }
26089
26110
  }),
26090
26111
  mutationFn: async ({ id, timestamp }) => {
26091
- if (!symmCoreClient || !userAddress) {
26112
+ if (!symmCoreClient || !accountAddress) {
26092
26113
  throw new Error("symm-core client not available");
26093
26114
  }
26094
26115
  return symmCoreClient.notifications.markRead({
26095
26116
  id,
26096
26117
  timestamp,
26097
- userAddress,
26118
+ accountAddress,
26098
26119
  chainId
26099
26120
  });
26100
26121
  }