@orderly.network/hooks 0.0.61 → 0.0.63
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 +39 -21
- package/dist/index.d.ts +39 -21
- package/dist/index.js +691 -218
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +694 -220
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -7
package/dist/index.d.mts
CHANGED
|
@@ -54,10 +54,6 @@ declare const useBoolean: (initialValue?: boolean) => [boolean, {
|
|
|
54
54
|
|
|
55
55
|
declare const useTradingView: () => {};
|
|
56
56
|
|
|
57
|
-
declare const usePrivateObserve: <T>() => {
|
|
58
|
-
data: T | undefined;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
57
|
declare const useTopicObserve: <T>(topic: string) => {
|
|
62
58
|
data: T | undefined;
|
|
63
59
|
};
|
|
@@ -65,7 +61,6 @@ declare const useTopicObserve: <T>(topic: string) => {
|
|
|
65
61
|
declare const useAccount: () => {
|
|
66
62
|
account: Account;
|
|
67
63
|
state: AccountState;
|
|
68
|
-
login: (address: string) => void;
|
|
69
64
|
createOrderlyKey: (remember: boolean) => Promise<string>;
|
|
70
65
|
createAccount: () => Promise<string>;
|
|
71
66
|
disconnect: () => Promise<void>;
|
|
@@ -98,6 +93,7 @@ interface OrderlyContextState extends OrderlyAppConfig {
|
|
|
98
93
|
onWalletDisconnect?: () => Promise<any>;
|
|
99
94
|
onSetChain?: (chainId: number) => Promise<any>;
|
|
100
95
|
errors: AppStateErrors;
|
|
96
|
+
onlyTestnet: boolean;
|
|
101
97
|
}
|
|
102
98
|
declare const OrderlyContext: react.Context<OrderlyContextState>;
|
|
103
99
|
declare const OrderlyProvider: react.Provider<OrderlyContextState>;
|
|
@@ -292,29 +288,33 @@ declare const useChain: (token: string) => {
|
|
|
292
288
|
isLoading: boolean;
|
|
293
289
|
};
|
|
294
290
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
isLoading: boolean;
|
|
291
|
+
type WithdrawInputs = {
|
|
292
|
+
chainId: number;
|
|
293
|
+
token: string;
|
|
294
|
+
amount: number;
|
|
295
|
+
};
|
|
296
|
+
interface WithdrawReturns {
|
|
302
297
|
maxAmount: number;
|
|
303
298
|
availableBalance: number;
|
|
304
299
|
unsettledPnL: number;
|
|
305
|
-
|
|
300
|
+
isLoading: boolean;
|
|
301
|
+
withdraw: (inputs: WithdrawInputs) => Promise<any>;
|
|
302
|
+
}
|
|
303
|
+
declare const useWithdraw: () => WithdrawReturns;
|
|
306
304
|
|
|
307
305
|
type useDepositOptions = {
|
|
308
306
|
address?: string;
|
|
309
307
|
decimals?: number;
|
|
308
|
+
vaultAddress?: string;
|
|
309
|
+
networkId?: NetworkId;
|
|
310
310
|
};
|
|
311
311
|
declare const useDeposit: (options?: useDepositOptions) => {
|
|
312
312
|
dst: {
|
|
313
313
|
symbol: string;
|
|
314
|
-
address: string;
|
|
315
|
-
decimals: number;
|
|
316
|
-
network: string;
|
|
314
|
+
address: string | undefined;
|
|
315
|
+
decimals: number | undefined;
|
|
317
316
|
chainId: number;
|
|
317
|
+
network: string;
|
|
318
318
|
};
|
|
319
319
|
balance: string;
|
|
320
320
|
allowance: string;
|
|
@@ -406,7 +406,13 @@ declare const useWooSwapQuery: () => {
|
|
|
406
406
|
};
|
|
407
407
|
|
|
408
408
|
declare const useWooCrossSwapQuery: () => {
|
|
409
|
-
query: (inputs:
|
|
409
|
+
query: (inputs: {
|
|
410
|
+
srcNetwork: string;
|
|
411
|
+
srcToken: string;
|
|
412
|
+
amount: bigint;
|
|
413
|
+
slippage: number;
|
|
414
|
+
crossChainRouteAddress: string;
|
|
415
|
+
}) => Promise<any> | undefined;
|
|
410
416
|
loading: boolean;
|
|
411
417
|
};
|
|
412
418
|
|
|
@@ -419,6 +425,7 @@ declare enum MessageStatus {
|
|
|
419
425
|
declare const useCrossSwap: () => {
|
|
420
426
|
swap: (inputs: {
|
|
421
427
|
address: string;
|
|
428
|
+
crossChainRouteAddress: string;
|
|
422
429
|
src: {
|
|
423
430
|
fromToken: string;
|
|
424
431
|
fromAmount: bigint;
|
|
@@ -432,20 +439,31 @@ declare const useCrossSwap: () => {
|
|
|
432
439
|
minToAmount: bigint;
|
|
433
440
|
airdropNativeAmount: bigint;
|
|
434
441
|
};
|
|
435
|
-
}) => Promise<{
|
|
442
|
+
}) => Promise<{
|
|
443
|
+
readonly hash: string;
|
|
444
|
+
readonly to: string | null;
|
|
445
|
+
readonly from: string;
|
|
446
|
+
readonly value: bigint;
|
|
447
|
+
} | undefined>;
|
|
436
448
|
loading: boolean;
|
|
437
449
|
status: MessageStatus;
|
|
438
450
|
message: any;
|
|
439
451
|
};
|
|
440
452
|
|
|
441
453
|
declare const useSwap: () => {
|
|
442
|
-
swap: (inputs: {
|
|
454
|
+
swap: (woofiDexDepositorAdress: string, inputs: {
|
|
443
455
|
fromToken: string;
|
|
444
456
|
fromAmount: string;
|
|
445
457
|
toToken: string;
|
|
446
458
|
minToAmount: string;
|
|
447
|
-
|
|
459
|
+
orderlyNativeFees: bigint;
|
|
460
|
+
}) => Promise<{
|
|
461
|
+
readonly hash: string;
|
|
462
|
+
readonly to: string | null;
|
|
463
|
+
readonly from: string;
|
|
464
|
+
readonly value: bigint;
|
|
465
|
+
} | undefined>;
|
|
448
466
|
loading: boolean;
|
|
449
467
|
};
|
|
450
468
|
|
|
451
|
-
export { AppStateErrors, DataSourceProvider, OrderStatus, OrderlyAppConfig, OrderlyContext, OrderlyContextState, OrderlyProvider, index as apis, useAccount, useAccountInfo, useAccountInstance, useAppState, useBalance, useBoolean, useChain, useChains, useCollateral, useConfig, useCrossSwap, useDeposit, useEventEmitter, useExecutionReport, useFetures, useFundingRate, useHoldingStream, useLazyQuery, useLeverage, useLocalStorage, useMarginRatio, useMarkPrice, useMarkPricesStream, useMarketTradeStream, useMarketsStream, useMaxQty, useMutation, useOrderEntry, useOrderStream, useOrderbookStream, usePositionStream, usePreLoadData, usePrivateDataObserver,
|
|
469
|
+
export { AppStateErrors, DataSourceProvider, OrderStatus, OrderlyAppConfig, OrderlyContext, OrderlyContextState, OrderlyProvider, index as apis, useAccount, useAccountInfo, useAccountInstance, useAppState, useBalance, useBoolean, useChain, useChains, useCollateral, useConfig, useCrossSwap, useDeposit, useEventEmitter, useExecutionReport, useFetures, useFundingRate, useHoldingStream, useLazyQuery, useLeverage, useLocalStorage, useMarginRatio, useMarkPrice, useMarkPricesStream, useMarketTradeStream, useMarketsStream, useMaxQty, useMutation, useOrderEntry, useOrderStream, useOrderbookStream, usePositionStream, usePreLoadData, usePrivateDataObserver, usePrivateQuery, useQuery, useRunOnce, useSessionStorage, useSwap, useSymbolsInfo, useTickerStream, useTokenInfo, useTopicObserve, useTradingView, useWS, useWalletSubscription, useWithdraw, useWooCrossSwapQuery, useWooSwapQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -54,10 +54,6 @@ declare const useBoolean: (initialValue?: boolean) => [boolean, {
|
|
|
54
54
|
|
|
55
55
|
declare const useTradingView: () => {};
|
|
56
56
|
|
|
57
|
-
declare const usePrivateObserve: <T>() => {
|
|
58
|
-
data: T | undefined;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
57
|
declare const useTopicObserve: <T>(topic: string) => {
|
|
62
58
|
data: T | undefined;
|
|
63
59
|
};
|
|
@@ -65,7 +61,6 @@ declare const useTopicObserve: <T>(topic: string) => {
|
|
|
65
61
|
declare const useAccount: () => {
|
|
66
62
|
account: Account;
|
|
67
63
|
state: AccountState;
|
|
68
|
-
login: (address: string) => void;
|
|
69
64
|
createOrderlyKey: (remember: boolean) => Promise<string>;
|
|
70
65
|
createAccount: () => Promise<string>;
|
|
71
66
|
disconnect: () => Promise<void>;
|
|
@@ -98,6 +93,7 @@ interface OrderlyContextState extends OrderlyAppConfig {
|
|
|
98
93
|
onWalletDisconnect?: () => Promise<any>;
|
|
99
94
|
onSetChain?: (chainId: number) => Promise<any>;
|
|
100
95
|
errors: AppStateErrors;
|
|
96
|
+
onlyTestnet: boolean;
|
|
101
97
|
}
|
|
102
98
|
declare const OrderlyContext: react.Context<OrderlyContextState>;
|
|
103
99
|
declare const OrderlyProvider: react.Provider<OrderlyContextState>;
|
|
@@ -292,29 +288,33 @@ declare const useChain: (token: string) => {
|
|
|
292
288
|
isLoading: boolean;
|
|
293
289
|
};
|
|
294
290
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
isLoading: boolean;
|
|
291
|
+
type WithdrawInputs = {
|
|
292
|
+
chainId: number;
|
|
293
|
+
token: string;
|
|
294
|
+
amount: number;
|
|
295
|
+
};
|
|
296
|
+
interface WithdrawReturns {
|
|
302
297
|
maxAmount: number;
|
|
303
298
|
availableBalance: number;
|
|
304
299
|
unsettledPnL: number;
|
|
305
|
-
|
|
300
|
+
isLoading: boolean;
|
|
301
|
+
withdraw: (inputs: WithdrawInputs) => Promise<any>;
|
|
302
|
+
}
|
|
303
|
+
declare const useWithdraw: () => WithdrawReturns;
|
|
306
304
|
|
|
307
305
|
type useDepositOptions = {
|
|
308
306
|
address?: string;
|
|
309
307
|
decimals?: number;
|
|
308
|
+
vaultAddress?: string;
|
|
309
|
+
networkId?: NetworkId;
|
|
310
310
|
};
|
|
311
311
|
declare const useDeposit: (options?: useDepositOptions) => {
|
|
312
312
|
dst: {
|
|
313
313
|
symbol: string;
|
|
314
|
-
address: string;
|
|
315
|
-
decimals: number;
|
|
316
|
-
network: string;
|
|
314
|
+
address: string | undefined;
|
|
315
|
+
decimals: number | undefined;
|
|
317
316
|
chainId: number;
|
|
317
|
+
network: string;
|
|
318
318
|
};
|
|
319
319
|
balance: string;
|
|
320
320
|
allowance: string;
|
|
@@ -406,7 +406,13 @@ declare const useWooSwapQuery: () => {
|
|
|
406
406
|
};
|
|
407
407
|
|
|
408
408
|
declare const useWooCrossSwapQuery: () => {
|
|
409
|
-
query: (inputs:
|
|
409
|
+
query: (inputs: {
|
|
410
|
+
srcNetwork: string;
|
|
411
|
+
srcToken: string;
|
|
412
|
+
amount: bigint;
|
|
413
|
+
slippage: number;
|
|
414
|
+
crossChainRouteAddress: string;
|
|
415
|
+
}) => Promise<any> | undefined;
|
|
410
416
|
loading: boolean;
|
|
411
417
|
};
|
|
412
418
|
|
|
@@ -419,6 +425,7 @@ declare enum MessageStatus {
|
|
|
419
425
|
declare const useCrossSwap: () => {
|
|
420
426
|
swap: (inputs: {
|
|
421
427
|
address: string;
|
|
428
|
+
crossChainRouteAddress: string;
|
|
422
429
|
src: {
|
|
423
430
|
fromToken: string;
|
|
424
431
|
fromAmount: bigint;
|
|
@@ -432,20 +439,31 @@ declare const useCrossSwap: () => {
|
|
|
432
439
|
minToAmount: bigint;
|
|
433
440
|
airdropNativeAmount: bigint;
|
|
434
441
|
};
|
|
435
|
-
}) => Promise<{
|
|
442
|
+
}) => Promise<{
|
|
443
|
+
readonly hash: string;
|
|
444
|
+
readonly to: string | null;
|
|
445
|
+
readonly from: string;
|
|
446
|
+
readonly value: bigint;
|
|
447
|
+
} | undefined>;
|
|
436
448
|
loading: boolean;
|
|
437
449
|
status: MessageStatus;
|
|
438
450
|
message: any;
|
|
439
451
|
};
|
|
440
452
|
|
|
441
453
|
declare const useSwap: () => {
|
|
442
|
-
swap: (inputs: {
|
|
454
|
+
swap: (woofiDexDepositorAdress: string, inputs: {
|
|
443
455
|
fromToken: string;
|
|
444
456
|
fromAmount: string;
|
|
445
457
|
toToken: string;
|
|
446
458
|
minToAmount: string;
|
|
447
|
-
|
|
459
|
+
orderlyNativeFees: bigint;
|
|
460
|
+
}) => Promise<{
|
|
461
|
+
readonly hash: string;
|
|
462
|
+
readonly to: string | null;
|
|
463
|
+
readonly from: string;
|
|
464
|
+
readonly value: bigint;
|
|
465
|
+
} | undefined>;
|
|
448
466
|
loading: boolean;
|
|
449
467
|
};
|
|
450
468
|
|
|
451
|
-
export { AppStateErrors, DataSourceProvider, OrderStatus, OrderlyAppConfig, OrderlyContext, OrderlyContextState, OrderlyProvider, index as apis, useAccount, useAccountInfo, useAccountInstance, useAppState, useBalance, useBoolean, useChain, useChains, useCollateral, useConfig, useCrossSwap, useDeposit, useEventEmitter, useExecutionReport, useFetures, useFundingRate, useHoldingStream, useLazyQuery, useLeverage, useLocalStorage, useMarginRatio, useMarkPrice, useMarkPricesStream, useMarketTradeStream, useMarketsStream, useMaxQty, useMutation, useOrderEntry, useOrderStream, useOrderbookStream, usePositionStream, usePreLoadData, usePrivateDataObserver,
|
|
469
|
+
export { AppStateErrors, DataSourceProvider, OrderStatus, OrderlyAppConfig, OrderlyContext, OrderlyContextState, OrderlyProvider, index as apis, useAccount, useAccountInfo, useAccountInstance, useAppState, useBalance, useBoolean, useChain, useChains, useCollateral, useConfig, useCrossSwap, useDeposit, useEventEmitter, useExecutionReport, useFetures, useFundingRate, useHoldingStream, useLazyQuery, useLeverage, useLocalStorage, useMarginRatio, useMarkPrice, useMarkPricesStream, useMarketTradeStream, useMarketsStream, useMaxQty, useMutation, useOrderEntry, useOrderStream, useOrderbookStream, usePositionStream, usePreLoadData, usePrivateDataObserver, usePrivateQuery, useQuery, useRunOnce, useSessionStorage, useSwap, useSymbolsInfo, useTickerStream, useTokenInfo, useTopicObserve, useTradingView, useWS, useWalletSubscription, useWithdraw, useWooCrossSwapQuery, useWooSwapQuery };
|