@pear-protocol/hyperliquid-sdk 0.1.27 → 0.1.28
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 +23 -16
- package/dist/store/userSelection.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -820,22 +820,13 @@ function validateClosePositionRequest(payload) {
|
|
|
820
820
|
}
|
|
821
821
|
|
|
822
822
|
const DEFAULT_STATE = {
|
|
823
|
-
longTokens: [
|
|
824
|
-
|
|
825
|
-
{ symbol: "BTC", weight: 25 },
|
|
826
|
-
],
|
|
827
|
-
shortTokens: [
|
|
828
|
-
{ symbol: "AVAX", weight: 10 },
|
|
829
|
-
{ symbol: "SEI", weight: 10 },
|
|
830
|
-
{ symbol: "ADA", weight: 10 },
|
|
831
|
-
{ symbol: "TRUMP", weight: 10 },
|
|
832
|
-
{ symbol: "SUI", weight: 10 },
|
|
833
|
-
],
|
|
823
|
+
longTokens: [],
|
|
824
|
+
shortTokens: [],
|
|
834
825
|
openTokenSelector: false,
|
|
835
826
|
selectorConfig: null,
|
|
836
827
|
openConflictModal: false,
|
|
837
828
|
conflicts: [],
|
|
838
|
-
candleInterval:
|
|
829
|
+
candleInterval: '1h',
|
|
839
830
|
isWeightBalanced: true,
|
|
840
831
|
};
|
|
841
832
|
const useUserSelection$1 = create((set, get) => ({
|
|
@@ -855,7 +846,11 @@ const useUserSelection$1 = create((set, get) => ({
|
|
|
855
846
|
const longTotal = updated.reduce((sum, t) => sum + t.weight, 0);
|
|
856
847
|
const shortTotal = prev.shortTokens.reduce((sum, t) => sum + t.weight, 0);
|
|
857
848
|
const isWeightBalanced = longTotal + shortTotal === 100;
|
|
858
|
-
return {
|
|
849
|
+
return {
|
|
850
|
+
...prev,
|
|
851
|
+
longTokens: updated,
|
|
852
|
+
isWeightBalanced,
|
|
853
|
+
};
|
|
859
854
|
}
|
|
860
855
|
else {
|
|
861
856
|
const updated = [...prev.shortTokens];
|
|
@@ -863,7 +858,11 @@ const useUserSelection$1 = create((set, get) => ({
|
|
|
863
858
|
const longTotal = prev.longTokens.reduce((sum, t) => sum + t.weight, 0);
|
|
864
859
|
const shortTotal = updated.reduce((sum, t) => sum + t.weight, 0);
|
|
865
860
|
const isWeightBalanced = longTotal + shortTotal === 100;
|
|
866
|
-
return {
|
|
861
|
+
return {
|
|
862
|
+
...prev,
|
|
863
|
+
shortTokens: updated,
|
|
864
|
+
isWeightBalanced,
|
|
865
|
+
};
|
|
867
866
|
}
|
|
868
867
|
});
|
|
869
868
|
},
|
|
@@ -892,14 +891,22 @@ const useUserSelection$1 = create((set, get) => ({
|
|
|
892
891
|
const longTotal = updated.reduce((sum, t) => sum + t.weight, 0);
|
|
893
892
|
const shortTotal = prev.shortTokens.reduce((sum, t) => sum + t.weight, 0);
|
|
894
893
|
const isWeightBalanced = longTotal + shortTotal === 100;
|
|
895
|
-
return {
|
|
894
|
+
return {
|
|
895
|
+
...prev,
|
|
896
|
+
longTokens: updated,
|
|
897
|
+
isWeightBalanced,
|
|
898
|
+
};
|
|
896
899
|
}
|
|
897
900
|
else {
|
|
898
901
|
const updated = prev.shortTokens.filter((_, i) => i !== index);
|
|
899
902
|
const longTotal = prev.longTokens.reduce((sum, t) => sum + t.weight, 0);
|
|
900
903
|
const shortTotal = updated.reduce((sum, t) => sum + t.weight, 0);
|
|
901
904
|
const isWeightBalanced = longTotal + shortTotal === 100;
|
|
902
|
-
return {
|
|
905
|
+
return {
|
|
906
|
+
...prev,
|
|
907
|
+
shortTokens: updated,
|
|
908
|
+
isWeightBalanced,
|
|
909
|
+
};
|
|
903
910
|
}
|
|
904
911
|
});
|
|
905
912
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CandleInterval, TokenConflict, TokenSelection, TokenSelectorConfig } from
|
|
1
|
+
import type { CandleInterval, TokenConflict, TokenSelection, TokenSelectorConfig } from '../types';
|
|
2
2
|
interface UserSelectionState {
|
|
3
3
|
longTokens: TokenSelection[];
|
|
4
4
|
shortTokens: TokenSelection[];
|