@orderly.network/hooks 3.0.0-beta.0 → 3.0.0-beta.2
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 +465 -185
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +461 -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
|
-
import { TesnetTokenFallback, ArbitrumSepoliaTokenInfo, SolanaDevnetTokenInfo, OrderType, OrderSide, MarginMode, 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';
|
|
8
7
|
import { usePluginScope } from '@orderly.network/plugin-core';
|
|
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.2";
|
|
43
54
|
}
|
|
44
|
-
var version_default = "3.0.0-beta.
|
|
55
|
+
var version_default = "3.0.0-beta.2";
|
|
45
56
|
var fetcher = (url, init2 = {}, queryOptions) => get(url, init2, queryOptions?.formatter);
|
|
46
57
|
var noCacheConfig = {
|
|
47
58
|
dedupingInterval: 0,
|
|
@@ -72,6 +83,8 @@ function useConfig(key, defaultValue) {
|
|
|
72
83
|
}
|
|
73
84
|
return configStore;
|
|
74
85
|
}
|
|
86
|
+
|
|
87
|
+
// src/useQuery.ts
|
|
75
88
|
var PLUGIN_ID_HEADER = "X-Orderly-Plugin-Id";
|
|
76
89
|
var useQuery = (query, options) => {
|
|
77
90
|
const apiBaseUrl = useConfig("apiBaseUrl");
|
|
@@ -2582,16 +2595,12 @@ var createDataStore = (config) => {
|
|
|
2582
2595
|
const brokerIdQuery = typeof options?.brokerId === "string" && options?.brokerId !== "orderly" ? `?broker_id=${options?.brokerId}` : "";
|
|
2583
2596
|
const url = `${dynamicBaseUrl || baseUrl || ""}${endpoint}${brokerIdQuery}`;
|
|
2584
2597
|
const data = await fetcher(url, {}, { formatter });
|
|
2585
|
-
const dataWithBrokerId = data.map((item) => ({
|
|
2586
|
-
...item,
|
|
2587
|
-
broker_id: options?.brokerId
|
|
2588
|
-
}));
|
|
2589
2598
|
set({
|
|
2590
|
-
data
|
|
2599
|
+
data,
|
|
2591
2600
|
loading: false,
|
|
2592
2601
|
error: null
|
|
2593
2602
|
});
|
|
2594
|
-
return
|
|
2603
|
+
return data;
|
|
2595
2604
|
} catch (error) {
|
|
2596
2605
|
set({ error, loading: false });
|
|
2597
2606
|
return null;
|
|
@@ -3410,7 +3419,10 @@ var useGetRwaSymbolOpenTimeInterval = (symbol, thresholdMinutes = 30) => {
|
|
|
3410
3419
|
};
|
|
3411
3420
|
var useSymbolsInfo = () => {
|
|
3412
3421
|
const symbolsInfo = useAppStore((state) => state.symbolsInfo);
|
|
3413
|
-
return useMemo(
|
|
3422
|
+
return useMemo(
|
|
3423
|
+
() => createGetter(symbolsInfo ? { ...symbolsInfo } : symbolsInfo),
|
|
3424
|
+
[symbolsInfo]
|
|
3425
|
+
);
|
|
3414
3426
|
};
|
|
3415
3427
|
var useSymbolsInfoStore = () => {
|
|
3416
3428
|
return useAppStore((state) => state.symbolsInfo);
|
|
@@ -3423,6 +3435,7 @@ var MarketsType = /* @__PURE__ */ ((MarketsType2) => {
|
|
|
3423
3435
|
MarketsType2[MarketsType2["ALL"] = 2] = "ALL";
|
|
3424
3436
|
MarketsType2[MarketsType2["RWA"] = 3] = "RWA";
|
|
3425
3437
|
MarketsType2[MarketsType2["NEW_LISTING"] = 4] = "NEW_LISTING";
|
|
3438
|
+
MarketsType2[MarketsType2["COMMUNITY"] = 5] = "COMMUNITY";
|
|
3426
3439
|
return MarketsType2;
|
|
3427
3440
|
})(MarketsType || {});
|
|
3428
3441
|
var MarketsStorageKey = "orderly_markets";
|
|
@@ -3592,6 +3605,8 @@ var addFieldToMarkets = (futures, symbolsInfo, rwaSymbolsInfo) => {
|
|
|
3592
3605
|
const rwaInfo = !rwaSymbolsInfo.isNil ? rwaSymbolsInfo[item.symbol]() : null;
|
|
3593
3606
|
return {
|
|
3594
3607
|
...item,
|
|
3608
|
+
broker_id: item.broker_id,
|
|
3609
|
+
display_symbol_name: item.display_symbol_name,
|
|
3595
3610
|
quote_dp: info("quote_dp"),
|
|
3596
3611
|
created_time: info("created_time"),
|
|
3597
3612
|
displayName: info("displayName"),
|
|
@@ -3613,7 +3628,7 @@ var addFieldToMarkets = (futures, symbolsInfo, rwaSymbolsInfo) => {
|
|
|
3613
3628
|
var filterMarkets = (params) => {
|
|
3614
3629
|
const { markets, favorites, recent, newListing, type } = params;
|
|
3615
3630
|
let curData = [];
|
|
3616
|
-
if (type === 2 /* ALL */) {
|
|
3631
|
+
if (type === 2 /* ALL */ || type === 5 /* COMMUNITY */) {
|
|
3617
3632
|
curData = markets;
|
|
3618
3633
|
} else if (type === 3 /* RWA */) {
|
|
3619
3634
|
curData = markets.filter((item) => item.isRwa);
|
|
@@ -4535,7 +4550,7 @@ var useMarket = (type) => {
|
|
|
4535
4550
|
const getData = (type2) => {
|
|
4536
4551
|
const localData = type2 === 0 /* FAVORITES */ ? [...favorites] : [...recent];
|
|
4537
4552
|
const keys = localData.map((item) => item.name);
|
|
4538
|
-
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));
|
|
4539
4554
|
const favoritesData = [...favorites];
|
|
4540
4555
|
const favoriteKeys = favoritesData.map((item) => item.name);
|
|
4541
4556
|
if (filter) {
|
|
@@ -4734,6 +4749,80 @@ var useSymbolLeverageMap = () => {
|
|
|
4734
4749
|
refresh: mutate6
|
|
4735
4750
|
};
|
|
4736
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
|
|
4737
4826
|
var useMarginModes = () => {
|
|
4738
4827
|
const { data, error, isLoading, mutate: mutate6 } = usePrivateQuery("/v1/client/margin_modes", {
|
|
4739
4828
|
revalidateOnFocus: false,
|
|
@@ -4775,22 +4864,28 @@ var useMarginModes = () => {
|
|
|
4775
4864
|
};
|
|
4776
4865
|
var useMarginModeBySymbol = (symbol, fallback = MarginMode.CROSS) => {
|
|
4777
4866
|
const { marginModes, isLoading, error, refresh, updateMarginMode } = useMarginModes();
|
|
4778
|
-
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]);
|
|
4779
4872
|
const update = useCallback(
|
|
4780
4873
|
async (mode) => {
|
|
4874
|
+
if (brokerId) mode = MarginMode.ISOLATED;
|
|
4781
4875
|
return updateMarginMode({
|
|
4782
4876
|
symbol_list: [symbol],
|
|
4783
4877
|
default_margin_mode: mode
|
|
4784
4878
|
});
|
|
4785
4879
|
},
|
|
4786
|
-
[symbol, updateMarginMode]
|
|
4880
|
+
[brokerId, symbol, updateMarginMode]
|
|
4787
4881
|
);
|
|
4788
4882
|
return {
|
|
4789
4883
|
marginMode,
|
|
4790
4884
|
isLoading,
|
|
4791
4885
|
error,
|
|
4792
4886
|
refresh,
|
|
4793
|
-
update
|
|
4887
|
+
update,
|
|
4888
|
+
isPermissionlessListing: !!brokerId
|
|
4794
4889
|
};
|
|
4795
4890
|
};
|
|
4796
4891
|
|
|
@@ -5433,7 +5528,7 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5433
5528
|
if (!accountInfo || !fundingRates || !symbolsInfo) {
|
|
5434
5529
|
return data;
|
|
5435
5530
|
}
|
|
5436
|
-
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;
|
|
5437
5532
|
let rows = data.rows.map((item) => {
|
|
5438
5533
|
const info = symbolsInfo[item.symbol];
|
|
5439
5534
|
const sum_unitary_funding = fundingRates?.[item.symbol]?.["sum_unitary_funding"] ?? 0;
|
|
@@ -5496,6 +5591,12 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5496
5591
|
unrealPnL_total_index = unrealPnL_total_index.add(unrealPnl_index);
|
|
5497
5592
|
notional_total = notional_total.add(notional);
|
|
5498
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
|
+
}
|
|
5499
5600
|
const fundingFee = new Decimal(sum_unitary_funding).sub(item.last_sum_unitary_funding).mul(item.position_qty).negated().toNumber();
|
|
5500
5601
|
return {
|
|
5501
5602
|
...item,
|
|
@@ -5511,7 +5612,8 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5511
5612
|
unrealized_pnl: unrealPnl,
|
|
5512
5613
|
unrealized_pnl_index: unrealPnl_index,
|
|
5513
5614
|
unrealized_pnl_ROI: unrealPnlROI,
|
|
5514
|
-
unrealized_pnl_ROI_index: unrealPnlROI_index
|
|
5615
|
+
unrealized_pnl_ROI_index: unrealPnlROI_index,
|
|
5616
|
+
unsettled_pnl: unsettlementPnL2
|
|
5515
5617
|
};
|
|
5516
5618
|
});
|
|
5517
5619
|
const totalUnrealPnl = unrealPnL_total.toNumber();
|
|
@@ -5523,18 +5625,34 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5523
5625
|
rows = rows.map((item) => {
|
|
5524
5626
|
const info = symbolsInfo[item.symbol];
|
|
5525
5627
|
const totalCollateral = item.margin_mode === MarginMode.ISOLATED ? new Decimal(item.margin ?? 0).add(item.unsettlement_pnl ?? 0).toNumber() : crossMarginCollateral.toNumber();
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
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
|
+
}
|
|
5538
5656
|
return {
|
|
5539
5657
|
...item,
|
|
5540
5658
|
est_liq_price
|
|
@@ -5561,6 +5679,8 @@ var PositionCalculator = class extends BaseCalculator {
|
|
|
5561
5679
|
total_unsettled_pnl: unsettlementPnL,
|
|
5562
5680
|
unrealPnlROI: totalUnrealizedROI,
|
|
5563
5681
|
unrealPnlROI_index: totalUnrealizedROI_index,
|
|
5682
|
+
total_unsettled_cross_pnl: totalUnsettledCrossPnl.toNumber(),
|
|
5683
|
+
total_unsettled_isolated_pnl: totalUnsettledIsolatedPnl.toNumber(),
|
|
5564
5684
|
rows
|
|
5565
5685
|
};
|
|
5566
5686
|
}
|
|
@@ -5723,13 +5843,9 @@ var PortfolioCalculator = class extends BaseCalculator {
|
|
|
5723
5843
|
if (!holding || !positions3 || !Array.isArray(positions3.rows) || !markPrices || !indexPrices || !accountInfo) {
|
|
5724
5844
|
return null;
|
|
5725
5845
|
}
|
|
5726
|
-
const
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
);
|
|
5730
|
-
const totalUnsettlementPnL = positions3.rows.reduce(
|
|
5731
|
-
(sum, pos) => sum + (pos.unsettled_pnl ?? 0),
|
|
5732
|
-
0
|
|
5846
|
+
const unsettledPnL = pathOr(0, ["total_unsettled_pnl"])(positions3);
|
|
5847
|
+
const unsettledCrossPnL = pathOr(0, ["total_unsettled_cross_pnl"])(
|
|
5848
|
+
positions3
|
|
5733
5849
|
);
|
|
5734
5850
|
const unrealizedPnL = pathOr(0, ["total_unreal_pnl"])(positions3);
|
|
5735
5851
|
const [USDC_holding, nonUSDC] = parseHolding(
|
|
@@ -5741,7 +5857,7 @@ var PortfolioCalculator = class extends BaseCalculator {
|
|
|
5741
5857
|
const totalCollateral = account.totalCollateral({
|
|
5742
5858
|
USDCHolding: USDC_holding,
|
|
5743
5859
|
nonUSDCHolding: nonUSDC,
|
|
5744
|
-
unsettlementPnL:
|
|
5860
|
+
unsettlementPnL: unsettledCrossPnL,
|
|
5745
5861
|
usdcBalancePendingShortQty: usdc?.pending_short ?? 0,
|
|
5746
5862
|
usdcBalanceIsolatedOrderFrozen: usdc?.isolated_order_frozen ?? 0
|
|
5747
5863
|
});
|
|
@@ -5752,7 +5868,7 @@ var PortfolioCalculator = class extends BaseCalculator {
|
|
|
5752
5868
|
return acc.add(curr.margin ?? 0);
|
|
5753
5869
|
}, zero);
|
|
5754
5870
|
const totalValue = account.totalValue({
|
|
5755
|
-
totalUnsettlementPnL,
|
|
5871
|
+
totalUnsettlementPnL: unsettledPnL,
|
|
5756
5872
|
USDCHolding: USDC_holding,
|
|
5757
5873
|
nonUSDCHolding: nonUSDC,
|
|
5758
5874
|
totalIsolatedPositionMargin: sumIsolatedMargin.toNumber()
|
|
@@ -5796,7 +5912,7 @@ var PortfolioCalculator = class extends BaseCalculator {
|
|
|
5796
5912
|
totalUnrealizedROI,
|
|
5797
5913
|
freeCollateral,
|
|
5798
5914
|
availableBalance,
|
|
5799
|
-
unsettledPnL
|
|
5915
|
+
unsettledPnL,
|
|
5800
5916
|
holding,
|
|
5801
5917
|
usdcHolding: USDC_holding,
|
|
5802
5918
|
freeCollateralUSDCOnly
|
|
@@ -5915,7 +6031,7 @@ var usePositionStream = (symbol = "all", options) => {
|
|
|
5915
6031
|
total_unreal_pnl: total_unreal_pnl_index,
|
|
5916
6032
|
unrealPnlROI: unrealPnlROI_index
|
|
5917
6033
|
};
|
|
5918
|
-
}, [calcMode]);
|
|
6034
|
+
}, [calcMode, formattedPositions]);
|
|
5919
6035
|
let rows = formattedPositions[0];
|
|
5920
6036
|
{
|
|
5921
6037
|
if (!rows) {
|
|
@@ -6405,14 +6521,8 @@ function formatPortfolio(inputs) {
|
|
|
6405
6521
|
if (!holding || !positions3 || !Array.isArray(positions3.rows) || !markPrices || !indexPrices || !accountInfo || symbolsInfo?.isNil) {
|
|
6406
6522
|
return null;
|
|
6407
6523
|
}
|
|
6408
|
-
const
|
|
6409
|
-
|
|
6410
|
-
0
|
|
6411
|
-
);
|
|
6412
|
-
const totalUnsettlementPnL = positions3.rows.reduce(
|
|
6413
|
-
(sum, pos) => sum + (pos.unsettled_pnl ?? 0),
|
|
6414
|
-
0
|
|
6415
|
-
);
|
|
6524
|
+
const unsettledPnL = pathOr(0, ["total_unsettled_pnl"])(positions3);
|
|
6525
|
+
const unsettledCrossPnL = pathOr(0, ["total_unsettled_cross_pnl"])(positions3);
|
|
6416
6526
|
const unrealizedPnL = pathOr(0, ["total_unreal_pnl"])(positions3);
|
|
6417
6527
|
const [USDC_holding, nonUSDC] = parseHolding(
|
|
6418
6528
|
holding,
|
|
@@ -6423,7 +6533,7 @@ function formatPortfolio(inputs) {
|
|
|
6423
6533
|
const totalCollateral = account.totalCollateral({
|
|
6424
6534
|
USDCHolding: USDC_holding,
|
|
6425
6535
|
nonUSDCHolding: nonUSDC,
|
|
6426
|
-
unsettlementPnL:
|
|
6536
|
+
unsettlementPnL: unsettledCrossPnL,
|
|
6427
6537
|
usdcBalancePendingShortQty: usdc?.pending_short ?? 0,
|
|
6428
6538
|
usdcBalanceIsolatedOrderFrozen: usdc?.isolated_order_frozen ?? 0
|
|
6429
6539
|
});
|
|
@@ -6434,7 +6544,7 @@ function formatPortfolio(inputs) {
|
|
|
6434
6544
|
return acc.add(curr.margin ?? 0);
|
|
6435
6545
|
}, zero);
|
|
6436
6546
|
const totalValue = account.totalValue({
|
|
6437
|
-
totalUnsettlementPnL,
|
|
6547
|
+
totalUnsettlementPnL: unsettledPnL,
|
|
6438
6548
|
USDCHolding: USDC_holding,
|
|
6439
6549
|
nonUSDCHolding: nonUSDC,
|
|
6440
6550
|
totalIsolatedPositionMargin: sumIsolatedMargin.toNumber()
|
|
@@ -6478,7 +6588,7 @@ function formatPortfolio(inputs) {
|
|
|
6478
6588
|
totalUnrealizedROI,
|
|
6479
6589
|
freeCollateral,
|
|
6480
6590
|
availableBalance,
|
|
6481
|
-
unsettledPnL
|
|
6591
|
+
unsettledPnL,
|
|
6482
6592
|
holding,
|
|
6483
6593
|
freeCollateralUSDCOnly
|
|
6484
6594
|
};
|
|
@@ -6487,7 +6597,7 @@ function formatPositions(data, accountInfo, symbolsInfo, fundingRates) {
|
|
|
6487
6597
|
if (!accountInfo || !fundingRates || !symbolsInfo) {
|
|
6488
6598
|
return data;
|
|
6489
6599
|
}
|
|
6490
|
-
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;
|
|
6491
6601
|
const rows = data.rows.map((item) => {
|
|
6492
6602
|
const info = symbolsInfo[item.symbol];
|
|
6493
6603
|
const notional = positions.notional(item.position_qty, item.mark_price);
|
|
@@ -6549,6 +6659,12 @@ function formatPositions(data, accountInfo, symbolsInfo, fundingRates) {
|
|
|
6549
6659
|
unrealPnL_total_index = unrealPnL_total_index.add(unrealPnl_index);
|
|
6550
6660
|
notional_total = notional_total.add(notional);
|
|
6551
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
|
+
}
|
|
6552
6668
|
return {
|
|
6553
6669
|
...item,
|
|
6554
6670
|
mm: positions.maintenanceMargin({
|
|
@@ -6562,7 +6678,8 @@ function formatPositions(data, accountInfo, symbolsInfo, fundingRates) {
|
|
|
6562
6678
|
unrealized_pnl: unrealPnl,
|
|
6563
6679
|
unrealized_pnl_index: unrealPnl_index,
|
|
6564
6680
|
unrealized_pnl_ROI: unrealPnlROI,
|
|
6565
|
-
unrealized_pnl_ROI_index: unrealPnlROI_index
|
|
6681
|
+
unrealized_pnl_ROI_index: unrealPnlROI_index,
|
|
6682
|
+
unsettled_pnl: unsettlementPnL2
|
|
6566
6683
|
};
|
|
6567
6684
|
});
|
|
6568
6685
|
const totalUnrealPnl = unrealPnL_total.toNumber();
|
|
@@ -6576,6 +6693,8 @@ function formatPositions(data, accountInfo, symbolsInfo, fundingRates) {
|
|
|
6576
6693
|
notional: notional_total.toNumber(),
|
|
6577
6694
|
unsettledPnL: unsettlementPnL,
|
|
6578
6695
|
total_unsettled_pnl: unsettlementPnL,
|
|
6696
|
+
total_unsettled_cross_pnl: totalUnsettledCrossPnl.toNumber(),
|
|
6697
|
+
total_unsettled_isolated_pnl: totalUnsettledIsolatedPnl.toNumber(),
|
|
6579
6698
|
rows
|
|
6580
6699
|
};
|
|
6581
6700
|
}
|
|
@@ -7958,7 +8077,9 @@ var useDeposit = (options) => {
|
|
|
7958
8077
|
const depositPromise = isNativeToken ? account9.assetsManager.depositNativeToken(inputs) : account9.assetsManager.deposit(inputs);
|
|
7959
8078
|
return depositPromise.then((result) => {
|
|
7960
8079
|
updateAllowanceWhenTxSuccess(result.hash);
|
|
7961
|
-
setBalance(
|
|
8080
|
+
setBalance(
|
|
8081
|
+
(value) => value ? new Decimal(value).sub(quantity).toString() : "0"
|
|
8082
|
+
);
|
|
7962
8083
|
track2(TrackerEventName.depositSuccess, {
|
|
7963
8084
|
wallet: state?.connectWallet?.name,
|
|
7964
8085
|
network: targetChain?.network_infos.name,
|
|
@@ -8010,16 +8131,16 @@ var useDeposit = (options) => {
|
|
|
8010
8131
|
};
|
|
8011
8132
|
function useBalance(options) {
|
|
8012
8133
|
const { srcToken, address, decimals, account: account9, status } = options;
|
|
8013
|
-
const [balance, setBalance] = useState(
|
|
8134
|
+
const [balance, setBalance] = useState(null);
|
|
8014
8135
|
const fetchBalance = useCallback(
|
|
8015
8136
|
async (address2, decimals2) => {
|
|
8016
8137
|
try {
|
|
8017
8138
|
if (isNativeTokenChecker(address2)) {
|
|
8018
|
-
return account9.assetsManager.getNativeBalance({
|
|
8139
|
+
return await account9.assetsManager.getNativeBalance({
|
|
8019
8140
|
decimals: decimals2
|
|
8020
8141
|
});
|
|
8021
8142
|
}
|
|
8022
|
-
return account9.assetsManager.getBalance(address2, {
|
|
8143
|
+
return await account9.assetsManager.getBalance(address2, {
|
|
8023
8144
|
decimals: decimals2
|
|
8024
8145
|
});
|
|
8025
8146
|
} catch (err) {
|
|
@@ -8068,11 +8189,13 @@ function useBalance(options) {
|
|
|
8068
8189
|
useEffect(() => {
|
|
8069
8190
|
if (swrBalance !== void 0) {
|
|
8070
8191
|
setBalance(swrBalance || "0");
|
|
8192
|
+
} else {
|
|
8193
|
+
setBalance(null);
|
|
8071
8194
|
}
|
|
8072
|
-
}, [swrBalance]);
|
|
8195
|
+
}, [swrBalance, address]);
|
|
8073
8196
|
return {
|
|
8074
8197
|
balance,
|
|
8075
|
-
balanceRevalidating,
|
|
8198
|
+
balanceRevalidating: balanceRevalidating || balance === null,
|
|
8076
8199
|
setBalance,
|
|
8077
8200
|
fetchBalance,
|
|
8078
8201
|
fetchBalances
|
|
@@ -9602,6 +9725,9 @@ var PriceValidationStrategy = class {
|
|
|
9602
9725
|
}
|
|
9603
9726
|
const price = new Decimal(order_price);
|
|
9604
9727
|
const { symbol } = config;
|
|
9728
|
+
if (!symbol) {
|
|
9729
|
+
return;
|
|
9730
|
+
}
|
|
9605
9731
|
const { quote_max, quote_min, quote_dp, price_range, price_scope } = symbol;
|
|
9606
9732
|
const maxPriceNumber = order.maxPrice(config.markPrice, price_range);
|
|
9607
9733
|
const minPriceNumber = order.minPrice(config.markPrice, price_range);
|
|
@@ -9648,6 +9774,9 @@ var TriggerPriceValidationStrategy = class {
|
|
|
9648
9774
|
validate(values, config) {
|
|
9649
9775
|
const { trigger_price } = values;
|
|
9650
9776
|
const { symbol } = config;
|
|
9777
|
+
if (!symbol) {
|
|
9778
|
+
return;
|
|
9779
|
+
}
|
|
9651
9780
|
const { quote_max, quote_min } = symbol;
|
|
9652
9781
|
if (!trigger_price) {
|
|
9653
9782
|
return OrderValidation.required("trigger_price");
|
|
@@ -9694,6 +9823,9 @@ var QuantityValidationStrategy = class {
|
|
|
9694
9823
|
validate(values, config) {
|
|
9695
9824
|
let { order_quantity, total, order_price } = values;
|
|
9696
9825
|
const { maxQty, symbol } = config;
|
|
9826
|
+
if (!symbol) {
|
|
9827
|
+
return;
|
|
9828
|
+
}
|
|
9697
9829
|
const { base_min, base_dp, quote_dp } = symbol;
|
|
9698
9830
|
if (!order_quantity && total && order_price) {
|
|
9699
9831
|
const totalNumber = new Decimal(total);
|
|
@@ -10949,7 +11081,7 @@ var calcEstLiqPrice = (order$1, askAndBid, inputs) => {
|
|
|
10949
11081
|
totalCollateral,
|
|
10950
11082
|
futures_taker_fee_rate,
|
|
10951
11083
|
positions: positions3,
|
|
10952
|
-
|
|
11084
|
+
symbolLeverage,
|
|
10953
11085
|
sumUnitaryFunding
|
|
10954
11086
|
} = inputs;
|
|
10955
11087
|
const orderFee = order.orderFee({
|
|
@@ -10974,7 +11106,7 @@ var calcEstLiqPrice = (order$1, askAndBid, inputs) => {
|
|
|
10974
11106
|
}
|
|
10975
11107
|
});
|
|
10976
11108
|
} else {
|
|
10977
|
-
let isolatedPositionMargin = 0, costPosition = 0, positionQty = 0, lastSumUnitaryFunding = 0, leverage = 1;
|
|
11109
|
+
let isolatedPositionMargin = 0, costPosition = 0, positionQty = 0, lastSumUnitaryFunding = 0, leverage = symbolLeverage ?? 1;
|
|
10978
11110
|
if (positions3) {
|
|
10979
11111
|
const position = positions3.find(
|
|
10980
11112
|
(p) => p.symbol === symbol && p.margin_mode === MarginMode.ISOLATED
|
|
@@ -12664,6 +12796,12 @@ var DataPaint = class extends BasePaint {
|
|
|
12664
12796
|
this.DEFAULT_LOSS_COLOR = "rgb(255,103,194)";
|
|
12665
12797
|
this.transformTop = 0;
|
|
12666
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";
|
|
12667
12805
|
}
|
|
12668
12806
|
async draw(options) {
|
|
12669
12807
|
const needDrawDetails = Array.isArray(options.data?.position?.informations) && (options.data?.position?.informations?.length ?? 0) > 0;
|
|
@@ -12750,6 +12888,49 @@ var DataPaint = class extends BasePaint {
|
|
|
12750
12888
|
fontSize: this._ratio(fontSize),
|
|
12751
12889
|
fontFamily: options.fontFamily
|
|
12752
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
|
+
}
|
|
12753
12934
|
}
|
|
12754
12935
|
const marginMode = options.data?.position.marginMode;
|
|
12755
12936
|
if (marginMode) {
|
|
@@ -12764,7 +12945,7 @@ var DataPaint = class extends BasePaint {
|
|
|
12764
12945
|
});
|
|
12765
12946
|
}
|
|
12766
12947
|
left += (prevElementBoundingBox.width ?? 0) + this._ratio(7);
|
|
12767
|
-
const marginModeText =
|
|
12948
|
+
const marginModeText = this.formatMarginMode(marginMode);
|
|
12768
12949
|
prevElementBoundingBox = this._drawText(marginModeText, {
|
|
12769
12950
|
color: layout.color,
|
|
12770
12951
|
left,
|
|
@@ -12797,6 +12978,20 @@ var DataPaint = class extends BasePaint {
|
|
|
12797
12978
|
);
|
|
12798
12979
|
}
|
|
12799
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
|
+
}
|
|
12800
12995
|
drawUnrealizedPnL(options, offsetTop = 0) {
|
|
12801
12996
|
const layout = path(
|
|
12802
12997
|
["layout", "unrealizedPnl"],
|
|
@@ -13250,18 +13445,6 @@ var useEpochInfo = (type) => {
|
|
|
13250
13445
|
}, [epochInfo]);
|
|
13251
13446
|
return [epochInfo, { isLoading, curEpochInfo, isNotStared, refresh }];
|
|
13252
13447
|
};
|
|
13253
|
-
|
|
13254
|
-
// src/trading-rewards/useAllBrokers.ts
|
|
13255
|
-
var useAllBrokers = () => {
|
|
13256
|
-
const { data } = useQuery("/v1/public/broker/name", {
|
|
13257
|
-
formatter: (res) => {
|
|
13258
|
-
const { rows } = res;
|
|
13259
|
-
return rows?.map((item) => ({ [item.broker_id]: item.broker_name })).reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
13260
|
-
},
|
|
13261
|
-
revalidateOnFocus: false
|
|
13262
|
-
});
|
|
13263
|
-
return [data];
|
|
13264
|
-
};
|
|
13265
13448
|
var useCurEpochEstimate = (type) => {
|
|
13266
13449
|
const [data, setData] = useState(void 0);
|
|
13267
13450
|
const { account: account9 } = useAccount();
|
|
@@ -18397,108 +18580,65 @@ var initialOrderState = {
|
|
|
18397
18580
|
tp_trigger_price: "",
|
|
18398
18581
|
sl_trigger_price: "",
|
|
18399
18582
|
total: "",
|
|
18400
|
-
symbol: ""
|
|
18583
|
+
symbol: "",
|
|
18584
|
+
side: OrderSide.BUY,
|
|
18585
|
+
order_type: OrderType.LIMIT,
|
|
18586
|
+
margin_mode: MarginMode.CROSS
|
|
18401
18587
|
};
|
|
18402
|
-
var
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
...
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
initOrder: (
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
margin_mode: options?.margin_mode ?? MarginMode.CROSS
|
|
18421
|
-
};
|
|
18422
|
-
state.estLeverage = null;
|
|
18423
|
-
state.estLiquidationPrice = null;
|
|
18424
|
-
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
|
|
18425
18606
|
});
|
|
18426
18607
|
},
|
|
18427
|
-
hasTP_SL: () => {
|
|
18428
|
-
const order = get3().entry;
|
|
18429
|
-
return typeof order.tp_trigger_price !== "undefined" || typeof order.sl_trigger_price !== "undefined";
|
|
18430
|
-
},
|
|
18431
|
-
updateOrderComputed: (data) => {
|
|
18432
|
-
set(
|
|
18433
|
-
(state) => {
|
|
18434
|
-
state.estLeverage = data.estLeverage;
|
|
18435
|
-
state.estLiquidationPrice = data.estLiquidationPrice;
|
|
18436
|
-
},
|
|
18437
|
-
false
|
|
18438
|
-
// "updateOrderComputed"
|
|
18439
|
-
);
|
|
18440
|
-
},
|
|
18441
18608
|
updateOrder: (order) => {
|
|
18442
|
-
|
|
18443
|
-
(state) => {
|
|
18444
|
-
state.entry = {
|
|
18445
|
-
...state.entry,
|
|
18446
|
-
...order
|
|
18447
|
-
};
|
|
18448
|
-
},
|
|
18449
|
-
false
|
|
18450
|
-
// "updateOrder"
|
|
18451
|
-
);
|
|
18609
|
+
setOrderEntity((prev) => ({ ...prev, ...order }));
|
|
18452
18610
|
},
|
|
18453
18611
|
updateOrderByKey: (key, value) => {
|
|
18454
|
-
|
|
18455
|
-
(state) => {
|
|
18456
|
-
state.entry[key] = value;
|
|
18457
|
-
},
|
|
18458
|
-
false
|
|
18459
|
-
// "updateOrderByKey"
|
|
18460
|
-
);
|
|
18461
|
-
},
|
|
18462
|
-
restoreOrder: (order) => {
|
|
18463
|
-
set(
|
|
18464
|
-
(state) => {
|
|
18465
|
-
state.entry = order;
|
|
18466
|
-
},
|
|
18467
|
-
false
|
|
18468
|
-
// "restoreOrder"
|
|
18469
|
-
);
|
|
18612
|
+
setOrderEntity((prev) => ({ ...prev, [key]: value }));
|
|
18470
18613
|
},
|
|
18471
18614
|
resetOrder: (_order) => {
|
|
18472
|
-
|
|
18473
|
-
|
|
18474
|
-
|
|
18475
|
-
|
|
18476
|
-
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
|
|
18480
|
-
|
|
18481
|
-
|
|
18482
|
-
|
|
18483
|
-
|
|
18484
|
-
|
|
18485
|
-
|
|
18486
|
-
|
|
18487
|
-
|
|
18488
|
-
|
|
18489
|
-
|
|
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";
|
|
18490
18634
|
}
|
|
18491
|
-
}
|
|
18492
|
-
|
|
18493
|
-
);
|
|
18494
|
-
var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
18495
|
-
const { symbolInfo, symbolLeverage } = options;
|
|
18496
|
-
const orderEntity = useOrderStore((state) => state.entry);
|
|
18497
|
-
const orderEntryActions = useOrderStore((state) => state.actions);
|
|
18635
|
+
}),
|
|
18636
|
+
[orderEntity]
|
|
18637
|
+
);
|
|
18498
18638
|
useEffect(() => {
|
|
18499
|
-
|
|
18639
|
+
actions.initOrder(symbol, options.initialOrder);
|
|
18500
18640
|
if (options.initialOrder) {
|
|
18501
|
-
|
|
18641
|
+
actions.updateOrder(options.initialOrder);
|
|
18502
18642
|
}
|
|
18503
18643
|
}, [symbol]);
|
|
18504
18644
|
const calculate2 = useCallback(
|
|
@@ -18516,10 +18656,10 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18516
18656
|
);
|
|
18517
18657
|
const setValue = (key, value, additional) => {
|
|
18518
18658
|
if (!symbolInfo) {
|
|
18519
|
-
|
|
18659
|
+
actions.updateOrderByKey(key, value);
|
|
18520
18660
|
return;
|
|
18521
18661
|
}
|
|
18522
|
-
const currentEntry =
|
|
18662
|
+
const currentEntry = orderEntity;
|
|
18523
18663
|
const { markPrice } = additional ?? { markPrice: 0 };
|
|
18524
18664
|
let newValues = calculate2(
|
|
18525
18665
|
{ ...currentEntry },
|
|
@@ -18553,7 +18693,7 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18553
18693
|
if (sl_ROI) {
|
|
18554
18694
|
newValues.sl_ROI = sl_ROI;
|
|
18555
18695
|
}
|
|
18556
|
-
|
|
18696
|
+
actions.updateOrder(newValues);
|
|
18557
18697
|
return newValues;
|
|
18558
18698
|
};
|
|
18559
18699
|
const calculateTPSL = (key, newValues, markPrice, symbolInfo2) => {
|
|
@@ -18600,11 +18740,10 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18600
18740
|
};
|
|
18601
18741
|
const setValues = (values, additional) => {
|
|
18602
18742
|
if (!symbolInfo) {
|
|
18603
|
-
|
|
18743
|
+
actions.updateOrder(values);
|
|
18604
18744
|
return;
|
|
18605
18745
|
}
|
|
18606
|
-
|
|
18607
|
-
let newValues = { ...currentEntry };
|
|
18746
|
+
let newValues = { ...orderEntity };
|
|
18608
18747
|
Object.keys(values).forEach((key) => {
|
|
18609
18748
|
newValues = calculate2(
|
|
18610
18749
|
newValues,
|
|
@@ -18614,17 +18753,28 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18614
18753
|
symbolInfo
|
|
18615
18754
|
);
|
|
18616
18755
|
});
|
|
18617
|
-
|
|
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);
|
|
18618
18769
|
return newValues;
|
|
18619
18770
|
};
|
|
18620
18771
|
const onMarkPriceUpdated = useCallback(
|
|
18621
18772
|
(markPrice, baseOn = []) => {
|
|
18622
18773
|
if (!options.symbolInfo) return;
|
|
18623
|
-
|
|
18624
|
-
let newValues = { ...currentEntry };
|
|
18774
|
+
let newValues = { ...orderEntity };
|
|
18625
18775
|
if (baseOn.length === 0) {
|
|
18626
18776
|
newValues = calculate2(
|
|
18627
|
-
{ ...
|
|
18777
|
+
{ ...orderEntity },
|
|
18628
18778
|
"order_price",
|
|
18629
18779
|
markPrice,
|
|
18630
18780
|
markPrice,
|
|
@@ -18635,7 +18785,7 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18635
18785
|
newValues = calculate2(
|
|
18636
18786
|
{ ...newValues },
|
|
18637
18787
|
key,
|
|
18638
|
-
|
|
18788
|
+
orderEntity[key],
|
|
18639
18789
|
markPrice,
|
|
18640
18790
|
options.symbolInfo
|
|
18641
18791
|
);
|
|
@@ -18654,9 +18804,9 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18654
18804
|
newValues.sl_ROI = sl_ROI;
|
|
18655
18805
|
}
|
|
18656
18806
|
}
|
|
18657
|
-
|
|
18807
|
+
actions.updateOrder(newValues);
|
|
18658
18808
|
},
|
|
18659
|
-
[calculate2, options.symbolInfo,
|
|
18809
|
+
[calculate2, options.symbolInfo, symbolLeverage, orderEntity]
|
|
18660
18810
|
);
|
|
18661
18811
|
const validate = (order, creator, options2) => {
|
|
18662
18812
|
return creator?.validate(order, {
|
|
@@ -18674,12 +18824,13 @@ var useOrderEntryNextInternal = (symbol, options = {}) => {
|
|
|
18674
18824
|
const submitOrder = useCallback(() => {
|
|
18675
18825
|
}, [orderEntity]);
|
|
18676
18826
|
const resetOrder = (order) => {
|
|
18677
|
-
|
|
18827
|
+
actions.resetOrder(order);
|
|
18678
18828
|
};
|
|
18679
18829
|
return {
|
|
18680
18830
|
formattedOrder: orderEntity,
|
|
18681
18831
|
setValue,
|
|
18682
18832
|
setValues,
|
|
18833
|
+
setValuesRaw,
|
|
18683
18834
|
submit: submitOrder,
|
|
18684
18835
|
reset: resetOrder,
|
|
18685
18836
|
generateOrder,
|
|
@@ -18695,6 +18846,8 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
18695
18846
|
}
|
|
18696
18847
|
const ee = useEventEmitter();
|
|
18697
18848
|
const { track: track2 } = useTrack();
|
|
18849
|
+
const apiBaseUrl = useConfig("apiBaseUrl");
|
|
18850
|
+
const fetchSymbols = useSymbolStore((state) => state.fetchData);
|
|
18698
18851
|
const [meta, setMeta] = useState({
|
|
18699
18852
|
dirty: {},
|
|
18700
18853
|
submitted: false,
|
|
@@ -18714,8 +18867,7 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
18714
18867
|
const symbolConfig = useSymbolsInfo();
|
|
18715
18868
|
const accountInfo = useAccountInfo();
|
|
18716
18869
|
const positions3 = usePositions();
|
|
18717
|
-
const
|
|
18718
|
-
const effectiveMarginMode = options?.initialOrder?.margin_mode ?? entry?.margin_mode ?? MarginMode.CROSS;
|
|
18870
|
+
const effectiveMarginMode = options?.initialOrder?.margin_mode ?? MarginMode.CROSS;
|
|
18719
18871
|
const symbolLeverage = useLeverageBySymbol(symbol, effectiveMarginMode);
|
|
18720
18872
|
const symbolInfo = symbolConfig[symbol]();
|
|
18721
18873
|
const markPrice = actions.getMarkPriceBySymbol(symbol);
|
|
@@ -18724,6 +18876,7 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
18724
18876
|
formattedOrder,
|
|
18725
18877
|
setValue: setValueInternal,
|
|
18726
18878
|
setValues: setValuesInternal,
|
|
18879
|
+
setValuesRaw: setValuesRawInternal,
|
|
18727
18880
|
validate,
|
|
18728
18881
|
generateOrder,
|
|
18729
18882
|
reset,
|
|
@@ -18948,6 +19101,21 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
18948
19101
|
interactiveValidate(newValues);
|
|
18949
19102
|
}
|
|
18950
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
|
+
};
|
|
18951
19119
|
async function validateFunc(order) {
|
|
18952
19120
|
const creator = getOrderCreator(order);
|
|
18953
19121
|
return validate(order, creator, prepareData());
|
|
@@ -19002,11 +19170,12 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19002
19170
|
markPrice: markPrice2,
|
|
19003
19171
|
totalCollateral,
|
|
19004
19172
|
futures_taker_fee_rate: accountInfo.futures_taker_fee_rate,
|
|
19005
|
-
imr_factor: accountInfo.imr_factor[symbol],
|
|
19173
|
+
imr_factor: accountInfo.imr_factor?.[symbol] ?? 0,
|
|
19006
19174
|
symbol,
|
|
19007
19175
|
positions: positions3,
|
|
19008
19176
|
symbolInfo,
|
|
19009
|
-
sumUnitaryFunding
|
|
19177
|
+
sumUnitaryFunding,
|
|
19178
|
+
symbolLeverage
|
|
19010
19179
|
});
|
|
19011
19180
|
return estLiqPrice2;
|
|
19012
19181
|
}, [
|
|
@@ -19017,7 +19186,8 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19017
19186
|
symbol,
|
|
19018
19187
|
maxQty,
|
|
19019
19188
|
symbolInfo,
|
|
19020
|
-
fundingRates
|
|
19189
|
+
fundingRates,
|
|
19190
|
+
symbolLeverage
|
|
19021
19191
|
]);
|
|
19022
19192
|
const estLiqPriceDistance = useMemo(() => {
|
|
19023
19193
|
if (!estLiqPrice) {
|
|
@@ -19089,6 +19259,9 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19089
19259
|
orders: appendOrderMetadata(order.orders, orderMetadata)
|
|
19090
19260
|
} : appendOrderMetadata(order, orderMetadata);
|
|
19091
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
|
+
}
|
|
19092
19265
|
if (result.success) {
|
|
19093
19266
|
let trackParams = {
|
|
19094
19267
|
side: order.side,
|
|
@@ -19156,6 +19329,7 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19156
19329
|
freeCollateral: effectiveMarginMode === MarginMode.ISOLATED ? freeCollateralUSDCOnly : freeCollateral,
|
|
19157
19330
|
setValue: useMemoizedFn(setValue),
|
|
19158
19331
|
setValues: useMemoizedFn(setValues),
|
|
19332
|
+
setValuesRaw: useMemoizedFn(setValuesRaw),
|
|
19159
19333
|
symbolInfo: symbolInfo || EMPTY_OBJECT,
|
|
19160
19334
|
metaState: meta,
|
|
19161
19335
|
isMutating,
|
|
@@ -19163,6 +19337,107 @@ var useOrderEntry2 = (symbol, options = {}) => {
|
|
|
19163
19337
|
symbolLeverage
|
|
19164
19338
|
};
|
|
19165
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
|
+
);
|
|
19166
19441
|
var useOrderEntity = (order, options) => {
|
|
19167
19442
|
const { symbol } = order;
|
|
19168
19443
|
const { maxQty } = options || {};
|
|
@@ -19612,6 +19887,6 @@ var FlagKeys = /* @__PURE__ */ ((FlagKeys2) => {
|
|
|
19612
19887
|
return FlagKeys2;
|
|
19613
19888
|
})(FlagKeys || {});
|
|
19614
19889
|
|
|
19615
|
-
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 };
|
|
19616
19891
|
//# sourceMappingURL=index.mjs.map
|
|
19617
19892
|
//# sourceMappingURL=index.mjs.map
|