@orderly.network/hooks 1.0.13 → 1.0.14

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 CHANGED
@@ -1,9 +1,9 @@
1
1
  import useSWR, { SWRConfiguration, SWRResponse } from 'swr';
2
2
  export { SWRConfig, SWRConfiguration, default as useSWR } from 'swr';
3
- import * as swr__internal from 'swr/_internal';
4
3
  import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
5
4
  import * as swr_infinite from 'swr/infinite';
6
5
  import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
6
+ import * as swr__internal from 'swr/_internal';
7
7
  import * as _orderly_network_core from '@orderly.network/core';
8
8
  import { AccountState, Account, EventEmitter, ConfigKey, ConfigStore, OrderlyKeyStore, getWalletAdapterFunc } from '@orderly.network/core';
9
9
  export { default as useConstant } from 'use-constant';
@@ -15,7 +15,7 @@ import * as swr_subscription from 'swr/subscription';
15
15
  import { Decimal } from '@orderly.network/utils';
16
16
  export * from 'use-debounce';
17
17
 
18
- declare type useQueryOptions<T> = SWRConfiguration & {
18
+ type useQueryOptions<T> = SWRConfiguration & {
19
19
  formatter?: (data: any) => T;
20
20
  };
21
21
 
@@ -33,13 +33,13 @@ declare const useQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: use
33
33
  * @param query
34
34
  * @param options
35
35
  */
36
- declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any, swr__internal.Key, any, any> & {
36
+ declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any> & {
37
37
  formatter?: ((data: any) => R) | undefined;
38
38
  init?: RequestInit | undefined;
39
39
  }) | undefined) => SWRMutationResponse;
40
40
 
41
- declare type HTTP_METHOD = "POST" | "PUT" | "DELETE";
42
- declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E, swr__internal.Key, any, any> | undefined) => readonly [(data: any, params?: any) => Promise<any>, {
41
+ type HTTP_METHOD = "POST" | "PUT" | "DELETE";
42
+ declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E> | undefined) => readonly [(data: any, params?: any) => Promise<any>, {
43
43
  readonly data: any;
44
44
  readonly error: E | undefined;
45
45
  readonly reset: () => void;
@@ -86,7 +86,7 @@ declare function useLocalStorage<T>(key: string, initialValue: T): [any, (value:
86
86
 
87
87
  declare const useWS: () => WS;
88
88
 
89
- declare const useConfig: <T>(key?: ConfigKey | undefined, defaultValue?: T | undefined) => ConfigStore | T;
89
+ declare const useConfig: <T>(key?: ConfigKey, defaultValue?: T | undefined) => ConfigStore | T;
90
90
 
91
91
  interface OrderlyConfigContextState {
92
92
  fetcher?: (url: string, init: RequestInit) => Promise<any>;
@@ -94,13 +94,19 @@ interface OrderlyConfigContextState {
94
94
  keyStore: OrderlyKeyStore;
95
95
  getWalletAdapter: getWalletAdapterFunc;
96
96
  networkId: NetworkId;
97
+ /**
98
+ * @hidden
99
+ */
97
100
  onlyTestnet?: boolean;
101
+ /**
102
+ * @hidden
103
+ */
98
104
  enableSwapDeposit?: boolean;
99
105
  }
100
106
  declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
101
107
  declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
102
108
 
103
- declare type RequireAtLeastOne<T, R extends keyof T = keyof T> = Omit<T, R> & {
109
+ type RequireAtLeastOne<T, R extends keyof T = keyof T> = Omit<T, R> & {
104
110
  [K in R]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<R, K>>>;
105
111
  }[R];
106
112
  interface ConfigProviderProps {
@@ -113,7 +119,7 @@ interface ConfigProviderProps {
113
119
  }
114
120
  declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) => react__default.JSX.Element | null;
115
121
 
116
- declare type ConnectedChain = {
122
+ type ConnectedChain = {
117
123
  id: string;
118
124
  };
119
125
  interface WalletConnectorContextState {
@@ -132,19 +138,19 @@ interface WalletConnectorContextState {
132
138
  declare const WalletConnectorContext: react.Context<WalletConnectorContextState>;
133
139
  declare const useWalletConnector: () => WalletConnectorContextState;
134
140
 
135
- declare type OrderBookItem = number[];
136
- declare type OrderbookData = {
141
+ type OrderBookItem = number[];
142
+ type OrderbookData = {
137
143
  asks: OrderBookItem[];
138
144
  bids: OrderBookItem[];
139
145
  };
140
- declare type OrderbookOptions = {
146
+ type OrderbookOptions = {
141
147
  level?: number;
142
148
  };
143
149
  /**
144
150
  * @name useOrderbookStream
145
151
  * @description React hook that returns the current orderbook for a given market
146
152
  */
147
- declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions | undefined) => ({
153
+ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions) => ({
148
154
  asks: OrderBookItem[];
149
155
  bids: OrderBookItem[];
150
156
  markPrice: any;
@@ -166,7 +172,7 @@ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, opti
166
172
  middlePrice?: undefined;
167
173
  })[];
168
174
 
169
- declare type UseOrderEntryOptions = {
175
+ type UseOrderEntryOptions = {
170
176
  commify?: boolean;
171
177
  validate?: (data: OrderEntity) => {
172
178
  [P in keyof OrderEntity]?: string;
@@ -177,7 +183,7 @@ declare type UseOrderEntryOptions = {
177
183
  * @param symbol
178
184
  * @returns
179
185
  */
180
- declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions | undefined) => {
186
+ declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions) => {
181
187
  maxQty: number;
182
188
  freeCollateral: number;
183
189
  markPrice: any;
@@ -221,7 +227,7 @@ declare const useFundingRate: (symbol: string) => {
221
227
  sum_unitary_funding?: number | undefined;
222
228
  };
223
229
 
224
- declare const usePositionStream: (symbol?: string | undefined, options?: Partial<swr__internal.PublicConfiguration<any, any, swr__internal.BareFetcher<any>>> | undefined) => readonly [{
230
+ declare const usePositionStream: (symbol?: string, options?: SWRConfiguration) => readonly [{
225
231
  readonly rows: API.PositionExt[] | null;
226
232
  readonly aggregated: any;
227
233
  readonly totalCollateral: Decimal;
@@ -234,7 +240,7 @@ declare const usePositionStream: (symbol?: string | undefined, options?: Partial
234
240
  readonly refresh: () => void;
235
241
  }];
236
242
 
237
- declare type Params = {
243
+ type Params = {
238
244
  symbol?: string;
239
245
  status?: OrderStatus;
240
246
  size?: number;
@@ -246,7 +252,7 @@ declare const useOrderStream: (params: Params) => readonly [any[] | null, {
246
252
  readonly loadMore: () => void;
247
253
  readonly cancelAllOrders: () => void;
248
254
  readonly updateOrder: (orderId: string, order: OrderEntity) => Promise<any>;
249
- readonly cancelOrder: (orderId: string, symbol?: string | undefined) => Promise<void>;
255
+ readonly cancelOrder: (orderId: string, symbol?: string) => Promise<void>;
250
256
  }];
251
257
 
252
258
  interface MarketTradeStreamOptions {
@@ -257,14 +263,14 @@ declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStream
257
263
  isLoading: boolean;
258
264
  };
259
265
 
260
- declare type CollateralOutputs = {
266
+ type CollateralOutputs = {
261
267
  totalCollateral: number;
262
268
  freeCollateral: number;
263
269
  totalValue: number;
264
270
  availableBalance: number;
265
271
  unsettledPnL: number;
266
272
  };
267
- declare type Options = {
273
+ type Options = {
268
274
  dp: number;
269
275
  };
270
276
  declare const useCollateral: (options?: Options) => CollateralOutputs;
@@ -276,18 +282,18 @@ declare const useMarginRatio: () => {
276
282
  currentLeverage: number;
277
283
  };
278
284
 
279
- declare type inputOptions = {
285
+ type inputOptions = {
280
286
  filter?: (item: API.Chain) => boolean;
281
287
  pick?: "dexs" | "network_infos" | "token_infos";
282
288
  crossEnabled?: boolean;
283
289
  /** if true, use wooSwap api, else use orderly api only */
284
290
  wooSwapEnabled?: boolean;
285
291
  };
286
- declare const useChains: (networkId?: NetworkId | undefined, options?: inputOptions & SWRConfiguration) => readonly [API.Chain[] | {
292
+ declare const useChains: (networkId?: NetworkId, options?: inputOptions & SWRConfiguration) => readonly [API.Chain[] | {
287
293
  testnet: API.Chain[];
288
294
  mainnet: API.Chain[];
289
295
  }, {
290
- readonly findByChainId: (chainId: number, field?: string | undefined) => (API.Chain & {
296
+ readonly findByChainId: (chainId: number, field?: string) => (API.Chain & {
291
297
  nativeToken?: API.TokenInfo | undefined;
292
298
  }) | undefined;
293
299
  readonly error: any;
@@ -310,7 +316,7 @@ declare const useWithdraw: () => {
310
316
  unsettledPnL: number;
311
317
  };
312
318
 
313
- declare type useDepositOptions = {
319
+ type useDepositOptions = {
314
320
  address?: string;
315
321
  decimals?: number;
316
322
  crossChainRouteAddress?: string;
@@ -323,7 +329,7 @@ declare type useDepositOptions = {
323
329
  */
324
330
  wooSwapEnabled?: boolean;
325
331
  };
326
- declare const useDeposit: (options?: useDepositOptions | undefined) => {
332
+ declare const useDeposit: (options?: useDepositOptions) => {
327
333
  dst: {
328
334
  symbol: string;
329
335
  address: string | undefined;
@@ -339,7 +345,7 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
339
345
  approve: (amount: string | undefined) => Promise<any>;
340
346
  deposit: (amount: string) => Promise<any>;
341
347
  fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
342
- fetchBalance: (address: string, decimals?: number | undefined) => Promise<string>;
348
+ fetchBalance: (address: string, decimals?: number) => Promise<string>;
343
349
  };
344
350
 
345
351
  declare const useHoldingStream: () => {
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import useSWR, { SWRConfiguration, SWRResponse } from 'swr';
2
2
  export { SWRConfig, SWRConfiguration, default as useSWR } from 'swr';
3
- import * as swr__internal from 'swr/_internal';
4
3
  import { SWRMutationConfiguration, SWRMutationResponse } from 'swr/mutation';
5
4
  import * as swr_infinite from 'swr/infinite';
6
5
  import { SWRInfiniteKeyLoader, SWRInfiniteConfiguration } from 'swr/infinite';
6
+ import * as swr__internal from 'swr/_internal';
7
7
  import * as _orderly_network_core from '@orderly.network/core';
8
8
  import { AccountState, Account, EventEmitter, ConfigKey, ConfigStore, OrderlyKeyStore, getWalletAdapterFunc } from '@orderly.network/core';
9
9
  export { default as useConstant } from 'use-constant';
@@ -15,7 +15,7 @@ import * as swr_subscription from 'swr/subscription';
15
15
  import { Decimal } from '@orderly.network/utils';
16
16
  export * from 'use-debounce';
17
17
 
18
- declare type useQueryOptions<T> = SWRConfiguration & {
18
+ type useQueryOptions<T> = SWRConfiguration & {
19
19
  formatter?: (data: any) => T;
20
20
  };
21
21
 
@@ -33,13 +33,13 @@ declare const useQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: use
33
33
  * @param query
34
34
  * @param options
35
35
  */
36
- declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any, swr__internal.Key, any, any> & {
36
+ declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any> & {
37
37
  formatter?: ((data: any) => R) | undefined;
38
38
  init?: RequestInit | undefined;
39
39
  }) | undefined) => SWRMutationResponse;
40
40
 
41
- declare type HTTP_METHOD = "POST" | "PUT" | "DELETE";
42
- declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E, swr__internal.Key, any, any> | undefined) => readonly [(data: any, params?: any) => Promise<any>, {
41
+ type HTTP_METHOD = "POST" | "PUT" | "DELETE";
42
+ declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E> | undefined) => readonly [(data: any, params?: any) => Promise<any>, {
43
43
  readonly data: any;
44
44
  readonly error: E | undefined;
45
45
  readonly reset: () => void;
@@ -86,7 +86,7 @@ declare function useLocalStorage<T>(key: string, initialValue: T): [any, (value:
86
86
 
87
87
  declare const useWS: () => WS;
88
88
 
89
- declare const useConfig: <T>(key?: ConfigKey | undefined, defaultValue?: T | undefined) => ConfigStore | T;
89
+ declare const useConfig: <T>(key?: ConfigKey, defaultValue?: T | undefined) => ConfigStore | T;
90
90
 
91
91
  interface OrderlyConfigContextState {
92
92
  fetcher?: (url: string, init: RequestInit) => Promise<any>;
@@ -94,13 +94,19 @@ interface OrderlyConfigContextState {
94
94
  keyStore: OrderlyKeyStore;
95
95
  getWalletAdapter: getWalletAdapterFunc;
96
96
  networkId: NetworkId;
97
+ /**
98
+ * @hidden
99
+ */
97
100
  onlyTestnet?: boolean;
101
+ /**
102
+ * @hidden
103
+ */
98
104
  enableSwapDeposit?: boolean;
99
105
  }
100
106
  declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
101
107
  declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
102
108
 
103
- declare type RequireAtLeastOne<T, R extends keyof T = keyof T> = Omit<T, R> & {
109
+ type RequireAtLeastOne<T, R extends keyof T = keyof T> = Omit<T, R> & {
104
110
  [K in R]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<R, K>>>;
105
111
  }[R];
106
112
  interface ConfigProviderProps {
@@ -113,7 +119,7 @@ interface ConfigProviderProps {
113
119
  }
114
120
  declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) => react__default.JSX.Element | null;
115
121
 
116
- declare type ConnectedChain = {
122
+ type ConnectedChain = {
117
123
  id: string;
118
124
  };
119
125
  interface WalletConnectorContextState {
@@ -132,19 +138,19 @@ interface WalletConnectorContextState {
132
138
  declare const WalletConnectorContext: react.Context<WalletConnectorContextState>;
133
139
  declare const useWalletConnector: () => WalletConnectorContextState;
134
140
 
135
- declare type OrderBookItem = number[];
136
- declare type OrderbookData = {
141
+ type OrderBookItem = number[];
142
+ type OrderbookData = {
137
143
  asks: OrderBookItem[];
138
144
  bids: OrderBookItem[];
139
145
  };
140
- declare type OrderbookOptions = {
146
+ type OrderbookOptions = {
141
147
  level?: number;
142
148
  };
143
149
  /**
144
150
  * @name useOrderbookStream
145
151
  * @description React hook that returns the current orderbook for a given market
146
152
  */
147
- declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions | undefined) => ({
153
+ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions) => ({
148
154
  asks: OrderBookItem[];
149
155
  bids: OrderBookItem[];
150
156
  markPrice: any;
@@ -166,7 +172,7 @@ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, opti
166
172
  middlePrice?: undefined;
167
173
  })[];
168
174
 
169
- declare type UseOrderEntryOptions = {
175
+ type UseOrderEntryOptions = {
170
176
  commify?: boolean;
171
177
  validate?: (data: OrderEntity) => {
172
178
  [P in keyof OrderEntity]?: string;
@@ -177,7 +183,7 @@ declare type UseOrderEntryOptions = {
177
183
  * @param symbol
178
184
  * @returns
179
185
  */
180
- declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions | undefined) => {
186
+ declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions) => {
181
187
  maxQty: number;
182
188
  freeCollateral: number;
183
189
  markPrice: any;
@@ -221,7 +227,7 @@ declare const useFundingRate: (symbol: string) => {
221
227
  sum_unitary_funding?: number | undefined;
222
228
  };
223
229
 
224
- declare const usePositionStream: (symbol?: string | undefined, options?: Partial<swr__internal.PublicConfiguration<any, any, swr__internal.BareFetcher<any>>> | undefined) => readonly [{
230
+ declare const usePositionStream: (symbol?: string, options?: SWRConfiguration) => readonly [{
225
231
  readonly rows: API.PositionExt[] | null;
226
232
  readonly aggregated: any;
227
233
  readonly totalCollateral: Decimal;
@@ -234,7 +240,7 @@ declare const usePositionStream: (symbol?: string | undefined, options?: Partial
234
240
  readonly refresh: () => void;
235
241
  }];
236
242
 
237
- declare type Params = {
243
+ type Params = {
238
244
  symbol?: string;
239
245
  status?: OrderStatus;
240
246
  size?: number;
@@ -246,7 +252,7 @@ declare const useOrderStream: (params: Params) => readonly [any[] | null, {
246
252
  readonly loadMore: () => void;
247
253
  readonly cancelAllOrders: () => void;
248
254
  readonly updateOrder: (orderId: string, order: OrderEntity) => Promise<any>;
249
- readonly cancelOrder: (orderId: string, symbol?: string | undefined) => Promise<void>;
255
+ readonly cancelOrder: (orderId: string, symbol?: string) => Promise<void>;
250
256
  }];
251
257
 
252
258
  interface MarketTradeStreamOptions {
@@ -257,14 +263,14 @@ declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStream
257
263
  isLoading: boolean;
258
264
  };
259
265
 
260
- declare type CollateralOutputs = {
266
+ type CollateralOutputs = {
261
267
  totalCollateral: number;
262
268
  freeCollateral: number;
263
269
  totalValue: number;
264
270
  availableBalance: number;
265
271
  unsettledPnL: number;
266
272
  };
267
- declare type Options = {
273
+ type Options = {
268
274
  dp: number;
269
275
  };
270
276
  declare const useCollateral: (options?: Options) => CollateralOutputs;
@@ -276,18 +282,18 @@ declare const useMarginRatio: () => {
276
282
  currentLeverage: number;
277
283
  };
278
284
 
279
- declare type inputOptions = {
285
+ type inputOptions = {
280
286
  filter?: (item: API.Chain) => boolean;
281
287
  pick?: "dexs" | "network_infos" | "token_infos";
282
288
  crossEnabled?: boolean;
283
289
  /** if true, use wooSwap api, else use orderly api only */
284
290
  wooSwapEnabled?: boolean;
285
291
  };
286
- declare const useChains: (networkId?: NetworkId | undefined, options?: inputOptions & SWRConfiguration) => readonly [API.Chain[] | {
292
+ declare const useChains: (networkId?: NetworkId, options?: inputOptions & SWRConfiguration) => readonly [API.Chain[] | {
287
293
  testnet: API.Chain[];
288
294
  mainnet: API.Chain[];
289
295
  }, {
290
- readonly findByChainId: (chainId: number, field?: string | undefined) => (API.Chain & {
296
+ readonly findByChainId: (chainId: number, field?: string) => (API.Chain & {
291
297
  nativeToken?: API.TokenInfo | undefined;
292
298
  }) | undefined;
293
299
  readonly error: any;
@@ -310,7 +316,7 @@ declare const useWithdraw: () => {
310
316
  unsettledPnL: number;
311
317
  };
312
318
 
313
- declare type useDepositOptions = {
319
+ type useDepositOptions = {
314
320
  address?: string;
315
321
  decimals?: number;
316
322
  crossChainRouteAddress?: string;
@@ -323,7 +329,7 @@ declare type useDepositOptions = {
323
329
  */
324
330
  wooSwapEnabled?: boolean;
325
331
  };
326
- declare const useDeposit: (options?: useDepositOptions | undefined) => {
332
+ declare const useDeposit: (options?: useDepositOptions) => {
327
333
  dst: {
328
334
  symbol: string;
329
335
  address: string | undefined;
@@ -339,7 +345,7 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
339
345
  approve: (amount: string | undefined) => Promise<any>;
340
346
  deposit: (amount: string) => Promise<any>;
341
347
  fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
342
- fetchBalance: (address: string, decimals?: number | undefined) => Promise<string>;
348
+ fetchBalance: (address: string, decimals?: number) => Promise<string>;
343
349
  };
344
350
 
345
351
  declare const useHoldingStream: () => {
package/dist/index.js CHANGED
@@ -286,9 +286,12 @@ var useBoolean = (initialValue = false) => {
286
286
  };
287
287
  var usePreLoadData = () => {
288
288
  React.useContext(OrderlyContext);
289
- const { error: tokenError, data: tokenData } = useQuery("/v1/public/token", {
290
- revalidateOnFocus: false
291
- });
289
+ const { error: tokenError, data: tokenData } = useQuery(
290
+ "https://api-evm.orderly.org/v1/public/token",
291
+ {
292
+ revalidateOnFocus: false
293
+ }
294
+ );
292
295
  const isDone = React.useMemo(() => {
293
296
  return !!tokenData;
294
297
  }, [tokenData]);
@@ -437,7 +440,14 @@ var useWS = () => {
437
440
  };
438
441
  var OrderlyConfigProvider = (props) => {
439
442
  const [account5, setAccount] = React__default.default.useState(null);
440
- const { configStore, keyStore, getWalletAdapter, brokerId, networkId, enableSwapDeposit } = props;
443
+ const {
444
+ configStore,
445
+ keyStore,
446
+ getWalletAdapter,
447
+ brokerId,
448
+ networkId,
449
+ enableSwapDeposit
450
+ } = props;
441
451
  if (!brokerId && typeof configStore === "undefined") {
442
452
  console.error("[OrderlyConfigProvider]: brokerId is required");
443
453
  }
@@ -1974,7 +1984,6 @@ var useLeverage = () => {
1974
1984
  const { data: config } = useQuery("/v1/public/config");
1975
1985
  const updateLeverage = React.useCallback((data2) => {
1976
1986
  return update(data2).then((res) => {
1977
- console.log(res);
1978
1987
  if (res.success) {
1979
1988
  return mutate2();
1980
1989
  } else {
@@ -3156,7 +3165,7 @@ var useChains = (networkId, options = {}) => {
3156
3165
  }
3157
3166
  );
3158
3167
  const { data: orderlyChains, error: tokenError } = useQuery(
3159
- // wooSwapEnabled ? "/v1/public/token" :
3168
+ // wooSwapEnabled ? "/v1/public/token" :
3160
3169
  "https://api-evm.orderly.org/v1/public/token",
3161
3170
  {
3162
3171
  revalidateIfStale: false,
@@ -3167,11 +3176,9 @@ var useChains = (networkId, options = {}) => {
3167
3176
  }
3168
3177
  );
3169
3178
  const chains = React.useMemo(() => {
3170
- if (!orderlyChains)
3171
- return void 0;
3172
3179
  let orderlyChainsArr = [];
3173
3180
  const orderlyChainIds = /* @__PURE__ */ new Set();
3174
- orderlyChains.forEach((item) => {
3181
+ orderlyChains?.forEach((item) => {
3175
3182
  item.chain_details.forEach((chain) => {
3176
3183
  const chainId = Number(chain.chain_id);
3177
3184
  orderlyChainIds.add(chainId);
@@ -3197,7 +3204,9 @@ var useChains = (networkId, options = {}) => {
3197
3204
  return;
3198
3205
  }
3199
3206
  if (_chain.chain_id === 421613) {
3200
- const index = testnetArr.findIndex((item2) => item2.network_infos.chain_id === 421613);
3207
+ const index = testnetArr.findIndex(
3208
+ (item2) => item2.network_infos.chain_id === 421613
3209
+ );
3201
3210
  if (index > -1) {
3202
3211
  testnetArr[index] = _chain;
3203
3212
  }
@@ -3264,16 +3273,19 @@ var useChains = (networkId, options = {}) => {
3264
3273
  }
3265
3274
  });
3266
3275
  } else {
3267
- if (!chainInfos)
3268
- return void 0;
3269
3276
  orderlyChainsArr.forEach((chain) => {
3270
3277
  let _chain = chain;
3271
- const networkInfo = chainInfos.find((item) => {
3272
- console.log(item.chain_id, chain.network_infos.chain_id);
3278
+ const networkInfo = chainInfos?.find((item) => {
3273
3279
  return item.chain_id == chain.network_infos.chain_id;
3274
3280
  });
3275
3281
  if (networkInfo) {
3276
- const { name, public_rpc_url, chain_id, currency_symbol, explorer_base_url } = networkInfo;
3282
+ const {
3283
+ name,
3284
+ public_rpc_url,
3285
+ chain_id,
3286
+ currency_symbol,
3287
+ explorer_base_url
3288
+ } = networkInfo;
3277
3289
  _chain.network_infos = {
3278
3290
  ..._chain.network_infos,
3279
3291
  name,
@@ -3290,7 +3302,9 @@ var useChains = (networkId, options = {}) => {
3290
3302
  }
3291
3303
  map.current.set(_chain.network_infos.chain_id, _chain);
3292
3304
  if (_chain.network_infos.chain_id === 421613) {
3293
- const index = testnetArr.findIndex((item) => item.network_infos.chain_id === 421613);
3305
+ const index = testnetArr.findIndex(
3306
+ (item) => item.network_infos.chain_id === 421613
3307
+ );
3294
3308
  if (index > -1) {
3295
3309
  testnetArr[index] = _chain;
3296
3310
  }
@@ -3322,7 +3336,15 @@ var useChains = (networkId, options = {}) => {
3322
3336
  testnet: testnetArr,
3323
3337
  mainnet: mainnetArr
3324
3338
  };
3325
- }, [data, networkId, field, options, orderlyChains, wooSwapEnabled]);
3339
+ }, [
3340
+ data,
3341
+ networkId,
3342
+ field,
3343
+ options,
3344
+ orderlyChains,
3345
+ wooSwapEnabled,
3346
+ chainInfos
3347
+ ]);
3326
3348
  const findByChainId = React.useCallback(
3327
3349
  (chainId, field2) => {
3328
3350
  const chain = map.current.get(chainId);
@@ -3418,7 +3440,7 @@ var useDeposit = (options) => {
3418
3440
  network: chain.network_infos.shortName
3419
3441
  // chainId: 42161,
3420
3442
  };
3421
- }, [networkId]);
3443
+ }, [networkId, findByChainId]);
3422
3444
  const isNativeToken = React.useMemo(
3423
3445
  () => isNativeTokenChecker(options?.address || ""),
3424
3446
  [options?.address]