@wagmi/core 3.0.2 → 3.1.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/Actions/amm.js +469 -0
- package/dist/esm/tempo/Actions/amm.js.map +1 -0
- package/dist/esm/tempo/Actions/dex.js +983 -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 +176 -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/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/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/Actions/amm.d.ts +418 -0
- package/dist/types/tempo/Actions/amm.d.ts.map +1 -0
- package/dist/types/tempo/Actions/dex.d.ts +858 -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 +150 -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/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/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/Actions/amm.ts +719 -0
- package/src/tempo/Actions/dex.ts +1571 -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 +283 -0
- package/src/tempo/Actions/policy.ts +827 -0
- package/src/tempo/Actions/reward.ts +621 -0
- package/src/tempo/Actions/token.ts +2598 -0
- package/src/tempo/Actions/utils.ts +26 -0
- package/src/tempo/Connectors.ts +762 -0
- package/src/tempo/KeyManager.ts +176 -0
- package/src/types/utils.ts +19 -0
- package/src/version.ts +1 -1
- package/tempo/package.json +5 -0
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
import { Actions } from 'viem/tempo';
|
|
2
|
+
import { getConnectorClient } from '../../actions/getConnectorClient.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new policy.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
9
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
10
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
11
|
+
*
|
|
12
|
+
* const config = createConfig({
|
|
13
|
+
* chains: [tempoTestnet],
|
|
14
|
+
* transports: {
|
|
15
|
+
* [tempo.id]: http(),
|
|
16
|
+
* },
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* const hash = await Actions.policy.create(config, {
|
|
20
|
+
* type: 'whitelist',
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param config - Config.
|
|
25
|
+
* @param parameters - Parameters.
|
|
26
|
+
* @returns Transaction hash.
|
|
27
|
+
*/
|
|
28
|
+
export async function create(config, parameters) {
|
|
29
|
+
const { account, chainId, connector } = parameters;
|
|
30
|
+
const client = await getConnectorClient(config, {
|
|
31
|
+
account,
|
|
32
|
+
assertChainId: false,
|
|
33
|
+
chainId,
|
|
34
|
+
connector,
|
|
35
|
+
});
|
|
36
|
+
return Actions.policy.create(client, parameters);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new policy.
|
|
40
|
+
*
|
|
41
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
42
|
+
* be included on a block before returning a response.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
47
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
48
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
49
|
+
*
|
|
50
|
+
* const config = createConfig({
|
|
51
|
+
* chains: [tempoTestnet],
|
|
52
|
+
* transports: {
|
|
53
|
+
* [tempo.id]: http(),
|
|
54
|
+
* },
|
|
55
|
+
* })
|
|
56
|
+
*
|
|
57
|
+
* const result = await Actions.policy.createSync(config, {
|
|
58
|
+
* type: 'whitelist',
|
|
59
|
+
* })
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param config - Config.
|
|
63
|
+
* @param parameters - Parameters.
|
|
64
|
+
* @returns The transaction receipt and event data.
|
|
65
|
+
*/
|
|
66
|
+
export async function createSync(config, parameters) {
|
|
67
|
+
const { account, chainId, connector } = parameters;
|
|
68
|
+
const client = await getConnectorClient(config, {
|
|
69
|
+
account,
|
|
70
|
+
assertChainId: false,
|
|
71
|
+
chainId,
|
|
72
|
+
connector,
|
|
73
|
+
});
|
|
74
|
+
return Actions.policy.createSync(client, parameters);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Sets the admin for a policy.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
82
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
83
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
84
|
+
*
|
|
85
|
+
* const config = createConfig({
|
|
86
|
+
* chains: [tempoTestnet],
|
|
87
|
+
* transports: {
|
|
88
|
+
* [tempo.id]: http(),
|
|
89
|
+
* },
|
|
90
|
+
* })
|
|
91
|
+
*
|
|
92
|
+
* const hash = await Actions.policy.setAdmin(config, {
|
|
93
|
+
* policyId: 2n,
|
|
94
|
+
* admin: '0x...',
|
|
95
|
+
* })
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @param config - Config.
|
|
99
|
+
* @param parameters - Parameters.
|
|
100
|
+
* @returns Transaction hash.
|
|
101
|
+
*/
|
|
102
|
+
export async function setAdmin(config, parameters) {
|
|
103
|
+
const { account, chainId, connector } = parameters;
|
|
104
|
+
const client = await getConnectorClient(config, {
|
|
105
|
+
account,
|
|
106
|
+
assertChainId: false,
|
|
107
|
+
chainId,
|
|
108
|
+
connector,
|
|
109
|
+
});
|
|
110
|
+
return Actions.policy.setAdmin(client, parameters);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sets the admin for a policy.
|
|
114
|
+
*
|
|
115
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
116
|
+
* be included on a block before returning a response.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
121
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
122
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
123
|
+
*
|
|
124
|
+
* const config = createConfig({
|
|
125
|
+
* chains: [tempoTestnet],
|
|
126
|
+
* transports: {
|
|
127
|
+
* [tempo.id]: http(),
|
|
128
|
+
* },
|
|
129
|
+
* })
|
|
130
|
+
*
|
|
131
|
+
* const result = await Actions.policy.setAdminSync(config, {
|
|
132
|
+
* policyId: 2n,
|
|
133
|
+
* admin: '0x...',
|
|
134
|
+
* })
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @param config - Config.
|
|
138
|
+
* @param parameters - Parameters.
|
|
139
|
+
* @returns The transaction receipt and event data.
|
|
140
|
+
*/
|
|
141
|
+
export async function setAdminSync(config, parameters) {
|
|
142
|
+
const { account, chainId, connector } = parameters;
|
|
143
|
+
const client = await getConnectorClient(config, {
|
|
144
|
+
account,
|
|
145
|
+
assertChainId: false,
|
|
146
|
+
chainId,
|
|
147
|
+
connector,
|
|
148
|
+
});
|
|
149
|
+
return Actions.policy.setAdminSync(client, parameters);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Modifies a policy whitelist.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
157
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
158
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
159
|
+
*
|
|
160
|
+
* const config = createConfig({
|
|
161
|
+
* chains: [tempoTestnet],
|
|
162
|
+
* transports: {
|
|
163
|
+
* [tempo.id]: http(),
|
|
164
|
+
* },
|
|
165
|
+
* })
|
|
166
|
+
*
|
|
167
|
+
* const hash = await Actions.policy.modifyWhitelist(config, {
|
|
168
|
+
* policyId: 2n,
|
|
169
|
+
* address: '0x...',
|
|
170
|
+
* allowed: true,
|
|
171
|
+
* })
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @param config - Config.
|
|
175
|
+
* @param parameters - Parameters.
|
|
176
|
+
* @returns Transaction hash.
|
|
177
|
+
*/
|
|
178
|
+
export async function modifyWhitelist(config, parameters) {
|
|
179
|
+
const { account, chainId, connector } = parameters;
|
|
180
|
+
const client = await getConnectorClient(config, {
|
|
181
|
+
account,
|
|
182
|
+
assertChainId: false,
|
|
183
|
+
chainId,
|
|
184
|
+
connector,
|
|
185
|
+
});
|
|
186
|
+
return Actions.policy.modifyWhitelist(client, parameters);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Modifies a policy whitelist.
|
|
190
|
+
*
|
|
191
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
192
|
+
* be included on a block before returning a response.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
197
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
198
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
199
|
+
*
|
|
200
|
+
* const config = createConfig({
|
|
201
|
+
* chains: [tempoTestnet],
|
|
202
|
+
* transports: {
|
|
203
|
+
* [tempo.id]: http(),
|
|
204
|
+
* },
|
|
205
|
+
* })
|
|
206
|
+
*
|
|
207
|
+
* const result = await Actions.policy.modifyWhitelistSync(config, {
|
|
208
|
+
* policyId: 2n,
|
|
209
|
+
* address: '0x...',
|
|
210
|
+
* allowed: true,
|
|
211
|
+
* })
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @param config - Config.
|
|
215
|
+
* @param parameters - Parameters.
|
|
216
|
+
* @returns The transaction receipt and event data.
|
|
217
|
+
*/
|
|
218
|
+
export async function modifyWhitelistSync(config, parameters) {
|
|
219
|
+
const { account, chainId, connector } = parameters;
|
|
220
|
+
const client = await getConnectorClient(config, {
|
|
221
|
+
account,
|
|
222
|
+
assertChainId: false,
|
|
223
|
+
chainId,
|
|
224
|
+
connector,
|
|
225
|
+
});
|
|
226
|
+
return Actions.policy.modifyWhitelistSync(client, parameters);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Modifies a policy blacklist.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
234
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
235
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
236
|
+
*
|
|
237
|
+
* const config = createConfig({
|
|
238
|
+
* chains: [tempoTestnet],
|
|
239
|
+
* transports: {
|
|
240
|
+
* [tempo.id]: http(),
|
|
241
|
+
* },
|
|
242
|
+
* })
|
|
243
|
+
*
|
|
244
|
+
* const hash = await Actions.policy.modifyBlacklist(config, {
|
|
245
|
+
* policyId: 2n,
|
|
246
|
+
* address: '0x...',
|
|
247
|
+
* restricted: true,
|
|
248
|
+
* })
|
|
249
|
+
* ```
|
|
250
|
+
*
|
|
251
|
+
* @param config - Config.
|
|
252
|
+
* @param parameters - Parameters.
|
|
253
|
+
* @returns Transaction hash.
|
|
254
|
+
*/
|
|
255
|
+
export async function modifyBlacklist(config, parameters) {
|
|
256
|
+
const { account, chainId, connector } = parameters;
|
|
257
|
+
const client = await getConnectorClient(config, {
|
|
258
|
+
account,
|
|
259
|
+
assertChainId: false,
|
|
260
|
+
chainId,
|
|
261
|
+
connector,
|
|
262
|
+
});
|
|
263
|
+
return Actions.policy.modifyBlacklist(client, parameters);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Modifies a policy blacklist.
|
|
267
|
+
*
|
|
268
|
+
* Note: This is a synchronous action that waits for the transaction to
|
|
269
|
+
* be included on a block before returning a response.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
274
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
275
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
276
|
+
*
|
|
277
|
+
* const config = createConfig({
|
|
278
|
+
* chains: [tempoTestnet],
|
|
279
|
+
* transports: {
|
|
280
|
+
* [tempo.id]: http(),
|
|
281
|
+
* },
|
|
282
|
+
* })
|
|
283
|
+
*
|
|
284
|
+
* const result = await Actions.policy.modifyBlacklistSync(config, {
|
|
285
|
+
* policyId: 2n,
|
|
286
|
+
* address: '0x...',
|
|
287
|
+
* restricted: true,
|
|
288
|
+
* })
|
|
289
|
+
* ```
|
|
290
|
+
*
|
|
291
|
+
* @param config - Config.
|
|
292
|
+
* @param parameters - Parameters.
|
|
293
|
+
* @returns The transaction receipt and event data.
|
|
294
|
+
*/
|
|
295
|
+
export async function modifyBlacklistSync(config, parameters) {
|
|
296
|
+
const { account, chainId, connector } = parameters;
|
|
297
|
+
const client = await getConnectorClient(config, {
|
|
298
|
+
account,
|
|
299
|
+
assertChainId: false,
|
|
300
|
+
chainId,
|
|
301
|
+
connector,
|
|
302
|
+
});
|
|
303
|
+
return Actions.policy.modifyBlacklistSync(client, parameters);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Gets policy data.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
311
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
312
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
313
|
+
*
|
|
314
|
+
* const config = createConfig({
|
|
315
|
+
* chains: [tempoTestnet],
|
|
316
|
+
* transports: {
|
|
317
|
+
* [tempo.id]: http(),
|
|
318
|
+
* },
|
|
319
|
+
* })
|
|
320
|
+
*
|
|
321
|
+
* const data = await Actions.policy.getData(config, {
|
|
322
|
+
* policyId: 2n,
|
|
323
|
+
* })
|
|
324
|
+
* ```
|
|
325
|
+
*
|
|
326
|
+
* @param config - Config.
|
|
327
|
+
* @param parameters - Parameters.
|
|
328
|
+
* @returns The policy data.
|
|
329
|
+
*/
|
|
330
|
+
export function getData(config, parameters) {
|
|
331
|
+
const { chainId, ...rest } = parameters;
|
|
332
|
+
const client = config.getClient({ chainId });
|
|
333
|
+
return Actions.policy.getData(client, rest);
|
|
334
|
+
}
|
|
335
|
+
(function (getData) {
|
|
336
|
+
function queryKey(parameters) {
|
|
337
|
+
return ['getData', parameters];
|
|
338
|
+
}
|
|
339
|
+
getData.queryKey = queryKey;
|
|
340
|
+
function queryOptions(config, parameters) {
|
|
341
|
+
const { query, ...rest } = parameters;
|
|
342
|
+
return {
|
|
343
|
+
...query,
|
|
344
|
+
enabled: Boolean(rest.policyId !== undefined && (query?.enabled ?? true)),
|
|
345
|
+
queryKey: queryKey(rest),
|
|
346
|
+
async queryFn({ queryKey }) {
|
|
347
|
+
const [, parameters] = queryKey;
|
|
348
|
+
return await getData(config, parameters);
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
getData.queryOptions = queryOptions;
|
|
353
|
+
})(getData || (getData = {}));
|
|
354
|
+
/**
|
|
355
|
+
* Checks if a user is authorized by a policy.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
360
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
361
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
362
|
+
*
|
|
363
|
+
* const config = createConfig({
|
|
364
|
+
* chains: [tempoTestnet],
|
|
365
|
+
* transports: {
|
|
366
|
+
* [tempo.id]: http(),
|
|
367
|
+
* },
|
|
368
|
+
* })
|
|
369
|
+
*
|
|
370
|
+
* const authorized = await Actions.policy.isAuthorized(config, {
|
|
371
|
+
* policyId: 2n,
|
|
372
|
+
* user: '0x...',
|
|
373
|
+
* })
|
|
374
|
+
* ```
|
|
375
|
+
*
|
|
376
|
+
* @param config - Config.
|
|
377
|
+
* @param parameters - Parameters.
|
|
378
|
+
* @returns Whether the user is authorized.
|
|
379
|
+
*/
|
|
380
|
+
export function isAuthorized(config, parameters) {
|
|
381
|
+
const { chainId, ...rest } = parameters;
|
|
382
|
+
const client = config.getClient({ chainId });
|
|
383
|
+
return Actions.policy.isAuthorized(client, rest);
|
|
384
|
+
}
|
|
385
|
+
(function (isAuthorized) {
|
|
386
|
+
function queryKey(parameters) {
|
|
387
|
+
return ['isAuthorized', parameters];
|
|
388
|
+
}
|
|
389
|
+
isAuthorized.queryKey = queryKey;
|
|
390
|
+
function queryOptions(config, parameters) {
|
|
391
|
+
const { query, ...rest } = parameters;
|
|
392
|
+
return {
|
|
393
|
+
...query,
|
|
394
|
+
enabled: Boolean(rest.policyId !== undefined && rest.user && (query?.enabled ?? true)),
|
|
395
|
+
queryKey: queryKey(rest),
|
|
396
|
+
async queryFn({ queryKey }) {
|
|
397
|
+
const [, parameters] = queryKey;
|
|
398
|
+
return await isAuthorized(config, parameters);
|
|
399
|
+
},
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
isAuthorized.queryOptions = queryOptions;
|
|
403
|
+
})(isAuthorized || (isAuthorized = {}));
|
|
404
|
+
/**
|
|
405
|
+
* Watches for policy creation events.
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```ts
|
|
409
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
410
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
411
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
412
|
+
*
|
|
413
|
+
* const config = createConfig({
|
|
414
|
+
* chains: [tempoTestnet],
|
|
415
|
+
* transports: {
|
|
416
|
+
* [tempo.id]: http(),
|
|
417
|
+
* },
|
|
418
|
+
* })
|
|
419
|
+
*
|
|
420
|
+
* const unwatch = Actions.policy.watchCreate(config, {
|
|
421
|
+
* onPolicyCreated: (args, log) => {
|
|
422
|
+
* console.log('Policy created:', args)
|
|
423
|
+
* },
|
|
424
|
+
* })
|
|
425
|
+
* ```
|
|
426
|
+
*
|
|
427
|
+
* @param config - Config.
|
|
428
|
+
* @param parameters - Parameters.
|
|
429
|
+
* @returns A function to unsubscribe from the event.
|
|
430
|
+
*/
|
|
431
|
+
export function watchCreate(config, parameters) {
|
|
432
|
+
const { chainId, ...rest } = parameters;
|
|
433
|
+
const client = config.getClient({ chainId });
|
|
434
|
+
return Actions.policy.watchCreate(client, rest);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Watches for policy admin update events.
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```ts
|
|
441
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
442
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
443
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
444
|
+
*
|
|
445
|
+
* const config = createConfig({
|
|
446
|
+
* chains: [tempoTestnet],
|
|
447
|
+
* transports: {
|
|
448
|
+
* [tempo.id]: http(),
|
|
449
|
+
* },
|
|
450
|
+
* })
|
|
451
|
+
*
|
|
452
|
+
* const unwatch = Actions.policy.watchAdminUpdated(config, {
|
|
453
|
+
* onAdminUpdated: (args, log) => {
|
|
454
|
+
* console.log('Policy admin updated:', args)
|
|
455
|
+
* },
|
|
456
|
+
* })
|
|
457
|
+
* ```
|
|
458
|
+
*
|
|
459
|
+
* @param config - Config.
|
|
460
|
+
* @param parameters - Parameters.
|
|
461
|
+
* @returns A function to unsubscribe from the event.
|
|
462
|
+
*/
|
|
463
|
+
export function watchAdminUpdated(config, parameters) {
|
|
464
|
+
const { chainId, ...rest } = parameters;
|
|
465
|
+
const client = config.getClient({ chainId });
|
|
466
|
+
return Actions.policy.watchAdminUpdated(client, rest);
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Watches for whitelist update events.
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```ts
|
|
473
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
474
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
475
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
476
|
+
*
|
|
477
|
+
* const config = createConfig({
|
|
478
|
+
* chains: [tempoTestnet],
|
|
479
|
+
* transports: {
|
|
480
|
+
* [tempo.id]: http(),
|
|
481
|
+
* },
|
|
482
|
+
* })
|
|
483
|
+
*
|
|
484
|
+
* const unwatch = Actions.policy.watchWhitelistUpdated(config, {
|
|
485
|
+
* onWhitelistUpdated: (args, log) => {
|
|
486
|
+
* console.log('Whitelist updated:', args)
|
|
487
|
+
* },
|
|
488
|
+
* })
|
|
489
|
+
* ```
|
|
490
|
+
*
|
|
491
|
+
* @param config - Config.
|
|
492
|
+
* @param parameters - Parameters.
|
|
493
|
+
* @returns A function to unsubscribe from the event.
|
|
494
|
+
*/
|
|
495
|
+
export function watchWhitelistUpdated(config, parameters) {
|
|
496
|
+
const { chainId, ...rest } = parameters;
|
|
497
|
+
const client = config.getClient({ chainId });
|
|
498
|
+
return Actions.policy.watchWhitelistUpdated(client, rest);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Watches for blacklist update events.
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* ```ts
|
|
505
|
+
* import { createConfig, http } from '@wagmi/core'
|
|
506
|
+
* import { tempo } from '@wagmi/core/chains'
|
|
507
|
+
* import { Actions } from '@wagmi/core/tempo'
|
|
508
|
+
*
|
|
509
|
+
* const config = createConfig({
|
|
510
|
+
* chains: [tempoTestnet],
|
|
511
|
+
* transports: {
|
|
512
|
+
* [tempo.id]: http(),
|
|
513
|
+
* },
|
|
514
|
+
* })
|
|
515
|
+
*
|
|
516
|
+
* const unwatch = Actions.policy.watchBlacklistUpdated(config, {
|
|
517
|
+
* onBlacklistUpdated: (args, log) => {
|
|
518
|
+
* console.log('Blacklist updated:', args)
|
|
519
|
+
* },
|
|
520
|
+
* })
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* @param config - Config.
|
|
524
|
+
* @param parameters - Parameters.
|
|
525
|
+
* @returns A function to unsubscribe from the event.
|
|
526
|
+
*/
|
|
527
|
+
export function watchBlacklistUpdated(config, parameters) {
|
|
528
|
+
const { chainId, ...rest } = parameters;
|
|
529
|
+
const client = config.getClient({ chainId });
|
|
530
|
+
return Actions.policy.watchBlacklistUpdated(client, rest);
|
|
531
|
+
}
|
|
532
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../../../src/tempo/Actions/policy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AASxE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,MAAc,EACd,UAAqC;IAErC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,UAAU,CAAA;IAElD,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE;QAC9C,OAAO;QACP,aAAa,EAAE,KAAK;QACpB,O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