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