@aave/react 4.0.0-next.1 → 4.0.0-next.2
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/chunk-GTUQRT5Q.js +2 -0
- package/dist/chunk-GTUQRT5Q.js.map +1 -0
- package/dist/chunk-XIDOSID3.js +2 -0
- package/dist/chunk-XIDOSID3.js.map +1 -0
- package/dist/ethers.cjs +2 -0
- package/dist/ethers.cjs.map +1 -0
- package/dist/ethers.d.cts +93 -0
- package/dist/ethers.d.ts +93 -0
- package/dist/ethers.js +2 -0
- package/dist/ethers.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2670 -0
- package/dist/index.d.ts +2670 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/misc-BkG5G4yl.d.cts +377 -0
- package/dist/misc-gmAnSdm5.d.ts +377 -0
- package/dist/privy.cjs +2 -0
- package/dist/privy.cjs.map +1 -0
- package/dist/privy.d.cts +72 -0
- package/dist/privy.d.ts +72 -0
- package/dist/privy.js +2 -0
- package/dist/privy.js.map +1 -0
- package/dist/thirdweb.cjs +3 -0
- package/dist/thirdweb.cjs.map +1 -0
- package/dist/thirdweb.d.cts +69 -0
- package/dist/thirdweb.d.ts +69 -0
- package/dist/thirdweb.js +3 -0
- package/dist/thirdweb.js.map +1 -0
- package/dist/utils.cjs +2 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/dist/viem/index.cjs +2 -0
- package/dist/viem/index.cjs.map +1 -0
- package/dist/viem/index.d.cts +97 -0
- package/dist/viem/index.d.ts +97 -0
- package/dist/viem/index.js +2 -0
- package/dist/viem/index.js.map +1 -0
- package/dist/writes-BXnwYgAQ.d.cts +123 -0
- package/dist/writes-BXnwYgAQ.d.ts +123 -0
- package/package.json +5 -5
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { UnexpectedError, CurrencyQueryOptions } from '@aave/client';
|
|
2
|
+
import { UnexpectedError as UnexpectedError$1 } from '@aave/core';
|
|
3
|
+
import { ChainRequest, Chain, ChainsFilter, ExchangeRateRequest, FiatAmount, ActivityItem, PreviewAction, NativeAmount } from '@aave/graphql';
|
|
4
|
+
import { NullishDeep, Prettify } from '@aave/types';
|
|
5
|
+
import { a as UseAsyncTask } from './writes-BXnwYgAQ.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A read hook result that supports pausing.
|
|
9
|
+
*/
|
|
10
|
+
type PausableReadResult<T, E extends UnexpectedError = UnexpectedError> = {
|
|
11
|
+
data: T | undefined;
|
|
12
|
+
error: E | undefined;
|
|
13
|
+
loading: false;
|
|
14
|
+
paused: true;
|
|
15
|
+
} | {
|
|
16
|
+
data: undefined;
|
|
17
|
+
error: undefined;
|
|
18
|
+
loading: true;
|
|
19
|
+
paused: false;
|
|
20
|
+
} | {
|
|
21
|
+
data: T;
|
|
22
|
+
error: undefined;
|
|
23
|
+
loading: false;
|
|
24
|
+
paused: false;
|
|
25
|
+
} | {
|
|
26
|
+
data: undefined;
|
|
27
|
+
error: E;
|
|
28
|
+
loading: false;
|
|
29
|
+
paused: false;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A read hook result.
|
|
33
|
+
*
|
|
34
|
+
* It's a discriminated union of the possible results of a read operation:
|
|
35
|
+
* - Rely on the `loading` value to determine if the `data` or `error` can be evaluated.
|
|
36
|
+
* - If `error` is `undefined`, then `data` value will be available.
|
|
37
|
+
*/
|
|
38
|
+
type ReadResult<T, E extends UnexpectedError = UnexpectedError> = {
|
|
39
|
+
data: undefined;
|
|
40
|
+
error: undefined;
|
|
41
|
+
loading: true;
|
|
42
|
+
} | {
|
|
43
|
+
data: T;
|
|
44
|
+
error: undefined;
|
|
45
|
+
loading: false;
|
|
46
|
+
} | {
|
|
47
|
+
data: undefined;
|
|
48
|
+
error: E;
|
|
49
|
+
loading: false;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
declare const ReadResult: {
|
|
55
|
+
Loading: <T, E extends UnexpectedError = UnexpectedError>() => PausableReadResult<T, E>;
|
|
56
|
+
Success: <T, E extends UnexpectedError = UnexpectedError>(data: T) => PausableReadResult<T, E>;
|
|
57
|
+
Failure: <T, E extends UnexpectedError = UnexpectedError>(error: E) => PausableReadResult<T, E>;
|
|
58
|
+
Paused: <T, E extends UnexpectedError = UnexpectedError>(data: T | undefined, error: E | undefined) => PausableReadResult<T, E>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* A read hook result that supports React Suspense.
|
|
62
|
+
*/
|
|
63
|
+
type SuspenseResult<T> = {
|
|
64
|
+
data: T;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* A read hook result that supports React Suspense and can be paused.
|
|
68
|
+
*/
|
|
69
|
+
type PausableSuspenseResult<T> = {
|
|
70
|
+
paused: true;
|
|
71
|
+
data: undefined;
|
|
72
|
+
} | {
|
|
73
|
+
paused: false;
|
|
74
|
+
data: T;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type Selector<T, V> = (data: T) => V;
|
|
78
|
+
type Pausable<T, WhenPaused = NullishDeep<T>> = Prettify<WhenPaused & {
|
|
79
|
+
/**
|
|
80
|
+
* Prevents the hook from automatically executing GraphQL query operations.
|
|
81
|
+
*
|
|
82
|
+
* @experimental This is an experimental feature and may change in the future.
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* `pause` may be set to `true` to stop the query operation from executing
|
|
86
|
+
* automatically. The hook will stop receiving updates and won’t execute the query
|
|
87
|
+
* operation until it’s set to `false`.
|
|
88
|
+
*/
|
|
89
|
+
pause: boolean;
|
|
90
|
+
}>;
|
|
91
|
+
type Suspendable = {
|
|
92
|
+
suspense: true;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
type UseChainArgs = ChainRequest;
|
|
96
|
+
/**
|
|
97
|
+
* Fetch a specific chain by chain ID.
|
|
98
|
+
*
|
|
99
|
+
* This signature supports React Suspense:
|
|
100
|
+
*
|
|
101
|
+
* ```tsx
|
|
102
|
+
* const { data } = useChain({
|
|
103
|
+
* chainId: chainId(1),
|
|
104
|
+
* suspense: true,
|
|
105
|
+
* });
|
|
106
|
+
* // data will be Chain | null
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare function useChain(args: UseChainArgs & Suspendable): SuspenseResult<Chain | null>;
|
|
110
|
+
/**
|
|
111
|
+
* Fetch a specific chain by chain ID.
|
|
112
|
+
*
|
|
113
|
+
* Pausable suspense mode.
|
|
114
|
+
*
|
|
115
|
+
* ```tsx
|
|
116
|
+
* const { data } = useChain({
|
|
117
|
+
* chainId: chainId(1),
|
|
118
|
+
* suspense: true,
|
|
119
|
+
* pause: true,
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare function useChain(args: Pausable<UseChainArgs> & Suspendable): PausableSuspenseResult<Chain | null>;
|
|
124
|
+
/**
|
|
125
|
+
* Fetch a specific chain by chain ID.
|
|
126
|
+
*
|
|
127
|
+
* ```tsx
|
|
128
|
+
* const { data, error, loading } = useChain({
|
|
129
|
+
* chainId: chainId(1),
|
|
130
|
+
* });
|
|
131
|
+
* // data will be Chain | null
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
declare function useChain(args: UseChainArgs): ReadResult<Chain | null>;
|
|
135
|
+
/**
|
|
136
|
+
* Fetch a specific chain by chain ID.
|
|
137
|
+
*
|
|
138
|
+
* Pausable loading state mode.
|
|
139
|
+
*
|
|
140
|
+
* ```tsx
|
|
141
|
+
* const { data, error, loading, paused } = useChain({
|
|
142
|
+
* chainId: chainId(1),
|
|
143
|
+
* pause: true,
|
|
144
|
+
* });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare function useChain(args: Pausable<UseChainArgs>): PausableReadResult<Chain | null>;
|
|
148
|
+
type UseChainsArgs = {
|
|
149
|
+
filter: ChainsFilter;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Fetches the list of supported chains.
|
|
153
|
+
*
|
|
154
|
+
* This signature supports React Suspense:
|
|
155
|
+
*
|
|
156
|
+
* ```tsx
|
|
157
|
+
* const { data } = useChains({
|
|
158
|
+
* filter: ChainsFilter.ALL,
|
|
159
|
+
* suspense: true,
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
declare function useChains(args: UseChainsArgs & Suspendable): SuspenseResult<Chain[]>;
|
|
164
|
+
/**
|
|
165
|
+
* Fetches the list of supported chains.
|
|
166
|
+
*
|
|
167
|
+
* Pausable suspense mode.
|
|
168
|
+
*
|
|
169
|
+
* ```tsx
|
|
170
|
+
* const { data } = useChains({
|
|
171
|
+
* filter: ChainsFilter.ALL,
|
|
172
|
+
* suspense: true,
|
|
173
|
+
* pause: true,
|
|
174
|
+
* });
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
declare function useChains(args: Pausable<UseChainsArgs> & Suspendable): PausableSuspenseResult<Chain[]>;
|
|
178
|
+
/**
|
|
179
|
+
* Fetches the list of supported chains.
|
|
180
|
+
*
|
|
181
|
+
* ```tsx
|
|
182
|
+
* const { data, error, loading } = useChains({
|
|
183
|
+
* filter: ChainsFilter.ALL,
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
declare function useChains(args?: UseChainsArgs): ReadResult<Chain[]>;
|
|
188
|
+
/**
|
|
189
|
+
* Fetches the list of supported chains.
|
|
190
|
+
*
|
|
191
|
+
* Pausable loading state mode.
|
|
192
|
+
*
|
|
193
|
+
* ```tsx
|
|
194
|
+
* const { data, error, loading, paused } = useChains({
|
|
195
|
+
* filter: ChainsFilter.ALL,
|
|
196
|
+
* pause: true,
|
|
197
|
+
* });
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
declare function useChains(args?: Pausable<UseChainsArgs>): PausableReadResult<Chain[]>;
|
|
201
|
+
/**
|
|
202
|
+
* Fetches exchange rates between tokens and fiat currencies.
|
|
203
|
+
*
|
|
204
|
+
* ```tsx
|
|
205
|
+
* const [getExchangeRate, gettingRate] = useExchangeRateAction();
|
|
206
|
+
*
|
|
207
|
+
* const loading = gettingRate.loading;
|
|
208
|
+
* const error = gettingRate.error;
|
|
209
|
+
*
|
|
210
|
+
* // …
|
|
211
|
+
*
|
|
212
|
+
* const result = await getExchangeRate({
|
|
213
|
+
* from: { erc20: { chainId: chainId(1), address: evmAddress('0xA0b86a33E6...') } },
|
|
214
|
+
* to: Currency.Usd,
|
|
215
|
+
* });
|
|
216
|
+
*
|
|
217
|
+
* if (result.isErr()) {
|
|
218
|
+
* console.error(result.error);
|
|
219
|
+
* return;
|
|
220
|
+
* }
|
|
221
|
+
*
|
|
222
|
+
* console.log('Exchange rate:', result.value);
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
declare function useExchangeRateAction(): UseAsyncTask<ExchangeRateRequest, FiatAmount, UnexpectedError$1>;
|
|
226
|
+
type UseExchangeRateArgs = ExchangeRateRequest;
|
|
227
|
+
/**
|
|
228
|
+
* Fetches exchange rates between tokens and fiat currencies with automatic polling.
|
|
229
|
+
*
|
|
230
|
+
* This signature supports React Suspense:
|
|
231
|
+
*
|
|
232
|
+
* ```tsx
|
|
233
|
+
* const { data } = useExchangeRate({
|
|
234
|
+
* from: {
|
|
235
|
+
* erc20: {
|
|
236
|
+
* chainId: chainId(1),
|
|
237
|
+
* address: evmAddress('0xA0b86a33E6...')
|
|
238
|
+
* }
|
|
239
|
+
* },
|
|
240
|
+
* to: Currency.Usd,
|
|
241
|
+
* suspense: true,
|
|
242
|
+
* });
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
declare function useExchangeRate(args: UseExchangeRateArgs & Suspendable): SuspenseResult<FiatAmount>;
|
|
246
|
+
/**
|
|
247
|
+
* Fetches exchange rates between tokens and fiat currencies with automatic polling.
|
|
248
|
+
*
|
|
249
|
+
* Pausable suspense mode.
|
|
250
|
+
*
|
|
251
|
+
* ```tsx
|
|
252
|
+
* const { data } = useExchangeRate({
|
|
253
|
+
* from: {
|
|
254
|
+
* erc20: {
|
|
255
|
+
* chainId: chainId(1),
|
|
256
|
+
* address: evmAddress('0xA0b86a33E6...')
|
|
257
|
+
* }
|
|
258
|
+
* },
|
|
259
|
+
* to: Currency.Usd,
|
|
260
|
+
* suspense: true,
|
|
261
|
+
* pause: true,
|
|
262
|
+
* });
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
declare function useExchangeRate(args: Pausable<UseExchangeRateArgs> & Suspendable): PausableSuspenseResult<FiatAmount>;
|
|
266
|
+
/**
|
|
267
|
+
* Fetches exchange rates between tokens and fiat currencies with automatic polling.
|
|
268
|
+
*
|
|
269
|
+
* ```tsx
|
|
270
|
+
* const { data, error, loading } = useExchangeRate({
|
|
271
|
+
* from: {
|
|
272
|
+
* erc20: {
|
|
273
|
+
* chainId: chainId(1),
|
|
274
|
+
* address: evmAddress('0xA0b86a33E6...')
|
|
275
|
+
* }
|
|
276
|
+
* },
|
|
277
|
+
* to: Currency.Usd,
|
|
278
|
+
* });
|
|
279
|
+
*
|
|
280
|
+
* <Component value={somewhere} fxRate={data} />
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
declare function useExchangeRate(args: UseExchangeRateArgs): ReadResult<FiatAmount>;
|
|
284
|
+
/**
|
|
285
|
+
* Fetches exchange rates between tokens and fiat currencies with automatic polling.
|
|
286
|
+
*
|
|
287
|
+
* Pausable loading state mode.
|
|
288
|
+
*
|
|
289
|
+
* ```tsx
|
|
290
|
+
* const { data, error, loading, paused } = useExchangeRate({
|
|
291
|
+
* from: {
|
|
292
|
+
* erc20: {
|
|
293
|
+
* chainId: chainId(1),
|
|
294
|
+
* address: evmAddress('0xA0b86a33E6...')
|
|
295
|
+
* }
|
|
296
|
+
* },
|
|
297
|
+
* to: Currency.Usd,
|
|
298
|
+
* pause: true,
|
|
299
|
+
* });
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
declare function useExchangeRate(args: Pausable<UseExchangeRateArgs>): PausableReadResult<FiatAmount>;
|
|
303
|
+
type UseNetworkFeeRequestQuery = {
|
|
304
|
+
activity: ActivityItem;
|
|
305
|
+
} | {
|
|
306
|
+
estimate: PreviewAction;
|
|
307
|
+
};
|
|
308
|
+
type UseNetworkFeeArgs = Prettify<{
|
|
309
|
+
query: UseNetworkFeeRequestQuery;
|
|
310
|
+
} & CurrencyQueryOptions>;
|
|
311
|
+
type PausableUseNetworkFeeArgs = Partial<{
|
|
312
|
+
query: Partial<UseNetworkFeeRequestQuery>;
|
|
313
|
+
} & CurrencyQueryOptions>;
|
|
314
|
+
/**
|
|
315
|
+
* Fetch the network fee for an ActivityItem.
|
|
316
|
+
*
|
|
317
|
+
* @experimental This hook is experimental and may be subject to breaking changes.
|
|
318
|
+
*/
|
|
319
|
+
type UseNetworkFee<T extends NativeAmount = NativeAmount> =
|
|
320
|
+
/**
|
|
321
|
+
* Fetches the network fee for a past ActivityItem.
|
|
322
|
+
*
|
|
323
|
+
* This signature supports React Suspense:
|
|
324
|
+
*
|
|
325
|
+
* ```tsx
|
|
326
|
+
* const { data } = useNetworkFee({
|
|
327
|
+
* query: { activity },
|
|
328
|
+
* suspense: true,
|
|
329
|
+
* });
|
|
330
|
+
*
|
|
331
|
+
* data: NativeAmount
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
((args: UseNetworkFeeArgs & Suspendable) => SuspenseResult<T>) &
|
|
335
|
+
/**
|
|
336
|
+
* Fetches the network fee for a past ActivityItem.
|
|
337
|
+
*
|
|
338
|
+
* Pausable suspense mode.
|
|
339
|
+
*
|
|
340
|
+
* ```tsx
|
|
341
|
+
* const { data, paused } = useNetworkFee({
|
|
342
|
+
* query: { activity },
|
|
343
|
+
* suspense: true,
|
|
344
|
+
* pause: true,
|
|
345
|
+
* });
|
|
346
|
+
*
|
|
347
|
+
* data: NativeAmount | undefined
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
((args: Pausable<UseNetworkFeeArgs, PausableUseNetworkFeeArgs> & Suspendable) => PausableSuspenseResult<T>) &
|
|
351
|
+
/**
|
|
352
|
+
* Fetches the network fee for a past ActivityItem.
|
|
353
|
+
*
|
|
354
|
+
* ```tsx
|
|
355
|
+
* const { data, error, loading } = useNetworkFee({
|
|
356
|
+
* query: { activity },
|
|
357
|
+
* });
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
((args: UseNetworkFeeArgs) => ReadResult<T>) &
|
|
361
|
+
/**
|
|
362
|
+
* Fetches the network fee for a past ActivityItem.
|
|
363
|
+
*
|
|
364
|
+
* Pausable loading state mode.
|
|
365
|
+
*
|
|
366
|
+
* ```tsx
|
|
367
|
+
* const { data, error, loading, paused } = useNetworkFee({
|
|
368
|
+
* query: { activity },
|
|
369
|
+
* pause: true,
|
|
370
|
+
* });
|
|
371
|
+
*
|
|
372
|
+
* data: NativeAmount | undefined
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
((args: Pausable<UseNetworkFeeArgs, PausableUseNetworkFeeArgs>) => PausableReadResult<T>);
|
|
376
|
+
|
|
377
|
+
export { type Pausable as P, ReadResult as R, type Suspendable as S, type UseNetworkFee as U, type SuspenseResult as a, type PausableSuspenseResult as b, type PausableReadResult as c, type Selector as d, type UseChainArgs as e, type UseChainsArgs as f, useChains as g, useExchangeRateAction as h, type UseExchangeRateArgs as i, useExchangeRate as j, type UseNetworkFeeRequestQuery as k, type UseNetworkFeeArgs as l, useChain as u };
|