@agg-build/hooks 1.0.0
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/README.md +403 -0
- package/dist/chunk-CDPQERUC.mjs +3601 -0
- package/dist/deposit.d.mts +184 -0
- package/dist/deposit.d.ts +184 -0
- package/dist/deposit.js +1563 -0
- package/dist/deposit.mjs +628 -0
- package/dist/index.d.mts +4640 -0
- package/dist/index.d.ts +4640 -0
- package/dist/index.js +5568 -0
- package/dist/index.mjs +2010 -0
- package/dist/use-sync-balances-D1Jdkck9.d.mts +246 -0
- package/dist/use-sync-balances-D1Jdkck9.d.ts +246 -0
- package/package.json +102 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import * as _agg_build_sdk from '@agg-build/sdk';
|
|
3
|
+
import { DepositAddressesReadyResponse, DepositAddressesResponse } from '@agg-build/sdk';
|
|
4
|
+
|
|
5
|
+
interface UseDepositAddressesOptions {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/** Poll while ready === false. Default true. */
|
|
8
|
+
poll?: boolean;
|
|
9
|
+
/** Polling interval in ms. Default 5000. */
|
|
10
|
+
refetchIntervalMs?: number;
|
|
11
|
+
/** Stop polling and surface isTimedOut after this many ms. Default 60000. */
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns the correct deposit address for the given chainId.
|
|
16
|
+
* Solana (chainId 792703809) → svmAddress; all other chains → evmAddress.
|
|
17
|
+
*/
|
|
18
|
+
declare function getDepositAddress(chainId: number | undefined, data: DepositAddressesReadyResponse): string;
|
|
19
|
+
/**
|
|
20
|
+
* Query hook for fetching managed wallet deposit addresses.
|
|
21
|
+
* Polls every 5 seconds while the wallet is being provisioned (ready === false).
|
|
22
|
+
* Stops polling after timeoutMs (default 60s) and sets isTimedOut.
|
|
23
|
+
*/
|
|
24
|
+
declare function useDepositAddresses(options?: UseDepositAddressesOptions): {
|
|
25
|
+
isReady: boolean;
|
|
26
|
+
isTimedOut: boolean;
|
|
27
|
+
evmAddress: string | undefined;
|
|
28
|
+
svmAddress: string | undefined;
|
|
29
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
30
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
31
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
32
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
33
|
+
data: DepositAddressesResponse;
|
|
34
|
+
error: Error;
|
|
35
|
+
isError: true;
|
|
36
|
+
isPending: false;
|
|
37
|
+
isLoading: false;
|
|
38
|
+
isLoadingError: false;
|
|
39
|
+
isRefetchError: true;
|
|
40
|
+
isSuccess: false;
|
|
41
|
+
isPlaceholderData: false;
|
|
42
|
+
status: "error";
|
|
43
|
+
dataUpdatedAt: number;
|
|
44
|
+
errorUpdatedAt: number;
|
|
45
|
+
failureCount: number;
|
|
46
|
+
failureReason: Error | null;
|
|
47
|
+
errorUpdateCount: number;
|
|
48
|
+
isFetched: boolean;
|
|
49
|
+
isFetchedAfterMount: boolean;
|
|
50
|
+
isFetching: boolean;
|
|
51
|
+
isInitialLoading: boolean;
|
|
52
|
+
isPaused: boolean;
|
|
53
|
+
isRefetching: boolean;
|
|
54
|
+
isStale: boolean;
|
|
55
|
+
isEnabled: boolean;
|
|
56
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
57
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
58
|
+
promise: Promise<DepositAddressesResponse>;
|
|
59
|
+
} | {
|
|
60
|
+
isReady: boolean;
|
|
61
|
+
isTimedOut: boolean;
|
|
62
|
+
evmAddress: string | undefined;
|
|
63
|
+
svmAddress: string | undefined;
|
|
64
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
65
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
66
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
67
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
68
|
+
data: DepositAddressesResponse;
|
|
69
|
+
error: null;
|
|
70
|
+
isError: false;
|
|
71
|
+
isPending: false;
|
|
72
|
+
isLoading: false;
|
|
73
|
+
isLoadingError: false;
|
|
74
|
+
isRefetchError: false;
|
|
75
|
+
isSuccess: true;
|
|
76
|
+
isPlaceholderData: false;
|
|
77
|
+
status: "success";
|
|
78
|
+
dataUpdatedAt: number;
|
|
79
|
+
errorUpdatedAt: number;
|
|
80
|
+
failureCount: number;
|
|
81
|
+
failureReason: Error | null;
|
|
82
|
+
errorUpdateCount: number;
|
|
83
|
+
isFetched: boolean;
|
|
84
|
+
isFetchedAfterMount: boolean;
|
|
85
|
+
isFetching: boolean;
|
|
86
|
+
isInitialLoading: boolean;
|
|
87
|
+
isPaused: boolean;
|
|
88
|
+
isRefetching: boolean;
|
|
89
|
+
isStale: boolean;
|
|
90
|
+
isEnabled: boolean;
|
|
91
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
92
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
93
|
+
promise: Promise<DepositAddressesResponse>;
|
|
94
|
+
} | {
|
|
95
|
+
isReady: boolean;
|
|
96
|
+
isTimedOut: boolean;
|
|
97
|
+
evmAddress: string | undefined;
|
|
98
|
+
svmAddress: string | undefined;
|
|
99
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
100
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
101
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
102
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
103
|
+
data: undefined;
|
|
104
|
+
error: Error;
|
|
105
|
+
isError: true;
|
|
106
|
+
isPending: false;
|
|
107
|
+
isLoading: false;
|
|
108
|
+
isLoadingError: true;
|
|
109
|
+
isRefetchError: false;
|
|
110
|
+
isSuccess: false;
|
|
111
|
+
isPlaceholderData: false;
|
|
112
|
+
status: "error";
|
|
113
|
+
dataUpdatedAt: number;
|
|
114
|
+
errorUpdatedAt: number;
|
|
115
|
+
failureCount: number;
|
|
116
|
+
failureReason: Error | null;
|
|
117
|
+
errorUpdateCount: number;
|
|
118
|
+
isFetched: boolean;
|
|
119
|
+
isFetchedAfterMount: boolean;
|
|
120
|
+
isFetching: boolean;
|
|
121
|
+
isInitialLoading: boolean;
|
|
122
|
+
isPaused: boolean;
|
|
123
|
+
isRefetching: boolean;
|
|
124
|
+
isStale: boolean;
|
|
125
|
+
isEnabled: boolean;
|
|
126
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
127
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
128
|
+
promise: Promise<DepositAddressesResponse>;
|
|
129
|
+
} | {
|
|
130
|
+
isReady: boolean;
|
|
131
|
+
isTimedOut: boolean;
|
|
132
|
+
evmAddress: string | undefined;
|
|
133
|
+
svmAddress: string | undefined;
|
|
134
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
135
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
136
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
137
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
138
|
+
data: undefined;
|
|
139
|
+
error: null;
|
|
140
|
+
isError: false;
|
|
141
|
+
isPending: true;
|
|
142
|
+
isLoading: true;
|
|
143
|
+
isLoadingError: false;
|
|
144
|
+
isRefetchError: false;
|
|
145
|
+
isSuccess: false;
|
|
146
|
+
isPlaceholderData: false;
|
|
147
|
+
status: "pending";
|
|
148
|
+
dataUpdatedAt: number;
|
|
149
|
+
errorUpdatedAt: number;
|
|
150
|
+
failureCount: number;
|
|
151
|
+
failureReason: Error | null;
|
|
152
|
+
errorUpdateCount: number;
|
|
153
|
+
isFetched: boolean;
|
|
154
|
+
isFetchedAfterMount: boolean;
|
|
155
|
+
isFetching: boolean;
|
|
156
|
+
isInitialLoading: boolean;
|
|
157
|
+
isPaused: boolean;
|
|
158
|
+
isRefetching: boolean;
|
|
159
|
+
isStale: boolean;
|
|
160
|
+
isEnabled: boolean;
|
|
161
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
162
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
163
|
+
promise: Promise<DepositAddressesResponse>;
|
|
164
|
+
} | {
|
|
165
|
+
isReady: boolean;
|
|
166
|
+
isTimedOut: boolean;
|
|
167
|
+
evmAddress: string | undefined;
|
|
168
|
+
svmAddress: string | undefined;
|
|
169
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
170
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
171
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
172
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
173
|
+
data: undefined;
|
|
174
|
+
error: null;
|
|
175
|
+
isError: false;
|
|
176
|
+
isPending: true;
|
|
177
|
+
isLoadingError: false;
|
|
178
|
+
isRefetchError: false;
|
|
179
|
+
isSuccess: false;
|
|
180
|
+
isPlaceholderData: false;
|
|
181
|
+
status: "pending";
|
|
182
|
+
dataUpdatedAt: number;
|
|
183
|
+
errorUpdatedAt: number;
|
|
184
|
+
failureCount: number;
|
|
185
|
+
failureReason: Error | null;
|
|
186
|
+
errorUpdateCount: number;
|
|
187
|
+
isFetched: boolean;
|
|
188
|
+
isFetchedAfterMount: boolean;
|
|
189
|
+
isFetching: boolean;
|
|
190
|
+
isLoading: boolean;
|
|
191
|
+
isInitialLoading: boolean;
|
|
192
|
+
isPaused: boolean;
|
|
193
|
+
isRefetching: boolean;
|
|
194
|
+
isStale: boolean;
|
|
195
|
+
isEnabled: boolean;
|
|
196
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
197
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
198
|
+
promise: Promise<DepositAddressesResponse>;
|
|
199
|
+
} | {
|
|
200
|
+
isReady: boolean;
|
|
201
|
+
isTimedOut: boolean;
|
|
202
|
+
evmAddress: string | undefined;
|
|
203
|
+
svmAddress: string | undefined;
|
|
204
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
205
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
206
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
207
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
208
|
+
data: DepositAddressesResponse;
|
|
209
|
+
isError: false;
|
|
210
|
+
error: null;
|
|
211
|
+
isPending: false;
|
|
212
|
+
isLoading: false;
|
|
213
|
+
isLoadingError: false;
|
|
214
|
+
isRefetchError: false;
|
|
215
|
+
isSuccess: true;
|
|
216
|
+
isPlaceholderData: true;
|
|
217
|
+
status: "success";
|
|
218
|
+
dataUpdatedAt: number;
|
|
219
|
+
errorUpdatedAt: number;
|
|
220
|
+
failureCount: number;
|
|
221
|
+
failureReason: Error | null;
|
|
222
|
+
errorUpdateCount: number;
|
|
223
|
+
isFetched: boolean;
|
|
224
|
+
isFetchedAfterMount: boolean;
|
|
225
|
+
isFetching: boolean;
|
|
226
|
+
isInitialLoading: boolean;
|
|
227
|
+
isPaused: boolean;
|
|
228
|
+
isRefetching: boolean;
|
|
229
|
+
isStale: boolean;
|
|
230
|
+
isEnabled: boolean;
|
|
231
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
232
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
233
|
+
promise: Promise<DepositAddressesResponse>;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
interface UseSyncBalancesOptions {
|
|
237
|
+
onSuccess?: () => void;
|
|
238
|
+
onError?: (error: Error) => void;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Mutation hook for triggering an on-chain balance sync.
|
|
242
|
+
* On success, invalidates balances queries.
|
|
243
|
+
*/
|
|
244
|
+
declare function useSyncBalances(options?: UseSyncBalancesOptions): _tanstack_react_query.UseMutationResult<_agg_build_sdk.SyncBalancesResponse, Error, void, unknown>;
|
|
245
|
+
|
|
246
|
+
export { type UseDepositAddressesOptions as U, type UseSyncBalancesOptions as a, useSyncBalances as b, getDepositAddress as g, useDepositAddresses as u };
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import * as _agg_build_sdk from '@agg-build/sdk';
|
|
3
|
+
import { DepositAddressesReadyResponse, DepositAddressesResponse } from '@agg-build/sdk';
|
|
4
|
+
|
|
5
|
+
interface UseDepositAddressesOptions {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/** Poll while ready === false. Default true. */
|
|
8
|
+
poll?: boolean;
|
|
9
|
+
/** Polling interval in ms. Default 5000. */
|
|
10
|
+
refetchIntervalMs?: number;
|
|
11
|
+
/** Stop polling and surface isTimedOut after this many ms. Default 60000. */
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns the correct deposit address for the given chainId.
|
|
16
|
+
* Solana (chainId 792703809) → svmAddress; all other chains → evmAddress.
|
|
17
|
+
*/
|
|
18
|
+
declare function getDepositAddress(chainId: number | undefined, data: DepositAddressesReadyResponse): string;
|
|
19
|
+
/**
|
|
20
|
+
* Query hook for fetching managed wallet deposit addresses.
|
|
21
|
+
* Polls every 5 seconds while the wallet is being provisioned (ready === false).
|
|
22
|
+
* Stops polling after timeoutMs (default 60s) and sets isTimedOut.
|
|
23
|
+
*/
|
|
24
|
+
declare function useDepositAddresses(options?: UseDepositAddressesOptions): {
|
|
25
|
+
isReady: boolean;
|
|
26
|
+
isTimedOut: boolean;
|
|
27
|
+
evmAddress: string | undefined;
|
|
28
|
+
svmAddress: string | undefined;
|
|
29
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
30
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
31
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
32
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
33
|
+
data: DepositAddressesResponse;
|
|
34
|
+
error: Error;
|
|
35
|
+
isError: true;
|
|
36
|
+
isPending: false;
|
|
37
|
+
isLoading: false;
|
|
38
|
+
isLoadingError: false;
|
|
39
|
+
isRefetchError: true;
|
|
40
|
+
isSuccess: false;
|
|
41
|
+
isPlaceholderData: false;
|
|
42
|
+
status: "error";
|
|
43
|
+
dataUpdatedAt: number;
|
|
44
|
+
errorUpdatedAt: number;
|
|
45
|
+
failureCount: number;
|
|
46
|
+
failureReason: Error | null;
|
|
47
|
+
errorUpdateCount: number;
|
|
48
|
+
isFetched: boolean;
|
|
49
|
+
isFetchedAfterMount: boolean;
|
|
50
|
+
isFetching: boolean;
|
|
51
|
+
isInitialLoading: boolean;
|
|
52
|
+
isPaused: boolean;
|
|
53
|
+
isRefetching: boolean;
|
|
54
|
+
isStale: boolean;
|
|
55
|
+
isEnabled: boolean;
|
|
56
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
57
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
58
|
+
promise: Promise<DepositAddressesResponse>;
|
|
59
|
+
} | {
|
|
60
|
+
isReady: boolean;
|
|
61
|
+
isTimedOut: boolean;
|
|
62
|
+
evmAddress: string | undefined;
|
|
63
|
+
svmAddress: string | undefined;
|
|
64
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
65
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
66
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
67
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
68
|
+
data: DepositAddressesResponse;
|
|
69
|
+
error: null;
|
|
70
|
+
isError: false;
|
|
71
|
+
isPending: false;
|
|
72
|
+
isLoading: false;
|
|
73
|
+
isLoadingError: false;
|
|
74
|
+
isRefetchError: false;
|
|
75
|
+
isSuccess: true;
|
|
76
|
+
isPlaceholderData: false;
|
|
77
|
+
status: "success";
|
|
78
|
+
dataUpdatedAt: number;
|
|
79
|
+
errorUpdatedAt: number;
|
|
80
|
+
failureCount: number;
|
|
81
|
+
failureReason: Error | null;
|
|
82
|
+
errorUpdateCount: number;
|
|
83
|
+
isFetched: boolean;
|
|
84
|
+
isFetchedAfterMount: boolean;
|
|
85
|
+
isFetching: boolean;
|
|
86
|
+
isInitialLoading: boolean;
|
|
87
|
+
isPaused: boolean;
|
|
88
|
+
isRefetching: boolean;
|
|
89
|
+
isStale: boolean;
|
|
90
|
+
isEnabled: boolean;
|
|
91
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
92
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
93
|
+
promise: Promise<DepositAddressesResponse>;
|
|
94
|
+
} | {
|
|
95
|
+
isReady: boolean;
|
|
96
|
+
isTimedOut: boolean;
|
|
97
|
+
evmAddress: string | undefined;
|
|
98
|
+
svmAddress: string | undefined;
|
|
99
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
100
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
101
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
102
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
103
|
+
data: undefined;
|
|
104
|
+
error: Error;
|
|
105
|
+
isError: true;
|
|
106
|
+
isPending: false;
|
|
107
|
+
isLoading: false;
|
|
108
|
+
isLoadingError: true;
|
|
109
|
+
isRefetchError: false;
|
|
110
|
+
isSuccess: false;
|
|
111
|
+
isPlaceholderData: false;
|
|
112
|
+
status: "error";
|
|
113
|
+
dataUpdatedAt: number;
|
|
114
|
+
errorUpdatedAt: number;
|
|
115
|
+
failureCount: number;
|
|
116
|
+
failureReason: Error | null;
|
|
117
|
+
errorUpdateCount: number;
|
|
118
|
+
isFetched: boolean;
|
|
119
|
+
isFetchedAfterMount: boolean;
|
|
120
|
+
isFetching: boolean;
|
|
121
|
+
isInitialLoading: boolean;
|
|
122
|
+
isPaused: boolean;
|
|
123
|
+
isRefetching: boolean;
|
|
124
|
+
isStale: boolean;
|
|
125
|
+
isEnabled: boolean;
|
|
126
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
127
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
128
|
+
promise: Promise<DepositAddressesResponse>;
|
|
129
|
+
} | {
|
|
130
|
+
isReady: boolean;
|
|
131
|
+
isTimedOut: boolean;
|
|
132
|
+
evmAddress: string | undefined;
|
|
133
|
+
svmAddress: string | undefined;
|
|
134
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
135
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
136
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
137
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
138
|
+
data: undefined;
|
|
139
|
+
error: null;
|
|
140
|
+
isError: false;
|
|
141
|
+
isPending: true;
|
|
142
|
+
isLoading: true;
|
|
143
|
+
isLoadingError: false;
|
|
144
|
+
isRefetchError: false;
|
|
145
|
+
isSuccess: false;
|
|
146
|
+
isPlaceholderData: false;
|
|
147
|
+
status: "pending";
|
|
148
|
+
dataUpdatedAt: number;
|
|
149
|
+
errorUpdatedAt: number;
|
|
150
|
+
failureCount: number;
|
|
151
|
+
failureReason: Error | null;
|
|
152
|
+
errorUpdateCount: number;
|
|
153
|
+
isFetched: boolean;
|
|
154
|
+
isFetchedAfterMount: boolean;
|
|
155
|
+
isFetching: boolean;
|
|
156
|
+
isInitialLoading: boolean;
|
|
157
|
+
isPaused: boolean;
|
|
158
|
+
isRefetching: boolean;
|
|
159
|
+
isStale: boolean;
|
|
160
|
+
isEnabled: boolean;
|
|
161
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
162
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
163
|
+
promise: Promise<DepositAddressesResponse>;
|
|
164
|
+
} | {
|
|
165
|
+
isReady: boolean;
|
|
166
|
+
isTimedOut: boolean;
|
|
167
|
+
evmAddress: string | undefined;
|
|
168
|
+
svmAddress: string | undefined;
|
|
169
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
170
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
171
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
172
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
173
|
+
data: undefined;
|
|
174
|
+
error: null;
|
|
175
|
+
isError: false;
|
|
176
|
+
isPending: true;
|
|
177
|
+
isLoadingError: false;
|
|
178
|
+
isRefetchError: false;
|
|
179
|
+
isSuccess: false;
|
|
180
|
+
isPlaceholderData: false;
|
|
181
|
+
status: "pending";
|
|
182
|
+
dataUpdatedAt: number;
|
|
183
|
+
errorUpdatedAt: number;
|
|
184
|
+
failureCount: number;
|
|
185
|
+
failureReason: Error | null;
|
|
186
|
+
errorUpdateCount: number;
|
|
187
|
+
isFetched: boolean;
|
|
188
|
+
isFetchedAfterMount: boolean;
|
|
189
|
+
isFetching: boolean;
|
|
190
|
+
isLoading: boolean;
|
|
191
|
+
isInitialLoading: boolean;
|
|
192
|
+
isPaused: boolean;
|
|
193
|
+
isRefetching: boolean;
|
|
194
|
+
isStale: boolean;
|
|
195
|
+
isEnabled: boolean;
|
|
196
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
197
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
198
|
+
promise: Promise<DepositAddressesResponse>;
|
|
199
|
+
} | {
|
|
200
|
+
isReady: boolean;
|
|
201
|
+
isTimedOut: boolean;
|
|
202
|
+
evmAddress: string | undefined;
|
|
203
|
+
svmAddress: string | undefined;
|
|
204
|
+
supportedChains: _agg_build_sdk.DepositAddressesSupportedChain[] | undefined;
|
|
205
|
+
depositAddresses: DepositAddressesResponse | undefined;
|
|
206
|
+
/** Resolve the correct address (EVM or SVM) for a given chainId. */
|
|
207
|
+
getAddress: (chainId: number | undefined) => string | undefined;
|
|
208
|
+
data: DepositAddressesResponse;
|
|
209
|
+
isError: false;
|
|
210
|
+
error: null;
|
|
211
|
+
isPending: false;
|
|
212
|
+
isLoading: false;
|
|
213
|
+
isLoadingError: false;
|
|
214
|
+
isRefetchError: false;
|
|
215
|
+
isSuccess: true;
|
|
216
|
+
isPlaceholderData: true;
|
|
217
|
+
status: "success";
|
|
218
|
+
dataUpdatedAt: number;
|
|
219
|
+
errorUpdatedAt: number;
|
|
220
|
+
failureCount: number;
|
|
221
|
+
failureReason: Error | null;
|
|
222
|
+
errorUpdateCount: number;
|
|
223
|
+
isFetched: boolean;
|
|
224
|
+
isFetchedAfterMount: boolean;
|
|
225
|
+
isFetching: boolean;
|
|
226
|
+
isInitialLoading: boolean;
|
|
227
|
+
isPaused: boolean;
|
|
228
|
+
isRefetching: boolean;
|
|
229
|
+
isStale: boolean;
|
|
230
|
+
isEnabled: boolean;
|
|
231
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DepositAddressesResponse, Error>>;
|
|
232
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
233
|
+
promise: Promise<DepositAddressesResponse>;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
interface UseSyncBalancesOptions {
|
|
237
|
+
onSuccess?: () => void;
|
|
238
|
+
onError?: (error: Error) => void;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Mutation hook for triggering an on-chain balance sync.
|
|
242
|
+
* On success, invalidates balances queries.
|
|
243
|
+
*/
|
|
244
|
+
declare function useSyncBalances(options?: UseSyncBalancesOptions): _tanstack_react_query.UseMutationResult<_agg_build_sdk.SyncBalancesResponse, Error, void, unknown>;
|
|
245
|
+
|
|
246
|
+
export { type UseDepositAddressesOptions as U, type UseSyncBalancesOptions as a, useSyncBalances as b, getDepositAddress as g, useDepositAddresses as u };
|
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agg-build/hooks",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React hooks and providers for the AGG prediction market aggregator. Wraps @agg-build/sdk with TanStack Query, shared session state, and live WebSocket data.",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://docs.agg.market/",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"agg",
|
|
10
|
+
"agg-market",
|
|
11
|
+
"agg-build",
|
|
12
|
+
"prediction-markets",
|
|
13
|
+
"prediction-market",
|
|
14
|
+
"trading",
|
|
15
|
+
"react",
|
|
16
|
+
"react-hooks",
|
|
17
|
+
"hooks",
|
|
18
|
+
"tanstack-query",
|
|
19
|
+
"siwe",
|
|
20
|
+
"siws",
|
|
21
|
+
"polymarket",
|
|
22
|
+
"kalshi"
|
|
23
|
+
],
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.mjs",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"typesVersions": {
|
|
28
|
+
"*": {
|
|
29
|
+
"deposit": [
|
|
30
|
+
"./dist/deposit.d.ts"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/Snag-Solutions/Agg.git",
|
|
37
|
+
"directory": "packages/hooks"
|
|
38
|
+
},
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/index.d.mts",
|
|
43
|
+
"default": "./dist/index.mjs"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/index.d.ts",
|
|
47
|
+
"default": "./dist/index.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"./deposit": {
|
|
51
|
+
"import": {
|
|
52
|
+
"types": "./dist/deposit.d.mts",
|
|
53
|
+
"default": "./dist/deposit.mjs"
|
|
54
|
+
},
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./dist/deposit.d.ts",
|
|
57
|
+
"default": "./dist/deposit.js"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"dist"
|
|
63
|
+
],
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@tanstack/react-query": "^5.90.21"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"@solana/wallet-adapter-react": "^0.15.0",
|
|
69
|
+
"@solana/web3.js": "^1.95.0",
|
|
70
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
71
|
+
"viem": "^2.0.0",
|
|
72
|
+
"wagmi": "^3.0.0 || ^2.0.0",
|
|
73
|
+
"@agg-build/sdk": "^1.0.0"
|
|
74
|
+
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"@solana/wallet-adapter-react": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"@solana/web3.js": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"viem": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"wagmi": {
|
|
86
|
+
"optional": true
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"publishConfig": {
|
|
90
|
+
"access": "public"
|
|
91
|
+
},
|
|
92
|
+
"scripts": {
|
|
93
|
+
"build": "tsup",
|
|
94
|
+
"dev": "tsup --watch",
|
|
95
|
+
"test": "pnpm exec vitest run --config vitest.config.ts",
|
|
96
|
+
"test:watch": "pnpm exec vitest --config vitest.config.ts",
|
|
97
|
+
"test:coverage": "pnpm exec vitest run --config vitest.config.ts --coverage",
|
|
98
|
+
"typecheck": "tsc --noEmit",
|
|
99
|
+
"lint": "eslint . --max-warnings 0",
|
|
100
|
+
"clean": "rm -rf .turbo node_modules dist"
|
|
101
|
+
}
|
|
102
|
+
}
|