@wagmi/core 3.0.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/exports/internal.js.map +1 -1
- package/dist/esm/exports/query.js +1 -1
- package/dist/esm/exports/query.js.map +1 -1
- package/dist/esm/exports/tempo.js +9 -0
- package/dist/esm/exports/tempo.js.map +1 -0
- package/dist/esm/tempo/Connectors.js +534 -0
- package/dist/esm/tempo/Connectors.js.map +1 -0
- package/dist/esm/tempo/KeyManager.js +106 -0
- package/dist/esm/tempo/KeyManager.js.map +1 -0
- package/dist/esm/tempo/actions/amm.js +437 -0
- package/dist/esm/tempo/actions/amm.js.map +1 -0
- package/dist/esm/tempo/actions/dex.js +1059 -0
- package/dist/esm/tempo/actions/dex.js.map +1 -0
- package/dist/esm/tempo/actions/faucet.js +64 -0
- package/dist/esm/tempo/actions/faucet.js.map +1 -0
- package/dist/esm/tempo/actions/fee.js +160 -0
- package/dist/esm/tempo/actions/fee.js.map +1 -0
- package/dist/esm/tempo/actions/index.js +11 -0
- package/dist/esm/tempo/actions/index.js.map +1 -0
- package/dist/esm/tempo/actions/nonce.js +91 -0
- package/dist/esm/tempo/actions/nonce.js.map +1 -0
- package/dist/esm/tempo/actions/policy.js +532 -0
- package/dist/esm/tempo/actions/policy.js.map +1 -0
- package/dist/esm/tempo/actions/reward.js +384 -0
- package/dist/esm/tempo/actions/reward.js.map +1 -0
- package/dist/esm/tempo/actions/token.js +1717 -0
- package/dist/esm/tempo/actions/token.js.map +1 -0
- package/dist/esm/tempo/actions/utils.js +2 -0
- package/dist/esm/tempo/actions/utils.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/exports/internal.d.ts +1 -1
- package/dist/types/exports/internal.d.ts.map +1 -1
- package/dist/types/exports/query.d.ts +1 -1
- package/dist/types/exports/query.d.ts.map +1 -1
- package/dist/types/exports/tempo.d.ts +5 -0
- package/dist/types/exports/tempo.d.ts.map +1 -0
- package/dist/types/tempo/Connectors.d.ts +99 -0
- package/dist/types/tempo/Connectors.d.ts.map +1 -0
- package/dist/types/tempo/KeyManager.d.ts +71 -0
- package/dist/types/tempo/KeyManager.d.ts.map +1 -0
- package/dist/types/tempo/actions/amm.d.ts +387 -0
- package/dist/types/tempo/actions/amm.d.ts.map +1 -0
- package/dist/types/tempo/actions/dex.d.ts +926 -0
- package/dist/types/tempo/actions/dex.d.ts.map +1 -0
- package/dist/types/tempo/actions/faucet.d.ts +70 -0
- package/dist/types/tempo/actions/faucet.d.ts.map +1 -0
- package/dist/types/tempo/actions/fee.d.ts +141 -0
- package/dist/types/tempo/actions/fee.d.ts.map +1 -0
- package/dist/types/tempo/actions/index.d.ts +10 -0
- package/dist/types/tempo/actions/index.d.ts.map +1 -0
- package/dist/types/tempo/actions/nonce.d.ts +79 -0
- package/dist/types/tempo/actions/nonce.d.ts.map +1 -0
- package/dist/types/tempo/actions/policy.d.ts +478 -0
- package/dist/types/tempo/actions/policy.d.ts.map +1 -0
- package/dist/types/tempo/actions/reward.d.ts +340 -0
- package/dist/types/tempo/actions/reward.d.ts.map +1 -0
- package/dist/types/tempo/actions/token.d.ts +1531 -0
- package/dist/types/tempo/actions/token.d.ts.map +1 -0
- package/dist/types/tempo/actions/utils.d.ts +9 -0
- package/dist/types/tempo/actions/utils.d.ts.map +1 -0
- package/dist/types/types/utils.d.ts +16 -0
- package/dist/types/types/utils.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +14 -2
- package/src/exports/internal.ts +3 -0
- package/src/exports/query.ts +4 -1
- package/src/exports/tempo.ts +14 -0
- package/src/tempo/Connectors.ts +762 -0
- package/src/tempo/KeyManager.ts +176 -0
- package/src/tempo/actions/amm.ts +678 -0
- package/src/tempo/actions/dex.ts +1685 -0
- package/src/tempo/actions/faucet.ts +95 -0
- package/src/tempo/actions/fee.ts +259 -0
- package/src/tempo/actions/index.ts +10 -0
- package/src/tempo/actions/nonce.ts +147 -0
- package/src/tempo/actions/policy.ts +827 -0
- package/src/tempo/actions/reward.ts +624 -0
- package/src/tempo/actions/token.ts +2598 -0
- package/src/tempo/actions/utils.ts +26 -0
- package/src/types/utils.ts +19 -0
- package/src/version.ts +1 -1
- package/tempo/package.json +5 -0
|
@@ -0,0 +1,1717 @@
|
|
|
1
|
+
import { Actions } from 'viem/tempo';
|
|
2
|
+
import { getConnectorClient } from '../../actions/getConnectorClient.js';
|
|
3
|
+
/**
|
|
4
|
+
* Approves a spender to transfer TIP20 tokens on behalf of the caller.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
9
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
10
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
11
|
+
*
|
|
12
|
+
* const config = createConfig({
|
|
13
|
+
* chains: [tempo],
|
|
14
|
+
* transports: {
|
|
15
|
+
* [tempo.id]: http(),
|
|
16
|
+
* },
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* const hash = await Actions.token.approve(config, {
|
|
20
|
+
* spender: '0x...',
|
|
21
|
+
* amount: 100n,
|
|
22
|
+
* })
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param config - Config.
|
|
26
|
+
* @param parameters - Parameters.
|
|
27
|
+
* @returns Transaction hash.
|
|
28
|
+
*/
|
|
29
|
+
export async function approve(config, parameters) {
|
|
30
|
+
const { account, chainId, connector } = parameters;
|
|
31
|
+
const client = await getConnectorClient(config, {
|
|
32
|
+
account,
|
|
33
|
+
assertChainId: false,
|
|
34
|
+
chainId,
|
|
35
|
+
connector,
|
|
36
|
+
});
|
|
37
|
+
return Actions.token.approve(client, parameters);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Approves a spender to transfer TIP20 tokens on behalf of the caller.
|
|
41
|
+
*
|
|
42
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
43
|
+
* be included on a block before returning a response.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
48
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
49
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
50
|
+
*
|
|
51
|
+
* const config = createConfig({
|
|
52
|
+
* chains: [tempo],
|
|
53
|
+
* transports: {
|
|
54
|
+
* [tempo.id]: http(),
|
|
55
|
+
* },
|
|
56
|
+
* })
|
|
57
|
+
*
|
|
58
|
+
* const result = await Actions.token.approveSync(config, {
|
|
59
|
+
* spender: '0x...',
|
|
60
|
+
* amount: 100n,
|
|
61
|
+
* })
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @param config - Config.
|
|
65
|
+
* @param parameters - Parameters.
|
|
66
|
+
* @returns The transaction receipt and event data.
|
|
67
|
+
*/
|
|
68
|
+
export async function approveSync(config, parameters) {
|
|
69
|
+
const { account, chainId, connector } = parameters;
|
|
70
|
+
const client = await getConnectorClient(config, {
|
|
71
|
+
account,
|
|
72
|
+
assertChainId: false,
|
|
73
|
+
chainId,
|
|
74
|
+
connector,
|
|
75
|
+
});
|
|
76
|
+
return Actions.token.approveSync(client, parameters);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Burns TIP20 tokens from the caller's balance.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
84
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
85
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
86
|
+
*
|
|
87
|
+
* const config = createConfig({
|
|
88
|
+
* chains: [tempo],
|
|
89
|
+
* transports: {
|
|
90
|
+
* [tempo.id]: http(),
|
|
91
|
+
* },
|
|
92
|
+
* })
|
|
93
|
+
*
|
|
94
|
+
* const hash = await Actions.token.burn(config, {
|
|
95
|
+
* amount: 100n,
|
|
96
|
+
* token: '0x...',
|
|
97
|
+
* })
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @param config - Config.
|
|
101
|
+
* @param parameters - Parameters.
|
|
102
|
+
* @returns Transaction hash.
|
|
103
|
+
*/
|
|
104
|
+
export async function burn(config, parameters) {
|
|
105
|
+
const { account, chainId, connector } = parameters;
|
|
106
|
+
const client = await getConnectorClient(config, {
|
|
107
|
+
account,
|
|
108
|
+
assertChainId: false,
|
|
109
|
+
chainId,
|
|
110
|
+
connector,
|
|
111
|
+
});
|
|
112
|
+
return Actions.token.burn(client, parameters);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Burns TIP20 tokens from a blocked address.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
120
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
121
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
122
|
+
*
|
|
123
|
+
* const config = createConfig({
|
|
124
|
+
* chains: [tempo],
|
|
125
|
+
* transports: {
|
|
126
|
+
* [tempo.id]: http(),
|
|
127
|
+
* },
|
|
128
|
+
* })
|
|
129
|
+
*
|
|
130
|
+
* const hash = await Actions.token.burnBlocked(config, {
|
|
131
|
+
* from: '0x...',
|
|
132
|
+
* amount: 100n,
|
|
133
|
+
* token: '0x...',
|
|
134
|
+
* })
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @param config - Config.
|
|
138
|
+
* @param parameters - Parameters.
|
|
139
|
+
* @returns Transaction hash.
|
|
140
|
+
*/
|
|
141
|
+
export async function burnBlocked(config, parameters) {
|
|
142
|
+
const { account, chainId, connector } = parameters;
|
|
143
|
+
const client = await getConnectorClient(config, {
|
|
144
|
+
account,
|
|
145
|
+
assertChainId: false,
|
|
146
|
+
chainId,
|
|
147
|
+
connector,
|
|
148
|
+
});
|
|
149
|
+
return await Actions.token.burnBlocked(client, parameters);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Burns TIP20 tokens from a blocked address.
|
|
153
|
+
*
|
|
154
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
155
|
+
* be included on a block before returning a response.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
160
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
161
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
162
|
+
*
|
|
163
|
+
* const config = createConfig({
|
|
164
|
+
* chains: [tempo],
|
|
165
|
+
* transports: {
|
|
166
|
+
* [tempo.id]: http(),
|
|
167
|
+
* },
|
|
168
|
+
* })
|
|
169
|
+
*
|
|
170
|
+
* const result = await Actions.token.burnBlockedSync(config, {
|
|
171
|
+
* from: '0x...',
|
|
172
|
+
* amount: 100n,
|
|
173
|
+
* token: '0x...',
|
|
174
|
+
* })
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @param config - Config.
|
|
178
|
+
* @param parameters - Parameters.
|
|
179
|
+
* @returns The transaction receipt and event data.
|
|
180
|
+
*/
|
|
181
|
+
export async function burnBlockedSync(config, parameters) {
|
|
182
|
+
const { account, chainId, connector } = parameters;
|
|
183
|
+
const client = await getConnectorClient(config, {
|
|
184
|
+
account,
|
|
185
|
+
assertChainId: false,
|
|
186
|
+
chainId,
|
|
187
|
+
connector,
|
|
188
|
+
});
|
|
189
|
+
return Actions.token.burnBlockedSync(client, parameters);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Burns TIP20 tokens from the caller's balance.
|
|
193
|
+
*
|
|
194
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
195
|
+
* be included on a block before returning a response.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
200
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
201
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
202
|
+
*
|
|
203
|
+
* const config = createConfig({
|
|
204
|
+
* chains: [tempo],
|
|
205
|
+
* transports: {
|
|
206
|
+
* [tempo.id]: http(),
|
|
207
|
+
* },
|
|
208
|
+
* })
|
|
209
|
+
*
|
|
210
|
+
* const result = await Actions.token.burnSync(config, {
|
|
211
|
+
* amount: 100n,
|
|
212
|
+
* token: '0x...',
|
|
213
|
+
* })
|
|
214
|
+
* ```
|
|
215
|
+
*
|
|
216
|
+
* @param config - Config.
|
|
217
|
+
* @param parameters - Parameters.
|
|
218
|
+
* @returns The transaction receipt and event data.
|
|
219
|
+
*/
|
|
220
|
+
export async function burnSync(config, parameters) {
|
|
221
|
+
const { account, chainId, connector } = parameters;
|
|
222
|
+
const client = await getConnectorClient(config, {
|
|
223
|
+
account,
|
|
224
|
+
assertChainId: false,
|
|
225
|
+
chainId,
|
|
226
|
+
connector,
|
|
227
|
+
});
|
|
228
|
+
return Actions.token.burnSync(client, parameters);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Changes the transfer policy ID for a TIP20 token.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
236
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
237
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
238
|
+
*
|
|
239
|
+
* const config = createConfig({
|
|
240
|
+
* chains: [tempo],
|
|
241
|
+
* transports: {
|
|
242
|
+
* [tempo.id]: http(),
|
|
243
|
+
* },
|
|
244
|
+
* })
|
|
245
|
+
*
|
|
246
|
+
* const hash = await Actions.token.changeTransferPolicy(config, {
|
|
247
|
+
* token: '0x...',
|
|
248
|
+
* policyId: 1n,
|
|
249
|
+
* })
|
|
250
|
+
* ```
|
|
251
|
+
*
|
|
252
|
+
* @param config - Config.
|
|
253
|
+
* @param parameters - Parameters.
|
|
254
|
+
* @returns Transaction hash.
|
|
255
|
+
*/
|
|
256
|
+
export async function changeTransferPolicy(config, parameters) {
|
|
257
|
+
const { account, chainId, connector } = parameters;
|
|
258
|
+
const client = await getConnectorClient(config, {
|
|
259
|
+
account,
|
|
260
|
+
assertChainId: false,
|
|
261
|
+
chainId,
|
|
262
|
+
connector,
|
|
263
|
+
});
|
|
264
|
+
return Actions.token.changeTransferPolicy(client, parameters);
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Changes the transfer policy ID for a TIP20 token.
|
|
268
|
+
*
|
|
269
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
270
|
+
* be included on a block before returning a response.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```ts
|
|
274
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
275
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
276
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
277
|
+
*
|
|
278
|
+
* const config = createConfig({
|
|
279
|
+
* chains: [tempo],
|
|
280
|
+
* transports: {
|
|
281
|
+
* [tempo.id]: http(),
|
|
282
|
+
* },
|
|
283
|
+
* })
|
|
284
|
+
*
|
|
285
|
+
* const result = await Actions.token.changeTransferPolicySync(config, {
|
|
286
|
+
* token: '0x...',
|
|
287
|
+
* policyId: 1n,
|
|
288
|
+
* })
|
|
289
|
+
* ```
|
|
290
|
+
*
|
|
291
|
+
* @param config - Config.
|
|
292
|
+
* @param parameters - Parameters.
|
|
293
|
+
* @returns The transaction receipt and event data.
|
|
294
|
+
*/
|
|
295
|
+
export async function changeTransferPolicySync(config, parameters) {
|
|
296
|
+
const { account, chainId, connector } = parameters;
|
|
297
|
+
const client = await getConnectorClient(config, {
|
|
298
|
+
account,
|
|
299
|
+
assertChainId: false,
|
|
300
|
+
chainId,
|
|
301
|
+
connector,
|
|
302
|
+
});
|
|
303
|
+
return Actions.token.changeTransferPolicySync(client, parameters);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Creates a new TIP20 token.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
311
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
312
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
313
|
+
*
|
|
314
|
+
* const config = createConfig({
|
|
315
|
+
* chains: [tempo],
|
|
316
|
+
* transports: {
|
|
317
|
+
* [tempo.id]: http(),
|
|
318
|
+
* },
|
|
319
|
+
* })
|
|
320
|
+
*
|
|
321
|
+
* const hash = await Actions.token.create(config, {
|
|
322
|
+
* name: 'My Token',
|
|
323
|
+
* symbol: 'MTK',
|
|
324
|
+
* currency: 'USD',
|
|
325
|
+
* })
|
|
326
|
+
* ```
|
|
327
|
+
*
|
|
328
|
+
* @param config - Config.
|
|
329
|
+
* @param parameters - Parameters.
|
|
330
|
+
* @returns Transaction hash.
|
|
331
|
+
*/
|
|
332
|
+
export async function create(config, parameters) {
|
|
333
|
+
const { account, chainId, connector } = parameters;
|
|
334
|
+
const client = await getConnectorClient(config, {
|
|
335
|
+
account,
|
|
336
|
+
assertChainId: false,
|
|
337
|
+
chainId,
|
|
338
|
+
connector,
|
|
339
|
+
});
|
|
340
|
+
return Actions.token.create(client, parameters);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Creates a new TIP20 token.
|
|
344
|
+
*
|
|
345
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
346
|
+
* be included on a block before returning a response.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```ts
|
|
350
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
351
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
352
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
353
|
+
*
|
|
354
|
+
* const config = createConfig({
|
|
355
|
+
* chains: [tempo],
|
|
356
|
+
* transports: {
|
|
357
|
+
* [tempo.id]: http(),
|
|
358
|
+
* },
|
|
359
|
+
* })
|
|
360
|
+
*
|
|
361
|
+
* const result = await Actions.token.createSync(config, {
|
|
362
|
+
* name: 'My Token',
|
|
363
|
+
* symbol: 'MTK',
|
|
364
|
+
* currency: 'USD',
|
|
365
|
+
* })
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* @param config - Config.
|
|
369
|
+
* @param parameters - Parameters.
|
|
370
|
+
* @returns The transaction receipt and event data.
|
|
371
|
+
*/
|
|
372
|
+
export async function createSync(config, parameters) {
|
|
373
|
+
const { account, chainId, connector } = parameters;
|
|
374
|
+
const client = await getConnectorClient(config, {
|
|
375
|
+
account,
|
|
376
|
+
assertChainId: false,
|
|
377
|
+
chainId,
|
|
378
|
+
connector,
|
|
379
|
+
});
|
|
380
|
+
return Actions.token.createSync(client, parameters);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Updates the quote token for a TIP20 token.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```ts
|
|
387
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
388
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
389
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
390
|
+
*
|
|
391
|
+
* const config = createConfig({
|
|
392
|
+
* chains: [tempo],
|
|
393
|
+
* transports: {
|
|
394
|
+
* [tempo.id]: http(),
|
|
395
|
+
* },
|
|
396
|
+
* })
|
|
397
|
+
*
|
|
398
|
+
* const hash = await Actions.token.updateQuoteToken(config, {
|
|
399
|
+
* token: '0x...',
|
|
400
|
+
* })
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* @param config - Config.
|
|
404
|
+
* @param parameters - Parameters.
|
|
405
|
+
* @returns Transaction hash.
|
|
406
|
+
*/
|
|
407
|
+
export async function updateQuoteToken(config, parameters) {
|
|
408
|
+
const { account, chainId, connector } = parameters;
|
|
409
|
+
const client = await getConnectorClient(config, {
|
|
410
|
+
account,
|
|
411
|
+
assertChainId: false,
|
|
412
|
+
chainId,
|
|
413
|
+
connector,
|
|
414
|
+
});
|
|
415
|
+
return Actions.token.updateQuoteToken(client, parameters);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Updates the quote token for a TIP20 token.
|
|
419
|
+
*
|
|
420
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
421
|
+
* be included on a block before returning a response.
|
|
422
|
+
*
|
|
423
|
+
* @example
|
|
424
|
+
* ```ts
|
|
425
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
426
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
427
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
428
|
+
*
|
|
429
|
+
* const config = createConfig({
|
|
430
|
+
* chains: [tempo],
|
|
431
|
+
* transports: {
|
|
432
|
+
* [tempo.id]: http(),
|
|
433
|
+
* },
|
|
434
|
+
* })
|
|
435
|
+
*
|
|
436
|
+
* const result = await Actions.token.updateQuoteTokenSync(config, {
|
|
437
|
+
* token: '0x...',
|
|
438
|
+
* })
|
|
439
|
+
* ```
|
|
440
|
+
*
|
|
441
|
+
* @param config - Config.
|
|
442
|
+
* @param parameters - Parameters.
|
|
443
|
+
* @returns The transaction receipt and event data.
|
|
444
|
+
*/
|
|
445
|
+
export async function updateQuoteTokenSync(config, parameters) {
|
|
446
|
+
const { account, chainId, connector } = parameters;
|
|
447
|
+
const client = await getConnectorClient(config, {
|
|
448
|
+
account,
|
|
449
|
+
assertChainId: false,
|
|
450
|
+
chainId,
|
|
451
|
+
connector,
|
|
452
|
+
});
|
|
453
|
+
return Actions.token.updateQuoteTokenSync(client, parameters);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Gets TIP20 token allowance.
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```ts
|
|
460
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
461
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
462
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
463
|
+
*
|
|
464
|
+
* const config = createConfig({
|
|
465
|
+
* chains: [tempo],
|
|
466
|
+
* transports: {
|
|
467
|
+
* [tempo.id]: http(),
|
|
468
|
+
* },
|
|
469
|
+
* })
|
|
470
|
+
*
|
|
471
|
+
* const allowance = await Actions.token.getAllowance(config, {
|
|
472
|
+
* account: '0x...',
|
|
473
|
+
* spender: '0x...',
|
|
474
|
+
* })
|
|
475
|
+
* ```
|
|
476
|
+
*
|
|
477
|
+
* @param config - Config.
|
|
478
|
+
* @param parameters - Parameters.
|
|
479
|
+
* @returns The token allowance.
|
|
480
|
+
*/
|
|
481
|
+
export function getAllowance(config, parameters) {
|
|
482
|
+
const { chainId, ...rest } = parameters;
|
|
483
|
+
const client = config.getClient({ chainId });
|
|
484
|
+
return Actions.token.getAllowance(client, rest);
|
|
485
|
+
}
|
|
486
|
+
(function (getAllowance) {
|
|
487
|
+
function queryKey(parameters) {
|
|
488
|
+
return ['getAllowance', parameters];
|
|
489
|
+
}
|
|
490
|
+
getAllowance.queryKey = queryKey;
|
|
491
|
+
function queryOptions(config, parameters) {
|
|
492
|
+
const { query, ...rest } = parameters;
|
|
493
|
+
return {
|
|
494
|
+
...query,
|
|
495
|
+
enabled: Boolean(rest.account && rest.spender && rest.token && (query?.enabled ?? true)),
|
|
496
|
+
queryKey: queryKey(rest),
|
|
497
|
+
async queryFn(context) {
|
|
498
|
+
const [, parameters] = context.queryKey;
|
|
499
|
+
return await getAllowance(config, parameters);
|
|
500
|
+
},
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
getAllowance.queryOptions = queryOptions;
|
|
504
|
+
})(getAllowance || (getAllowance = {}));
|
|
505
|
+
/**
|
|
506
|
+
* Gets TIP20 token balance for an address.
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* ```ts
|
|
510
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
511
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
512
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
513
|
+
*
|
|
514
|
+
* const config = createConfig({
|
|
515
|
+
* chains: [tempo],
|
|
516
|
+
* transports: {
|
|
517
|
+
* [tempo.id]: http(),
|
|
518
|
+
* },
|
|
519
|
+
* })
|
|
520
|
+
*
|
|
521
|
+
* const balance = await Actions.token.getBalance(config, {
|
|
522
|
+
* account: '0x...',
|
|
523
|
+
* })
|
|
524
|
+
* ```
|
|
525
|
+
*
|
|
526
|
+
* @param config - Config.
|
|
527
|
+
* @param parameters - Parameters.
|
|
528
|
+
* @returns The token balance.
|
|
529
|
+
*/
|
|
530
|
+
export function getBalance(config, parameters) {
|
|
531
|
+
const { chainId, ...rest } = parameters;
|
|
532
|
+
const client = config.getClient({ chainId });
|
|
533
|
+
return Actions.token.getBalance(client, rest);
|
|
534
|
+
}
|
|
535
|
+
(function (getBalance) {
|
|
536
|
+
function queryKey(parameters) {
|
|
537
|
+
return ['getBalance', parameters];
|
|
538
|
+
}
|
|
539
|
+
getBalance.queryKey = queryKey;
|
|
540
|
+
function queryOptions(config, parameters) {
|
|
541
|
+
const { query, ...rest } = parameters;
|
|
542
|
+
return {
|
|
543
|
+
...query,
|
|
544
|
+
enabled: Boolean(rest.account && rest.token && (query?.enabled ?? true)),
|
|
545
|
+
queryKey: queryKey(rest),
|
|
546
|
+
async queryFn(context) {
|
|
547
|
+
const [, parameters] = context.queryKey;
|
|
548
|
+
return (await getBalance(config, parameters)) ?? null;
|
|
549
|
+
},
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
getBalance.queryOptions = queryOptions;
|
|
553
|
+
})(getBalance || (getBalance = {}));
|
|
554
|
+
/**
|
|
555
|
+
* Gets TIP20 token metadata.
|
|
556
|
+
*
|
|
557
|
+
* @example
|
|
558
|
+
* ```ts
|
|
559
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
560
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
561
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
562
|
+
*
|
|
563
|
+
* const config = createConfig({
|
|
564
|
+
* chains: [tempo],
|
|
565
|
+
* transports: {
|
|
566
|
+
* [tempo.id]: http(),
|
|
567
|
+
* },
|
|
568
|
+
* })
|
|
569
|
+
*
|
|
570
|
+
* const metadata = await Actions.token.getMetadata(config, {
|
|
571
|
+
* token: '0x...',
|
|
572
|
+
* })
|
|
573
|
+
* ```
|
|
574
|
+
*
|
|
575
|
+
* @param config - Config.
|
|
576
|
+
* @param parameters - Parameters.
|
|
577
|
+
* @returns The token metadata.
|
|
578
|
+
*/
|
|
579
|
+
export function getMetadata(config, parameters) {
|
|
580
|
+
const { chainId, ...rest } = parameters;
|
|
581
|
+
const client = config.getClient({ chainId });
|
|
582
|
+
return Actions.token.getMetadata(client, rest);
|
|
583
|
+
}
|
|
584
|
+
(function (getMetadata) {
|
|
585
|
+
function queryKey(parameters) {
|
|
586
|
+
return ['getMetadata', parameters];
|
|
587
|
+
}
|
|
588
|
+
getMetadata.queryKey = queryKey;
|
|
589
|
+
function queryOptions(config, parameters) {
|
|
590
|
+
const { query, ...rest } = parameters;
|
|
591
|
+
return {
|
|
592
|
+
...query,
|
|
593
|
+
enabled: Boolean(rest.token && (query?.enabled ?? true)),
|
|
594
|
+
queryKey: queryKey(rest),
|
|
595
|
+
async queryFn(context) {
|
|
596
|
+
const [, parameters] = context.queryKey;
|
|
597
|
+
return await getMetadata(config, parameters);
|
|
598
|
+
},
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
getMetadata.queryOptions = queryOptions;
|
|
602
|
+
})(getMetadata || (getMetadata = {}));
|
|
603
|
+
/**
|
|
604
|
+
* Gets the admin role for a specific role in a TIP20 token.
|
|
605
|
+
*
|
|
606
|
+
* @example
|
|
607
|
+
* ```ts
|
|
608
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
609
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
610
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
611
|
+
*
|
|
612
|
+
* const config = createConfig({
|
|
613
|
+
* chains: [tempo],
|
|
614
|
+
* transports: {
|
|
615
|
+
* [tempo.id]: http(),
|
|
616
|
+
* },
|
|
617
|
+
* })
|
|
618
|
+
*
|
|
619
|
+
* const adminRole = await Actions.token.getRoleAdmin(config, {
|
|
620
|
+
* role: 'issuer',
|
|
621
|
+
* token: '0x...',
|
|
622
|
+
* })
|
|
623
|
+
* ```
|
|
624
|
+
*
|
|
625
|
+
* @param config - Config.
|
|
626
|
+
* @param parameters - Parameters.
|
|
627
|
+
* @returns The admin role hash.
|
|
628
|
+
*/
|
|
629
|
+
export function getRoleAdmin(config, parameters) {
|
|
630
|
+
const { chainId, ...rest } = parameters;
|
|
631
|
+
const client = config.getClient({ chainId });
|
|
632
|
+
return Actions.token.getRoleAdmin(client, rest);
|
|
633
|
+
}
|
|
634
|
+
(function (getRoleAdmin) {
|
|
635
|
+
function queryKey(parameters) {
|
|
636
|
+
return ['getRoleAdmin', parameters];
|
|
637
|
+
}
|
|
638
|
+
getRoleAdmin.queryKey = queryKey;
|
|
639
|
+
function queryOptions(config, parameters) {
|
|
640
|
+
const { query, ...rest } = parameters;
|
|
641
|
+
return {
|
|
642
|
+
...query,
|
|
643
|
+
enabled: Boolean(rest.token && rest.role && (query?.enabled ?? true)),
|
|
644
|
+
queryKey: queryKey(rest),
|
|
645
|
+
async queryFn(context) {
|
|
646
|
+
const [, parameters] = context.queryKey;
|
|
647
|
+
return await getRoleAdmin(config, parameters);
|
|
648
|
+
},
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
getRoleAdmin.queryOptions = queryOptions;
|
|
652
|
+
})(getRoleAdmin || (getRoleAdmin = {}));
|
|
653
|
+
/**
|
|
654
|
+
* Grants a role for a TIP20 token.
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* ```ts
|
|
658
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
659
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
660
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
661
|
+
*
|
|
662
|
+
* const config = createConfig({
|
|
663
|
+
* chains: [tempo],
|
|
664
|
+
* transports: {
|
|
665
|
+
* [tempo.id]: http(),
|
|
666
|
+
* },
|
|
667
|
+
* })
|
|
668
|
+
*
|
|
669
|
+
* const hash = await Actions.token.grantRoles(config, {
|
|
670
|
+
* token: '0x...',
|
|
671
|
+
* to: '0x...',
|
|
672
|
+
* roles: ['issuer'],
|
|
673
|
+
* })
|
|
674
|
+
* ```
|
|
675
|
+
*
|
|
676
|
+
* @param config - Config.
|
|
677
|
+
* @param parameters - Parameters.
|
|
678
|
+
* @returns Transaction hash.
|
|
679
|
+
*/
|
|
680
|
+
export async function grantRoles(config, parameters) {
|
|
681
|
+
const { account, chainId, connector } = parameters;
|
|
682
|
+
const client = await getConnectorClient(config, {
|
|
683
|
+
account,
|
|
684
|
+
assertChainId: false,
|
|
685
|
+
chainId,
|
|
686
|
+
connector,
|
|
687
|
+
});
|
|
688
|
+
return Actions.token.grantRoles(client, parameters);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Grants a role for a TIP20 token.
|
|
692
|
+
*
|
|
693
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
694
|
+
* be included on a block before returning a response.
|
|
695
|
+
*
|
|
696
|
+
* @example
|
|
697
|
+
* ```ts
|
|
698
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
699
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
700
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
701
|
+
*
|
|
702
|
+
* const config = createConfig({
|
|
703
|
+
* chains: [tempo],
|
|
704
|
+
* transports: {
|
|
705
|
+
* [tempo.id]: http(),
|
|
706
|
+
* },
|
|
707
|
+
* })
|
|
708
|
+
*
|
|
709
|
+
* const result = await Actions.token.grantRolesSync(config, {
|
|
710
|
+
* token: '0x...',
|
|
711
|
+
* to: '0x...',
|
|
712
|
+
* roles: ['issuer'],
|
|
713
|
+
* })
|
|
714
|
+
* ```
|
|
715
|
+
*
|
|
716
|
+
* @param config - Config.
|
|
717
|
+
* @param parameters - Parameters.
|
|
718
|
+
* @returns The transaction receipt and event data.
|
|
719
|
+
*/
|
|
720
|
+
export async function grantRolesSync(config, parameters) {
|
|
721
|
+
const { account, chainId, connector } = parameters;
|
|
722
|
+
const client = await getConnectorClient(config, {
|
|
723
|
+
account,
|
|
724
|
+
assertChainId: false,
|
|
725
|
+
chainId,
|
|
726
|
+
connector,
|
|
727
|
+
});
|
|
728
|
+
return Actions.token.grantRolesSync(client, parameters);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Checks if an account has a specific role for a TIP20 token.
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```ts
|
|
735
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
736
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
737
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
738
|
+
*
|
|
739
|
+
* const config = createConfig({
|
|
740
|
+
* chains: [tempo],
|
|
741
|
+
* transports: {
|
|
742
|
+
* [tempo.id]: http(),
|
|
743
|
+
* },
|
|
744
|
+
* })
|
|
745
|
+
*
|
|
746
|
+
* const hasRole = await Actions.token.hasRole(config, {
|
|
747
|
+
* account: '0x...',
|
|
748
|
+
* role: 'issuer',
|
|
749
|
+
* token: '0x...',
|
|
750
|
+
* })
|
|
751
|
+
* ```
|
|
752
|
+
*
|
|
753
|
+
* @param config - Config.
|
|
754
|
+
* @param parameters - Parameters.
|
|
755
|
+
* @returns Whether the account has the role.
|
|
756
|
+
*/
|
|
757
|
+
export function hasRole(config, parameters) {
|
|
758
|
+
const { chainId, ...rest } = parameters;
|
|
759
|
+
const client = config.getClient({ chainId });
|
|
760
|
+
return Actions.token.hasRole(client, rest);
|
|
761
|
+
}
|
|
762
|
+
(function (hasRole) {
|
|
763
|
+
function queryKey(parameters) {
|
|
764
|
+
return ['hasRole', parameters];
|
|
765
|
+
}
|
|
766
|
+
hasRole.queryKey = queryKey;
|
|
767
|
+
function queryOptions(config, parameters) {
|
|
768
|
+
const { query, ...rest } = parameters;
|
|
769
|
+
return {
|
|
770
|
+
...query,
|
|
771
|
+
enabled: Boolean(rest.token && rest.role && rest.account && (query?.enabled ?? true)),
|
|
772
|
+
queryKey: queryKey(rest),
|
|
773
|
+
async queryFn(context) {
|
|
774
|
+
const [, parameters] = context.queryKey;
|
|
775
|
+
return await hasRole(config, parameters);
|
|
776
|
+
},
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
hasRole.queryOptions = queryOptions;
|
|
780
|
+
})(hasRole || (hasRole = {}));
|
|
781
|
+
/**
|
|
782
|
+
* Mints TIP20 tokens to an address.
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* ```ts
|
|
786
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
787
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
788
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
789
|
+
*
|
|
790
|
+
* const config = createConfig({
|
|
791
|
+
* chains: [tempo],
|
|
792
|
+
* transports: {
|
|
793
|
+
* [tempo.id]: http(),
|
|
794
|
+
* },
|
|
795
|
+
* })
|
|
796
|
+
*
|
|
797
|
+
* const hash = await Actions.token.mint(config, {
|
|
798
|
+
* to: '0x...',
|
|
799
|
+
* amount: 100n,
|
|
800
|
+
* token: '0x...',
|
|
801
|
+
* })
|
|
802
|
+
* ```
|
|
803
|
+
*
|
|
804
|
+
* @param config - Config.
|
|
805
|
+
* @param parameters - Parameters.
|
|
806
|
+
* @returns Transaction hash.
|
|
807
|
+
*/
|
|
808
|
+
export async function mint(config, parameters) {
|
|
809
|
+
const { account, chainId, connector } = parameters;
|
|
810
|
+
const client = await getConnectorClient(config, {
|
|
811
|
+
account,
|
|
812
|
+
assertChainId: false,
|
|
813
|
+
chainId,
|
|
814
|
+
connector,
|
|
815
|
+
});
|
|
816
|
+
return Actions.token.mint(client, parameters);
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Mints TIP20 tokens to an address.
|
|
820
|
+
*
|
|
821
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
822
|
+
* be included on a block before returning a response.
|
|
823
|
+
*
|
|
824
|
+
* @example
|
|
825
|
+
* ```ts
|
|
826
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
827
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
828
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
829
|
+
*
|
|
830
|
+
* const config = createConfig({
|
|
831
|
+
* chains: [tempo],
|
|
832
|
+
* transports: {
|
|
833
|
+
* [tempo.id]: http(),
|
|
834
|
+
* },
|
|
835
|
+
* })
|
|
836
|
+
*
|
|
837
|
+
* const result = await Actions.token.mintSync(config, {
|
|
838
|
+
* to: '0x...',
|
|
839
|
+
* amount: 100n,
|
|
840
|
+
* token: '0x...',
|
|
841
|
+
* })
|
|
842
|
+
* ```
|
|
843
|
+
*
|
|
844
|
+
* @param config - Config.
|
|
845
|
+
* @param parameters - Parameters.
|
|
846
|
+
* @returns The transaction receipt and event data.
|
|
847
|
+
*/
|
|
848
|
+
export async function mintSync(config, parameters) {
|
|
849
|
+
const { account, chainId, connector } = parameters;
|
|
850
|
+
const client = await getConnectorClient(config, {
|
|
851
|
+
account,
|
|
852
|
+
assertChainId: false,
|
|
853
|
+
chainId,
|
|
854
|
+
connector,
|
|
855
|
+
});
|
|
856
|
+
return Actions.token.mintSync(client, parameters);
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Pauses a TIP20 token.
|
|
860
|
+
*
|
|
861
|
+
* @example
|
|
862
|
+
* ```ts
|
|
863
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
864
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
865
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
866
|
+
*
|
|
867
|
+
* const config = createConfig({
|
|
868
|
+
* chains: [tempo],
|
|
869
|
+
* transports: {
|
|
870
|
+
* [tempo.id]: http(),
|
|
871
|
+
* },
|
|
872
|
+
* })
|
|
873
|
+
*
|
|
874
|
+
* const hash = await Actions.token.pause(config, {
|
|
875
|
+
* token: '0x...',
|
|
876
|
+
* })
|
|
877
|
+
* ```
|
|
878
|
+
*
|
|
879
|
+
* @param config - Config.
|
|
880
|
+
* @param parameters - Parameters.
|
|
881
|
+
* @returns Transaction hash.
|
|
882
|
+
*/
|
|
883
|
+
export async function pause(config, parameters) {
|
|
884
|
+
const { account, chainId, connector } = parameters;
|
|
885
|
+
const client = await getConnectorClient(config, {
|
|
886
|
+
account,
|
|
887
|
+
assertChainId: false,
|
|
888
|
+
chainId,
|
|
889
|
+
connector,
|
|
890
|
+
});
|
|
891
|
+
return Actions.token.pause(client, parameters);
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Pauses a TIP20 token.
|
|
895
|
+
*
|
|
896
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
897
|
+
* be included on a block before returning a response.
|
|
898
|
+
*
|
|
899
|
+
* @example
|
|
900
|
+
* ```ts
|
|
901
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
902
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
903
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
904
|
+
*
|
|
905
|
+
* const config = createConfig({
|
|
906
|
+
* chains: [tempo],
|
|
907
|
+
* transports: {
|
|
908
|
+
* [tempo.id]: http(),
|
|
909
|
+
* },
|
|
910
|
+
* })
|
|
911
|
+
*
|
|
912
|
+
* const result = await Actions.token.pauseSync(config, {
|
|
913
|
+
* token: '0x...',
|
|
914
|
+
* })
|
|
915
|
+
* ```
|
|
916
|
+
*
|
|
917
|
+
* @param config - Config.
|
|
918
|
+
* @param parameters - Parameters.
|
|
919
|
+
* @returns The transaction receipt and event data.
|
|
920
|
+
*/
|
|
921
|
+
export async function pauseSync(config, parameters) {
|
|
922
|
+
const { account, chainId, connector } = parameters;
|
|
923
|
+
const client = await getConnectorClient(config, {
|
|
924
|
+
account,
|
|
925
|
+
assertChainId: false,
|
|
926
|
+
chainId,
|
|
927
|
+
connector,
|
|
928
|
+
});
|
|
929
|
+
return Actions.token.pauseSync(client, parameters);
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Renounces a role for a TIP20 token.
|
|
933
|
+
*
|
|
934
|
+
* @example
|
|
935
|
+
* ```ts
|
|
936
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
937
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
938
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
939
|
+
*
|
|
940
|
+
* const config = createConfig({
|
|
941
|
+
* chains: [tempo],
|
|
942
|
+
* transports: {
|
|
943
|
+
* [tempo.id]: http(),
|
|
944
|
+
* },
|
|
945
|
+
* })
|
|
946
|
+
*
|
|
947
|
+
* const hash = await Actions.token.renounceRoles(config, {
|
|
948
|
+
* token: '0x...',
|
|
949
|
+
* roles: ['issuer'],
|
|
950
|
+
* })
|
|
951
|
+
* ```
|
|
952
|
+
*
|
|
953
|
+
* @param config - Config.
|
|
954
|
+
* @param parameters - Parameters.
|
|
955
|
+
* @returns Transaction hash.
|
|
956
|
+
*/
|
|
957
|
+
export async function renounceRoles(config, parameters) {
|
|
958
|
+
const { account, chainId, connector } = parameters;
|
|
959
|
+
const client = await getConnectorClient(config, {
|
|
960
|
+
account,
|
|
961
|
+
assertChainId: false,
|
|
962
|
+
chainId,
|
|
963
|
+
connector,
|
|
964
|
+
});
|
|
965
|
+
return Actions.token.renounceRoles(client, parameters);
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Renounces a role for a TIP20 token.
|
|
969
|
+
*
|
|
970
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
971
|
+
* be included on a block before returning a response.
|
|
972
|
+
*
|
|
973
|
+
* @example
|
|
974
|
+
* ```ts
|
|
975
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
976
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
977
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
978
|
+
*
|
|
979
|
+
* const config = createConfig({
|
|
980
|
+
* chains: [tempo],
|
|
981
|
+
* transports: {
|
|
982
|
+
* [tempo.id]: http(),
|
|
983
|
+
* },
|
|
984
|
+
* })
|
|
985
|
+
*
|
|
986
|
+
* const result = await Actions.token.renounceRolesSync(config, {
|
|
987
|
+
* token: '0x...',
|
|
988
|
+
* roles: ['issuer'],
|
|
989
|
+
* })
|
|
990
|
+
* ```
|
|
991
|
+
*
|
|
992
|
+
* @param config - Config.
|
|
993
|
+
* @param parameters - Parameters.
|
|
994
|
+
* @returns The transaction receipt and event data.
|
|
995
|
+
*/
|
|
996
|
+
export async function renounceRolesSync(config, parameters) {
|
|
997
|
+
const { account, chainId, connector } = parameters;
|
|
998
|
+
const client = await getConnectorClient(config, {
|
|
999
|
+
account,
|
|
1000
|
+
assertChainId: false,
|
|
1001
|
+
chainId,
|
|
1002
|
+
connector,
|
|
1003
|
+
});
|
|
1004
|
+
return Actions.token.renounceRolesSync(client, parameters);
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Revokes a role for a TIP20 token.
|
|
1008
|
+
*
|
|
1009
|
+
* @example
|
|
1010
|
+
* ```ts
|
|
1011
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1012
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1013
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1014
|
+
*
|
|
1015
|
+
* const config = createConfig({
|
|
1016
|
+
* chains: [tempo],
|
|
1017
|
+
* transports: {
|
|
1018
|
+
* [tempo.id]: http(),
|
|
1019
|
+
* },
|
|
1020
|
+
* })
|
|
1021
|
+
*
|
|
1022
|
+
* const hash = await Actions.token.revokeRoles(config, {
|
|
1023
|
+
* token: '0x...',
|
|
1024
|
+
* from: '0x...',
|
|
1025
|
+
* roles: ['issuer'],
|
|
1026
|
+
* })
|
|
1027
|
+
* ```
|
|
1028
|
+
*
|
|
1029
|
+
* @param config - Config.
|
|
1030
|
+
* @param parameters - Parameters.
|
|
1031
|
+
* @returns Transaction hash.
|
|
1032
|
+
*/
|
|
1033
|
+
export async function revokeRoles(config, parameters) {
|
|
1034
|
+
const { account, chainId, connector } = parameters;
|
|
1035
|
+
const client = await getConnectorClient(config, {
|
|
1036
|
+
account,
|
|
1037
|
+
assertChainId: false,
|
|
1038
|
+
chainId,
|
|
1039
|
+
connector,
|
|
1040
|
+
});
|
|
1041
|
+
return Actions.token.revokeRoles(client, parameters);
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Revokes a role for a TIP20 token.
|
|
1045
|
+
*
|
|
1046
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
1047
|
+
* be included on a block before returning a response.
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* ```ts
|
|
1051
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1052
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1053
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1054
|
+
*
|
|
1055
|
+
* const config = createConfig({
|
|
1056
|
+
* chains: [tempo],
|
|
1057
|
+
* transports: {
|
|
1058
|
+
* [tempo.id]: http(),
|
|
1059
|
+
* },
|
|
1060
|
+
* })
|
|
1061
|
+
*
|
|
1062
|
+
* const result = await Actions.token.revokeRolesSync(config, {
|
|
1063
|
+
* token: '0x...',
|
|
1064
|
+
* from: '0x...',
|
|
1065
|
+
* roles: ['issuer'],
|
|
1066
|
+
* })
|
|
1067
|
+
* ```
|
|
1068
|
+
*
|
|
1069
|
+
* @param config - Config.
|
|
1070
|
+
* @param parameters - Parameters.
|
|
1071
|
+
* @returns The transaction receipt and event data.
|
|
1072
|
+
*/
|
|
1073
|
+
export async function revokeRolesSync(config, parameters) {
|
|
1074
|
+
const { account, chainId, connector } = parameters;
|
|
1075
|
+
const client = await getConnectorClient(config, {
|
|
1076
|
+
account,
|
|
1077
|
+
assertChainId: false,
|
|
1078
|
+
chainId,
|
|
1079
|
+
connector,
|
|
1080
|
+
});
|
|
1081
|
+
return Actions.token.revokeRolesSync(client, parameters);
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Sets the admin role for a specific role in a TIP20 token.
|
|
1085
|
+
*
|
|
1086
|
+
* @example
|
|
1087
|
+
* ```ts
|
|
1088
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1089
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1090
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1091
|
+
*
|
|
1092
|
+
* const config = createConfig({
|
|
1093
|
+
* chains: [tempo],
|
|
1094
|
+
* transports: {
|
|
1095
|
+
* [tempo.id]: http(),
|
|
1096
|
+
* },
|
|
1097
|
+
* })
|
|
1098
|
+
*
|
|
1099
|
+
* const hash = await Actions.token.setRoleAdmin(config, {
|
|
1100
|
+
* token: '0x...',
|
|
1101
|
+
* role: 'issuer',
|
|
1102
|
+
* adminRole: 'pause',
|
|
1103
|
+
* })
|
|
1104
|
+
* ```
|
|
1105
|
+
*
|
|
1106
|
+
* @param config - Config.
|
|
1107
|
+
* @param parameters - Parameters.
|
|
1108
|
+
* @returns Transaction hash.
|
|
1109
|
+
*/
|
|
1110
|
+
export async function setRoleAdmin(config, parameters) {
|
|
1111
|
+
const { account, chainId, connector } = parameters;
|
|
1112
|
+
const client = await getConnectorClient(config, {
|
|
1113
|
+
account,
|
|
1114
|
+
assertChainId: false,
|
|
1115
|
+
chainId,
|
|
1116
|
+
connector,
|
|
1117
|
+
});
|
|
1118
|
+
return Actions.token.setRoleAdmin(client, parameters);
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Sets the admin role for a specific role in a TIP20 token.
|
|
1122
|
+
*
|
|
1123
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
1124
|
+
* be included on a block before returning a response.
|
|
1125
|
+
*
|
|
1126
|
+
* @example
|
|
1127
|
+
* ```ts
|
|
1128
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1129
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1130
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1131
|
+
*
|
|
1132
|
+
* const config = createConfig({
|
|
1133
|
+
* chains: [tempo],
|
|
1134
|
+
* transports: {
|
|
1135
|
+
* [tempo.id]: http(),
|
|
1136
|
+
* },
|
|
1137
|
+
* })
|
|
1138
|
+
*
|
|
1139
|
+
* const result = await Actions.token.setRoleAdminSync(config, {
|
|
1140
|
+
* token: '0x...',
|
|
1141
|
+
* role: 'issuer',
|
|
1142
|
+
* adminRole: 'pause',
|
|
1143
|
+
* })
|
|
1144
|
+
* ```
|
|
1145
|
+
*
|
|
1146
|
+
* @param config - Config.
|
|
1147
|
+
* @param parameters - Parameters.
|
|
1148
|
+
* @returns The transaction receipt and event data.
|
|
1149
|
+
*/
|
|
1150
|
+
export async function setRoleAdminSync(config, parameters) {
|
|
1151
|
+
const { account, chainId, connector } = parameters;
|
|
1152
|
+
const client = await getConnectorClient(config, {
|
|
1153
|
+
account,
|
|
1154
|
+
assertChainId: false,
|
|
1155
|
+
chainId,
|
|
1156
|
+
connector,
|
|
1157
|
+
});
|
|
1158
|
+
return Actions.token.setRoleAdminSync(client, parameters);
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Sets the supply cap for a TIP20 token.
|
|
1162
|
+
*
|
|
1163
|
+
* @example
|
|
1164
|
+
* ```ts
|
|
1165
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1166
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1167
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1168
|
+
*
|
|
1169
|
+
* const config = createConfig({
|
|
1170
|
+
* chains: [tempo],
|
|
1171
|
+
* transports: {
|
|
1172
|
+
* [tempo.id]: http(),
|
|
1173
|
+
* },
|
|
1174
|
+
* })
|
|
1175
|
+
*
|
|
1176
|
+
* const hash = await Actions.token.setSupplyCap(config, {
|
|
1177
|
+
* token: '0x...',
|
|
1178
|
+
* supplyCap: 1000000n,
|
|
1179
|
+
* })
|
|
1180
|
+
* ```
|
|
1181
|
+
*
|
|
1182
|
+
* @param config - Config.
|
|
1183
|
+
* @param parameters - Parameters.
|
|
1184
|
+
* @returns Transaction hash.
|
|
1185
|
+
*/
|
|
1186
|
+
export async function setSupplyCap(config, parameters) {
|
|
1187
|
+
const { account, chainId, connector } = parameters;
|
|
1188
|
+
const client = await getConnectorClient(config, {
|
|
1189
|
+
account,
|
|
1190
|
+
assertChainId: false,
|
|
1191
|
+
chainId,
|
|
1192
|
+
connector,
|
|
1193
|
+
});
|
|
1194
|
+
return Actions.token.setSupplyCap(client, parameters);
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Sets the supply cap for a TIP20 token.
|
|
1198
|
+
*
|
|
1199
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
1200
|
+
* be included on a block before returning a response.
|
|
1201
|
+
*
|
|
1202
|
+
* @example
|
|
1203
|
+
* ```ts
|
|
1204
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1205
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1206
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1207
|
+
*
|
|
1208
|
+
* const config = createConfig({
|
|
1209
|
+
* chains: [tempo],
|
|
1210
|
+
* transports: {
|
|
1211
|
+
* [tempo.id]: http(),
|
|
1212
|
+
* },
|
|
1213
|
+
* })
|
|
1214
|
+
*
|
|
1215
|
+
* const result = await Actions.token.setSupplyCapSync(config, {
|
|
1216
|
+
* token: '0x...',
|
|
1217
|
+
* supplyCap: 1000000n,
|
|
1218
|
+
* })
|
|
1219
|
+
* ```
|
|
1220
|
+
*
|
|
1221
|
+
* @param config - Config.
|
|
1222
|
+
* @param parameters - Parameters.
|
|
1223
|
+
* @returns The transaction receipt and event data.
|
|
1224
|
+
*/
|
|
1225
|
+
export async function setSupplyCapSync(config, parameters) {
|
|
1226
|
+
const { account, chainId, connector } = parameters;
|
|
1227
|
+
const client = await getConnectorClient(config, {
|
|
1228
|
+
account,
|
|
1229
|
+
assertChainId: false,
|
|
1230
|
+
chainId,
|
|
1231
|
+
connector,
|
|
1232
|
+
});
|
|
1233
|
+
return Actions.token.setSupplyCapSync(client, parameters);
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Transfers TIP20 tokens to another address.
|
|
1237
|
+
*
|
|
1238
|
+
* @example
|
|
1239
|
+
* ```ts
|
|
1240
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1241
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1242
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1243
|
+
*
|
|
1244
|
+
* const config = createConfig({
|
|
1245
|
+
* chains: [tempo],
|
|
1246
|
+
* transports: {
|
|
1247
|
+
* [tempo.id]: http(),
|
|
1248
|
+
* },
|
|
1249
|
+
* })
|
|
1250
|
+
*
|
|
1251
|
+
* const hash = await Actions.token.transfer(config, {
|
|
1252
|
+
* to: '0x...',
|
|
1253
|
+
* amount: 100n,
|
|
1254
|
+
* })
|
|
1255
|
+
* ```
|
|
1256
|
+
*
|
|
1257
|
+
* @param config - Config.
|
|
1258
|
+
* @param parameters - Parameters.
|
|
1259
|
+
* @returns Transaction hash.
|
|
1260
|
+
*/
|
|
1261
|
+
export async function transfer(config, parameters) {
|
|
1262
|
+
const { account, chainId, connector } = parameters;
|
|
1263
|
+
const client = await getConnectorClient(config, {
|
|
1264
|
+
account,
|
|
1265
|
+
assertChainId: false,
|
|
1266
|
+
chainId,
|
|
1267
|
+
connector,
|
|
1268
|
+
});
|
|
1269
|
+
return Actions.token.transfer(client, parameters);
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Transfers TIP20 tokens to another address.
|
|
1273
|
+
*
|
|
1274
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
1275
|
+
* be included on a block before returning a response.
|
|
1276
|
+
*
|
|
1277
|
+
* @example
|
|
1278
|
+
* ```ts
|
|
1279
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1280
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1281
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1282
|
+
*
|
|
1283
|
+
* const config = createConfig({
|
|
1284
|
+
* chains: [tempo],
|
|
1285
|
+
* transports: {
|
|
1286
|
+
* [tempo.id]: http(),
|
|
1287
|
+
* },
|
|
1288
|
+
* })
|
|
1289
|
+
*
|
|
1290
|
+
* const result = await Actions.token.transferSync(config, {
|
|
1291
|
+
* to: '0x...',
|
|
1292
|
+
* amount: 100n,
|
|
1293
|
+
* })
|
|
1294
|
+
* ```
|
|
1295
|
+
*
|
|
1296
|
+
* @param config - Config.
|
|
1297
|
+
* @param parameters - Parameters.
|
|
1298
|
+
* @returns The transaction receipt and event data.
|
|
1299
|
+
*/
|
|
1300
|
+
export async function transferSync(config, parameters) {
|
|
1301
|
+
const { account, chainId, connector } = parameters;
|
|
1302
|
+
const client = await getConnectorClient(config, {
|
|
1303
|
+
account,
|
|
1304
|
+
assertChainId: false,
|
|
1305
|
+
chainId,
|
|
1306
|
+
connector,
|
|
1307
|
+
});
|
|
1308
|
+
return Actions.token.transferSync(client, parameters);
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Unpauses a TIP20 token.
|
|
1312
|
+
*
|
|
1313
|
+
* @example
|
|
1314
|
+
* ```ts
|
|
1315
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1316
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1317
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1318
|
+
*
|
|
1319
|
+
* const config = createConfig({
|
|
1320
|
+
* chains: [tempo],
|
|
1321
|
+
* transports: {
|
|
1322
|
+
* [tempo.id]: http(),
|
|
1323
|
+
* },
|
|
1324
|
+
* })
|
|
1325
|
+
*
|
|
1326
|
+
* const hash = await Actions.token.unpause(config, {
|
|
1327
|
+
* token: '0x...',
|
|
1328
|
+
* })
|
|
1329
|
+
* ```
|
|
1330
|
+
*
|
|
1331
|
+
* @param config - Config.
|
|
1332
|
+
* @param parameters - Parameters.
|
|
1333
|
+
* @returns Transaction hash.
|
|
1334
|
+
*/
|
|
1335
|
+
export async function unpause(config, parameters) {
|
|
1336
|
+
const { account, chainId, connector } = parameters;
|
|
1337
|
+
const client = await getConnectorClient(config, {
|
|
1338
|
+
account,
|
|
1339
|
+
assertChainId: false,
|
|
1340
|
+
chainId,
|
|
1341
|
+
connector,
|
|
1342
|
+
});
|
|
1343
|
+
return Actions.token.unpause(client, parameters);
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Unpauses a TIP20 token.
|
|
1347
|
+
*
|
|
1348
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
1349
|
+
* be included on a block before returning a response.
|
|
1350
|
+
*
|
|
1351
|
+
* @example
|
|
1352
|
+
* ```ts
|
|
1353
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1354
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1355
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1356
|
+
*
|
|
1357
|
+
* const config = createConfig({
|
|
1358
|
+
* chains: [tempo],
|
|
1359
|
+
* transports: {
|
|
1360
|
+
* [tempo.id]: http(),
|
|
1361
|
+
* },
|
|
1362
|
+
* })
|
|
1363
|
+
*
|
|
1364
|
+
* const result = await Actions.token.unpauseSync(config, {
|
|
1365
|
+
* token: '0x...',
|
|
1366
|
+
* })
|
|
1367
|
+
* ```
|
|
1368
|
+
*
|
|
1369
|
+
* @param config - Config.
|
|
1370
|
+
* @param parameters - Parameters.
|
|
1371
|
+
* @returns The transaction receipt and event data.
|
|
1372
|
+
*/
|
|
1373
|
+
export async function unpauseSync(config, parameters) {
|
|
1374
|
+
const { account, chainId, connector } = parameters;
|
|
1375
|
+
const client = await getConnectorClient(config, {
|
|
1376
|
+
account,
|
|
1377
|
+
assertChainId: false,
|
|
1378
|
+
chainId,
|
|
1379
|
+
connector,
|
|
1380
|
+
});
|
|
1381
|
+
return Actions.token.unpauseSync(client, parameters);
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Prepares the quote token update for a TIP20 token.
|
|
1385
|
+
*
|
|
1386
|
+
* @example
|
|
1387
|
+
* ```ts
|
|
1388
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1389
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1390
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1391
|
+
*
|
|
1392
|
+
* const config = createConfig({
|
|
1393
|
+
* chains: [tempo],
|
|
1394
|
+
* transports: {
|
|
1395
|
+
* [tempo.id]: http(),
|
|
1396
|
+
* },
|
|
1397
|
+
* })
|
|
1398
|
+
*
|
|
1399
|
+
* const hash = await Actions.token.prepareUpdateQuoteToken(config, {
|
|
1400
|
+
* token: '0x...',
|
|
1401
|
+
* quoteToken: '0x...',
|
|
1402
|
+
* })
|
|
1403
|
+
* ```
|
|
1404
|
+
*
|
|
1405
|
+
* @param config - Config.
|
|
1406
|
+
* @param parameters - Parameters.
|
|
1407
|
+
* @returns Transaction hash.
|
|
1408
|
+
*/
|
|
1409
|
+
export async function prepareUpdateQuoteToken(config, parameters) {
|
|
1410
|
+
const { account, chainId, connector } = parameters;
|
|
1411
|
+
const client = await getConnectorClient(config, {
|
|
1412
|
+
account,
|
|
1413
|
+
assertChainId: false,
|
|
1414
|
+
chainId,
|
|
1415
|
+
connector,
|
|
1416
|
+
});
|
|
1417
|
+
return Actions.token.prepareUpdateQuoteToken(client, parameters);
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Prepares the quote token update for a TIP20 token.
|
|
1421
|
+
*
|
|
1422
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
1423
|
+
* be included on a block before returning a response.
|
|
1424
|
+
*
|
|
1425
|
+
* @example
|
|
1426
|
+
* ```ts
|
|
1427
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1428
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1429
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1430
|
+
*
|
|
1431
|
+
* const config = createConfig({
|
|
1432
|
+
* chains: [tempo],
|
|
1433
|
+
* transports: {
|
|
1434
|
+
* [tempo.id]: http(),
|
|
1435
|
+
* },
|
|
1436
|
+
* })
|
|
1437
|
+
*
|
|
1438
|
+
* const result = await Actions.token.prepareUpdateQuoteTokenSync(config, {
|
|
1439
|
+
* token: '0x...',
|
|
1440
|
+
* quoteToken: '0x...',
|
|
1441
|
+
* })
|
|
1442
|
+
* ```
|
|
1443
|
+
*
|
|
1444
|
+
* @param config - Config.
|
|
1445
|
+
* @param parameters - Parameters.
|
|
1446
|
+
* @returns The transaction receipt and event data.
|
|
1447
|
+
*/
|
|
1448
|
+
export async function prepareUpdateQuoteTokenSync(config, parameters) {
|
|
1449
|
+
const { account, chainId, connector } = parameters;
|
|
1450
|
+
const client = await getConnectorClient(config, {
|
|
1451
|
+
account,
|
|
1452
|
+
assertChainId: false,
|
|
1453
|
+
chainId,
|
|
1454
|
+
connector,
|
|
1455
|
+
});
|
|
1456
|
+
return Actions.token.prepareUpdateQuoteTokenSync(client, parameters);
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Watches for TIP20 token role admin updates.
|
|
1460
|
+
*
|
|
1461
|
+
* @example
|
|
1462
|
+
* ```ts
|
|
1463
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1464
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1465
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1466
|
+
*
|
|
1467
|
+
* const config = createConfig({
|
|
1468
|
+
* chains: [tempo],
|
|
1469
|
+
* transports: {
|
|
1470
|
+
* [tempo.id]: http(),
|
|
1471
|
+
* },
|
|
1472
|
+
* })
|
|
1473
|
+
*
|
|
1474
|
+
* const unwatch = Actions.token.watchAdminRole(config, {
|
|
1475
|
+
* onRoleAdminUpdated: (args, log) => {
|
|
1476
|
+
* console.log('Role admin updated:', args)
|
|
1477
|
+
* },
|
|
1478
|
+
* })
|
|
1479
|
+
* ```
|
|
1480
|
+
*
|
|
1481
|
+
* @param config - Config.
|
|
1482
|
+
* @param parameters - Parameters.
|
|
1483
|
+
* @returns A function to unsubscribe from the event.
|
|
1484
|
+
*/
|
|
1485
|
+
export function watchAdminRole(config, parameters) {
|
|
1486
|
+
const { chainId, ...rest } = parameters;
|
|
1487
|
+
const client = config.getClient({ chainId });
|
|
1488
|
+
return Actions.token.watchAdminRole(client, rest);
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Watches for TIP20 token approval events.
|
|
1492
|
+
*
|
|
1493
|
+
* @example
|
|
1494
|
+
* ```ts
|
|
1495
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1496
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1497
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1498
|
+
*
|
|
1499
|
+
* const config = createConfig({
|
|
1500
|
+
* chains: [tempo],
|
|
1501
|
+
* transports: {
|
|
1502
|
+
* [tempo.id]: http(),
|
|
1503
|
+
* },
|
|
1504
|
+
* })
|
|
1505
|
+
*
|
|
1506
|
+
* const unwatch = Actions.token.watchApprove(config, {
|
|
1507
|
+
* onApproval: (args, log) => {
|
|
1508
|
+
* console.log('Approval:', args)
|
|
1509
|
+
* },
|
|
1510
|
+
* })
|
|
1511
|
+
* ```
|
|
1512
|
+
*
|
|
1513
|
+
* @param config - Config.
|
|
1514
|
+
* @param parameters - Parameters.
|
|
1515
|
+
* @returns A function to unsubscribe from the event.
|
|
1516
|
+
*/
|
|
1517
|
+
export function watchApprove(config, parameters) {
|
|
1518
|
+
const { chainId, ...rest } = parameters;
|
|
1519
|
+
const client = config.getClient({ chainId });
|
|
1520
|
+
return Actions.token.watchApprove(client, rest);
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Watches for TIP20 token burn events.
|
|
1524
|
+
*
|
|
1525
|
+
* @example
|
|
1526
|
+
* ```ts
|
|
1527
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1528
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1529
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1530
|
+
*
|
|
1531
|
+
* const config = createConfig({
|
|
1532
|
+
* chains: [tempo],
|
|
1533
|
+
* transports: {
|
|
1534
|
+
* [tempo.id]: http(),
|
|
1535
|
+
* },
|
|
1536
|
+
* })
|
|
1537
|
+
*
|
|
1538
|
+
* const unwatch = Actions.token.watchBurn(config, {
|
|
1539
|
+
* onBurn: (args, log) => {
|
|
1540
|
+
* console.log('Burn:', args)
|
|
1541
|
+
* },
|
|
1542
|
+
* })
|
|
1543
|
+
* ```
|
|
1544
|
+
*
|
|
1545
|
+
* @param config - Config.
|
|
1546
|
+
* @param parameters - Parameters.
|
|
1547
|
+
* @returns A function to unsubscribe from the event.
|
|
1548
|
+
*/
|
|
1549
|
+
export function watchBurn(config, parameters) {
|
|
1550
|
+
const { chainId, ...rest } = parameters;
|
|
1551
|
+
const client = config.getClient({ chainId });
|
|
1552
|
+
return Actions.token.watchBurn(client, rest);
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Watches for new TIP20 tokens created.
|
|
1556
|
+
*
|
|
1557
|
+
* @example
|
|
1558
|
+
* ```ts
|
|
1559
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1560
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1561
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1562
|
+
*
|
|
1563
|
+
* const config = createConfig({
|
|
1564
|
+
* chains: [tempo],
|
|
1565
|
+
* transports: {
|
|
1566
|
+
* [tempo.id]: http(),
|
|
1567
|
+
* },
|
|
1568
|
+
* })
|
|
1569
|
+
*
|
|
1570
|
+
* const unwatch = Actions.token.watchCreate(config, {
|
|
1571
|
+
* onTokenCreated: (args, log) => {
|
|
1572
|
+
* console.log('Token created:', args)
|
|
1573
|
+
* },
|
|
1574
|
+
* })
|
|
1575
|
+
* ```
|
|
1576
|
+
*
|
|
1577
|
+
* @param config - Config.
|
|
1578
|
+
* @param parameters - Parameters.
|
|
1579
|
+
* @returns A function to unsubscribe from the event.
|
|
1580
|
+
*/
|
|
1581
|
+
export function watchCreate(config, parameters) {
|
|
1582
|
+
const { chainId, ...rest } = parameters;
|
|
1583
|
+
const client = config.getClient({ chainId });
|
|
1584
|
+
return Actions.token.watchCreate(client, rest);
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Watches for TIP20 token mint events.
|
|
1588
|
+
*
|
|
1589
|
+
* @example
|
|
1590
|
+
* ```ts
|
|
1591
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1592
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1593
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1594
|
+
*
|
|
1595
|
+
* const config = createConfig({
|
|
1596
|
+
* chains: [tempo],
|
|
1597
|
+
* transports: {
|
|
1598
|
+
* [tempo.id]: http(),
|
|
1599
|
+
* },
|
|
1600
|
+
* })
|
|
1601
|
+
*
|
|
1602
|
+
* const unwatch = Actions.token.watchMint(config, {
|
|
1603
|
+
* onMint: (args, log) => {
|
|
1604
|
+
* console.log('Mint:', args)
|
|
1605
|
+
* },
|
|
1606
|
+
* })
|
|
1607
|
+
* ```
|
|
1608
|
+
*
|
|
1609
|
+
* @param config - Config.
|
|
1610
|
+
* @param parameters - Parameters.
|
|
1611
|
+
* @returns A function to unsubscribe from the event.
|
|
1612
|
+
*/
|
|
1613
|
+
export function watchMint(config, parameters) {
|
|
1614
|
+
const { chainId, ...rest } = parameters;
|
|
1615
|
+
const client = config.getClient({ chainId });
|
|
1616
|
+
return Actions.token.watchMint(client, rest);
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Watches for TIP20 token role membership updates.
|
|
1620
|
+
*
|
|
1621
|
+
* @example
|
|
1622
|
+
* ```ts
|
|
1623
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1624
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1625
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1626
|
+
*
|
|
1627
|
+
* const config = createConfig({
|
|
1628
|
+
* chains: [tempo],
|
|
1629
|
+
* transports: {
|
|
1630
|
+
* [tempo.id]: http(),
|
|
1631
|
+
* },
|
|
1632
|
+
* })
|
|
1633
|
+
*
|
|
1634
|
+
* const unwatch = Actions.token.watchRole(config, {
|
|
1635
|
+
* onRoleUpdated: (args, log) => {
|
|
1636
|
+
* console.log('Role updated:', args)
|
|
1637
|
+
* },
|
|
1638
|
+
* })
|
|
1639
|
+
* ```
|
|
1640
|
+
*
|
|
1641
|
+
* @param config - Config.
|
|
1642
|
+
* @param parameters - Parameters.
|
|
1643
|
+
* @returns A function to unsubscribe from the event.
|
|
1644
|
+
*/
|
|
1645
|
+
export function watchRole(config, parameters) {
|
|
1646
|
+
const { chainId, ...rest } = parameters;
|
|
1647
|
+
const client = config.getClient({ chainId });
|
|
1648
|
+
return Actions.token.watchRole(client, rest);
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Watches for TIP20 token transfer events.
|
|
1652
|
+
*
|
|
1653
|
+
* @example
|
|
1654
|
+
* ```ts
|
|
1655
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1656
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1657
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1658
|
+
*
|
|
1659
|
+
* const config = createConfig({
|
|
1660
|
+
* chains: [tempo],
|
|
1661
|
+
* transports: {
|
|
1662
|
+
* [tempo.id]: http(),
|
|
1663
|
+
* },
|
|
1664
|
+
* })
|
|
1665
|
+
*
|
|
1666
|
+
* const unwatch = Actions.token.watchTransfer(config, {
|
|
1667
|
+
* onTransfer: (args, log) => {
|
|
1668
|
+
* console.log('Transfer:', args)
|
|
1669
|
+
* },
|
|
1670
|
+
* })
|
|
1671
|
+
* ```
|
|
1672
|
+
*
|
|
1673
|
+
* @param config - Config.
|
|
1674
|
+
* @param parameters - Parameters.
|
|
1675
|
+
* @returns A function to unsubscribe from the event.
|
|
1676
|
+
*/
|
|
1677
|
+
export function watchTransfer(config, parameters) {
|
|
1678
|
+
const { chainId, ...rest } = parameters;
|
|
1679
|
+
const client = config.getClient({ chainId });
|
|
1680
|
+
return Actions.token.watchTransfer(client, rest);
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Watches for TIP20 token quote token update events.
|
|
1684
|
+
*
|
|
1685
|
+
* @example
|
|
1686
|
+
* ```ts
|
|
1687
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
1688
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
1689
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
1690
|
+
*
|
|
1691
|
+
* const config = createConfig({
|
|
1692
|
+
* chains: [tempo],
|
|
1693
|
+
* transports: {
|
|
1694
|
+
* [tempo.id]: http(),
|
|
1695
|
+
* },
|
|
1696
|
+
* })
|
|
1697
|
+
*
|
|
1698
|
+
* const unwatch = Actions.token.watchUpdateQuoteToken(config, {
|
|
1699
|
+
* onUpdateQuoteToken: (args, log) => {
|
|
1700
|
+
* if (args.completed)
|
|
1701
|
+
* console.log('quote token update completed:', args.newQuoteToken)
|
|
1702
|
+
* else
|
|
1703
|
+
* console.log('quote token update proposed:', args.newQuoteToken)
|
|
1704
|
+
* },
|
|
1705
|
+
* })
|
|
1706
|
+
* ```
|
|
1707
|
+
*
|
|
1708
|
+
* @param config - Config.
|
|
1709
|
+
* @param parameters - Parameters.
|
|
1710
|
+
* @returns A function to unsubscribe from the event.
|
|
1711
|
+
*/
|
|
1712
|
+
export function watchUpdateQuoteToken(config, parameters) {
|
|
1713
|
+
const { chainId, ...rest } = parameters;
|
|
1714
|
+
const client = config.getClient({ chainId });
|
|
1715
|
+
return Actions.token.watchUpdateQuoteToken(client, rest);
|
|
1716
|
+
}
|
|
1717
|
+
//# sourceMappingURL=token.js.map
|