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