@orderly.network/hooks 1.0.13 → 1.0.15
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 +38 -27
- package/dist/index.d.ts +38 -27
- package/dist/index.js +176 -249
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +178 -250
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
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';
|
|
10
10
|
import { WS } from '@orderly.network/net';
|
|
11
11
|
import * as react from 'react';
|
|
12
|
-
import
|
|
12
|
+
import { PropsWithChildren } from 'react';
|
|
13
13
|
import { NetworkId, OrderSide, OrderEntity, API, WSMessage, OrderStatus, WS_WalletStatusEnum } from '@orderly.network/types';
|
|
14
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
14
15
|
import * as swr_subscription from 'swr/subscription';
|
|
15
16
|
import { Decimal } from '@orderly.network/utils';
|
|
16
17
|
export * from 'use-debounce';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
type useQueryOptions<T> = SWRConfiguration & {
|
|
19
20
|
formatter?: (data: any) => T;
|
|
20
21
|
};
|
|
21
22
|
|
|
@@ -33,13 +34,13 @@ declare const useQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: use
|
|
|
33
34
|
* @param query
|
|
34
35
|
* @param options
|
|
35
36
|
*/
|
|
36
|
-
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any
|
|
37
|
+
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any> & {
|
|
37
38
|
formatter?: ((data: any) => R) | undefined;
|
|
38
39
|
init?: RequestInit | undefined;
|
|
39
40
|
}) | undefined) => SWRMutationResponse;
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E
|
|
42
|
+
type HTTP_METHOD = "POST" | "PUT" | "DELETE";
|
|
43
|
+
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E> | undefined) => readonly [(data: any, params?: any) => Promise<any>, {
|
|
43
44
|
readonly data: any;
|
|
44
45
|
readonly error: E | undefined;
|
|
45
46
|
readonly reset: () => void;
|
|
@@ -86,7 +87,7 @@ declare function useLocalStorage<T>(key: string, initialValue: T): [any, (value:
|
|
|
86
87
|
|
|
87
88
|
declare const useWS: () => WS;
|
|
88
89
|
|
|
89
|
-
declare const useConfig: <T>(key?: ConfigKey
|
|
90
|
+
declare const useConfig: <T>(key?: ConfigKey, defaultValue?: T | undefined) => ConfigStore | T;
|
|
90
91
|
|
|
91
92
|
interface OrderlyConfigContextState {
|
|
92
93
|
fetcher?: (url: string, init: RequestInit) => Promise<any>;
|
|
@@ -94,13 +95,19 @@ interface OrderlyConfigContextState {
|
|
|
94
95
|
keyStore: OrderlyKeyStore;
|
|
95
96
|
getWalletAdapter: getWalletAdapterFunc;
|
|
96
97
|
networkId: NetworkId;
|
|
98
|
+
/**
|
|
99
|
+
* @hidden
|
|
100
|
+
*/
|
|
97
101
|
onlyTestnet?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* @hidden
|
|
104
|
+
*/
|
|
98
105
|
enableSwapDeposit?: boolean;
|
|
99
106
|
}
|
|
100
107
|
declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
|
|
101
108
|
declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
|
|
102
109
|
|
|
103
|
-
|
|
110
|
+
type RequireAtLeastOne<T, R extends keyof T = keyof T> = Omit<T, R> & {
|
|
104
111
|
[K in R]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<R, K>>>;
|
|
105
112
|
}[R];
|
|
106
113
|
interface ConfigProviderProps {
|
|
@@ -111,9 +118,9 @@ interface ConfigProviderProps {
|
|
|
111
118
|
networkId: NetworkId;
|
|
112
119
|
enableSwapDeposit?: boolean;
|
|
113
120
|
}
|
|
114
|
-
declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) =>
|
|
121
|
+
declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) => react_jsx_runtime.JSX.Element | null;
|
|
115
122
|
|
|
116
|
-
|
|
123
|
+
type ConnectedChain = {
|
|
117
124
|
id: string;
|
|
118
125
|
};
|
|
119
126
|
interface WalletConnectorContextState {
|
|
@@ -132,19 +139,19 @@ interface WalletConnectorContextState {
|
|
|
132
139
|
declare const WalletConnectorContext: react.Context<WalletConnectorContextState>;
|
|
133
140
|
declare const useWalletConnector: () => WalletConnectorContextState;
|
|
134
141
|
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
type OrderBookItem = number[];
|
|
143
|
+
type OrderbookData = {
|
|
137
144
|
asks: OrderBookItem[];
|
|
138
145
|
bids: OrderBookItem[];
|
|
139
146
|
};
|
|
140
|
-
|
|
147
|
+
type OrderbookOptions = {
|
|
141
148
|
level?: number;
|
|
142
149
|
};
|
|
143
150
|
/**
|
|
144
151
|
* @name useOrderbookStream
|
|
145
152
|
* @description React hook that returns the current orderbook for a given market
|
|
146
153
|
*/
|
|
147
|
-
declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions
|
|
154
|
+
declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions) => ({
|
|
148
155
|
asks: OrderBookItem[];
|
|
149
156
|
bids: OrderBookItem[];
|
|
150
157
|
markPrice: any;
|
|
@@ -166,7 +173,7 @@ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, opti
|
|
|
166
173
|
middlePrice?: undefined;
|
|
167
174
|
})[];
|
|
168
175
|
|
|
169
|
-
|
|
176
|
+
type UseOrderEntryOptions = {
|
|
170
177
|
commify?: boolean;
|
|
171
178
|
validate?: (data: OrderEntity) => {
|
|
172
179
|
[P in keyof OrderEntity]?: string;
|
|
@@ -177,7 +184,7 @@ declare type UseOrderEntryOptions = {
|
|
|
177
184
|
* @param symbol
|
|
178
185
|
* @returns
|
|
179
186
|
*/
|
|
180
|
-
declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions
|
|
187
|
+
declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions) => {
|
|
181
188
|
maxQty: number;
|
|
182
189
|
freeCollateral: number;
|
|
183
190
|
markPrice: any;
|
|
@@ -221,7 +228,7 @@ declare const useFundingRate: (symbol: string) => {
|
|
|
221
228
|
sum_unitary_funding?: number | undefined;
|
|
222
229
|
};
|
|
223
230
|
|
|
224
|
-
declare const usePositionStream: (symbol?: string
|
|
231
|
+
declare const usePositionStream: (symbol?: string, options?: SWRConfiguration) => readonly [{
|
|
225
232
|
readonly rows: API.PositionExt[] | null;
|
|
226
233
|
readonly aggregated: any;
|
|
227
234
|
readonly totalCollateral: Decimal;
|
|
@@ -234,7 +241,7 @@ declare const usePositionStream: (symbol?: string | undefined, options?: Partial
|
|
|
234
241
|
readonly refresh: () => void;
|
|
235
242
|
}];
|
|
236
243
|
|
|
237
|
-
|
|
244
|
+
type Params = {
|
|
238
245
|
symbol?: string;
|
|
239
246
|
status?: OrderStatus;
|
|
240
247
|
size?: number;
|
|
@@ -246,7 +253,11 @@ declare const useOrderStream: (params: Params) => readonly [any[] | null, {
|
|
|
246
253
|
readonly loadMore: () => void;
|
|
247
254
|
readonly cancelAllOrders: () => void;
|
|
248
255
|
readonly updateOrder: (orderId: string, order: OrderEntity) => Promise<any>;
|
|
249
|
-
readonly cancelOrder: (orderId: string, symbol?: string
|
|
256
|
+
readonly cancelOrder: (orderId: string, symbol?: string) => Promise<void>;
|
|
257
|
+
readonly errors: {
|
|
258
|
+
readonly cancelOrder: unknown;
|
|
259
|
+
readonly updateOrder: unknown;
|
|
260
|
+
};
|
|
250
261
|
}];
|
|
251
262
|
|
|
252
263
|
interface MarketTradeStreamOptions {
|
|
@@ -257,14 +268,14 @@ declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStream
|
|
|
257
268
|
isLoading: boolean;
|
|
258
269
|
};
|
|
259
270
|
|
|
260
|
-
|
|
271
|
+
type CollateralOutputs = {
|
|
261
272
|
totalCollateral: number;
|
|
262
273
|
freeCollateral: number;
|
|
263
274
|
totalValue: number;
|
|
264
275
|
availableBalance: number;
|
|
265
276
|
unsettledPnL: number;
|
|
266
277
|
};
|
|
267
|
-
|
|
278
|
+
type Options = {
|
|
268
279
|
dp: number;
|
|
269
280
|
};
|
|
270
281
|
declare const useCollateral: (options?: Options) => CollateralOutputs;
|
|
@@ -276,18 +287,18 @@ declare const useMarginRatio: () => {
|
|
|
276
287
|
currentLeverage: number;
|
|
277
288
|
};
|
|
278
289
|
|
|
279
|
-
|
|
290
|
+
type inputOptions = {
|
|
280
291
|
filter?: (item: API.Chain) => boolean;
|
|
281
292
|
pick?: "dexs" | "network_infos" | "token_infos";
|
|
282
293
|
crossEnabled?: boolean;
|
|
283
294
|
/** if true, use wooSwap api, else use orderly api only */
|
|
284
295
|
wooSwapEnabled?: boolean;
|
|
285
296
|
};
|
|
286
|
-
declare const useChains: (networkId?: NetworkId
|
|
297
|
+
declare const useChains: (networkId?: NetworkId, options?: inputOptions & SWRConfiguration) => readonly [API.Chain[] | {
|
|
287
298
|
testnet: API.Chain[];
|
|
288
299
|
mainnet: API.Chain[];
|
|
289
300
|
}, {
|
|
290
|
-
readonly findByChainId: (chainId: number, field?: string
|
|
301
|
+
readonly findByChainId: (chainId: number, field?: string) => (API.Chain & {
|
|
291
302
|
nativeToken?: API.TokenInfo | undefined;
|
|
292
303
|
}) | undefined;
|
|
293
304
|
readonly error: any;
|
|
@@ -310,7 +321,7 @@ declare const useWithdraw: () => {
|
|
|
310
321
|
unsettledPnL: number;
|
|
311
322
|
};
|
|
312
323
|
|
|
313
|
-
|
|
324
|
+
type useDepositOptions = {
|
|
314
325
|
address?: string;
|
|
315
326
|
decimals?: number;
|
|
316
327
|
crossChainRouteAddress?: string;
|
|
@@ -323,7 +334,7 @@ declare type useDepositOptions = {
|
|
|
323
334
|
*/
|
|
324
335
|
wooSwapEnabled?: boolean;
|
|
325
336
|
};
|
|
326
|
-
declare const useDeposit: (options?: useDepositOptions
|
|
337
|
+
declare const useDeposit: (options?: useDepositOptions) => {
|
|
327
338
|
dst: {
|
|
328
339
|
symbol: string;
|
|
329
340
|
address: string | undefined;
|
|
@@ -339,7 +350,7 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
|
339
350
|
approve: (amount: string | undefined) => Promise<any>;
|
|
340
351
|
deposit: (amount: string) => Promise<any>;
|
|
341
352
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
342
|
-
fetchBalance: (address: string, decimals?: number
|
|
353
|
+
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
343
354
|
};
|
|
344
355
|
|
|
345
356
|
declare const useHoldingStream: () => {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
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';
|
|
10
10
|
import { WS } from '@orderly.network/net';
|
|
11
11
|
import * as react from 'react';
|
|
12
|
-
import
|
|
12
|
+
import { PropsWithChildren } from 'react';
|
|
13
13
|
import { NetworkId, OrderSide, OrderEntity, API, WSMessage, OrderStatus, WS_WalletStatusEnum } from '@orderly.network/types';
|
|
14
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
14
15
|
import * as swr_subscription from 'swr/subscription';
|
|
15
16
|
import { Decimal } from '@orderly.network/utils';
|
|
16
17
|
export * from 'use-debounce';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
type useQueryOptions<T> = SWRConfiguration & {
|
|
19
20
|
formatter?: (data: any) => T;
|
|
20
21
|
};
|
|
21
22
|
|
|
@@ -33,13 +34,13 @@ declare const useQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: use
|
|
|
33
34
|
* @param query
|
|
34
35
|
* @param options
|
|
35
36
|
*/
|
|
36
|
-
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any
|
|
37
|
+
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any> & {
|
|
37
38
|
formatter?: ((data: any) => R) | undefined;
|
|
38
39
|
init?: RequestInit | undefined;
|
|
39
40
|
}) | undefined) => SWRMutationResponse;
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E
|
|
42
|
+
type HTTP_METHOD = "POST" | "PUT" | "DELETE";
|
|
43
|
+
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E> | undefined) => readonly [(data: any, params?: any) => Promise<any>, {
|
|
43
44
|
readonly data: any;
|
|
44
45
|
readonly error: E | undefined;
|
|
45
46
|
readonly reset: () => void;
|
|
@@ -86,7 +87,7 @@ declare function useLocalStorage<T>(key: string, initialValue: T): [any, (value:
|
|
|
86
87
|
|
|
87
88
|
declare const useWS: () => WS;
|
|
88
89
|
|
|
89
|
-
declare const useConfig: <T>(key?: ConfigKey
|
|
90
|
+
declare const useConfig: <T>(key?: ConfigKey, defaultValue?: T | undefined) => ConfigStore | T;
|
|
90
91
|
|
|
91
92
|
interface OrderlyConfigContextState {
|
|
92
93
|
fetcher?: (url: string, init: RequestInit) => Promise<any>;
|
|
@@ -94,13 +95,19 @@ interface OrderlyConfigContextState {
|
|
|
94
95
|
keyStore: OrderlyKeyStore;
|
|
95
96
|
getWalletAdapter: getWalletAdapterFunc;
|
|
96
97
|
networkId: NetworkId;
|
|
98
|
+
/**
|
|
99
|
+
* @hidden
|
|
100
|
+
*/
|
|
97
101
|
onlyTestnet?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* @hidden
|
|
104
|
+
*/
|
|
98
105
|
enableSwapDeposit?: boolean;
|
|
99
106
|
}
|
|
100
107
|
declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
|
|
101
108
|
declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
|
|
102
109
|
|
|
103
|
-
|
|
110
|
+
type RequireAtLeastOne<T, R extends keyof T = keyof T> = Omit<T, R> & {
|
|
104
111
|
[K in R]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<R, K>>>;
|
|
105
112
|
}[R];
|
|
106
113
|
interface ConfigProviderProps {
|
|
@@ -111,9 +118,9 @@ interface ConfigProviderProps {
|
|
|
111
118
|
networkId: NetworkId;
|
|
112
119
|
enableSwapDeposit?: boolean;
|
|
113
120
|
}
|
|
114
|
-
declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) =>
|
|
121
|
+
declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) => react_jsx_runtime.JSX.Element | null;
|
|
115
122
|
|
|
116
|
-
|
|
123
|
+
type ConnectedChain = {
|
|
117
124
|
id: string;
|
|
118
125
|
};
|
|
119
126
|
interface WalletConnectorContextState {
|
|
@@ -132,19 +139,19 @@ interface WalletConnectorContextState {
|
|
|
132
139
|
declare const WalletConnectorContext: react.Context<WalletConnectorContextState>;
|
|
133
140
|
declare const useWalletConnector: () => WalletConnectorContextState;
|
|
134
141
|
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
type OrderBookItem = number[];
|
|
143
|
+
type OrderbookData = {
|
|
137
144
|
asks: OrderBookItem[];
|
|
138
145
|
bids: OrderBookItem[];
|
|
139
146
|
};
|
|
140
|
-
|
|
147
|
+
type OrderbookOptions = {
|
|
141
148
|
level?: number;
|
|
142
149
|
};
|
|
143
150
|
/**
|
|
144
151
|
* @name useOrderbookStream
|
|
145
152
|
* @description React hook that returns the current orderbook for a given market
|
|
146
153
|
*/
|
|
147
|
-
declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions
|
|
154
|
+
declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions) => ({
|
|
148
155
|
asks: OrderBookItem[];
|
|
149
156
|
bids: OrderBookItem[];
|
|
150
157
|
markPrice: any;
|
|
@@ -166,7 +173,7 @@ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, opti
|
|
|
166
173
|
middlePrice?: undefined;
|
|
167
174
|
})[];
|
|
168
175
|
|
|
169
|
-
|
|
176
|
+
type UseOrderEntryOptions = {
|
|
170
177
|
commify?: boolean;
|
|
171
178
|
validate?: (data: OrderEntity) => {
|
|
172
179
|
[P in keyof OrderEntity]?: string;
|
|
@@ -177,7 +184,7 @@ declare type UseOrderEntryOptions = {
|
|
|
177
184
|
* @param symbol
|
|
178
185
|
* @returns
|
|
179
186
|
*/
|
|
180
|
-
declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions
|
|
187
|
+
declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions) => {
|
|
181
188
|
maxQty: number;
|
|
182
189
|
freeCollateral: number;
|
|
183
190
|
markPrice: any;
|
|
@@ -221,7 +228,7 @@ declare const useFundingRate: (symbol: string) => {
|
|
|
221
228
|
sum_unitary_funding?: number | undefined;
|
|
222
229
|
};
|
|
223
230
|
|
|
224
|
-
declare const usePositionStream: (symbol?: string
|
|
231
|
+
declare const usePositionStream: (symbol?: string, options?: SWRConfiguration) => readonly [{
|
|
225
232
|
readonly rows: API.PositionExt[] | null;
|
|
226
233
|
readonly aggregated: any;
|
|
227
234
|
readonly totalCollateral: Decimal;
|
|
@@ -234,7 +241,7 @@ declare const usePositionStream: (symbol?: string | undefined, options?: Partial
|
|
|
234
241
|
readonly refresh: () => void;
|
|
235
242
|
}];
|
|
236
243
|
|
|
237
|
-
|
|
244
|
+
type Params = {
|
|
238
245
|
symbol?: string;
|
|
239
246
|
status?: OrderStatus;
|
|
240
247
|
size?: number;
|
|
@@ -246,7 +253,11 @@ declare const useOrderStream: (params: Params) => readonly [any[] | null, {
|
|
|
246
253
|
readonly loadMore: () => void;
|
|
247
254
|
readonly cancelAllOrders: () => void;
|
|
248
255
|
readonly updateOrder: (orderId: string, order: OrderEntity) => Promise<any>;
|
|
249
|
-
readonly cancelOrder: (orderId: string, symbol?: string
|
|
256
|
+
readonly cancelOrder: (orderId: string, symbol?: string) => Promise<void>;
|
|
257
|
+
readonly errors: {
|
|
258
|
+
readonly cancelOrder: unknown;
|
|
259
|
+
readonly updateOrder: unknown;
|
|
260
|
+
};
|
|
250
261
|
}];
|
|
251
262
|
|
|
252
263
|
interface MarketTradeStreamOptions {
|
|
@@ -257,14 +268,14 @@ declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStream
|
|
|
257
268
|
isLoading: boolean;
|
|
258
269
|
};
|
|
259
270
|
|
|
260
|
-
|
|
271
|
+
type CollateralOutputs = {
|
|
261
272
|
totalCollateral: number;
|
|
262
273
|
freeCollateral: number;
|
|
263
274
|
totalValue: number;
|
|
264
275
|
availableBalance: number;
|
|
265
276
|
unsettledPnL: number;
|
|
266
277
|
};
|
|
267
|
-
|
|
278
|
+
type Options = {
|
|
268
279
|
dp: number;
|
|
269
280
|
};
|
|
270
281
|
declare const useCollateral: (options?: Options) => CollateralOutputs;
|
|
@@ -276,18 +287,18 @@ declare const useMarginRatio: () => {
|
|
|
276
287
|
currentLeverage: number;
|
|
277
288
|
};
|
|
278
289
|
|
|
279
|
-
|
|
290
|
+
type inputOptions = {
|
|
280
291
|
filter?: (item: API.Chain) => boolean;
|
|
281
292
|
pick?: "dexs" | "network_infos" | "token_infos";
|
|
282
293
|
crossEnabled?: boolean;
|
|
283
294
|
/** if true, use wooSwap api, else use orderly api only */
|
|
284
295
|
wooSwapEnabled?: boolean;
|
|
285
296
|
};
|
|
286
|
-
declare const useChains: (networkId?: NetworkId
|
|
297
|
+
declare const useChains: (networkId?: NetworkId, options?: inputOptions & SWRConfiguration) => readonly [API.Chain[] | {
|
|
287
298
|
testnet: API.Chain[];
|
|
288
299
|
mainnet: API.Chain[];
|
|
289
300
|
}, {
|
|
290
|
-
readonly findByChainId: (chainId: number, field?: string
|
|
301
|
+
readonly findByChainId: (chainId: number, field?: string) => (API.Chain & {
|
|
291
302
|
nativeToken?: API.TokenInfo | undefined;
|
|
292
303
|
}) | undefined;
|
|
293
304
|
readonly error: any;
|
|
@@ -310,7 +321,7 @@ declare const useWithdraw: () => {
|
|
|
310
321
|
unsettledPnL: number;
|
|
311
322
|
};
|
|
312
323
|
|
|
313
|
-
|
|
324
|
+
type useDepositOptions = {
|
|
314
325
|
address?: string;
|
|
315
326
|
decimals?: number;
|
|
316
327
|
crossChainRouteAddress?: string;
|
|
@@ -323,7 +334,7 @@ declare type useDepositOptions = {
|
|
|
323
334
|
*/
|
|
324
335
|
wooSwapEnabled?: boolean;
|
|
325
336
|
};
|
|
326
|
-
declare const useDeposit: (options?: useDepositOptions
|
|
337
|
+
declare const useDeposit: (options?: useDepositOptions) => {
|
|
327
338
|
dst: {
|
|
328
339
|
symbol: string;
|
|
329
340
|
address: string | undefined;
|
|
@@ -339,7 +350,7 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
|
339
350
|
approve: (amount: string | undefined) => Promise<any>;
|
|
340
351
|
deposit: (amount: string) => Promise<any>;
|
|
341
352
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
342
|
-
fetchBalance: (address: string, decimals?: number
|
|
353
|
+
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
343
354
|
};
|
|
344
355
|
|
|
345
356
|
declare const useHoldingStream: () => {
|