@orderly.network/hooks 0.0.96 → 0.0.97

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
@@ -3311,6 +3311,7 @@ var useWithdraw = () => {
3311
3311
  const { account: account5, state } = useAccount();
3312
3312
  const [isLoading, setIsLoading] = useState(false);
3313
3313
  const { unsettledPnL, availableBalance } = useCollateral();
3314
+ const { freeCollateral } = useCollateral();
3314
3315
  const withdraw = useCallback(
3315
3316
  (inputs) => {
3316
3317
  return account5.assetsManager.withdraw(inputs).then((res) => {
@@ -3319,14 +3320,10 @@ var useWithdraw = () => {
3319
3320
  },
3320
3321
  [state]
3321
3322
  );
3322
- const { usdc } = useHoldingStream();
3323
+ useHoldingStream();
3323
3324
  const maxAmount = useMemo(() => {
3324
- if (!usdc || !usdc.holding)
3325
- return 0;
3326
- if (unsettledPnL >= 0)
3327
- return usdc?.holding ?? 0;
3328
- return new Decimal(usdc.holding).add(unsettledPnL).toNumber();
3329
- }, [usdc, unsettledPnL]);
3325
+ return freeCollateral;
3326
+ }, [freeCollateral]);
3330
3327
  return { withdraw, isLoading, maxAmount, availableBalance, unsettledPnL };
3331
3328
  };
3332
3329
  var useDeposit = (options) => {