@pear-protocol/symmio-client 0.2.30 → 0.2.31

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.
@@ -5,7 +5,7 @@ import { SymmSDK, CloseOrderRequest, CancelOpenRequest, ClosePositionRequest, Op
5
5
  import * as viem from 'viem';
6
6
  import { Address, WalletClient, Hex, PublicClient } from 'viem';
7
7
  import * as _tanstack_react_query from '@tanstack/react-query';
8
- import { UseMutationOptions, useQueryClient, useQuery } from '@tanstack/react-query';
8
+ import { UseMutationOptions, useQueryClient } from '@tanstack/react-query';
9
9
  import * as node_modules_viem__types_actions_siwe_verifySiweMessage from 'node_modules/viem/_types/actions/siwe/verifySiweMessage';
10
10
  import * as node_modules_viem__types_utils_ccip from 'node_modules/viem/_types/utils/ccip';
11
11
  import * as node_modules__pear_protocol_symm_core_dist_types from 'node_modules/@pear-protocol/symm-core/dist/types';
@@ -8877,7 +8877,6 @@ interface SymmTokenMetadata {
8877
8877
  nextFundingTime: number;
8878
8878
  }
8879
8879
  interface UseSymmTokenSelectionMetadataReturn {
8880
- query: ReturnType<typeof useQuery>;
8881
8880
  isLoading: boolean;
8882
8881
  isPriceDataReady: boolean;
8883
8882
  isUnsupported: boolean;
@@ -5,7 +5,7 @@ import { SymmSDK, CloseOrderRequest, CancelOpenRequest, ClosePositionRequest, Op
5
5
  import * as viem from 'viem';
6
6
  import { Address, WalletClient, Hex, PublicClient } from 'viem';
7
7
  import * as _tanstack_react_query from '@tanstack/react-query';
8
- import { UseMutationOptions, useQueryClient, useQuery } from '@tanstack/react-query';
8
+ import { UseMutationOptions, useQueryClient } from '@tanstack/react-query';
9
9
  import * as node_modules_viem__types_actions_siwe_verifySiweMessage from 'node_modules/viem/_types/actions/siwe/verifySiweMessage';
10
10
  import * as node_modules_viem__types_utils_ccip from 'node_modules/viem/_types/utils/ccip';
11
11
  import * as node_modules__pear_protocol_symm_core_dist_types from 'node_modules/@pear-protocol/symm-core/dist/types';
@@ -8877,7 +8877,6 @@ interface SymmTokenMetadata {
8877
8877
  nextFundingTime: number;
8878
8878
  }
8879
8879
  interface UseSymmTokenSelectionMetadataReturn {
8880
- query: ReturnType<typeof useQuery>;
8881
8880
  isLoading: boolean;
8882
8881
  isPriceDataReady: boolean;
8883
8882
  isUnsupported: boolean;
@@ -26000,6 +26000,12 @@ function useSymmChartSelection(input) {
26000
26000
  }
26001
26001
 
26002
26002
  // src/utils/chart-metrics.ts
26003
+ function normalizeWeight(weight) {
26004
+ if (!Number.isFinite(weight) || weight <= 0) {
26005
+ return 0;
26006
+ }
26007
+ return weight <= 1 ? weight : weight / 100;
26008
+ }
26003
26009
  function getPositiveValue(metadata, field) {
26004
26010
  const value = metadata?.[field];
26005
26011
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
@@ -26019,7 +26025,8 @@ function computeWeightedProduct(tokens, metadataMap, field, invert = false) {
26019
26025
  return null;
26020
26026
  }
26021
26027
  hasToken = true;
26022
- const exponent = invert ? -(token.weight / 100) : token.weight / 100;
26028
+ const normalizedWeight = normalizeWeight(token.weight);
26029
+ const exponent = invert ? -normalizedWeight : normalizedWeight;
26023
26030
  product *= Math.pow(price, exponent);
26024
26031
  }
26025
26032
  return hasToken ? product : 1;
@@ -26246,7 +26253,6 @@ function useSymmTokenSelectionMetadata(selection, options = {}) {
26246
26253
  const weightedRatio24h = computeWeightedRatio24h(metricInput) ?? 0;
26247
26254
  const sumNetFunding = computeNetFundingSum(metricInput);
26248
26255
  return {
26249
- query,
26250
26256
  isLoading,
26251
26257
  isPriceDataReady,
26252
26258
  isUnsupported,
@@ -26303,6 +26309,12 @@ function toBinanceInterval(interval) {
26303
26309
  }
26304
26310
 
26305
26311
  // src/react/hooks/use-symm-chart-candles.ts
26312
+ function normalizeWeight2(weight) {
26313
+ if (!Number.isFinite(weight) || weight <= 0) {
26314
+ return 0;
26315
+ }
26316
+ return weight <= 1 ? weight : weight / 100;
26317
+ }
26306
26318
  function areIntervalsEqual(currentInterval, nextInterval) {
26307
26319
  return currentInterval === toBinanceInterval(nextInterval);
26308
26320
  }
@@ -26340,7 +26352,8 @@ function computeWeightedValues(tokens, candlesBySymbol, invert = false) {
26340
26352
  if (!(candle.o > 0 && candle.h > 0 && candle.l > 0 && candle.c > 0)) {
26341
26353
  return null;
26342
26354
  }
26343
- const exponent = invert ? -(token.weight / 100) : token.weight / 100;
26355
+ const normalizedWeight = normalizeWeight2(token.weight);
26356
+ const exponent = invert ? -normalizedWeight : normalizedWeight;
26344
26357
  o *= Math.pow(candle.o, exponent);
26345
26358
  h *= Math.pow(candle.h, exponent);
26346
26359
  l *= Math.pow(candle.l, exponent);