@kodiak-finance/orderly-react-app 2.8.33 → 2.9.0-rc.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 +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +94 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useTrack, OrderlyConfigProvider, useAccount, ERROR_MSG_CODES, useTrackingInstance, useRestrictedInfo, useEventEmitter, useSymbolsInfo, useOrderlyContext,
|
|
2
|
-
import {
|
|
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';
|
|
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';
|
|
@@ -417,32 +417,35 @@ function useWalletConnectError() {
|
|
|
417
417
|
const ee = useEventEmitter();
|
|
418
418
|
const { setLedgerAddress } = useStorageLedgerAddress();
|
|
419
419
|
useEffect(() => {
|
|
420
|
-
|
|
420
|
+
const handleConnectError = (data) => {
|
|
421
421
|
toast.error(data.message);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
cancelLabel: t("common.no")
|
|
441
|
-
}).then((res) => {
|
|
442
|
-
});
|
|
422
|
+
};
|
|
423
|
+
const handleLedgerError = (data) => {
|
|
424
|
+
window.setTimeout(() => {
|
|
425
|
+
modal.confirm({
|
|
426
|
+
title: t("connector.ledger.signMessageFailed"),
|
|
427
|
+
content: t("connector.ledger.signMessageFailed.description"),
|
|
428
|
+
size: "sm",
|
|
429
|
+
onOk: async () => {
|
|
430
|
+
setLedgerAddress(data.userAddress);
|
|
431
|
+
return Promise.resolve();
|
|
432
|
+
},
|
|
433
|
+
okLabel: t("common.ok"),
|
|
434
|
+
onCancel: async () => {
|
|
435
|
+
toast.error(data.message);
|
|
436
|
+
return Promise.resolve();
|
|
437
|
+
},
|
|
438
|
+
cancelLabel: t("common.no")
|
|
439
|
+
}).then((res) => {
|
|
443
440
|
});
|
|
444
|
-
}
|
|
445
|
-
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
ee.on("wallet:connect-error", handleConnectError);
|
|
444
|
+
ee.on("wallet:sign-message-with-ledger-error", handleLedgerError);
|
|
445
|
+
return () => {
|
|
446
|
+
ee.off("wallet:connect-error", handleConnectError);
|
|
447
|
+
ee.off("wallet:sign-message-with-ledger-error", handleLedgerError);
|
|
448
|
+
};
|
|
446
449
|
}, [ee, t]);
|
|
447
450
|
return {};
|
|
448
451
|
}
|
|
@@ -676,6 +679,7 @@ var useAppContext = () => {
|
|
|
676
679
|
};
|
|
677
680
|
var AppStateProvider = (props) => {
|
|
678
681
|
const [showAnnouncement, setShowAnnouncement] = useState(false);
|
|
682
|
+
const [initialized, setInitialized] = useState(false);
|
|
679
683
|
const [currentChainId, setCurrentChainId] = useCurrentChainId(
|
|
680
684
|
props.defaultChain
|
|
681
685
|
);
|
|
@@ -691,6 +695,9 @@ var AppStateProvider = (props) => {
|
|
|
691
695
|
useWalletConnectError();
|
|
692
696
|
const restrictedInfo = useRestrictedInfo(props.restrictedInfo);
|
|
693
697
|
const disabledConnect = restrictedInfo.restrictedOpen;
|
|
698
|
+
useEffect(() => {
|
|
699
|
+
setInitialized(true);
|
|
700
|
+
}, []);
|
|
694
701
|
const memoizedValue = useMemo(
|
|
695
702
|
() => ({
|
|
696
703
|
connectWallet,
|
|
@@ -704,7 +711,8 @@ var AppStateProvider = (props) => {
|
|
|
704
711
|
setShowAnnouncement,
|
|
705
712
|
onRouteChange: props.onRouteChange,
|
|
706
713
|
widgetConfigs: props.widgetConfigs,
|
|
707
|
-
customAnnouncements: props.customAnnouncements
|
|
714
|
+
customAnnouncements: props.customAnnouncements,
|
|
715
|
+
initialized
|
|
708
716
|
}),
|
|
709
717
|
[
|
|
710
718
|
connectWallet,
|
|
@@ -717,11 +725,45 @@ var AppStateProvider = (props) => {
|
|
|
717
725
|
wrongNetwork,
|
|
718
726
|
props.onRouteChange,
|
|
719
727
|
props.widgetConfigs,
|
|
720
|
-
props.customAnnouncements
|
|
728
|
+
props.customAnnouncements,
|
|
729
|
+
initialized
|
|
721
730
|
]
|
|
722
731
|
);
|
|
723
732
|
return /* @__PURE__ */ jsx(AppStateContext.Provider, { value: memoizedValue, children: props.children });
|
|
724
733
|
};
|
|
734
|
+
var ORDERLY_THEME_STORAGE_KEY = "orderly_theme_id";
|
|
735
|
+
var AppThemeProvider = (props) => {
|
|
736
|
+
const { children, themes, ...rest } = props;
|
|
737
|
+
const [currentThemeId, setCurrentThemeId] = useLocalStorage(ORDERLY_THEME_STORAGE_KEY, themes?.[0]?.id);
|
|
738
|
+
const currentTheme = useMemo(() => {
|
|
739
|
+
return themes?.find((theme) => theme.id === currentThemeId);
|
|
740
|
+
}, [themes, currentThemeId]);
|
|
741
|
+
useEffect(() => {
|
|
742
|
+
if (typeof document === "undefined")
|
|
743
|
+
return;
|
|
744
|
+
const root = document.documentElement;
|
|
745
|
+
if (!currentThemeId) {
|
|
746
|
+
root.removeAttribute("data-oui-theme");
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
root.setAttribute("data-oui-theme", currentThemeId);
|
|
750
|
+
Object.entries(DARK_THEME_CSS_VARS).forEach(([key, value]) => {
|
|
751
|
+
const newValue = currentTheme?.cssVars?.[key] || value;
|
|
752
|
+
root.style.setProperty(key, newValue);
|
|
753
|
+
});
|
|
754
|
+
}, [currentThemeId, currentTheme]);
|
|
755
|
+
return /* @__PURE__ */ jsx(
|
|
756
|
+
OrderlyThemeProvider,
|
|
757
|
+
{
|
|
758
|
+
themes,
|
|
759
|
+
currentThemeId,
|
|
760
|
+
currentTheme,
|
|
761
|
+
setCurrentThemeId,
|
|
762
|
+
...rest,
|
|
763
|
+
children
|
|
764
|
+
}
|
|
765
|
+
);
|
|
766
|
+
};
|
|
725
767
|
var ExecutionReportListener = () => {
|
|
726
768
|
useExecutionReport();
|
|
727
769
|
return null;
|
|
@@ -731,6 +773,7 @@ var OrderlyAppProvider = (props) => {
|
|
|
731
773
|
// dateFormatting,
|
|
732
774
|
components,
|
|
733
775
|
appIcons,
|
|
776
|
+
themes,
|
|
734
777
|
onChainChanged,
|
|
735
778
|
defaultChain,
|
|
736
779
|
widgetConfigs,
|
|
@@ -740,10 +783,11 @@ var OrderlyAppProvider = (props) => {
|
|
|
740
783
|
useBootstrap();
|
|
741
784
|
const uiLocale = useUILocale();
|
|
742
785
|
return /* @__PURE__ */ jsx(AppConfigProvider, { appIcons, brokerName: props.brokerName, children: /* @__PURE__ */ jsx(
|
|
743
|
-
|
|
786
|
+
AppThemeProvider,
|
|
744
787
|
{
|
|
745
788
|
components,
|
|
746
789
|
overrides: props.overrides,
|
|
790
|
+
themes,
|
|
747
791
|
children: /* @__PURE__ */ jsxs(OrderlyConfigProvider, { ...configProps, children: [
|
|
748
792
|
/* @__PURE__ */ jsx(ExecutionReportListener, {}),
|
|
749
793
|
/* @__PURE__ */ jsx(
|
|
@@ -1189,19 +1233,32 @@ function useCanTrade() {
|
|
|
1189
1233
|
}
|
|
1190
1234
|
|
|
1191
1235
|
// src/constants/changesets.ts
|
|
1192
|
-
var SDK_VERSION = "2.
|
|
1236
|
+
var SDK_VERSION = "2.9.0";
|
|
1193
1237
|
var CHANGESETS = {
|
|
1194
|
-
"2.
|
|
1195
|
-
date: "2026-03-
|
|
1196
|
-
title: "
|
|
1197
|
-
summary: "
|
|
1238
|
+
"2.9.0": {
|
|
1239
|
+
date: "2026-03-27",
|
|
1240
|
+
title: "Isolated margin mode and Orderly SDK v2.10 sync",
|
|
1241
|
+
summary: "Synced with Orderly SDK v2.10, introducing isolated margin mode, margin adjustment, effective fee calculations with referral rebates, and trading points support.",
|
|
1198
1242
|
highlights: [
|
|
1199
|
-
"
|
|
1200
|
-
"
|
|
1201
|
-
"
|
|
1243
|
+
"Switch between Cross and Isolated margin modes per symbol",
|
|
1244
|
+
"Adjust margin on isolated positions with add/reduce controls",
|
|
1245
|
+
"Effective fee display with referral rebate discounts for regular and RWA markets",
|
|
1246
|
+
"Trading points module with full i18n support across 17 languages",
|
|
1247
|
+
"Storybook Router context fix for new RWA route detection"
|
|
1202
1248
|
],
|
|
1203
|
-
packages: [
|
|
1204
|
-
|
|
1249
|
+
packages: [
|
|
1250
|
+
"kodiak-orderly-hooks",
|
|
1251
|
+
"kodiak-orderly-ui-order-entry",
|
|
1252
|
+
"kodiak-orderly-ui-positions",
|
|
1253
|
+
"kodiak-orderly-ui-leverage",
|
|
1254
|
+
"kodiak-orderly-i18n",
|
|
1255
|
+
"kodiak-orderly-trading-points",
|
|
1256
|
+
"kodiak-orderly-types",
|
|
1257
|
+
"kodiak-orderly-trading",
|
|
1258
|
+
"kodiak-orderly-portfolio",
|
|
1259
|
+
"kodiak-orderly-app"
|
|
1260
|
+
],
|
|
1261
|
+
type: "feature"
|
|
1205
1262
|
},
|
|
1206
1263
|
"2.8.32": {
|
|
1207
1264
|
date: "2026-03-04",
|