@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.js +4 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -3319,6 +3319,7 @@ var useWithdraw = () => {
|
|
|
3319
3319
|
const { account: account5, state } = useAccount();
|
|
3320
3320
|
const [isLoading, setIsLoading] = react.useState(false);
|
|
3321
3321
|
const { unsettledPnL, availableBalance } = useCollateral();
|
|
3322
|
+
const { freeCollateral } = useCollateral();
|
|
3322
3323
|
const withdraw = react.useCallback(
|
|
3323
3324
|
(inputs) => {
|
|
3324
3325
|
return account5.assetsManager.withdraw(inputs).then((res) => {
|
|
@@ -3327,14 +3328,10 @@ var useWithdraw = () => {
|
|
|
3327
3328
|
},
|
|
3328
3329
|
[state]
|
|
3329
3330
|
);
|
|
3330
|
-
|
|
3331
|
+
useHoldingStream();
|
|
3331
3332
|
const maxAmount = react.useMemo(() => {
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
if (unsettledPnL >= 0)
|
|
3335
|
-
return usdc?.holding ?? 0;
|
|
3336
|
-
return new utils.Decimal(usdc.holding).add(unsettledPnL).toNumber();
|
|
3337
|
-
}, [usdc, unsettledPnL]);
|
|
3333
|
+
return freeCollateral;
|
|
3334
|
+
}, [freeCollateral]);
|
|
3338
3335
|
return { withdraw, isLoading, maxAmount, availableBalance, unsettledPnL };
|
|
3339
3336
|
};
|
|
3340
3337
|
var useDeposit = (options) => {
|