@kodiak-finance/orderly-react-app 2.9.0 → 2.9.1-alpha.1
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useTrack, OrderlyConfigProvider, useAccount, ERROR_MSG_CODES, useLocalStorage, useTrackingInstance, useRestrictedInfo, useEventEmitter, useSymbolsInfo, useOrderlyContext, useUpdatedRef, useDebouncedCallback, useStorageChain, useChains, useConfig, useWalletConnector, useKeyStore, useSessionStorage, useWalletSubscription, useSettleSubscription, useWS, useStorageLedgerAddress, parseJSON } from '@kodiak-finance/orderly-hooks';
|
|
1
|
+
import { useTrack, OrderlyConfigProvider, useAccount, ERROR_MSG_CODES, useLocalStorage, useTrackingInstance, useRestrictedInfo, MarketCategoriesConfigProvider, useEventEmitter, useSymbolsInfo, useOrderlyContext, useAllBrokers, useUpdatedRef, useDebouncedCallback, useStorageChain, useChains, useConfig, useWalletConnector, useKeyStore, useSessionStorage, useWalletSubscription, useSettleSubscription, useWS, useStorageLedgerAddress, formatSymbolWithBroker, parseJSON } from '@kodiak-finance/orderly-hooks';
|
|
2
2
|
import { LocaleProvider, TooltipProvider, ModalProvider, Toaster, Flex, cn, Text, Button, DARK_THEME_CSS_VARS, OrderlyThemeProvider, useCanLinkDevice, toast, modal, parseNumber } from '@kodiak-finance/orderly-ui';
|
|
3
3
|
import { createContext, useContext, useCallback, Component, useMemo, useEffect, useState, useRef } from 'react';
|
|
4
4
|
import { AccountStatusEnum, SDKError, ABSTRACT_CHAIN_ID_MAP, ChainNamespace, TrackerEventName, OrderStatus, AlgoOrderRootType } from '@kodiak-finance/orderly-types';
|
|
5
5
|
import { useTranslation, i18n, useLocaleCode, LocaleEnum } from '@kodiak-finance/orderly-i18n';
|
|
6
|
-
import { parseChainIdToNumber, windowGuard, praseChainIdToNumber, capitalizeString, getTimestamp
|
|
6
|
+
import { parseChainIdToNumber, windowGuard, praseChainIdToNumber, capitalizeString, getTimestamp } from '@kodiak-finance/orderly-utils';
|
|
7
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
8
|
import { zhCN, enUS } from 'date-fns/locale';
|
|
9
9
|
|
|
@@ -25,7 +25,7 @@ function getDisplaySide(side) {
|
|
|
25
25
|
}
|
|
26
26
|
return capitalizeString(side);
|
|
27
27
|
}
|
|
28
|
-
function getOrderExecutionReportMsg(data, symbolsInfo) {
|
|
28
|
+
function getOrderExecutionReportMsg(data, symbolsInfo, displaySymbol) {
|
|
29
29
|
const { symbol, side, quantity, client_order_id, fieldChanges } = data;
|
|
30
30
|
const total_executed_quantity = "total_executed_quantity" in data ? data.total_executed_quantity : 0;
|
|
31
31
|
const status = "status" in data ? data.status : data.algo_status;
|
|
@@ -33,7 +33,6 @@ function getOrderExecutionReportMsg(data, symbolsInfo) {
|
|
|
33
33
|
const base_dp = getSymbolInfo("base_dp");
|
|
34
34
|
getSymbolInfo("quote_dp");
|
|
35
35
|
const displaySide = getDisplaySide(side);
|
|
36
|
-
const displaySymbol = transSymbolformString(symbol);
|
|
37
36
|
const displayQuantity = "algo_type" in data && data.algo_type === AlgoOrderRootType.POSITIONAL_TP_SL ? i18n.t("tpsl.entirePosition") : base_dp === void 0 ? quantity : parseNumber(quantity, { dp: base_dp });
|
|
38
37
|
let title = "";
|
|
39
38
|
let msg = "";
|
|
@@ -118,9 +117,14 @@ var useExecutionReport = () => {
|
|
|
118
117
|
const symbolsInfo = useSymbolsInfo();
|
|
119
118
|
const symbolsInfoRef = useRef({});
|
|
120
119
|
const { notification } = useOrderlyContext();
|
|
120
|
+
const [brokers] = useAllBrokers();
|
|
121
|
+
const brokersRef = useRef(void 0);
|
|
121
122
|
useEffect(() => {
|
|
122
123
|
symbolsInfoRef.current = symbolsInfo;
|
|
123
124
|
}, [symbolsInfo]);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
brokersRef.current = brokers;
|
|
127
|
+
}, [brokers]);
|
|
124
128
|
const src = notification?.orderFilled?.media ?? "";
|
|
125
129
|
const [soundAutoPlay] = useLocalStorage(
|
|
126
130
|
ORDERLY_ORDER_SOUND_ALERT_KEY,
|
|
@@ -141,9 +145,15 @@ var useExecutionReport = () => {
|
|
|
141
145
|
return;
|
|
142
146
|
}
|
|
143
147
|
const showToast = (data2) => {
|
|
148
|
+
const displaySymbol = formatSymbolWithBroker(
|
|
149
|
+
data2.symbol,
|
|
150
|
+
symbolsInfoRef.current,
|
|
151
|
+
brokersRef.current
|
|
152
|
+
);
|
|
144
153
|
const { title, msg, status } = getOrderExecutionReportMsg(
|
|
145
154
|
data2,
|
|
146
|
-
symbolsInfoRef.current
|
|
155
|
+
symbolsInfoRef.current,
|
|
156
|
+
displaySymbol
|
|
147
157
|
);
|
|
148
158
|
const shouldPlaySound = getStoredBoolean(
|
|
149
159
|
ORDERLY_ORDER_SOUND_ALERT_KEY,
|
|
@@ -729,7 +739,7 @@ var AppStateProvider = (props) => {
|
|
|
729
739
|
initialized
|
|
730
740
|
]
|
|
731
741
|
);
|
|
732
|
-
return /* @__PURE__ */ jsx(AppStateContext.Provider, { value: memoizedValue, children: props.children });
|
|
742
|
+
return /* @__PURE__ */ jsx(AppStateContext.Provider, { value: memoizedValue, children: /* @__PURE__ */ jsx(MarketCategoriesConfigProvider, { value: props.widgetConfigs?.marketTabs, children: props.children }) });
|
|
733
743
|
};
|
|
734
744
|
var ORDERLY_THEME_STORAGE_KEY = "orderly_theme_id";
|
|
735
745
|
var AppThemeProvider = (props) => {
|