tempo.ts 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +28 -34
  3. package/package.json +2 -28
  4. package/dist/wagmi/Actions/amm.d.ts +0 -418
  5. package/dist/wagmi/Actions/amm.d.ts.map +0 -1
  6. package/dist/wagmi/Actions/amm.js +0 -462
  7. package/dist/wagmi/Actions/amm.js.map +0 -1
  8. package/dist/wagmi/Actions/dex.d.ts +0 -864
  9. package/dist/wagmi/Actions/dex.d.ts.map +0 -1
  10. package/dist/wagmi/Actions/dex.js +0 -968
  11. package/dist/wagmi/Actions/dex.js.map +0 -1
  12. package/dist/wagmi/Actions/faucet.d.ts +0 -66
  13. package/dist/wagmi/Actions/faucet.d.ts.map +0 -1
  14. package/dist/wagmi/Actions/faucet.js +0 -64
  15. package/dist/wagmi/Actions/faucet.js.map +0 -1
  16. package/dist/wagmi/Actions/fee.d.ts +0 -111
  17. package/dist/wagmi/Actions/fee.d.ts.map +0 -1
  18. package/dist/wagmi/Actions/fee.js +0 -126
  19. package/dist/wagmi/Actions/fee.js.map +0 -1
  20. package/dist/wagmi/Actions/index.d.ts +0 -9
  21. package/dist/wagmi/Actions/index.d.ts.map +0 -1
  22. package/dist/wagmi/Actions/index.js +0 -9
  23. package/dist/wagmi/Actions/index.js.map +0 -1
  24. package/dist/wagmi/Actions/nonce.d.ts +0 -77
  25. package/dist/wagmi/Actions/nonce.d.ts.map +0 -1
  26. package/dist/wagmi/Actions/nonce.js +0 -87
  27. package/dist/wagmi/Actions/nonce.js.map +0 -1
  28. package/dist/wagmi/Actions/policy.d.ts +0 -480
  29. package/dist/wagmi/Actions/policy.d.ts.map +0 -1
  30. package/dist/wagmi/Actions/policy.js +0 -530
  31. package/dist/wagmi/Actions/policy.js.map +0 -1
  32. package/dist/wagmi/Actions/reward.d.ts +0 -346
  33. package/dist/wagmi/Actions/reward.d.ts.map +0 -1
  34. package/dist/wagmi/Actions/reward.js +0 -382
  35. package/dist/wagmi/Actions/reward.js.map +0 -1
  36. package/dist/wagmi/Actions/token.d.ts +0 -1546
  37. package/dist/wagmi/Actions/token.d.ts.map +0 -1
  38. package/dist/wagmi/Actions/token.js +0 -1712
  39. package/dist/wagmi/Actions/token.js.map +0 -1
  40. package/dist/wagmi/Connector.d.ts +0 -91
  41. package/dist/wagmi/Connector.d.ts.map +0 -1
  42. package/dist/wagmi/Connector.js +0 -473
  43. package/dist/wagmi/Connector.js.map +0 -1
  44. package/dist/wagmi/Hooks/amm.d.ts +0 -411
  45. package/dist/wagmi/Hooks/amm.d.ts.map +0 -1
  46. package/dist/wagmi/Hooks/amm.js +0 -494
  47. package/dist/wagmi/Hooks/amm.js.map +0 -1
  48. package/dist/wagmi/Hooks/dex.d.ts +0 -773
  49. package/dist/wagmi/Hooks/dex.d.ts.map +0 -1
  50. package/dist/wagmi/Hooks/dex.js +0 -921
  51. package/dist/wagmi/Hooks/dex.js.map +0 -1
  52. package/dist/wagmi/Hooks/faucet.d.ts +0 -71
  53. package/dist/wagmi/Hooks/faucet.d.ts.map +0 -1
  54. package/dist/wagmi/Hooks/faucet.js +0 -76
  55. package/dist/wagmi/Hooks/faucet.js.map +0 -1
  56. package/dist/wagmi/Hooks/fee.d.ts +0 -97
  57. package/dist/wagmi/Hooks/fee.d.ts.map +0 -1
  58. package/dist/wagmi/Hooks/fee.js +0 -109
  59. package/dist/wagmi/Hooks/fee.js.map +0 -1
  60. package/dist/wagmi/Hooks/index.d.ts +0 -9
  61. package/dist/wagmi/Hooks/index.d.ts.map +0 -1
  62. package/dist/wagmi/Hooks/index.js +0 -9
  63. package/dist/wagmi/Hooks/index.js.map +0 -1
  64. package/dist/wagmi/Hooks/nonce.d.ts +0 -59
  65. package/dist/wagmi/Hooks/nonce.d.ts.map +0 -1
  66. package/dist/wagmi/Hooks/nonce.js +0 -75
  67. package/dist/wagmi/Hooks/nonce.js.map +0 -1
  68. package/dist/wagmi/Hooks/policy.d.ts +0 -423
  69. package/dist/wagmi/Hooks/policy.d.ts.map +0 -1
  70. package/dist/wagmi/Hooks/policy.js +0 -510
  71. package/dist/wagmi/Hooks/policy.js.map +0 -1
  72. package/dist/wagmi/Hooks/reward.d.ts +0 -305
  73. package/dist/wagmi/Hooks/reward.d.ts.map +0 -1
  74. package/dist/wagmi/Hooks/reward.js +0 -368
  75. package/dist/wagmi/Hooks/reward.js.map +0 -1
  76. package/dist/wagmi/Hooks/token.d.ts +0 -1388
  77. package/dist/wagmi/Hooks/token.d.ts.map +0 -1
  78. package/dist/wagmi/Hooks/token.js +0 -1657
  79. package/dist/wagmi/Hooks/token.js.map +0 -1
  80. package/dist/wagmi/KeyManager.d.ts +0 -60
  81. package/dist/wagmi/KeyManager.d.ts.map +0 -1
  82. package/dist/wagmi/KeyManager.js +0 -106
  83. package/dist/wagmi/KeyManager.js.map +0 -1
  84. package/dist/wagmi/index.d.ts +0 -5
  85. package/dist/wagmi/index.d.ts.map +0 -1
  86. package/dist/wagmi/index.js +0 -5
  87. package/dist/wagmi/index.js.map +0 -1
  88. package/src/wagmi/Actions/amm.test.ts +0 -208
  89. package/src/wagmi/Actions/amm.ts +0 -690
  90. package/src/wagmi/Actions/dex.test.ts +0 -1482
  91. package/src/wagmi/Actions/dex.ts +0 -1540
  92. package/src/wagmi/Actions/faucet.ts +0 -89
  93. package/src/wagmi/Actions/fee.test.ts +0 -63
  94. package/src/wagmi/Actions/fee.ts +0 -211
  95. package/src/wagmi/Actions/index.ts +0 -8
  96. package/src/wagmi/Actions/nonce.test.ts +0 -82
  97. package/src/wagmi/Actions/nonce.ts +0 -139
  98. package/src/wagmi/Actions/policy.test.ts +0 -461
  99. package/src/wagmi/Actions/policy.ts +0 -817
  100. package/src/wagmi/Actions/reward.test.ts +0 -216
  101. package/src/wagmi/Actions/reward.ts +0 -613
  102. package/src/wagmi/Actions/token.test.ts +0 -1309
  103. package/src/wagmi/Actions/token.ts +0 -2644
  104. package/src/wagmi/Connector.test.ts +0 -56
  105. package/src/wagmi/Connector.ts +0 -670
  106. package/src/wagmi/Hooks/amm.test.ts +0 -564
  107. package/src/wagmi/Hooks/amm.ts +0 -796
  108. package/src/wagmi/Hooks/dex.test.ts +0 -992
  109. package/src/wagmi/Hooks/dex.ts +0 -1598
  110. package/src/wagmi/Hooks/faucet.ts +0 -144
  111. package/src/wagmi/Hooks/fee.test.ts +0 -166
  112. package/src/wagmi/Hooks/fee.ts +0 -206
  113. package/src/wagmi/Hooks/index.ts +0 -8
  114. package/src/wagmi/Hooks/nonce.test.ts +0 -142
  115. package/src/wagmi/Hooks/nonce.ts +0 -117
  116. package/src/wagmi/Hooks/policy.test.ts +0 -665
  117. package/src/wagmi/Hooks/policy.ts +0 -873
  118. package/src/wagmi/Hooks/reward.test.ts +0 -249
  119. package/src/wagmi/Hooks/reward.ts +0 -645
  120. package/src/wagmi/Hooks/token.test.ts +0 -1183
  121. package/src/wagmi/Hooks/token.ts +0 -2906
  122. package/src/wagmi/KeyManager.ts +0 -172
  123. package/src/wagmi/index.ts +0 -7
@@ -1,2644 +0,0 @@
1
- import type * as Query from '@tanstack/query-core'
2
- import { type Config, getConnectorClient } from '@wagmi/core'
3
- import type { ChainIdParameter, ConnectorParameter } from '@wagmi/core/internal'
4
- import type { Account } from 'viem'
5
- import { Actions } from 'viem/tempo'
6
- import type { RequiredBy, UnionOmit } from '../../internal/types.js'
7
-
8
- /**
9
- * Approves a spender to transfer TIP20 tokens on behalf of the caller.
10
- *
11
- * @example
12
- * ```ts
13
- * import { createConfig, http } from '@wagmi/core'
14
- * import { tempo } from 'viem/chains'
15
- * import { Actions } from 'tempo.ts/wagmi'
16
- *
17
- * const config = createConfig({
18
- * chains: [tempoTestnet],
19
- * transports: {
20
- * [tempo.id]: http(),
21
- * },
22
- * })
23
- *
24
- * const hash = await Actions.token.approve(config, {
25
- * spender: '0x...',
26
- * amount: 100n,
27
- * })
28
- * ```
29
- *
30
- * @param config - Config.
31
- * @param parameters - Parameters.
32
- * @returns Transaction hash.
33
- */
34
- export async function approve<config extends Config>(
35
- config: config,
36
- parameters: approve.Parameters<config>,
37
- ): Promise<Actions.token.approve.ReturnValue> {
38
- const { account, chainId, connector } = parameters
39
-
40
- const client = await getConnectorClient(config, {
41
- account,
42
- assertChainId: false,
43
- chainId,
44
- connector,
45
- })
46
-
47
- return Actions.token.approve(client, parameters as never)
48
- }
49
-
50
- export declare namespace approve {
51
- export type Parameters<config extends Config> = ChainIdParameter<config> &
52
- ConnectorParameter &
53
- UnionOmit<
54
- Actions.token.approve.Parameters<config['chains'][number], Account>,
55
- 'chain'
56
- >
57
-
58
- export type ReturnValue = Actions.token.approve.ReturnValue
59
-
60
- export type ErrorType = Actions.token.approve.ErrorType
61
- }
62
-
63
- /**
64
- * Approves a spender to transfer TIP20 tokens on behalf of the caller.
65
- *
66
- * Note: This is a synchronous action that waits for the transaction to
67
- * be included on a block before returning a response.
68
- *
69
- * @example
70
- * ```ts
71
- * import { createConfig, http } from '@wagmi/core'
72
- * import { tempo } from 'viem/chains'
73
- * import { Actions } from 'tempo.ts/wagmi'
74
- *
75
- * const config = createConfig({
76
- * chains: [tempoTestnet],
77
- * transports: {
78
- * [tempo.id]: http(),
79
- * },
80
- * })
81
- *
82
- * const result = await Actions.token.approveSync(config, {
83
- * spender: '0x...',
84
- * amount: 100n,
85
- * })
86
- * ```
87
- *
88
- * @param config - Config.
89
- * @param parameters - Parameters.
90
- * @returns The transaction receipt and event data.
91
- */
92
- export async function approveSync<config extends Config>(
93
- config: config,
94
- parameters: approveSync.Parameters<config>,
95
- ): Promise<Actions.token.approveSync.ReturnValue> {
96
- const { account, chainId, connector } = parameters
97
-
98
- const client = await getConnectorClient(config, {
99
- account,
100
- assertChainId: false,
101
- chainId,
102
- connector,
103
- })
104
-
105
- return Actions.token.approveSync(client, parameters as never)
106
- }
107
-
108
- export declare namespace approveSync {
109
- export type Parameters<config extends Config> = ChainIdParameter<config> &
110
- ConnectorParameter &
111
- UnionOmit<
112
- Actions.token.approveSync.Parameters<config['chains'][number], Account>,
113
- 'chain'
114
- >
115
-
116
- export type ReturnValue = Actions.token.approveSync.ReturnValue
117
-
118
- export type ErrorType = Actions.token.approveSync.ErrorType
119
- }
120
-
121
- /**
122
- * Burns TIP20 tokens from the caller's balance.
123
- *
124
- * @example
125
- * ```ts
126
- * import { createConfig, http } from '@wagmi/core'
127
- * import { tempo } from 'viem/chains'
128
- * import { Actions } from 'tempo.ts/wagmi'
129
- *
130
- * const config = createConfig({
131
- * chains: [tempoTestnet],
132
- * transports: {
133
- * [tempo.id]: http(),
134
- * },
135
- * })
136
- *
137
- * const hash = await Actions.token.burn(config, {
138
- * amount: 100n,
139
- * token: '0x...',
140
- * })
141
- * ```
142
- *
143
- * @param config - Config.
144
- * @param parameters - Parameters.
145
- * @returns Transaction hash.
146
- */
147
- export async function burn<config extends Config>(
148
- config: config,
149
- parameters: burn.Parameters<config>,
150
- ): Promise<Actions.token.burn.ReturnValue> {
151
- const { account, chainId, connector } = parameters
152
-
153
- const client = await getConnectorClient(config, {
154
- account,
155
- assertChainId: false,
156
- chainId,
157
- connector,
158
- })
159
-
160
- return Actions.token.burn(client, parameters as never)
161
- }
162
-
163
- export declare namespace burn {
164
- export type Parameters<config extends Config> = ChainIdParameter<config> &
165
- ConnectorParameter &
166
- UnionOmit<
167
- Actions.token.burn.Parameters<config['chains'][number], Account>,
168
- 'chain'
169
- >
170
-
171
- export type ReturnValue = Actions.token.burn.ReturnValue
172
-
173
- export type ErrorType = Actions.token.burn.ErrorType
174
- }
175
-
176
- /**
177
- * Burns TIP20 tokens from a blocked address.
178
- *
179
- * @example
180
- * ```ts
181
- * import { createConfig, http } from '@wagmi/core'
182
- * import { tempo } from 'viem/chains'
183
- * import { Actions } from 'tempo.ts/wagmi'
184
- *
185
- * const config = createConfig({
186
- * chains: [tempoTestnet],
187
- * transports: {
188
- * [tempo.id]: http(),
189
- * },
190
- * })
191
- *
192
- * const hash = await Actions.token.burnBlocked(config, {
193
- * from: '0x...',
194
- * amount: 100n,
195
- * token: '0x...',
196
- * })
197
- * ```
198
- *
199
- * @param config - Config.
200
- * @param parameters - Parameters.
201
- * @returns Transaction hash.
202
- */
203
- export async function burnBlocked<config extends Config>(
204
- config: config,
205
- parameters: burnBlocked.Parameters<config>,
206
- ): Promise<Actions.token.burnBlocked.ReturnValue> {
207
- const { account, chainId, connector } = parameters
208
-
209
- const client = await getConnectorClient(config, {
210
- account,
211
- assertChainId: false,
212
- chainId,
213
- connector,
214
- })
215
-
216
- return await Actions.token.burnBlocked(client, parameters as never)
217
- }
218
-
219
- export declare namespace burnBlocked {
220
- export type Parameters<config extends Config> = ChainIdParameter<config> &
221
- ConnectorParameter &
222
- UnionOmit<
223
- Actions.token.burnBlocked.Parameters<config['chains'][number], Account>,
224
- 'chain'
225
- >
226
-
227
- export type ReturnValue = Actions.token.burnBlocked.ReturnValue
228
-
229
- export type ErrorType = Actions.token.burnBlocked.ErrorType
230
- }
231
-
232
- /**
233
- * Burns TIP20 tokens from a blocked address.
234
- *
235
- * Note: This is a synchronous action that waits for the transaction to
236
- * be included on a block before returning a response.
237
- *
238
- * @example
239
- * ```ts
240
- * import { createConfig, http } from '@wagmi/core'
241
- * import { tempo } from 'viem/chains'
242
- * import { Actions } from 'tempo.ts/wagmi'
243
- *
244
- * const config = createConfig({
245
- * chains: [tempoTestnet],
246
- * transports: {
247
- * [tempo.id]: http(),
248
- * },
249
- * })
250
- *
251
- * const result = await Actions.token.burnBlockedSync(config, {
252
- * from: '0x...',
253
- * amount: 100n,
254
- * token: '0x...',
255
- * })
256
- * ```
257
- *
258
- * @param config - Config.
259
- * @param parameters - Parameters.
260
- * @returns The transaction receipt and event data.
261
- */
262
- export async function burnBlockedSync<config extends Config>(
263
- config: config,
264
- parameters: burnBlockedSync.Parameters<config>,
265
- ): Promise<Actions.token.burnBlockedSync.ReturnValue> {
266
- const { account, chainId, connector } = parameters
267
-
268
- const client = await getConnectorClient(config, {
269
- account,
270
- assertChainId: false,
271
- chainId,
272
- connector,
273
- })
274
-
275
- return Actions.token.burnBlockedSync(client, parameters as never)
276
- }
277
-
278
- export declare namespace burnBlockedSync {
279
- export type Parameters<config extends Config> = ChainIdParameter<config> &
280
- ConnectorParameter &
281
- UnionOmit<
282
- Actions.token.burnBlockedSync.Parameters<
283
- config['chains'][number],
284
- Account
285
- >,
286
- 'chain'
287
- >
288
-
289
- export type ReturnValue = Actions.token.burnBlockedSync.ReturnValue
290
-
291
- export type ErrorType = Actions.token.burnBlockedSync.ErrorType
292
- }
293
-
294
- /**
295
- * Burns TIP20 tokens from the caller's balance.
296
- *
297
- * Note: This is a synchronous action that waits for the transaction to
298
- * be included on a block before returning a response.
299
- *
300
- * @example
301
- * ```ts
302
- * import { createConfig, http } from '@wagmi/core'
303
- * import { tempo } from 'viem/chains'
304
- * import { Actions } from 'tempo.ts/wagmi'
305
- *
306
- * const config = createConfig({
307
- * chains: [tempoTestnet],
308
- * transports: {
309
- * [tempo.id]: http(),
310
- * },
311
- * })
312
- *
313
- * const result = await Actions.token.burnSync(config, {
314
- * amount: 100n,
315
- * token: '0x...',
316
- * })
317
- * ```
318
- *
319
- * @param config - Config.
320
- * @param parameters - Parameters.
321
- * @returns The transaction receipt and event data.
322
- */
323
- export async function burnSync<config extends Config>(
324
- config: config,
325
- parameters: burnSync.Parameters<config>,
326
- ): Promise<Actions.token.burnSync.ReturnValue> {
327
- const { account, chainId, connector } = parameters
328
-
329
- const client = await getConnectorClient(config, {
330
- account,
331
- assertChainId: false,
332
- chainId,
333
- connector,
334
- })
335
-
336
- return Actions.token.burnSync(client, parameters as never)
337
- }
338
-
339
- export declare namespace burnSync {
340
- export type Parameters<config extends Config> = ChainIdParameter<config> &
341
- ConnectorParameter &
342
- UnionOmit<
343
- Actions.token.burnSync.Parameters<config['chains'][number], Account>,
344
- 'chain'
345
- >
346
-
347
- export type ReturnValue = Actions.token.burnSync.ReturnValue
348
-
349
- export type ErrorType = Actions.token.burnSync.ErrorType
350
- }
351
-
352
- /**
353
- * Changes the transfer policy ID for a TIP20 token.
354
- *
355
- * @example
356
- * ```ts
357
- * import { createConfig, http } from '@wagmi/core'
358
- * import { tempo } from 'viem/chains'
359
- * import { Actions } from 'tempo.ts/wagmi'
360
- *
361
- * const config = createConfig({
362
- * chains: [tempoTestnet],
363
- * transports: {
364
- * [tempo.id]: http(),
365
- * },
366
- * })
367
- *
368
- * const hash = await Actions.token.changeTransferPolicy(config, {
369
- * token: '0x...',
370
- * policyId: 1n,
371
- * })
372
- * ```
373
- *
374
- * @param config - Config.
375
- * @param parameters - Parameters.
376
- * @returns Transaction hash.
377
- */
378
- export async function changeTransferPolicy<config extends Config>(
379
- config: config,
380
- parameters: changeTransferPolicy.Parameters<config>,
381
- ): Promise<Actions.token.changeTransferPolicy.ReturnValue> {
382
- const { account, chainId, connector } = parameters
383
-
384
- const client = await getConnectorClient(config, {
385
- account,
386
- assertChainId: false,
387
- chainId,
388
- connector,
389
- })
390
-
391
- return Actions.token.changeTransferPolicy(client, parameters as never)
392
- }
393
-
394
- export declare namespace changeTransferPolicy {
395
- export type Parameters<config extends Config> = ChainIdParameter<config> &
396
- ConnectorParameter &
397
- UnionOmit<
398
- Actions.token.changeTransferPolicy.Parameters<
399
- config['chains'][number],
400
- Account
401
- >,
402
- 'chain'
403
- >
404
-
405
- export type ReturnValue = Actions.token.changeTransferPolicy.ReturnValue
406
-
407
- export type ErrorType = Actions.token.changeTransferPolicy.ErrorType
408
- }
409
-
410
- /**
411
- * Changes the transfer policy ID for a TIP20 token.
412
- *
413
- * Note: This is a synchronous action that waits for the transaction to
414
- * be included on a block before returning a response.
415
- *
416
- * @example
417
- * ```ts
418
- * import { createConfig, http } from '@wagmi/core'
419
- * import { tempo } from 'viem/chains'
420
- * import { Actions } from 'tempo.ts/wagmi'
421
- *
422
- * const config = createConfig({
423
- * chains: [tempoTestnet],
424
- * transports: {
425
- * [tempo.id]: http(),
426
- * },
427
- * })
428
- *
429
- * const result = await Actions.token.changeTransferPolicySync(config, {
430
- * token: '0x...',
431
- * policyId: 1n,
432
- * })
433
- * ```
434
- *
435
- * @param config - Config.
436
- * @param parameters - Parameters.
437
- * @returns The transaction receipt and event data.
438
- */
439
- export async function changeTransferPolicySync<config extends Config>(
440
- config: config,
441
- parameters: changeTransferPolicySync.Parameters<config>,
442
- ): Promise<Actions.token.changeTransferPolicySync.ReturnValue> {
443
- const { account, chainId, connector } = parameters
444
-
445
- const client = await getConnectorClient(config, {
446
- account,
447
- assertChainId: false,
448
- chainId,
449
- connector,
450
- })
451
-
452
- return Actions.token.changeTransferPolicySync(client, parameters as never)
453
- }
454
-
455
- export declare namespace changeTransferPolicySync {
456
- export type Parameters<config extends Config> = ChainIdParameter<config> &
457
- ConnectorParameter &
458
- UnionOmit<
459
- Actions.token.changeTransferPolicySync.Parameters<
460
- config['chains'][number],
461
- Account
462
- >,
463
- 'chain'
464
- >
465
-
466
- export type ReturnValue = Actions.token.changeTransferPolicySync.ReturnValue
467
-
468
- export type ErrorType = Actions.token.changeTransferPolicySync.ErrorType
469
- }
470
-
471
- /**
472
- * Creates a new TIP20 token.
473
- *
474
- * @example
475
- * ```ts
476
- * import { createConfig, http } from '@wagmi/core'
477
- * import { tempo } from 'viem/chains'
478
- * import { Actions } from 'tempo.ts/wagmi'
479
- *
480
- * const config = createConfig({
481
- * chains: [tempoTestnet],
482
- * transports: {
483
- * [tempo.id]: http(),
484
- * },
485
- * })
486
- *
487
- * const hash = await Actions.token.create(config, {
488
- * name: 'My Token',
489
- * symbol: 'MTK',
490
- * currency: 'USD',
491
- * })
492
- * ```
493
- *
494
- * @param config - Config.
495
- * @param parameters - Parameters.
496
- * @returns Transaction hash.
497
- */
498
- export async function create<config extends Config>(
499
- config: config,
500
- parameters: create.Parameters<config>,
501
- ): Promise<Actions.token.create.ReturnValue> {
502
- const { account, chainId, connector } = parameters
503
-
504
- const client = await getConnectorClient(config, {
505
- account,
506
- assertChainId: false,
507
- chainId,
508
- connector,
509
- })
510
-
511
- return Actions.token.create(client, parameters as never)
512
- }
513
-
514
- export declare namespace create {
515
- export type Parameters<config extends Config> = ChainIdParameter<config> &
516
- ConnectorParameter &
517
- UnionOmit<
518
- Actions.token.create.Parameters<config['chains'][number], Account>,
519
- 'chain'
520
- >
521
-
522
- export type ReturnValue = Actions.token.create.ReturnValue
523
-
524
- export type ErrorType = Actions.token.create.ErrorType
525
- }
526
-
527
- /**
528
- * Creates a new TIP20 token.
529
- *
530
- * Note: This is a synchronous action that waits for the transaction to
531
- * be included on a block before returning a response.
532
- *
533
- * @example
534
- * ```ts
535
- * import { createConfig, http } from '@wagmi/core'
536
- * import { tempo } from 'viem/chains'
537
- * import { Actions } from 'tempo.ts/wagmi'
538
- *
539
- * const config = createConfig({
540
- * chains: [tempoTestnet],
541
- * transports: {
542
- * [tempo.id]: http(),
543
- * },
544
- * })
545
- *
546
- * const result = await Actions.token.createSync(config, {
547
- * name: 'My Token',
548
- * symbol: 'MTK',
549
- * currency: 'USD',
550
- * })
551
- * ```
552
- *
553
- * @param config - Config.
554
- * @param parameters - Parameters.
555
- * @returns The transaction receipt and event data.
556
- */
557
- export async function createSync<config extends Config>(
558
- config: config,
559
- parameters: createSync.Parameters<config>,
560
- ): Promise<Actions.token.createSync.ReturnValue> {
561
- const { account, chainId, connector } = parameters
562
-
563
- const client = await getConnectorClient(config, {
564
- account,
565
- assertChainId: false,
566
- chainId,
567
- connector,
568
- })
569
-
570
- return Actions.token.createSync(client, parameters as never)
571
- }
572
-
573
- export declare namespace createSync {
574
- export type Parameters<config extends Config> = ChainIdParameter<config> &
575
- ConnectorParameter &
576
- UnionOmit<
577
- Actions.token.createSync.Parameters<config['chains'][number], Account>,
578
- 'chain'
579
- >
580
-
581
- export type ReturnValue = Actions.token.createSync.ReturnValue
582
-
583
- export type ErrorType = Actions.token.createSync.ErrorType
584
- }
585
-
586
- /**
587
- * Updates the quote token for a TIP20 token.
588
- *
589
- * @example
590
- * ```ts
591
- * import { createConfig, http } from '@wagmi/core'
592
- * import { tempo } from 'viem/chains'
593
- * import { Actions } from 'tempo.ts/wagmi'
594
- *
595
- * const config = createConfig({
596
- * chains: [tempoTestnet],
597
- * transports: {
598
- * [tempo.id]: http(),
599
- * },
600
- * })
601
- *
602
- * const hash = await Actions.token.updateQuoteToken(config, {
603
- * token: '0x...',
604
- * })
605
- * ```
606
- *
607
- * @param config - Config.
608
- * @param parameters - Parameters.
609
- * @returns Transaction hash.
610
- */
611
- export async function updateQuoteToken<config extends Config>(
612
- config: config,
613
- parameters: updateQuoteToken.Parameters<config>,
614
- ): Promise<Actions.token.updateQuoteToken.ReturnValue> {
615
- const { account, chainId, connector } = parameters
616
-
617
- const client = await getConnectorClient(config, {
618
- account,
619
- assertChainId: false,
620
- chainId,
621
- connector,
622
- })
623
-
624
- return Actions.token.updateQuoteToken(client, parameters as never)
625
- }
626
-
627
- export declare namespace updateQuoteToken {
628
- export type Parameters<config extends Config> = ChainIdParameter<config> &
629
- ConnectorParameter &
630
- UnionOmit<
631
- Actions.token.updateQuoteToken.Parameters<
632
- config['chains'][number],
633
- Account
634
- >,
635
- 'chain'
636
- >
637
-
638
- export type ReturnValue = Actions.token.updateQuoteToken.ReturnValue
639
-
640
- export type ErrorType = Actions.token.updateQuoteToken.ErrorType
641
- }
642
-
643
- /**
644
- * Updates the quote token for a TIP20 token.
645
- *
646
- * Note: This is a synchronous action that waits for the transaction to
647
- * be included on a block before returning a response.
648
- *
649
- * @example
650
- * ```ts
651
- * import { createConfig, http } from '@wagmi/core'
652
- * import { tempo } from 'viem/chains'
653
- * import { Actions } from 'tempo.ts/wagmi'
654
- *
655
- * const config = createConfig({
656
- * chains: [tempoTestnet],
657
- * transports: {
658
- * [tempo.id]: http(),
659
- * },
660
- * })
661
- *
662
- * const result = await Actions.token.updateQuoteTokenSync(config, {
663
- * token: '0x...',
664
- * })
665
- * ```
666
- *
667
- * @param config - Config.
668
- * @param parameters - Parameters.
669
- * @returns The transaction receipt and event data.
670
- */
671
- export async function updateQuoteTokenSync<config extends Config>(
672
- config: config,
673
- parameters: updateQuoteTokenSync.Parameters<config>,
674
- ): Promise<Actions.token.updateQuoteTokenSync.ReturnValue> {
675
- const { account, chainId, connector } = parameters
676
-
677
- const client = await getConnectorClient(config, {
678
- account,
679
- assertChainId: false,
680
- chainId,
681
- connector,
682
- })
683
-
684
- return Actions.token.updateQuoteTokenSync(client, parameters as never)
685
- }
686
-
687
- export declare namespace updateQuoteTokenSync {
688
- export type Parameters<config extends Config> = ChainIdParameter<config> &
689
- ConnectorParameter &
690
- UnionOmit<
691
- Actions.token.updateQuoteTokenSync.Parameters<
692
- config['chains'][number],
693
- Account
694
- >,
695
- 'chain'
696
- >
697
-
698
- export type ReturnValue = Actions.token.updateQuoteTokenSync.ReturnValue
699
-
700
- export type ErrorType = Actions.token.updateQuoteTokenSync.ErrorType
701
- }
702
-
703
- /**
704
- * Gets TIP20 token allowance.
705
- *
706
- * @example
707
- * ```ts
708
- * import { createConfig, http } from '@wagmi/core'
709
- * import { tempo } from 'viem/chains'
710
- * import { Actions } from 'tempo.ts/wagmi'
711
- *
712
- * const config = createConfig({
713
- * chains: [tempoTestnet],
714
- * transports: {
715
- * [tempo.id]: http(),
716
- * },
717
- * })
718
- *
719
- * const allowance = await Actions.token.getAllowance(config, {
720
- * account: '0x...',
721
- * spender: '0x...',
722
- * })
723
- * ```
724
- *
725
- * @param config - Config.
726
- * @param parameters - Parameters.
727
- * @returns The token allowance.
728
- */
729
- export function getAllowance<config extends Config>(
730
- config: config,
731
- parameters: getAllowance.Parameters<config>,
732
- ) {
733
- const { chainId, ...rest } = parameters
734
- const client = config.getClient({ chainId })
735
- return Actions.token.getAllowance(client, rest)
736
- }
737
-
738
- export namespace getAllowance {
739
- export type Parameters<config extends Config> = ChainIdParameter<config> &
740
- Actions.token.getAllowance.Parameters
741
-
742
- export type ReturnValue = Actions.token.getAllowance.ReturnValue
743
-
744
- export function queryKey<config extends Config>(
745
- parameters: Parameters<config>,
746
- ) {
747
- return ['getAllowance', parameters] as const
748
- }
749
-
750
- export type QueryKey<config extends Config> = ReturnType<
751
- typeof queryKey<config>
752
- >
753
-
754
- export function queryOptions<config extends Config, selectData = ReturnValue>(
755
- config: Config,
756
- parameters: queryOptions.Parameters<config, selectData>,
757
- ): queryOptions.ReturnValue<config, selectData> {
758
- const { query, ...rest } = parameters
759
- return {
760
- ...query,
761
- queryKey: queryKey(rest),
762
- async queryFn({ queryKey }) {
763
- const [, parameters] = queryKey
764
- return await getAllowance(config, parameters)
765
- },
766
- }
767
- }
768
-
769
- export declare namespace queryOptions {
770
- export type Parameters<
771
- config extends Config,
772
- selectData = getAllowance.ReturnValue,
773
- > = getAllowance.Parameters<config> & {
774
- query?:
775
- | UnionOmit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
776
- | undefined
777
- }
778
-
779
- export type ReturnValue<
780
- config extends Config,
781
- selectData = getAllowance.ReturnValue,
782
- > = RequiredBy<
783
- Query.QueryOptions<
784
- getAllowance.ReturnValue,
785
- Query.DefaultError,
786
- selectData,
787
- getAllowance.QueryKey<config>
788
- >,
789
- 'queryKey' | 'queryFn'
790
- >
791
- }
792
- }
793
-
794
- /**
795
- * Gets TIP20 token balance for an address.
796
- *
797
- * @example
798
- * ```ts
799
- * import { createConfig, http } from '@wagmi/core'
800
- * import { tempo } from 'viem/chains'
801
- * import { Actions } from 'tempo.ts/wagmi'
802
- *
803
- * const config = createConfig({
804
- * chains: [tempoTestnet],
805
- * transports: {
806
- * [tempo.id]: http(),
807
- * },
808
- * })
809
- *
810
- * const balance = await Actions.token.getBalance(config, {
811
- * account: '0x...',
812
- * })
813
- * ```
814
- *
815
- * @param config - Config.
816
- * @param parameters - Parameters.
817
- * @returns The token balance.
818
- */
819
- export function getBalance<config extends Config>(
820
- config: config,
821
- parameters: getBalance.Parameters<config>,
822
- ) {
823
- const { chainId, ...rest } = parameters
824
- const client = config.getClient({ chainId })
825
- return Actions.token.getBalance(client, rest as never)
826
- }
827
-
828
- export namespace getBalance {
829
- export type Parameters<config extends Config> = ChainIdParameter<config> &
830
- Actions.token.getBalance.Parameters
831
-
832
- export type ReturnValue = Actions.token.getBalance.ReturnValue
833
-
834
- export function queryKey<config extends Config>(
835
- parameters: Parameters<config>,
836
- ) {
837
- return ['getBalance', parameters] as const
838
- }
839
-
840
- export type QueryKey<config extends Config> = ReturnType<
841
- typeof queryKey<config>
842
- >
843
-
844
- export function queryOptions<config extends Config, selectData = ReturnValue>(
845
- config: Config,
846
- parameters: queryOptions.Parameters<config, selectData>,
847
- ): queryOptions.ReturnValue<config, selectData> {
848
- const { query, ...rest } = parameters
849
- return {
850
- ...query,
851
- queryKey: queryKey(rest),
852
- async queryFn({ queryKey }) {
853
- const [, parameters] = queryKey
854
- return (await getBalance(config, parameters)) ?? null
855
- },
856
- }
857
- }
858
-
859
- export declare namespace queryOptions {
860
- export type Parameters<
861
- config extends Config,
862
- selectData = getBalance.ReturnValue,
863
- > = getBalance.Parameters<config> & {
864
- query?:
865
- | UnionOmit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
866
- | undefined
867
- }
868
-
869
- export type ReturnValue<
870
- config extends Config,
871
- selectData = getBalance.ReturnValue,
872
- > = RequiredBy<
873
- Query.QueryOptions<
874
- getBalance.ReturnValue,
875
- Query.DefaultError,
876
- selectData,
877
- getBalance.QueryKey<config>
878
- >,
879
- 'queryKey' | 'queryFn'
880
- >
881
- }
882
- }
883
-
884
- /**
885
- * Gets TIP20 token metadata.
886
- *
887
- * @example
888
- * ```ts
889
- * import { createConfig, http } from '@wagmi/core'
890
- * import { tempo } from 'viem/chains'
891
- * import { Actions } from 'tempo.ts/wagmi'
892
- *
893
- * const config = createConfig({
894
- * chains: [tempoTestnet],
895
- * transports: {
896
- * [tempo.id]: http(),
897
- * },
898
- * })
899
- *
900
- * const metadata = await Actions.token.getMetadata(config, {
901
- * token: '0x...',
902
- * })
903
- * ```
904
- *
905
- * @param config - Config.
906
- * @param parameters - Parameters.
907
- * @returns The token metadata.
908
- */
909
- export function getMetadata<config extends Config>(
910
- config: config,
911
- parameters: getMetadata.Parameters<config>,
912
- ) {
913
- const { chainId, ...rest } = parameters
914
- const client = config.getClient({ chainId })
915
- return Actions.token.getMetadata(client, rest)
916
- }
917
-
918
- export namespace getMetadata {
919
- export type Parameters<config extends Config> = ChainIdParameter<config> &
920
- Actions.token.getMetadata.Parameters
921
-
922
- export type ReturnValue = Actions.token.getMetadata.ReturnValue
923
-
924
- export function queryKey<config extends Config>(
925
- parameters: Parameters<config>,
926
- ) {
927
- return ['getMetadata', parameters] as const
928
- }
929
-
930
- export type QueryKey<config extends Config> = ReturnType<
931
- typeof queryKey<config>
932
- >
933
-
934
- export function queryOptions<config extends Config, selectData = ReturnValue>(
935
- config: Config,
936
- parameters: queryOptions.Parameters<config, selectData>,
937
- ): queryOptions.ReturnValue<config, selectData> {
938
- const { query, ...rest } = parameters
939
- return {
940
- ...query,
941
- queryKey: queryKey(rest),
942
- async queryFn({ queryKey }) {
943
- const [, parameters] = queryKey
944
- return await getMetadata(config, parameters)
945
- },
946
- }
947
- }
948
-
949
- export declare namespace queryOptions {
950
- export type Parameters<
951
- config extends Config,
952
- selectData = getMetadata.ReturnValue,
953
- > = getMetadata.Parameters<config> & {
954
- query?:
955
- | UnionOmit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
956
- | undefined
957
- }
958
-
959
- export type ReturnValue<
960
- config extends Config,
961
- selectData = getMetadata.ReturnValue,
962
- > = RequiredBy<
963
- Query.QueryOptions<
964
- getMetadata.ReturnValue,
965
- Query.DefaultError,
966
- selectData,
967
- getMetadata.QueryKey<config>
968
- >,
969
- 'queryKey' | 'queryFn'
970
- >
971
- }
972
- }
973
-
974
- /**
975
- * Gets the admin role for a specific role in a TIP20 token.
976
- *
977
- * @example
978
- * ```ts
979
- * import { createConfig, http } from '@wagmi/core'
980
- * import { tempo } from 'viem/chains'
981
- * import { Actions } from 'tempo.ts/wagmi'
982
- *
983
- * const config = createConfig({
984
- * chains: [tempoTestnet],
985
- * transports: {
986
- * [tempo.id]: http(),
987
- * },
988
- * })
989
- *
990
- * const adminRole = await Actions.token.getRoleAdmin(config, {
991
- * role: 'issuer',
992
- * token: '0x...',
993
- * })
994
- * ```
995
- *
996
- * @param config - Config.
997
- * @param parameters - Parameters.
998
- * @returns The admin role hash.
999
- */
1000
- export function getRoleAdmin<config extends Config>(
1001
- config: config,
1002
- parameters: getRoleAdmin.Parameters<config>,
1003
- ) {
1004
- const { chainId, ...rest } = parameters
1005
- const client = config.getClient({ chainId })
1006
- return Actions.token.getRoleAdmin(client, rest)
1007
- }
1008
-
1009
- export namespace getRoleAdmin {
1010
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1011
- Actions.token.getRoleAdmin.Parameters
1012
-
1013
- export type ReturnValue = Actions.token.getRoleAdmin.ReturnValue
1014
-
1015
- export function queryKey<config extends Config>(
1016
- parameters: Parameters<config>,
1017
- ) {
1018
- return ['getRoleAdmin', parameters] as const
1019
- }
1020
-
1021
- export type QueryKey<config extends Config> = ReturnType<
1022
- typeof queryKey<config>
1023
- >
1024
-
1025
- export function queryOptions<config extends Config, selectData = ReturnValue>(
1026
- config: Config,
1027
- parameters: queryOptions.Parameters<config, selectData>,
1028
- ): queryOptions.ReturnValue<config, selectData> {
1029
- const { query, ...rest } = parameters
1030
- return {
1031
- ...query,
1032
- queryKey: queryKey(rest),
1033
- async queryFn({ queryKey }) {
1034
- const [, parameters] = queryKey
1035
- return await getRoleAdmin(config, parameters)
1036
- },
1037
- }
1038
- }
1039
-
1040
- export declare namespace queryOptions {
1041
- export type Parameters<
1042
- config extends Config,
1043
- selectData = getRoleAdmin.ReturnValue,
1044
- > = getRoleAdmin.Parameters<config> & {
1045
- query?:
1046
- | UnionOmit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
1047
- | undefined
1048
- }
1049
-
1050
- export type ReturnValue<
1051
- config extends Config,
1052
- selectData = getRoleAdmin.ReturnValue,
1053
- > = RequiredBy<
1054
- Query.QueryOptions<
1055
- getRoleAdmin.ReturnValue,
1056
- Query.DefaultError,
1057
- selectData,
1058
- getRoleAdmin.QueryKey<config>
1059
- >,
1060
- 'queryKey' | 'queryFn'
1061
- >
1062
- }
1063
- }
1064
-
1065
- /**
1066
- * Grants a role for a TIP20 token.
1067
- *
1068
- * @example
1069
- * ```ts
1070
- * import { createConfig, http } from '@wagmi/core'
1071
- * import { tempo } from 'viem/chains'
1072
- * import { Actions } from 'tempo.ts/wagmi'
1073
- *
1074
- * const config = createConfig({
1075
- * chains: [tempoTestnet],
1076
- * transports: {
1077
- * [tempo.id]: http(),
1078
- * },
1079
- * })
1080
- *
1081
- * const hash = await Actions.token.grantRoles(config, {
1082
- * token: '0x...',
1083
- * to: '0x...',
1084
- * roles: ['issuer'],
1085
- * })
1086
- * ```
1087
- *
1088
- * @param config - Config.
1089
- * @param parameters - Parameters.
1090
- * @returns Transaction hash.
1091
- */
1092
- export async function grantRoles<config extends Config>(
1093
- config: config,
1094
- parameters: grantRoles.Parameters<config>,
1095
- ): Promise<Actions.token.grantRoles.ReturnValue> {
1096
- const { account, chainId, connector } = parameters
1097
-
1098
- const client = await getConnectorClient(config, {
1099
- account,
1100
- assertChainId: false,
1101
- chainId,
1102
- connector,
1103
- })
1104
-
1105
- return Actions.token.grantRoles(client, parameters as never)
1106
- }
1107
-
1108
- export declare namespace grantRoles {
1109
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1110
- ConnectorParameter &
1111
- UnionOmit<
1112
- Actions.token.grantRoles.Parameters<config['chains'][number], Account>,
1113
- 'chain'
1114
- >
1115
-
1116
- export type ReturnValue = Actions.token.grantRoles.ReturnValue
1117
-
1118
- export type ErrorType = Actions.token.grantRoles.ErrorType
1119
- }
1120
-
1121
- /**
1122
- * Grants a role for a TIP20 token.
1123
- *
1124
- * Note: This is a synchronous action that waits for the transaction to
1125
- * be included on a block before returning a response.
1126
- *
1127
- * @example
1128
- * ```ts
1129
- * import { createConfig, http } from '@wagmi/core'
1130
- * import { tempo } from 'viem/chains'
1131
- * import { Actions } from 'tempo.ts/wagmi'
1132
- *
1133
- * const config = createConfig({
1134
- * chains: [tempoTestnet],
1135
- * transports: {
1136
- * [tempo.id]: http(),
1137
- * },
1138
- * })
1139
- *
1140
- * const result = await Actions.token.grantRolesSync(config, {
1141
- * token: '0x...',
1142
- * to: '0x...',
1143
- * roles: ['issuer'],
1144
- * })
1145
- * ```
1146
- *
1147
- * @param config - Config.
1148
- * @param parameters - Parameters.
1149
- * @returns The transaction receipt and event data.
1150
- */
1151
- export async function grantRolesSync<config extends Config>(
1152
- config: config,
1153
- parameters: grantRolesSync.Parameters<config>,
1154
- ): Promise<Actions.token.grantRolesSync.ReturnValue> {
1155
- const { account, chainId, connector } = parameters
1156
-
1157
- const client = await getConnectorClient(config, {
1158
- account,
1159
- assertChainId: false,
1160
- chainId,
1161
- connector,
1162
- })
1163
-
1164
- return Actions.token.grantRolesSync(client, parameters as never)
1165
- }
1166
-
1167
- export declare namespace grantRolesSync {
1168
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1169
- ConnectorParameter &
1170
- UnionOmit<
1171
- Actions.token.grantRolesSync.Parameters<
1172
- config['chains'][number],
1173
- Account
1174
- >,
1175
- 'chain'
1176
- >
1177
-
1178
- export type ReturnValue = Actions.token.grantRolesSync.ReturnValue
1179
-
1180
- export type ErrorType = Actions.token.grantRolesSync.ErrorType
1181
- }
1182
-
1183
- /**
1184
- * Checks if an account has a specific role for a TIP20 token.
1185
- *
1186
- * @example
1187
- * ```ts
1188
- * import { createConfig, http } from '@wagmi/core'
1189
- * import { tempo } from 'viem/chains'
1190
- * import { Actions } from 'tempo.ts/wagmi'
1191
- *
1192
- * const config = createConfig({
1193
- * chains: [tempoTestnet],
1194
- * transports: {
1195
- * [tempo.id]: http(),
1196
- * },
1197
- * })
1198
- *
1199
- * const hasRole = await Actions.token.hasRole(config, {
1200
- * account: '0x...',
1201
- * role: 'issuer',
1202
- * token: '0x...',
1203
- * })
1204
- * ```
1205
- *
1206
- * @param config - Config.
1207
- * @param parameters - Parameters.
1208
- * @returns Whether the account has the role.
1209
- */
1210
- export function hasRole<config extends Config>(
1211
- config: config,
1212
- parameters: hasRole.Parameters<config>,
1213
- ) {
1214
- const { chainId, ...rest } = parameters
1215
- const client = config.getClient({ chainId })
1216
- return Actions.token.hasRole(client, rest)
1217
- }
1218
-
1219
- export namespace hasRole {
1220
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1221
- Actions.token.hasRole.Parameters
1222
-
1223
- export type ReturnValue = Actions.token.hasRole.ReturnValue
1224
-
1225
- export function queryKey<config extends Config>(
1226
- parameters: Parameters<config>,
1227
- ) {
1228
- return ['hasRole', parameters] as const
1229
- }
1230
-
1231
- export type QueryKey<config extends Config> = ReturnType<
1232
- typeof queryKey<config>
1233
- >
1234
-
1235
- export function queryOptions<config extends Config, selectData = ReturnValue>(
1236
- config: Config,
1237
- parameters: queryOptions.Parameters<config, selectData>,
1238
- ): queryOptions.ReturnValue<config, selectData> {
1239
- const { query, ...rest } = parameters
1240
- return {
1241
- ...query,
1242
- queryKey: queryKey(rest),
1243
- async queryFn({ queryKey }) {
1244
- const [, parameters] = queryKey
1245
- return await hasRole(config, parameters)
1246
- },
1247
- }
1248
- }
1249
-
1250
- export declare namespace queryOptions {
1251
- export type Parameters<
1252
- config extends Config,
1253
- selectData = hasRole.ReturnValue,
1254
- > = hasRole.Parameters<config> & {
1255
- query?:
1256
- | UnionOmit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
1257
- | undefined
1258
- }
1259
-
1260
- export type ReturnValue<
1261
- config extends Config,
1262
- selectData = hasRole.ReturnValue,
1263
- > = RequiredBy<
1264
- Query.QueryOptions<
1265
- hasRole.ReturnValue,
1266
- Query.DefaultError,
1267
- selectData,
1268
- hasRole.QueryKey<config>
1269
- >,
1270
- 'queryKey' | 'queryFn'
1271
- >
1272
- }
1273
- }
1274
-
1275
- /**
1276
- * Mints TIP20 tokens to an address.
1277
- *
1278
- * @example
1279
- * ```ts
1280
- * import { createConfig, http } from '@wagmi/core'
1281
- * import { tempo } from 'viem/chains'
1282
- * import { Actions } from 'tempo.ts/wagmi'
1283
- *
1284
- * const config = createConfig({
1285
- * chains: [tempoTestnet],
1286
- * transports: {
1287
- * [tempo.id]: http(),
1288
- * },
1289
- * })
1290
- *
1291
- * const hash = await Actions.token.mint(config, {
1292
- * to: '0x...',
1293
- * amount: 100n,
1294
- * token: '0x...',
1295
- * })
1296
- * ```
1297
- *
1298
- * @param config - Config.
1299
- * @param parameters - Parameters.
1300
- * @returns Transaction hash.
1301
- */
1302
- export async function mint<config extends Config>(
1303
- config: config,
1304
- parameters: mint.Parameters<config>,
1305
- ): Promise<Actions.token.mint.ReturnValue> {
1306
- const { account, chainId, connector } = parameters
1307
-
1308
- const client = await getConnectorClient(config, {
1309
- account,
1310
- assertChainId: false,
1311
- chainId,
1312
- connector,
1313
- })
1314
-
1315
- return Actions.token.mint(client, parameters as never)
1316
- }
1317
-
1318
- export declare namespace mint {
1319
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1320
- ConnectorParameter &
1321
- UnionOmit<
1322
- Actions.token.mint.Parameters<config['chains'][number], Account>,
1323
- 'chain'
1324
- >
1325
-
1326
- export type ReturnValue = Actions.token.mint.ReturnValue
1327
-
1328
- export type ErrorType = Actions.token.mint.ErrorType
1329
- }
1330
-
1331
- /**
1332
- * Mints TIP20 tokens to an address.
1333
- *
1334
- * Note: This is a synchronous action that waits for the transaction to
1335
- * be included on a block before returning a response.
1336
- *
1337
- * @example
1338
- * ```ts
1339
- * import { createConfig, http } from '@wagmi/core'
1340
- * import { tempo } from 'viem/chains'
1341
- * import { Actions } from 'tempo.ts/wagmi'
1342
- *
1343
- * const config = createConfig({
1344
- * chains: [tempoTestnet],
1345
- * transports: {
1346
- * [tempo.id]: http(),
1347
- * },
1348
- * })
1349
- *
1350
- * const result = await Actions.token.mintSync(config, {
1351
- * to: '0x...',
1352
- * amount: 100n,
1353
- * token: '0x...',
1354
- * })
1355
- * ```
1356
- *
1357
- * @param config - Config.
1358
- * @param parameters - Parameters.
1359
- * @returns The transaction receipt and event data.
1360
- */
1361
- export async function mintSync<config extends Config>(
1362
- config: config,
1363
- parameters: mintSync.Parameters<config>,
1364
- ): Promise<Actions.token.mintSync.ReturnValue> {
1365
- const { account, chainId, connector } = parameters
1366
-
1367
- const client = await getConnectorClient(config, {
1368
- account,
1369
- assertChainId: false,
1370
- chainId,
1371
- connector,
1372
- })
1373
-
1374
- return Actions.token.mintSync(client, parameters as never)
1375
- }
1376
-
1377
- export declare namespace mintSync {
1378
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1379
- ConnectorParameter &
1380
- UnionOmit<
1381
- Actions.token.mintSync.Parameters<config['chains'][number], Account>,
1382
- 'chain'
1383
- >
1384
-
1385
- export type ReturnValue = Actions.token.mintSync.ReturnValue
1386
-
1387
- export type ErrorType = Actions.token.mintSync.ErrorType
1388
- }
1389
-
1390
- /**
1391
- * Pauses a TIP20 token.
1392
- *
1393
- * @example
1394
- * ```ts
1395
- * import { createConfig, http } from '@wagmi/core'
1396
- * import { tempo } from 'viem/chains'
1397
- * import { Actions } from 'tempo.ts/wagmi'
1398
- *
1399
- * const config = createConfig({
1400
- * chains: [tempoTestnet],
1401
- * transports: {
1402
- * [tempo.id]: http(),
1403
- * },
1404
- * })
1405
- *
1406
- * const hash = await Actions.token.pause(config, {
1407
- * token: '0x...',
1408
- * })
1409
- * ```
1410
- *
1411
- * @param config - Config.
1412
- * @param parameters - Parameters.
1413
- * @returns Transaction hash.
1414
- */
1415
- export async function pause<config extends Config>(
1416
- config: config,
1417
- parameters: pause.Parameters<config>,
1418
- ): Promise<Actions.token.pause.ReturnValue> {
1419
- const { account, chainId, connector } = parameters
1420
-
1421
- const client = await getConnectorClient(config, {
1422
- account,
1423
- assertChainId: false,
1424
- chainId,
1425
- connector,
1426
- })
1427
-
1428
- return Actions.token.pause(client, parameters as never)
1429
- }
1430
-
1431
- export declare namespace pause {
1432
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1433
- ConnectorParameter &
1434
- UnionOmit<
1435
- Actions.token.pause.Parameters<config['chains'][number], Account>,
1436
- 'chain'
1437
- >
1438
-
1439
- export type ReturnValue = Actions.token.pause.ReturnValue
1440
-
1441
- export type ErrorType = Actions.token.pause.ErrorType
1442
- }
1443
-
1444
- /**
1445
- * Pauses a TIP20 token.
1446
- *
1447
- * Note: This is a synchronous action that waits for the transaction to
1448
- * be included on a block before returning a response.
1449
- *
1450
- * @example
1451
- * ```ts
1452
- * import { createConfig, http } from '@wagmi/core'
1453
- * import { tempo } from 'viem/chains'
1454
- * import { Actions } from 'tempo.ts/wagmi'
1455
- *
1456
- * const config = createConfig({
1457
- * chains: [tempoTestnet],
1458
- * transports: {
1459
- * [tempo.id]: http(),
1460
- * },
1461
- * })
1462
- *
1463
- * const result = await Actions.token.pauseSync(config, {
1464
- * token: '0x...',
1465
- * })
1466
- * ```
1467
- *
1468
- * @param config - Config.
1469
- * @param parameters - Parameters.
1470
- * @returns The transaction receipt and event data.
1471
- */
1472
- export async function pauseSync<config extends Config>(
1473
- config: config,
1474
- parameters: pauseSync.Parameters<config>,
1475
- ): Promise<Actions.token.pauseSync.ReturnValue> {
1476
- const { account, chainId, connector } = parameters
1477
-
1478
- const client = await getConnectorClient(config, {
1479
- account,
1480
- assertChainId: false,
1481
- chainId,
1482
- connector,
1483
- })
1484
-
1485
- return Actions.token.pauseSync(client, parameters as never)
1486
- }
1487
-
1488
- export declare namespace pauseSync {
1489
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1490
- ConnectorParameter &
1491
- UnionOmit<
1492
- Actions.token.pauseSync.Parameters<config['chains'][number], Account>,
1493
- 'chain'
1494
- >
1495
-
1496
- export type ReturnValue = Actions.token.pauseSync.ReturnValue
1497
-
1498
- export type ErrorType = Actions.token.pauseSync.ErrorType
1499
- }
1500
-
1501
- /**
1502
- * Renounces a role for a TIP20 token.
1503
- *
1504
- * @example
1505
- * ```ts
1506
- * import { createConfig, http } from '@wagmi/core'
1507
- * import { tempo } from 'viem/chains'
1508
- * import { Actions } from 'tempo.ts/wagmi'
1509
- *
1510
- * const config = createConfig({
1511
- * chains: [tempoTestnet],
1512
- * transports: {
1513
- * [tempo.id]: http(),
1514
- * },
1515
- * })
1516
- *
1517
- * const hash = await Actions.token.renounceRoles(config, {
1518
- * token: '0x...',
1519
- * roles: ['issuer'],
1520
- * })
1521
- * ```
1522
- *
1523
- * @param config - Config.
1524
- * @param parameters - Parameters.
1525
- * @returns Transaction hash.
1526
- */
1527
- export async function renounceRoles<config extends Config>(
1528
- config: config,
1529
- parameters: renounceRoles.Parameters<config>,
1530
- ): Promise<Actions.token.renounceRoles.ReturnValue> {
1531
- const { account, chainId, connector } = parameters
1532
-
1533
- const client = await getConnectorClient(config, {
1534
- account,
1535
- assertChainId: false,
1536
- chainId,
1537
- connector,
1538
- })
1539
-
1540
- return Actions.token.renounceRoles(client, parameters as never)
1541
- }
1542
-
1543
- export declare namespace renounceRoles {
1544
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1545
- ConnectorParameter &
1546
- UnionOmit<
1547
- Actions.token.renounceRoles.Parameters<config['chains'][number], Account>,
1548
- 'chain'
1549
- >
1550
-
1551
- export type ReturnValue = Actions.token.renounceRoles.ReturnValue
1552
-
1553
- export type ErrorType = Actions.token.renounceRoles.ErrorType
1554
- }
1555
-
1556
- /**
1557
- * Renounces a role for a TIP20 token.
1558
- *
1559
- * Note: This is a synchronous action that waits for the transaction to
1560
- * be included on a block before returning a response.
1561
- *
1562
- * @example
1563
- * ```ts
1564
- * import { createConfig, http } from '@wagmi/core'
1565
- * import { tempo } from 'viem/chains'
1566
- * import { Actions } from 'tempo.ts/wagmi'
1567
- *
1568
- * const config = createConfig({
1569
- * chains: [tempoTestnet],
1570
- * transports: {
1571
- * [tempo.id]: http(),
1572
- * },
1573
- * })
1574
- *
1575
- * const result = await Actions.token.renounceRolesSync(config, {
1576
- * token: '0x...',
1577
- * roles: ['issuer'],
1578
- * })
1579
- * ```
1580
- *
1581
- * @param config - Config.
1582
- * @param parameters - Parameters.
1583
- * @returns The transaction receipt and event data.
1584
- */
1585
- export async function renounceRolesSync<config extends Config>(
1586
- config: config,
1587
- parameters: renounceRolesSync.Parameters<config>,
1588
- ): Promise<Actions.token.renounceRolesSync.ReturnValue> {
1589
- const { account, chainId, connector } = parameters
1590
-
1591
- const client = await getConnectorClient(config, {
1592
- account,
1593
- assertChainId: false,
1594
- chainId,
1595
- connector,
1596
- })
1597
-
1598
- return Actions.token.renounceRolesSync(client, parameters as never)
1599
- }
1600
-
1601
- export declare namespace renounceRolesSync {
1602
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1603
- ConnectorParameter &
1604
- UnionOmit<
1605
- Actions.token.renounceRolesSync.Parameters<
1606
- config['chains'][number],
1607
- Account
1608
- >,
1609
- 'chain'
1610
- >
1611
-
1612
- export type ReturnValue = Actions.token.renounceRolesSync.ReturnValue
1613
-
1614
- export type ErrorType = Actions.token.renounceRolesSync.ErrorType
1615
- }
1616
-
1617
- /**
1618
- * Revokes a role for a TIP20 token.
1619
- *
1620
- * @example
1621
- * ```ts
1622
- * import { createConfig, http } from '@wagmi/core'
1623
- * import { tempo } from 'viem/chains'
1624
- * import { Actions } from 'tempo.ts/wagmi'
1625
- *
1626
- * const config = createConfig({
1627
- * chains: [tempoTestnet],
1628
- * transports: {
1629
- * [tempo.id]: http(),
1630
- * },
1631
- * })
1632
- *
1633
- * const hash = await Actions.token.revokeRoles(config, {
1634
- * token: '0x...',
1635
- * from: '0x...',
1636
- * roles: ['issuer'],
1637
- * })
1638
- * ```
1639
- *
1640
- * @param config - Config.
1641
- * @param parameters - Parameters.
1642
- * @returns Transaction hash.
1643
- */
1644
- export async function revokeRoles<config extends Config>(
1645
- config: config,
1646
- parameters: revokeRoles.Parameters<config>,
1647
- ): Promise<Actions.token.revokeRoles.ReturnValue> {
1648
- const { account, chainId, connector } = parameters
1649
-
1650
- const client = await getConnectorClient(config, {
1651
- account,
1652
- assertChainId: false,
1653
- chainId,
1654
- connector,
1655
- })
1656
-
1657
- return Actions.token.revokeRoles(client, parameters as never)
1658
- }
1659
-
1660
- export declare namespace revokeRoles {
1661
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1662
- ConnectorParameter &
1663
- UnionOmit<
1664
- Actions.token.revokeRoles.Parameters<config['chains'][number], Account>,
1665
- 'chain'
1666
- >
1667
-
1668
- export type ReturnValue = Actions.token.revokeRoles.ReturnValue
1669
-
1670
- export type ErrorType = Actions.token.revokeRoles.ErrorType
1671
- }
1672
-
1673
- /**
1674
- * Revokes a role for a TIP20 token.
1675
- *
1676
- * Note: This is a synchronous action that waits for the transaction to
1677
- * be included on a block before returning a response.
1678
- *
1679
- * @example
1680
- * ```ts
1681
- * import { createConfig, http } from '@wagmi/core'
1682
- * import { tempo } from 'viem/chains'
1683
- * import { Actions } from 'tempo.ts/wagmi'
1684
- *
1685
- * const config = createConfig({
1686
- * chains: [tempoTestnet],
1687
- * transports: {
1688
- * [tempo.id]: http(),
1689
- * },
1690
- * })
1691
- *
1692
- * const result = await Actions.token.revokeRolesSync(config, {
1693
- * token: '0x...',
1694
- * from: '0x...',
1695
- * roles: ['issuer'],
1696
- * })
1697
- * ```
1698
- *
1699
- * @param config - Config.
1700
- * @param parameters - Parameters.
1701
- * @returns The transaction receipt and event data.
1702
- */
1703
- export async function revokeRolesSync<config extends Config>(
1704
- config: config,
1705
- parameters: revokeRolesSync.Parameters<config>,
1706
- ): Promise<Actions.token.revokeRolesSync.ReturnValue> {
1707
- const { account, chainId, connector } = parameters
1708
-
1709
- const client = await getConnectorClient(config, {
1710
- account,
1711
- assertChainId: false,
1712
- chainId,
1713
- connector,
1714
- })
1715
-
1716
- return Actions.token.revokeRolesSync(client, parameters as never)
1717
- }
1718
-
1719
- export declare namespace revokeRolesSync {
1720
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1721
- ConnectorParameter &
1722
- UnionOmit<
1723
- Actions.token.revokeRolesSync.Parameters<
1724
- config['chains'][number],
1725
- Account
1726
- >,
1727
- 'chain'
1728
- >
1729
-
1730
- export type ReturnValue = Actions.token.revokeRolesSync.ReturnValue
1731
-
1732
- export type ErrorType = Actions.token.revokeRolesSync.ErrorType
1733
- }
1734
-
1735
- /**
1736
- * Sets the admin role for a specific role in a TIP20 token.
1737
- *
1738
- * @example
1739
- * ```ts
1740
- * import { createConfig, http } from '@wagmi/core'
1741
- * import { tempo } from 'viem/chains'
1742
- * import { Actions } from 'tempo.ts/wagmi'
1743
- *
1744
- * const config = createConfig({
1745
- * chains: [tempoTestnet],
1746
- * transports: {
1747
- * [tempo.id]: http(),
1748
- * },
1749
- * })
1750
- *
1751
- * const hash = await Actions.token.setRoleAdmin(config, {
1752
- * token: '0x...',
1753
- * role: 'issuer',
1754
- * adminRole: 'pause',
1755
- * })
1756
- * ```
1757
- *
1758
- * @param config - Config.
1759
- * @param parameters - Parameters.
1760
- * @returns Transaction hash.
1761
- */
1762
- export async function setRoleAdmin<config extends Config>(
1763
- config: config,
1764
- parameters: setRoleAdmin.Parameters<config>,
1765
- ): Promise<Actions.token.setRoleAdmin.ReturnValue> {
1766
- const { account, chainId, connector } = parameters
1767
-
1768
- const client = await getConnectorClient(config, {
1769
- account,
1770
- assertChainId: false,
1771
- chainId,
1772
- connector,
1773
- })
1774
-
1775
- return Actions.token.setRoleAdmin(client, parameters as never)
1776
- }
1777
-
1778
- export declare namespace setRoleAdmin {
1779
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1780
- ConnectorParameter &
1781
- UnionOmit<
1782
- Actions.token.setRoleAdmin.Parameters<config['chains'][number], Account>,
1783
- 'chain'
1784
- >
1785
-
1786
- export type ReturnValue = Actions.token.setRoleAdmin.ReturnValue
1787
-
1788
- export type ErrorType = Actions.token.setRoleAdmin.ErrorType
1789
- }
1790
-
1791
- /**
1792
- * Sets the admin role for a specific role in a TIP20 token.
1793
- *
1794
- * Note: This is a synchronous action that waits for the transaction to
1795
- * be included on a block before returning a response.
1796
- *
1797
- * @example
1798
- * ```ts
1799
- * import { createConfig, http } from '@wagmi/core'
1800
- * import { tempo } from 'viem/chains'
1801
- * import { Actions } from 'tempo.ts/wagmi'
1802
- *
1803
- * const config = createConfig({
1804
- * chains: [tempoTestnet],
1805
- * transports: {
1806
- * [tempo.id]: http(),
1807
- * },
1808
- * })
1809
- *
1810
- * const result = await Actions.token.setRoleAdminSync(config, {
1811
- * token: '0x...',
1812
- * role: 'issuer',
1813
- * adminRole: 'pause',
1814
- * })
1815
- * ```
1816
- *
1817
- * @param config - Config.
1818
- * @param parameters - Parameters.
1819
- * @returns The transaction receipt and event data.
1820
- */
1821
- export async function setRoleAdminSync<config extends Config>(
1822
- config: config,
1823
- parameters: setRoleAdminSync.Parameters<config>,
1824
- ): Promise<Actions.token.setRoleAdminSync.ReturnValue> {
1825
- const { account, chainId, connector } = parameters
1826
-
1827
- const client = await getConnectorClient(config, {
1828
- account,
1829
- assertChainId: false,
1830
- chainId,
1831
- connector,
1832
- })
1833
-
1834
- return Actions.token.setRoleAdminSync(client, parameters as never)
1835
- }
1836
-
1837
- export declare namespace setRoleAdminSync {
1838
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1839
- ConnectorParameter &
1840
- UnionOmit<
1841
- Actions.token.setRoleAdminSync.Parameters<
1842
- config['chains'][number],
1843
- Account
1844
- >,
1845
- 'chain'
1846
- >
1847
-
1848
- export type ReturnValue = Actions.token.setRoleAdminSync.ReturnValue
1849
-
1850
- export type ErrorType = Actions.token.setRoleAdminSync.ErrorType
1851
- }
1852
-
1853
- /**
1854
- * Sets the supply cap for a TIP20 token.
1855
- *
1856
- * @example
1857
- * ```ts
1858
- * import { createConfig, http } from '@wagmi/core'
1859
- * import { tempo } from 'viem/chains'
1860
- * import { Actions } from 'tempo.ts/wagmi'
1861
- *
1862
- * const config = createConfig({
1863
- * chains: [tempoTestnet],
1864
- * transports: {
1865
- * [tempo.id]: http(),
1866
- * },
1867
- * })
1868
- *
1869
- * const hash = await Actions.token.setSupplyCap(config, {
1870
- * token: '0x...',
1871
- * supplyCap: 1000000n,
1872
- * })
1873
- * ```
1874
- *
1875
- * @param config - Config.
1876
- * @param parameters - Parameters.
1877
- * @returns Transaction hash.
1878
- */
1879
- export async function setSupplyCap<config extends Config>(
1880
- config: config,
1881
- parameters: setSupplyCap.Parameters<config>,
1882
- ): Promise<Actions.token.setSupplyCap.ReturnValue> {
1883
- const { account, chainId, connector } = parameters
1884
-
1885
- const client = await getConnectorClient(config, {
1886
- account,
1887
- assertChainId: false,
1888
- chainId,
1889
- connector,
1890
- })
1891
-
1892
- return Actions.token.setSupplyCap(client, parameters as never)
1893
- }
1894
-
1895
- export declare namespace setSupplyCap {
1896
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1897
- ConnectorParameter &
1898
- UnionOmit<
1899
- Actions.token.setSupplyCap.Parameters<config['chains'][number], Account>,
1900
- 'chain'
1901
- >
1902
-
1903
- export type ReturnValue = Actions.token.setSupplyCap.ReturnValue
1904
-
1905
- export type ErrorType = Actions.token.setSupplyCap.ErrorType
1906
- }
1907
-
1908
- /**
1909
- * Sets the supply cap for a TIP20 token.
1910
- *
1911
- * Note: This is a synchronous action that waits for the transaction to
1912
- * be included on a block before returning a response.
1913
- *
1914
- * @example
1915
- * ```ts
1916
- * import { createConfig, http } from '@wagmi/core'
1917
- * import { tempo } from 'viem/chains'
1918
- * import { Actions } from 'tempo.ts/wagmi'
1919
- *
1920
- * const config = createConfig({
1921
- * chains: [tempoTestnet],
1922
- * transports: {
1923
- * [tempo.id]: http(),
1924
- * },
1925
- * })
1926
- *
1927
- * const result = await Actions.token.setSupplyCapSync(config, {
1928
- * token: '0x...',
1929
- * supplyCap: 1000000n,
1930
- * })
1931
- * ```
1932
- *
1933
- * @param config - Config.
1934
- * @param parameters - Parameters.
1935
- * @returns The transaction receipt and event data.
1936
- */
1937
- export async function setSupplyCapSync<config extends Config>(
1938
- config: config,
1939
- parameters: setSupplyCapSync.Parameters<config>,
1940
- ): Promise<Actions.token.setSupplyCapSync.ReturnValue> {
1941
- const { account, chainId, connector } = parameters
1942
-
1943
- const client = await getConnectorClient(config, {
1944
- account,
1945
- assertChainId: false,
1946
- chainId,
1947
- connector,
1948
- })
1949
-
1950
- return Actions.token.setSupplyCapSync(client, parameters as never)
1951
- }
1952
-
1953
- export declare namespace setSupplyCapSync {
1954
- export type Parameters<config extends Config> = ChainIdParameter<config> &
1955
- ConnectorParameter &
1956
- UnionOmit<
1957
- Actions.token.setSupplyCapSync.Parameters<
1958
- config['chains'][number],
1959
- Account
1960
- >,
1961
- 'chain'
1962
- >
1963
-
1964
- export type ReturnValue = Actions.token.setSupplyCapSync.ReturnValue
1965
-
1966
- export type ErrorType = Actions.token.setSupplyCapSync.ErrorType
1967
- }
1968
-
1969
- /**
1970
- * Transfers TIP20 tokens to another address.
1971
- *
1972
- * @example
1973
- * ```ts
1974
- * import { createConfig, http } from '@wagmi/core'
1975
- * import { tempo } from 'viem/chains'
1976
- * import { Actions } from 'tempo.ts/wagmi'
1977
- *
1978
- * const config = createConfig({
1979
- * chains: [tempoTestnet],
1980
- * transports: {
1981
- * [tempo.id]: http(),
1982
- * },
1983
- * })
1984
- *
1985
- * const hash = await Actions.token.transfer(config, {
1986
- * to: '0x...',
1987
- * amount: 100n,
1988
- * })
1989
- * ```
1990
- *
1991
- * @param config - Config.
1992
- * @param parameters - Parameters.
1993
- * @returns Transaction hash.
1994
- */
1995
- export async function transfer<config extends Config>(
1996
- config: config,
1997
- parameters: transfer.Parameters<config>,
1998
- ): Promise<Actions.token.transfer.ReturnValue> {
1999
- const { account, chainId, connector } = parameters
2000
-
2001
- const client = await getConnectorClient(config, {
2002
- account,
2003
- assertChainId: false,
2004
- chainId,
2005
- connector,
2006
- })
2007
-
2008
- return Actions.token.transfer(client, parameters as never)
2009
- }
2010
-
2011
- export declare namespace transfer {
2012
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2013
- ConnectorParameter &
2014
- UnionOmit<
2015
- Actions.token.transfer.Parameters<config['chains'][number], Account>,
2016
- 'chain'
2017
- >
2018
-
2019
- export type ReturnValue = Actions.token.transfer.ReturnValue
2020
-
2021
- export type ErrorType = Actions.token.transfer.ErrorType
2022
- }
2023
-
2024
- /**
2025
- * Transfers TIP20 tokens to another address.
2026
- *
2027
- * Note: This is a synchronous action that waits for the transaction to
2028
- * be included on a block before returning a response.
2029
- *
2030
- * @example
2031
- * ```ts
2032
- * import { createConfig, http } from '@wagmi/core'
2033
- * import { tempo } from 'viem/chains'
2034
- * import { Actions } from 'tempo.ts/wagmi'
2035
- *
2036
- * const config = createConfig({
2037
- * chains: [tempoTestnet],
2038
- * transports: {
2039
- * [tempo.id]: http(),
2040
- * },
2041
- * })
2042
- *
2043
- * const result = await Actions.token.transferSync(config, {
2044
- * to: '0x...',
2045
- * amount: 100n,
2046
- * })
2047
- * ```
2048
- *
2049
- * @param config - Config.
2050
- * @param parameters - Parameters.
2051
- * @returns The transaction receipt and event data.
2052
- */
2053
- export async function transferSync<config extends Config>(
2054
- config: config,
2055
- parameters: transferSync.Parameters<config>,
2056
- ): Promise<Actions.token.transferSync.ReturnValue> {
2057
- const { account, chainId, connector } = parameters
2058
-
2059
- const client = await getConnectorClient(config, {
2060
- account,
2061
- assertChainId: false,
2062
- chainId,
2063
- connector,
2064
- })
2065
-
2066
- return Actions.token.transferSync(client, parameters as never)
2067
- }
2068
-
2069
- export declare namespace transferSync {
2070
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2071
- ConnectorParameter &
2072
- UnionOmit<
2073
- Actions.token.transferSync.Parameters<config['chains'][number], Account>,
2074
- 'chain'
2075
- >
2076
-
2077
- export type ReturnValue = Actions.token.transferSync.ReturnValue
2078
-
2079
- export type ErrorType = Actions.token.transferSync.ErrorType
2080
- }
2081
-
2082
- /**
2083
- * Unpauses a TIP20 token.
2084
- *
2085
- * @example
2086
- * ```ts
2087
- * import { createConfig, http } from '@wagmi/core'
2088
- * import { tempo } from 'viem/chains'
2089
- * import { Actions } from 'tempo.ts/wagmi'
2090
- *
2091
- * const config = createConfig({
2092
- * chains: [tempoTestnet],
2093
- * transports: {
2094
- * [tempo.id]: http(),
2095
- * },
2096
- * })
2097
- *
2098
- * const hash = await Actions.token.unpause(config, {
2099
- * token: '0x...',
2100
- * })
2101
- * ```
2102
- *
2103
- * @param config - Config.
2104
- * @param parameters - Parameters.
2105
- * @returns Transaction hash.
2106
- */
2107
- export async function unpause<config extends Config>(
2108
- config: config,
2109
- parameters: unpause.Parameters<config>,
2110
- ): Promise<Actions.token.unpause.ReturnValue> {
2111
- const { account, chainId, connector } = parameters
2112
-
2113
- const client = await getConnectorClient(config, {
2114
- account,
2115
- assertChainId: false,
2116
- chainId,
2117
- connector,
2118
- })
2119
-
2120
- return Actions.token.unpause(client, parameters as never)
2121
- }
2122
-
2123
- export declare namespace unpause {
2124
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2125
- ConnectorParameter &
2126
- UnionOmit<
2127
- Actions.token.unpause.Parameters<config['chains'][number], Account>,
2128
- 'chain'
2129
- >
2130
-
2131
- export type ReturnValue = Actions.token.unpause.ReturnValue
2132
-
2133
- export type ErrorType = Actions.token.unpause.ErrorType
2134
- }
2135
-
2136
- /**
2137
- * Unpauses a TIP20 token.
2138
- *
2139
- * Note: This is a synchronous action that waits for the transaction to
2140
- * be included on a block before returning a response.
2141
- *
2142
- * @example
2143
- * ```ts
2144
- * import { createConfig, http } from '@wagmi/core'
2145
- * import { tempo } from 'viem/chains'
2146
- * import { Actions } from 'tempo.ts/wagmi'
2147
- *
2148
- * const config = createConfig({
2149
- * chains: [tempoTestnet],
2150
- * transports: {
2151
- * [tempo.id]: http(),
2152
- * },
2153
- * })
2154
- *
2155
- * const result = await Actions.token.unpauseSync(config, {
2156
- * token: '0x...',
2157
- * })
2158
- * ```
2159
- *
2160
- * @param config - Config.
2161
- * @param parameters - Parameters.
2162
- * @returns The transaction receipt and event data.
2163
- */
2164
- export async function unpauseSync<config extends Config>(
2165
- config: config,
2166
- parameters: unpauseSync.Parameters<config>,
2167
- ): Promise<Actions.token.unpauseSync.ReturnValue> {
2168
- const { account, chainId, connector } = parameters
2169
-
2170
- const client = await getConnectorClient(config, {
2171
- account,
2172
- assertChainId: false,
2173
- chainId,
2174
- connector,
2175
- })
2176
-
2177
- return Actions.token.unpauseSync(client, parameters as never)
2178
- }
2179
-
2180
- export declare namespace unpauseSync {
2181
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2182
- ConnectorParameter &
2183
- UnionOmit<
2184
- Actions.token.unpauseSync.Parameters<config['chains'][number], Account>,
2185
- 'chain'
2186
- >
2187
-
2188
- export type ReturnValue = Actions.token.unpauseSync.ReturnValue
2189
-
2190
- export type ErrorType = Actions.token.unpauseSync.ErrorType
2191
- }
2192
-
2193
- /**
2194
- * Prepares the quote token update for a TIP20 token.
2195
- *
2196
- * @example
2197
- * ```ts
2198
- * import { createConfig, http } from '@wagmi/core'
2199
- * import { tempo } from 'viem/chains'
2200
- * import { Actions } from 'tempo.ts/wagmi'
2201
- *
2202
- * const config = createConfig({
2203
- * chains: [tempoTestnet],
2204
- * transports: {
2205
- * [tempo.id]: http(),
2206
- * },
2207
- * })
2208
- *
2209
- * const hash = await Actions.token.prepareUpdateQuoteToken(config, {
2210
- * token: '0x...',
2211
- * quoteToken: '0x...',
2212
- * })
2213
- * ```
2214
- *
2215
- * @param config - Config.
2216
- * @param parameters - Parameters.
2217
- * @returns Transaction hash.
2218
- */
2219
- export async function prepareUpdateQuoteToken<config extends Config>(
2220
- config: config,
2221
- parameters: prepareUpdateQuoteToken.Parameters<config>,
2222
- ): Promise<Actions.token.prepareUpdateQuoteToken.ReturnValue> {
2223
- const { account, chainId, connector } = parameters
2224
-
2225
- const client = await getConnectorClient(config, {
2226
- account,
2227
- assertChainId: false,
2228
- chainId,
2229
- connector,
2230
- })
2231
-
2232
- return Actions.token.prepareUpdateQuoteToken(client, parameters as never)
2233
- }
2234
-
2235
- export declare namespace prepareUpdateQuoteToken {
2236
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2237
- ConnectorParameter &
2238
- UnionOmit<
2239
- Actions.token.prepareUpdateQuoteToken.Parameters<
2240
- config['chains'][number],
2241
- Account
2242
- >,
2243
- 'chain'
2244
- >
2245
-
2246
- export type ReturnValue = Actions.token.prepareUpdateQuoteToken.ReturnValue
2247
-
2248
- export type ErrorType = Actions.token.prepareUpdateQuoteToken.ErrorType
2249
- }
2250
-
2251
- /**
2252
- * Prepares the quote token update for a TIP20 token.
2253
- *
2254
- * Note: This is a synchronous action that waits for the transaction to
2255
- * be included on a block before returning a response.
2256
- *
2257
- * @example
2258
- * ```ts
2259
- * import { createConfig, http } from '@wagmi/core'
2260
- * import { tempo } from 'viem/chains'
2261
- * import { Actions } from 'tempo.ts/wagmi'
2262
- *
2263
- * const config = createConfig({
2264
- * chains: [tempoTestnet],
2265
- * transports: {
2266
- * [tempo.id]: http(),
2267
- * },
2268
- * })
2269
- *
2270
- * const result = await Actions.token.prepareUpdateQuoteTokenSync(config, {
2271
- * token: '0x...',
2272
- * quoteToken: '0x...',
2273
- * })
2274
- * ```
2275
- *
2276
- * @param config - Config.
2277
- * @param parameters - Parameters.
2278
- * @returns The transaction receipt and event data.
2279
- */
2280
- export async function prepareUpdateQuoteTokenSync<config extends Config>(
2281
- config: config,
2282
- parameters: prepareUpdateQuoteTokenSync.Parameters<config>,
2283
- ): Promise<Actions.token.prepareUpdateQuoteTokenSync.ReturnValue> {
2284
- const { account, chainId, connector } = parameters
2285
-
2286
- const client = await getConnectorClient(config, {
2287
- account,
2288
- assertChainId: false,
2289
- chainId,
2290
- connector,
2291
- })
2292
-
2293
- return Actions.token.prepareUpdateQuoteTokenSync(client, parameters as never)
2294
- }
2295
-
2296
- export declare namespace prepareUpdateQuoteTokenSync {
2297
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2298
- ConnectorParameter &
2299
- UnionOmit<
2300
- Actions.token.prepareUpdateQuoteTokenSync.Parameters<
2301
- config['chains'][number],
2302
- Account
2303
- >,
2304
- 'chain'
2305
- >
2306
-
2307
- export type ReturnValue =
2308
- Actions.token.prepareUpdateQuoteTokenSync.ReturnValue
2309
-
2310
- export type ErrorType = Actions.token.prepareUpdateQuoteTokenSync.ErrorType
2311
- }
2312
-
2313
- /**
2314
- * Watches for TIP20 token role admin updates.
2315
- *
2316
- * @example
2317
- * ```ts
2318
- * import { createConfig, http } from '@wagmi/core'
2319
- * import { tempo } from 'viem/chains'
2320
- * import { Actions } from 'tempo.ts/wagmi'
2321
- *
2322
- * const config = createConfig({
2323
- * chains: [tempoTestnet],
2324
- * transports: {
2325
- * [tempo.id]: http(),
2326
- * },
2327
- * })
2328
- *
2329
- * const unwatch = Actions.token.watchAdminRole(config, {
2330
- * onRoleAdminUpdated: (args, log) => {
2331
- * console.log('Role admin updated:', args)
2332
- * },
2333
- * })
2334
- * ```
2335
- *
2336
- * @param config - Config.
2337
- * @param parameters - Parameters.
2338
- * @returns A function to unsubscribe from the event.
2339
- */
2340
- export function watchAdminRole<config extends Config>(
2341
- config: config,
2342
- parameters: watchAdminRole.Parameters<config>,
2343
- ) {
2344
- const { chainId, ...rest } = parameters
2345
- const client = config.getClient({ chainId })
2346
- return Actions.token.watchAdminRole(client, rest)
2347
- }
2348
-
2349
- export declare namespace watchAdminRole {
2350
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2351
- Actions.token.watchAdminRole.Parameters
2352
- }
2353
-
2354
- /**
2355
- * Watches for TIP20 token approval events.
2356
- *
2357
- * @example
2358
- * ```ts
2359
- * import { createConfig, http } from '@wagmi/core'
2360
- * import { tempo } from 'viem/chains'
2361
- * import { Actions } from 'tempo.ts/wagmi'
2362
- *
2363
- * const config = createConfig({
2364
- * chains: [tempoTestnet],
2365
- * transports: {
2366
- * [tempo.id]: http(),
2367
- * },
2368
- * })
2369
- *
2370
- * const unwatch = Actions.token.watchApprove(config, {
2371
- * onApproval: (args, log) => {
2372
- * console.log('Approval:', args)
2373
- * },
2374
- * })
2375
- * ```
2376
- *
2377
- * @param config - Config.
2378
- * @param parameters - Parameters.
2379
- * @returns A function to unsubscribe from the event.
2380
- */
2381
- export function watchApprove<config extends Config>(
2382
- config: config,
2383
- parameters: watchApprove.Parameters<config>,
2384
- ) {
2385
- const { chainId, ...rest } = parameters
2386
- const client = config.getClient({ chainId })
2387
- return Actions.token.watchApprove(client, rest)
2388
- }
2389
-
2390
- export declare namespace watchApprove {
2391
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2392
- Actions.token.watchApprove.Parameters
2393
- }
2394
-
2395
- /**
2396
- * Watches for TIP20 token burn events.
2397
- *
2398
- * @example
2399
- * ```ts
2400
- * import { createConfig, http } from '@wagmi/core'
2401
- * import { tempo } from 'viem/chains'
2402
- * import { Actions } from 'tempo.ts/wagmi'
2403
- *
2404
- * const config = createConfig({
2405
- * chains: [tempoTestnet],
2406
- * transports: {
2407
- * [tempo.id]: http(),
2408
- * },
2409
- * })
2410
- *
2411
- * const unwatch = Actions.token.watchBurn(config, {
2412
- * onBurn: (args, log) => {
2413
- * console.log('Burn:', args)
2414
- * },
2415
- * })
2416
- * ```
2417
- *
2418
- * @param config - Config.
2419
- * @param parameters - Parameters.
2420
- * @returns A function to unsubscribe from the event.
2421
- */
2422
- export function watchBurn<config extends Config>(
2423
- config: config,
2424
- parameters: watchBurn.Parameters<config>,
2425
- ) {
2426
- const { chainId, ...rest } = parameters
2427
- const client = config.getClient({ chainId })
2428
- return Actions.token.watchBurn(client, rest)
2429
- }
2430
-
2431
- export declare namespace watchBurn {
2432
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2433
- Actions.token.watchBurn.Parameters
2434
- }
2435
-
2436
- /**
2437
- * Watches for new TIP20 tokens created.
2438
- *
2439
- * @example
2440
- * ```ts
2441
- * import { createConfig, http } from '@wagmi/core'
2442
- * import { tempo } from 'viem/chains'
2443
- * import { Actions } from 'tempo.ts/wagmi'
2444
- *
2445
- * const config = createConfig({
2446
- * chains: [tempoTestnet],
2447
- * transports: {
2448
- * [tempo.id]: http(),
2449
- * },
2450
- * })
2451
- *
2452
- * const unwatch = Actions.token.watchCreate(config, {
2453
- * onTokenCreated: (args, log) => {
2454
- * console.log('Token created:', args)
2455
- * },
2456
- * })
2457
- * ```
2458
- *
2459
- * @param config - Config.
2460
- * @param parameters - Parameters.
2461
- * @returns A function to unsubscribe from the event.
2462
- */
2463
- export function watchCreate<config extends Config>(
2464
- config: config,
2465
- parameters: watchCreate.Parameters<config>,
2466
- ) {
2467
- const { chainId, ...rest } = parameters
2468
- const client = config.getClient({ chainId })
2469
- return Actions.token.watchCreate(client, rest)
2470
- }
2471
-
2472
- export declare namespace watchCreate {
2473
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2474
- Actions.token.watchCreate.Parameters
2475
- }
2476
-
2477
- /**
2478
- * Watches for TIP20 token mint events.
2479
- *
2480
- * @example
2481
- * ```ts
2482
- * import { createConfig, http } from '@wagmi/core'
2483
- * import { tempo } from 'viem/chains'
2484
- * import { Actions } from 'tempo.ts/wagmi'
2485
- *
2486
- * const config = createConfig({
2487
- * chains: [tempoTestnet],
2488
- * transports: {
2489
- * [tempo.id]: http(),
2490
- * },
2491
- * })
2492
- *
2493
- * const unwatch = Actions.token.watchMint(config, {
2494
- * onMint: (args, log) => {
2495
- * console.log('Mint:', args)
2496
- * },
2497
- * })
2498
- * ```
2499
- *
2500
- * @param config - Config.
2501
- * @param parameters - Parameters.
2502
- * @returns A function to unsubscribe from the event.
2503
- */
2504
- export function watchMint<config extends Config>(
2505
- config: config,
2506
- parameters: watchMint.Parameters<config>,
2507
- ) {
2508
- const { chainId, ...rest } = parameters
2509
- const client = config.getClient({ chainId })
2510
- return Actions.token.watchMint(client, rest)
2511
- }
2512
-
2513
- export declare namespace watchMint {
2514
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2515
- Actions.token.watchMint.Parameters
2516
-
2517
- export type ReturnValue = Actions.token.watchMint.ReturnValue
2518
- }
2519
-
2520
- /**
2521
- * Watches for TIP20 token role membership updates.
2522
- *
2523
- * @example
2524
- * ```ts
2525
- * import { createConfig, http } from '@wagmi/core'
2526
- * import { tempo } from 'viem/chains'
2527
- * import { Actions } from 'tempo.ts/wagmi'
2528
- *
2529
- * const config = createConfig({
2530
- * chains: [tempoTestnet],
2531
- * transports: {
2532
- * [tempo.id]: http(),
2533
- * },
2534
- * })
2535
- *
2536
- * const unwatch = Actions.token.watchRole(config, {
2537
- * onRoleUpdated: (args, log) => {
2538
- * console.log('Role updated:', args)
2539
- * },
2540
- * })
2541
- * ```
2542
- *
2543
- * @param config - Config.
2544
- * @param parameters - Parameters.
2545
- * @returns A function to unsubscribe from the event.
2546
- */
2547
- export function watchRole<config extends Config>(
2548
- config: config,
2549
- parameters: watchRole.Parameters<config>,
2550
- ) {
2551
- const { chainId, ...rest } = parameters
2552
- const client = config.getClient({ chainId })
2553
- return Actions.token.watchRole(client, rest)
2554
- }
2555
-
2556
- export declare namespace watchRole {
2557
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2558
- Actions.token.watchRole.Parameters
2559
- }
2560
-
2561
- /**
2562
- * Watches for TIP20 token transfer events.
2563
- *
2564
- * @example
2565
- * ```ts
2566
- * import { createConfig, http } from '@wagmi/core'
2567
- * import { tempo } from 'viem/chains'
2568
- * import { Actions } from 'tempo.ts/wagmi'
2569
- *
2570
- * const config = createConfig({
2571
- * chains: [tempoTestnet],
2572
- * transports: {
2573
- * [tempo.id]: http(),
2574
- * },
2575
- * })
2576
- *
2577
- * const unwatch = Actions.token.watchTransfer(config, {
2578
- * onTransfer: (args, log) => {
2579
- * console.log('Transfer:', args)
2580
- * },
2581
- * })
2582
- * ```
2583
- *
2584
- * @param config - Config.
2585
- * @param parameters - Parameters.
2586
- * @returns A function to unsubscribe from the event.
2587
- */
2588
- export function watchTransfer<config extends Config>(
2589
- config: config,
2590
- parameters: watchTransfer.Parameters<config>,
2591
- ) {
2592
- const { chainId, ...rest } = parameters
2593
- const client = config.getClient({ chainId })
2594
- return Actions.token.watchTransfer(client, rest)
2595
- }
2596
-
2597
- export declare namespace watchTransfer {
2598
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2599
- Actions.token.watchTransfer.Parameters
2600
- }
2601
-
2602
- /**
2603
- * Watches for TIP20 token quote token update events.
2604
- *
2605
- * @example
2606
- * ```ts
2607
- * import { createConfig, http } from '@wagmi/core'
2608
- * import { tempo } from 'viem/chains'
2609
- * import { Actions } from 'tempo.ts/wagmi'
2610
- *
2611
- * const config = createConfig({
2612
- * chains: [tempoTestnet],
2613
- * transports: {
2614
- * [tempo.id]: http(),
2615
- * },
2616
- * })
2617
- *
2618
- * const unwatch = Actions.token.watchUpdateQuoteToken(config, {
2619
- * onUpdateQuoteToken: (args, log) => {
2620
- * if (args.completed)
2621
- * console.log('quote token update completed:', args.newQuoteToken)
2622
- * else
2623
- * console.log('quote token update proposed:', args.newQuoteToken)
2624
- * },
2625
- * })
2626
- * ```
2627
- *
2628
- * @param config - Config.
2629
- * @param parameters - Parameters.
2630
- * @returns A function to unsubscribe from the event.
2631
- */
2632
- export function watchUpdateQuoteToken<config extends Config>(
2633
- config: config,
2634
- parameters: watchUpdateQuoteToken.Parameters<config>,
2635
- ) {
2636
- const { chainId, ...rest } = parameters
2637
- const client = config.getClient({ chainId })
2638
- return Actions.token.watchUpdateQuoteToken(client, rest)
2639
- }
2640
-
2641
- export declare namespace watchUpdateQuoteToken {
2642
- export type Parameters<config extends Config> = ChainIdParameter<config> &
2643
- Actions.token.watchUpdateQuoteToken.Parameters
2644
- }