@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.
Files changed (45) hide show
  1. package/dist/chunk-GTUQRT5Q.js +2 -0
  2. package/dist/chunk-GTUQRT5Q.js.map +1 -0
  3. package/dist/chunk-XIDOSID3.js +2 -0
  4. package/dist/chunk-XIDOSID3.js.map +1 -0
  5. package/dist/ethers.cjs +2 -0
  6. package/dist/ethers.cjs.map +1 -0
  7. package/dist/ethers.d.cts +93 -0
  8. package/dist/ethers.d.ts +93 -0
  9. package/dist/ethers.js +2 -0
  10. package/dist/ethers.js.map +1 -0
  11. package/dist/index.cjs +2 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.cts +2670 -0
  14. package/dist/index.d.ts +2670 -0
  15. package/dist/index.js +2 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/misc-BkG5G4yl.d.cts +377 -0
  18. package/dist/misc-gmAnSdm5.d.ts +377 -0
  19. package/dist/privy.cjs +2 -0
  20. package/dist/privy.cjs.map +1 -0
  21. package/dist/privy.d.cts +72 -0
  22. package/dist/privy.d.ts +72 -0
  23. package/dist/privy.js +2 -0
  24. package/dist/privy.js.map +1 -0
  25. package/dist/thirdweb.cjs +3 -0
  26. package/dist/thirdweb.cjs.map +1 -0
  27. package/dist/thirdweb.d.cts +69 -0
  28. package/dist/thirdweb.d.ts +69 -0
  29. package/dist/thirdweb.js +3 -0
  30. package/dist/thirdweb.js.map +1 -0
  31. package/dist/utils.cjs +2 -0
  32. package/dist/utils.cjs.map +1 -0
  33. package/dist/utils.d.cts +1 -0
  34. package/dist/utils.d.ts +1 -0
  35. package/dist/utils.js +2 -0
  36. package/dist/utils.js.map +1 -0
  37. package/dist/viem/index.cjs +2 -0
  38. package/dist/viem/index.cjs.map +1 -0
  39. package/dist/viem/index.d.cts +97 -0
  40. package/dist/viem/index.d.ts +97 -0
  41. package/dist/viem/index.js +2 -0
  42. package/dist/viem/index.js.map +1 -0
  43. package/dist/writes-BXnwYgAQ.d.cts +123 -0
  44. package/dist/writes-BXnwYgAQ.d.ts +123 -0
  45. package/package.json +5 -5
@@ -0,0 +1,123 @@
1
+ import { TransactionResult } from '@aave/client';
2
+ import { CancelError, TimeoutError, TransactionError, UnexpectedError, SigningError } from '@aave/core';
3
+ import { TransactionRequest, Erc20ApprovalRequired, PreContractActionRequired } from '@aave/graphql';
4
+ import { ResultAsync } from '@aave/types';
5
+
6
+ /**
7
+ * An async task is a function that can be executed multiple times and that can be in a pending state.
8
+ *
9
+ * @internal
10
+ */
11
+ type AsyncTask<TInput, TResult extends ResultAsync<unknown, unknown>> = (input: TInput) => TResult;
12
+ /**
13
+ * The initial state of a async task.
14
+ */
15
+ type AsyncTaskIdle = {
16
+ called: boolean;
17
+ loading: false;
18
+ data: undefined;
19
+ error: undefined;
20
+ };
21
+ /**
22
+ * The state of a async task during the loading.
23
+ */
24
+ type AsyncTaskLoading<TData> = {
25
+ called: true;
26
+ loading: true;
27
+ data: TData | undefined;
28
+ error: undefined;
29
+ };
30
+ /**
31
+ * The state of a async task after a successful call.
32
+ */
33
+ type AsyncTaskSuccess<TData> = {
34
+ called: true;
35
+ loading: false;
36
+ data: TData;
37
+ error: undefined;
38
+ };
39
+ /**
40
+ * The state of a async task after a failed call.
41
+ */
42
+ type AsyncTaskError<TError> = {
43
+ called: true;
44
+ loading: false;
45
+ data: undefined;
46
+ error: TError;
47
+ };
48
+ /**
49
+ * The possible statuses of a async task.
50
+ */
51
+ type AsyncTaskState<TData, TError> = AsyncTaskIdle | AsyncTaskLoading<TData> | AsyncTaskSuccess<TData> | AsyncTaskError<TError>;
52
+ /**
53
+ * A async task React Hook is a lightweight wrapper for an asynchronous function.
54
+ * It allows tracking of the task's execution status and provides access to the
55
+ * last error that occurred during the task's execution, if any.
56
+ *
57
+ * ```ts
58
+ * const [execute, { called, loading, data, error }]: UseAsyncTask<TData, TError, TInput> = useAnyAsyncTask();
59
+ *
60
+ * if (!called) {
61
+ * // data === undefined
62
+ * // error === undefined
63
+ * return <p>Click the button to execute the task</p>;
64
+ * }
65
+ *
66
+ * if (loading) {
67
+ * // data === undefined on first call
68
+ * // data === TData from previous successful call
69
+ * // error === undefined
70
+ * return <Loader />;
71
+ * }
72
+ *
73
+ * if (error) {
74
+ * // data === undefined
75
+ * // error === TError
76
+ * return <p>Something went wrong: {error.message}</p>;
77
+ * }
78
+ *
79
+ * // called === true
80
+ * // data === TData
81
+ * // error === undefined
82
+ * return <p>Task completed: {data}</p>;
83
+ * ```
84
+ */
85
+ type UseAsyncTask<TInput, TValue, TError> = [
86
+ AsyncTask<TInput, ResultAsync<TValue, TError>>,
87
+ AsyncTaskState<TValue, TError>
88
+ ];
89
+
90
+ /**
91
+ * The errors that could occur in the early stage of sending a transaction.
92
+ */
93
+ type SendTransactionError = CancelError | SigningError | UnexpectedError;
94
+ type CancelOperation = (message: string) => ResultAsync<never, CancelError>;
95
+ type TransactionHandlerOptions = {
96
+ cancel: CancelOperation;
97
+ };
98
+ /**
99
+ * The errors that could occur in the late stages of a transaction.
100
+ */
101
+ type PendingTransactionError = CancelError | TimeoutError | TransactionError | UnexpectedError;
102
+ declare class PendingTransaction {
103
+ /**
104
+ * @internal Do NOT rely on this method. It's used internally by the SDK and may be subject to breaking changes.
105
+ */
106
+ readonly wait: () => ResultAsync<TransactionResult, PendingTransactionError>;
107
+ constructor(
108
+ /**
109
+ * @internal Do NOT rely on this method. It's used internally by the SDK and may be subject to breaking changes.
110
+ */
111
+ wait: () => ResultAsync<TransactionResult, PendingTransactionError>);
112
+ /**
113
+ * @internal
114
+ */
115
+ static ensure<T>(value: T): PendingTransaction & T;
116
+ }
117
+ type UseSendTransactionResult = UseAsyncTask<TransactionRequest, PendingTransaction, SendTransactionError>;
118
+ /**
119
+ * The handler for sending Aave transactions.
120
+ */
121
+ type TransactionHandler = (result: TransactionRequest | Erc20ApprovalRequired | PreContractActionRequired, options: TransactionHandlerOptions) => ResultAsync<PendingTransaction, SendTransactionError>;
122
+
123
+ export { type AsyncTaskError as A, type CancelOperation as C, type PendingTransactionError as P, type SendTransactionError as S, type TransactionHandler as T, type UseSendTransactionResult as U, type UseAsyncTask as a, PendingTransaction as b, type AsyncTaskIdle as c, type AsyncTaskLoading as d, type AsyncTaskState as e, type AsyncTaskSuccess as f, type TransactionHandlerOptions as g };
@@ -0,0 +1,123 @@
1
+ import { TransactionResult } from '@aave/client';
2
+ import { CancelError, TimeoutError, TransactionError, UnexpectedError, SigningError } from '@aave/core';
3
+ import { TransactionRequest, Erc20ApprovalRequired, PreContractActionRequired } from '@aave/graphql';
4
+ import { ResultAsync } from '@aave/types';
5
+
6
+ /**
7
+ * An async task is a function that can be executed multiple times and that can be in a pending state.
8
+ *
9
+ * @internal
10
+ */
11
+ type AsyncTask<TInput, TResult extends ResultAsync<unknown, unknown>> = (input: TInput) => TResult;
12
+ /**
13
+ * The initial state of a async task.
14
+ */
15
+ type AsyncTaskIdle = {
16
+ called: boolean;
17
+ loading: false;
18
+ data: undefined;
19
+ error: undefined;
20
+ };
21
+ /**
22
+ * The state of a async task during the loading.
23
+ */
24
+ type AsyncTaskLoading<TData> = {
25
+ called: true;
26
+ loading: true;
27
+ data: TData | undefined;
28
+ error: undefined;
29
+ };
30
+ /**
31
+ * The state of a async task after a successful call.
32
+ */
33
+ type AsyncTaskSuccess<TData> = {
34
+ called: true;
35
+ loading: false;
36
+ data: TData;
37
+ error: undefined;
38
+ };
39
+ /**
40
+ * The state of a async task after a failed call.
41
+ */
42
+ type AsyncTaskError<TError> = {
43
+ called: true;
44
+ loading: false;
45
+ data: undefined;
46
+ error: TError;
47
+ };
48
+ /**
49
+ * The possible statuses of a async task.
50
+ */
51
+ type AsyncTaskState<TData, TError> = AsyncTaskIdle | AsyncTaskLoading<TData> | AsyncTaskSuccess<TData> | AsyncTaskError<TError>;
52
+ /**
53
+ * A async task React Hook is a lightweight wrapper for an asynchronous function.
54
+ * It allows tracking of the task's execution status and provides access to the
55
+ * last error that occurred during the task's execution, if any.
56
+ *
57
+ * ```ts
58
+ * const [execute, { called, loading, data, error }]: UseAsyncTask<TData, TError, TInput> = useAnyAsyncTask();
59
+ *
60
+ * if (!called) {
61
+ * // data === undefined
62
+ * // error === undefined
63
+ * return <p>Click the button to execute the task</p>;
64
+ * }
65
+ *
66
+ * if (loading) {
67
+ * // data === undefined on first call
68
+ * // data === TData from previous successful call
69
+ * // error === undefined
70
+ * return <Loader />;
71
+ * }
72
+ *
73
+ * if (error) {
74
+ * // data === undefined
75
+ * // error === TError
76
+ * return <p>Something went wrong: {error.message}</p>;
77
+ * }
78
+ *
79
+ * // called === true
80
+ * // data === TData
81
+ * // error === undefined
82
+ * return <p>Task completed: {data}</p>;
83
+ * ```
84
+ */
85
+ type UseAsyncTask<TInput, TValue, TError> = [
86
+ AsyncTask<TInput, ResultAsync<TValue, TError>>,
87
+ AsyncTaskState<TValue, TError>
88
+ ];
89
+
90
+ /**
91
+ * The errors that could occur in the early stage of sending a transaction.
92
+ */
93
+ type SendTransactionError = CancelError | SigningError | UnexpectedError;
94
+ type CancelOperation = (message: string) => ResultAsync<never, CancelError>;
95
+ type TransactionHandlerOptions = {
96
+ cancel: CancelOperation;
97
+ };
98
+ /**
99
+ * The errors that could occur in the late stages of a transaction.
100
+ */
101
+ type PendingTransactionError = CancelError | TimeoutError | TransactionError | UnexpectedError;
102
+ declare class PendingTransaction {
103
+ /**
104
+ * @internal Do NOT rely on this method. It's used internally by the SDK and may be subject to breaking changes.
105
+ */
106
+ readonly wait: () => ResultAsync<TransactionResult, PendingTransactionError>;
107
+ constructor(
108
+ /**
109
+ * @internal Do NOT rely on this method. It's used internally by the SDK and may be subject to breaking changes.
110
+ */
111
+ wait: () => ResultAsync<TransactionResult, PendingTransactionError>);
112
+ /**
113
+ * @internal
114
+ */
115
+ static ensure<T>(value: T): PendingTransaction & T;
116
+ }
117
+ type UseSendTransactionResult = UseAsyncTask<TransactionRequest, PendingTransaction, SendTransactionError>;
118
+ /**
119
+ * The handler for sending Aave transactions.
120
+ */
121
+ type TransactionHandler = (result: TransactionRequest | Erc20ApprovalRequired | PreContractActionRequired, options: TransactionHandlerOptions) => ResultAsync<PendingTransaction, SendTransactionError>;
122
+
123
+ export { type AsyncTaskError as A, type CancelOperation as C, type PendingTransactionError as P, type SendTransactionError as S, type TransactionHandler as T, type UseSendTransactionResult as U, type UseAsyncTask as a, PendingTransaction as b, type AsyncTaskIdle as c, type AsyncTaskLoading as d, type AsyncTaskState as e, type AsyncTaskSuccess as f, type TransactionHandlerOptions as g };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aave/react",
3
- "version": "4.0.0-next.1",
3
+ "version": "4.0.0-next.2",
4
4
  "description": "The official React bindings for the Aave Protocol",
5
5
  "keywords": [
6
6
  "aave",
@@ -72,10 +72,10 @@
72
72
  "sideEffects": false,
73
73
  "dependencies": {
74
74
  "urql": "^5.0.1",
75
- "@aave/client": "4.0.0-next.1",
76
- "@aave/core": "1.0.0-next.0",
77
- "@aave/graphql": "1.0.0-next.1",
78
- "@aave/types": "1.0.0-next.0"
75
+ "@aave/client": "4.0.0-next.2",
76
+ "@aave/core": "1.0.0-next.1",
77
+ "@aave/types": "1.0.0-next.1",
78
+ "@aave/graphql": "1.0.0-next.2"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@privy-io/react-auth": "^2.20.0",