tempo.ts 0.11.0 → 0.12.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.
Files changed (196) hide show
  1. package/CHANGELOG.md +67 -4
  2. package/README.md +3 -34
  3. package/dist/server/Handler.d.ts +14 -14
  4. package/dist/server/Handler.d.ts.map +1 -1
  5. package/dist/server/Handler.js +16 -17
  6. package/dist/server/Handler.js.map +1 -1
  7. package/dist/wagmi/Actions/amm.d.ts +51 -51
  8. package/dist/wagmi/Actions/amm.d.ts.map +1 -1
  9. package/dist/wagmi/Actions/amm.js +37 -37
  10. package/dist/wagmi/Actions/amm.js.map +1 -1
  11. package/dist/wagmi/Actions/dex.d.ts +129 -129
  12. package/dist/wagmi/Actions/dex.d.ts.map +1 -1
  13. package/dist/wagmi/Actions/dex.js +73 -73
  14. package/dist/wagmi/Actions/dex.js.map +1 -1
  15. package/dist/wagmi/Actions/faucet.d.ts +9 -9
  16. package/dist/wagmi/Actions/faucet.d.ts.map +1 -1
  17. package/dist/wagmi/Actions/faucet.js +7 -7
  18. package/dist/wagmi/Actions/faucet.js.map +1 -1
  19. package/dist/wagmi/Actions/fee.d.ts +17 -17
  20. package/dist/wagmi/Actions/fee.d.ts.map +1 -1
  21. package/dist/wagmi/Actions/fee.js +10 -10
  22. package/dist/wagmi/Actions/fee.js.map +1 -1
  23. package/dist/wagmi/Actions/nonce.d.ts +9 -79
  24. package/dist/wagmi/Actions/nonce.d.ts.map +1 -1
  25. package/dist/wagmi/Actions/nonce.js +7 -89
  26. package/dist/wagmi/Actions/nonce.js.map +1 -1
  27. package/dist/wagmi/Actions/policy.d.ts +69 -70
  28. package/dist/wagmi/Actions/policy.d.ts.map +1 -1
  29. package/dist/wagmi/Actions/policy.js +43 -43
  30. package/dist/wagmi/Actions/policy.js.map +1 -1
  31. package/dist/wagmi/Actions/reward.d.ts +51 -51
  32. package/dist/wagmi/Actions/reward.d.ts.map +1 -1
  33. package/dist/wagmi/Actions/reward.js +31 -31
  34. package/dist/wagmi/Actions/reward.js.map +1 -1
  35. package/dist/wagmi/Actions/token.d.ts +238 -238
  36. package/dist/wagmi/Actions/token.d.ts.map +1 -1
  37. package/dist/wagmi/Actions/token.js +136 -136
  38. package/dist/wagmi/Actions/token.js.map +1 -1
  39. package/dist/wagmi/Connector.d.ts +2 -1
  40. package/dist/wagmi/Connector.d.ts.map +1 -1
  41. package/dist/wagmi/Connector.js +83 -22
  42. package/dist/wagmi/Connector.js.map +1 -1
  43. package/dist/wagmi/Hooks/nonce.d.ts +1 -52
  44. package/dist/wagmi/Hooks/nonce.d.ts.map +1 -1
  45. package/dist/wagmi/Hooks/nonce.js +1 -70
  46. package/dist/wagmi/Hooks/nonce.js.map +1 -1
  47. package/dist/wagmi/Hooks/policy.d.ts +0 -1
  48. package/dist/wagmi/Hooks/policy.d.ts.map +1 -1
  49. package/dist/wagmi/Hooks/policy.js.map +1 -1
  50. package/dist/wagmi/KeyManager.d.ts +6 -3
  51. package/dist/wagmi/KeyManager.d.ts.map +1 -1
  52. package/dist/wagmi/KeyManager.js +9 -4
  53. package/dist/wagmi/KeyManager.js.map +1 -1
  54. package/package.json +2 -2
  55. package/src/server/Handler.test.ts +2 -2
  56. package/src/server/Handler.ts +16 -17
  57. package/src/wagmi/Actions/amm.ts +63 -63
  58. package/src/wagmi/Actions/dex.test.ts +1 -1
  59. package/src/wagmi/Actions/dex.ts +153 -153
  60. package/src/wagmi/Actions/faucet.ts +11 -11
  61. package/src/wagmi/Actions/fee.ts +20 -20
  62. package/src/wagmi/Actions/nonce.test.ts +1 -64
  63. package/src/wagmi/Actions/nonce.ts +10 -142
  64. package/src/wagmi/Actions/policy.ts +83 -85
  65. package/src/wagmi/Actions/reward.ts +64 -61
  66. package/src/wagmi/Actions/token.ts +287 -283
  67. package/src/wagmi/Connector.ts +105 -31
  68. package/src/wagmi/Hooks/dex.test.ts +1 -1
  69. package/src/wagmi/Hooks/fee.test.ts +0 -6
  70. package/src/wagmi/Hooks/nonce.test.ts +1 -66
  71. package/src/wagmi/Hooks/nonce.ts +1 -114
  72. package/src/wagmi/Hooks/policy.ts +0 -2
  73. package/src/wagmi/KeyManager.ts +18 -5
  74. package/dist/viem/Abis.d.ts +0 -2649
  75. package/dist/viem/Abis.d.ts.map +0 -1
  76. package/dist/viem/Abis.js +0 -1677
  77. package/dist/viem/Abis.js.map +0 -1
  78. package/dist/viem/Account.d.ts +0 -244
  79. package/dist/viem/Account.d.ts.map +0 -1
  80. package/dist/viem/Account.js +0 -382
  81. package/dist/viem/Account.js.map +0 -1
  82. package/dist/viem/Actions/amm.d.ts +0 -1991
  83. package/dist/viem/Actions/amm.d.ts.map +0 -1
  84. package/dist/viem/Actions/amm.js +0 -814
  85. package/dist/viem/Actions/amm.js.map +0 -1
  86. package/dist/viem/Actions/dex.d.ts +0 -3900
  87. package/dist/viem/Actions/dex.d.ts.map +0 -1
  88. package/dist/viem/Actions/dex.js +0 -1414
  89. package/dist/viem/Actions/dex.js.map +0 -1
  90. package/dist/viem/Actions/faucet.d.ts +0 -69
  91. package/dist/viem/Actions/faucet.d.ts.map +0 -1
  92. package/dist/viem/Actions/faucet.js +0 -73
  93. package/dist/viem/Actions/faucet.js.map +0 -1
  94. package/dist/viem/Actions/fee.d.ts +0 -360
  95. package/dist/viem/Actions/fee.d.ts.map +0 -1
  96. package/dist/viem/Actions/fee.js +0 -237
  97. package/dist/viem/Actions/fee.js.map +0 -1
  98. package/dist/viem/Actions/nonce.d.ts +0 -257
  99. package/dist/viem/Actions/nonce.d.ts.map +0 -1
  100. package/dist/viem/Actions/nonce.js +0 -228
  101. package/dist/viem/Actions/nonce.js.map +0 -1
  102. package/dist/viem/Actions/policy.d.ts +0 -1680
  103. package/dist/viem/Actions/policy.d.ts.map +0 -1
  104. package/dist/viem/Actions/policy.js +0 -875
  105. package/dist/viem/Actions/policy.js.map +0 -1
  106. package/dist/viem/Actions/reward.d.ts +0 -2422
  107. package/dist/viem/Actions/reward.d.ts.map +0 -1
  108. package/dist/viem/Actions/reward.js +0 -651
  109. package/dist/viem/Actions/reward.js.map +0 -1
  110. package/dist/viem/Actions/token.d.ts +0 -16007
  111. package/dist/viem/Actions/token.d.ts.map +0 -1
  112. package/dist/viem/Actions/token.js +0 -2936
  113. package/dist/viem/Actions/token.js.map +0 -1
  114. package/dist/viem/Addresses.d.ts +0 -9
  115. package/dist/viem/Addresses.d.ts.map +0 -1
  116. package/dist/viem/Addresses.js +0 -9
  117. package/dist/viem/Addresses.js.map +0 -1
  118. package/dist/viem/Chain.d.ts +0 -451
  119. package/dist/viem/Chain.d.ts.map +0 -1
  120. package/dist/viem/Chain.js +0 -96
  121. package/dist/viem/Chain.js.map +0 -1
  122. package/dist/viem/Formatters.d.ts +0 -10
  123. package/dist/viem/Formatters.d.ts.map +0 -1
  124. package/dist/viem/Formatters.js +0 -104
  125. package/dist/viem/Formatters.js.map +0 -1
  126. package/dist/viem/Storage.d.ts +0 -24
  127. package/dist/viem/Storage.d.ts.map +0 -1
  128. package/dist/viem/Storage.js +0 -68
  129. package/dist/viem/Storage.js.map +0 -1
  130. package/dist/viem/Transaction.d.ts +0 -76
  131. package/dist/viem/Transaction.d.ts.map +0 -1
  132. package/dist/viem/Transaction.js +0 -176
  133. package/dist/viem/Transaction.js.map +0 -1
  134. package/dist/viem/Transport.d.ts +0 -33
  135. package/dist/viem/Transport.d.ts.map +0 -1
  136. package/dist/viem/Transport.js +0 -138
  137. package/dist/viem/Transport.js.map +0 -1
  138. package/dist/viem/WebAuthnP256.d.ts +0 -82
  139. package/dist/viem/WebAuthnP256.d.ts.map +0 -1
  140. package/dist/viem/WebAuthnP256.js +0 -97
  141. package/dist/viem/WebAuthnP256.js.map +0 -1
  142. package/dist/viem/WebCryptoP256.d.ts +0 -2
  143. package/dist/viem/WebCryptoP256.d.ts.map +0 -1
  144. package/dist/viem/WebCryptoP256.js +0 -2
  145. package/dist/viem/WebCryptoP256.js.map +0 -1
  146. package/dist/viem/internal/types.d.ts +0 -20
  147. package/dist/viem/internal/types.d.ts.map +0 -1
  148. package/dist/viem/internal/types.js +0 -2
  149. package/dist/viem/internal/types.js.map +0 -1
  150. package/dist/viem/internal/utils.d.ts +0 -14
  151. package/dist/viem/internal/utils.d.ts.map +0 -1
  152. package/dist/viem/internal/utils.js +0 -33
  153. package/dist/viem/internal/utils.js.map +0 -1
  154. package/src/chains.ts +0 -54
  155. package/src/viem/Abis.ts +0 -1688
  156. package/src/viem/Account.test.ts +0 -444
  157. package/src/viem/Account.ts +0 -601
  158. package/src/viem/Actions/account.test.ts +0 -414
  159. package/src/viem/Actions/account.ts +0 -106
  160. package/src/viem/Actions/amm.test.ts +0 -381
  161. package/src/viem/Actions/amm.ts +0 -1227
  162. package/src/viem/Actions/dex.test.ts +0 -1549
  163. package/src/viem/Actions/dex.ts +0 -2150
  164. package/src/viem/Actions/faucet.ts +0 -121
  165. package/src/viem/Actions/fee.test.ts +0 -259
  166. package/src/viem/Actions/fee.ts +0 -372
  167. package/src/viem/Actions/index.ts +0 -9
  168. package/src/viem/Actions/nonce.test.ts +0 -206
  169. package/src/viem/Actions/nonce.ts +0 -347
  170. package/src/viem/Actions/policy.test.ts +0 -534
  171. package/src/viem/Actions/policy.ts +0 -1335
  172. package/src/viem/Actions/reward.test.ts +0 -434
  173. package/src/viem/Actions/reward.ts +0 -944
  174. package/src/viem/Actions/token.test.ts +0 -3029
  175. package/src/viem/Actions/token.ts +0 -4458
  176. package/src/viem/Addresses.ts +0 -9
  177. package/src/viem/Chain.bench-d.ts +0 -12
  178. package/src/viem/Chain.test.ts +0 -168
  179. package/src/viem/Chain.ts +0 -157
  180. package/src/viem/Decorator.bench-d.ts +0 -11
  181. package/src/viem/Decorator.test.ts +0 -39
  182. package/src/viem/Decorator.ts +0 -3179
  183. package/src/viem/Formatters.ts +0 -164
  184. package/src/viem/P256.ts +0 -1
  185. package/src/viem/Secp256k1.ts +0 -1
  186. package/src/viem/Storage.ts +0 -110
  187. package/src/viem/TokenIds.ts +0 -1
  188. package/src/viem/Transaction.ts +0 -382
  189. package/src/viem/Transport.ts +0 -191
  190. package/src/viem/WebAuthnP256.ts +0 -146
  191. package/src/viem/WebCryptoP256.ts +0 -1
  192. package/src/viem/e2e.test.ts +0 -1602
  193. package/src/viem/index.ts +0 -30
  194. package/src/viem/internal/types.ts +0 -69
  195. package/src/viem/internal/utils.ts +0 -58
  196. package/src/wagmi/internal/types.ts +0 -16
@@ -1,1991 +0,0 @@
1
- import { TokenId } from 'ox/tempo';
2
- import { type Account, type Address, type Chain, type Client, type ExtractAbiItem, type GetEventArgs, type Hex, type Log, type MulticallParameters, type ReadContractReturnType, type TransactionReceipt, type Transport, type Log as viem_Log, type WatchContractEventParameters, type WriteContractReturnType } from 'viem';
3
- import { writeContract, writeContractSync } from 'viem/actions';
4
- import type { Compute, OneOf, UnionOmit } from '../../internal/types.js';
5
- import * as Abis from '../Abis.js';
6
- import type { ReadParameters, WriteParameters } from '../internal/types.js';
7
- /**
8
- * Gets the reserves for a liquidity pool.
9
- *
10
- * @example
11
- * ```ts
12
- * import { createClient, http } from 'viem'
13
- * import { tempo } from 'tempo.ts/chains'
14
- * import { Actions } from 'tempo.ts/viem'
15
- *
16
- * const client = createClient({
17
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
18
- * transport: http(),
19
- * })
20
- *
21
- * const pool = await Actions.amm.getPool(client, {
22
- * userToken: '0x...',
23
- * validatorToken: '0x...',
24
- * })
25
- * ```
26
- *
27
- * @param client - Client.
28
- * @param parameters - Parameters.
29
- * @returns The pool reserves.
30
- */
31
- export declare function getPool<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getPool.Parameters): Promise<getPool.ReturnValue>;
32
- export declare namespace getPool {
33
- type Parameters = UnionOmit<MulticallParameters, 'allowFailure' | 'contracts' | 'deployless'> & Args;
34
- type Args = {
35
- /** Address or ID of the user token. */
36
- userToken: TokenId.TokenIdOrAddress;
37
- /** Address or ID of the validator token. */
38
- validatorToken: TokenId.TokenIdOrAddress;
39
- };
40
- type ReturnValue = Compute<{
41
- /** Reserve of user token. */
42
- reserveUserToken: bigint;
43
- /** Reserve of validator token. */
44
- reserveValidatorToken: bigint;
45
- /** Total supply of LP tokens. */
46
- totalSupply: bigint;
47
- }>;
48
- /**
49
- * Defines calls to the `getPool` and `totalSupply` functions.
50
- *
51
- * @param args - Arguments.
52
- * @returns The calls.
53
- */
54
- function calls(args: Args): readonly [{
55
- abi: [{
56
- readonly name: "getPool";
57
- readonly type: "function";
58
- readonly stateMutability: "view";
59
- readonly inputs: readonly [{
60
- readonly type: "address";
61
- readonly name: "userToken";
62
- }, {
63
- readonly type: "address";
64
- readonly name: "validatorToken";
65
- }];
66
- readonly outputs: readonly [{
67
- readonly type: "tuple";
68
- readonly components: readonly [{
69
- readonly type: "uint128";
70
- readonly name: "reserveUserToken";
71
- }, {
72
- readonly type: "uint128";
73
- readonly name: "reserveValidatorToken";
74
- }];
75
- }];
76
- }];
77
- functionName: "getPool";
78
- args?: readonly [`0x${string}`, `0x${string}`] | undefined;
79
- } & {
80
- args: readonly [`0x${string}`, `0x${string}`];
81
- } & {
82
- address: Address;
83
- } & {
84
- data: Hex;
85
- to: Address;
86
- }, {
87
- abi: [{
88
- readonly name: "totalSupply";
89
- readonly type: "function";
90
- readonly stateMutability: "view";
91
- readonly inputs: readonly [{
92
- readonly type: "bytes32";
93
- readonly name: "poolId";
94
- }];
95
- readonly outputs: readonly [{
96
- readonly type: "uint256";
97
- }];
98
- }];
99
- functionName: "totalSupply";
100
- args?: readonly [`0x${string}`] | undefined;
101
- } & {
102
- args: readonly [`0x${string}`];
103
- } & {
104
- address: Address;
105
- } & {
106
- data: Hex;
107
- to: Address;
108
- }];
109
- }
110
- /**
111
- * Gets the LP token balance for an account in a specific pool.
112
- *
113
- * @example
114
- * ```ts
115
- * import { createClient, http } from 'viem'
116
- * import { tempo } from 'tempo.ts/chains'
117
- * import { Actions } from 'tempo.ts/viem'
118
- *
119
- * const client = createClient({
120
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
121
- * transport: http(),
122
- * })
123
- *
124
- * const poolId = await Actions.amm.getPoolId(client, {
125
- * userToken: '0x...',
126
- * validatorToken: '0x...',
127
- * })
128
- *
129
- * const balance = await Actions.amm.getLiquidityBalance(client, {
130
- * poolId,
131
- * address: '0x...',
132
- * })
133
- * ```
134
- *
135
- * @param client - Client.
136
- * @param parameters - Parameters.
137
- * @returns The LP token balance.
138
- */
139
- export declare function getLiquidityBalance<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getLiquidityBalance.Parameters): Promise<getLiquidityBalance.ReturnValue>;
140
- export declare namespace getLiquidityBalance {
141
- type Parameters = ReadParameters & Args;
142
- type Args = {
143
- /** Address to check balance for. */
144
- address: Address;
145
- } & OneOf<{
146
- /** Pool ID. */
147
- poolId: Hex;
148
- } | {
149
- /** User token. */
150
- userToken: TokenId.TokenIdOrAddress;
151
- /** Validator token. */
152
- validatorToken: TokenId.TokenIdOrAddress;
153
- }>;
154
- type ReturnValue = ReadContractReturnType<typeof Abis.feeAmm, 'liquidityBalances', never>;
155
- /**
156
- * Defines a call to the `liquidityBalances` function.
157
- *
158
- * @param args - Arguments.
159
- * @returns The call.
160
- */
161
- function call(args: Args): {
162
- abi: [{
163
- readonly name: "liquidityBalances";
164
- readonly type: "function";
165
- readonly stateMutability: "view";
166
- readonly inputs: readonly [{
167
- readonly type: "bytes32";
168
- readonly name: "poolId";
169
- }, {
170
- readonly type: "address";
171
- readonly name: "user";
172
- }];
173
- readonly outputs: readonly [{
174
- readonly type: "uint256";
175
- }];
176
- }];
177
- functionName: "liquidityBalances";
178
- args?: readonly [`0x${string}`, `0x${string}`] | undefined;
179
- } & {
180
- args: readonly [`0x${string}`, `0x${string}`];
181
- } & {
182
- address: Address;
183
- } & {
184
- data: Hex;
185
- to: Address;
186
- };
187
- }
188
- /**
189
- * Performs a rebalance swap from validator token to user token.
190
- *
191
- * @example
192
- * ```ts
193
- * import { createClient, http } from 'viem'
194
- * import { tempo } from 'tempo.ts/chains'
195
- * import { Actions } from 'tempo.ts/viem'
196
- * import { privateKeyToAccount } from 'viem/accounts'
197
- *
198
- * const client = createClient({
199
- * account: privateKeyToAccount('0x...'),
200
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
201
- * transport: http(),
202
- * })
203
- *
204
- * const hash = await Actions.amm.rebalanceSwap(client, {
205
- * userToken: '0x...',
206
- * validatorToken: '0x...',
207
- * amountOut: 100n,
208
- * to: '0x...',
209
- * })
210
- * ```
211
- *
212
- * @param client - Client.
213
- * @param parameters - Parameters.
214
- * @returns The transaction hash.
215
- */
216
- export declare function rebalanceSwap<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: rebalanceSwap.Parameters<chain, account>): Promise<rebalanceSwap.ReturnValue>;
217
- export declare namespace rebalanceSwap {
218
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
219
- type Args = {
220
- /** Amount of user token to receive. */
221
- amountOut: bigint;
222
- /** Address to send the user token to. */
223
- to: Address;
224
- /** Address or ID of the user token. */
225
- userToken: TokenId.TokenIdOrAddress;
226
- /** Address or ID of the validator token. */
227
- validatorToken: TokenId.TokenIdOrAddress;
228
- };
229
- type ReturnValue = WriteContractReturnType;
230
- /** @internal */
231
- function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: rebalanceSwap.Parameters<chain, account>): Promise<ReturnType<action>>;
232
- /**
233
- * Defines a call to the `rebalanceSwap` function.
234
- *
235
- * Can be passed as a parameter to:
236
- * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
237
- * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
238
- * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
239
- *
240
- * @example
241
- * ```ts
242
- * import { createClient, http, walletActions } from 'viem'
243
- * import { tempo } from 'tempo.ts/chains'
244
- * import { Actions } from 'tempo.ts/viem'
245
- *
246
- * const client = createClient({
247
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
248
- * transport: http(),
249
- * }).extend(walletActions)
250
- *
251
- * const { result } = await client.sendCalls({
252
- * calls: [
253
- * actions.amm.rebalanceSwap.call({
254
- * userToken: '0x20c0...beef',
255
- * validatorToken: '0x20c0...babe',
256
- * amountOut: 100n,
257
- * to: '0xfeed...fede',
258
- * }),
259
- * actions.amm.rebalanceSwap.call({
260
- * userToken: '0x20c0...babe',
261
- * validatorToken: '0x20c0...babe',
262
- * amountOut: 100n,
263
- * to: '0xfeed...fede',
264
- * }),
265
- * ]
266
- * })
267
- * ```
268
- *
269
- * @param args - Arguments.
270
- * @returns The call.
271
- */
272
- function call(args: Args): {
273
- abi: [{
274
- readonly name: "rebalanceSwap";
275
- readonly type: "function";
276
- readonly stateMutability: "nonpayable";
277
- readonly inputs: readonly [{
278
- readonly type: "address";
279
- readonly name: "userToken";
280
- }, {
281
- readonly type: "address";
282
- readonly name: "validatorToken";
283
- }, {
284
- readonly type: "uint256";
285
- readonly name: "amountOut";
286
- }, {
287
- readonly type: "address";
288
- readonly name: "to";
289
- }];
290
- readonly outputs: readonly [{
291
- readonly type: "uint256";
292
- readonly name: "amountIn";
293
- }];
294
- }];
295
- functionName: "rebalanceSwap";
296
- args?: readonly [`0x${string}`, `0x${string}`, bigint, `0x${string}`] | undefined;
297
- } & {
298
- args: readonly [`0x${string}`, `0x${string}`, bigint, `0x${string}`];
299
- } & {
300
- address: Address;
301
- } & {
302
- data: Hex;
303
- to: Address;
304
- };
305
- /**
306
- * Extracts the `RebalanceSwap` event from logs.
307
- *
308
- * @param logs - The logs.
309
- * @returns The `RebalanceSwap` event.
310
- */
311
- function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
312
- readonly name: "M";
313
- readonly type: "function";
314
- readonly stateMutability: "view";
315
- readonly inputs: readonly [];
316
- readonly outputs: readonly [{
317
- readonly type: "uint256";
318
- }];
319
- }, {
320
- readonly name: "N";
321
- readonly type: "function";
322
- readonly stateMutability: "view";
323
- readonly inputs: readonly [];
324
- readonly outputs: readonly [{
325
- readonly type: "uint256";
326
- }];
327
- }, {
328
- readonly name: "SCALE";
329
- readonly type: "function";
330
- readonly stateMutability: "view";
331
- readonly inputs: readonly [];
332
- readonly outputs: readonly [{
333
- readonly type: "uint256";
334
- }];
335
- }, {
336
- readonly name: "MIN_LIQUIDITY";
337
- readonly type: "function";
338
- readonly stateMutability: "view";
339
- readonly inputs: readonly [];
340
- readonly outputs: readonly [{
341
- readonly type: "uint256";
342
- }];
343
- }, {
344
- readonly name: "getPoolId";
345
- readonly type: "function";
346
- readonly stateMutability: "pure";
347
- readonly inputs: readonly [{
348
- readonly type: "address";
349
- readonly name: "userToken";
350
- }, {
351
- readonly type: "address";
352
- readonly name: "validatorToken";
353
- }];
354
- readonly outputs: readonly [{
355
- readonly type: "bytes32";
356
- }];
357
- }, {
358
- readonly name: "getPool";
359
- readonly type: "function";
360
- readonly stateMutability: "view";
361
- readonly inputs: readonly [{
362
- readonly type: "address";
363
- readonly name: "userToken";
364
- }, {
365
- readonly type: "address";
366
- readonly name: "validatorToken";
367
- }];
368
- readonly outputs: readonly [{
369
- readonly type: "tuple";
370
- readonly components: readonly [{
371
- readonly type: "uint128";
372
- readonly name: "reserveUserToken";
373
- }, {
374
- readonly type: "uint128";
375
- readonly name: "reserveValidatorToken";
376
- }];
377
- }];
378
- }, {
379
- readonly name: "pools";
380
- readonly type: "function";
381
- readonly stateMutability: "view";
382
- readonly inputs: readonly [{
383
- readonly type: "bytes32";
384
- readonly name: "poolId";
385
- }];
386
- readonly outputs: readonly [{
387
- readonly type: "tuple";
388
- readonly components: readonly [{
389
- readonly type: "uint128";
390
- readonly name: "reserveUserToken";
391
- }, {
392
- readonly type: "uint128";
393
- readonly name: "reserveValidatorToken";
394
- }];
395
- }];
396
- }, {
397
- readonly name: "mint";
398
- readonly type: "function";
399
- readonly stateMutability: "nonpayable";
400
- readonly inputs: readonly [{
401
- readonly type: "address";
402
- readonly name: "userToken";
403
- }, {
404
- readonly type: "address";
405
- readonly name: "validatorToken";
406
- }, {
407
- readonly type: "uint256";
408
- readonly name: "amountUserToken";
409
- }, {
410
- readonly type: "uint256";
411
- readonly name: "amountValidatorToken";
412
- }, {
413
- readonly type: "address";
414
- readonly name: "to";
415
- }];
416
- readonly outputs: readonly [{
417
- readonly type: "uint256";
418
- readonly name: "liquidity";
419
- }];
420
- }, {
421
- readonly name: "mintWithValidatorToken";
422
- readonly type: "function";
423
- readonly stateMutability: "nonpayable";
424
- readonly inputs: readonly [{
425
- readonly type: "address";
426
- readonly name: "userToken";
427
- }, {
428
- readonly type: "address";
429
- readonly name: "validatorToken";
430
- }, {
431
- readonly type: "uint256";
432
- readonly name: "amountValidatorToken";
433
- }, {
434
- readonly type: "address";
435
- readonly name: "to";
436
- }];
437
- readonly outputs: readonly [{
438
- readonly type: "uint256";
439
- readonly name: "liquidity";
440
- }];
441
- }, {
442
- readonly name: "burn";
443
- readonly type: "function";
444
- readonly stateMutability: "nonpayable";
445
- readonly inputs: readonly [{
446
- readonly type: "address";
447
- readonly name: "userToken";
448
- }, {
449
- readonly type: "address";
450
- readonly name: "validatorToken";
451
- }, {
452
- readonly type: "uint256";
453
- readonly name: "liquidity";
454
- }, {
455
- readonly type: "address";
456
- readonly name: "to";
457
- }];
458
- readonly outputs: readonly [{
459
- readonly type: "uint256";
460
- readonly name: "amountUserToken";
461
- }, {
462
- readonly type: "uint256";
463
- readonly name: "amountValidatorToken";
464
- }];
465
- }, {
466
- readonly name: "totalSupply";
467
- readonly type: "function";
468
- readonly stateMutability: "view";
469
- readonly inputs: readonly [{
470
- readonly type: "bytes32";
471
- readonly name: "poolId";
472
- }];
473
- readonly outputs: readonly [{
474
- readonly type: "uint256";
475
- }];
476
- }, {
477
- readonly name: "liquidityBalances";
478
- readonly type: "function";
479
- readonly stateMutability: "view";
480
- readonly inputs: readonly [{
481
- readonly type: "bytes32";
482
- readonly name: "poolId";
483
- }, {
484
- readonly type: "address";
485
- readonly name: "user";
486
- }];
487
- readonly outputs: readonly [{
488
- readonly type: "uint256";
489
- }];
490
- }, {
491
- readonly name: "rebalanceSwap";
492
- readonly type: "function";
493
- readonly stateMutability: "nonpayable";
494
- readonly inputs: readonly [{
495
- readonly type: "address";
496
- readonly name: "userToken";
497
- }, {
498
- readonly type: "address";
499
- readonly name: "validatorToken";
500
- }, {
501
- readonly type: "uint256";
502
- readonly name: "amountOut";
503
- }, {
504
- readonly type: "address";
505
- readonly name: "to";
506
- }];
507
- readonly outputs: readonly [{
508
- readonly type: "uint256";
509
- readonly name: "amountIn";
510
- }];
511
- }, {
512
- readonly name: "Mint";
513
- readonly type: "event";
514
- readonly inputs: readonly [{
515
- readonly type: "address";
516
- readonly name: "sender";
517
- readonly indexed: true;
518
- }, {
519
- readonly type: "address";
520
- readonly name: "userToken";
521
- readonly indexed: true;
522
- }, {
523
- readonly type: "address";
524
- readonly name: "validatorToken";
525
- readonly indexed: true;
526
- }, {
527
- readonly type: "uint256";
528
- readonly name: "amountUserToken";
529
- }, {
530
- readonly type: "uint256";
531
- readonly name: "amountValidatorToken";
532
- }, {
533
- readonly type: "uint256";
534
- readonly name: "liquidity";
535
- }];
536
- }, {
537
- readonly name: "Burn";
538
- readonly type: "event";
539
- readonly inputs: readonly [{
540
- readonly type: "address";
541
- readonly name: "sender";
542
- readonly indexed: true;
543
- }, {
544
- readonly type: "address";
545
- readonly name: "userToken";
546
- readonly indexed: true;
547
- }, {
548
- readonly type: "address";
549
- readonly name: "validatorToken";
550
- readonly indexed: true;
551
- }, {
552
- readonly type: "uint256";
553
- readonly name: "amountUserToken";
554
- }, {
555
- readonly type: "uint256";
556
- readonly name: "amountValidatorToken";
557
- }, {
558
- readonly type: "uint256";
559
- readonly name: "liquidity";
560
- }, {
561
- readonly type: "address";
562
- readonly name: "to";
563
- }];
564
- }, {
565
- readonly name: "RebalanceSwap";
566
- readonly type: "event";
567
- readonly inputs: readonly [{
568
- readonly type: "address";
569
- readonly name: "userToken";
570
- readonly indexed: true;
571
- }, {
572
- readonly type: "address";
573
- readonly name: "validatorToken";
574
- readonly indexed: true;
575
- }, {
576
- readonly type: "address";
577
- readonly name: "swapper";
578
- readonly indexed: true;
579
- }, {
580
- readonly type: "uint256";
581
- readonly name: "amountIn";
582
- }, {
583
- readonly type: "uint256";
584
- readonly name: "amountOut";
585
- }];
586
- }, {
587
- readonly name: "FeeSwap";
588
- readonly type: "event";
589
- readonly inputs: readonly [{
590
- readonly type: "address";
591
- readonly name: "userToken";
592
- readonly indexed: true;
593
- }, {
594
- readonly type: "address";
595
- readonly name: "validatorToken";
596
- readonly indexed: true;
597
- }, {
598
- readonly type: "uint256";
599
- readonly name: "amountIn";
600
- }, {
601
- readonly type: "uint256";
602
- readonly name: "amountOut";
603
- }];
604
- }, {
605
- readonly name: "IdenticalAddresses";
606
- readonly type: "error";
607
- readonly inputs: readonly [];
608
- }, {
609
- readonly name: "ZeroAddress";
610
- readonly type: "error";
611
- readonly inputs: readonly [];
612
- }, {
613
- readonly name: "PoolExists";
614
- readonly type: "error";
615
- readonly inputs: readonly [];
616
- }, {
617
- readonly name: "PoolDoesNotExist";
618
- readonly type: "error";
619
- readonly inputs: readonly [];
620
- }, {
621
- readonly name: "InvalidToken";
622
- readonly type: "error";
623
- readonly inputs: readonly [];
624
- }, {
625
- readonly name: "InsufficientLiquidity";
626
- readonly type: "error";
627
- readonly inputs: readonly [];
628
- }, {
629
- readonly name: "OnlyProtocol";
630
- readonly type: "error";
631
- readonly inputs: readonly [];
632
- }, {
633
- readonly name: "InsufficientPoolBalance";
634
- readonly type: "error";
635
- readonly inputs: readonly [];
636
- }, {
637
- readonly name: "InsufficientReserves";
638
- readonly type: "error";
639
- readonly inputs: readonly [];
640
- }, {
641
- readonly name: "InsufficientLiquidityBalance";
642
- readonly type: "error";
643
- readonly inputs: readonly [];
644
- }, {
645
- readonly name: "MustDepositLowerBalanceToken";
646
- readonly type: "error";
647
- readonly inputs: readonly [];
648
- }, {
649
- readonly name: "InvalidAmount";
650
- readonly type: "error";
651
- readonly inputs: readonly [];
652
- }, {
653
- readonly name: "InvalidRebalanceState";
654
- readonly type: "error";
655
- readonly inputs: readonly [];
656
- }, {
657
- readonly name: "InvalidRebalanceDirection";
658
- readonly type: "error";
659
- readonly inputs: readonly [];
660
- }, {
661
- readonly name: "InvalidNewReserves";
662
- readonly type: "error";
663
- readonly inputs: readonly [];
664
- }, {
665
- readonly name: "CannotSupportPendingSwaps";
666
- readonly type: "error";
667
- readonly inputs: readonly [];
668
- }, {
669
- readonly name: "DivisionByZero";
670
- readonly type: "error";
671
- readonly inputs: readonly [];
672
- }, {
673
- readonly name: "InvalidSwapCalculation";
674
- readonly type: "error";
675
- readonly inputs: readonly [];
676
- }, {
677
- readonly name: "InsufficientLiquidityForPending";
678
- readonly type: "error";
679
- readonly inputs: readonly [];
680
- }, {
681
- readonly name: "TokenTransferFailed";
682
- readonly type: "error";
683
- readonly inputs: readonly [];
684
- }, {
685
- readonly name: "InternalError";
686
- readonly type: "error";
687
- readonly inputs: readonly [];
688
- }], "RebalanceSwap">;
689
- }
690
- /**
691
- * Performs a rebalance swap from validator token to user token.
692
- *
693
- * @example
694
- * ```ts
695
- * import { createClient, http } from 'viem'
696
- * import { tempo } from 'tempo.ts/chains'
697
- * import { Actions } from 'tempo.ts/viem'
698
- * import { privateKeyToAccount } from 'viem/accounts'
699
- *
700
- * const client = createClient({
701
- * account: privateKeyToAccount('0x...'),
702
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
703
- * transport: http(),
704
- * })
705
- *
706
- * const result = await Actions.amm.rebalanceSwapSync(client, {
707
- * userToken: '0x...',
708
- * validatorToken: '0x...',
709
- * amountOut: 100n,
710
- * to: '0x...',
711
- * })
712
- * ```
713
- *
714
- * @param client - Client.
715
- * @param parameters - Parameters.
716
- * @returns The transaction receipt and event data.
717
- */
718
- export declare function rebalanceSwapSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: rebalanceSwapSync.Parameters<chain, account>): Promise<rebalanceSwapSync.ReturnValue>;
719
- export declare namespace rebalanceSwapSync {
720
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = rebalanceSwap.Parameters<chain, account>;
721
- type Args = rebalanceSwap.Args;
722
- type ReturnValue = Compute<GetEventArgs<typeof Abis.feeAmm, 'RebalanceSwap', {
723
- IndexedOnly: false;
724
- Required: true;
725
- }> & {
726
- /** Transaction receipt. */
727
- receipt: TransactionReceipt;
728
- }>;
729
- }
730
- /**
731
- * Adds liquidity to a pool.
732
- *
733
- * @example
734
- * ```ts
735
- * import { createClient, http } from 'viem'
736
- * import { tempo } from 'tempo.ts/chains'
737
- * import { Actions } from 'tempo.ts/viem'
738
- * import { privateKeyToAccount } from 'viem/accounts'
739
- *
740
- * const client = createClient({
741
- * account: privateKeyToAccount('0x...'),
742
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
743
- * transport: http(),
744
- * })
745
- *
746
- * const hash = await Actions.amm.mint(client, {
747
- * userTokenAddress: '0x20c0...beef',
748
- * validatorTokenAddress: '0x20c0...babe',
749
- * validatorTokenAmount: 100n,
750
- * to: '0xfeed...fede',
751
- * })
752
- * ```
753
- *
754
- * @param client - Client.
755
- * @param parameters - Parameters.
756
- * @returns The transaction hash.
757
- */
758
- export declare function mint<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: mint.Parameters<chain, account>): Promise<mint.ReturnValue>;
759
- export declare namespace mint {
760
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
761
- type Args = {
762
- /** Address to mint LP tokens to. */
763
- to: Address;
764
- /** User token address. */
765
- userTokenAddress: TokenId.TokenIdOrAddress;
766
- /** Validator token address. */
767
- validatorTokenAddress: TokenId.TokenIdOrAddress;
768
- /** Amount of validator token to add. */
769
- validatorTokenAmount: bigint;
770
- };
771
- type ReturnValue = WriteContractReturnType;
772
- /** @internal */
773
- function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: mint.Parameters<chain, account>): Promise<ReturnType<action>>;
774
- /**
775
- * Defines a call to the `mint` function.
776
- *
777
- * Can be passed as a parameter to:
778
- * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
779
- * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
780
- * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
781
- *
782
- * @example
783
- * ```ts
784
- * import { createClient, http, walletActions } from 'viem'
785
- * import { tempo } from 'tempo.ts/chains'
786
- * import { Actions } from 'tempo.ts/viem'
787
- *
788
- * const client = createClient({
789
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
790
- * transport: http(),
791
- * }).extend(walletActions)
792
- *
793
- * const { result } = await client.sendCalls({
794
- * calls: [
795
- * actions.amm.mint.call({
796
- * userTokenAddress: '0x20c0...beef',
797
- * validatorTokenAddress: '0x20c0...babe',
798
- * validatorTokenAmount: 100n,
799
- * to: '0xfeed...fede',
800
- * }),
801
- * actions.amm.mint.call({
802
- * userTokenAddress: '0x20c0...babe',
803
- * validatorTokenAddress: '0x20c0...babe',
804
- * validatorTokenAmount: 100n,
805
- * to: '0xfeed...fede',
806
- * }),
807
- * ]
808
- * })
809
- * ```
810
- *
811
- * @param args - Arguments.
812
- * @returns The call.
813
- */
814
- function call(args: Args): {
815
- abi: [{
816
- readonly name: "mintWithValidatorToken";
817
- readonly type: "function";
818
- readonly stateMutability: "nonpayable";
819
- readonly inputs: readonly [{
820
- readonly type: "address";
821
- readonly name: "userToken";
822
- }, {
823
- readonly type: "address";
824
- readonly name: "validatorToken";
825
- }, {
826
- readonly type: "uint256";
827
- readonly name: "amountValidatorToken";
828
- }, {
829
- readonly type: "address";
830
- readonly name: "to";
831
- }];
832
- readonly outputs: readonly [{
833
- readonly type: "uint256";
834
- readonly name: "liquidity";
835
- }];
836
- }];
837
- functionName: "mintWithValidatorToken";
838
- args?: readonly [`0x${string}`, `0x${string}`, bigint, `0x${string}`] | undefined;
839
- } & {
840
- args: readonly [`0x${string}`, `0x${string}`, bigint, `0x${string}`];
841
- } & {
842
- address: Address;
843
- } & {
844
- data: Hex;
845
- to: Address;
846
- };
847
- /**
848
- * Extracts the `Mint` event from logs.
849
- *
850
- * @param logs - The logs.
851
- * @returns The `Mint` event.
852
- */
853
- function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
854
- readonly name: "M";
855
- readonly type: "function";
856
- readonly stateMutability: "view";
857
- readonly inputs: readonly [];
858
- readonly outputs: readonly [{
859
- readonly type: "uint256";
860
- }];
861
- }, {
862
- readonly name: "N";
863
- readonly type: "function";
864
- readonly stateMutability: "view";
865
- readonly inputs: readonly [];
866
- readonly outputs: readonly [{
867
- readonly type: "uint256";
868
- }];
869
- }, {
870
- readonly name: "SCALE";
871
- readonly type: "function";
872
- readonly stateMutability: "view";
873
- readonly inputs: readonly [];
874
- readonly outputs: readonly [{
875
- readonly type: "uint256";
876
- }];
877
- }, {
878
- readonly name: "MIN_LIQUIDITY";
879
- readonly type: "function";
880
- readonly stateMutability: "view";
881
- readonly inputs: readonly [];
882
- readonly outputs: readonly [{
883
- readonly type: "uint256";
884
- }];
885
- }, {
886
- readonly name: "getPoolId";
887
- readonly type: "function";
888
- readonly stateMutability: "pure";
889
- readonly inputs: readonly [{
890
- readonly type: "address";
891
- readonly name: "userToken";
892
- }, {
893
- readonly type: "address";
894
- readonly name: "validatorToken";
895
- }];
896
- readonly outputs: readonly [{
897
- readonly type: "bytes32";
898
- }];
899
- }, {
900
- readonly name: "getPool";
901
- readonly type: "function";
902
- readonly stateMutability: "view";
903
- readonly inputs: readonly [{
904
- readonly type: "address";
905
- readonly name: "userToken";
906
- }, {
907
- readonly type: "address";
908
- readonly name: "validatorToken";
909
- }];
910
- readonly outputs: readonly [{
911
- readonly type: "tuple";
912
- readonly components: readonly [{
913
- readonly type: "uint128";
914
- readonly name: "reserveUserToken";
915
- }, {
916
- readonly type: "uint128";
917
- readonly name: "reserveValidatorToken";
918
- }];
919
- }];
920
- }, {
921
- readonly name: "pools";
922
- readonly type: "function";
923
- readonly stateMutability: "view";
924
- readonly inputs: readonly [{
925
- readonly type: "bytes32";
926
- readonly name: "poolId";
927
- }];
928
- readonly outputs: readonly [{
929
- readonly type: "tuple";
930
- readonly components: readonly [{
931
- readonly type: "uint128";
932
- readonly name: "reserveUserToken";
933
- }, {
934
- readonly type: "uint128";
935
- readonly name: "reserveValidatorToken";
936
- }];
937
- }];
938
- }, {
939
- readonly name: "mint";
940
- readonly type: "function";
941
- readonly stateMutability: "nonpayable";
942
- readonly inputs: readonly [{
943
- readonly type: "address";
944
- readonly name: "userToken";
945
- }, {
946
- readonly type: "address";
947
- readonly name: "validatorToken";
948
- }, {
949
- readonly type: "uint256";
950
- readonly name: "amountUserToken";
951
- }, {
952
- readonly type: "uint256";
953
- readonly name: "amountValidatorToken";
954
- }, {
955
- readonly type: "address";
956
- readonly name: "to";
957
- }];
958
- readonly outputs: readonly [{
959
- readonly type: "uint256";
960
- readonly name: "liquidity";
961
- }];
962
- }, {
963
- readonly name: "mintWithValidatorToken";
964
- readonly type: "function";
965
- readonly stateMutability: "nonpayable";
966
- readonly inputs: readonly [{
967
- readonly type: "address";
968
- readonly name: "userToken";
969
- }, {
970
- readonly type: "address";
971
- readonly name: "validatorToken";
972
- }, {
973
- readonly type: "uint256";
974
- readonly name: "amountValidatorToken";
975
- }, {
976
- readonly type: "address";
977
- readonly name: "to";
978
- }];
979
- readonly outputs: readonly [{
980
- readonly type: "uint256";
981
- readonly name: "liquidity";
982
- }];
983
- }, {
984
- readonly name: "burn";
985
- readonly type: "function";
986
- readonly stateMutability: "nonpayable";
987
- readonly inputs: readonly [{
988
- readonly type: "address";
989
- readonly name: "userToken";
990
- }, {
991
- readonly type: "address";
992
- readonly name: "validatorToken";
993
- }, {
994
- readonly type: "uint256";
995
- readonly name: "liquidity";
996
- }, {
997
- readonly type: "address";
998
- readonly name: "to";
999
- }];
1000
- readonly outputs: readonly [{
1001
- readonly type: "uint256";
1002
- readonly name: "amountUserToken";
1003
- }, {
1004
- readonly type: "uint256";
1005
- readonly name: "amountValidatorToken";
1006
- }];
1007
- }, {
1008
- readonly name: "totalSupply";
1009
- readonly type: "function";
1010
- readonly stateMutability: "view";
1011
- readonly inputs: readonly [{
1012
- readonly type: "bytes32";
1013
- readonly name: "poolId";
1014
- }];
1015
- readonly outputs: readonly [{
1016
- readonly type: "uint256";
1017
- }];
1018
- }, {
1019
- readonly name: "liquidityBalances";
1020
- readonly type: "function";
1021
- readonly stateMutability: "view";
1022
- readonly inputs: readonly [{
1023
- readonly type: "bytes32";
1024
- readonly name: "poolId";
1025
- }, {
1026
- readonly type: "address";
1027
- readonly name: "user";
1028
- }];
1029
- readonly outputs: readonly [{
1030
- readonly type: "uint256";
1031
- }];
1032
- }, {
1033
- readonly name: "rebalanceSwap";
1034
- readonly type: "function";
1035
- readonly stateMutability: "nonpayable";
1036
- readonly inputs: readonly [{
1037
- readonly type: "address";
1038
- readonly name: "userToken";
1039
- }, {
1040
- readonly type: "address";
1041
- readonly name: "validatorToken";
1042
- }, {
1043
- readonly type: "uint256";
1044
- readonly name: "amountOut";
1045
- }, {
1046
- readonly type: "address";
1047
- readonly name: "to";
1048
- }];
1049
- readonly outputs: readonly [{
1050
- readonly type: "uint256";
1051
- readonly name: "amountIn";
1052
- }];
1053
- }, {
1054
- readonly name: "Mint";
1055
- readonly type: "event";
1056
- readonly inputs: readonly [{
1057
- readonly type: "address";
1058
- readonly name: "sender";
1059
- readonly indexed: true;
1060
- }, {
1061
- readonly type: "address";
1062
- readonly name: "userToken";
1063
- readonly indexed: true;
1064
- }, {
1065
- readonly type: "address";
1066
- readonly name: "validatorToken";
1067
- readonly indexed: true;
1068
- }, {
1069
- readonly type: "uint256";
1070
- readonly name: "amountUserToken";
1071
- }, {
1072
- readonly type: "uint256";
1073
- readonly name: "amountValidatorToken";
1074
- }, {
1075
- readonly type: "uint256";
1076
- readonly name: "liquidity";
1077
- }];
1078
- }, {
1079
- readonly name: "Burn";
1080
- readonly type: "event";
1081
- readonly inputs: readonly [{
1082
- readonly type: "address";
1083
- readonly name: "sender";
1084
- readonly indexed: true;
1085
- }, {
1086
- readonly type: "address";
1087
- readonly name: "userToken";
1088
- readonly indexed: true;
1089
- }, {
1090
- readonly type: "address";
1091
- readonly name: "validatorToken";
1092
- readonly indexed: true;
1093
- }, {
1094
- readonly type: "uint256";
1095
- readonly name: "amountUserToken";
1096
- }, {
1097
- readonly type: "uint256";
1098
- readonly name: "amountValidatorToken";
1099
- }, {
1100
- readonly type: "uint256";
1101
- readonly name: "liquidity";
1102
- }, {
1103
- readonly type: "address";
1104
- readonly name: "to";
1105
- }];
1106
- }, {
1107
- readonly name: "RebalanceSwap";
1108
- readonly type: "event";
1109
- readonly inputs: readonly [{
1110
- readonly type: "address";
1111
- readonly name: "userToken";
1112
- readonly indexed: true;
1113
- }, {
1114
- readonly type: "address";
1115
- readonly name: "validatorToken";
1116
- readonly indexed: true;
1117
- }, {
1118
- readonly type: "address";
1119
- readonly name: "swapper";
1120
- readonly indexed: true;
1121
- }, {
1122
- readonly type: "uint256";
1123
- readonly name: "amountIn";
1124
- }, {
1125
- readonly type: "uint256";
1126
- readonly name: "amountOut";
1127
- }];
1128
- }, {
1129
- readonly name: "FeeSwap";
1130
- readonly type: "event";
1131
- readonly inputs: readonly [{
1132
- readonly type: "address";
1133
- readonly name: "userToken";
1134
- readonly indexed: true;
1135
- }, {
1136
- readonly type: "address";
1137
- readonly name: "validatorToken";
1138
- readonly indexed: true;
1139
- }, {
1140
- readonly type: "uint256";
1141
- readonly name: "amountIn";
1142
- }, {
1143
- readonly type: "uint256";
1144
- readonly name: "amountOut";
1145
- }];
1146
- }, {
1147
- readonly name: "IdenticalAddresses";
1148
- readonly type: "error";
1149
- readonly inputs: readonly [];
1150
- }, {
1151
- readonly name: "ZeroAddress";
1152
- readonly type: "error";
1153
- readonly inputs: readonly [];
1154
- }, {
1155
- readonly name: "PoolExists";
1156
- readonly type: "error";
1157
- readonly inputs: readonly [];
1158
- }, {
1159
- readonly name: "PoolDoesNotExist";
1160
- readonly type: "error";
1161
- readonly inputs: readonly [];
1162
- }, {
1163
- readonly name: "InvalidToken";
1164
- readonly type: "error";
1165
- readonly inputs: readonly [];
1166
- }, {
1167
- readonly name: "InsufficientLiquidity";
1168
- readonly type: "error";
1169
- readonly inputs: readonly [];
1170
- }, {
1171
- readonly name: "OnlyProtocol";
1172
- readonly type: "error";
1173
- readonly inputs: readonly [];
1174
- }, {
1175
- readonly name: "InsufficientPoolBalance";
1176
- readonly type: "error";
1177
- readonly inputs: readonly [];
1178
- }, {
1179
- readonly name: "InsufficientReserves";
1180
- readonly type: "error";
1181
- readonly inputs: readonly [];
1182
- }, {
1183
- readonly name: "InsufficientLiquidityBalance";
1184
- readonly type: "error";
1185
- readonly inputs: readonly [];
1186
- }, {
1187
- readonly name: "MustDepositLowerBalanceToken";
1188
- readonly type: "error";
1189
- readonly inputs: readonly [];
1190
- }, {
1191
- readonly name: "InvalidAmount";
1192
- readonly type: "error";
1193
- readonly inputs: readonly [];
1194
- }, {
1195
- readonly name: "InvalidRebalanceState";
1196
- readonly type: "error";
1197
- readonly inputs: readonly [];
1198
- }, {
1199
- readonly name: "InvalidRebalanceDirection";
1200
- readonly type: "error";
1201
- readonly inputs: readonly [];
1202
- }, {
1203
- readonly name: "InvalidNewReserves";
1204
- readonly type: "error";
1205
- readonly inputs: readonly [];
1206
- }, {
1207
- readonly name: "CannotSupportPendingSwaps";
1208
- readonly type: "error";
1209
- readonly inputs: readonly [];
1210
- }, {
1211
- readonly name: "DivisionByZero";
1212
- readonly type: "error";
1213
- readonly inputs: readonly [];
1214
- }, {
1215
- readonly name: "InvalidSwapCalculation";
1216
- readonly type: "error";
1217
- readonly inputs: readonly [];
1218
- }, {
1219
- readonly name: "InsufficientLiquidityForPending";
1220
- readonly type: "error";
1221
- readonly inputs: readonly [];
1222
- }, {
1223
- readonly name: "TokenTransferFailed";
1224
- readonly type: "error";
1225
- readonly inputs: readonly [];
1226
- }, {
1227
- readonly name: "InternalError";
1228
- readonly type: "error";
1229
- readonly inputs: readonly [];
1230
- }], "Mint">;
1231
- }
1232
- /**
1233
- * Adds liquidity to a pool.
1234
- *
1235
- * @example
1236
- * ```ts
1237
- * import { createClient, http } from 'viem'
1238
- * import { tempo } from 'tempo.ts/chains'
1239
- * import { Actions } from 'tempo.ts/viem'
1240
- * import { privateKeyToAccount } from 'viem/accounts'
1241
- *
1242
- * const client = createClient({
1243
- * account: privateKeyToAccount('0x...'),
1244
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1245
- * transport: http(),
1246
- * })
1247
- *
1248
- * const hash = await Actions.amm.mint(client, {
1249
- * userTokenAddress: '0x20c0...beef',
1250
- * validatorTokenAddress: '0x20c0...babe',
1251
- * validatorTokenAmount: 100n,
1252
- * to: '0xfeed...fede',
1253
- * })
1254
- * ```
1255
- *
1256
- * @param client - Client.
1257
- * @param parameters - Parameters.
1258
- * @returns The transaction receipt and event data.
1259
- */
1260
- export declare function mintSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: mintSync.Parameters<chain, account>): Promise<mintSync.ReturnValue>;
1261
- export declare namespace mintSync {
1262
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = mint.Parameters<chain, account>;
1263
- type Args = mint.Args;
1264
- type ReturnValue = Compute<GetEventArgs<typeof Abis.feeAmm, 'Mint', {
1265
- IndexedOnly: false;
1266
- Required: true;
1267
- }> & {
1268
- /** Transaction receipt. */
1269
- receipt: TransactionReceipt;
1270
- }>;
1271
- }
1272
- /**
1273
- * Removes liquidity from a pool.
1274
- *
1275
- * @example
1276
- * ```ts
1277
- * import { createClient, http } from 'viem'
1278
- * import { tempo } from 'tempo.ts/chains'
1279
- * import { Actions } from 'tempo.ts/viem'
1280
- * import { privateKeyToAccount } from 'viem/accounts'
1281
- *
1282
- * const client = createClient({
1283
- * account: privateKeyToAccount('0x...'),
1284
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1285
- * transport: http(),
1286
- * })
1287
- *
1288
- * const hash = await Actions.amm.burn(client, {
1289
- * userToken: '0x20c0...beef',
1290
- * validatorToken: '0x20c0...babe',
1291
- * liquidity: 50n,
1292
- * to: '0xfeed...fede',
1293
- * })
1294
- * ```
1295
- *
1296
- * @param client - Client.
1297
- * @param parameters - Parameters.
1298
- * @returns The transaction hash.
1299
- */
1300
- export declare function burn<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: burn.Parameters<chain, account>): Promise<burn.ReturnValue>;
1301
- export declare namespace burn {
1302
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
1303
- type Args = {
1304
- /** Amount of LP tokens to burn. */
1305
- liquidity: bigint;
1306
- /** Address to send tokens to. */
1307
- to: Address;
1308
- /** Address or ID of the user token. */
1309
- userToken: TokenId.TokenIdOrAddress;
1310
- /** Address or ID of the validator token. */
1311
- validatorToken: TokenId.TokenIdOrAddress;
1312
- };
1313
- type ReturnValue = WriteContractReturnType;
1314
- /** @internal */
1315
- function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: burn.Parameters<chain, account>): Promise<ReturnType<action>>;
1316
- /**
1317
- * Defines a call to the `burn` function.
1318
- *
1319
- * Can be passed as a parameter to:
1320
- * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
1321
- * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
1322
- * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
1323
- *
1324
- * @example
1325
- * ```ts
1326
- * import { createClient, http, walletActions } from 'viem'
1327
- * import { tempo } from 'tempo.ts/chains'
1328
- * import { Actions } from 'tempo.ts/viem'
1329
- *
1330
- * const client = createClient({
1331
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1332
- * transport: http(),
1333
- * }).extend(walletActions)
1334
- *
1335
- * const { result } = await client.sendCalls({
1336
- * calls: [
1337
- * actions.amm.burn.call({
1338
- * liquidity: 100n,
1339
- * to: '0xfeed...fede',
1340
- * userToken: '0x20c0...beef',
1341
- * validatorToken: '0x20c0...babe',
1342
- * }),
1343
- * actions.amm.burn.call({
1344
- * liquidity: 100n,
1345
- * to: '0xfeed...fede',
1346
- * userToken: '0x20c0...babe',
1347
- * validatorToken: '0x20c0...babe',
1348
- * }),
1349
- * ]
1350
- * })
1351
- * ```
1352
- *
1353
- * @param args - Arguments.
1354
- * @returns The call.
1355
- */
1356
- function call(args: Args): {
1357
- abi: [{
1358
- readonly name: "burn";
1359
- readonly type: "function";
1360
- readonly stateMutability: "nonpayable";
1361
- readonly inputs: readonly [{
1362
- readonly type: "address";
1363
- readonly name: "userToken";
1364
- }, {
1365
- readonly type: "address";
1366
- readonly name: "validatorToken";
1367
- }, {
1368
- readonly type: "uint256";
1369
- readonly name: "liquidity";
1370
- }, {
1371
- readonly type: "address";
1372
- readonly name: "to";
1373
- }];
1374
- readonly outputs: readonly [{
1375
- readonly type: "uint256";
1376
- readonly name: "amountUserToken";
1377
- }, {
1378
- readonly type: "uint256";
1379
- readonly name: "amountValidatorToken";
1380
- }];
1381
- }];
1382
- functionName: "burn";
1383
- args?: readonly [`0x${string}`, `0x${string}`, bigint, `0x${string}`] | undefined;
1384
- } & {
1385
- args: readonly [`0x${string}`, `0x${string}`, bigint, `0x${string}`];
1386
- } & {
1387
- address: Address;
1388
- } & {
1389
- data: Hex;
1390
- to: Address;
1391
- };
1392
- /**
1393
- * Extracts the `Burn` event from logs.
1394
- *
1395
- * @param logs - The logs.
1396
- * @returns The `Burn` event.
1397
- */
1398
- function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
1399
- readonly name: "M";
1400
- readonly type: "function";
1401
- readonly stateMutability: "view";
1402
- readonly inputs: readonly [];
1403
- readonly outputs: readonly [{
1404
- readonly type: "uint256";
1405
- }];
1406
- }, {
1407
- readonly name: "N";
1408
- readonly type: "function";
1409
- readonly stateMutability: "view";
1410
- readonly inputs: readonly [];
1411
- readonly outputs: readonly [{
1412
- readonly type: "uint256";
1413
- }];
1414
- }, {
1415
- readonly name: "SCALE";
1416
- readonly type: "function";
1417
- readonly stateMutability: "view";
1418
- readonly inputs: readonly [];
1419
- readonly outputs: readonly [{
1420
- readonly type: "uint256";
1421
- }];
1422
- }, {
1423
- readonly name: "MIN_LIQUIDITY";
1424
- readonly type: "function";
1425
- readonly stateMutability: "view";
1426
- readonly inputs: readonly [];
1427
- readonly outputs: readonly [{
1428
- readonly type: "uint256";
1429
- }];
1430
- }, {
1431
- readonly name: "getPoolId";
1432
- readonly type: "function";
1433
- readonly stateMutability: "pure";
1434
- readonly inputs: readonly [{
1435
- readonly type: "address";
1436
- readonly name: "userToken";
1437
- }, {
1438
- readonly type: "address";
1439
- readonly name: "validatorToken";
1440
- }];
1441
- readonly outputs: readonly [{
1442
- readonly type: "bytes32";
1443
- }];
1444
- }, {
1445
- readonly name: "getPool";
1446
- readonly type: "function";
1447
- readonly stateMutability: "view";
1448
- readonly inputs: readonly [{
1449
- readonly type: "address";
1450
- readonly name: "userToken";
1451
- }, {
1452
- readonly type: "address";
1453
- readonly name: "validatorToken";
1454
- }];
1455
- readonly outputs: readonly [{
1456
- readonly type: "tuple";
1457
- readonly components: readonly [{
1458
- readonly type: "uint128";
1459
- readonly name: "reserveUserToken";
1460
- }, {
1461
- readonly type: "uint128";
1462
- readonly name: "reserveValidatorToken";
1463
- }];
1464
- }];
1465
- }, {
1466
- readonly name: "pools";
1467
- readonly type: "function";
1468
- readonly stateMutability: "view";
1469
- readonly inputs: readonly [{
1470
- readonly type: "bytes32";
1471
- readonly name: "poolId";
1472
- }];
1473
- readonly outputs: readonly [{
1474
- readonly type: "tuple";
1475
- readonly components: readonly [{
1476
- readonly type: "uint128";
1477
- readonly name: "reserveUserToken";
1478
- }, {
1479
- readonly type: "uint128";
1480
- readonly name: "reserveValidatorToken";
1481
- }];
1482
- }];
1483
- }, {
1484
- readonly name: "mint";
1485
- readonly type: "function";
1486
- readonly stateMutability: "nonpayable";
1487
- readonly inputs: readonly [{
1488
- readonly type: "address";
1489
- readonly name: "userToken";
1490
- }, {
1491
- readonly type: "address";
1492
- readonly name: "validatorToken";
1493
- }, {
1494
- readonly type: "uint256";
1495
- readonly name: "amountUserToken";
1496
- }, {
1497
- readonly type: "uint256";
1498
- readonly name: "amountValidatorToken";
1499
- }, {
1500
- readonly type: "address";
1501
- readonly name: "to";
1502
- }];
1503
- readonly outputs: readonly [{
1504
- readonly type: "uint256";
1505
- readonly name: "liquidity";
1506
- }];
1507
- }, {
1508
- readonly name: "mintWithValidatorToken";
1509
- readonly type: "function";
1510
- readonly stateMutability: "nonpayable";
1511
- readonly inputs: readonly [{
1512
- readonly type: "address";
1513
- readonly name: "userToken";
1514
- }, {
1515
- readonly type: "address";
1516
- readonly name: "validatorToken";
1517
- }, {
1518
- readonly type: "uint256";
1519
- readonly name: "amountValidatorToken";
1520
- }, {
1521
- readonly type: "address";
1522
- readonly name: "to";
1523
- }];
1524
- readonly outputs: readonly [{
1525
- readonly type: "uint256";
1526
- readonly name: "liquidity";
1527
- }];
1528
- }, {
1529
- readonly name: "burn";
1530
- readonly type: "function";
1531
- readonly stateMutability: "nonpayable";
1532
- readonly inputs: readonly [{
1533
- readonly type: "address";
1534
- readonly name: "userToken";
1535
- }, {
1536
- readonly type: "address";
1537
- readonly name: "validatorToken";
1538
- }, {
1539
- readonly type: "uint256";
1540
- readonly name: "liquidity";
1541
- }, {
1542
- readonly type: "address";
1543
- readonly name: "to";
1544
- }];
1545
- readonly outputs: readonly [{
1546
- readonly type: "uint256";
1547
- readonly name: "amountUserToken";
1548
- }, {
1549
- readonly type: "uint256";
1550
- readonly name: "amountValidatorToken";
1551
- }];
1552
- }, {
1553
- readonly name: "totalSupply";
1554
- readonly type: "function";
1555
- readonly stateMutability: "view";
1556
- readonly inputs: readonly [{
1557
- readonly type: "bytes32";
1558
- readonly name: "poolId";
1559
- }];
1560
- readonly outputs: readonly [{
1561
- readonly type: "uint256";
1562
- }];
1563
- }, {
1564
- readonly name: "liquidityBalances";
1565
- readonly type: "function";
1566
- readonly stateMutability: "view";
1567
- readonly inputs: readonly [{
1568
- readonly type: "bytes32";
1569
- readonly name: "poolId";
1570
- }, {
1571
- readonly type: "address";
1572
- readonly name: "user";
1573
- }];
1574
- readonly outputs: readonly [{
1575
- readonly type: "uint256";
1576
- }];
1577
- }, {
1578
- readonly name: "rebalanceSwap";
1579
- readonly type: "function";
1580
- readonly stateMutability: "nonpayable";
1581
- readonly inputs: readonly [{
1582
- readonly type: "address";
1583
- readonly name: "userToken";
1584
- }, {
1585
- readonly type: "address";
1586
- readonly name: "validatorToken";
1587
- }, {
1588
- readonly type: "uint256";
1589
- readonly name: "amountOut";
1590
- }, {
1591
- readonly type: "address";
1592
- readonly name: "to";
1593
- }];
1594
- readonly outputs: readonly [{
1595
- readonly type: "uint256";
1596
- readonly name: "amountIn";
1597
- }];
1598
- }, {
1599
- readonly name: "Mint";
1600
- readonly type: "event";
1601
- readonly inputs: readonly [{
1602
- readonly type: "address";
1603
- readonly name: "sender";
1604
- readonly indexed: true;
1605
- }, {
1606
- readonly type: "address";
1607
- readonly name: "userToken";
1608
- readonly indexed: true;
1609
- }, {
1610
- readonly type: "address";
1611
- readonly name: "validatorToken";
1612
- readonly indexed: true;
1613
- }, {
1614
- readonly type: "uint256";
1615
- readonly name: "amountUserToken";
1616
- }, {
1617
- readonly type: "uint256";
1618
- readonly name: "amountValidatorToken";
1619
- }, {
1620
- readonly type: "uint256";
1621
- readonly name: "liquidity";
1622
- }];
1623
- }, {
1624
- readonly name: "Burn";
1625
- readonly type: "event";
1626
- readonly inputs: readonly [{
1627
- readonly type: "address";
1628
- readonly name: "sender";
1629
- readonly indexed: true;
1630
- }, {
1631
- readonly type: "address";
1632
- readonly name: "userToken";
1633
- readonly indexed: true;
1634
- }, {
1635
- readonly type: "address";
1636
- readonly name: "validatorToken";
1637
- readonly indexed: true;
1638
- }, {
1639
- readonly type: "uint256";
1640
- readonly name: "amountUserToken";
1641
- }, {
1642
- readonly type: "uint256";
1643
- readonly name: "amountValidatorToken";
1644
- }, {
1645
- readonly type: "uint256";
1646
- readonly name: "liquidity";
1647
- }, {
1648
- readonly type: "address";
1649
- readonly name: "to";
1650
- }];
1651
- }, {
1652
- readonly name: "RebalanceSwap";
1653
- readonly type: "event";
1654
- readonly inputs: readonly [{
1655
- readonly type: "address";
1656
- readonly name: "userToken";
1657
- readonly indexed: true;
1658
- }, {
1659
- readonly type: "address";
1660
- readonly name: "validatorToken";
1661
- readonly indexed: true;
1662
- }, {
1663
- readonly type: "address";
1664
- readonly name: "swapper";
1665
- readonly indexed: true;
1666
- }, {
1667
- readonly type: "uint256";
1668
- readonly name: "amountIn";
1669
- }, {
1670
- readonly type: "uint256";
1671
- readonly name: "amountOut";
1672
- }];
1673
- }, {
1674
- readonly name: "FeeSwap";
1675
- readonly type: "event";
1676
- readonly inputs: readonly [{
1677
- readonly type: "address";
1678
- readonly name: "userToken";
1679
- readonly indexed: true;
1680
- }, {
1681
- readonly type: "address";
1682
- readonly name: "validatorToken";
1683
- readonly indexed: true;
1684
- }, {
1685
- readonly type: "uint256";
1686
- readonly name: "amountIn";
1687
- }, {
1688
- readonly type: "uint256";
1689
- readonly name: "amountOut";
1690
- }];
1691
- }, {
1692
- readonly name: "IdenticalAddresses";
1693
- readonly type: "error";
1694
- readonly inputs: readonly [];
1695
- }, {
1696
- readonly name: "ZeroAddress";
1697
- readonly type: "error";
1698
- readonly inputs: readonly [];
1699
- }, {
1700
- readonly name: "PoolExists";
1701
- readonly type: "error";
1702
- readonly inputs: readonly [];
1703
- }, {
1704
- readonly name: "PoolDoesNotExist";
1705
- readonly type: "error";
1706
- readonly inputs: readonly [];
1707
- }, {
1708
- readonly name: "InvalidToken";
1709
- readonly type: "error";
1710
- readonly inputs: readonly [];
1711
- }, {
1712
- readonly name: "InsufficientLiquidity";
1713
- readonly type: "error";
1714
- readonly inputs: readonly [];
1715
- }, {
1716
- readonly name: "OnlyProtocol";
1717
- readonly type: "error";
1718
- readonly inputs: readonly [];
1719
- }, {
1720
- readonly name: "InsufficientPoolBalance";
1721
- readonly type: "error";
1722
- readonly inputs: readonly [];
1723
- }, {
1724
- readonly name: "InsufficientReserves";
1725
- readonly type: "error";
1726
- readonly inputs: readonly [];
1727
- }, {
1728
- readonly name: "InsufficientLiquidityBalance";
1729
- readonly type: "error";
1730
- readonly inputs: readonly [];
1731
- }, {
1732
- readonly name: "MustDepositLowerBalanceToken";
1733
- readonly type: "error";
1734
- readonly inputs: readonly [];
1735
- }, {
1736
- readonly name: "InvalidAmount";
1737
- readonly type: "error";
1738
- readonly inputs: readonly [];
1739
- }, {
1740
- readonly name: "InvalidRebalanceState";
1741
- readonly type: "error";
1742
- readonly inputs: readonly [];
1743
- }, {
1744
- readonly name: "InvalidRebalanceDirection";
1745
- readonly type: "error";
1746
- readonly inputs: readonly [];
1747
- }, {
1748
- readonly name: "InvalidNewReserves";
1749
- readonly type: "error";
1750
- readonly inputs: readonly [];
1751
- }, {
1752
- readonly name: "CannotSupportPendingSwaps";
1753
- readonly type: "error";
1754
- readonly inputs: readonly [];
1755
- }, {
1756
- readonly name: "DivisionByZero";
1757
- readonly type: "error";
1758
- readonly inputs: readonly [];
1759
- }, {
1760
- readonly name: "InvalidSwapCalculation";
1761
- readonly type: "error";
1762
- readonly inputs: readonly [];
1763
- }, {
1764
- readonly name: "InsufficientLiquidityForPending";
1765
- readonly type: "error";
1766
- readonly inputs: readonly [];
1767
- }, {
1768
- readonly name: "TokenTransferFailed";
1769
- readonly type: "error";
1770
- readonly inputs: readonly [];
1771
- }, {
1772
- readonly name: "InternalError";
1773
- readonly type: "error";
1774
- readonly inputs: readonly [];
1775
- }], "Burn">;
1776
- }
1777
- /**
1778
- * Removes liquidity from a pool.
1779
- *
1780
- * @example
1781
- * ```ts
1782
- * import { createClient, http } from 'viem'
1783
- * import { tempo } from 'tempo.ts/chains'
1784
- * import { Actions } from 'tempo.ts/viem'
1785
- * import { privateKeyToAccount } from 'viem/accounts'
1786
- *
1787
- * const client = createClient({
1788
- * account: privateKeyToAccount('0x...'),
1789
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1790
- * transport: http(),
1791
- * })
1792
- *
1793
- * const result = await Actions.amm.burnSync(client, {
1794
- * userToken: '0x20c0...beef',
1795
- * validatorToken: '0x20c0...babe',
1796
- * liquidity: 50n,
1797
- * to: '0xfeed...fede',
1798
- * })
1799
- * ```
1800
- *
1801
- * @param client - Client.
1802
- * @param parameters - Parameters.
1803
- * @returns The transaction receipt and event data.
1804
- */
1805
- export declare function burnSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: burnSync.Parameters<chain, account>): Promise<burnSync.ReturnValue>;
1806
- export declare namespace burnSync {
1807
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = burn.Parameters<chain, account>;
1808
- type Args = burn.Args;
1809
- type ReturnValue = Compute<GetEventArgs<typeof Abis.feeAmm, 'Burn', {
1810
- IndexedOnly: false;
1811
- Required: true;
1812
- }> & {
1813
- /** Transaction receipt. */
1814
- receipt: TransactionReceipt;
1815
- }>;
1816
- }
1817
- /**
1818
- * Watches for rebalance swap events.
1819
- *
1820
- * @example
1821
- * ```ts
1822
- * import { createClient, http } from 'viem'
1823
- * import { tempo } from 'tempo.ts/chains'
1824
- * import { Actions } from 'tempo.ts/viem'
1825
- *
1826
- * const client = createClient({
1827
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1828
- * transport: http(),
1829
- * })
1830
- *
1831
- * const unwatch = actions.amm.watchRebalanceSwap(client, {
1832
- * onRebalanceSwap: (args, log) => {
1833
- * console.log('Rebalance swap:', args)
1834
- * },
1835
- * })
1836
- * ```
1837
- *
1838
- * @param client - Client.
1839
- * @param parameters - Parameters.
1840
- * @returns A function to unsubscribe from the event.
1841
- */
1842
- export declare function watchRebalanceSwap<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchRebalanceSwap.Parameters): import("viem").WatchContractEventReturnType;
1843
- export declare namespace watchRebalanceSwap {
1844
- type Args = GetEventArgs<typeof Abis.feeAmm, 'RebalanceSwap', {
1845
- IndexedOnly: false;
1846
- Required: true;
1847
- }>;
1848
- type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.feeAmm, 'RebalanceSwap'>, true>;
1849
- type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.feeAmm, 'RebalanceSwap', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
1850
- /** Callback to invoke when a rebalance swap occurs. */
1851
- onRebalanceSwap: (args: Args, log: Log) => void;
1852
- /** Address or ID of the user token to filter events. */
1853
- userToken?: TokenId.TokenIdOrAddress | undefined;
1854
- /** Address or ID of the validator token to filter events. */
1855
- validatorToken?: TokenId.TokenIdOrAddress | undefined;
1856
- };
1857
- }
1858
- /**
1859
- * Watches for fee swap events.
1860
- *
1861
- * @example
1862
- * ```ts
1863
- * import { createClient, http } from 'viem'
1864
- * import { tempo } from 'tempo.ts/chains'
1865
- * import { Actions } from 'tempo.ts/viem'
1866
- *
1867
- * const client = createClient({
1868
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1869
- * transport: http(),
1870
- * })
1871
- *
1872
- * const unwatch = actions.amm.watchFeeSwap(client, {
1873
- * onFeeSwap: (args, log) => {
1874
- * console.log('Fee swap:', args)
1875
- * },
1876
- * })
1877
- * ```
1878
- *
1879
- * @param client - Client.
1880
- * @param parameters - Parameters.
1881
- * @returns A function to unsubscribe from the event.
1882
- */
1883
- export declare function watchFeeSwap<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchFeeSwap.Parameters): import("viem").WatchContractEventReturnType;
1884
- export declare namespace watchFeeSwap {
1885
- type Args = GetEventArgs<typeof Abis.feeAmm, 'FeeSwap', {
1886
- IndexedOnly: false;
1887
- Required: true;
1888
- }>;
1889
- type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.feeAmm, 'FeeSwap'>, true>;
1890
- type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.feeAmm, 'FeeSwap', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
1891
- /** Callback to invoke when a fee swap occurs. */
1892
- onFeeSwap: (args: Args, log: Log) => void;
1893
- /** Address or ID of the user token to filter events. */
1894
- userToken?: TokenId.TokenIdOrAddress | undefined;
1895
- /** Address or ID of the validator token to filter events. */
1896
- validatorToken?: TokenId.TokenIdOrAddress | undefined;
1897
- };
1898
- }
1899
- /**
1900
- * Watches for liquidity mint events.
1901
- *
1902
- * @example
1903
- * ```ts
1904
- * import { createClient, http } from 'viem'
1905
- * import { tempo } from 'tempo.ts/chains'
1906
- * import { Actions } from 'tempo.ts/viem'
1907
- *
1908
- * const client = createClient({
1909
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1910
- * transport: http(),
1911
- * })
1912
- *
1913
- * const unwatch = actions.amm.watchMint(client, {
1914
- * onMint: (args, log) => {
1915
- * console.log('Liquidity added:', args)
1916
- * },
1917
- * })
1918
- * ```
1919
- *
1920
- * @param client - Client.
1921
- * @param parameters - Parameters.
1922
- * @returns A function to unsubscribe from the event.
1923
- */
1924
- export declare function watchMint<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchMint.Parameters): import("viem").WatchContractEventReturnType;
1925
- export declare namespace watchMint {
1926
- type Args = {
1927
- liquidity: bigint;
1928
- sender: Address;
1929
- userToken: {
1930
- address: Address;
1931
- amount: bigint;
1932
- };
1933
- validatorToken: {
1934
- address: Address;
1935
- amount: bigint;
1936
- };
1937
- };
1938
- type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.feeAmm, 'Mint'>, true>;
1939
- type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.feeAmm, 'Mint', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
1940
- /** Callback to invoke when liquidity is added. */
1941
- onMint: (args: Args, log: Log) => void;
1942
- /** Address or ID of the sender to filter events. */
1943
- sender?: TokenId.TokenIdOrAddress | undefined;
1944
- /** Address or ID of the user token to filter events. */
1945
- userToken?: TokenId.TokenIdOrAddress | undefined;
1946
- /** Address or ID of the validator token to filter events. */
1947
- validatorToken?: TokenId.TokenIdOrAddress | undefined;
1948
- };
1949
- }
1950
- /**
1951
- * Watches for liquidity burn events.
1952
- *
1953
- * @example
1954
- * ```ts
1955
- * import { createClient, http } from 'viem'
1956
- * import { tempo } from 'tempo.ts/chains'
1957
- * import { Actions } from 'tempo.ts/viem'
1958
- *
1959
- * const client = createClient({
1960
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
1961
- * transport: http(),
1962
- * })
1963
- *
1964
- * const unwatch = actions.amm.watchBurn(client, {
1965
- * onBurn: (args, log) => {
1966
- * console.log('Liquidity removed:', args)
1967
- * },
1968
- * })
1969
- * ```
1970
- *
1971
- * @param client - Client.
1972
- * @param parameters - Parameters.
1973
- * @returns A function to unsubscribe from the event.
1974
- */
1975
- export declare function watchBurn<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchBurn.Parameters): import("viem").WatchContractEventReturnType;
1976
- export declare namespace watchBurn {
1977
- type Args = GetEventArgs<typeof Abis.feeAmm, 'Burn', {
1978
- IndexedOnly: false;
1979
- Required: true;
1980
- }>;
1981
- type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.feeAmm, 'Burn'>, true>;
1982
- type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.feeAmm, 'Burn', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
1983
- /** Callback to invoke when liquidity is removed. */
1984
- onBurn: (args: Args, log: Log) => void;
1985
- /** Address or ID of the user token to filter events. */
1986
- userToken?: TokenId.TokenIdOrAddress | undefined;
1987
- /** Address or ID of the validator token to filter events. */
1988
- validatorToken?: TokenId.TokenIdOrAddress | undefined;
1989
- };
1990
- }
1991
- //# sourceMappingURL=amm.d.ts.map