@orderly.network/hooks 2.6.3 → 2.7.0
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.d.mts +61 -7
- package/dist/index.d.ts +61 -7
- package/dist/index.js +151 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +147 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -36,9 +36,9 @@ var __export = (target, all) => {
|
|
|
36
36
|
// src/version.ts
|
|
37
37
|
if (typeof window !== "undefined") {
|
|
38
38
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
39
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.
|
|
39
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.7.0";
|
|
40
40
|
}
|
|
41
|
-
var version_default = "2.
|
|
41
|
+
var version_default = "2.7.0";
|
|
42
42
|
var fetcher = (url, init2 = {}, queryOptions) => get(url, init2, queryOptions?.formatter);
|
|
43
43
|
var noCacheConfig = {
|
|
44
44
|
dedupingInterval: 0,
|
|
@@ -465,15 +465,17 @@ var useUpdatedRef = (val) => {
|
|
|
465
465
|
return latestRef;
|
|
466
466
|
};
|
|
467
467
|
var useMemoizedFn = (fn) => {
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
468
|
+
const safeFn = typeof fn === "function" ? fn : () => {
|
|
469
|
+
};
|
|
470
|
+
const fnRef = useRef(safeFn);
|
|
471
|
+
fnRef.current = useMemo(() => safeFn, [safeFn]);
|
|
472
|
+
const wrapperRef = useRef(null);
|
|
473
|
+
if (!wrapperRef.current) {
|
|
474
|
+
wrapperRef.current = function(...args) {
|
|
473
475
|
return fnRef.current.apply(this, args);
|
|
474
476
|
};
|
|
475
477
|
}
|
|
476
|
-
return
|
|
478
|
+
return wrapperRef.current;
|
|
477
479
|
};
|
|
478
480
|
var useAudioPlayer = (src, options = {}) => {
|
|
479
481
|
const { volume = 1, loop, autoPlay } = options;
|
|
@@ -2141,13 +2143,13 @@ var useFeeState = () => {
|
|
|
2141
2143
|
const makerFeeBps = accountInfo?.futures_maker_fee_rate;
|
|
2142
2144
|
const refereeRebate = referralData?.referee_info?.referee_rebate_rate;
|
|
2143
2145
|
const takerFee = useMemo(() => {
|
|
2144
|
-
if (isAccountLoading || takerFeeBps
|
|
2146
|
+
if (isAccountLoading || takerFeeBps === null || takerFeeBps === void 0) {
|
|
2145
2147
|
return "-";
|
|
2146
2148
|
}
|
|
2147
2149
|
return formatFractionAsPercent(bpsToFraction(takerFeeBps));
|
|
2148
2150
|
}, [isAccountLoading, takerFeeBps]);
|
|
2149
2151
|
const makerFee = useMemo(() => {
|
|
2150
|
-
if (isAccountLoading || makerFeeBps
|
|
2152
|
+
if (isAccountLoading || makerFeeBps === null || makerFeeBps === void 0) {
|
|
2151
2153
|
return "-";
|
|
2152
2154
|
}
|
|
2153
2155
|
return formatFractionAsPercent(bpsToFraction(makerFeeBps));
|
|
@@ -2176,15 +2178,10 @@ var useFeeState = () => {
|
|
|
2176
2178
|
}, [makerFeeBps, refereeRebate, isReferralLoading]);
|
|
2177
2179
|
return {
|
|
2178
2180
|
takerFee,
|
|
2179
|
-
// 原始 taker 费率(百分比字符串)
|
|
2180
2181
|
makerFee,
|
|
2181
|
-
// 原始 maker 费率(百分比字符串)
|
|
2182
2182
|
refereeRebate,
|
|
2183
|
-
// 返佣(fraction),例如 0.2
|
|
2184
2183
|
effectiveTakerFee,
|
|
2185
|
-
// 有效 taker 费率(百分比字符串)
|
|
2186
2184
|
effectiveMakerFee
|
|
2187
|
-
// 有效 maker 费率(百分比字符串)
|
|
2188
2185
|
};
|
|
2189
2186
|
};
|
|
2190
2187
|
var apiKeyMap = {
|
|
@@ -2599,6 +2596,7 @@ var useAppStore = create()(
|
|
|
2599
2596
|
}))
|
|
2600
2597
|
);
|
|
2601
2598
|
var useAccountInfo2 = () => useAppStore((state) => state.accountInfo);
|
|
2599
|
+
var usePortfolio = () => useAppStore((state) => state.portfolio);
|
|
2602
2600
|
|
|
2603
2601
|
// src/orderly/useSymbolsInfo.ts
|
|
2604
2602
|
var useSymbolsInfo = () => {
|
|
@@ -3471,8 +3469,12 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
3471
3469
|
markPrice: item.mark_price
|
|
3472
3470
|
});
|
|
3473
3471
|
let unrealPnl_index = 0, unrealPnlROI_index = 0;
|
|
3472
|
+
const maxLeverage = account.maxLeverage({
|
|
3473
|
+
symbolLeverage: item.leverage,
|
|
3474
|
+
accountLeverage: accountInfo.max_leverage
|
|
3475
|
+
});
|
|
3474
3476
|
const imr = account.IMR({
|
|
3475
|
-
maxLeverage
|
|
3477
|
+
maxLeverage,
|
|
3476
3478
|
baseIMR: info?.["base_imr"],
|
|
3477
3479
|
IMR_Factor: accountInfo.imr_factor[item.symbol],
|
|
3478
3480
|
positionNotional: notional,
|
|
@@ -4394,6 +4396,12 @@ var useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
|
|
|
4394
4396
|
}
|
|
4395
4397
|
];
|
|
4396
4398
|
};
|
|
4399
|
+
var useSymbolInfo = (symbol) => {
|
|
4400
|
+
const infos = useSymbolsInfo();
|
|
4401
|
+
return useMemo(() => {
|
|
4402
|
+
return !symbol || infos.isNil ? null : infos[symbol];
|
|
4403
|
+
}, [infos, symbol]);
|
|
4404
|
+
};
|
|
4397
4405
|
var useFundingRates = () => {
|
|
4398
4406
|
const data = useAppStore((state) => state.fundingRates);
|
|
4399
4407
|
return createGetter({ ...data });
|
|
@@ -4817,6 +4825,13 @@ var useFundingRate = (symbol) => {
|
|
|
4817
4825
|
}
|
|
4818
4826
|
timerRef.current = setInterval(() => {
|
|
4819
4827
|
const diff = new Date(next_funding_time).getTime() - getTimestamp();
|
|
4828
|
+
if (diff <= 0) {
|
|
4829
|
+
setCountDown("00:00:00");
|
|
4830
|
+
if (timerRef.current) {
|
|
4831
|
+
clearInterval(timerRef.current);
|
|
4832
|
+
}
|
|
4833
|
+
return;
|
|
4834
|
+
}
|
|
4820
4835
|
const result = timeConvertString(diff);
|
|
4821
4836
|
if (result.length === 3) {
|
|
4822
4837
|
setCountDown(
|
|
@@ -4854,7 +4869,8 @@ var useFundingDetails = (symbol) => {
|
|
|
4854
4869
|
throw new SDKError("symbol is required");
|
|
4855
4870
|
}
|
|
4856
4871
|
return useQuery(`/v1/public/info/${symbol}`, {
|
|
4857
|
-
errorRetryCount: 3
|
|
4872
|
+
errorRetryCount: 3,
|
|
4873
|
+
revalidateOnFocus: false
|
|
4858
4874
|
});
|
|
4859
4875
|
};
|
|
4860
4876
|
var calculatePositiveRate = (periodData, period) => {
|
|
@@ -5432,12 +5448,45 @@ var useCollateral = (options = { dp: 6 }) => {
|
|
|
5432
5448
|
// positions: positionsPath(positions),
|
|
5433
5449
|
};
|
|
5434
5450
|
};
|
|
5451
|
+
var useLeverageBySymbol = (symbol) => {
|
|
5452
|
+
const { state } = useAccount();
|
|
5453
|
+
const ws = useWS();
|
|
5454
|
+
const [leverage, setLeverage] = useState(void 0);
|
|
5455
|
+
const { data } = usePrivateQuery(
|
|
5456
|
+
symbol ? `/v1/client/leverage?symbol=${symbol}` : null,
|
|
5457
|
+
{
|
|
5458
|
+
revalidateOnFocus: false
|
|
5459
|
+
}
|
|
5460
|
+
);
|
|
5461
|
+
useEffect(() => {
|
|
5462
|
+
if (data?.leverage) {
|
|
5463
|
+
setLeverage(data.leverage);
|
|
5464
|
+
}
|
|
5465
|
+
}, [data]);
|
|
5466
|
+
useEffect(() => {
|
|
5467
|
+
if (!state.accountId || !symbol)
|
|
5468
|
+
return;
|
|
5469
|
+
const unsubscribe = ws.privateSubscribe("account", {
|
|
5470
|
+
onMessage: (data2) => {
|
|
5471
|
+
const res = data2?.accountDetail?.symbolLeverage || {};
|
|
5472
|
+
if (res.symbol === symbol) {
|
|
5473
|
+
setLeverage(res.leverage);
|
|
5474
|
+
}
|
|
5475
|
+
}
|
|
5476
|
+
});
|
|
5477
|
+
return () => unsubscribe?.();
|
|
5478
|
+
}, [symbol, state.accountId]);
|
|
5479
|
+
return leverage;
|
|
5480
|
+
};
|
|
5481
|
+
|
|
5482
|
+
// src/orderly/useMaxQty.ts
|
|
5435
5483
|
var useMaxQty = (symbol, side, reduceOnly = false) => {
|
|
5436
5484
|
const positions3 = usePositions();
|
|
5437
5485
|
const accountInfo = useAccountInfo2();
|
|
5438
5486
|
const symbolInfo = useSymbolsInfo();
|
|
5439
5487
|
const { totalCollateral } = useCollateral();
|
|
5440
5488
|
const { data: markPrices } = useMarkPricesStream();
|
|
5489
|
+
const symbolLeverage = useLeverageBySymbol(symbol);
|
|
5441
5490
|
const maxQty = useMemo(() => {
|
|
5442
5491
|
if (!symbol)
|
|
5443
5492
|
return 0;
|
|
@@ -5483,7 +5532,10 @@ var useMaxQty = (symbol, side, reduceOnly = false) => {
|
|
|
5483
5532
|
symbol,
|
|
5484
5533
|
baseMaxQty: getSymbolInfo("base_max"),
|
|
5485
5534
|
totalCollateral,
|
|
5486
|
-
maxLeverage:
|
|
5535
|
+
maxLeverage: account.maxLeverage({
|
|
5536
|
+
symbolLeverage: symbolLeverage || currentSymbolPosition?.leverage,
|
|
5537
|
+
accountLeverage: accountInfo.max_leverage
|
|
5538
|
+
}),
|
|
5487
5539
|
takerFeeRate: accountInfo.futures_taker_fee_rate,
|
|
5488
5540
|
baseIMR: getSymbolInfo("base_imr"),
|
|
5489
5541
|
otherIMs,
|
|
@@ -5567,6 +5619,11 @@ function useChains(networkId, options = {}) {
|
|
|
5567
5619
|
const filterFun = useRef(options?.filter);
|
|
5568
5620
|
filterFun.current = options?.filter;
|
|
5569
5621
|
const chainsMap = useRef(/* @__PURE__ */ new Map());
|
|
5622
|
+
const brokerId = configStore.get("brokerId");
|
|
5623
|
+
const env = configStore.get("env");
|
|
5624
|
+
const brokerIdQuery = brokerId !== "orderly" ? `?broker_id=${brokerId}` : "";
|
|
5625
|
+
const urlPrefix = env === "prod" ? "https://testnet-api.orderly.org" : "";
|
|
5626
|
+
const needFetchFromAPI = options.forceAPI || !customChains;
|
|
5570
5627
|
const commonSwrOpts = {
|
|
5571
5628
|
revalidateIfStale: false,
|
|
5572
5629
|
revalidateOnFocus: false,
|
|
@@ -5582,22 +5639,18 @@ function useChains(networkId, options = {}) {
|
|
|
5582
5639
|
{ ...commonSwrOpts }
|
|
5583
5640
|
);
|
|
5584
5641
|
const { data: testTokenChainsRes } = useQuery(
|
|
5585
|
-
|
|
5642
|
+
`${urlPrefix}/v1/public/token`,
|
|
5586
5643
|
{
|
|
5587
5644
|
...commonSwrOpts,
|
|
5588
5645
|
fallbackData: testnetTokenFallback
|
|
5589
5646
|
}
|
|
5590
5647
|
);
|
|
5591
|
-
const brokerId = configStore.get("brokerId");
|
|
5592
|
-
const env = configStore.get("env");
|
|
5593
|
-
const brokerIdQuery = brokerId !== "orderly" ? `?broker_id=${brokerId}` : "";
|
|
5594
|
-
const needFetchFromAPI = options.forceAPI || !customChains;
|
|
5595
5648
|
const { data: chainInfos, error: chainInfoErr } = useQuery(
|
|
5596
5649
|
needFetchFromAPI ? `https://api.orderly.org/v1/public/chain_info${brokerIdQuery}` : null,
|
|
5597
5650
|
{ ...commonSwrOpts }
|
|
5598
5651
|
);
|
|
5599
5652
|
const { data: testChainInfos, error: testChainInfoError } = useQuery(
|
|
5600
|
-
needFetchFromAPI ?
|
|
5653
|
+
needFetchFromAPI ? `${urlPrefix}/v1/public/chain_info${brokerIdQuery}` : null,
|
|
5601
5654
|
{
|
|
5602
5655
|
...commonSwrOpts,
|
|
5603
5656
|
fallbackData: testnetChainFallback,
|
|
@@ -5605,10 +5658,6 @@ function useChains(networkId, options = {}) {
|
|
|
5605
5658
|
}
|
|
5606
5659
|
}
|
|
5607
5660
|
);
|
|
5608
|
-
const { data: envChainInfos, error: envChainInfoError } = useQuery(
|
|
5609
|
-
needFetchFromAPI && env !== "prod" ? `/v1/public/chain_info${brokerIdQuery}` : null,
|
|
5610
|
-
commonSwrOpts
|
|
5611
|
-
);
|
|
5612
5661
|
const { swapChains, swapChainsError } = useSwapChains();
|
|
5613
5662
|
const chains = useMemo(() => {
|
|
5614
5663
|
const mainnetChains = formatChains({
|
|
@@ -5621,7 +5670,7 @@ function useChains(networkId, options = {}) {
|
|
|
5621
5670
|
});
|
|
5622
5671
|
const testnetChains = formatChains({
|
|
5623
5672
|
tokenChains: testTokenChainsRes,
|
|
5624
|
-
chainInfos:
|
|
5673
|
+
chainInfos: testChainInfos,
|
|
5625
5674
|
swapChains,
|
|
5626
5675
|
mainnet: false,
|
|
5627
5676
|
chainTransformer
|
|
@@ -5663,8 +5712,7 @@ function useChains(networkId, options = {}) {
|
|
|
5663
5712
|
pickField,
|
|
5664
5713
|
allowedChains,
|
|
5665
5714
|
swapChains,
|
|
5666
|
-
chainTransformer
|
|
5667
|
-
envChainInfos
|
|
5715
|
+
chainTransformer
|
|
5668
5716
|
]);
|
|
5669
5717
|
const findByChainId = useCallback(
|
|
5670
5718
|
(chainId, field) => {
|
|
@@ -5870,18 +5918,6 @@ function formatChains({
|
|
|
5870
5918
|
}
|
|
5871
5919
|
return chains;
|
|
5872
5920
|
}
|
|
5873
|
-
function formatTestnetChainInfos(chainInfos, envChainInfos) {
|
|
5874
|
-
if (!chainInfos || !envChainInfos || !Array.isArray(chainInfos) || !Array.isArray(envChainInfos)) {
|
|
5875
|
-
return chainInfos;
|
|
5876
|
-
}
|
|
5877
|
-
return chainInfos.map((chain) => {
|
|
5878
|
-
const info = envChainInfos.find((item) => item.chain_id === chain.chain_id);
|
|
5879
|
-
if (info) {
|
|
5880
|
-
chain.vault_address = info.vault_address;
|
|
5881
|
-
}
|
|
5882
|
-
return chain;
|
|
5883
|
-
});
|
|
5884
|
-
}
|
|
5885
5921
|
function useStorageChain() {
|
|
5886
5922
|
const [chain, setChain] = useLocalStorage(ChainKey, null);
|
|
5887
5923
|
const setStorageChain = (chainId) => {
|
|
@@ -5919,6 +5955,13 @@ var useChain = (token) => {
|
|
|
5919
5955
|
}, [data, token]);
|
|
5920
5956
|
return { chains, isLoading };
|
|
5921
5957
|
};
|
|
5958
|
+
|
|
5959
|
+
// src/orderly/useChainInfo.ts
|
|
5960
|
+
var useChainInfo = () => {
|
|
5961
|
+
return useQuery("/v1/public/chain_info", {
|
|
5962
|
+
revalidateOnFocus: false
|
|
5963
|
+
});
|
|
5964
|
+
};
|
|
5922
5965
|
var useHoldingStream = () => {
|
|
5923
5966
|
const ws = useWS();
|
|
5924
5967
|
const { data, isLoading, mutate: mutate5 } = usePrivateQuery(
|
|
@@ -8839,8 +8882,12 @@ function formatPositions(data, accountInfo, symbolsInfo, fundingRates) {
|
|
|
8839
8882
|
markPrice: item.mark_price
|
|
8840
8883
|
});
|
|
8841
8884
|
let unrealPnl_index = 0, unrealPnlROI_index = 0;
|
|
8885
|
+
const maxLeverage = account.maxLeverage({
|
|
8886
|
+
symbolLeverage: item.leverage,
|
|
8887
|
+
accountLeverage: accountInfo.max_leverage
|
|
8888
|
+
});
|
|
8842
8889
|
const imr = account.IMR({
|
|
8843
|
-
maxLeverage
|
|
8890
|
+
maxLeverage,
|
|
8844
8891
|
baseIMR: info?.("base_imr"),
|
|
8845
8892
|
IMR_Factor: accountInfo.imr_factor[item.symbol],
|
|
8846
8893
|
positionNotional: notional,
|
|
@@ -9497,29 +9544,36 @@ var useTPSLOrder = (position, options) => {
|
|
|
9497
9544
|
const result = useTaskProfitAndStopLossInternal(position, options);
|
|
9498
9545
|
return result;
|
|
9499
9546
|
};
|
|
9500
|
-
var
|
|
9501
|
-
const
|
|
9502
|
-
const
|
|
9503
|
-
const
|
|
9504
|
-
dedupingInterval: 1e3 * 60 * 60 * 24,
|
|
9505
|
-
// 24 hours
|
|
9506
|
-
revalidateOnFocus: false,
|
|
9507
|
-
errorRetryCount: 2,
|
|
9508
|
-
errorRetryInterval: 200
|
|
9509
|
-
});
|
|
9547
|
+
var useMaxLeverage = (symbol) => {
|
|
9548
|
+
const symbolsInfo = useSymbolsInfo();
|
|
9549
|
+
const accountInfo = useAccountInfo2();
|
|
9550
|
+
const maxAccountLeverage = accountInfo?.max_leverage;
|
|
9510
9551
|
const maxSymbolLeverage = useMemo(() => {
|
|
9511
|
-
const
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
}, [
|
|
9552
|
+
const symbolInfo = symbolsInfo[symbol];
|
|
9553
|
+
const baseIMR = symbolInfo("base_imr");
|
|
9554
|
+
return baseIMR ? 1 / baseIMR : 1;
|
|
9555
|
+
}, [symbolsInfo, symbol]);
|
|
9515
9556
|
const maxLeverage = useMemo(() => {
|
|
9516
9557
|
if (!maxAccountLeverage || !maxSymbolLeverage) {
|
|
9517
|
-
return
|
|
9558
|
+
return 1;
|
|
9518
9559
|
}
|
|
9519
9560
|
return Math.min(maxAccountLeverage, maxSymbolLeverage);
|
|
9520
9561
|
}, [maxAccountLeverage, maxSymbolLeverage]);
|
|
9521
9562
|
return maxLeverage;
|
|
9522
9563
|
};
|
|
9564
|
+
var useSymbolLeverage = (symbol) => {
|
|
9565
|
+
const symbolInfo = useSymbolInfo(symbol);
|
|
9566
|
+
const [update, { isMutating }] = useMutation("/v1/client/leverage");
|
|
9567
|
+
const maxLeverage = useMemo(() => {
|
|
9568
|
+
const baseIMR = symbolInfo?.("base_imr");
|
|
9569
|
+
return baseIMR ? 1 / baseIMR : 1;
|
|
9570
|
+
}, [symbolInfo]);
|
|
9571
|
+
return {
|
|
9572
|
+
maxLeverage,
|
|
9573
|
+
update,
|
|
9574
|
+
isLoading: isMutating
|
|
9575
|
+
};
|
|
9576
|
+
};
|
|
9523
9577
|
var useAssetsHistory = (options, config) => {
|
|
9524
9578
|
const ee = useEventEmitter();
|
|
9525
9579
|
const getKey = () => {
|
|
@@ -9796,12 +9850,12 @@ var MaintenanceStatus = /* @__PURE__ */ ((MaintenanceStatus2) => {
|
|
|
9796
9850
|
MaintenanceStatus2[MaintenanceStatus2["Maintenance"] = 2] = "Maintenance";
|
|
9797
9851
|
return MaintenanceStatus2;
|
|
9798
9852
|
})(MaintenanceStatus || {});
|
|
9799
|
-
|
|
9853
|
+
var useMaintenanceStatus = () => {
|
|
9800
9854
|
const [status, setStatus] = useState(0 /* None */);
|
|
9801
9855
|
const [startTime, setStartTime] = useState();
|
|
9802
9856
|
const [endTime, setEndTime] = useState();
|
|
9803
9857
|
const [brokerName, setBrokerName] = useState("Orderly network");
|
|
9804
|
-
const { data: systemInfo
|
|
9858
|
+
const { data: systemInfo } = useQuery(
|
|
9805
9859
|
`/v1/public/system_info?source=maintenance`,
|
|
9806
9860
|
{
|
|
9807
9861
|
revalidateOnFocus: false,
|
|
@@ -9847,7 +9901,7 @@ function useMaintenanceStatus() {
|
|
|
9847
9901
|
startTime,
|
|
9848
9902
|
endTime
|
|
9849
9903
|
};
|
|
9850
|
-
}
|
|
9904
|
+
};
|
|
9851
9905
|
var useStorageLedgerAddress = () => {
|
|
9852
9906
|
const [ledgerWallet, setLedgerWallet] = useLocalStorage(LedgerWalletKey, []);
|
|
9853
9907
|
const setLedgerAddress = (address) => {
|
|
@@ -10030,6 +10084,36 @@ var usePrivateDataObserver = (options) => {
|
|
|
10030
10084
|
});
|
|
10031
10085
|
return () => unsubscribe?.();
|
|
10032
10086
|
}, [state.accountId, subOrder]);
|
|
10087
|
+
useEffect(() => {
|
|
10088
|
+
if (!state.accountId)
|
|
10089
|
+
return;
|
|
10090
|
+
const key = ["/v1/positions", state.accountId];
|
|
10091
|
+
const unsubscribe = ws.privateSubscribe("account", {
|
|
10092
|
+
onMessage: (data) => {
|
|
10093
|
+
const { symbol, leverage } = data?.accountDetail?.symbolLeverage || {};
|
|
10094
|
+
if (symbol && leverage) {
|
|
10095
|
+
mutate(
|
|
10096
|
+
key,
|
|
10097
|
+
(prevPositions) => {
|
|
10098
|
+
if (prevPositions?.rows?.length) {
|
|
10099
|
+
return {
|
|
10100
|
+
...prevPositions,
|
|
10101
|
+
rows: prevPositions.rows.map((row) => {
|
|
10102
|
+
return row.symbol === symbol ? { ...row, leverage } : row;
|
|
10103
|
+
})
|
|
10104
|
+
};
|
|
10105
|
+
}
|
|
10106
|
+
return prevPositions;
|
|
10107
|
+
},
|
|
10108
|
+
{
|
|
10109
|
+
revalidate: false
|
|
10110
|
+
}
|
|
10111
|
+
);
|
|
10112
|
+
}
|
|
10113
|
+
}
|
|
10114
|
+
});
|
|
10115
|
+
return () => unsubscribe?.();
|
|
10116
|
+
}, [state.accountId]);
|
|
10033
10117
|
useEffect(() => {
|
|
10034
10118
|
if (!state.accountId) {
|
|
10035
10119
|
return;
|
|
@@ -17664,6 +17748,6 @@ var usePositionClose = (options) => {
|
|
|
17664
17748
|
};
|
|
17665
17749
|
};
|
|
17666
17750
|
|
|
17667
|
-
export { DefaultLayoutConfig, DistributionId, ENVType2 as ENVType, EpochStatus, ExtendedConfigStore, MaintenanceStatus, MarketsStorageKey, MarketsType, ORDERLY_ORDERBOOK_DEPTH_KEY, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, StatusProvider, TWType, WalletConnectorContext, WsNetworkStatus, checkNotional, cleanStringStyle, fetcher, findPositionTPSLFromOrders, findTPSLFromOrder, findTPSLOrderPriceFromOrder, getMinNotional, getPriceKey, noCacheConfig, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useAudioPlayer, useBalanceSubscription, useBalanceTopic, useBoolean, useChain, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFeeState, useFundingDetails, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useInternalTransfer, useKeyStore, useLazyQuery, useLeverage, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketList, useMarketMap, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxQty, useMediaQuery, useMemoizedFn, useMutation, useNetworkInfo, useOdosQuote, useOrderEntity, useOrderEntry2 as useOrderEntry, useOrderEntry as useOrderEntry_deprecated, useOrderStore2 as useOrderStore, useOrderStream, useOrderbookStream, useOrderlyContext, usePositionActions, usePositionClose, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTickerStream, useTokenInfo, useTokensInfo, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useUpdatedRef, useVaultsHistory, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWalletTopic, useWithdraw, useWsStatus, utils_exports as utils, version_default as version };
|
|
17751
|
+
export { DefaultLayoutConfig, DistributionId, ENVType2 as ENVType, EpochStatus, ExtendedConfigStore, MaintenanceStatus, MarketsStorageKey, MarketsType, ORDERLY_ORDERBOOK_DEPTH_KEY, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, StatusProvider, TWType, WalletConnectorContext, WsNetworkStatus, checkNotional, cleanStringStyle, fetcher, findPositionTPSLFromOrders, findTPSLFromOrder, findTPSLOrderPriceFromOrder, getMinNotional, getPriceKey, noCacheConfig, parseJSON, useAccount, useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAssetsHistory, useAudioPlayer, useBalanceSubscription, useBalanceTopic, useBoolean, useChain, useChainInfo, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEventEmitter, useFeeState, useFundingDetails, useFundingFeeHistory, useFundingRate, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetReferralCode, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useInternalTransfer, useKeyStore, useLazyQuery, useLeverage, useLeverageBySymbol, useLocalStorage, useMaintenanceStatus, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketList, useMarketMap, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxLeverage, useMaxQty, useMediaQuery, useMemoizedFn, useMutation, useNetworkInfo, useOdosQuote, useOrderEntity, useOrderEntry2 as useOrderEntry, useOrderEntry as useOrderEntry_deprecated, useOrderStore2 as useOrderStore, useOrderStream, useOrderbookStream, useOrderlyContext, usePortfolio, usePositionActions, usePositionClose, usePositionStream, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSymbolInfo, useSymbolLeverage, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTickerStream, useTokenInfo, useTokensInfo, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useUpdatedRef, useVaultsHistory, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWalletTopic, useWithdraw, useWsStatus, utils_exports as utils, version_default as version };
|
|
17668
17752
|
//# sourceMappingURL=out.js.map
|
|
17669
17753
|
//# sourceMappingURL=index.mjs.map
|