@orderly.network/hooks 1.0.15 → 1.0.17
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 +8 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -3362,7 +3362,7 @@ var useWithdraw = () => {
|
|
|
3362
3362
|
return { withdraw, isLoading, maxAmount, availableBalance, unsettledPnL };
|
|
3363
3363
|
};
|
|
3364
3364
|
var useDeposit = (options) => {
|
|
3365
|
-
const {
|
|
3365
|
+
const { enableSwapDeposit } = useContext(OrderlyContext);
|
|
3366
3366
|
const networkId = useConfig("networkId");
|
|
3367
3367
|
const [balanceRevalidating, setBalanceRevalidating] = useState(false);
|
|
3368
3368
|
const [allowanceRevalidating, setAllowanceRevalidating] = useState(false);
|
|
@@ -3414,19 +3414,14 @@ var useDeposit = (options) => {
|
|
|
3414
3414
|
if (!address)
|
|
3415
3415
|
return;
|
|
3416
3416
|
try {
|
|
3417
|
-
if (balanceRevalidating)
|
|
3418
|
-
return;
|
|
3419
|
-
setBalanceRevalidating(true);
|
|
3420
3417
|
const balance2 = await fetchBalanceHandler(address, decimals);
|
|
3421
3418
|
setBalance(() => balance2);
|
|
3422
|
-
setBalanceRevalidating(false);
|
|
3423
3419
|
} catch (e) {
|
|
3424
3420
|
console.warn("----- refresh balance error -----", e);
|
|
3425
|
-
setBalanceRevalidating(false);
|
|
3426
3421
|
setBalance(() => "0");
|
|
3427
3422
|
}
|
|
3428
3423
|
},
|
|
3429
|
-
[state
|
|
3424
|
+
[state]
|
|
3430
3425
|
);
|
|
3431
3426
|
const fetchBalances = useCallback(async (tokens) => {
|
|
3432
3427
|
const tasks = [];
|
|
@@ -3475,7 +3470,10 @@ var useDeposit = (options) => {
|
|
|
3475
3470
|
useEffect(() => {
|
|
3476
3471
|
if (state.status < AccountStatusEnum.Connected)
|
|
3477
3472
|
return;
|
|
3478
|
-
|
|
3473
|
+
setBalanceRevalidating(true);
|
|
3474
|
+
fetchBalance(options?.address, options?.decimals).finally(() => {
|
|
3475
|
+
setBalanceRevalidating(false);
|
|
3476
|
+
});
|
|
3479
3477
|
if (dst.chainId !== options?.srcChainId) {
|
|
3480
3478
|
getAllowance(options?.address, options?.crossChainRouteAddress);
|
|
3481
3479
|
} else {
|
|
@@ -3493,7 +3491,8 @@ var useDeposit = (options) => {
|
|
|
3493
3491
|
options?.srcChainId,
|
|
3494
3492
|
options?.srcToken,
|
|
3495
3493
|
account5.address,
|
|
3496
|
-
dst
|
|
3494
|
+
dst.chainId,
|
|
3495
|
+
dst.symbol
|
|
3497
3496
|
]);
|
|
3498
3497
|
const approve = useCallback(
|
|
3499
3498
|
(amount) => {
|