@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.d.mts
CHANGED
|
@@ -39,7 +39,7 @@ declare const useWalletStateHandle: (options: {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
type RouteOption = {
|
|
42
|
-
href: "/portfolio" | "/portfolio/history";
|
|
42
|
+
href: "/portfolio" | "/portfolio/history" | "/perp";
|
|
43
43
|
name: string;
|
|
44
44
|
};
|
|
45
45
|
type WidgetConfigs = {
|
|
@@ -50,6 +50,15 @@ type WidgetConfigs = {
|
|
|
50
50
|
/** @deprecated The number of custom sub-accounts needs to be configured in sync with the backend. If you’re not sure about it, please don’t set this value. */
|
|
51
51
|
maxSubAccountCount: number;
|
|
52
52
|
};
|
|
53
|
+
withdraw?: {
|
|
54
|
+
/**
|
|
55
|
+
* Control the "withdraw to other wallet" feature.
|
|
56
|
+
* - `true` / `undefined`: enable external wallet trigger & management.
|
|
57
|
+
* - `false`: only show the connected wallet address without external
|
|
58
|
+
* wallet selector or add-wallet dialog.
|
|
59
|
+
*/
|
|
60
|
+
enableWithdrawToExternalWallet?: boolean;
|
|
61
|
+
};
|
|
53
62
|
};
|
|
54
63
|
type AppContextState = {
|
|
55
64
|
connectWallet: ReturnType<typeof useWalletStateHandle>["connectWallet"];
|
|
@@ -71,6 +80,7 @@ type AppContextState = {
|
|
|
71
80
|
widgetConfigs?: WidgetConfigs;
|
|
72
81
|
/** Custom announcements to merge with API announcements */
|
|
73
82
|
customAnnouncements?: API.AnnouncementRow[];
|
|
83
|
+
initialized: boolean;
|
|
74
84
|
};
|
|
75
85
|
declare const useAppContext: () => AppContextState;
|
|
76
86
|
|
|
@@ -125,7 +135,7 @@ declare function useCanTrade(): boolean;
|
|
|
125
135
|
/**
|
|
126
136
|
* SDK Version - BUMP THIS WHEN RELEASING
|
|
127
137
|
*/
|
|
128
|
-
declare const SDK_VERSION = "2.
|
|
138
|
+
declare const SDK_VERSION = "2.9.0";
|
|
129
139
|
type ChangesetEntry = {
|
|
130
140
|
date: string;
|
|
131
141
|
title: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ declare const useWalletStateHandle: (options: {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
type RouteOption = {
|
|
42
|
-
href: "/portfolio" | "/portfolio/history";
|
|
42
|
+
href: "/portfolio" | "/portfolio/history" | "/perp";
|
|
43
43
|
name: string;
|
|
44
44
|
};
|
|
45
45
|
type WidgetConfigs = {
|
|
@@ -50,6 +50,15 @@ type WidgetConfigs = {
|
|
|
50
50
|
/** @deprecated The number of custom sub-accounts needs to be configured in sync with the backend. If you’re not sure about it, please don’t set this value. */
|
|
51
51
|
maxSubAccountCount: number;
|
|
52
52
|
};
|
|
53
|
+
withdraw?: {
|
|
54
|
+
/**
|
|
55
|
+
* Control the "withdraw to other wallet" feature.
|
|
56
|
+
* - `true` / `undefined`: enable external wallet trigger & management.
|
|
57
|
+
* - `false`: only show the connected wallet address without external
|
|
58
|
+
* wallet selector or add-wallet dialog.
|
|
59
|
+
*/
|
|
60
|
+
enableWithdrawToExternalWallet?: boolean;
|
|
61
|
+
};
|
|
53
62
|
};
|
|
54
63
|
type AppContextState = {
|
|
55
64
|
connectWallet: ReturnType<typeof useWalletStateHandle>["connectWallet"];
|
|
@@ -71,6 +80,7 @@ type AppContextState = {
|
|
|
71
80
|
widgetConfigs?: WidgetConfigs;
|
|
72
81
|
/** Custom announcements to merge with API announcements */
|
|
73
82
|
customAnnouncements?: API.AnnouncementRow[];
|
|
83
|
+
initialized: boolean;
|
|
74
84
|
};
|
|
75
85
|
declare const useAppContext: () => AppContextState;
|
|
76
86
|
|
|
@@ -125,7 +135,7 @@ declare function useCanTrade(): boolean;
|
|
|
125
135
|
/**
|
|
126
136
|
* SDK Version - BUMP THIS WHEN RELEASING
|
|
127
137
|
*/
|
|
128
|
-
declare const SDK_VERSION = "2.
|
|
138
|
+
declare const SDK_VERSION = "2.9.0";
|
|
129
139
|
type ChangesetEntry = {
|
|
130
140
|
date: string;
|
|
131
141
|
title: string;
|
package/dist/index.js
CHANGED
|
@@ -419,32 +419,35 @@ function useWalletConnectError() {
|
|
|
419
419
|
const ee = orderlyHooks.useEventEmitter();
|
|
420
420
|
const { setLedgerAddress } = orderlyHooks.useStorageLedgerAddress();
|
|
421
421
|
react.useEffect(() => {
|
|
422
|
-
|
|
422
|
+
const handleConnectError = (data) => {
|
|
423
423
|
orderlyUi.toast.error(data.message);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
cancelLabel: t("common.no")
|
|
443
|
-
}).then((res) => {
|
|
444
|
-
});
|
|
424
|
+
};
|
|
425
|
+
const handleLedgerError = (data) => {
|
|
426
|
+
window.setTimeout(() => {
|
|
427
|
+
orderlyUi.modal.confirm({
|
|
428
|
+
title: t("connector.ledger.signMessageFailed"),
|
|
429
|
+
content: t("connector.ledger.signMessageFailed.description"),
|
|
430
|
+
size: "sm",
|
|
431
|
+
onOk: async () => {
|
|
432
|
+
setLedgerAddress(data.userAddress);
|
|
433
|
+
return Promise.resolve();
|
|
434
|
+
},
|
|
435
|
+
okLabel: t("common.ok"),
|
|
436
|
+
onCancel: async () => {
|
|
437
|
+
orderlyUi.toast.error(data.message);
|
|
438
|
+
return Promise.resolve();
|
|
439
|
+
},
|
|
440
|
+
cancelLabel: t("common.no")
|
|
441
|
+
}).then((res) => {
|
|
445
442
|
});
|
|
446
|
-
}
|
|
447
|
-
|
|
443
|
+
});
|
|
444
|
+
};
|
|
445
|
+
ee.on("wallet:connect-error", handleConnectError);
|
|
446
|
+
ee.on("wallet:sign-message-with-ledger-error", handleLedgerError);
|
|
447
|
+
return () => {
|
|
448
|
+
ee.off("wallet:connect-error", handleConnectError);
|
|
449
|
+
ee.off("wallet:sign-message-with-ledger-error", handleLedgerError);
|
|
450
|
+
};
|
|
448
451
|
}, [ee, t]);
|
|
449
452
|
return {};
|
|
450
453
|
}
|
|
@@ -678,6 +681,7 @@ var useAppContext = () => {
|
|
|
678
681
|
};
|
|
679
682
|
var AppStateProvider = (props) => {
|
|
680
683
|
const [showAnnouncement, setShowAnnouncement] = react.useState(false);
|
|
684
|
+
const [initialized, setInitialized] = react.useState(false);
|
|
681
685
|
const [currentChainId, setCurrentChainId] = useCurrentChainId(
|
|
682
686
|
props.defaultChain
|
|
683
687
|
);
|
|
@@ -693,6 +697,9 @@ var AppStateProvider = (props) => {
|
|
|
693
697
|
useWalletConnectError();
|
|
694
698
|
const restrictedInfo = orderlyHooks.useRestrictedInfo(props.restrictedInfo);
|
|
695
699
|
const disabledConnect = restrictedInfo.restrictedOpen;
|
|
700
|
+
react.useEffect(() => {
|
|
701
|
+
setInitialized(true);
|
|
702
|
+
}, []);
|
|
696
703
|
const memoizedValue = react.useMemo(
|
|
697
704
|
() => ({
|
|
698
705
|
connectWallet,
|
|
@@ -706,7 +713,8 @@ var AppStateProvider = (props) => {
|
|
|
706
713
|
setShowAnnouncement,
|
|
707
714
|
onRouteChange: props.onRouteChange,
|
|
708
715
|
widgetConfigs: props.widgetConfigs,
|
|
709
|
-
customAnnouncements: props.customAnnouncements
|
|
716
|
+
customAnnouncements: props.customAnnouncements,
|
|
717
|
+
initialized
|
|
710
718
|
}),
|
|
711
719
|
[
|
|
712
720
|
connectWallet,
|
|
@@ -719,11 +727,45 @@ var AppStateProvider = (props) => {
|
|
|
719
727
|
wrongNetwork,
|
|
720
728
|
props.onRouteChange,
|
|
721
729
|
props.widgetConfigs,
|
|
722
|
-
props.customAnnouncements
|
|
730
|
+
props.customAnnouncements,
|
|
731
|
+
initialized
|
|
723
732
|
]
|
|
724
733
|
);
|
|
725
734
|
return /* @__PURE__ */ jsxRuntime.jsx(AppStateContext.Provider, { value: memoizedValue, children: props.children });
|
|
726
735
|
};
|
|
736
|
+
var ORDERLY_THEME_STORAGE_KEY = "orderly_theme_id";
|
|
737
|
+
var AppThemeProvider = (props) => {
|
|
738
|
+
const { children, themes, ...rest } = props;
|
|
739
|
+
const [currentThemeId, setCurrentThemeId] = orderlyHooks.useLocalStorage(ORDERLY_THEME_STORAGE_KEY, themes?.[0]?.id);
|
|
740
|
+
const currentTheme = react.useMemo(() => {
|
|
741
|
+
return themes?.find((theme) => theme.id === currentThemeId);
|
|
742
|
+
}, [themes, currentThemeId]);
|
|
743
|
+
react.useEffect(() => {
|
|
744
|
+
if (typeof document === "undefined")
|
|
745
|
+
return;
|
|
746
|
+
const root = document.documentElement;
|
|
747
|
+
if (!currentThemeId) {
|
|
748
|
+
root.removeAttribute("data-oui-theme");
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
root.setAttribute("data-oui-theme", currentThemeId);
|
|
752
|
+
Object.entries(orderlyUi.DARK_THEME_CSS_VARS).forEach(([key, value]) => {
|
|
753
|
+
const newValue = currentTheme?.cssVars?.[key] || value;
|
|
754
|
+
root.style.setProperty(key, newValue);
|
|
755
|
+
});
|
|
756
|
+
}, [currentThemeId, currentTheme]);
|
|
757
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
758
|
+
orderlyUi.OrderlyThemeProvider,
|
|
759
|
+
{
|
|
760
|
+
themes,
|
|
761
|
+
currentThemeId,
|
|
762
|
+
currentTheme,
|
|
763
|
+
setCurrentThemeId,
|
|
764
|
+
...rest,
|
|
765
|
+
children
|
|
766
|
+
}
|
|
767
|
+
);
|
|
768
|
+
};
|
|
727
769
|
var ExecutionReportListener = () => {
|
|
728
770
|
useExecutionReport();
|
|
729
771
|
return null;
|
|
@@ -733,6 +775,7 @@ var OrderlyAppProvider = (props) => {
|
|
|
733
775
|
// dateFormatting,
|
|
734
776
|
components,
|
|
735
777
|
appIcons,
|
|
778
|
+
themes,
|
|
736
779
|
onChainChanged,
|
|
737
780
|
defaultChain,
|
|
738
781
|
widgetConfigs,
|
|
@@ -742,10 +785,11 @@ var OrderlyAppProvider = (props) => {
|
|
|
742
785
|
useBootstrap();
|
|
743
786
|
const uiLocale = useUILocale();
|
|
744
787
|
return /* @__PURE__ */ jsxRuntime.jsx(AppConfigProvider, { appIcons, brokerName: props.brokerName, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
745
|
-
|
|
788
|
+
AppThemeProvider,
|
|
746
789
|
{
|
|
747
790
|
components,
|
|
748
791
|
overrides: props.overrides,
|
|
792
|
+
themes,
|
|
749
793
|
children: /* @__PURE__ */ jsxRuntime.jsxs(orderlyHooks.OrderlyConfigProvider, { ...configProps, children: [
|
|
750
794
|
/* @__PURE__ */ jsxRuntime.jsx(ExecutionReportListener, {}),
|
|
751
795
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1191,19 +1235,32 @@ function useCanTrade() {
|
|
|
1191
1235
|
}
|
|
1192
1236
|
|
|
1193
1237
|
// src/constants/changesets.ts
|
|
1194
|
-
var SDK_VERSION = "2.
|
|
1238
|
+
var SDK_VERSION = "2.9.0";
|
|
1195
1239
|
var CHANGESETS = {
|
|
1196
|
-
"2.
|
|
1197
|
-
date: "2026-03-
|
|
1198
|
-
title: "
|
|
1199
|
-
summary: "
|
|
1240
|
+
"2.9.0": {
|
|
1241
|
+
date: "2026-03-27",
|
|
1242
|
+
title: "Isolated margin mode and Orderly SDK v2.10 sync",
|
|
1243
|
+
summary: "Synced with Orderly SDK v2.10, introducing isolated margin mode, margin adjustment, effective fee calculations with referral rebates, and trading points support.",
|
|
1200
1244
|
highlights: [
|
|
1201
|
-
"
|
|
1202
|
-
"
|
|
1203
|
-
"
|
|
1245
|
+
"Switch between Cross and Isolated margin modes per symbol",
|
|
1246
|
+
"Adjust margin on isolated positions with add/reduce controls",
|
|
1247
|
+
"Effective fee display with referral rebate discounts for regular and RWA markets",
|
|
1248
|
+
"Trading points module with full i18n support across 17 languages",
|
|
1249
|
+
"Storybook Router context fix for new RWA route detection"
|
|
1204
1250
|
],
|
|
1205
|
-
packages: [
|
|
1206
|
-
|
|
1251
|
+
packages: [
|
|
1252
|
+
"kodiak-orderly-hooks",
|
|
1253
|
+
"kodiak-orderly-ui-order-entry",
|
|
1254
|
+
"kodiak-orderly-ui-positions",
|
|
1255
|
+
"kodiak-orderly-ui-leverage",
|
|
1256
|
+
"kodiak-orderly-i18n",
|
|
1257
|
+
"kodiak-orderly-trading-points",
|
|
1258
|
+
"kodiak-orderly-types",
|
|
1259
|
+
"kodiak-orderly-trading",
|
|
1260
|
+
"kodiak-orderly-portfolio",
|
|
1261
|
+
"kodiak-orderly-app"
|
|
1262
|
+
],
|
|
1263
|
+
type: "feature"
|
|
1207
1264
|
},
|
|
1208
1265
|
"2.8.32": {
|
|
1209
1266
|
date: "2026-03-04",
|