@orderly.network/hooks 1.0.28-alpha.13 → 1.0.28-alpha.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 +33 -30
- package/dist/index.d.ts +33 -30
- package/dist/index.js +114 -124
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -126
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
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, IContract } from '@orderly.network/core';
|
|
9
9
|
export { default as useConstant } from 'use-constant';
|
|
@@ -24,9 +24,9 @@ declare global {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
declare const _default: "1.0.28-alpha.
|
|
27
|
+
declare const _default: "1.0.28-alpha.14";
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
type useQueryOptions<T> = SWRConfiguration & {
|
|
30
30
|
formatter?: (data: any) => T;
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -44,13 +44,13 @@ declare const useQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: use
|
|
|
44
44
|
* @param query
|
|
45
45
|
* @param options
|
|
46
46
|
*/
|
|
47
|
-
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any
|
|
47
|
+
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any> & {
|
|
48
48
|
formatter?: ((data: any) => R) | undefined;
|
|
49
49
|
init?: RequestInit | undefined;
|
|
50
50
|
}) | undefined) => SWRMutationResponse;
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E
|
|
52
|
+
type HTTP_METHOD = "POST" | "PUT" | "DELETE";
|
|
53
|
+
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E> | undefined) => readonly [(data: any, params?: any, options?: any) => Promise<any>, {
|
|
54
54
|
readonly data: any;
|
|
55
55
|
readonly error: E | undefined;
|
|
56
56
|
readonly reset: () => void;
|
|
@@ -97,7 +97,7 @@ declare function useLocalStorage<T>(key: string, initialValue: T): [any, (value:
|
|
|
97
97
|
|
|
98
98
|
declare const useWS: () => WS;
|
|
99
99
|
|
|
100
|
-
declare const useConfig: <T>(key?: ConfigKey
|
|
100
|
+
declare const useConfig: <T>(key?: ConfigKey, defaultValue?: T | undefined) => ConfigStore | T;
|
|
101
101
|
|
|
102
102
|
interface OrderlyConfigContextState {
|
|
103
103
|
fetcher?: (url: string, init: RequestInit) => Promise<any>;
|
|
@@ -117,7 +117,7 @@ interface OrderlyConfigContextState {
|
|
|
117
117
|
declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
|
|
118
118
|
declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
type RequireAtLeastOne<T, R extends keyof T = keyof T> = Omit<T, R> & {
|
|
121
121
|
[K in R]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<R, K>>>;
|
|
122
122
|
}[R];
|
|
123
123
|
interface ConfigProviderProps {
|
|
@@ -131,7 +131,7 @@ interface ConfigProviderProps {
|
|
|
131
131
|
}
|
|
132
132
|
declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) => react_jsx_runtime.JSX.Element | null;
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
type ConnectedChain = {
|
|
135
135
|
id: number;
|
|
136
136
|
};
|
|
137
137
|
interface WalletConnectorContextState {
|
|
@@ -147,19 +147,19 @@ interface WalletConnectorContextState {
|
|
|
147
147
|
declare const WalletConnectorContext: react.Context<WalletConnectorContextState>;
|
|
148
148
|
declare const useWalletConnector: () => WalletConnectorContextState;
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
type OrderBookItem = number[];
|
|
151
|
+
type OrderbookData = {
|
|
152
152
|
asks: OrderBookItem[];
|
|
153
153
|
bids: OrderBookItem[];
|
|
154
154
|
};
|
|
155
|
-
|
|
155
|
+
type OrderbookOptions = {
|
|
156
156
|
level?: number;
|
|
157
157
|
};
|
|
158
158
|
/**
|
|
159
159
|
* @name useOrderbookStream
|
|
160
160
|
* @description React hook that returns the current orderbook for a given market
|
|
161
161
|
*/
|
|
162
|
-
declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions
|
|
162
|
+
declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions) => ({
|
|
163
163
|
asks: OrderBookItem[];
|
|
164
164
|
bids: OrderBookItem[];
|
|
165
165
|
markPrice: any;
|
|
@@ -181,7 +181,7 @@ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, opti
|
|
|
181
181
|
middlePrice?: undefined;
|
|
182
182
|
})[];
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
type UseOrderEntryOptions = {
|
|
185
185
|
commify?: boolean;
|
|
186
186
|
validate?: (data: OrderEntity) => {
|
|
187
187
|
[P in keyof OrderEntity]?: string;
|
|
@@ -192,7 +192,7 @@ declare type UseOrderEntryOptions = {
|
|
|
192
192
|
* @param symbol
|
|
193
193
|
* @returns
|
|
194
194
|
*/
|
|
195
|
-
declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions
|
|
195
|
+
declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions) => {
|
|
196
196
|
maxQty: number;
|
|
197
197
|
freeCollateral: number;
|
|
198
198
|
markPrice: any;
|
|
@@ -234,10 +234,10 @@ declare const useMarkets: (type: MarketsType) => readonly [_orderly_network_type
|
|
|
234
234
|
readonly recent: Recent[];
|
|
235
235
|
readonly addToHistory: (symbol: API.MarketInfoExt) => void;
|
|
236
236
|
readonly updateFavoriteTabs: (tab: FavoriteTab | FavoriteTab[], operator?: {
|
|
237
|
-
add?: boolean
|
|
238
|
-
update?: boolean
|
|
239
|
-
delete?: boolean
|
|
240
|
-
}
|
|
237
|
+
add?: boolean;
|
|
238
|
+
update?: boolean;
|
|
239
|
+
delete?: boolean;
|
|
240
|
+
}) => void;
|
|
241
241
|
readonly updateSymbolFavoriteState: (symbol: API.MarketInfoExt, tab: FavoriteTab | FavoriteTab[], del?: boolean) => void;
|
|
242
242
|
readonly pinToTop: (symbol: API.MarketInfoExt) => void;
|
|
243
243
|
}];
|
|
@@ -263,7 +263,10 @@ declare const useFundingRate: (symbol: string) => {
|
|
|
263
263
|
sum_unitary_funding?: number | undefined;
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
type PriceMode = "markPrice" | "lastPrice";
|
|
267
|
+
declare const usePositionStream: (symbol?: string, options?: SWRConfiguration & {
|
|
268
|
+
calcMode?: PriceMode;
|
|
269
|
+
}) => readonly [{
|
|
267
270
|
readonly rows: API.PositionExt[] | null;
|
|
268
271
|
readonly aggregated: any;
|
|
269
272
|
readonly totalCollateral: Decimal;
|
|
@@ -276,7 +279,7 @@ declare const usePositionStream: (symbol?: string | undefined, options?: Partial
|
|
|
276
279
|
readonly refresh: () => void;
|
|
277
280
|
}];
|
|
278
281
|
|
|
279
|
-
|
|
282
|
+
type Params = {
|
|
280
283
|
symbol?: string;
|
|
281
284
|
status?: OrderStatus;
|
|
282
285
|
size?: number;
|
|
@@ -288,7 +291,7 @@ declare const useOrderStream: (params: Params) => readonly [any[] | null, {
|
|
|
288
291
|
readonly loadMore: () => void;
|
|
289
292
|
readonly cancelAllOrders: () => void;
|
|
290
293
|
readonly updateOrder: (orderId: string, order: OrderEntity) => Promise<any>;
|
|
291
|
-
readonly cancelOrder: (orderId: string, symbol?: string
|
|
294
|
+
readonly cancelOrder: (orderId: string, symbol?: string) => Promise<any>;
|
|
292
295
|
readonly errors: {
|
|
293
296
|
readonly cancelOrder: unknown;
|
|
294
297
|
readonly updateOrder: unknown;
|
|
@@ -307,14 +310,14 @@ declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStream
|
|
|
307
310
|
isLoading: boolean;
|
|
308
311
|
};
|
|
309
312
|
|
|
310
|
-
|
|
313
|
+
type CollateralOutputs = {
|
|
311
314
|
totalCollateral: number;
|
|
312
315
|
freeCollateral: number;
|
|
313
316
|
totalValue: number;
|
|
314
317
|
availableBalance: number;
|
|
315
318
|
unsettledPnL: number;
|
|
316
319
|
};
|
|
317
|
-
|
|
320
|
+
type Options = {
|
|
318
321
|
dp: number;
|
|
319
322
|
};
|
|
320
323
|
declare const useCollateral: (options?: Options) => CollateralOutputs;
|
|
@@ -326,18 +329,18 @@ declare const useMarginRatio: () => {
|
|
|
326
329
|
currentLeverage: number;
|
|
327
330
|
};
|
|
328
331
|
|
|
329
|
-
|
|
332
|
+
type inputOptions = {
|
|
330
333
|
filter?: (item: API.Chain) => boolean;
|
|
331
334
|
pick?: "dexs" | "network_infos" | "token_infos";
|
|
332
335
|
crossEnabled?: boolean;
|
|
333
336
|
/** if true, use wooSwap api, else use orderly api only */
|
|
334
337
|
wooSwapEnabled?: boolean;
|
|
335
338
|
};
|
|
336
|
-
declare const useChains: (networkId?: NetworkId
|
|
339
|
+
declare const useChains: (networkId?: NetworkId, options?: inputOptions & SWRConfiguration) => readonly [API.Chain[] | {
|
|
337
340
|
testnet: API.Chain[];
|
|
338
341
|
mainnet: API.Chain[];
|
|
339
342
|
}, {
|
|
340
|
-
readonly findByChainId: (chainId: number, field?: string
|
|
343
|
+
readonly findByChainId: (chainId: number, field?: string) => (API.Chain & {
|
|
341
344
|
nativeToken?: API.TokenInfo | undefined;
|
|
342
345
|
}) | (<K extends never>(prop: K) => ((API.Chain & {
|
|
343
346
|
nativeToken?: API.TokenInfo | undefined;
|
|
@@ -363,7 +366,7 @@ declare const useWithdraw: () => {
|
|
|
363
366
|
unsettledPnL: number;
|
|
364
367
|
};
|
|
365
368
|
|
|
366
|
-
|
|
369
|
+
type useDepositOptions = {
|
|
367
370
|
address?: string;
|
|
368
371
|
decimals?: number;
|
|
369
372
|
crossChainRouteAddress?: string;
|
|
@@ -377,7 +380,7 @@ declare type useDepositOptions = {
|
|
|
377
380
|
*/
|
|
378
381
|
wooSwapEnabled?: boolean;
|
|
379
382
|
};
|
|
380
|
-
declare const useDeposit: (options?: useDepositOptions
|
|
383
|
+
declare const useDeposit: (options?: useDepositOptions) => {
|
|
381
384
|
/** orderly support chain dst */
|
|
382
385
|
dst: {
|
|
383
386
|
symbol: string;
|
|
@@ -400,7 +403,7 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
|
400
403
|
approve: (amount?: string) => Promise<any>;
|
|
401
404
|
deposit: () => Promise<any>;
|
|
402
405
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
403
|
-
fetchBalance: (address: string, decimals?: number
|
|
406
|
+
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
404
407
|
/** set input quantity */
|
|
405
408
|
setQuantity: react.Dispatch<react.SetStateAction<string>>;
|
|
406
409
|
};
|
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, IContract } from '@orderly.network/core';
|
|
9
9
|
export { default as useConstant } from 'use-constant';
|
|
@@ -24,9 +24,9 @@ declare global {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
declare const _default: "1.0.28-alpha.
|
|
27
|
+
declare const _default: "1.0.28-alpha.14";
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
type useQueryOptions<T> = SWRConfiguration & {
|
|
30
30
|
formatter?: (data: any) => T;
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -44,13 +44,13 @@ declare const useQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: use
|
|
|
44
44
|
* @param query
|
|
45
45
|
* @param options
|
|
46
46
|
*/
|
|
47
|
-
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any
|
|
47
|
+
declare const useLazyQuery: <T, R = any>(query: Parameters<typeof useSWR>["0"], options?: (SWRMutationConfiguration<any, any> & {
|
|
48
48
|
formatter?: ((data: any) => R) | undefined;
|
|
49
49
|
init?: RequestInit | undefined;
|
|
50
50
|
}) | undefined) => SWRMutationResponse;
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E
|
|
52
|
+
type HTTP_METHOD = "POST" | "PUT" | "DELETE";
|
|
53
|
+
declare const useMutation: <T, E>(url: string, method?: HTTP_METHOD, options?: SWRMutationConfiguration<T, E> | undefined) => readonly [(data: any, params?: any, options?: any) => Promise<any>, {
|
|
54
54
|
readonly data: any;
|
|
55
55
|
readonly error: E | undefined;
|
|
56
56
|
readonly reset: () => void;
|
|
@@ -97,7 +97,7 @@ declare function useLocalStorage<T>(key: string, initialValue: T): [any, (value:
|
|
|
97
97
|
|
|
98
98
|
declare const useWS: () => WS;
|
|
99
99
|
|
|
100
|
-
declare const useConfig: <T>(key?: ConfigKey
|
|
100
|
+
declare const useConfig: <T>(key?: ConfigKey, defaultValue?: T | undefined) => ConfigStore | T;
|
|
101
101
|
|
|
102
102
|
interface OrderlyConfigContextState {
|
|
103
103
|
fetcher?: (url: string, init: RequestInit) => Promise<any>;
|
|
@@ -117,7 +117,7 @@ interface OrderlyConfigContextState {
|
|
|
117
117
|
declare const OrderlyContext: react.Context<OrderlyConfigContextState>;
|
|
118
118
|
declare const OrderlyProvider: react.Provider<OrderlyConfigContextState>;
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
type RequireAtLeastOne<T, R extends keyof T = keyof T> = Omit<T, R> & {
|
|
121
121
|
[K in R]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<R, K>>>;
|
|
122
122
|
}[R];
|
|
123
123
|
interface ConfigProviderProps {
|
|
@@ -131,7 +131,7 @@ interface ConfigProviderProps {
|
|
|
131
131
|
}
|
|
132
132
|
declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) => react_jsx_runtime.JSX.Element | null;
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
type ConnectedChain = {
|
|
135
135
|
id: number;
|
|
136
136
|
};
|
|
137
137
|
interface WalletConnectorContextState {
|
|
@@ -147,19 +147,19 @@ interface WalletConnectorContextState {
|
|
|
147
147
|
declare const WalletConnectorContext: react.Context<WalletConnectorContextState>;
|
|
148
148
|
declare const useWalletConnector: () => WalletConnectorContextState;
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
type OrderBookItem = number[];
|
|
151
|
+
type OrderbookData = {
|
|
152
152
|
asks: OrderBookItem[];
|
|
153
153
|
bids: OrderBookItem[];
|
|
154
154
|
};
|
|
155
|
-
|
|
155
|
+
type OrderbookOptions = {
|
|
156
156
|
level?: number;
|
|
157
157
|
};
|
|
158
158
|
/**
|
|
159
159
|
* @name useOrderbookStream
|
|
160
160
|
* @description React hook that returns the current orderbook for a given market
|
|
161
161
|
*/
|
|
162
|
-
declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions
|
|
162
|
+
declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions) => ({
|
|
163
163
|
asks: OrderBookItem[];
|
|
164
164
|
bids: OrderBookItem[];
|
|
165
165
|
markPrice: any;
|
|
@@ -181,7 +181,7 @@ declare const useOrderbookStream: (symbol: string, initial?: OrderbookData, opti
|
|
|
181
181
|
middlePrice?: undefined;
|
|
182
182
|
})[];
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
type UseOrderEntryOptions = {
|
|
185
185
|
commify?: boolean;
|
|
186
186
|
validate?: (data: OrderEntity) => {
|
|
187
187
|
[P in keyof OrderEntity]?: string;
|
|
@@ -192,7 +192,7 @@ declare type UseOrderEntryOptions = {
|
|
|
192
192
|
* @param symbol
|
|
193
193
|
* @returns
|
|
194
194
|
*/
|
|
195
|
-
declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions
|
|
195
|
+
declare const useOrderEntry: (symbol: string, side: OrderSide, reduceOnly?: boolean, options?: UseOrderEntryOptions) => {
|
|
196
196
|
maxQty: number;
|
|
197
197
|
freeCollateral: number;
|
|
198
198
|
markPrice: any;
|
|
@@ -234,10 +234,10 @@ declare const useMarkets: (type: MarketsType) => readonly [_orderly_network_type
|
|
|
234
234
|
readonly recent: Recent[];
|
|
235
235
|
readonly addToHistory: (symbol: API.MarketInfoExt) => void;
|
|
236
236
|
readonly updateFavoriteTabs: (tab: FavoriteTab | FavoriteTab[], operator?: {
|
|
237
|
-
add?: boolean
|
|
238
|
-
update?: boolean
|
|
239
|
-
delete?: boolean
|
|
240
|
-
}
|
|
237
|
+
add?: boolean;
|
|
238
|
+
update?: boolean;
|
|
239
|
+
delete?: boolean;
|
|
240
|
+
}) => void;
|
|
241
241
|
readonly updateSymbolFavoriteState: (symbol: API.MarketInfoExt, tab: FavoriteTab | FavoriteTab[], del?: boolean) => void;
|
|
242
242
|
readonly pinToTop: (symbol: API.MarketInfoExt) => void;
|
|
243
243
|
}];
|
|
@@ -263,7 +263,10 @@ declare const useFundingRate: (symbol: string) => {
|
|
|
263
263
|
sum_unitary_funding?: number | undefined;
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
type PriceMode = "markPrice" | "lastPrice";
|
|
267
|
+
declare const usePositionStream: (symbol?: string, options?: SWRConfiguration & {
|
|
268
|
+
calcMode?: PriceMode;
|
|
269
|
+
}) => readonly [{
|
|
267
270
|
readonly rows: API.PositionExt[] | null;
|
|
268
271
|
readonly aggregated: any;
|
|
269
272
|
readonly totalCollateral: Decimal;
|
|
@@ -276,7 +279,7 @@ declare const usePositionStream: (symbol?: string | undefined, options?: Partial
|
|
|
276
279
|
readonly refresh: () => void;
|
|
277
280
|
}];
|
|
278
281
|
|
|
279
|
-
|
|
282
|
+
type Params = {
|
|
280
283
|
symbol?: string;
|
|
281
284
|
status?: OrderStatus;
|
|
282
285
|
size?: number;
|
|
@@ -288,7 +291,7 @@ declare const useOrderStream: (params: Params) => readonly [any[] | null, {
|
|
|
288
291
|
readonly loadMore: () => void;
|
|
289
292
|
readonly cancelAllOrders: () => void;
|
|
290
293
|
readonly updateOrder: (orderId: string, order: OrderEntity) => Promise<any>;
|
|
291
|
-
readonly cancelOrder: (orderId: string, symbol?: string
|
|
294
|
+
readonly cancelOrder: (orderId: string, symbol?: string) => Promise<any>;
|
|
292
295
|
readonly errors: {
|
|
293
296
|
readonly cancelOrder: unknown;
|
|
294
297
|
readonly updateOrder: unknown;
|
|
@@ -307,14 +310,14 @@ declare const useMarketTradeStream: (symbol: string, options?: MarketTradeStream
|
|
|
307
310
|
isLoading: boolean;
|
|
308
311
|
};
|
|
309
312
|
|
|
310
|
-
|
|
313
|
+
type CollateralOutputs = {
|
|
311
314
|
totalCollateral: number;
|
|
312
315
|
freeCollateral: number;
|
|
313
316
|
totalValue: number;
|
|
314
317
|
availableBalance: number;
|
|
315
318
|
unsettledPnL: number;
|
|
316
319
|
};
|
|
317
|
-
|
|
320
|
+
type Options = {
|
|
318
321
|
dp: number;
|
|
319
322
|
};
|
|
320
323
|
declare const useCollateral: (options?: Options) => CollateralOutputs;
|
|
@@ -326,18 +329,18 @@ declare const useMarginRatio: () => {
|
|
|
326
329
|
currentLeverage: number;
|
|
327
330
|
};
|
|
328
331
|
|
|
329
|
-
|
|
332
|
+
type inputOptions = {
|
|
330
333
|
filter?: (item: API.Chain) => boolean;
|
|
331
334
|
pick?: "dexs" | "network_infos" | "token_infos";
|
|
332
335
|
crossEnabled?: boolean;
|
|
333
336
|
/** if true, use wooSwap api, else use orderly api only */
|
|
334
337
|
wooSwapEnabled?: boolean;
|
|
335
338
|
};
|
|
336
|
-
declare const useChains: (networkId?: NetworkId
|
|
339
|
+
declare const useChains: (networkId?: NetworkId, options?: inputOptions & SWRConfiguration) => readonly [API.Chain[] | {
|
|
337
340
|
testnet: API.Chain[];
|
|
338
341
|
mainnet: API.Chain[];
|
|
339
342
|
}, {
|
|
340
|
-
readonly findByChainId: (chainId: number, field?: string
|
|
343
|
+
readonly findByChainId: (chainId: number, field?: string) => (API.Chain & {
|
|
341
344
|
nativeToken?: API.TokenInfo | undefined;
|
|
342
345
|
}) | (<K extends never>(prop: K) => ((API.Chain & {
|
|
343
346
|
nativeToken?: API.TokenInfo | undefined;
|
|
@@ -363,7 +366,7 @@ declare const useWithdraw: () => {
|
|
|
363
366
|
unsettledPnL: number;
|
|
364
367
|
};
|
|
365
368
|
|
|
366
|
-
|
|
369
|
+
type useDepositOptions = {
|
|
367
370
|
address?: string;
|
|
368
371
|
decimals?: number;
|
|
369
372
|
crossChainRouteAddress?: string;
|
|
@@ -377,7 +380,7 @@ declare type useDepositOptions = {
|
|
|
377
380
|
*/
|
|
378
381
|
wooSwapEnabled?: boolean;
|
|
379
382
|
};
|
|
380
|
-
declare const useDeposit: (options?: useDepositOptions
|
|
383
|
+
declare const useDeposit: (options?: useDepositOptions) => {
|
|
381
384
|
/** orderly support chain dst */
|
|
382
385
|
dst: {
|
|
383
386
|
symbol: string;
|
|
@@ -400,7 +403,7 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
|
400
403
|
approve: (amount?: string) => Promise<any>;
|
|
401
404
|
deposit: () => Promise<any>;
|
|
402
405
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
403
|
-
fetchBalance: (address: string, decimals?: number
|
|
406
|
+
fetchBalance: (address: string, decimals?: number) => Promise<string>;
|
|
404
407
|
/** set input quantity */
|
|
405
408
|
setQuantity: react.Dispatch<react.SetStateAction<string>>;
|
|
406
409
|
};
|