@orderly.network/hooks 1.0.28-alpha.1 → 1.0.28-alpha.11
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 +45 -6
- package/dist/index.d.ts +45 -6
- package/dist/index.js +307 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +307 -60
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as useConstant } from 'use-constant';
|
|
|
10
10
|
import { WS } from '@orderly.network/net';
|
|
11
11
|
import * as react from 'react';
|
|
12
12
|
import { PropsWithChildren } from 'react';
|
|
13
|
+
import * as _orderly_network_types from '@orderly.network/types';
|
|
13
14
|
import { NetworkId, OrderSide, OrderEntity, API, WSMessage, OrderStatus } from '@orderly.network/types';
|
|
14
15
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
15
16
|
import * as swr_subscription from 'swr/subscription';
|
|
@@ -23,7 +24,7 @@ declare global {
|
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
declare const _default: "1.0.28-alpha.
|
|
27
|
+
declare const _default: "1.0.28-alpha.11";
|
|
27
28
|
|
|
28
29
|
declare type useQueryOptions<T> = SWRConfiguration & {
|
|
29
30
|
formatter?: (data: any) => T;
|
|
@@ -131,7 +132,7 @@ interface ConfigProviderProps {
|
|
|
131
132
|
declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) => react_jsx_runtime.JSX.Element | null;
|
|
132
133
|
|
|
133
134
|
declare type ConnectedChain = {
|
|
134
|
-
id:
|
|
135
|
+
id: number;
|
|
135
136
|
};
|
|
136
137
|
interface WalletConnectorContextState {
|
|
137
138
|
connect: () => Promise<any[]>;
|
|
@@ -212,6 +213,35 @@ declare const useMarketsStream: () => {
|
|
|
212
213
|
data: WSMessage.Ticker[] | null;
|
|
213
214
|
};
|
|
214
215
|
|
|
216
|
+
declare enum MarketsType {
|
|
217
|
+
FAVORITES = 0,
|
|
218
|
+
RECENT = 1,
|
|
219
|
+
ALL = 2
|
|
220
|
+
}
|
|
221
|
+
interface FavoriteTab {
|
|
222
|
+
name: string;
|
|
223
|
+
id: number;
|
|
224
|
+
}
|
|
225
|
+
interface Recent {
|
|
226
|
+
name: string;
|
|
227
|
+
}
|
|
228
|
+
declare const useMarkets: (type: MarketsType) => readonly [_orderly_network_types.WSMessage.Ticker[], {
|
|
229
|
+
readonly favoriteTabs: FavoriteTab[];
|
|
230
|
+
readonly favorites: {
|
|
231
|
+
tabs: FavoriteTab[];
|
|
232
|
+
name: string;
|
|
233
|
+
}[];
|
|
234
|
+
readonly recent: Recent[];
|
|
235
|
+
readonly addToHistory: (symbol: API.MarketInfoExt) => void;
|
|
236
|
+
readonly updateFavoriteTabs: (tab: FavoriteTab | FavoriteTab[], operator?: {
|
|
237
|
+
add?: boolean | undefined;
|
|
238
|
+
update?: boolean | undefined;
|
|
239
|
+
delete?: boolean | undefined;
|
|
240
|
+
} | undefined) => void;
|
|
241
|
+
readonly updateSymbolFavoriteState: (symbol: API.MarketInfoExt, tab: FavoriteTab | FavoriteTab[], del?: boolean) => void;
|
|
242
|
+
readonly pinToTop: (symbol: API.MarketInfoExt) => void;
|
|
243
|
+
}];
|
|
244
|
+
|
|
215
245
|
declare const useMarkPricesStream: () => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
216
246
|
|
|
217
247
|
declare const useMarkPrice: (symbol: string) => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
@@ -341,12 +371,14 @@ declare type useDepositOptions = {
|
|
|
341
371
|
networkId?: NetworkId;
|
|
342
372
|
srcChainId?: number;
|
|
343
373
|
srcToken?: string;
|
|
374
|
+
quantity?: string;
|
|
344
375
|
/**
|
|
345
376
|
* @hidden
|
|
346
377
|
*/
|
|
347
378
|
wooSwapEnabled?: boolean;
|
|
348
379
|
};
|
|
349
380
|
declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
381
|
+
/** orderly support chain dst */
|
|
350
382
|
dst: {
|
|
351
383
|
symbol: string;
|
|
352
384
|
address: string | undefined;
|
|
@@ -359,11 +391,18 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
|
359
391
|
isNativeToken: boolean;
|
|
360
392
|
balanceRevalidating: boolean;
|
|
361
393
|
allowanceRevalidating: boolean;
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
394
|
+
/** input quantiy */
|
|
395
|
+
quantity: string;
|
|
396
|
+
/** orderly deposit fee, unit: wei */
|
|
397
|
+
depositFee: bigint;
|
|
398
|
+
/** enquiring depositFee status on chain */
|
|
399
|
+
depositFeeRevalidating: boolean;
|
|
400
|
+
approve: (amount?: string) => Promise<any>;
|
|
401
|
+
deposit: () => Promise<any>;
|
|
365
402
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
366
403
|
fetchBalance: (address: string, decimals?: number | undefined) => Promise<string>;
|
|
404
|
+
/** set input quantity */
|
|
405
|
+
setQuantity: react.Dispatch<react.SetStateAction<string>>;
|
|
367
406
|
};
|
|
368
407
|
|
|
369
408
|
declare const useHoldingStream: () => {
|
|
@@ -409,4 +448,4 @@ declare const useCrossSwap: () => any;
|
|
|
409
448
|
/** @hidden */
|
|
410
449
|
declare const useSwap: () => any;
|
|
411
450
|
|
|
412
|
-
export { ConfigProviderProps, OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, WalletConnectorContext, useAccount, useAccountInfo, useAccountInstance, useBoolean, useChain, useChains, useCollateral, useConfig, useCrossSwap, useDeposit, useEventEmitter, useFundingRate, useHoldingStream, useIndexPrice, useLazyQuery, useLeverage, useLocalStorage, useMarginRatio, useMarkPrice, useMarkPricesStream, useMarketTradeStream, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useOrderEntry, useOrderStream, useOrderbookStream, usePositionStream, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useSessionStorage, useSettleSubscription, useSwap, useSymbolsInfo, useTickerStream, useWS, useWalletConnector, useWalletSubscription, useWithdraw, useWooCrossSwapQuery, useWooSwapQuery, _default as version };
|
|
451
|
+
export { ConfigProviderProps, MarketsType, OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, WalletConnectorContext, useAccount, useAccountInfo, useAccountInstance, useBoolean, useChain, useChains, useCollateral, useConfig, useCrossSwap, useDeposit, useEventEmitter, useFundingRate, useHoldingStream, useIndexPrice, useLazyQuery, useLeverage, useLocalStorage, useMarginRatio, useMarkPrice, useMarkPricesStream, useMarketTradeStream, useMarkets, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useOrderEntry, useOrderStream, useOrderbookStream, usePositionStream, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useSessionStorage, useSettleSubscription, useSwap, useSymbolsInfo, useTickerStream, useWS, useWalletConnector, useWalletSubscription, useWithdraw, useWooCrossSwapQuery, useWooSwapQuery, _default as version };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { default as useConstant } from 'use-constant';
|
|
|
10
10
|
import { WS } from '@orderly.network/net';
|
|
11
11
|
import * as react from 'react';
|
|
12
12
|
import { PropsWithChildren } from 'react';
|
|
13
|
+
import * as _orderly_network_types from '@orderly.network/types';
|
|
13
14
|
import { NetworkId, OrderSide, OrderEntity, API, WSMessage, OrderStatus } from '@orderly.network/types';
|
|
14
15
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
15
16
|
import * as swr_subscription from 'swr/subscription';
|
|
@@ -23,7 +24,7 @@ declare global {
|
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
declare const _default: "1.0.28-alpha.
|
|
27
|
+
declare const _default: "1.0.28-alpha.11";
|
|
27
28
|
|
|
28
29
|
declare type useQueryOptions<T> = SWRConfiguration & {
|
|
29
30
|
formatter?: (data: any) => T;
|
|
@@ -131,7 +132,7 @@ interface ConfigProviderProps {
|
|
|
131
132
|
declare const OrderlyConfigProvider: (props: PropsWithChildren<RequireAtLeastOne<ConfigProviderProps, "brokerId" | "configStore">>) => react_jsx_runtime.JSX.Element | null;
|
|
132
133
|
|
|
133
134
|
declare type ConnectedChain = {
|
|
134
|
-
id:
|
|
135
|
+
id: number;
|
|
135
136
|
};
|
|
136
137
|
interface WalletConnectorContextState {
|
|
137
138
|
connect: () => Promise<any[]>;
|
|
@@ -212,6 +213,35 @@ declare const useMarketsStream: () => {
|
|
|
212
213
|
data: WSMessage.Ticker[] | null;
|
|
213
214
|
};
|
|
214
215
|
|
|
216
|
+
declare enum MarketsType {
|
|
217
|
+
FAVORITES = 0,
|
|
218
|
+
RECENT = 1,
|
|
219
|
+
ALL = 2
|
|
220
|
+
}
|
|
221
|
+
interface FavoriteTab {
|
|
222
|
+
name: string;
|
|
223
|
+
id: number;
|
|
224
|
+
}
|
|
225
|
+
interface Recent {
|
|
226
|
+
name: string;
|
|
227
|
+
}
|
|
228
|
+
declare const useMarkets: (type: MarketsType) => readonly [_orderly_network_types.WSMessage.Ticker[], {
|
|
229
|
+
readonly favoriteTabs: FavoriteTab[];
|
|
230
|
+
readonly favorites: {
|
|
231
|
+
tabs: FavoriteTab[];
|
|
232
|
+
name: string;
|
|
233
|
+
}[];
|
|
234
|
+
readonly recent: Recent[];
|
|
235
|
+
readonly addToHistory: (symbol: API.MarketInfoExt) => void;
|
|
236
|
+
readonly updateFavoriteTabs: (tab: FavoriteTab | FavoriteTab[], operator?: {
|
|
237
|
+
add?: boolean | undefined;
|
|
238
|
+
update?: boolean | undefined;
|
|
239
|
+
delete?: boolean | undefined;
|
|
240
|
+
} | undefined) => void;
|
|
241
|
+
readonly updateSymbolFavoriteState: (symbol: API.MarketInfoExt, tab: FavoriteTab | FavoriteTab[], del?: boolean) => void;
|
|
242
|
+
readonly pinToTop: (symbol: API.MarketInfoExt) => void;
|
|
243
|
+
}];
|
|
244
|
+
|
|
215
245
|
declare const useMarkPricesStream: () => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
216
246
|
|
|
217
247
|
declare const useMarkPrice: (symbol: string) => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
@@ -341,12 +371,14 @@ declare type useDepositOptions = {
|
|
|
341
371
|
networkId?: NetworkId;
|
|
342
372
|
srcChainId?: number;
|
|
343
373
|
srcToken?: string;
|
|
374
|
+
quantity?: string;
|
|
344
375
|
/**
|
|
345
376
|
* @hidden
|
|
346
377
|
*/
|
|
347
378
|
wooSwapEnabled?: boolean;
|
|
348
379
|
};
|
|
349
380
|
declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
381
|
+
/** orderly support chain dst */
|
|
350
382
|
dst: {
|
|
351
383
|
symbol: string;
|
|
352
384
|
address: string | undefined;
|
|
@@ -359,11 +391,18 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
|
359
391
|
isNativeToken: boolean;
|
|
360
392
|
balanceRevalidating: boolean;
|
|
361
393
|
allowanceRevalidating: boolean;
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
394
|
+
/** input quantiy */
|
|
395
|
+
quantity: string;
|
|
396
|
+
/** orderly deposit fee, unit: wei */
|
|
397
|
+
depositFee: bigint;
|
|
398
|
+
/** enquiring depositFee status on chain */
|
|
399
|
+
depositFeeRevalidating: boolean;
|
|
400
|
+
approve: (amount?: string) => Promise<any>;
|
|
401
|
+
deposit: () => Promise<any>;
|
|
365
402
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
366
403
|
fetchBalance: (address: string, decimals?: number | undefined) => Promise<string>;
|
|
404
|
+
/** set input quantity */
|
|
405
|
+
setQuantity: react.Dispatch<react.SetStateAction<string>>;
|
|
367
406
|
};
|
|
368
407
|
|
|
369
408
|
declare const useHoldingStream: () => {
|
|
@@ -409,4 +448,4 @@ declare const useCrossSwap: () => any;
|
|
|
409
448
|
/** @hidden */
|
|
410
449
|
declare const useSwap: () => any;
|
|
411
450
|
|
|
412
|
-
export { ConfigProviderProps, OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, WalletConnectorContext, useAccount, useAccountInfo, useAccountInstance, useBoolean, useChain, useChains, useCollateral, useConfig, useCrossSwap, useDeposit, useEventEmitter, useFundingRate, useHoldingStream, useIndexPrice, useLazyQuery, useLeverage, useLocalStorage, useMarginRatio, useMarkPrice, useMarkPricesStream, useMarketTradeStream, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useOrderEntry, useOrderStream, useOrderbookStream, usePositionStream, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useSessionStorage, useSettleSubscription, useSwap, useSymbolsInfo, useTickerStream, useWS, useWalletConnector, useWalletSubscription, useWithdraw, useWooCrossSwapQuery, useWooSwapQuery, _default as version };
|
|
451
|
+
export { ConfigProviderProps, MarketsType, OrderlyConfigContextState, OrderlyConfigProvider, OrderlyContext, OrderlyProvider, WalletConnectorContext, useAccount, useAccountInfo, useAccountInstance, useBoolean, useChain, useChains, useCollateral, useConfig, useCrossSwap, useDeposit, useEventEmitter, useFundingRate, useHoldingStream, useIndexPrice, useLazyQuery, useLeverage, useLocalStorage, useMarginRatio, useMarkPrice, useMarkPricesStream, useMarketTradeStream, useMarkets, useMarketsStream, useMaxQty, useMediaQuery, useMutation, useOrderEntry, useOrderStream, useOrderbookStream, usePositionStream, usePreLoadData, usePrivateDataObserver, usePrivateInfiniteQuery, usePrivateQuery, useQuery, useSessionStorage, useSettleSubscription, useSwap, useSymbolsInfo, useTickerStream, useWS, useWalletConnector, useWalletSubscription, useWithdraw, useWooCrossSwapQuery, useWooSwapQuery, _default as version };
|