@orderly.network/hooks 1.0.25-alpha.1 → 1.0.25-alpha.3
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 +17 -62
- package/dist/index.d.ts +17 -62
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -10,12 +10,21 @@ 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 { NetworkId, OrderSide, OrderEntity, API, WSMessage, OrderStatus
|
|
13
|
+
import { NetworkId, OrderSide, OrderEntity, API, WSMessage, OrderStatus } from '@orderly.network/types';
|
|
14
14
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
15
15
|
import * as swr_subscription from 'swr/subscription';
|
|
16
16
|
import { Decimal } from '@orderly.network/utils';
|
|
17
17
|
export * from 'use-debounce';
|
|
18
18
|
|
|
19
|
+
declare global {
|
|
20
|
+
interface Window {
|
|
21
|
+
__ORDERLY_VERSION__?: {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
declare const _default: "1.0.25-alpha.3";
|
|
27
|
+
|
|
19
28
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
20
29
|
formatter?: (data: any) => T;
|
|
21
30
|
};
|
|
@@ -212,11 +221,7 @@ declare const useMarkPrice: (symbol: string) => swr_subscription.SWRSubscription
|
|
|
212
221
|
|
|
213
222
|
declare const useIndexPrice: (symbol: string) => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
214
223
|
|
|
215
|
-
declare const useLeverage: () =>
|
|
216
|
-
update: (data: any) => Promise<unknown>;
|
|
217
|
-
config: number[];
|
|
218
|
-
isMutating: boolean;
|
|
219
|
-
}];
|
|
224
|
+
declare const useLeverage: () => any;
|
|
220
225
|
|
|
221
226
|
declare const useTickerStream: (symbol: string) => API.MarketInfo;
|
|
222
227
|
|
|
@@ -307,7 +312,9 @@ declare const useChains: (networkId?: NetworkId, options?: inputOptions & SWRCon
|
|
|
307
312
|
}, {
|
|
308
313
|
readonly findByChainId: (chainId: number, field?: string) => (API.Chain & {
|
|
309
314
|
nativeToken?: API.TokenInfo | undefined;
|
|
310
|
-
}) |
|
|
315
|
+
}) | (<K extends never>(prop: K) => ((API.Chain & {
|
|
316
|
+
nativeToken?: API.TokenInfo | undefined;
|
|
317
|
+
}) | undefined)[K]) | undefined;
|
|
311
318
|
readonly error: any;
|
|
312
319
|
}];
|
|
313
320
|
|
|
@@ -398,61 +405,9 @@ declare const useWooCrossSwapQuery: () => {
|
|
|
398
405
|
};
|
|
399
406
|
|
|
400
407
|
/** @hidden */
|
|
401
|
-
declare
|
|
402
|
-
INITIALIZING = "WAITTING",
|
|
403
|
-
INFLIGHT = "INFLIGHT",
|
|
404
|
-
DELIVERED = "DELIVERED",
|
|
405
|
-
FAILED = "FAILED"
|
|
406
|
-
}
|
|
407
|
-
/** @hidden */
|
|
408
|
-
declare const useCrossSwap: () => {
|
|
409
|
-
swap: (inputs: {
|
|
410
|
-
address: string;
|
|
411
|
-
crossChainRouteAddress: string;
|
|
412
|
-
src: {
|
|
413
|
-
fromToken: string;
|
|
414
|
-
fromAmount: bigint;
|
|
415
|
-
bridgeToken: string;
|
|
416
|
-
minBridgeAmount: bigint;
|
|
417
|
-
};
|
|
418
|
-
dst: {
|
|
419
|
-
chainId: string;
|
|
420
|
-
bridgedToken: string;
|
|
421
|
-
toToken: string;
|
|
422
|
-
minToAmount: bigint;
|
|
423
|
-
airdropNativeAmount: bigint;
|
|
424
|
-
};
|
|
425
|
-
}) => Promise<{
|
|
426
|
-
readonly hash: string;
|
|
427
|
-
readonly to: string | null;
|
|
428
|
-
readonly from: string;
|
|
429
|
-
readonly value: bigint;
|
|
430
|
-
} | undefined>;
|
|
431
|
-
loading: boolean;
|
|
432
|
-
bridgeStatus: MessageStatus;
|
|
433
|
-
status: WS_WalletStatusEnum;
|
|
434
|
-
message: any;
|
|
435
|
-
};
|
|
408
|
+
declare const useCrossSwap: () => any;
|
|
436
409
|
|
|
437
410
|
/** @hidden */
|
|
438
|
-
declare const useSwap: () =>
|
|
439
|
-
swap: (woofiDexDepositorAdress: string, inputs: {
|
|
440
|
-
fromToken: string;
|
|
441
|
-
fromAmount: string;
|
|
442
|
-
toToken: string;
|
|
443
|
-
minToAmount: string;
|
|
444
|
-
orderlyNativeFees: bigint;
|
|
445
|
-
}, config: {
|
|
446
|
-
dst: any;
|
|
447
|
-
src: any;
|
|
448
|
-
}) => Promise<{
|
|
449
|
-
readonly hash: string;
|
|
450
|
-
readonly to: string | null;
|
|
451
|
-
readonly from: string;
|
|
452
|
-
readonly value: bigint;
|
|
453
|
-
} | undefined>;
|
|
454
|
-
loading: boolean;
|
|
455
|
-
status: WS_WalletStatusEnum;
|
|
456
|
-
};
|
|
411
|
+
declare const useSwap: () => any;
|
|
457
412
|
|
|
458
|
-
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 };
|
|
413
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,12 +10,21 @@ 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 { NetworkId, OrderSide, OrderEntity, API, WSMessage, OrderStatus
|
|
13
|
+
import { NetworkId, OrderSide, OrderEntity, API, WSMessage, OrderStatus } from '@orderly.network/types';
|
|
14
14
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
15
15
|
import * as swr_subscription from 'swr/subscription';
|
|
16
16
|
import { Decimal } from '@orderly.network/utils';
|
|
17
17
|
export * from 'use-debounce';
|
|
18
18
|
|
|
19
|
+
declare global {
|
|
20
|
+
interface Window {
|
|
21
|
+
__ORDERLY_VERSION__?: {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
declare const _default: "1.0.25-alpha.3";
|
|
27
|
+
|
|
19
28
|
type useQueryOptions<T> = SWRConfiguration & {
|
|
20
29
|
formatter?: (data: any) => T;
|
|
21
30
|
};
|
|
@@ -212,11 +221,7 @@ declare const useMarkPrice: (symbol: string) => swr_subscription.SWRSubscription
|
|
|
212
221
|
|
|
213
222
|
declare const useIndexPrice: (symbol: string) => swr_subscription.SWRSubscriptionResponse<any, any>;
|
|
214
223
|
|
|
215
|
-
declare const useLeverage: () =>
|
|
216
|
-
update: (data: any) => Promise<unknown>;
|
|
217
|
-
config: number[];
|
|
218
|
-
isMutating: boolean;
|
|
219
|
-
}];
|
|
224
|
+
declare const useLeverage: () => any;
|
|
220
225
|
|
|
221
226
|
declare const useTickerStream: (symbol: string) => API.MarketInfo;
|
|
222
227
|
|
|
@@ -307,7 +312,9 @@ declare const useChains: (networkId?: NetworkId, options?: inputOptions & SWRCon
|
|
|
307
312
|
}, {
|
|
308
313
|
readonly findByChainId: (chainId: number, field?: string) => (API.Chain & {
|
|
309
314
|
nativeToken?: API.TokenInfo | undefined;
|
|
310
|
-
}) |
|
|
315
|
+
}) | (<K extends never>(prop: K) => ((API.Chain & {
|
|
316
|
+
nativeToken?: API.TokenInfo | undefined;
|
|
317
|
+
}) | undefined)[K]) | undefined;
|
|
311
318
|
readonly error: any;
|
|
312
319
|
}];
|
|
313
320
|
|
|
@@ -398,61 +405,9 @@ declare const useWooCrossSwapQuery: () => {
|
|
|
398
405
|
};
|
|
399
406
|
|
|
400
407
|
/** @hidden */
|
|
401
|
-
declare
|
|
402
|
-
INITIALIZING = "WAITTING",
|
|
403
|
-
INFLIGHT = "INFLIGHT",
|
|
404
|
-
DELIVERED = "DELIVERED",
|
|
405
|
-
FAILED = "FAILED"
|
|
406
|
-
}
|
|
407
|
-
/** @hidden */
|
|
408
|
-
declare const useCrossSwap: () => {
|
|
409
|
-
swap: (inputs: {
|
|
410
|
-
address: string;
|
|
411
|
-
crossChainRouteAddress: string;
|
|
412
|
-
src: {
|
|
413
|
-
fromToken: string;
|
|
414
|
-
fromAmount: bigint;
|
|
415
|
-
bridgeToken: string;
|
|
416
|
-
minBridgeAmount: bigint;
|
|
417
|
-
};
|
|
418
|
-
dst: {
|
|
419
|
-
chainId: string;
|
|
420
|
-
bridgedToken: string;
|
|
421
|
-
toToken: string;
|
|
422
|
-
minToAmount: bigint;
|
|
423
|
-
airdropNativeAmount: bigint;
|
|
424
|
-
};
|
|
425
|
-
}) => Promise<{
|
|
426
|
-
readonly hash: string;
|
|
427
|
-
readonly to: string | null;
|
|
428
|
-
readonly from: string;
|
|
429
|
-
readonly value: bigint;
|
|
430
|
-
} | undefined>;
|
|
431
|
-
loading: boolean;
|
|
432
|
-
bridgeStatus: MessageStatus;
|
|
433
|
-
status: WS_WalletStatusEnum;
|
|
434
|
-
message: any;
|
|
435
|
-
};
|
|
408
|
+
declare const useCrossSwap: () => any;
|
|
436
409
|
|
|
437
410
|
/** @hidden */
|
|
438
|
-
declare const useSwap: () =>
|
|
439
|
-
swap: (woofiDexDepositorAdress: string, inputs: {
|
|
440
|
-
fromToken: string;
|
|
441
|
-
fromAmount: string;
|
|
442
|
-
toToken: string;
|
|
443
|
-
minToAmount: string;
|
|
444
|
-
orderlyNativeFees: bigint;
|
|
445
|
-
}, config: {
|
|
446
|
-
dst: any;
|
|
447
|
-
src: any;
|
|
448
|
-
}) => Promise<{
|
|
449
|
-
readonly hash: string;
|
|
450
|
-
readonly to: string | null;
|
|
451
|
-
readonly from: string;
|
|
452
|
-
readonly value: bigint;
|
|
453
|
-
} | undefined>;
|
|
454
|
-
loading: boolean;
|
|
455
|
-
status: WS_WalletStatusEnum;
|
|
456
|
-
};
|
|
411
|
+
declare const useSwap: () => any;
|
|
457
412
|
|
|
458
|
-
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 };
|
|
413
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,12 @@ var useConstant4__default = /*#__PURE__*/_interopDefault(useConstant4);
|
|
|
25
25
|
var useSWRInfinite__default = /*#__PURE__*/_interopDefault(useSWRInfinite);
|
|
26
26
|
var useSWRSubscription__default = /*#__PURE__*/_interopDefault(useSWRSubscription);
|
|
27
27
|
|
|
28
|
-
// src/
|
|
28
|
+
// src/version.ts
|
|
29
|
+
if (typeof window !== "undefined") {
|
|
30
|
+
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
31
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.25-alpha.3";
|
|
32
|
+
}
|
|
33
|
+
var version_default = "1.0.25-alpha.3";
|
|
29
34
|
var fetcher = (url, init = {}, queryOptions) => net.get(url, init, queryOptions?.formatter);
|
|
30
35
|
var OrderlyContext = React.createContext({
|
|
31
36
|
// configStore: new MemoryConfigStore(),
|
|
@@ -438,6 +443,9 @@ var useWS = () => {
|
|
|
438
443
|
return { ...result, timestamp };
|
|
439
444
|
}
|
|
440
445
|
});
|
|
446
|
+
if (account5.stateValue.status === types.AccountStatusEnum.EnableTrading && account5.stateValue.accountId) {
|
|
447
|
+
websocketClient.openPrivate(account5.stateValue.accountId);
|
|
448
|
+
}
|
|
441
449
|
account5.on("change:status", (nextState) => {
|
|
442
450
|
if (nextState.status === types.AccountStatusEnum.EnableTrading && nextState.accountId) {
|
|
443
451
|
websocketClient.openPrivate(nextState.accountId);
|
|
@@ -4316,6 +4324,7 @@ exports.useWalletSubscription = useWalletSubscription;
|
|
|
4316
4324
|
exports.useWithdraw = useWithdraw;
|
|
4317
4325
|
exports.useWooCrossSwapQuery = useWooCrossSwapQuery;
|
|
4318
4326
|
exports.useWooSwapQuery = useWooSwapQuery;
|
|
4327
|
+
exports.version = version_default;
|
|
4319
4328
|
Object.keys(useDebounce).forEach(function (k) {
|
|
4320
4329
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
4321
4330
|
enumerable: true,
|