@orderly.network/hooks 3.0.0-beta.1 → 3.0.0-beta.3
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 +198 -111
- package/dist/index.d.ts +198 -111
- package/dist/index.js +462 -184
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +459 -186
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import React, { createContext, createElement, useContext, useCallback, useState, useEffect, useMemo, useRef, useId, useLayoutEffect } from 'react';
|
|
1
2
|
import { get, WS, mutate as mutate$1 } from '@orderly.network/net';
|
|
2
|
-
import React, { createContext, useContext, useCallback, useState, useEffect, useMemo, useRef, useId, useLayoutEffect } from 'react';
|
|
3
3
|
import useSWR5__default, { mutate } from 'swr';
|
|
4
4
|
import * as useSWR5 from 'swr';
|
|
5
5
|
export { useSWR5 as swr };
|
|
6
6
|
export { unstable_serialize, default as useSWR, useSWRConfig } from 'swr';
|
|
7
7
|
import { usePluginScope } from '@orderly.network/plugin-core';
|
|
8
|
-
import { TesnetTokenFallback, ArbitrumSepoliaTokenInfo, SolanaDevnetTokenInfo, OrderType, OrderSide,
|
|
8
|
+
import { TesnetTokenFallback, ArbitrumSepoliaTokenInfo, SolanaDevnetTokenInfo, MarginMode, OrderType, OrderSide, SDKError, TrackerEventName, AccountStatusEnum, AlgoOrderType, AlgoOrderRootType, OrderStatus, ArbitrumSepoliaChainInfo, SolanaDevnetChainInfo, EMPTY_LIST, EMPTY_OBJECT, isNativeTokenChecker, nativeTokenAddress, ChainKey, chainsInfoMap, ARBITRUM_TESTNET_CHAINID, ARBITRUM_MAINNET_CHAINID, ChainNamespace, MaxUint256, DEPOSIT_FEE_RATE, ETHEREUM_MAINNET_CHAINID, LedgerWalletKey, SOLANA_TESTNET_CHAINID, MONAD_TESTNET_CHAINID, ABSTRACT_TESTNET_CHAINID, BSC_TESTNET_CHAINID, SolanaChains, PositionType, DistributionType, TriggerPriceType } from '@orderly.network/types';
|
|
9
9
|
import { zero, windowGuard, getTimestamp, getGlobalObject, Decimal, timeConvertString, isTestnet, getPrecisionByNumber, getBBOType, camelCaseToUnderscoreCase, commify, todpIfNeed, getTPSLDirection } from '@orderly.network/utils';
|
|
10
10
|
import useSWRMutation from 'swr/mutation';
|
|
11
11
|
import useConstant from 'use-constant';
|
|
@@ -35,13 +35,24 @@ var __export = (target, all) => {
|
|
|
35
35
|
for (var name in all)
|
|
36
36
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
37
37
|
};
|
|
38
|
+
var MarketCategoriesConfigContext = createContext(void 0);
|
|
39
|
+
var MarketCategoriesConfigProvider = ({ value, children }) => {
|
|
40
|
+
return createElement(
|
|
41
|
+
MarketCategoriesConfigContext.Provider,
|
|
42
|
+
{ value },
|
|
43
|
+
children
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
function useMarketCategoriesConfig() {
|
|
47
|
+
return useContext(MarketCategoriesConfigContext);
|
|
48
|
+
}
|
|
38
49
|
|
|
39
50
|
// src/version.ts
|
|
40
51
|
if (typeof window !== "undefined") {
|
|
41
52
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
42
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "3.0.0-beta.
|
|
53
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "3.0.0-beta.3";
|
|
43
54
|
}
|
|
44
|
-
var version_default = "3.0.0-beta.
|
|
55
|
+
var version_default = "3.0.0-beta.3";
|
|
45
56
|
var fetcher = (url, init2 = {}, queryOptions) => get(url, init2, queryOptions?.formatter);
|
|
46
57
|
var noCacheConfig = {
|
|
47
58
|
dedupingInterval: 0,
|
|
@@ -2584,16 +2595,12 @@ var createDataStore = (config) => {
|
|
|
2584
2595
|
const brokerIdQuery = typeof options?.brokerId === "string" && options?.brokerId !== "orderly" ? `?broker_id=${options?.brokerId}` : "";
|
|
2585
2596
|
const url = `${dynamicBaseUrl || baseUrl || ""}${endpoint}${brokerIdQuery}`;
|
|
2586
2597
|
const data = await fetcher(url, {}, { formatter });
|
|
2587
|
-
const dataWithBrokerId = data.map((item) => ({
|
|
2588
|
-
...item,
|
|
2589
|
-
broker_id: options?.brokerId
|
|
2590
|
-
}));
|
|
2591
2598
|
set({
|
|
2592
|
-
data
|
|
2599
|
+
data,
|
|
2593
2600
|
loading: false,
|
|
2594
2601
|
error: null
|
|
2595
2602
|
});
|
|
2596
|
-
return
|
|
2603
|
+
return data;
|
|
2597
2604
|
} catch (error) {
|
|
2598
2605
|
set({ error, loading: false });
|
|
2599
2606
|
return null;
|
|
@@ -3412,7 +3419,10 @@ var useGetRwaSymbolOpenTimeInterval = (symbol, thresholdMinutes = 30) => {
|
|
|
3412
3419
|
};
|
|
3413
3420
|
var useSymbolsInfo = () => {
|
|
3414
3421
|
const symbolsInfo = useAppStore((state) => state.symbolsInfo);
|
|
3415
|
-
return useMemo(
|
|
3422
|
+
return useMemo(
|
|
3423
|
+
() => createGetter(symbolsInfo ? { ...symbolsInfo } : symbolsInfo),
|
|
3424
|
+
[symbolsInfo]
|
|
3425
|
+
);
|
|
3416
3426
|
};
|
|
3417
3427
|
var useSymbolsInfoStore = () => {
|
|
3418
3428
|
return useAppStore((state) => state.symbolsInfo);
|
|
@@ -3425,6 +3435,7 @@ var MarketsType = /* @__PURE__ */ ((MarketsType2) => {
|
|
|
3425
3435
|
MarketsType2[MarketsType2["ALL"] = 2] = "ALL";
|
|
3426
3436
|
MarketsType2[MarketsType2["RWA"] = 3] = "RWA";
|
|
3427
3437
|
MarketsType2[MarketsType2["NEW_LISTING"] = 4] = "NEW_LISTING";
|
|
3438
|
+
MarketsType2[MarketsType2["COMMUNITY"] = 5] = "COMMUNITY";
|
|
3428
3439
|
return MarketsType2;
|
|
3429
3440
|
})(MarketsType || {});
|
|
3430
3441
|
var MarketsStorageKey = "orderly_markets";
|
|
@@ -3594,6 +3605,8 @@ var addFieldToMarkets = (futures, symbolsInfo, rwaSymbolsInfo) => {
|
|
|
3594
3605
|
const rwaInfo = !rwaSymbolsInfo.isNil ? rwaSymbolsInfo[item.symbol]() : null;
|
|
3595
3606
|
return {
|
|
3596
3607
|
...item,
|
|
3608
|
+
broker_id: item.broker_id,
|
|
3609
|
+
display_symbol_name: item.display_symbol_name,
|
|
3597
3610
|
quote_dp: info("quote_dp"),
|
|
3598
3611
|
created_time: info("created_time"),
|
|
3599
3612
|
displayName: info("displayName"),
|
|
@@ -3615,7 +3628,7 @@ var addFieldToMarkets = (futures, symbolsInfo, rwaSymbolsInfo) => {
|
|
|
3615
3628
|
var filterMarkets = (params) => {
|
|
3616
3629
|
const { markets, favorites, recent, newListing, type } = params;
|
|
3617
3630
|
let curData = [];
|
|
3618
|
-
if (type === 2 /* ALL */) {
|
|
3631
|
+
if (type === 2 /* ALL */ || type === 5 /* COMMUNITY */) {
|
|
3619
3632
|
curData = markets;
|
|
3620
3633
|
} else if (type === 3 /* RWA */) {
|
|
3621
3634
|
curData = markets.filter((item) => item.isRwa);
|
|
@@ -4537,7 +4550,7 @@ var useMarket = (type) => {
|
|
|
4537
4550
|
const getData = (type2) => {
|
|
4538
4551
|
const localData = type2 === 0 /* FAVORITES */ ? [...favorites] : [...recent];
|
|
4539
4552
|
const keys = localData.map((item) => item.name);
|
|
4540
|
-
const filter = type2 == 2 /* ALL */ ? marketsList : marketsList?.filter((item) => keys.includes(item.symbol));
|
|
4553
|
+
const filter = type2 == 2 /* ALL */ || type2 == 4 /* COMMUNITY */ ? marketsList : marketsList?.filter((item) => keys.includes(item.symbol));
|
|
4541
4554
|
const favoritesData = [...favorites];
|
|
4542
4555
|
const favoriteKeys = favoritesData.map((item) => item.name);
|
|
4543
4556
|
if (filter) {
|
|
@@ -4736,6 +4749,80 @@ var useSymbolLeverageMap = () => {
|
|
|
4736
4749
|
refresh: mutate6
|
|
4737
4750
|
};
|
|
4738
4751
|
};
|
|
4752
|
+
|
|
4753
|
+
// src/trading-rewards/useAllBrokers.ts
|
|
4754
|
+
var useAllBrokers = () => {
|
|
4755
|
+
const { data } = useQuery("/v1/public/broker/name", {
|
|
4756
|
+
formatter: (res) => {
|
|
4757
|
+
const { rows } = res;
|
|
4758
|
+
return rows?.map((item) => ({ [item.broker_id]: item.broker_name })).reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
4759
|
+
},
|
|
4760
|
+
revalidateOnFocus: false
|
|
4761
|
+
});
|
|
4762
|
+
return [data];
|
|
4763
|
+
};
|
|
4764
|
+
|
|
4765
|
+
// src/useBadgeBySymbol.ts
|
|
4766
|
+
function brokerNameBaseFromRaw(rawBrokerName) {
|
|
4767
|
+
if (!rawBrokerName) return void 0;
|
|
4768
|
+
const first = rawBrokerName.trim().split(/[ _-]/, 1)[0]?.trim() ?? "";
|
|
4769
|
+
return first.length > 0 ? first : void 0;
|
|
4770
|
+
}
|
|
4771
|
+
var useBadgeBySymbol = (symbol) => {
|
|
4772
|
+
const symbolsInfo = useSymbolsInfo();
|
|
4773
|
+
const [brokers] = useAllBrokers();
|
|
4774
|
+
return useMemo(() => {
|
|
4775
|
+
if (!symbol || symbolsInfo.isNil) {
|
|
4776
|
+
return {
|
|
4777
|
+
displayName: symbol ?? "",
|
|
4778
|
+
brokerId: void 0,
|
|
4779
|
+
brokerName: void 0,
|
|
4780
|
+
brokerNameRaw: void 0
|
|
4781
|
+
};
|
|
4782
|
+
}
|
|
4783
|
+
const getter = symbolsInfo[symbol];
|
|
4784
|
+
const info = typeof getter === "function" ? getter() : void 0;
|
|
4785
|
+
const displayName = info?.displayName ?? info?.display_symbol_name ?? symbol;
|
|
4786
|
+
const brokerId = info?.broker_id ?? void 0;
|
|
4787
|
+
const rawBrokerName = brokerId ? brokers?.[brokerId] : void 0;
|
|
4788
|
+
const base = brokerNameBaseFromRaw(rawBrokerName);
|
|
4789
|
+
const brokerName = base ? base.length > 7 ? `${base.slice(0, 7)}...` : base : void 0;
|
|
4790
|
+
return {
|
|
4791
|
+
displayName,
|
|
4792
|
+
brokerId,
|
|
4793
|
+
brokerName,
|
|
4794
|
+
brokerNameRaw: rawBrokerName
|
|
4795
|
+
};
|
|
4796
|
+
}, [brokers, symbolsInfo, symbol]);
|
|
4797
|
+
};
|
|
4798
|
+
function formatSymbolWithBroker(symbol, symbolsInfo, brokers) {
|
|
4799
|
+
if (!symbol) return "";
|
|
4800
|
+
let brokerNameBase;
|
|
4801
|
+
if (!symbolsInfo.isNil) {
|
|
4802
|
+
const getter = symbolsInfo[symbol];
|
|
4803
|
+
const info = typeof getter === "function" ? getter() : void 0;
|
|
4804
|
+
const brokerId = info?.broker_id ?? void 0;
|
|
4805
|
+
const rawBrokerName = brokerId ? brokers?.[brokerId] : void 0;
|
|
4806
|
+
brokerNameBase = brokerNameBaseFromRaw(rawBrokerName);
|
|
4807
|
+
}
|
|
4808
|
+
const parts = symbol.split("_");
|
|
4809
|
+
const base = parts.length >= 3 ? parts[1] ?? "" : symbol.match(/^([A-Za-z]+)/)?.[1] ?? symbol;
|
|
4810
|
+
const hasBrokerSuffix = symbol.includes("-") || symbol.split("_").length > 3;
|
|
4811
|
+
if (brokerNameBase && hasBrokerSuffix) {
|
|
4812
|
+
return `${base}-${brokerNameBase}`;
|
|
4813
|
+
}
|
|
4814
|
+
return base;
|
|
4815
|
+
}
|
|
4816
|
+
var useSymbolWithBroker = (symbol) => {
|
|
4817
|
+
const symbolsInfo = useSymbolsInfo();
|
|
4818
|
+
const [brokers] = useAllBrokers();
|
|
4819
|
+
return useMemo(
|
|
4820
|
+
() => formatSymbolWithBroker(symbol, symbolsInfo, brokers),
|
|
4821
|
+
[brokers, symbolsInfo, symbol]
|
|
4822
|
+
);
|
|
4823
|
+
};
|
|
4824
|
+
|
|
4825
|
+
// src/orderly/useMarginModes.ts
|
|
4739
4826
|
var useMarginModes = () => {
|
|
4740
4827
|
const { data, error, isLoading, mutate: mutate6 } = usePrivateQuery("/v1/client/margin_modes", {
|
|
4741
4828
|
revalidateOnFocus: false,
|
|
@@ -4777,22 +4864,28 @@ var useMarginModes = () => {
|
|
|
4777
4864
|
};
|
|
4778
4865
|
var useMarginModeBySymbol = (symbol, fallback = MarginMode.CROSS) => {
|
|
4779
4866
|
const { marginModes, isLoading, error, refresh, updateMarginMode } = useMarginModes();
|
|
4780
|
-
const
|
|
4867
|
+
const { brokerId } = useBadgeBySymbol(symbol);
|
|
4868
|
+
const marginMode = useMemo(() => {
|
|
4869
|
+
if (brokerId) return MarginMode.ISOLATED;
|
|
4870
|
+
return fallback === null ? marginModes[symbol] : marginModes[symbol] ?? fallback;
|
|
4871
|
+
}, [brokerId, fallback, marginModes, symbol]);
|
|
4781
4872
|
const update = useCallback(
|
|
4782
4873
|
async (mode) => {
|
|
4874
|
+
if (brokerId) mode = MarginMode.ISOLATED;
|
|
4783
4875
|
return updateMarginMode({
|
|
4784
4876
|
symbol_list: [symbol],
|
|
4785
4877
|
default_margin_mode: mode
|
|
4786
4878
|
});
|
|
4787
4879
|
},
|
|
4788
|
-
[symbol, updateMarginMode]
|
|
4880
|
+
[brokerId, symbol, updateMarginMode]
|
|
4789
4881
|
);
|
|
4790
4882
|
return {
|
|
4791
4883
|
marginMode,
|
|
4792
4884
|
isLoading,
|
|
4793
4885
|
error,
|
|
4794
4886
|
refresh,
|
|
4795
|
-
update
|
|
4887
|
+
update,
|
|
4888
|
+
isPermissionlessListing: !!brokerId
|
|
4796
4889
|
};
|
|
4797
4890
|
};
|
|
4798
4891
|
|
|
@@ -5435,7 +5528,7 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5435
5528
|
if (!accountInfo || !fundingRates || !symbolsInfo) {
|
|
5436
5529
|
return data;
|
|
5437
5530
|
}
|
|
5438
|
-
let unrealPnL_total = zero, unrealPnL_total_index = zero, notional_total = zero, unsettlementPnL_total = zero;
|
|
5531
|
+
let unrealPnL_total = zero, unrealPnL_total_index = zero, notional_total = zero, unsettlementPnL_total = zero, totalUnsettledIsolatedPnl = zero, totalUnsettledCrossPnl = zero;
|
|
5439
5532
|
let rows = data.rows.map((item) => {
|
|
5440
5533
|
const info = symbolsInfo[item.symbol];
|
|
5441
5534
|
const sum_unitary_funding = fundingRates?.[item.symbol]?.["sum_unitary_funding"] ?? 0;
|
|
@@ -5498,6 +5591,12 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5498
5591
|
unrealPnL_total_index = unrealPnL_total_index.add(unrealPnl_index);
|
|
5499
5592
|
notional_total = notional_total.add(notional);
|
|
5500
5593
|
unsettlementPnL_total = unsettlementPnL_total.add(unsettlementPnL2);
|
|
5594
|
+
if (item.margin_mode === MarginMode.CROSS) {
|
|
5595
|
+
totalUnsettledCrossPnl = totalUnsettledCrossPnl.add(unsettlementPnL2);
|
|
5596
|
+
}
|
|
5597
|
+
if (item.margin_mode === MarginMode.ISOLATED) {
|
|
5598
|
+
totalUnsettledIsolatedPnl = totalUnsettledIsolatedPnl.add(unsettlementPnL2);
|
|
5599
|
+
}
|
|
5501
5600
|
const fundingFee = new Decimal(sum_unitary_funding).sub(item.last_sum_unitary_funding).mul(item.position_qty).negated().toNumber();
|
|
5502
5601
|
return {
|
|
5503
5602
|
...item,
|
|
@@ -5513,7 +5612,8 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5513
5612
|
unrealized_pnl: unrealPnl,
|
|
5514
5613
|
unrealized_pnl_index: unrealPnl_index,
|
|
5515
5614
|
unrealized_pnl_ROI: unrealPnlROI,
|
|
5516
|
-
unrealized_pnl_ROI_index: unrealPnlROI_index
|
|
5615
|
+
unrealized_pnl_ROI_index: unrealPnlROI_index,
|
|
5616
|
+
unsettled_pnl: unsettlementPnL2
|
|
5517
5617
|
};
|
|
5518
5618
|
});
|
|
5519
5619
|
const totalUnrealPnl = unrealPnL_total.toNumber();
|
|
@@ -5525,18 +5625,34 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5525
5625
|
rows = rows.map((item) => {
|
|
5526
5626
|
const info = symbolsInfo[item.symbol];
|
|
5527
5627
|
const totalCollateral = item.margin_mode === MarginMode.ISOLATED ? new Decimal(item.margin ?? 0).add(item.unsettlement_pnl ?? 0).toNumber() : crossMarginCollateral.toNumber();
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5628
|
+
let est_liq_price;
|
|
5629
|
+
if (item.margin_mode === MarginMode.ISOLATED) {
|
|
5630
|
+
est_liq_price = positions.liquidationPriceIsolated({
|
|
5631
|
+
isolatedPositionMargin: item.margin ?? 0,
|
|
5632
|
+
costPosition: item.cost_position ?? 0,
|
|
5633
|
+
positionQty: item.position_qty ?? 0,
|
|
5634
|
+
sumUnitaryFunding: fundingRates?.[item.symbol]?.["sum_unitary_funding"] ?? 0,
|
|
5635
|
+
lastSumUnitaryFunding: item.last_sum_unitary_funding ?? 0,
|
|
5636
|
+
baseMMR: info?.["base_mmr"] ?? 0,
|
|
5637
|
+
baseIMR: info?.["base_imr"] ?? 0,
|
|
5638
|
+
IMRFactor: accountInfo.imr_factor[item.symbol],
|
|
5639
|
+
referencePrice: item.mark_price,
|
|
5640
|
+
leverage: item.leverage ?? 0
|
|
5641
|
+
});
|
|
5642
|
+
} else {
|
|
5643
|
+
est_liq_price = positions.liqPrice({
|
|
5644
|
+
symbol: item.symbol,
|
|
5645
|
+
markPrice: item.mark_price,
|
|
5646
|
+
totalCollateral,
|
|
5647
|
+
positionQty: item.position_qty,
|
|
5648
|
+
positions: rows,
|
|
5649
|
+
MMR: item.mmr,
|
|
5650
|
+
baseMMR: info?.["base_mmr"],
|
|
5651
|
+
baseIMR: info?.["base_imr"],
|
|
5652
|
+
IMRFactor: accountInfo.imr_factor[item.symbol],
|
|
5653
|
+
costPosition: item.cost_position
|
|
5654
|
+
});
|
|
5655
|
+
}
|
|
5540
5656
|
return {
|
|
5541
5657
|
...item,
|
|
5542
5658
|
est_liq_price
|
|
@@ -5563,6 +5679,8 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5563
5679
|
total_unsettled_pnl: unsettlementPnL,
|
|
5564
5680
|
unrealPnlROI: totalUnrealizedROI,
|
|
5565
5681
|
unrealPnlROI_index: totalUnrealizedROI_index,
|
|
5682
|
+
total_unsettled_cross_pnl: totalUnsettledCrossPnl.toNumber(),
|
|
5683
|
+
total_unsettled_isolated_pnl: totalUnsettledIsolatedPnl.toNumber(),
|
|
5566
5684
|
rows
|
|
5567
5685
|
};
|
|
5568
5686
|
}
|
|
@@ -5725,13 +5843,9 @@ var PortfolioCalculator = class extends BaseCalculator {
|
|
|
5725
5843
|
if (!holding || !positions3 || !Array.isArray(positions3.rows) || !markPrices || !indexPrices || !accountInfo) {
|
|
5726
5844
|
return null;
|
|
5727
5845
|
}
|
|
5728
|
-
const
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
);
|
|
5732
|
-
const totalUnsettlementPnL = positions3.rows.reduce(
|
|
5733
|
-
(sum, pos) => sum + (pos.unsettled_pnl ?? 0),
|
|
5734
|
-
0
|
|
5846
|
+
const unsettledPnL = pathOr(0, ["total_unsettled_pnl"])(positions3);
|
|
5847
|
+
const unsettledCrossPnL = pathOr(0, ["total_unsettled_cross_pnl"])(
|
|
5848
|
+
positions3
|
|
5735
5849
|
);
|
|
5736
5850
|
const unrealizedPnL = pathOr(0, ["total_unreal_pnl"])(positions3);
|
|
5737
5851
|
const [USDC_holding, nonUSDC] = parseHolding(
|
|
@@ -5743,7 +5857,7 @@ var PortfolioCalculator = class extends BaseCalculator {
|
|
|
5743
5857
|
const totalCollateral = account.totalCollateral({
|
|
5744
5858
|
USDCHolding: USDC_holding,
|
|
5745
5859
|
nonUSDCHolding: nonUSDC,
|
|
5746
|
-
unsettlementPnL:
|
|
5860
|
+
unsettlementPnL: unsettledCrossPnL,
|
|
5747
5861
|
usdcBalancePendingShortQty: usdc?.pending_short ?? 0,
|
|
5748
5862
|
usdcBalanceIsolatedOrderFrozen: usdc?.isolated_order_frozen ?? 0
|
|
5749
5863
|
});
|
|
@@ -5754,7 +5868,7 @@ var PortfolioCalculator = class extends BaseCalculator {
|
|
|
5754
5868
|
return acc.add(curr.margin ?? 0);
|
|
5755
5869
|
}, zero);
|
|
5756
5870
|
const totalValue = account.totalValue({
|
|
5757
|
-
totalUnsettlementPnL,
|
|
5871
|
+
totalUnsettlementPnL: unsettledPnL,
|
|
5758
5872
|
USDCHolding: USDC_holding,
|
|
5759
5873
|
nonUSDCHolding: nonUSDC,
|
|
5760
5874
|
totalIsolatedPositionMargin: sumIsolatedMargin.toNumber()
|
|
@@ -5798,7 +5912,7 @@ var PortfolioCalculator = class extends BaseCalculator {
|
|
|
5798
5912
|
totalUnrealizedROI,
|
|
5799
5913
|
freeCollateral,
|
|
5800
5914
|
availableBalance,
|
|
5801
|
-
unsettledPnL
|
|
5915
|
+
unsettledPnL,
|
|
5802
5916
|
holding,
|
|
5803
5917
|
usdcHolding: USDC_holding,
|
|
5804
5918
|
freeCollateralUSDCOnly
|
|
@@ -5917,7 +6031,7 @@ var usePositionStream = (symbol = "all", options) => {
|
|
|
5917
6031
|
total_unreal_pnl: total_unreal_pnl_index,
|
|
5918
6032
|
unrealPnlROI: unrealPnlROI_index
|
|
5919
6033
|
};
|
|
5920
|
-
}, [calcMode]);
|
|
6034
|
+
}, [calcMode, formattedPositions]);
|
|
5921
6035
|
let rows = formattedPositions[0];
|
|
5922
6036
|
{
|
|
5923
6037
|
if (!rows) {
|
|
@@ -6407,14 +6521,8 @@ function formatPortfolio(inputs) {
|
|
|
6407
6521
|
if (!holding || !positions3 || !Array.isArray(positions3.rows) || !markPrices || !indexPrices || !accountInfo || symbolsInfo?.isNil) {
|
|
6408
6522
|
return null;
|
|
6409
6523
|
}
|
|
6410
|
-
const
|
|
6411
|
-
|
|
6412
|
-
0
|
|
6413
|
-
);
|
|
6414
|
-
const totalUnsettlementPnL = positions3.rows.reduce(
|
|
6415
|
-
(sum, pos) => sum + (pos.unsettled_pnl ?? 0),
|
|
6416
|
-
0
|
|
6417
|
-
);
|
|
6524
|
+
const unsettledPnL = pathOr(0, ["total_unsettled_pnl"])(positions3);
|
|
6525
|
+
const unsettledCrossPnL = pathOr(0, ["total_unsettled_cross_pnl"])(positions3);
|
|
6418
6526
|
const unrealizedPnL = pathOr(0, ["total_unreal_pnl"])(positions3);
|
|
6419
6527
|
const [USDC_holding, nonUSDC] = parseHolding(
|
|
6420
6528
|
holding,
|
|
@@ -6425,7 +6533,7 @@ function formatPortfolio(inputs) {
|
|
|
6425
6533
|
const totalCollateral = account.totalCollateral({
|
|
6426
6534
|
USDCHolding: USDC_holding,
|
|
6427
6535
|
nonUSDCHolding: nonUSDC,
|
|
6428
|
-
unsettlementPnL:
|
|
6536
|
+
unsettlementPnL: unsettledCrossPnL,
|
|
6429
6537
|
usdcBalancePendingShortQty: usdc?.pending_short ?? 0,
|
|
6430
6538
|
usdcBalanceIsolatedOrderFrozen: usdc?.isolated_order_frozen ?? 0
|
|
6431
6539
|
});
|
|
@@ -6436,7 +6544,7 @@ function formatPortfolio(inputs) {
|
|
|
6436
6544
|
return acc.add(curr.margin ?? 0);
|
|
6437
6545
|
}, zero);
|
|
6438
6546
|
const totalValue = account.totalValue({
|
|
6439
|
-
totalUnsettlementPnL,
|
|
6547
|
+
totalUnsettlementPnL: unsettledPnL,
|
|
6440
6548
|
USDCHolding: USDC_holding,
|
|
6441
6549
|
nonUSDCHolding: nonUSDC,
|
|
6442
6550
|
totalIsolatedPositionMargin: sumIsolatedMargin.toNumber()
|
|
@@ -6480,7 +6588,7 @@ function formatPortfolio(inputs) {
|
|
|
6480
6588
|
totalUnrealizedROI,
|
|
6481
6589
|
freeCollateral,
|
|
6482
6590
|
availableBalance,
|
|
6483
|
-
unsettledPnL
|
|
6591
|
+
unsettledPnL,
|
|
6484
6592
|
holding,
|
|
6485
6593
|
freeCollateralUSDCOnly
|
|
6486
6594
|
};
|
|
@@ -6489,7 +6597,7 @@ function formatPositions(data, accountInfo, symbolsInfo, fundingRates) {
|
|
|
6489
6597
|
if (!accountInfo || !fundingRates || !symbolsInfo) {
|
|
6490
6598
|
return data;
|
|
6491
6599
|
}
|
|
6492
|
-
let unrealPnL_total = zero, unrealPnL_total_index = zero, notional_total = zero, unsettlementPnL_total = zero;
|
|
6600
|
+
let unrealPnL_total = zero, unrealPnL_total_index = zero, notional_total = zero, unsettlementPnL_total = zero, totalUnsettledIsolatedPnl = zero, totalUnsettledCrossPnl = zero;
|
|
6493
6601
|
const rows = data.rows.map((item) => {
|
|
6494
6602
|
const info = symbolsInfo[item.symbol];
|
|
6495
6603
|
const notional = positions.notional(item.position_qty, item.mark_price);
|
|
@@ -6551,6 +6659,12 @@ function formatPositions(data, accountInfo, symbolsInfo, fundingRates) {
|
|
|
6551
6659
|
unrealPnL_total_index = unrealPnL_total_index.add(unrealPnl_index);
|
|
6552
6660
|
notional_total = notional_total.add(notional);
|
|
6553
6661
|
unsettlementPnL_total = unsettlementPnL_total.add(unsettlementPnL2);
|
|
6662
|
+
if (item.margin_mode === MarginMode.CROSS) {
|
|
6663
|
+
totalUnsettledCrossPnl = totalUnsettledCrossPnl.add(unsettlementPnL2);
|
|
6664
|
+
}
|
|
6665
|
+
if (item.margin_mode === MarginMode.ISOLATED) {
|
|
6666
|
+
totalUnsettledIsolatedPnl = totalUnsettledIsolatedPnl.add(unsettlementPnL2);
|
|
6667
|
+
}
|
|
6554
6668
|
return {
|
|
6555
6669
|
...item,
|
|
6556
6670
|
mm: positions.maintenanceMargin({
|
|
@@ -6564,7 +6678,8 @@ function formatPositions(data, accountInfo, symbolsInfo, fundingRates) {
|
|
|
6564
6678
|
unrealized_pnl: unrealPnl,
|
|
6565
6679
|
unrealized_pnl_index: unrealPnl_index,
|
|
6566
6680
|
unrealized_pnl_ROI: unrealPnlROI,
|
|
6567
|
-
unrealized_pnl_ROI_index: unrealPnlROI_index
|
|
6681
|
+
unrealized_pnl_ROI_index: unrealPnlROI_index,
|
|
6682
|
+
unsettled_pnl: unsettlementPnL2
|
|
6568
6683
|
};
|
|
6569
6684
|
});
|
|
6570
6685
|
const totalUnrealPnl = unrealPnL_total.toNumber();
|
|
@@ -6578,6 +6693,8 @@ function formatPositions(data, accountInfo, symbolsInfo, fundingRates) {
|
|
|
6578
6693
|
notional: notional_total.toNumber(),
|
|
6579
6694
|
unsettledPnL: unsettlementPnL,
|
|
6580
6695
|
total_unsettled_pnl: unsettlementPnL,
|
|
6696
|
+
total_unsettled_cross_pnl: totalUnsettledCrossPnl.toNumber(),
|
|
6697
|
+
total_unsettled_isolated_pnl: totalUnsettledIsolatedPnl.toNumber(),
|
|
6581
6698
|
rows
|
|
6582
6699
|
};
|
|
6583
6700
|
}
|
|
@@ -7960,7 +8077,9 @@ var useDeposit = (options) => {
|
|
|
7960
8077
|
const depositPromise = isNativeToken ? account9.assetsManager.depositNativeToken(inputs) : account9.assetsManager.deposit(inputs);
|
|
7961
8078
|
return depositPromise.then((result) => {
|
|
7962
8079
|
updateAllowanceWhenTxSuccess(result.hash);
|
|
7963
|
-
setBalance(
|
|
8080
|
+
setBalance(
|
|
8081
|
+
(value) => value ? new Decimal(value).sub(quantity).toString() : "0"
|
|
8082
|
+
);
|
|
7964
8083
|
track2(TrackerEventName.depositSuccess, {
|
|
7965
8084
|
wallet: state?.connectWallet?.name,
|
|
7966
8085
|
network: targetChain?.network_infos.name,
|
|
@@ -8012,16 +8131,16 @@ var useDeposit = (options) => {
|
|
|
8012
8131
|
};
|
|
8013
8132
|
function useBalance(options) {
|
|
8014
8133
|
const { srcToken, address, decimals, account: account9, status } = options;
|
|
8015
|
-
const [balance, setBalance] = useState(
|
|
8134
|
+
const [balance, setBalance] = useState(null);
|
|
8016
8135
|
const fetchBalance = useCallback(
|
|
8017
8136
|
async (address2, decimals2) => {
|
|
8018
8137
|
try {
|
|
8019
8138
|
if (isNativeTokenChecker(address2)) {
|
|
8020
|
-
return account9.assetsManager.getNativeBalance({
|
|
8139
|
+
return await account9.assetsManager.getNativeBalance({
|
|
8021
8140
|
decimals: decimals2
|
|
8022
8141
|
});
|
|
8023
8142
|
}
|
|
8024
|
-
return account9.assetsManager.getBalance(address2, {
|
|
8143
|
+
return await account9.assetsManager.getBalance(address2, {
|
|
8025
8144
|
decimals: decimals2
|
|
8026
8145
|
});
|
|
8027
8146
|
} catch (err) {
|
|
@@ -8070,11 +8189,13 @@ function useBalance(options) {
|
|
|
8070
8189
|
useEffect(() => {
|
|
8071
8190
|
if (swrBalance !== void 0) {
|
|
8072
8191
|
setBalance(swrBalance || "0");
|
|
8192
|
+
} else {
|
|
8193
|
+
setBalance(null);
|
|
8073
8194
|
}
|
|
8074
|
-
}, [swrBalance]);
|
|
8195
|
+
}, [swrBalance, address]);
|
|
8075
8196
|
return {
|
|
8076
8197
|
balance,
|
|
8077
|
-
balanceRevalidating,
|
|
8198
|
+
balanceRevalidating: balanceRevalidating || balance === null,
|
|
8078
8199
|
setBalance,
|
|
8079
8200
|
fetchBalance,
|
|
8080
8201
|
fetchBalances
|
|
@@ -9604,6 +9725,9 @@ var PriceValidationStrategy = class {
|
|
|
9604
9725
|
}
|
|
9605
9726
|
const price = new Decimal(order_price);
|
|
9606
9727
|
const { symbol } = config;
|
|
9728
|
+
if (!symbol) {
|
|
9729
|
+
return;
|
|
9730
|
+
}
|
|
9607
9731
|
const { quote_max, quote_min, quote_dp, price_range, price_scope } = symbol;
|
|
9608
9732
|
const maxPriceNumber = order.maxPrice(config.markPrice, price_range);
|
|
9609
9733
|
const minPriceNumber = order.minPrice(config.markPrice, price_range);
|
|
@@ -9650,6 +9774,9 @@ var TriggerPriceValidationStrategy = class {
|
|
|
9650
9774
|
validate(values, config) {
|
|
9651
9775
|
const { trigger_price } = values;
|
|
9652
9776
|
const { symbol } = config;
|
|
9777
|
+
if (!symbol) {
|
|
9778
|
+
return;
|
|
9779
|
+
}
|
|
9653
9780
|
const { quote_max, quote_min } = symbol;
|
|
9654
9781
|
if (!trigger_price) {
|
|
9655
9782
|
return OrderValidation.required("trigger_price");
|
|
@@ -9696,6 +9823,9 @@ var QuantityValidationStrategy = class {
|
|
|
9696
9823
|
validate(values, config) {
|
|
9697
9824
|
let { order_quantity, total, order_price } = values;
|
|
9698
9825
|
const { maxQty, symbol } = config;
|
|
9826
|
+
if (!symbol) {
|
|
9827
|
+
return;
|
|
9828
|
+
}
|
|
9699
9829
|
const { base_min, base_dp, quote_dp } = symbol;
|
|
9700
9830
|
if (!order_quantity && total && order_price) {
|
|
9701
9831
|
const totalNumber = new Decimal(total);
|
|
@@ -10951,7 +11081,7 @@ var calcEstLiqPrice = (order$1, askAndBid, inputs) => {
|
|
|
10951
11081
|
totalCollateral,
|
|
10952
11082
|
futures_taker_fee_rate,
|
|
10953
11083
|
positions: positions3,
|
|
10954
|
-
|
|
11084
|
+
symbolLeverage,
|
|
10955
11085
|
sumUnitaryFunding
|
|
10956
11086
|
} = inputs;
|
|
10957
11087
|
const orderFee = order.orderFee({
|
|
@@ -10976,7 +11106,7 @@ var calcEstLiqPrice = (order$1, askAndBid, inputs) => {
|
|
|
10976
11106
|
}
|
|
10977
11107
|
});
|
|
10978
11108
|
} else {
|
|
10979
|
-
let isolatedPositionMargin = 0, costPosition = 0, positionQty = 0, lastSumUnitaryFunding = 0, leverage = 1;
|
|
11109
|
+
let isolatedPositionMargin = 0, costPosition = 0, positionQty = 0, lastSumUnitaryFunding = 0, leverage = symbolLeverage ?? 1;
|
|
10980
11110
|
if (positions3) {
|
|
10981
11111
|
const position = positions3.find(
|
|
10982
11112
|
(p) => p.symbol === symbol && p.margin_mode === MarginMode.ISOLATED
|
|
@@ -12666,6 +12796,12 @@ var DataPaint = class extends BasePaint {
|
|
|
12666
12796
|
this.DEFAULT_LOSS_COLOR = "rgb(255,103,194)";
|
|
12667
12797
|
this.transformTop = 0;
|
|
12668
12798
|
this.QRCODE_SIZE = 56;
|
|
12799
|
+
this.BROKER_BADGE_HEIGHT = 18;
|
|
12800
|
+
this.BROKER_BADGE_PADDING_X = 8;
|
|
12801
|
+
this.BROKER_BADGE_RADIUS = 4;
|
|
12802
|
+
}
|
|
12803
|
+
formatMarginMode(marginMode) {
|
|
12804
|
+
return marginMode === MarginMode.ISOLATED ? "Isolated" : "Cross";
|
|
12669
12805
|
}
|
|
12670
12806
|
async draw(options) {
|
|
12671
12807
|
const needDrawDetails = Array.isArray(options.data?.position?.informations) && (options.data?.position?.informations?.length ?? 0) > 0;
|
|
@@ -12752,6 +12888,49 @@ var DataPaint = class extends BasePaint {
|
|
|
12752
12888
|
fontSize: this._ratio(fontSize),
|
|
12753
12889
|
fontFamily: options.fontFamily
|
|
12754
12890
|
});
|
|
12891
|
+
const brokerName = options.data?.position.brokerName?.trim();
|
|
12892
|
+
if (brokerName) {
|
|
12893
|
+
left += (prevElementBoundingBox.width ?? 0) + this._ratio(10);
|
|
12894
|
+
const badgeHeight = this._ratio(this.BROKER_BADGE_HEIGHT);
|
|
12895
|
+
const badgePaddingX = this._ratio(this.BROKER_BADGE_PADDING_X);
|
|
12896
|
+
const badgeRadius = this._ratio(this.BROKER_BADGE_RADIUS);
|
|
12897
|
+
const badgeFontSize = this._ratio(12);
|
|
12898
|
+
const badgeFontWeight = 600;
|
|
12899
|
+
const textMetrics = this._drawText(
|
|
12900
|
+
brokerName,
|
|
12901
|
+
{
|
|
12902
|
+
left: 0,
|
|
12903
|
+
top: 0,
|
|
12904
|
+
fontSize: badgeFontSize,
|
|
12905
|
+
fontWeight: badgeFontWeight,
|
|
12906
|
+
fontFamily: options.fontFamily
|
|
12907
|
+
},
|
|
12908
|
+
true
|
|
12909
|
+
);
|
|
12910
|
+
const badgeWidth = (textMetrics.width ?? 0) + badgePaddingX * 2;
|
|
12911
|
+
const badgeTop = this._ratio(top) - badgeHeight / 2;
|
|
12912
|
+
this._fillRoundedRect(
|
|
12913
|
+
left,
|
|
12914
|
+
badgeTop,
|
|
12915
|
+
badgeWidth,
|
|
12916
|
+
badgeHeight,
|
|
12917
|
+
badgeRadius,
|
|
12918
|
+
"rgba(255,255,255,0.06)"
|
|
12919
|
+
);
|
|
12920
|
+
this._drawText(brokerName, {
|
|
12921
|
+
color: "rgba(255,255,255,0.36)",
|
|
12922
|
+
left: left + badgePaddingX,
|
|
12923
|
+
top: badgeTop + badgeHeight / 2,
|
|
12924
|
+
fontSize: badgeFontSize,
|
|
12925
|
+
fontWeight: badgeFontWeight,
|
|
12926
|
+
fontFamily: options.fontFamily,
|
|
12927
|
+
textBaseline: "middle"
|
|
12928
|
+
});
|
|
12929
|
+
prevElementBoundingBox = {
|
|
12930
|
+
...prevElementBoundingBox,
|
|
12931
|
+
width: badgeWidth
|
|
12932
|
+
};
|
|
12933
|
+
}
|
|
12755
12934
|
}
|
|
12756
12935
|
const marginMode = options.data?.position.marginMode;
|
|
12757
12936
|
if (marginMode) {
|
|
@@ -12766,7 +12945,7 @@ var DataPaint = class extends BasePaint {
|
|
|
12766
12945
|
});
|
|
12767
12946
|
}
|
|
12768
12947
|
left += (prevElementBoundingBox.width ?? 0) + this._ratio(7);
|
|
12769
|
-
const marginModeText =
|
|
12948
|
+
const marginModeText = this.formatMarginMode(marginMode);
|
|
12770
12949
|
prevElementBoundingBox = this._drawText(marginModeText, {
|
|
12771
12950
|
color: layout.color,
|
|
12772
12951
|
left,
|
|
@@ -12799,6 +12978,20 @@ var DataPaint = class extends BasePaint {
|
|
|
12799
12978
|
);
|
|
12800
12979
|
}
|
|
12801
12980
|
}
|
|
12981
|
+
_fillRoundedRect(x, y, width, height, radius, color) {
|
|
12982
|
+
const r = Math.min(radius, width / 2, height / 2);
|
|
12983
|
+
this.ctx.save();
|
|
12984
|
+
this.ctx.fillStyle = color;
|
|
12985
|
+
this.ctx.beginPath();
|
|
12986
|
+
this.ctx.moveTo(x + r, y);
|
|
12987
|
+
this.ctx.arcTo(x + width, y, x + width, y + height, r);
|
|
12988
|
+
this.ctx.arcTo(x + width, y + height, x, y + height, r);
|
|
12989
|
+
this.ctx.arcTo(x, y + height, x, y, r);
|
|
12990
|
+
this.ctx.arcTo(x, y, x + width, y, r);
|
|
12991
|
+
this.ctx.closePath();
|
|
12992
|
+
this.ctx.fill();
|
|
12993
|
+
this.ctx.restore();
|
|
12994
|
+
}
|
|
12802
12995
|
drawUnrealizedPnL(options, offsetTop = 0) {
|
|
12803
12996
|
const layout = path(
|
|
12804
12997
|
["layout", "unrealizedPnl"],
|
|
@@ -13252,18 +13445,6 @@ var useEpochInfo = (type) => {
|
|
|
13252
13445
|
}, [epochInfo]);
|
|
13253
13446
|
return [epochInfo, { isLoading, curEpochInfo, isNotStared, refresh }];
|
|
13254
13447
|
};
|
|
13255
|
-
|
|
13256
|
-
// src/trading-rewards/useAllBrokers.ts
|
|
13257
|
-
var useAllBrokers = () => {
|
|
13258
|
-
const { data } = useQuery("/v1/public/broker/name", {
|
|
13259
|
-
formatter: (res) => {
|
|
13260
|
-
const { rows } = res;
|
|
13261
|
-
return rows?.map((item) => ({ [item.broker_id]: item.broker_name })).reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
13262
|
-
},
|
|
13263
|
-
revalidateOnFocus: false
|
|
13264
|
-
});
|
|
13265
|
-
return [data];
|
|
13266
|
-
};
|
|
13267
13448
|
var useCurEpochEstimate = (type) => {
|
|
13268
13449
|
const [data, setData] = useState(void 0);
|
|
13269
13450
|
const { account: account9 } = useAccount();
|
|
@@ -18399,108 +18580,65 @@ var initialOrderState = {
|
|
|
18399
18580
|
tp_trigger_price: "",
|
|
18400
18581
|
sl_trigger_price: "",
|
|
18401
18582
|
total: "",
|
|
18402
|
-
symbol: ""
|
|
18583
|
+
symbol: "",
|
|
18584
|
+
side: OrderSide.BUY,
|
|
18585
|
+
order_type: OrderType.LIMIT,
|
|
18586
|
+
margin_mode: MarginMode.CROSS
|
|
18403
18587
|
};
|
|
18404
|
-
var
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
...
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
|
|
18414
|
-
|
|
18415
|
-
initOrder: (
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
|
|
18421
|
-
|
|
18422
|
-
margin_mode: options?.margin_mode ?? MarginMode.CROSS
|
|
18423
|
-
};
|
|
18424
|
-
state.estLeverage = null;
|
|
18425
|
-
state.estLiquidationPrice = null;
|
|
18426
|
-
state.errors = {};
|
|
18588
|
+
var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
18589
|
+
const { symbolInfo, symbolLeverage } = options;
|
|
18590
|
+
const [orderEntity, setOrderEntity] = useState(
|
|
18591
|
+
() => ({
|
|
18592
|
+
...initialOrderState,
|
|
18593
|
+
...options.initialOrder,
|
|
18594
|
+
symbol
|
|
18595
|
+
})
|
|
18596
|
+
);
|
|
18597
|
+
const actions = useMemo(
|
|
18598
|
+
() => ({
|
|
18599
|
+
initOrder: (sym, opts) => {
|
|
18600
|
+
setOrderEntity({
|
|
18601
|
+
...initialOrderState,
|
|
18602
|
+
symbol: sym,
|
|
18603
|
+
side: opts?.side ?? OrderSide.BUY,
|
|
18604
|
+
order_type: opts?.order_type ?? OrderType.LIMIT,
|
|
18605
|
+
margin_mode: opts?.margin_mode ?? MarginMode.CROSS
|
|
18427
18606
|
});
|
|
18428
18607
|
},
|
|
18429
|
-
hasTP_SL: () => {
|
|
18430
|
-
const order = get3().entry;
|
|
18431
|
-
return typeof order.tp_trigger_price !== "undefined" || typeof order.sl_trigger_price !== "undefined";
|
|
18432
|
-
},
|
|
18433
|
-
updateOrderComputed: (data) => {
|
|
18434
|
-
set(
|
|
18435
|
-
(state) => {
|
|
18436
|
-
state.estLeverage = data.estLeverage;
|
|
18437
|
-
state.estLiquidationPrice = data.estLiquidationPrice;
|
|
18438
|
-
},
|
|
18439
|
-
false
|
|
18440
|
-
// "updateOrderComputed"
|
|
18441
|
-
);
|
|
18442
|
-
},
|
|
18443
18608
|
updateOrder: (order) => {
|
|
18444
|
-
|
|
18445
|
-
(state) => {
|
|
18446
|
-
state.entry = {
|
|
18447
|
-
...state.entry,
|
|
18448
|
-
...order
|
|
18449
|
-
};
|
|
18450
|
-
},
|
|
18451
|
-
false
|
|
18452
|
-
// "updateOrder"
|
|
18453
|
-
);
|
|
18609
|
+
setOrderEntity((prev) => ({ ...prev, ...order }));
|
|
18454
18610
|
},
|
|
18455
18611
|
updateOrderByKey: (key, value) => {
|
|
18456
|
-
|
|
18457
|
-
(state) => {
|
|
18458
|
-
state.entry[key] = value;
|
|
18459
|
-
},
|
|
18460
|
-
false
|
|
18461
|
-
// "updateOrderByKey"
|
|
18462
|
-
);
|
|
18463
|
-
},
|
|
18464
|
-
restoreOrder: (order) => {
|
|
18465
|
-
set(
|
|
18466
|
-
(state) => {
|
|
18467
|
-
state.entry = order;
|
|
18468
|
-
},
|
|
18469
|
-
false
|
|
18470
|
-
// "restoreOrder"
|
|
18471
|
-
);
|
|
18612
|
+
setOrderEntity((prev) => ({ ...prev, [key]: value }));
|
|
18472
18613
|
},
|
|
18473
18614
|
resetOrder: (_order) => {
|
|
18474
|
-
|
|
18475
|
-
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
|
|
18480
|
-
|
|
18481
|
-
|
|
18482
|
-
|
|
18483
|
-
|
|
18484
|
-
|
|
18485
|
-
|
|
18486
|
-
|
|
18487
|
-
|
|
18488
|
-
|
|
18489
|
-
|
|
18490
|
-
|
|
18491
|
-
|
|
18615
|
+
setOrderEntity((prev) => ({
|
|
18616
|
+
...prev,
|
|
18617
|
+
order_price: "",
|
|
18618
|
+
order_quantity: "",
|
|
18619
|
+
trigger_price: "",
|
|
18620
|
+
total: "",
|
|
18621
|
+
tp_trigger_price: "",
|
|
18622
|
+
tp_pnl: "",
|
|
18623
|
+
tp_offset: "",
|
|
18624
|
+
tp_offset_percentage: "",
|
|
18625
|
+
sl_trigger_price: "",
|
|
18626
|
+
sl_pnl: "",
|
|
18627
|
+
sl_offset: "",
|
|
18628
|
+
sl_offset_percentage: ""
|
|
18629
|
+
}));
|
|
18630
|
+
},
|
|
18631
|
+
hasTP_SL: () => {
|
|
18632
|
+
const order = orderEntity;
|
|
18633
|
+
return typeof order.tp_trigger_price !== "undefined" || typeof order.sl_trigger_price !== "undefined";
|
|
18492
18634
|
}
|
|
18493
|
-
}
|
|
18494
|
-
|
|
18495
|
-
);
|
|
18496
|
-
var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
18497
|
-
const { symbolInfo, symbolLeverage } = options;
|
|
18498
|
-
const orderEntity = useOrderStore((state) => state.entry);
|
|
18499
|
-
const orderEntryActions = useOrderStore((state) => state.actions);
|
|
18635
|
+
}),
|
|
18636
|
+
[orderEntity]
|
|
18637
|
+
);
|
|
18500
18638
|
useEffect(() => {
|
|
18501
|
-
|
|
18639
|
+
actions.initOrder(symbol, options.initialOrder);
|
|
18502
18640
|
if (options.initialOrder) {
|
|
18503
|
-
|
|
18641
|
+
actions.updateOrder(options.initialOrder);
|
|
18504
18642
|
}
|
|
18505
18643
|
}, [symbol]);
|
|
18506
18644
|
const calculate2 = useCallback(
|
|
@@ -18518,10 +18656,10 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18518
18656
|
);
|
|
18519
18657
|
const setValue = (key, value, additional) => {
|
|
18520
18658
|
if (!symbolInfo) {
|
|
18521
|
-
|
|
18659
|
+
actions.updateOrderByKey(key, value);
|
|
18522
18660
|
return;
|
|
18523
18661
|
}
|
|
18524
|
-
const currentEntry =
|
|
18662
|
+
const currentEntry = orderEntity;
|
|
18525
18663
|
const { markPrice } = additional ?? { markPrice: 0 };
|
|
18526
18664
|
let newValues = calculate2(
|
|
18527
18665
|
{ ...currentEntry },
|
|
@@ -18555,7 +18693,7 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18555
18693
|
if (sl_ROI) {
|
|
18556
18694
|
newValues.sl_ROI = sl_ROI;
|
|
18557
18695
|
}
|
|
18558
|
-
|
|
18696
|
+
actions.updateOrder(newValues);
|
|
18559
18697
|
return newValues;
|
|
18560
18698
|
};
|
|
18561
18699
|
const calculateTPSL = (key, newValues, markPrice, symbolInfo2) => {
|
|
@@ -18602,11 +18740,10 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18602
18740
|
};
|
|
18603
18741
|
const setValues = (values, additional) => {
|
|
18604
18742
|
if (!symbolInfo) {
|
|
18605
|
-
|
|
18743
|
+
actions.updateOrder(values);
|
|
18606
18744
|
return;
|
|
18607
18745
|
}
|
|
18608
|
-
|
|
18609
|
-
let newValues = { ...currentEntry };
|
|
18746
|
+
let newValues = { ...orderEntity };
|
|
18610
18747
|
Object.keys(values).forEach((key) => {
|
|
18611
18748
|
newValues = calculate2(
|
|
18612
18749
|
newValues,
|
|
@@ -18616,17 +18753,28 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18616
18753
|
symbolInfo
|
|
18617
18754
|
);
|
|
18618
18755
|
});
|
|
18619
|
-
|
|
18756
|
+
actions.updateOrder(newValues);
|
|
18757
|
+
return newValues;
|
|
18758
|
+
};
|
|
18759
|
+
const setValuesRaw = (values) => {
|
|
18760
|
+
if (!symbolInfo) {
|
|
18761
|
+
actions.updateOrder(values);
|
|
18762
|
+
return;
|
|
18763
|
+
}
|
|
18764
|
+
const newValues = {
|
|
18765
|
+
...orderEntity,
|
|
18766
|
+
...values
|
|
18767
|
+
};
|
|
18768
|
+
actions.updateOrder(newValues);
|
|
18620
18769
|
return newValues;
|
|
18621
18770
|
};
|
|
18622
18771
|
const onMarkPriceUpdated = useCallback(
|
|
18623
18772
|
(markPrice, baseOn = []) => {
|
|
18624
18773
|
if (!options.symbolInfo) return;
|
|
18625
|
-
|
|
18626
|
-
let newValues = { ...currentEntry };
|
|
18774
|
+
let newValues = { ...orderEntity };
|
|
18627
18775
|
if (baseOn.length === 0) {
|
|
18628
18776
|
newValues = calculate2(
|
|
18629
|
-
{ ...
|
|
18777
|
+
{ ...orderEntity },
|
|
18630
18778
|
"order_price",
|
|
18631
18779
|
markPrice,
|
|
18632
18780
|
markPrice,
|
|
@@ -18637,7 +18785,7 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18637
18785
|
newValues = calculate2(
|
|
18638
18786
|
{ ...newValues },
|
|
18639
18787
|
key,
|
|
18640
|
-
|
|
18788
|
+
orderEntity[key],
|
|
18641
18789
|
markPrice,
|
|
18642
18790
|
options.symbolInfo
|
|
18643
18791
|
);
|
|
@@ -18656,9 +18804,9 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18656
18804
|
newValues.sl_ROI = sl_ROI;
|
|
18657
18805
|
}
|
|
18658
18806
|
}
|
|
18659
|
-
|
|
18807
|
+
actions.updateOrder(newValues);
|
|
18660
18808
|
},
|
|
18661
|
-
[calculate2, options.symbolInfo,
|
|
18809
|
+
[calculate2, options.symbolInfo, symbolLeverage, orderEntity]
|
|
18662
18810
|
);
|
|
18663
18811
|
const validate = (order, creator, options2) => {
|
|
18664
18812
|
return creator?.validate(order, {
|
|
@@ -18676,12 +18824,13 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18676
18824
|
const submitOrder = useCallback(() => {
|
|
18677
18825
|
}, [orderEntity]);
|
|
18678
18826
|
const resetOrder = (order) => {
|
|
18679
|
-
|
|
18827
|
+
actions.resetOrder(order);
|
|
18680
18828
|
};
|
|
18681
18829
|
return {
|
|
18682
18830
|
formattedOrder: orderEntity,
|
|
18683
18831
|
setValue,
|
|
18684
18832
|
setValues,
|
|
18833
|
+
setValuesRaw,
|
|
18685
18834
|
submit: submitOrder,
|
|
18686
18835
|
reset: resetOrder,
|
|
18687
18836
|
generateOrder,
|
|
@@ -18697,6 +18846,8 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
18697
18846
|
}
|
|
18698
18847
|
const ee = useEventEmitter();
|
|
18699
18848
|
const { track: track2 } = useTrack();
|
|
18849
|
+
const apiBaseUrl = useConfig("apiBaseUrl");
|
|
18850
|
+
const fetchSymbols = useSymbolStore((state) => state.fetchData);
|
|
18700
18851
|
const [meta, setMeta] = useState({
|
|
18701
18852
|
dirty: {},
|
|
18702
18853
|
submitted: false,
|
|
@@ -18716,8 +18867,7 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
18716
18867
|
const symbolConfig = useSymbolsInfo();
|
|
18717
18868
|
const accountInfo = useAccountInfo();
|
|
18718
18869
|
const positions3 = usePositions();
|
|
18719
|
-
const
|
|
18720
|
-
const effectiveMarginMode = options?.initialOrder?.margin_mode ?? entry?.margin_mode ?? MarginMode.CROSS;
|
|
18870
|
+
const effectiveMarginMode = options?.initialOrder?.margin_mode ?? MarginMode.CROSS;
|
|
18721
18871
|
const symbolLeverage = useLeverageBySymbol(symbol, effectiveMarginMode);
|
|
18722
18872
|
const symbolInfo = symbolConfig[symbol]();
|
|
18723
18873
|
const markPrice = actions.getMarkPriceBySymbol(symbol);
|
|
@@ -18726,6 +18876,7 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
18726
18876
|
formattedOrder,
|
|
18727
18877
|
setValue: setValueInternal,
|
|
18728
18878
|
setValues: setValuesInternal,
|
|
18879
|
+
setValuesRaw: setValuesRawInternal,
|
|
18729
18880
|
validate,
|
|
18730
18881
|
generateOrder,
|
|
18731
18882
|
reset,
|
|
@@ -18950,6 +19101,21 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
18950
19101
|
interactiveValidate(newValues);
|
|
18951
19102
|
}
|
|
18952
19103
|
};
|
|
19104
|
+
const setValuesRaw = (values) => {
|
|
19105
|
+
if (!Object.keys(values).every(
|
|
19106
|
+
(key) => canSetTPSLPrice(
|
|
19107
|
+
key,
|
|
19108
|
+
values[key],
|
|
19109
|
+
formattedOrder.order_type
|
|
19110
|
+
)
|
|
19111
|
+
)) {
|
|
19112
|
+
return;
|
|
19113
|
+
}
|
|
19114
|
+
const newValues = setValuesRawInternal(values);
|
|
19115
|
+
if (newValues) {
|
|
19116
|
+
interactiveValidate(newValues);
|
|
19117
|
+
}
|
|
19118
|
+
};
|
|
18953
19119
|
async function validateFunc(order) {
|
|
18954
19120
|
const creator = getOrderCreator(order);
|
|
18955
19121
|
return validate(order, creator, prepareData());
|
|
@@ -19004,11 +19170,12 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19004
19170
|
markPrice: markPrice2,
|
|
19005
19171
|
totalCollateral,
|
|
19006
19172
|
futures_taker_fee_rate: accountInfo.futures_taker_fee_rate,
|
|
19007
|
-
imr_factor: accountInfo.imr_factor[symbol],
|
|
19173
|
+
imr_factor: accountInfo.imr_factor?.[symbol] ?? 0,
|
|
19008
19174
|
symbol,
|
|
19009
19175
|
positions: positions3,
|
|
19010
19176
|
symbolInfo,
|
|
19011
|
-
sumUnitaryFunding
|
|
19177
|
+
sumUnitaryFunding,
|
|
19178
|
+
symbolLeverage
|
|
19012
19179
|
});
|
|
19013
19180
|
return estLiqPrice2;
|
|
19014
19181
|
}, [
|
|
@@ -19019,7 +19186,8 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19019
19186
|
symbol,
|
|
19020
19187
|
maxQty,
|
|
19021
19188
|
symbolInfo,
|
|
19022
|
-
fundingRates
|
|
19189
|
+
fundingRates,
|
|
19190
|
+
symbolLeverage
|
|
19023
19191
|
]);
|
|
19024
19192
|
const estLiqPriceDistance = useMemo(() => {
|
|
19025
19193
|
if (!estLiqPrice) {
|
|
@@ -19091,6 +19259,9 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19091
19259
|
orders: appendOrderMetadata(order.orders, orderMetadata)
|
|
19092
19260
|
} : appendOrderMetadata(order, orderMetadata);
|
|
19093
19261
|
const result = await doCreateOrder(params);
|
|
19262
|
+
if (!result.success && (order.order_type === OrderType.MARKET || order.order_type === OrderType.STOP_MARKET)) {
|
|
19263
|
+
void fetchSymbols(apiBaseUrl);
|
|
19264
|
+
}
|
|
19094
19265
|
if (result.success) {
|
|
19095
19266
|
let trackParams = {
|
|
19096
19267
|
side: order.side,
|
|
@@ -19158,6 +19329,7 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19158
19329
|
freeCollateral: effectiveMarginMode === MarginMode.ISOLATED ? freeCollateralUSDCOnly : freeCollateral,
|
|
19159
19330
|
setValue: useMemoizedFn(setValue),
|
|
19160
19331
|
setValues: useMemoizedFn(setValues),
|
|
19332
|
+
setValuesRaw: useMemoizedFn(setValuesRaw),
|
|
19161
19333
|
symbolInfo: symbolInfo || EMPTY_OBJECT,
|
|
19162
19334
|
metaState: meta,
|
|
19163
19335
|
isMutating,
|
|
@@ -19165,6 +19337,107 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19165
19337
|
symbolLeverage
|
|
19166
19338
|
};
|
|
19167
19339
|
};
|
|
19340
|
+
var initialOrderState2 = {
|
|
19341
|
+
order_price: "",
|
|
19342
|
+
order_quantity: "",
|
|
19343
|
+
trigger_price: "",
|
|
19344
|
+
tp_trigger_price: "",
|
|
19345
|
+
sl_trigger_price: "",
|
|
19346
|
+
total: "",
|
|
19347
|
+
symbol: ""
|
|
19348
|
+
};
|
|
19349
|
+
var useOrderStore = create()(
|
|
19350
|
+
immer((set, get3) => ({
|
|
19351
|
+
entry: {
|
|
19352
|
+
side: OrderSide.BUY,
|
|
19353
|
+
order_type: OrderType.LIMIT,
|
|
19354
|
+
...initialOrderState2
|
|
19355
|
+
},
|
|
19356
|
+
estLeverage: null,
|
|
19357
|
+
estLiquidationPrice: null,
|
|
19358
|
+
errors: {},
|
|
19359
|
+
actions: {
|
|
19360
|
+
initOrder: (symbol, options) => {
|
|
19361
|
+
set((state) => {
|
|
19362
|
+
state.entry = {
|
|
19363
|
+
...initialOrderState2,
|
|
19364
|
+
symbol,
|
|
19365
|
+
side: options?.side ?? OrderSide.BUY,
|
|
19366
|
+
order_type: options?.order_type ?? OrderType.LIMIT,
|
|
19367
|
+
margin_mode: options?.margin_mode ?? MarginMode.CROSS
|
|
19368
|
+
};
|
|
19369
|
+
state.estLeverage = null;
|
|
19370
|
+
state.estLiquidationPrice = null;
|
|
19371
|
+
state.errors = {};
|
|
19372
|
+
});
|
|
19373
|
+
},
|
|
19374
|
+
hasTP_SL: () => {
|
|
19375
|
+
const order = get3().entry;
|
|
19376
|
+
return typeof order.tp_trigger_price !== "undefined" || typeof order.sl_trigger_price !== "undefined";
|
|
19377
|
+
},
|
|
19378
|
+
updateOrderComputed: (data) => {
|
|
19379
|
+
set(
|
|
19380
|
+
(state) => {
|
|
19381
|
+
state.estLeverage = data.estLeverage;
|
|
19382
|
+
state.estLiquidationPrice = data.estLiquidationPrice;
|
|
19383
|
+
},
|
|
19384
|
+
false
|
|
19385
|
+
// "updateOrderComputed"
|
|
19386
|
+
);
|
|
19387
|
+
},
|
|
19388
|
+
updateOrder: (order) => {
|
|
19389
|
+
set(
|
|
19390
|
+
(state) => {
|
|
19391
|
+
state.entry = {
|
|
19392
|
+
...state.entry,
|
|
19393
|
+
...order
|
|
19394
|
+
};
|
|
19395
|
+
},
|
|
19396
|
+
false
|
|
19397
|
+
// "updateOrder"
|
|
19398
|
+
);
|
|
19399
|
+
},
|
|
19400
|
+
updateOrderByKey: (key, value) => {
|
|
19401
|
+
set(
|
|
19402
|
+
(state) => {
|
|
19403
|
+
state.entry[key] = value;
|
|
19404
|
+
},
|
|
19405
|
+
false
|
|
19406
|
+
// "updateOrderByKey"
|
|
19407
|
+
);
|
|
19408
|
+
},
|
|
19409
|
+
restoreOrder: (order) => {
|
|
19410
|
+
set(
|
|
19411
|
+
(state) => {
|
|
19412
|
+
state.entry = order;
|
|
19413
|
+
},
|
|
19414
|
+
false
|
|
19415
|
+
// "restoreOrder"
|
|
19416
|
+
);
|
|
19417
|
+
},
|
|
19418
|
+
resetOrder: (_order) => {
|
|
19419
|
+
set(
|
|
19420
|
+
(state) => {
|
|
19421
|
+
state.entry.order_price = "";
|
|
19422
|
+
state.entry.order_quantity = "";
|
|
19423
|
+
state.entry.trigger_price = "";
|
|
19424
|
+
state.entry.total = "";
|
|
19425
|
+
state.entry.tp_trigger_price = "";
|
|
19426
|
+
state.entry.tp_pnl = "";
|
|
19427
|
+
state.entry.tp_offset = "";
|
|
19428
|
+
state.entry.tp_offset_percentage = "";
|
|
19429
|
+
state.entry.sl_trigger_price = "";
|
|
19430
|
+
state.entry.sl_pnl = "";
|
|
19431
|
+
state.entry.sl_offset = "";
|
|
19432
|
+
state.entry.sl_offset_percentage = "";
|
|
19433
|
+
},
|
|
19434
|
+
true
|
|
19435
|
+
// "resetOrder"
|
|
19436
|
+
);
|
|
19437
|
+
}
|
|
19438
|
+
}
|
|
19439
|
+
}))
|
|
19440
|
+
);
|
|
19168
19441
|
var useOrderEntity = (order, options) => {
|
|
19169
19442
|
const { symbol } = order;
|
|
19170
19443
|
const { maxQty } = options || {};
|
|
@@ -19614,6 +19887,6 @@ var FlagKeys = /* @__PURE__ */ ((FlagKeys2) => {
|
|
|
19614
19887
|
return FlagKeys2;
|
|
19615
19888
|
})(FlagKeys || {});
|
|
19616
19889
|
|
|
19617
|
-
export { DefaultLayoutConfig, DistributionId, ENVType2 as ENVType, ERROR_MSG_CODES, EpochStatus, ExtendedConfigStore, FlagKeys, MaintenanceStatus, MarketsStorageKey, MarketsType, ORDERLY_ORDERBOOK_DEPTH_KEY, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, StatusProvider, TWType, WalletConnectorContext, WsNetworkStatus, checkNotional, cleanStringStyle, fetcher, findPositionTPSLFromOrders, findTPSLFromOrder, findTPSLOrderPriceFromOrder, getMinNotional, getPriceKey, indexedDBManager, initializeAppDatabase, isCurrentlyClosed, isCurrentlyTrading, noCacheConfig, parseJSON, persistIndexedDB, resetTimestampOffsetState, timestampWaitingMiddleware, useAccount, useAccountInfo2 as useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAppStore, useAssetsHistory, useAudioPlayer, useBalanceSubscription, useBalanceTopic, useBoolean, useChain, useChainInfo, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEstLiqPriceBySymbol, useEventEmitter, useFeatureFlag, useFeeState, useFundingDetails, useFundingFeeHistory, useFundingRate, useFundingRateBySymbol, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetEstLiqPrice, useGetReferralCode, useGetRwaSymbolCloseTimeInterval, useGetRwaSymbolInfo, useGetRwaSymbolOpenStatus, useGetRwaSymbolOpenTimeInterval, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useInitRwaSymbolsRuntime, useInternalTransfer, useKeyStore, useLazyQuery, useLeverage, useLeverageBySymbol, useLocalStorage, useMainTokenStore, useMainnetChainsStore, useMaintenanceStatus, useMarginModeBySymbol, useMarginModes, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketList, useMarketMap, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxLeverage, useMaxQty, useMaxWithdrawal, useMediaQuery, useMemoizedFn, useMutation, useNetworkInfo, useOdosQuote, useOrderEntity, useOrderEntry2 as useOrderEntry, useOrderEntry as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, useOrderlyContext, usePortfolio, usePositionActions, usePositionClose, usePositionStream, usePositions, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useRwaSymbolsInfo, useRwaSymbolsInfoStore, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountAlgoOrderStream, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSwapSupportStore, useSymbolInfo, useSymbolLeverage, useSymbolLeverageMap, useSymbolPriceRange, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTestTokenStore, useTestnetChainsStore, useTickerStream, useTokenInfo, useTokensInfo, useTpslPriceChecker, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useUpdatedRef, useUserStatistics, useVaultsHistory, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWalletTopic, useWithdraw, useWsStatus, utils_exports as utils, version_default as version };
|
|
19890
|
+
export { DefaultLayoutConfig, DistributionId, ENVType2 as ENVType, ERROR_MSG_CODES, EpochStatus, ExtendedConfigStore, FlagKeys, MaintenanceStatus, MarketCategoriesConfigProvider, MarketsStorageKey, MarketsType, ORDERLY_ORDERBOOK_DEPTH_KEY, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, StatusProvider, TWType, WalletConnectorContext, WsNetworkStatus, checkNotional, cleanStringStyle, fetcher, findPositionTPSLFromOrders, findTPSLFromOrder, findTPSLOrderPriceFromOrder, formatSymbolWithBroker, getMinNotional, getPriceKey, indexedDBManager, initializeAppDatabase, isCurrentlyClosed, isCurrentlyTrading, noCacheConfig, parseJSON, persistIndexedDB, resetTimestampOffsetState, timestampWaitingMiddleware, useAccount, useAccountInfo2 as useAccountInfo, useAccountInstance, useAccountRewardsHistory, useAllBrokers, useApiKeyManager, useAppStore, useAssetsHistory, useAudioPlayer, useBadgeBySymbol, useBalanceSubscription, useBalanceTopic, useBoolean, useChain, useChainInfo, useChains, useCheckReferralCode, useCollateral, useCommission, useComputedLTV, useConfig, useConvert, useCurEpochEstimate, useDaily, useDeposit, useDistribution, useDistributionHistory, useEpochInfo, useEstLiqPriceBySymbol, useEventEmitter, useFeatureFlag, useFeeState, useFundingDetails, useFundingFeeHistory, useFundingRate, useFundingRateBySymbol, useFundingRateHistory, useFundingRates, useFundingRatesStore, useGetClaimed, useGetEnv, useGetEstLiqPrice, useGetReferralCode, useGetRwaSymbolCloseTimeInterval, useGetRwaSymbolInfo, useGetRwaSymbolOpenStatus, useGetRwaSymbolOpenTimeInterval, useHoldingStream, useIndexPrice, useIndexPricesStream, useInfiniteQuery, useInitRwaSymbolsRuntime, useInternalTransfer, useKeyStore, useLazyQuery, useLeverage, useLeverageBySymbol, useLocalStorage, useMainTokenStore, useMainnetChainsStore, useMaintenanceStatus, useMarginModeBySymbol, useMarginModes, useMarginRatio, useMarkPrice, useMarkPriceBySymbol, useMarkPricesStream, useMarket, useMarketCategoriesConfig, useMarketList, useMarketMap, useMarketTradeStream, useMarkets, useMarketsStore, useMarketsStream, useMaxLeverage, useMaxQty, useMaxWithdrawal, useMediaQuery, useMemoizedFn, useMutation, useNetworkInfo, useOdosQuote, useOrderEntity, useOrderEntry2 as useOrderEntry, useOrderEntry as useOrderEntry_deprecated, useOrderStore, useOrderStream, useOrderbookStream, useOrderlyContext, usePortfolio, usePositionActions, usePositionClose, usePositionStream, usePositions, usePoster, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useRefereeHistory, useRefereeInfo, useRefereeRebateSummary, useReferralInfo, useReferralRebateSummary, useRestrictedInfo, useRwaSymbolsInfo, useRwaSymbolsInfoStore, useSessionStorage, useSettleSubscription, useSimpleDI, useStatisticsDaily, useStorageChain, useStorageLedgerAddress, useSubAccountAlgoOrderStream, useSubAccountDataObserver, useSubAccountMaxWithdrawal, useSubAccountMutation, useSubAccountQuery, useSubAccountWS, useSwapSupportStore, useSymbolInfo, useSymbolLeverage, useSymbolLeverageMap, useSymbolPriceRange, useSymbolWithBroker, useSymbolsInfo, useSymbolsInfoStore, useTPSLOrder, useTestTokenStore, useTestnetChainsStore, useTickerStream, useTokenInfo, useTokensInfo, useTpslPriceChecker, useTrack, useTrackingInstance, useTradingRewardsStatus, useTransfer, useTransferHistory, useUpdatedRef, useUserStatistics, useVaultsHistory, useWS, useWalletConnector, useWalletRewardsHistory, useWalletSubscription, useWalletTopic, useWithdraw, useWsStatus, utils_exports as utils, version_default as version };
|
|
19618
19891
|
//# sourceMappingURL=index.mjs.map
|
|
19619
19892
|
//# sourceMappingURL=index.mjs.map
|