@orderly.network/hooks 0.0.29 → 0.0.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.
package/dist/index.d.mts CHANGED
@@ -249,7 +249,10 @@ declare const useCollateral: (options?: Options) => CollateralOutputs;
249
249
 
250
250
  declare const useMaxQty: (symbol: string, side: OrderSide, reduceOnly?: boolean) => number;
251
251
 
252
- declare const useMarginRatio: () => number[];
252
+ declare const useMarginRatio: () => {
253
+ marginRatio: number;
254
+ currentLeverage: number;
255
+ };
253
256
 
254
257
  type inputOptions = {
255
258
  filter?: (item: API.Chain) => boolean;
package/dist/index.d.ts CHANGED
@@ -249,7 +249,10 @@ declare const useCollateral: (options?: Options) => CollateralOutputs;
249
249
 
250
250
  declare const useMaxQty: (symbol: string, side: OrderSide, reduceOnly?: boolean) => number;
251
251
 
252
- declare const useMarginRatio: () => number[];
252
+ declare const useMarginRatio: () => {
253
+ marginRatio: number;
254
+ currentLeverage: number;
255
+ };
253
256
 
254
257
  type inputOptions = {
255
258
  filter?: (item: API.Chain) => boolean;
package/dist/index.js CHANGED
@@ -1858,6 +1858,9 @@ var useMarginRatio = () => {
1858
1858
  const { data: markPrices } = useMarkPricesStream();
1859
1859
  const { totalCollateral } = useCollateral();
1860
1860
  const marginRatio = React2.useMemo(() => {
1861
+ if (!rows || !markPrices || !totalCollateral) {
1862
+ return 0;
1863
+ }
1861
1864
  const ratio = futures.account.totalMarginRatio({
1862
1865
  totalCollateral,
1863
1866
  markPrices,
@@ -1868,7 +1871,7 @@ var useMarginRatio = () => {
1868
1871
  const currentLeverage = React2.useMemo(() => {
1869
1872
  return futures.account.currentLeverage(marginRatio);
1870
1873
  }, [marginRatio]);
1871
- return [marginRatio, currentLeverage];
1874
+ return { marginRatio, currentLeverage };
1872
1875
  };
1873
1876
  var useChains = (networkId, options = {}) => {
1874
1877
  const _a = options, swrOptions = __objRest(_a, ["filter", "pick"]);