tempo.ts 0.7.0 → 0.7.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.
@@ -192,6 +192,119 @@ export namespace getLiquidityBalance {
192
192
  }
193
193
  }
194
194
 
195
+ /**
196
+ * Performs a rebalance swap from validator token to user token.
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * import { createConfig, http } from '@wagmi/core'
201
+ * import { tempo } from 'tempo.ts/chains'
202
+ * import { Actions } from 'tempo.ts/wagmi'
203
+ *
204
+ * const config = createConfig({
205
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
206
+ * transports: {
207
+ * [tempo.id]: http(),
208
+ * },
209
+ * })
210
+ *
211
+ * const hash = await Actions.amm.rebalanceSwap(config, {
212
+ * userToken: '0x...',
213
+ * validatorToken: '0x...',
214
+ * amountOut: 100n,
215
+ * to: '0x...',
216
+ * })
217
+ * ```
218
+ *
219
+ * @param config - Config.
220
+ * @param parameters - Parameters.
221
+ * @returns The transaction hash.
222
+ */
223
+ export async function rebalanceSwap<config extends Config>(
224
+ config: config,
225
+ parameters: rebalanceSwap.Parameters<config>,
226
+ ): Promise<viem_Actions.rebalanceSwap.ReturnValue> {
227
+ const { account, chainId, connector } = parameters
228
+
229
+ const client = await getConnectorClient(config, {
230
+ account,
231
+ assertChainId: false,
232
+ chainId,
233
+ connector,
234
+ })
235
+
236
+ return viem_Actions.rebalanceSwap(client, parameters as never)
237
+ }
238
+
239
+ export declare namespace rebalanceSwap {
240
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
241
+ ConnectorParameter &
242
+ UnionOmit<
243
+ viem_Actions.rebalanceSwap.Parameters<config['chains'][number], Account>,
244
+ 'chain'
245
+ >
246
+
247
+ export type ReturnValue = viem_Actions.rebalanceSwap.ReturnValue
248
+ }
249
+
250
+ /**
251
+ * Performs a rebalance swap from validator token to user token.
252
+ *
253
+ * @example
254
+ * ```ts
255
+ * import { createConfig, http } from '@wagmi/core'
256
+ * import { tempo } from 'tempo.ts/chains'
257
+ * import { Actions } from 'tempo.ts/wagmi'
258
+ *
259
+ * const config = createConfig({
260
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
261
+ * transports: {
262
+ * [tempo.id]: http(),
263
+ * },
264
+ * })
265
+ *
266
+ * const result = await Actions.amm.rebalanceSwapSync(config, {
267
+ * userToken: '0x...',
268
+ * validatorToken: '0x...',
269
+ * amountOut: 100n,
270
+ * to: '0x...',
271
+ * })
272
+ * ```
273
+ *
274
+ * @param config - Config.
275
+ * @param parameters - Parameters.
276
+ * @returns The transaction receipt and event data.
277
+ */
278
+ export async function rebalanceSwapSync<config extends Config>(
279
+ config: config,
280
+ parameters: rebalanceSwapSync.Parameters<config>,
281
+ ): Promise<viem_Actions.rebalanceSwapSync.ReturnValue> {
282
+ const { account, chainId, connector } = parameters
283
+
284
+ const client = await getConnectorClient(config, {
285
+ account,
286
+ assertChainId: false,
287
+ chainId,
288
+ connector,
289
+ })
290
+
291
+ return viem_Actions.rebalanceSwapSync(client, parameters as never)
292
+ }
293
+
294
+ export declare namespace rebalanceSwapSync {
295
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
296
+ ConnectorParameter &
297
+ UnionOmit<
298
+ viem_Actions.rebalanceSwapSync.Parameters<
299
+ config['chains'][number],
300
+ Account
301
+ >,
302
+ 'chain'
303
+ >
304
+
305
+ export type ReturnValue = viem_Actions.rebalanceSwapSync.ReturnValue
306
+ }
307
+
195
308
  /**
196
309
  * Adds liquidity to a pool.
197
310
  *
@@ -312,6 +425,198 @@ export declare namespace mintSync {
312
425
  export type ReturnValue = viem_Actions.mintSync.ReturnValue
313
426
  }
314
427
 
428
+ /**
429
+ * Removes liquidity from a pool.
430
+ *
431
+ * @example
432
+ * ```ts
433
+ * import { createConfig, http } from '@wagmi/core'
434
+ * import { tempo } from 'tempo.ts/chains'
435
+ * import { Actions } from 'tempo.ts/wagmi'
436
+ *
437
+ * const config = createConfig({
438
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
439
+ * transports: {
440
+ * [tempo.id]: http(),
441
+ * },
442
+ * })
443
+ *
444
+ * const hash = await Actions.amm.burn(config, {
445
+ * userToken: '0x20c0...beef',
446
+ * validatorToken: '0x20c0...babe',
447
+ * liquidity: 50n,
448
+ * to: '0xfeed...fede',
449
+ * })
450
+ * ```
451
+ *
452
+ * @param config - Config.
453
+ * @param parameters - Parameters.
454
+ * @returns The transaction hash.
455
+ */
456
+ export async function burn<config extends Config>(
457
+ config: config,
458
+ parameters: burn.Parameters<config>,
459
+ ): Promise<viem_Actions.burn.ReturnValue> {
460
+ const { account, chainId, connector } = parameters
461
+
462
+ const client = await getConnectorClient(config, {
463
+ account,
464
+ assertChainId: false,
465
+ chainId,
466
+ connector,
467
+ })
468
+
469
+ return viem_Actions.burn(client, parameters as never)
470
+ }
471
+
472
+ export declare namespace burn {
473
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
474
+ ConnectorParameter &
475
+ UnionOmit<
476
+ viem_Actions.burn.Parameters<config['chains'][number], Account>,
477
+ 'chain'
478
+ >
479
+
480
+ export type ReturnValue = viem_Actions.burn.ReturnValue
481
+ }
482
+
483
+ /**
484
+ * Removes liquidity from a pool.
485
+ *
486
+ * @example
487
+ * ```ts
488
+ * import { createConfig, http } from '@wagmi/core'
489
+ * import { tempo } from 'tempo.ts/chains'
490
+ * import { Actions } from 'tempo.ts/wagmi'
491
+ *
492
+ * const config = createConfig({
493
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
494
+ * transports: {
495
+ * [tempo.id]: http(),
496
+ * },
497
+ * })
498
+ *
499
+ * const result = await Actions.amm.burnSync(config, {
500
+ * userToken: '0x20c0...beef',
501
+ * validatorToken: '0x20c0...babe',
502
+ * liquidity: 50n,
503
+ * to: '0xfeed...fede',
504
+ * })
505
+ * ```
506
+ *
507
+ * @param config - Config.
508
+ * @param parameters - Parameters.
509
+ * @returns The transaction receipt and event data.
510
+ */
511
+ export async function burnSync<config extends Config>(
512
+ config: config,
513
+ parameters: burnSync.Parameters<config>,
514
+ ): Promise<viem_Actions.burnSync.ReturnValue> {
515
+ const { account, chainId, connector } = parameters
516
+
517
+ const client = await getConnectorClient(config, {
518
+ account,
519
+ assertChainId: false,
520
+ chainId,
521
+ connector,
522
+ })
523
+
524
+ return viem_Actions.burnSync(client, parameters as never)
525
+ }
526
+
527
+ export declare namespace burnSync {
528
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
529
+ ConnectorParameter &
530
+ UnionOmit<
531
+ viem_Actions.burnSync.Parameters<config['chains'][number], Account>,
532
+ 'chain'
533
+ >
534
+
535
+ export type ReturnValue = viem_Actions.burnSync.ReturnValue
536
+ }
537
+
538
+ /**
539
+ * Watches for rebalance swap events.
540
+ *
541
+ * @example
542
+ * ```ts
543
+ * import { createConfig, http } from '@wagmi/core'
544
+ * import { tempo } from 'tempo.ts/chains'
545
+ * import { Actions } from 'tempo.ts/wagmi'
546
+ *
547
+ * const config = createConfig({
548
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
549
+ * transports: {
550
+ * [tempo.id]: http(),
551
+ * },
552
+ * })
553
+ *
554
+ * const unwatch = Actions.amm.watchRebalanceSwap(config, {
555
+ * onRebalanceSwap: (args, log) => {
556
+ * console.log('Rebalance swap:', args)
557
+ * },
558
+ * })
559
+ * ```
560
+ *
561
+ * @param config - Config.
562
+ * @param parameters - Parameters.
563
+ * @returns A function to unsubscribe from the event.
564
+ */
565
+ export function watchRebalanceSwap<config extends Config>(
566
+ config: config,
567
+ parameters: watchRebalanceSwap.Parameters<config>,
568
+ ) {
569
+ const { chainId, ...rest } = parameters
570
+ const client = config.getClient({ chainId })
571
+ return viem_Actions.watchRebalanceSwap(client, rest)
572
+ }
573
+
574
+ export declare namespace watchRebalanceSwap {
575
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
576
+ viem_Actions.watchRebalanceSwap.Parameters
577
+ }
578
+
579
+ /**
580
+ * Watches for fee swap events.
581
+ *
582
+ * @example
583
+ * ```ts
584
+ * import { createConfig, http } from '@wagmi/core'
585
+ * import { tempo } from 'tempo.ts/chains'
586
+ * import { Actions } from 'tempo.ts/wagmi'
587
+ *
588
+ * const config = createConfig({
589
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
590
+ * transports: {
591
+ * [tempo.id]: http(),
592
+ * },
593
+ * })
594
+ *
595
+ * const unwatch = Actions.amm.watchFeeSwap(config, {
596
+ * onFeeSwap: (args, log) => {
597
+ * console.log('Fee swap:', args)
598
+ * },
599
+ * })
600
+ * ```
601
+ *
602
+ * @param config - Config.
603
+ * @param parameters - Parameters.
604
+ * @returns A function to unsubscribe from the event.
605
+ */
606
+ export function watchFeeSwap<config extends Config>(
607
+ config: config,
608
+ parameters: watchFeeSwap.Parameters<config>,
609
+ ) {
610
+ const { chainId, ...rest } = parameters
611
+ const client = config.getClient({ chainId })
612
+ return viem_Actions.watchFeeSwap(client, rest)
613
+ }
614
+
615
+ export declare namespace watchFeeSwap {
616
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
617
+ viem_Actions.watchFeeSwap.Parameters
618
+ }
619
+
315
620
  /**
316
621
  * Watches for liquidity mint events.
317
622
  *
@@ -352,3 +657,44 @@ export declare namespace watchMint {
352
657
  export type Parameters<config extends Config> = ChainIdParameter<config> &
353
658
  viem_Actions.watchMint.Parameters
354
659
  }
660
+
661
+ /**
662
+ * Watches for liquidity burn events.
663
+ *
664
+ * @example
665
+ * ```ts
666
+ * import { createConfig, http } from '@wagmi/core'
667
+ * import { tempo } from 'tempo.ts/chains'
668
+ * import { Actions } from 'tempo.ts/wagmi'
669
+ *
670
+ * const config = createConfig({
671
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
672
+ * transports: {
673
+ * [tempo.id]: http(),
674
+ * },
675
+ * })
676
+ *
677
+ * const unwatch = Actions.amm.watchBurn(config, {
678
+ * onBurn: (args, log) => {
679
+ * console.log('Liquidity removed:', args)
680
+ * },
681
+ * })
682
+ * ```
683
+ *
684
+ * @param config - Config.
685
+ * @param parameters - Parameters.
686
+ * @returns A function to unsubscribe from the event.
687
+ */
688
+ export function watchBurn<config extends Config>(
689
+ config: config,
690
+ parameters: watchBurn.Parameters<config>,
691
+ ) {
692
+ const { chainId, ...rest } = parameters
693
+ const client = config.getClient({ chainId })
694
+ return viem_Actions.watchBurn(client, rest)
695
+ }
696
+
697
+ export declare namespace watchBurn {
698
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
699
+ viem_Actions.watchBurn.Parameters
700
+ }