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