@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.mjs CHANGED
@@ -1849,6 +1849,9 @@ var useMarginRatio = () => {
1849
1849
  const { data: markPrices } = useMarkPricesStream();
1850
1850
  const { totalCollateral } = useCollateral();
1851
1851
  const marginRatio = useMemo(() => {
1852
+ if (!rows || !markPrices || !totalCollateral) {
1853
+ return 0;
1854
+ }
1852
1855
  const ratio = account.totalMarginRatio({
1853
1856
  totalCollateral,
1854
1857
  markPrices,
@@ -1859,7 +1862,7 @@ var useMarginRatio = () => {
1859
1862
  const currentLeverage = useMemo(() => {
1860
1863
  return account.currentLeverage(marginRatio);
1861
1864
  }, [marginRatio]);
1862
- return [marginRatio, currentLeverage];
1865
+ return { marginRatio, currentLeverage };
1863
1866
  };
1864
1867
  var useChains = (networkId, options = {}) => {
1865
1868
  const _a = options, swrOptions = __objRest(_a, ["filter", "pick"]);