wagmi 3.1.4 → 3.3.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/dist/esm/exports/tempo.js +9 -0
- package/dist/esm/exports/tempo.js.map +1 -0
- package/dist/esm/tempo/hooks/amm.js +485 -0
- package/dist/esm/tempo/hooks/amm.js.map +1 -0
- package/dist/esm/tempo/hooks/dex.js +1020 -0
- package/dist/esm/tempo/hooks/dex.js.map +1 -0
- package/dist/esm/tempo/hooks/faucet.js +76 -0
- package/dist/esm/tempo/hooks/faucet.js.map +1 -0
- package/dist/esm/tempo/hooks/fee.js +155 -0
- package/dist/esm/tempo/hooks/fee.js.map +1 -0
- package/dist/esm/tempo/hooks/index.js +11 -0
- package/dist/esm/tempo/hooks/index.js.map +1 -0
- package/dist/esm/tempo/hooks/nonce.js +85 -0
- package/dist/esm/tempo/hooks/nonce.js.map +1 -0
- package/dist/esm/tempo/hooks/policy.js +545 -0
- package/dist/esm/tempo/hooks/policy.js.map +1 -0
- package/dist/esm/tempo/hooks/reward.js +385 -0
- package/dist/esm/tempo/hooks/reward.js.map +1 -0
- package/dist/esm/tempo/hooks/token.js +1730 -0
- package/dist/esm/tempo/hooks/token.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/exports/tempo.d.ts +4 -0
- package/dist/types/exports/tempo.d.ts.map +1 -0
- package/dist/types/tempo/hooks/amm.d.ts +384 -0
- package/dist/types/tempo/hooks/amm.d.ts.map +1 -0
- package/dist/types/tempo/hooks/dex.d.ts +841 -0
- package/dist/types/tempo/hooks/dex.d.ts.map +1 -0
- package/dist/types/tempo/hooks/faucet.d.ts +70 -0
- package/dist/types/tempo/hooks/faucet.d.ts.map +1 -0
- package/dist/types/tempo/hooks/fee.d.ts +123 -0
- package/dist/types/tempo/hooks/fee.d.ts.map +1 -0
- package/dist/types/tempo/hooks/index.d.ts +10 -0
- package/dist/types/tempo/hooks/index.d.ts.map +1 -0
- package/dist/types/tempo/hooks/nonce.d.ts +60 -0
- package/dist/types/tempo/hooks/nonce.d.ts.map +1 -0
- package/dist/types/tempo/hooks/policy.d.ts +422 -0
- package/dist/types/tempo/hooks/policy.d.ts.map +1 -0
- package/dist/types/tempo/hooks/reward.d.ts +304 -0
- package/dist/types/tempo/hooks/reward.d.ts.map +1 -0
- package/dist/types/tempo/hooks/token.d.ts +1387 -0
- package/dist/types/tempo/hooks/token.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +12 -4
- package/src/exports/tempo.ts +17 -0
- package/src/tempo/hooks/amm.ts +776 -0
- package/src/tempo/hooks/dex.ts +1737 -0
- package/src/tempo/hooks/faucet.ts +142 -0
- package/src/tempo/hooks/fee.ts +264 -0
- package/src/tempo/hooks/index.ts +10 -0
- package/src/tempo/hooks/nonce.ts +126 -0
- package/src/tempo/hooks/policy.ts +907 -0
- package/src/tempo/hooks/reward.ts +668 -0
- package/src/tempo/hooks/token.ts +2979 -0
- package/src/version.ts +1 -1
- package/tempo/package.json +5 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Tempo
|
|
3
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
4
|
+
/** biome-ignore-all lint/performance/noReExportAll: entrypoint */
|
|
5
|
+
// biome-ignore lint/performance/noBarrelFile: entrypoint module
|
|
6
|
+
export { Actions, dangerous_secp256k1, KeyManager, webAuthn, } from '@wagmi/core/tempo';
|
|
7
|
+
// Export Hooks
|
|
8
|
+
export * as Hooks from '../tempo/hooks/index.js';
|
|
9
|
+
//# sourceMappingURL=tempo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tempo.js","sourceRoot":"","sources":["../../../src/exports/tempo.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF,kEAAkE;AAClE,gEAAgE;AAChE,OAAO,EACL,OAAO,EAEP,mBAAmB,EACnB,UAAU,EAEV,QAAQ,GACT,MAAM,mBAAmB,CAAA;AAE1B,eAAe;AACf,OAAO,KAAK,KAAK,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { Actions } from '@wagmi/core/tempo';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useChainId } from '../../hooks/useChainId.js';
|
|
4
|
+
import { useConfig } from '../../hooks/useConfig.js';
|
|
5
|
+
import { useMutation, useQuery, } from '../../utils/query.js';
|
|
6
|
+
/**
|
|
7
|
+
* Hook for getting the reserves for a liquidity pool.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
12
|
+
*
|
|
13
|
+
* function App() {
|
|
14
|
+
* const { data, isLoading } = Hooks.amm.usePool({
|
|
15
|
+
* userToken: '0x...',
|
|
16
|
+
* validatorToken: '0x...',
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* if (isLoading) return <div>Loading...</div>
|
|
20
|
+
* return (
|
|
21
|
+
* <div>
|
|
22
|
+
* User Token Reserve: {data?.reserveUserToken.toString()}
|
|
23
|
+
* Validator Token Reserve: {data?.reserveValidatorToken.toString()}
|
|
24
|
+
* </div>
|
|
25
|
+
* )
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param parameters - Parameters.
|
|
30
|
+
* @returns Query result with the pool reserves.
|
|
31
|
+
*/
|
|
32
|
+
export function usePool(parameters = {}) {
|
|
33
|
+
const config = useConfig(parameters);
|
|
34
|
+
const chainId = useChainId({ config });
|
|
35
|
+
const options = Actions.amm.getPool.queryOptions(config, {
|
|
36
|
+
...parameters,
|
|
37
|
+
chainId: parameters.chainId ?? chainId,
|
|
38
|
+
});
|
|
39
|
+
return useQuery(options);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Hook for getting the LP token balance for an account in a specific pool.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
47
|
+
*
|
|
48
|
+
* function App() {
|
|
49
|
+
* const { data: poolId } = Hooks.amm.usePoolId({
|
|
50
|
+
* userToken: '0x...',
|
|
51
|
+
* validatorToken: '0x...',
|
|
52
|
+
* })
|
|
53
|
+
*
|
|
54
|
+
* const { data, isLoading } = Hooks.amm.useLiquidityBalance({
|
|
55
|
+
* poolId,
|
|
56
|
+
* address: '0x20c...0055',
|
|
57
|
+
* })
|
|
58
|
+
*
|
|
59
|
+
* if (isLoading) return <div>Loading...</div>
|
|
60
|
+
* return <div>LP Balance: {data?.toString()}</div>
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @param parameters - Parameters.
|
|
65
|
+
* @returns Query result with the LP token balance.
|
|
66
|
+
*/
|
|
67
|
+
export function useLiquidityBalance(parameters = {}) {
|
|
68
|
+
const config = useConfig(parameters);
|
|
69
|
+
const chainId = useChainId({ config });
|
|
70
|
+
const options = Actions.amm.getLiquidityBalance.queryOptions(config, {
|
|
71
|
+
...parameters,
|
|
72
|
+
chainId: parameters.chainId ?? chainId,
|
|
73
|
+
});
|
|
74
|
+
return useQuery(options);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Hook for performing a rebalance swap from validator token to user token.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
82
|
+
*
|
|
83
|
+
* function App() {
|
|
84
|
+
* const { mutate, isPending } = Hooks.amm.useRebalanceSwap()
|
|
85
|
+
*
|
|
86
|
+
* return (
|
|
87
|
+
* <button
|
|
88
|
+
* onClick={() =>
|
|
89
|
+
* mutate({
|
|
90
|
+
* userToken: '0x...',
|
|
91
|
+
* validatorToken: '0x...',
|
|
92
|
+
* amountOut: 100n,
|
|
93
|
+
* to: '0x...',
|
|
94
|
+
* })
|
|
95
|
+
* }
|
|
96
|
+
* disabled={isPending}
|
|
97
|
+
* >
|
|
98
|
+
* Rebalance Swap
|
|
99
|
+
* </button>
|
|
100
|
+
* )
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @param parameters - Parameters.
|
|
105
|
+
* @returns Mutation result.
|
|
106
|
+
*/
|
|
107
|
+
export function useRebalanceSwap(parameters = {}) {
|
|
108
|
+
const { mutation } = parameters;
|
|
109
|
+
const config = useConfig(parameters);
|
|
110
|
+
return useMutation({
|
|
111
|
+
...mutation,
|
|
112
|
+
async mutationFn(variables) {
|
|
113
|
+
return Actions.amm.rebalanceSwap(config, variables);
|
|
114
|
+
},
|
|
115
|
+
mutationKey: ['rebalanceSwap'],
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Hook for performing a rebalance swap from validator token to user token.
|
|
120
|
+
*
|
|
121
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
122
|
+
* to be included on a block before returning a response.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
127
|
+
*
|
|
128
|
+
* function App() {
|
|
129
|
+
* const { mutate, isPending } = Hooks.amm.useRebalanceSwapSync()
|
|
130
|
+
*
|
|
131
|
+
* return (
|
|
132
|
+
* <button
|
|
133
|
+
* onClick={() =>
|
|
134
|
+
* mutate({
|
|
135
|
+
* userToken: '0x...',
|
|
136
|
+
* validatorToken: '0x...',
|
|
137
|
+
* amountOut: 100n,
|
|
138
|
+
* to: '0x...',
|
|
139
|
+
* })
|
|
140
|
+
* }
|
|
141
|
+
* disabled={isPending}
|
|
142
|
+
* >
|
|
143
|
+
* Rebalance Swap
|
|
144
|
+
* </button>
|
|
145
|
+
* )
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* @param parameters - Parameters.
|
|
150
|
+
* @returns Mutation result.
|
|
151
|
+
*/
|
|
152
|
+
export function useRebalanceSwapSync(parameters = {}) {
|
|
153
|
+
const { mutation } = parameters;
|
|
154
|
+
const config = useConfig(parameters);
|
|
155
|
+
return useMutation({
|
|
156
|
+
...mutation,
|
|
157
|
+
async mutationFn(variables) {
|
|
158
|
+
return Actions.amm.rebalanceSwapSync(config, variables);
|
|
159
|
+
},
|
|
160
|
+
mutationKey: ['rebalanceSwapSync'],
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Hook for adding liquidity to a pool.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
169
|
+
*
|
|
170
|
+
* function App() {
|
|
171
|
+
* const { mutate, isPending } = Hooks.amm.useMint()
|
|
172
|
+
*
|
|
173
|
+
* return (
|
|
174
|
+
* <button
|
|
175
|
+
* onClick={() =>
|
|
176
|
+
* mutate({
|
|
177
|
+
* userTokenAddress: '0x20c0...beef',
|
|
178
|
+
* validatorTokenAddress: '0x20c0...babe',
|
|
179
|
+
* validatorTokenAmount: 100n,
|
|
180
|
+
* to: '0xfeed...fede',
|
|
181
|
+
* })
|
|
182
|
+
* }
|
|
183
|
+
* disabled={isPending}
|
|
184
|
+
* >
|
|
185
|
+
* Add Liquidity
|
|
186
|
+
* </button>
|
|
187
|
+
* )
|
|
188
|
+
* }
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* @param parameters - Parameters.
|
|
192
|
+
* @returns Mutation result.
|
|
193
|
+
*/
|
|
194
|
+
export function useMint(parameters = {}) {
|
|
195
|
+
const { mutation } = parameters;
|
|
196
|
+
const config = useConfig(parameters);
|
|
197
|
+
return useMutation({
|
|
198
|
+
...mutation,
|
|
199
|
+
async mutationFn(variables) {
|
|
200
|
+
return Actions.amm.mint(config, variables);
|
|
201
|
+
},
|
|
202
|
+
mutationKey: ['mint'],
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Hook for adding liquidity to a pool.
|
|
207
|
+
*
|
|
208
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
209
|
+
* to be included on a block before returning a response.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```tsx
|
|
213
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
214
|
+
*
|
|
215
|
+
* function App() {
|
|
216
|
+
* const { mutate, isPending } = Hooks.amm.useMintSync()
|
|
217
|
+
*
|
|
218
|
+
* return (
|
|
219
|
+
* <button
|
|
220
|
+
* onClick={() =>
|
|
221
|
+
* mutate({
|
|
222
|
+
* userTokenAddress: '0x20c0...beef',
|
|
223
|
+
* validatorTokenAddress: '0x20c0...babe',
|
|
224
|
+
* validatorTokenAmount: 100n,
|
|
225
|
+
* to: '0xfeed...fede',
|
|
226
|
+
* })
|
|
227
|
+
* }
|
|
228
|
+
* disabled={isPending}
|
|
229
|
+
* >
|
|
230
|
+
* Add Liquidity
|
|
231
|
+
* </button>
|
|
232
|
+
* )
|
|
233
|
+
* }
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* @param parameters - Parameters.
|
|
237
|
+
* @returns Mutation result.
|
|
238
|
+
*/
|
|
239
|
+
export function useMintSync(parameters = {}) {
|
|
240
|
+
const { mutation } = parameters;
|
|
241
|
+
const config = useConfig(parameters);
|
|
242
|
+
return useMutation({
|
|
243
|
+
...mutation,
|
|
244
|
+
async mutationFn(variables) {
|
|
245
|
+
return Actions.amm.mintSync(config, variables);
|
|
246
|
+
},
|
|
247
|
+
mutationKey: ['mintSync'],
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Hook for removing liquidity from a pool.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```tsx
|
|
255
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
256
|
+
*
|
|
257
|
+
* function App() {
|
|
258
|
+
* const { mutate, isPending } = Hooks.amm.useBurn()
|
|
259
|
+
*
|
|
260
|
+
* return (
|
|
261
|
+
* <button
|
|
262
|
+
* onClick={() =>
|
|
263
|
+
* mutate({
|
|
264
|
+
* userToken: '0x20c0...beef',
|
|
265
|
+
* validatorToken: '0x20c0...babe',
|
|
266
|
+
* liquidity: 50n,
|
|
267
|
+
* to: '0xfeed...fede',
|
|
268
|
+
* })
|
|
269
|
+
* }
|
|
270
|
+
* disabled={isPending}
|
|
271
|
+
* >
|
|
272
|
+
* Remove Liquidity
|
|
273
|
+
* </button>
|
|
274
|
+
* )
|
|
275
|
+
* }
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* @param parameters - Parameters.
|
|
279
|
+
* @returns Mutation result.
|
|
280
|
+
*/
|
|
281
|
+
export function useBurn(parameters = {}) {
|
|
282
|
+
const { mutation } = parameters;
|
|
283
|
+
const config = useConfig(parameters);
|
|
284
|
+
return useMutation({
|
|
285
|
+
...mutation,
|
|
286
|
+
async mutationFn(variables) {
|
|
287
|
+
return Actions.amm.burn(config, variables);
|
|
288
|
+
},
|
|
289
|
+
mutationKey: ['burn'],
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Hook for removing liquidity from a pool.
|
|
294
|
+
*
|
|
295
|
+
* Note: This is a synchronous hook that waits for the transaction
|
|
296
|
+
* to be included on a block before returning a response.
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```tsx
|
|
300
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
301
|
+
*
|
|
302
|
+
* function App() {
|
|
303
|
+
* const { mutate, isPending } = Hooks.amm.useBurnSync()
|
|
304
|
+
*
|
|
305
|
+
* return (
|
|
306
|
+
* <button
|
|
307
|
+
* onClick={() =>
|
|
308
|
+
* mutate({
|
|
309
|
+
* userToken: '0x20c0...beef',
|
|
310
|
+
* validatorToken: '0x20c0...babe',
|
|
311
|
+
* liquidity: 50n,
|
|
312
|
+
* to: '0xfeed...fede',
|
|
313
|
+
* })
|
|
314
|
+
* }
|
|
315
|
+
* disabled={isPending}
|
|
316
|
+
* >
|
|
317
|
+
* Remove Liquidity
|
|
318
|
+
* </button>
|
|
319
|
+
* )
|
|
320
|
+
* }
|
|
321
|
+
* ```
|
|
322
|
+
*
|
|
323
|
+
* @param parameters - Parameters.
|
|
324
|
+
* @returns Mutation result.
|
|
325
|
+
*/
|
|
326
|
+
export function useBurnSync(parameters = {}) {
|
|
327
|
+
const { mutation } = parameters;
|
|
328
|
+
const config = useConfig(parameters);
|
|
329
|
+
return useMutation({
|
|
330
|
+
...mutation,
|
|
331
|
+
async mutationFn(variables) {
|
|
332
|
+
return Actions.amm.burnSync(config, variables);
|
|
333
|
+
},
|
|
334
|
+
mutationKey: ['burnSync'],
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Hook for watching rebalance swap events.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```tsx
|
|
342
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
343
|
+
*
|
|
344
|
+
* function App() {
|
|
345
|
+
* Hooks.amm.useWatchRebalanceSwap({
|
|
346
|
+
* onRebalanceSwap(args) {
|
|
347
|
+
* console.log('Rebalance swap:', args)
|
|
348
|
+
* },
|
|
349
|
+
* })
|
|
350
|
+
*
|
|
351
|
+
* return <div>Watching for rebalance swaps...</div>
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
*
|
|
355
|
+
* @param parameters - Parameters.
|
|
356
|
+
*/
|
|
357
|
+
export function useWatchRebalanceSwap(parameters = {}) {
|
|
358
|
+
const { enabled = true, onRebalanceSwap, ...rest } = parameters;
|
|
359
|
+
const config = useConfig({ config: parameters.config });
|
|
360
|
+
const configChainId = useChainId({ config });
|
|
361
|
+
const chainId = parameters.chainId ?? configChainId;
|
|
362
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
363
|
+
useEffect(() => {
|
|
364
|
+
if (!enabled)
|
|
365
|
+
return;
|
|
366
|
+
if (!onRebalanceSwap)
|
|
367
|
+
return;
|
|
368
|
+
return Actions.amm.watchRebalanceSwap(config, {
|
|
369
|
+
...rest,
|
|
370
|
+
chainId,
|
|
371
|
+
onRebalanceSwap,
|
|
372
|
+
});
|
|
373
|
+
}, [
|
|
374
|
+
config,
|
|
375
|
+
enabled,
|
|
376
|
+
chainId,
|
|
377
|
+
onRebalanceSwap,
|
|
378
|
+
rest.fromBlock,
|
|
379
|
+
rest.onError,
|
|
380
|
+
rest.poll,
|
|
381
|
+
rest.pollingInterval,
|
|
382
|
+
rest.userToken,
|
|
383
|
+
rest.validatorToken,
|
|
384
|
+
]);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Hook for watching liquidity mint events.
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```tsx
|
|
391
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
392
|
+
*
|
|
393
|
+
* function App() {
|
|
394
|
+
* Hooks.amm.useWatchMint({
|
|
395
|
+
* onMint(args) {
|
|
396
|
+
* console.log('Liquidity added:', args)
|
|
397
|
+
* },
|
|
398
|
+
* })
|
|
399
|
+
*
|
|
400
|
+
* return <div>Watching for liquidity additions...</div>
|
|
401
|
+
* }
|
|
402
|
+
* ```
|
|
403
|
+
*
|
|
404
|
+
* @param parameters - Parameters.
|
|
405
|
+
*/
|
|
406
|
+
export function useWatchMint(parameters = {}) {
|
|
407
|
+
const { enabled = true, onMint, ...rest } = parameters;
|
|
408
|
+
const config = useConfig({ config: parameters.config });
|
|
409
|
+
const configChainId = useChainId({ config });
|
|
410
|
+
const chainId = parameters.chainId ?? configChainId;
|
|
411
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
412
|
+
useEffect(() => {
|
|
413
|
+
if (!enabled)
|
|
414
|
+
return;
|
|
415
|
+
if (!onMint)
|
|
416
|
+
return;
|
|
417
|
+
return Actions.amm.watchMint(config, {
|
|
418
|
+
...rest,
|
|
419
|
+
chainId,
|
|
420
|
+
onMint,
|
|
421
|
+
});
|
|
422
|
+
}, [
|
|
423
|
+
config,
|
|
424
|
+
enabled,
|
|
425
|
+
chainId,
|
|
426
|
+
onMint,
|
|
427
|
+
rest.fromBlock,
|
|
428
|
+
rest.onError,
|
|
429
|
+
rest.poll,
|
|
430
|
+
rest.pollingInterval,
|
|
431
|
+
rest.sender,
|
|
432
|
+
rest.userToken,
|
|
433
|
+
rest.validatorToken,
|
|
434
|
+
]);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Hook for watching liquidity burn events.
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```tsx
|
|
441
|
+
* import { Hooks } from 'wagmi/tempo'
|
|
442
|
+
*
|
|
443
|
+
* function App() {
|
|
444
|
+
* Hooks.amm.useWatchBurn({
|
|
445
|
+
* onBurn(args) {
|
|
446
|
+
* console.log('Liquidity removed:', args)
|
|
447
|
+
* },
|
|
448
|
+
* })
|
|
449
|
+
*
|
|
450
|
+
* return <div>Watching for liquidity removals...</div>
|
|
451
|
+
* }
|
|
452
|
+
* ```
|
|
453
|
+
*
|
|
454
|
+
* @param parameters - Parameters.
|
|
455
|
+
*/
|
|
456
|
+
export function useWatchBurn(parameters = {}) {
|
|
457
|
+
const { enabled = true, onBurn, ...rest } = parameters;
|
|
458
|
+
const config = useConfig({ config: parameters.config });
|
|
459
|
+
const configChainId = useChainId({ config });
|
|
460
|
+
const chainId = parameters.chainId ?? configChainId;
|
|
461
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rest.x is explicitly listed
|
|
462
|
+
useEffect(() => {
|
|
463
|
+
if (!enabled)
|
|
464
|
+
return;
|
|
465
|
+
if (!onBurn)
|
|
466
|
+
return;
|
|
467
|
+
return Actions.amm.watchBurn(config, {
|
|
468
|
+
...rest,
|
|
469
|
+
chainId,
|
|
470
|
+
onBurn,
|
|
471
|
+
});
|
|
472
|
+
}, [
|
|
473
|
+
config,
|
|
474
|
+
enabled,
|
|
475
|
+
chainId,
|
|
476
|
+
onBurn,
|
|
477
|
+
rest.fromBlock,
|
|
478
|
+
rest.onError,
|
|
479
|
+
rest.poll,
|
|
480
|
+
rest.pollingInterval,
|
|
481
|
+
rest.userToken,
|
|
482
|
+
rest.validatorToken,
|
|
483
|
+
]);
|
|
484
|
+
}
|
|
485
|
+
//# sourceMappingURL=amm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amm.js","sourceRoot":"","sources":["../../../../src/tempo/hooks/amm.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,OAAO,EAGL,WAAW,EACX,QAAQ,GACT,MAAM,sBAAsB,CAAA;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,OAAO,CAIrB,aAAqD,EAAE;IAEvD,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,CAAA;IACpC,MAAM,OAAO,GAAG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IACtC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE;QACvD,GAAG,UAAU;QACb,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,OAAO;KAC9B,CAAC,CAAA;IACX,OAAO,QAAQ,CAAC,OAAO,CAAU,CAAA;AACnC,CAAC;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,mBAAmB,CAIjC,aAAiE,EAAE;IAEnE,MAAM,MAAM,GAAG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