@orderly.network/hooks 1.0.18 → 1.0.20
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 +6 -6
package/dist/index.js
CHANGED
|
@@ -3351,6 +3351,7 @@ var useWithdraw = () => {
|
|
|
3351
3351
|
const { account: account5, state } = useAccount();
|
|
3352
3352
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
3353
3353
|
const { unsettledPnL, availableBalance } = useCollateral();
|
|
3354
|
+
const { freeCollateral } = useCollateral();
|
|
3354
3355
|
const withdraw = React.useCallback(
|
|
3355
3356
|
(inputs) => {
|
|
3356
3357
|
return account5.assetsManager.withdraw(inputs).then((res) => {
|
|
@@ -3359,14 +3360,10 @@ var useWithdraw = () => {
|
|
|
3359
3360
|
},
|
|
3360
3361
|
[state]
|
|
3361
3362
|
);
|
|
3362
|
-
|
|
3363
|
+
useHoldingStream();
|
|
3363
3364
|
const maxAmount = React.useMemo(() => {
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
if (unsettledPnL >= 0)
|
|
3367
|
-
return usdc?.holding ?? 0;
|
|
3368
|
-
return new utils.Decimal(usdc.holding).add(unsettledPnL).toNumber();
|
|
3369
|
-
}, [usdc, unsettledPnL]);
|
|
3365
|
+
return freeCollateral;
|
|
3366
|
+
}, [freeCollateral]);
|
|
3370
3367
|
return { withdraw, isLoading, maxAmount, availableBalance, unsettledPnL };
|
|
3371
3368
|
};
|
|
3372
3369
|
var useDeposit = (options) => {
|