@orderly.network/hooks 0.0.4 → 0.0.6
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 +249 -0
- package/dist/index.d.ts +249 -0
- package/package.json +7 -7
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import useSWR, { SWRConfiguration, SWRResponse } from 'swr';
|
|
2
|
+
export { SWRConfiguration, default as useSWR } from 'swr';
|
|
3
|
+
import { SWRMutationConfiguration } from 'swr/mutation';
|
|
4
|
+
import { AccountState, ConfigStore, WSMessage } from '@orderly.network/core';
|
|
5
|
+
import { API, OrderEntity, OrderSide } from '@orderly.network/types';
|
|
6
|
+
import { WebSocketClient } from '@orderly.network/net';
|
|
7
|
+
export { useEventCallback, useObservable } from 'rxjs-hooks';
|
|
8
|
+
export { default as useConstant } from 'use-constant';
|
|
9
|
+
import * as react from 'react';
|
|
10
|
+
import { FormikErrors, FormikState } from 'formik';
|
|
11
|
+
import * as swr__internal from 'swr/_internal';
|
|
12
|
+
|
|
13
|
+
type useQueryOptions<T> = SWRConfiguration & {
|
|
14
|
+
formatter?: (data: any) => T;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* useQuery
|
|
19
|
+
* @description for public api
|
|
20
|
+
* @param query
|
|
21
|
+
* @param options
|
|
22
|
+
*/
|
|
23
|
+
declare const useQuery: <T>(query: string, options?: useQueryOptions<T> | undefined) => SWRResponse<T, any, any>;
|
|
24
|
+
|
|
25
|
+
declare const useMutation: <T, E>(url: string, options?: SWRMutationConfiguration<T, E> | undefined) => {
|
|
26
|
+
mutation: (data: any) => Promise<any>;
|
|
27
|
+
data: any;
|
|
28
|
+
error: E | undefined;
|
|
29
|
+
reset: () => void;
|
|
30
|
+
isMutating: boolean;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* usePrivateQuery
|
|
35
|
+
* @description for private api
|
|
36
|
+
* @param query
|
|
37
|
+
* @param options
|
|
38
|
+
*/
|
|
39
|
+
declare const usePrivateQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: useQueryOptions<T> | undefined) => SWRResponse<T, any, any>;
|
|
40
|
+
|
|
41
|
+
declare const useTradingView: () => {};
|
|
42
|
+
|
|
43
|
+
declare const usePrivateObserve: <T>() => {
|
|
44
|
+
data: T | undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
declare const useTopicObserve: <T>(topic: string) => {
|
|
48
|
+
data: T | undefined;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
declare const useAccount: () => {
|
|
52
|
+
account: AccountState;
|
|
53
|
+
login: (address: string) => void;
|
|
54
|
+
info: API.AccountInfo | undefined;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
declare const useWebSocketClient: () => WebSocketClient;
|
|
58
|
+
|
|
59
|
+
interface OrderlyContextState {
|
|
60
|
+
fetcher?: (url: string, init: RequestInit) => Promise<any>;
|
|
61
|
+
apiBaseUrl: string;
|
|
62
|
+
configStore: ConfigStore;
|
|
63
|
+
}
|
|
64
|
+
declare const OrderlyContext: react.Context<OrderlyContextState>;
|
|
65
|
+
declare const OrderlyProvider: react.Provider<OrderlyContextState>;
|
|
66
|
+
|
|
67
|
+
type OrderBookItem = number[];
|
|
68
|
+
type OrderbookData = {
|
|
69
|
+
asks: OrderBookItem[];
|
|
70
|
+
bids: OrderBookItem[];
|
|
71
|
+
};
|
|
72
|
+
type OrderbookOptions = {
|
|
73
|
+
level?: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* @name useOrderbook
|
|
77
|
+
* @description React hook that returns the current orderbook for a given market
|
|
78
|
+
*/
|
|
79
|
+
declare const useOrderbook: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions) => ({
|
|
80
|
+
markPrice: number;
|
|
81
|
+
middlePrice: any;
|
|
82
|
+
asks: OrderBookItem[];
|
|
83
|
+
bids: OrderBookItem[];
|
|
84
|
+
onDepthChange?: undefined;
|
|
85
|
+
depth?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
onDepthChange: (depth: number) => void;
|
|
88
|
+
depth: number;
|
|
89
|
+
})[];
|
|
90
|
+
|
|
91
|
+
type OrderEntityKey = keyof OrderEntity & string;
|
|
92
|
+
|
|
93
|
+
interface OrderEntryReturn {
|
|
94
|
+
onSubmit: (values?: OrderEntity) => Promise<any>;
|
|
95
|
+
validateForm: (values?: any) => Promise<FormikErrors<OrderEntity>>;
|
|
96
|
+
resetForm: (nextState?: Partial<FormikState<OrderEntity>>) => void;
|
|
97
|
+
setValue: (field: OrderEntityKey, value: any) => void;
|
|
98
|
+
maxQty: number;
|
|
99
|
+
freeCollateral: number;
|
|
100
|
+
values: OrderEntity;
|
|
101
|
+
markPrice: number;
|
|
102
|
+
errors: Partial<Record<keyof OrderEntity, string>>;
|
|
103
|
+
symbolConfig: API.SymbolExt;
|
|
104
|
+
submitCount: number;
|
|
105
|
+
isSubmitting: boolean;
|
|
106
|
+
onFocus?: (field: keyof OrderEntity) => void;
|
|
107
|
+
onBlur?: (field: keyof OrderEntity) => void;
|
|
108
|
+
}
|
|
109
|
+
type UseOrderEntryOptions = {
|
|
110
|
+
commify?: boolean;
|
|
111
|
+
validate?: (data: OrderEntity) => {
|
|
112
|
+
[P in keyof OrderEntity]?: string;
|
|
113
|
+
} | null | undefined;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* 创建订单
|
|
117
|
+
* @param symbol
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
declare const useOrderEntry: (symbol: string, initialValue?: Partial<OrderEntity>, options?: UseOrderEntryOptions) => OrderEntryReturn;
|
|
121
|
+
|
|
122
|
+
interface MarketInfo {
|
|
123
|
+
}
|
|
124
|
+
declare const useFetures: () => {
|
|
125
|
+
data: MarketInfo[] | undefined;
|
|
126
|
+
sortBy: (key: string) => void;
|
|
127
|
+
filterBy: (key: string) => void;
|
|
128
|
+
isLoading: boolean;
|
|
129
|
+
error: any;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
declare const useSymbolsInfo: () => any;
|
|
133
|
+
|
|
134
|
+
declare const useTokenInfo: () => any;
|
|
135
|
+
|
|
136
|
+
declare const useMarketsStream: () => {
|
|
137
|
+
data: WSMessage.Ticker[] | null;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
declare const useTickerStream: (symbol: string) => any;
|
|
141
|
+
|
|
142
|
+
declare const useFundingRate$1: (symbol: string) => {
|
|
143
|
+
countDown: string;
|
|
144
|
+
symbol?: string | undefined;
|
|
145
|
+
est_funding_rate?: number | undefined;
|
|
146
|
+
est_funding_rate_timestamp?: number | undefined;
|
|
147
|
+
last_funding_rate?: number | undefined;
|
|
148
|
+
last_funding_rate_timestamp?: number | undefined;
|
|
149
|
+
next_funding_time?: number | undefined;
|
|
150
|
+
sum_unitary_funding?: number | undefined;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
declare const usePositionStream: (symbol?: string, options?: SWRConfiguration) => any[];
|
|
154
|
+
|
|
155
|
+
declare enum OrderStatus {
|
|
156
|
+
FILLED = "FILLED",
|
|
157
|
+
PARTIAL_FILLED = "PARTIAL_FILLED",
|
|
158
|
+
CANCELED = "CANCELED",
|
|
159
|
+
NEW = "NEW",
|
|
160
|
+
COMPLETED = "COMPLETED"
|
|
161
|
+
}
|
|
162
|
+
declare const useOrderStream: ({ status, symbol, }?: {
|
|
163
|
+
symbol?: string | undefined;
|
|
164
|
+
status?: OrderStatus | undefined;
|
|
165
|
+
}) => (API.OrderExt[] | {
|
|
166
|
+
cancelAllOrders: () => void;
|
|
167
|
+
updateOrder: (id: string, data: any) => void;
|
|
168
|
+
cancelOrder: (id: string) => void;
|
|
169
|
+
} | null)[];
|
|
170
|
+
|
|
171
|
+
type CollateralOutputs = {
|
|
172
|
+
totalCollateral: number;
|
|
173
|
+
freeCollateral: number;
|
|
174
|
+
totalValue: number;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* 用户保证金
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
declare const useCollateral: (dp?: number) => CollateralOutputs;
|
|
181
|
+
|
|
182
|
+
declare const useMaxQty: (symbol: string, side: OrderSide, reduceOnly?: boolean) => number;
|
|
183
|
+
|
|
184
|
+
interface Info {
|
|
185
|
+
symbol: string;
|
|
186
|
+
quote_min: number;
|
|
187
|
+
quote_max: number;
|
|
188
|
+
quote_tick: number;
|
|
189
|
+
base_min: number;
|
|
190
|
+
base_max: number;
|
|
191
|
+
base_tick: number;
|
|
192
|
+
min_notional: number;
|
|
193
|
+
price_range: number;
|
|
194
|
+
created_time: number;
|
|
195
|
+
updated_time: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* useInfo
|
|
199
|
+
* @returns
|
|
200
|
+
*/
|
|
201
|
+
declare const useInfo: () => swr__internal.SWRResponse<Info[], any, any>;
|
|
202
|
+
|
|
203
|
+
interface Token {
|
|
204
|
+
token: string;
|
|
205
|
+
token_account_id: string;
|
|
206
|
+
decimals: number;
|
|
207
|
+
minimum_increment: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* useToken
|
|
211
|
+
* @description get token info
|
|
212
|
+
*/
|
|
213
|
+
declare const useToken: () => swr__internal.SWRResponse<Token[], any, any>;
|
|
214
|
+
|
|
215
|
+
interface FundingRate {
|
|
216
|
+
symbol: string;
|
|
217
|
+
est_funding_rate: number;
|
|
218
|
+
est_funding_rate_timestamp: number;
|
|
219
|
+
last_funding_rate: number;
|
|
220
|
+
last_funding_rate_timestamp: number;
|
|
221
|
+
next_funding_time: number;
|
|
222
|
+
sum_unitary_funding: number;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* FundingRate
|
|
226
|
+
* @param symbol
|
|
227
|
+
*/
|
|
228
|
+
declare const useFundingRateBySymbol: (symbol: string) => swr__internal.SWRResponse<FundingRate, any, any>;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* FundingRate
|
|
232
|
+
* @param symbol
|
|
233
|
+
*/
|
|
234
|
+
declare const useFundingRate: (symbol?: string) => swr__internal.SWRResponse<FundingRate, any, any>;
|
|
235
|
+
|
|
236
|
+
declare const index_useFundingRate: typeof useFundingRate;
|
|
237
|
+
declare const index_useFundingRateBySymbol: typeof useFundingRateBySymbol;
|
|
238
|
+
declare const index_useInfo: typeof useInfo;
|
|
239
|
+
declare const index_useToken: typeof useToken;
|
|
240
|
+
declare namespace index {
|
|
241
|
+
export {
|
|
242
|
+
index_useFundingRate as useFundingRate,
|
|
243
|
+
index_useFundingRateBySymbol as useFundingRateBySymbol,
|
|
244
|
+
index_useInfo as useInfo,
|
|
245
|
+
index_useToken as useToken,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export { OrderStatus, OrderlyContext, OrderlyContextState, OrderlyProvider, index as apis, useAccount, useCollateral, useFetures, useFundingRate$1 as useFundingRate, useMarketsStream, useMaxQty, useMutation, useOrderEntry, useOrderStream, useOrderbook, usePositionStream, usePrivateObserve, usePrivateQuery, useQuery, useSymbolsInfo, useTickerStream, useTokenInfo, useTopicObserve, useTradingView, useWebSocketClient };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import useSWR, { SWRConfiguration, SWRResponse } from 'swr';
|
|
2
|
+
export { SWRConfiguration, default as useSWR } from 'swr';
|
|
3
|
+
import { SWRMutationConfiguration } from 'swr/mutation';
|
|
4
|
+
import { AccountState, ConfigStore, WSMessage } from '@orderly.network/core';
|
|
5
|
+
import { API, OrderEntity, OrderSide } from '@orderly.network/types';
|
|
6
|
+
import { WebSocketClient } from '@orderly.network/net';
|
|
7
|
+
export { useEventCallback, useObservable } from 'rxjs-hooks';
|
|
8
|
+
export { default as useConstant } from 'use-constant';
|
|
9
|
+
import * as react from 'react';
|
|
10
|
+
import { FormikErrors, FormikState } from 'formik';
|
|
11
|
+
import * as swr__internal from 'swr/_internal';
|
|
12
|
+
|
|
13
|
+
type useQueryOptions<T> = SWRConfiguration & {
|
|
14
|
+
formatter?: (data: any) => T;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* useQuery
|
|
19
|
+
* @description for public api
|
|
20
|
+
* @param query
|
|
21
|
+
* @param options
|
|
22
|
+
*/
|
|
23
|
+
declare const useQuery: <T>(query: string, options?: useQueryOptions<T> | undefined) => SWRResponse<T, any, any>;
|
|
24
|
+
|
|
25
|
+
declare const useMutation: <T, E>(url: string, options?: SWRMutationConfiguration<T, E> | undefined) => {
|
|
26
|
+
mutation: (data: any) => Promise<any>;
|
|
27
|
+
data: any;
|
|
28
|
+
error: E | undefined;
|
|
29
|
+
reset: () => void;
|
|
30
|
+
isMutating: boolean;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* usePrivateQuery
|
|
35
|
+
* @description for private api
|
|
36
|
+
* @param query
|
|
37
|
+
* @param options
|
|
38
|
+
*/
|
|
39
|
+
declare const usePrivateQuery: <T>(query: Parameters<typeof useSWR>["0"], options?: useQueryOptions<T> | undefined) => SWRResponse<T, any, any>;
|
|
40
|
+
|
|
41
|
+
declare const useTradingView: () => {};
|
|
42
|
+
|
|
43
|
+
declare const usePrivateObserve: <T>() => {
|
|
44
|
+
data: T | undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
declare const useTopicObserve: <T>(topic: string) => {
|
|
48
|
+
data: T | undefined;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
declare const useAccount: () => {
|
|
52
|
+
account: AccountState;
|
|
53
|
+
login: (address: string) => void;
|
|
54
|
+
info: API.AccountInfo | undefined;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
declare const useWebSocketClient: () => WebSocketClient;
|
|
58
|
+
|
|
59
|
+
interface OrderlyContextState {
|
|
60
|
+
fetcher?: (url: string, init: RequestInit) => Promise<any>;
|
|
61
|
+
apiBaseUrl: string;
|
|
62
|
+
configStore: ConfigStore;
|
|
63
|
+
}
|
|
64
|
+
declare const OrderlyContext: react.Context<OrderlyContextState>;
|
|
65
|
+
declare const OrderlyProvider: react.Provider<OrderlyContextState>;
|
|
66
|
+
|
|
67
|
+
type OrderBookItem = number[];
|
|
68
|
+
type OrderbookData = {
|
|
69
|
+
asks: OrderBookItem[];
|
|
70
|
+
bids: OrderBookItem[];
|
|
71
|
+
};
|
|
72
|
+
type OrderbookOptions = {
|
|
73
|
+
level?: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* @name useOrderbook
|
|
77
|
+
* @description React hook that returns the current orderbook for a given market
|
|
78
|
+
*/
|
|
79
|
+
declare const useOrderbook: (symbol: string, initial?: OrderbookData, options?: OrderbookOptions) => ({
|
|
80
|
+
markPrice: number;
|
|
81
|
+
middlePrice: any;
|
|
82
|
+
asks: OrderBookItem[];
|
|
83
|
+
bids: OrderBookItem[];
|
|
84
|
+
onDepthChange?: undefined;
|
|
85
|
+
depth?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
onDepthChange: (depth: number) => void;
|
|
88
|
+
depth: number;
|
|
89
|
+
})[];
|
|
90
|
+
|
|
91
|
+
type OrderEntityKey = keyof OrderEntity & string;
|
|
92
|
+
|
|
93
|
+
interface OrderEntryReturn {
|
|
94
|
+
onSubmit: (values?: OrderEntity) => Promise<any>;
|
|
95
|
+
validateForm: (values?: any) => Promise<FormikErrors<OrderEntity>>;
|
|
96
|
+
resetForm: (nextState?: Partial<FormikState<OrderEntity>>) => void;
|
|
97
|
+
setValue: (field: OrderEntityKey, value: any) => void;
|
|
98
|
+
maxQty: number;
|
|
99
|
+
freeCollateral: number;
|
|
100
|
+
values: OrderEntity;
|
|
101
|
+
markPrice: number;
|
|
102
|
+
errors: Partial<Record<keyof OrderEntity, string>>;
|
|
103
|
+
symbolConfig: API.SymbolExt;
|
|
104
|
+
submitCount: number;
|
|
105
|
+
isSubmitting: boolean;
|
|
106
|
+
onFocus?: (field: keyof OrderEntity) => void;
|
|
107
|
+
onBlur?: (field: keyof OrderEntity) => void;
|
|
108
|
+
}
|
|
109
|
+
type UseOrderEntryOptions = {
|
|
110
|
+
commify?: boolean;
|
|
111
|
+
validate?: (data: OrderEntity) => {
|
|
112
|
+
[P in keyof OrderEntity]?: string;
|
|
113
|
+
} | null | undefined;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* 创建订单
|
|
117
|
+
* @param symbol
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
declare const useOrderEntry: (symbol: string, initialValue?: Partial<OrderEntity>, options?: UseOrderEntryOptions) => OrderEntryReturn;
|
|
121
|
+
|
|
122
|
+
interface MarketInfo {
|
|
123
|
+
}
|
|
124
|
+
declare const useFetures: () => {
|
|
125
|
+
data: MarketInfo[] | undefined;
|
|
126
|
+
sortBy: (key: string) => void;
|
|
127
|
+
filterBy: (key: string) => void;
|
|
128
|
+
isLoading: boolean;
|
|
129
|
+
error: any;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
declare const useSymbolsInfo: () => any;
|
|
133
|
+
|
|
134
|
+
declare const useTokenInfo: () => any;
|
|
135
|
+
|
|
136
|
+
declare const useMarketsStream: () => {
|
|
137
|
+
data: WSMessage.Ticker[] | null;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
declare const useTickerStream: (symbol: string) => any;
|
|
141
|
+
|
|
142
|
+
declare const useFundingRate$1: (symbol: string) => {
|
|
143
|
+
countDown: string;
|
|
144
|
+
symbol?: string | undefined;
|
|
145
|
+
est_funding_rate?: number | undefined;
|
|
146
|
+
est_funding_rate_timestamp?: number | undefined;
|
|
147
|
+
last_funding_rate?: number | undefined;
|
|
148
|
+
last_funding_rate_timestamp?: number | undefined;
|
|
149
|
+
next_funding_time?: number | undefined;
|
|
150
|
+
sum_unitary_funding?: number | undefined;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
declare const usePositionStream: (symbol?: string, options?: SWRConfiguration) => any[];
|
|
154
|
+
|
|
155
|
+
declare enum OrderStatus {
|
|
156
|
+
FILLED = "FILLED",
|
|
157
|
+
PARTIAL_FILLED = "PARTIAL_FILLED",
|
|
158
|
+
CANCELED = "CANCELED",
|
|
159
|
+
NEW = "NEW",
|
|
160
|
+
COMPLETED = "COMPLETED"
|
|
161
|
+
}
|
|
162
|
+
declare const useOrderStream: ({ status, symbol, }?: {
|
|
163
|
+
symbol?: string | undefined;
|
|
164
|
+
status?: OrderStatus | undefined;
|
|
165
|
+
}) => (API.OrderExt[] | {
|
|
166
|
+
cancelAllOrders: () => void;
|
|
167
|
+
updateOrder: (id: string, data: any) => void;
|
|
168
|
+
cancelOrder: (id: string) => void;
|
|
169
|
+
} | null)[];
|
|
170
|
+
|
|
171
|
+
type CollateralOutputs = {
|
|
172
|
+
totalCollateral: number;
|
|
173
|
+
freeCollateral: number;
|
|
174
|
+
totalValue: number;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* 用户保证金
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
declare const useCollateral: (dp?: number) => CollateralOutputs;
|
|
181
|
+
|
|
182
|
+
declare const useMaxQty: (symbol: string, side: OrderSide, reduceOnly?: boolean) => number;
|
|
183
|
+
|
|
184
|
+
interface Info {
|
|
185
|
+
symbol: string;
|
|
186
|
+
quote_min: number;
|
|
187
|
+
quote_max: number;
|
|
188
|
+
quote_tick: number;
|
|
189
|
+
base_min: number;
|
|
190
|
+
base_max: number;
|
|
191
|
+
base_tick: number;
|
|
192
|
+
min_notional: number;
|
|
193
|
+
price_range: number;
|
|
194
|
+
created_time: number;
|
|
195
|
+
updated_time: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* useInfo
|
|
199
|
+
* @returns
|
|
200
|
+
*/
|
|
201
|
+
declare const useInfo: () => swr__internal.SWRResponse<Info[], any, any>;
|
|
202
|
+
|
|
203
|
+
interface Token {
|
|
204
|
+
token: string;
|
|
205
|
+
token_account_id: string;
|
|
206
|
+
decimals: number;
|
|
207
|
+
minimum_increment: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* useToken
|
|
211
|
+
* @description get token info
|
|
212
|
+
*/
|
|
213
|
+
declare const useToken: () => swr__internal.SWRResponse<Token[], any, any>;
|
|
214
|
+
|
|
215
|
+
interface FundingRate {
|
|
216
|
+
symbol: string;
|
|
217
|
+
est_funding_rate: number;
|
|
218
|
+
est_funding_rate_timestamp: number;
|
|
219
|
+
last_funding_rate: number;
|
|
220
|
+
last_funding_rate_timestamp: number;
|
|
221
|
+
next_funding_time: number;
|
|
222
|
+
sum_unitary_funding: number;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* FundingRate
|
|
226
|
+
* @param symbol
|
|
227
|
+
*/
|
|
228
|
+
declare const useFundingRateBySymbol: (symbol: string) => swr__internal.SWRResponse<FundingRate, any, any>;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* FundingRate
|
|
232
|
+
* @param symbol
|
|
233
|
+
*/
|
|
234
|
+
declare const useFundingRate: (symbol?: string) => swr__internal.SWRResponse<FundingRate, any, any>;
|
|
235
|
+
|
|
236
|
+
declare const index_useFundingRate: typeof useFundingRate;
|
|
237
|
+
declare const index_useFundingRateBySymbol: typeof useFundingRateBySymbol;
|
|
238
|
+
declare const index_useInfo: typeof useInfo;
|
|
239
|
+
declare const index_useToken: typeof useToken;
|
|
240
|
+
declare namespace index {
|
|
241
|
+
export {
|
|
242
|
+
index_useFundingRate as useFundingRate,
|
|
243
|
+
index_useFundingRateBySymbol as useFundingRateBySymbol,
|
|
244
|
+
index_useInfo as useInfo,
|
|
245
|
+
index_useToken as useToken,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export { OrderStatus, OrderlyContext, OrderlyContextState, OrderlyProvider, index as apis, useAccount, useCollateral, useFetures, useFundingRate$1 as useFundingRate, useMarketsStream, useMaxQty, useMutation, useOrderEntry, useOrderStream, useOrderbook, usePositionStream, usePrivateObserve, usePrivateQuery, useQuery, useSymbolsInfo, useTickerStream, useTokenInfo, useTopicObserve, useTradingView, useWebSocketClient };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orderly.network/hooks",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"rxjs": "^7.8.1",
|
|
22
22
|
"tsup": "^7.1.0",
|
|
23
23
|
"typescript": "^5.1.6",
|
|
24
|
-
"tsconfig": "0.0.
|
|
24
|
+
"tsconfig": "0.0.3"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"formik": "^2.4.3",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"rxjs-hooks": "0.8.0-alpha.0",
|
|
30
30
|
"swr": "^2.2.0",
|
|
31
31
|
"use-constant": "^1.1.1",
|
|
32
|
-
"@orderly.network/
|
|
33
|
-
"@orderly.network/
|
|
34
|
-
"@orderly.network/
|
|
35
|
-
"@orderly.network/types": "0.0.
|
|
36
|
-
"@orderly.network/
|
|
32
|
+
"@orderly.network/futures": "0.0.6",
|
|
33
|
+
"@orderly.network/core": "0.0.5",
|
|
34
|
+
"@orderly.network/net": "1.0.3",
|
|
35
|
+
"@orderly.network/types": "0.0.5",
|
|
36
|
+
"@orderly.network/utils": "0.0.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"rxjs": "^7.8.1"
|