@orderly.network/hooks 2.4.1 → 2.4.2-alpha.0
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 +21 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -14,6 +14,9 @@ import { debounce } from 'lodash';
|
|
|
14
14
|
import useSWRInfinite, { unstable_serialize } from 'swr/infinite';
|
|
15
15
|
import * as amplitude from '@amplitude/analytics-browser';
|
|
16
16
|
import { jsx } from 'react/jsx-runtime';
|
|
17
|
+
import { DefaultEVMWalletAdapter } from '@orderly.network/default-evm-adapter';
|
|
18
|
+
import { DefaultSolanaWalletAdapter } from '@orderly.network/default-solana-adapter';
|
|
19
|
+
import { EthersProvider } from '@orderly.network/web3-provider-ethers';
|
|
17
20
|
import { create } from 'zustand';
|
|
18
21
|
import { immer } from 'zustand/middleware/immer';
|
|
19
22
|
import { pathOr, omit, prop, pick, compose, head, mergeDeepRight, min, max, isNil, propOr, path, lensIndex, over } from 'ramda';
|
|
@@ -22,9 +25,6 @@ import useSWRSubscription from 'swr/subscription';
|
|
|
22
25
|
import { useDebouncedCallback, useThrottledCallback } from 'use-debounce';
|
|
23
26
|
export * from 'use-debounce';
|
|
24
27
|
import { produce } from 'immer';
|
|
25
|
-
import { DefaultEVMWalletAdapter } from '@orderly.network/default-evm-adapter';
|
|
26
|
-
import { DefaultSolanaWalletAdapter } from '@orderly.network/default-solana-adapter';
|
|
27
|
-
import { EthersProvider } from '@orderly.network/web3-provider-ethers';
|
|
28
28
|
import { qrcode } from '@akamfoad/qr';
|
|
29
29
|
|
|
30
30
|
var __defProp = Object.defineProperty;
|
|
@@ -36,9 +36,9 @@ var __export = (target, all) => {
|
|
|
36
36
|
// src/version.ts
|
|
37
37
|
if (typeof window !== "undefined") {
|
|
38
38
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
39
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.4.
|
|
39
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "2.4.2-alpha.0";
|
|
40
40
|
}
|
|
41
|
-
var version_default = "2.4.
|
|
41
|
+
var version_default = "2.4.2-alpha.0";
|
|
42
42
|
var fetcher = (url, init2 = {}, queryOptions) => get(url, init2, queryOptions?.formatter);
|
|
43
43
|
var OrderlyContext = createContext({
|
|
44
44
|
// configStore: new MemoryConfigStore(),
|
|
@@ -748,6 +748,13 @@ var StatusProvider = (props) => {
|
|
|
748
748
|
const wsStatus = useWsStatus();
|
|
749
749
|
return /* @__PURE__ */ jsx(StatusContext.Provider, { value: { ws: wsStatus }, children: props.children });
|
|
750
750
|
};
|
|
751
|
+
|
|
752
|
+
// src/constants.ts
|
|
753
|
+
var DEFAULT_TICK_SIZES = {
|
|
754
|
+
PERP_BTC_USDC: "1",
|
|
755
|
+
PERP_ETH_USDC: "0.1",
|
|
756
|
+
PERP_SOL_USDC: "0.01"
|
|
757
|
+
};
|
|
751
758
|
var useWSObserver = (calculatorService) => {
|
|
752
759
|
const ws = useWS();
|
|
753
760
|
useEffect(() => {
|
|
@@ -2275,10 +2282,6 @@ var useTickerStream = (symbol) => {
|
|
|
2275
2282
|
};
|
|
2276
2283
|
|
|
2277
2284
|
// src/orderly/useOrderbookStream.ts
|
|
2278
|
-
var DEFAULT_DEPTH = {
|
|
2279
|
-
PERP_BTC_USDC: "1",
|
|
2280
|
-
PERP_ETH_USDC: "0.1"
|
|
2281
|
-
};
|
|
2282
2285
|
var paddingFn = (len) => Array(len).fill([
|
|
2283
2286
|
Number.NaN,
|
|
2284
2287
|
Number.NaN,
|
|
@@ -2387,7 +2390,7 @@ var useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
|
|
|
2387
2390
|
const padding = options?.padding ?? true;
|
|
2388
2391
|
const symbolRef = useRef(symbol);
|
|
2389
2392
|
symbolRef.current = symbol;
|
|
2390
|
-
const
|
|
2393
|
+
const { defaultOrderbookTickSizes: DEFAULT_TICK_SIZES2 } = useContext(OrderlyContext);
|
|
2391
2394
|
const [data, setData] = useState(initial);
|
|
2392
2395
|
const [isLoading, setIsLoading] = useState(true);
|
|
2393
2396
|
const config = useSymbolsInfo()[symbol];
|
|
@@ -2410,12 +2413,12 @@ var useOrderbookStream = (symbol, initial = INIT_DATA, options) => {
|
|
|
2410
2413
|
return [tick];
|
|
2411
2414
|
}, [config("quote_tick")]);
|
|
2412
2415
|
useEffect(() => {
|
|
2413
|
-
if (
|
|
2414
|
-
setDepth(Number(
|
|
2416
|
+
if (DEFAULT_TICK_SIZES2[symbol]) {
|
|
2417
|
+
setDepth(Number(DEFAULT_TICK_SIZES2[symbol]));
|
|
2415
2418
|
} else {
|
|
2416
2419
|
setDepth(config("quote_tick"));
|
|
2417
2420
|
}
|
|
2418
|
-
}, [config("quote_tick"), symbol]);
|
|
2421
|
+
}, [config("quote_tick"), symbol, DEFAULT_TICK_SIZES2]);
|
|
2419
2422
|
const ws = useWS();
|
|
2420
2423
|
const ticker = useTickerStream(symbol);
|
|
2421
2424
|
const eventEmitter = useEventEmitter();
|
|
@@ -8036,6 +8039,9 @@ var OrderlyConfigProvider = (props) => {
|
|
|
8036
8039
|
new DefaultSolanaWalletAdapter()
|
|
8037
8040
|
];
|
|
8038
8041
|
}, [walletAdapters]);
|
|
8042
|
+
const defaultOrderbookTickSizes = useMemo(() => {
|
|
8043
|
+
return props.orderbookDefaultTickSizes || DEFAULT_TICK_SIZES;
|
|
8044
|
+
}, [props.orderbookDefaultTickSizes]);
|
|
8039
8045
|
useLayoutEffect(() => {
|
|
8040
8046
|
let account8 = SimpleDI.get(Account.instanceName);
|
|
8041
8047
|
if (!account8) {
|
|
@@ -8072,7 +8078,8 @@ var OrderlyConfigProvider = (props) => {
|
|
|
8072
8078
|
filteredChains,
|
|
8073
8079
|
walletAdapters: innerWalletAdapters,
|
|
8074
8080
|
// apiBaseUrl,
|
|
8075
|
-
customChains
|
|
8081
|
+
customChains,
|
|
8082
|
+
defaultOrderbookTickSizes
|
|
8076
8083
|
},
|
|
8077
8084
|
children: /* @__PURE__ */ jsx(StatusProvider, { children: /* @__PURE__ */ jsx(DataCenterProvider, { children: props.children }) })
|
|
8078
8085
|
}
|