tempo.ts 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/viem/Actions/policy.d.ts +9 -1
  2. package/dist/viem/Actions/policy.d.ts.map +1 -1
  3. package/dist/viem/Actions/policy.js.map +1 -1
  4. package/dist/viem/Chain.d.ts.map +1 -1
  5. package/dist/viem/Chain.js +8 -2
  6. package/dist/viem/Chain.js.map +1 -1
  7. package/dist/viem/Transaction.js +4 -1
  8. package/dist/viem/Transaction.js.map +1 -1
  9. package/dist/viem/Transport.d.ts +8 -0
  10. package/dist/viem/Transport.d.ts.map +1 -1
  11. package/dist/viem/Transport.js +87 -1
  12. package/dist/viem/Transport.js.map +1 -1
  13. package/dist/wagmi/Actions/faucet.d.ts +31 -0
  14. package/dist/wagmi/Actions/faucet.d.ts.map +1 -1
  15. package/dist/wagmi/Actions/faucet.js +31 -0
  16. package/dist/wagmi/Actions/faucet.js.map +1 -1
  17. package/dist/wagmi/Actions/index.d.ts +1 -0
  18. package/dist/wagmi/Actions/index.d.ts.map +1 -1
  19. package/dist/wagmi/Actions/index.js +1 -0
  20. package/dist/wagmi/Actions/index.js.map +1 -1
  21. package/dist/wagmi/Actions/policy.d.ts +481 -0
  22. package/dist/wagmi/Actions/policy.d.ts.map +1 -0
  23. package/dist/wagmi/Actions/policy.js +530 -0
  24. package/dist/wagmi/Actions/policy.js.map +1 -0
  25. package/dist/wagmi/Connector.d.ts +1 -1
  26. package/dist/wagmi/Connector.d.ts.map +1 -1
  27. package/dist/wagmi/Connector.js +3 -85
  28. package/dist/wagmi/Connector.js.map +1 -1
  29. package/dist/wagmi/Hooks/faucet.d.ts +33 -1
  30. package/dist/wagmi/Hooks/faucet.d.ts.map +1 -1
  31. package/dist/wagmi/Hooks/faucet.js +37 -1
  32. package/dist/wagmi/Hooks/faucet.js.map +1 -1
  33. package/dist/wagmi/Hooks/index.d.ts +1 -0
  34. package/dist/wagmi/Hooks/index.d.ts.map +1 -1
  35. package/dist/wagmi/Hooks/index.js +1 -0
  36. package/dist/wagmi/Hooks/index.js.map +1 -1
  37. package/dist/wagmi/Hooks/policy.d.ts +424 -0
  38. package/dist/wagmi/Hooks/policy.d.ts.map +1 -0
  39. package/dist/wagmi/Hooks/policy.js +510 -0
  40. package/dist/wagmi/Hooks/policy.js.map +1 -0
  41. package/package.json +2 -2
  42. package/src/viem/Actions/policy.ts +25 -0
  43. package/src/viem/Chain.ts +9 -2
  44. package/src/viem/Transaction.ts +9 -4
  45. package/src/viem/Transport.ts +107 -1
  46. package/src/viem/e2e.test.ts +33 -24
  47. package/src/wagmi/Actions/faucet.ts +43 -0
  48. package/src/wagmi/Actions/index.ts +1 -0
  49. package/src/wagmi/Actions/policy.test.ts +461 -0
  50. package/src/wagmi/Actions/policy.ts +819 -0
  51. package/src/wagmi/Connector.ts +4 -112
  52. package/src/wagmi/Hooks/faucet.ts +69 -1
  53. package/src/wagmi/Hooks/index.ts +1 -0
  54. package/src/wagmi/Hooks/policy.test.ts +665 -0
  55. package/src/wagmi/Hooks/policy.ts +875 -0
@@ -0,0 +1,819 @@
1
+ import type * as Query from '@tanstack/query-core'
2
+ import { type Config, getConnectorClient } from '@wagmi/core'
3
+ import type { ChainIdParameter, ConnectorParameter } from '@wagmi/core/internal'
4
+ import type { Account } from 'viem'
5
+ import type { RequiredBy, UnionOmit } from '../../internal/types.js'
6
+ import * as viem_Actions from '../../viem/Actions/policy.js'
7
+
8
+ export type { PolicyType } from '../../viem/Actions/policy.js'
9
+
10
+ /**
11
+ * Creates a new policy.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { createConfig, http } from '@wagmi/core'
16
+ * import { tempo } from 'tempo.ts/chains'
17
+ * import { Actions } from 'tempo.ts/wagmi'
18
+ *
19
+ * const config = createConfig({
20
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
21
+ * transports: {
22
+ * [tempo.id]: http(),
23
+ * },
24
+ * })
25
+ *
26
+ * const hash = await Actions.policy.create(config, {
27
+ * type: 'whitelist',
28
+ * })
29
+ * ```
30
+ *
31
+ * @param config - Config.
32
+ * @param parameters - Parameters.
33
+ * @returns Transaction hash.
34
+ */
35
+ export async function create<config extends Config>(
36
+ config: config,
37
+ parameters: create.Parameters<config>,
38
+ ): Promise<viem_Actions.create.ReturnValue> {
39
+ const { account, chainId, connector } = parameters
40
+
41
+ const client = await getConnectorClient(config, {
42
+ account,
43
+ assertChainId: false,
44
+ chainId,
45
+ connector,
46
+ })
47
+
48
+ return viem_Actions.create(client, parameters as never)
49
+ }
50
+
51
+ export declare namespace create {
52
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
53
+ ConnectorParameter &
54
+ UnionOmit<
55
+ viem_Actions.create.Parameters<config['chains'][number], Account>,
56
+ 'chain' | 'admin'
57
+ >
58
+
59
+ export type ReturnValue = viem_Actions.create.ReturnValue
60
+
61
+ export type ErrorType = viem_Actions.create.ErrorType
62
+ }
63
+
64
+ /**
65
+ * Creates a new policy.
66
+ *
67
+ * Note: This is a synchronous action that waits for the transaction to
68
+ * be included on a block before returning a response.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * import { createConfig, http } from '@wagmi/core'
73
+ * import { tempo } from 'tempo.ts/chains'
74
+ * import { Actions } from 'tempo.ts/wagmi'
75
+ *
76
+ * const config = createConfig({
77
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
78
+ * transports: {
79
+ * [tempo.id]: http(),
80
+ * },
81
+ * })
82
+ *
83
+ * const result = await Actions.policy.createSync(config, {
84
+ * type: 'whitelist',
85
+ * })
86
+ * ```
87
+ *
88
+ * @param config - Config.
89
+ * @param parameters - Parameters.
90
+ * @returns The transaction receipt and event data.
91
+ */
92
+ export async function createSync<config extends Config>(
93
+ config: config,
94
+ parameters: createSync.Parameters<config>,
95
+ ): Promise<viem_Actions.createSync.ReturnValue> {
96
+ const { account, chainId, connector } = parameters
97
+
98
+ const client = await getConnectorClient(config, {
99
+ account,
100
+ assertChainId: false,
101
+ chainId,
102
+ connector,
103
+ })
104
+
105
+ return viem_Actions.createSync(client, parameters as never)
106
+ }
107
+
108
+ export declare namespace createSync {
109
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
110
+ ConnectorParameter &
111
+ UnionOmit<
112
+ viem_Actions.createSync.Parameters<config['chains'][number], Account>,
113
+ 'chain' | 'admin'
114
+ >
115
+
116
+ export type ReturnValue = viem_Actions.createSync.ReturnValue
117
+
118
+ export type ErrorType = viem_Actions.createSync.ErrorType
119
+ }
120
+
121
+ /**
122
+ * Sets the admin for a policy.
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * import { createConfig, http } from '@wagmi/core'
127
+ * import { tempo } from 'tempo.ts/chains'
128
+ * import { Actions } from 'tempo.ts/wagmi'
129
+ *
130
+ * const config = createConfig({
131
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
132
+ * transports: {
133
+ * [tempo.id]: http(),
134
+ * },
135
+ * })
136
+ *
137
+ * const hash = await Actions.policy.setAdmin(config, {
138
+ * policyId: 2n,
139
+ * admin: '0x...',
140
+ * })
141
+ * ```
142
+ *
143
+ * @param config - Config.
144
+ * @param parameters - Parameters.
145
+ * @returns Transaction hash.
146
+ */
147
+ export async function setAdmin<config extends Config>(
148
+ config: config,
149
+ parameters: setAdmin.Parameters<config>,
150
+ ): Promise<viem_Actions.setAdmin.ReturnValue> {
151
+ const { account, chainId, connector } = parameters
152
+
153
+ const client = await getConnectorClient(config, {
154
+ account,
155
+ assertChainId: false,
156
+ chainId,
157
+ connector,
158
+ })
159
+
160
+ return viem_Actions.setAdmin(client, parameters as never)
161
+ }
162
+
163
+ export declare namespace setAdmin {
164
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
165
+ ConnectorParameter &
166
+ UnionOmit<
167
+ viem_Actions.setAdmin.Parameters<config['chains'][number], Account>,
168
+ 'chain'
169
+ >
170
+
171
+ export type ReturnValue = viem_Actions.setAdmin.ReturnValue
172
+
173
+ export type ErrorType = viem_Actions.setAdmin.ErrorType
174
+ }
175
+
176
+ /**
177
+ * Sets the admin for a policy.
178
+ *
179
+ * Note: This is a synchronous action that waits for the transaction to
180
+ * be included on a block before returning a response.
181
+ *
182
+ * @example
183
+ * ```ts
184
+ * import { createConfig, http } from '@wagmi/core'
185
+ * import { tempo } from 'tempo.ts/chains'
186
+ * import { Actions } from 'tempo.ts/wagmi'
187
+ *
188
+ * const config = createConfig({
189
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
190
+ * transports: {
191
+ * [tempo.id]: http(),
192
+ * },
193
+ * })
194
+ *
195
+ * const result = await Actions.policy.setAdminSync(config, {
196
+ * policyId: 2n,
197
+ * admin: '0x...',
198
+ * })
199
+ * ```
200
+ *
201
+ * @param config - Config.
202
+ * @param parameters - Parameters.
203
+ * @returns The transaction receipt and event data.
204
+ */
205
+ export async function setAdminSync<config extends Config>(
206
+ config: config,
207
+ parameters: setAdminSync.Parameters<config>,
208
+ ): Promise<viem_Actions.setAdminSync.ReturnValue> {
209
+ const { account, chainId, connector } = parameters
210
+
211
+ const client = await getConnectorClient(config, {
212
+ account,
213
+ assertChainId: false,
214
+ chainId,
215
+ connector,
216
+ })
217
+
218
+ return viem_Actions.setAdminSync(client, parameters as never)
219
+ }
220
+
221
+ export declare namespace setAdminSync {
222
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
223
+ ConnectorParameter &
224
+ UnionOmit<
225
+ viem_Actions.setAdminSync.Parameters<config['chains'][number], Account>,
226
+ 'chain'
227
+ >
228
+
229
+ export type ReturnValue = viem_Actions.setAdminSync.ReturnValue
230
+
231
+ export type ErrorType = viem_Actions.setAdminSync.ErrorType
232
+ }
233
+
234
+ /**
235
+ * Modifies a policy whitelist.
236
+ *
237
+ * @example
238
+ * ```ts
239
+ * import { createConfig, http } from '@wagmi/core'
240
+ * import { tempo } from 'tempo.ts/chains'
241
+ * import { Actions } from 'tempo.ts/wagmi'
242
+ *
243
+ * const config = createConfig({
244
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
245
+ * transports: {
246
+ * [tempo.id]: http(),
247
+ * },
248
+ * })
249
+ *
250
+ * const hash = await Actions.policy.modifyWhitelist(config, {
251
+ * policyId: 2n,
252
+ * address: '0x...',
253
+ * allowed: true,
254
+ * })
255
+ * ```
256
+ *
257
+ * @param config - Config.
258
+ * @param parameters - Parameters.
259
+ * @returns Transaction hash.
260
+ */
261
+ export async function modifyWhitelist<config extends Config>(
262
+ config: config,
263
+ parameters: modifyWhitelist.Parameters<config>,
264
+ ): Promise<viem_Actions.modifyWhitelist.ReturnValue> {
265
+ const { account, chainId, connector } = parameters
266
+
267
+ const client = await getConnectorClient(config, {
268
+ account,
269
+ assertChainId: false,
270
+ chainId,
271
+ connector,
272
+ })
273
+
274
+ return viem_Actions.modifyWhitelist(client, parameters as never)
275
+ }
276
+
277
+ export declare namespace modifyWhitelist {
278
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
279
+ ConnectorParameter &
280
+ UnionOmit<
281
+ viem_Actions.modifyWhitelist.Parameters<
282
+ config['chains'][number],
283
+ Account
284
+ >,
285
+ 'chain'
286
+ >
287
+
288
+ export type ReturnValue = viem_Actions.modifyWhitelist.ReturnValue
289
+
290
+ export type ErrorType = viem_Actions.modifyWhitelist.ErrorType
291
+ }
292
+
293
+ /**
294
+ * Modifies a policy whitelist.
295
+ *
296
+ * Note: This is a synchronous action that waits for the transaction to
297
+ * be included on a block before returning a response.
298
+ *
299
+ * @example
300
+ * ```ts
301
+ * import { createConfig, http } from '@wagmi/core'
302
+ * import { tempo } from 'tempo.ts/chains'
303
+ * import { Actions } from 'tempo.ts/wagmi'
304
+ *
305
+ * const config = createConfig({
306
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
307
+ * transports: {
308
+ * [tempo.id]: http(),
309
+ * },
310
+ * })
311
+ *
312
+ * const result = await Actions.policy.modifyWhitelistSync(config, {
313
+ * policyId: 2n,
314
+ * address: '0x...',
315
+ * allowed: true,
316
+ * })
317
+ * ```
318
+ *
319
+ * @param config - Config.
320
+ * @param parameters - Parameters.
321
+ * @returns The transaction receipt and event data.
322
+ */
323
+ export async function modifyWhitelistSync<config extends Config>(
324
+ config: config,
325
+ parameters: modifyWhitelistSync.Parameters<config>,
326
+ ): Promise<viem_Actions.modifyWhitelistSync.ReturnValue> {
327
+ const { account, chainId, connector } = parameters
328
+
329
+ const client = await getConnectorClient(config, {
330
+ account,
331
+ assertChainId: false,
332
+ chainId,
333
+ connector,
334
+ })
335
+
336
+ return viem_Actions.modifyWhitelistSync(client, parameters as never)
337
+ }
338
+
339
+ export declare namespace modifyWhitelistSync {
340
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
341
+ ConnectorParameter &
342
+ UnionOmit<
343
+ viem_Actions.modifyWhitelistSync.Parameters<
344
+ config['chains'][number],
345
+ Account
346
+ >,
347
+ 'chain'
348
+ >
349
+
350
+ export type ReturnValue = viem_Actions.modifyWhitelistSync.ReturnValue
351
+
352
+ export type ErrorType = viem_Actions.modifyWhitelistSync.ErrorType
353
+ }
354
+
355
+ /**
356
+ * Modifies a policy blacklist.
357
+ *
358
+ * @example
359
+ * ```ts
360
+ * import { createConfig, http } from '@wagmi/core'
361
+ * import { tempo } from 'tempo.ts/chains'
362
+ * import { Actions } from 'tempo.ts/wagmi'
363
+ *
364
+ * const config = createConfig({
365
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
366
+ * transports: {
367
+ * [tempo.id]: http(),
368
+ * },
369
+ * })
370
+ *
371
+ * const hash = await Actions.policy.modifyBlacklist(config, {
372
+ * policyId: 2n,
373
+ * address: '0x...',
374
+ * restricted: true,
375
+ * })
376
+ * ```
377
+ *
378
+ * @param config - Config.
379
+ * @param parameters - Parameters.
380
+ * @returns Transaction hash.
381
+ */
382
+ export async function modifyBlacklist<config extends Config>(
383
+ config: config,
384
+ parameters: modifyBlacklist.Parameters<config>,
385
+ ): Promise<viem_Actions.modifyBlacklist.ReturnValue> {
386
+ const { account, chainId, connector } = parameters
387
+
388
+ const client = await getConnectorClient(config, {
389
+ account,
390
+ assertChainId: false,
391
+ chainId,
392
+ connector,
393
+ })
394
+
395
+ return viem_Actions.modifyBlacklist(client, parameters as never)
396
+ }
397
+
398
+ export declare namespace modifyBlacklist {
399
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
400
+ ConnectorParameter &
401
+ UnionOmit<
402
+ viem_Actions.modifyBlacklist.Parameters<
403
+ config['chains'][number],
404
+ Account
405
+ >,
406
+ 'chain'
407
+ >
408
+
409
+ export type ReturnValue = viem_Actions.modifyBlacklist.ReturnValue
410
+
411
+ export type ErrorType = viem_Actions.modifyBlacklist.ErrorType
412
+ }
413
+
414
+ /**
415
+ * Modifies a policy blacklist.
416
+ *
417
+ * Note: This is a synchronous action that waits for the transaction to
418
+ * be included on a block before returning a response.
419
+ *
420
+ * @example
421
+ * ```ts
422
+ * import { createConfig, http } from '@wagmi/core'
423
+ * import { tempo } from 'tempo.ts/chains'
424
+ * import { Actions } from 'tempo.ts/wagmi'
425
+ *
426
+ * const config = createConfig({
427
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
428
+ * transports: {
429
+ * [tempo.id]: http(),
430
+ * },
431
+ * })
432
+ *
433
+ * const result = await Actions.policy.modifyBlacklistSync(config, {
434
+ * policyId: 2n,
435
+ * address: '0x...',
436
+ * restricted: true,
437
+ * })
438
+ * ```
439
+ *
440
+ * @param config - Config.
441
+ * @param parameters - Parameters.
442
+ * @returns The transaction receipt and event data.
443
+ */
444
+ export async function modifyBlacklistSync<config extends Config>(
445
+ config: config,
446
+ parameters: modifyBlacklistSync.Parameters<config>,
447
+ ): Promise<viem_Actions.modifyBlacklistSync.ReturnValue> {
448
+ const { account, chainId, connector } = parameters
449
+
450
+ const client = await getConnectorClient(config, {
451
+ account,
452
+ assertChainId: false,
453
+ chainId,
454
+ connector,
455
+ })
456
+
457
+ return viem_Actions.modifyBlacklistSync(client, parameters as never)
458
+ }
459
+
460
+ export declare namespace modifyBlacklistSync {
461
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
462
+ ConnectorParameter &
463
+ UnionOmit<
464
+ viem_Actions.modifyBlacklistSync.Parameters<
465
+ config['chains'][number],
466
+ Account
467
+ >,
468
+ 'chain'
469
+ >
470
+
471
+ export type ReturnValue = viem_Actions.modifyBlacklistSync.ReturnValue
472
+
473
+ export type ErrorType = viem_Actions.modifyBlacklistSync.ErrorType
474
+ }
475
+
476
+ /**
477
+ * Gets policy data.
478
+ *
479
+ * @example
480
+ * ```ts
481
+ * import { createConfig, http } from '@wagmi/core'
482
+ * import { tempo } from 'tempo.ts/chains'
483
+ * import { Actions } from 'tempo.ts/wagmi'
484
+ *
485
+ * const config = createConfig({
486
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
487
+ * transports: {
488
+ * [tempo.id]: http(),
489
+ * },
490
+ * })
491
+ *
492
+ * const data = await Actions.policy.getData(config, {
493
+ * policyId: 2n,
494
+ * })
495
+ * ```
496
+ *
497
+ * @param config - Config.
498
+ * @param parameters - Parameters.
499
+ * @returns The policy data.
500
+ */
501
+ export function getData<config extends Config>(
502
+ config: config,
503
+ parameters: getData.Parameters<config>,
504
+ ): Promise<getData.ReturnValue> {
505
+ const { chainId, ...rest } = parameters
506
+ const client = config.getClient({ chainId })
507
+ return viem_Actions.getData(client, rest)
508
+ }
509
+
510
+ export namespace getData {
511
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
512
+ viem_Actions.getData.Parameters
513
+
514
+ export type ReturnValue = viem_Actions.getData.ReturnValue
515
+
516
+ export function queryKey<config extends Config>(
517
+ parameters: Parameters<config>,
518
+ ) {
519
+ return ['getData', parameters] as const
520
+ }
521
+
522
+ export type QueryKey<config extends Config> = ReturnType<
523
+ typeof queryKey<config>
524
+ >
525
+
526
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
527
+ config: Config,
528
+ parameters: queryOptions.Parameters<config, selectData>,
529
+ ): queryOptions.ReturnValue<config, selectData> {
530
+ const { query, ...rest } = parameters
531
+ return {
532
+ ...query,
533
+ queryKey: queryKey(rest),
534
+ async queryFn({ queryKey }) {
535
+ const [, parameters] = queryKey
536
+ return await getData(config, parameters)
537
+ },
538
+ }
539
+ }
540
+
541
+ export declare namespace queryOptions {
542
+ export type Parameters<
543
+ config extends Config,
544
+ selectData = getData.ReturnValue,
545
+ > = getData.Parameters<config> & {
546
+ query?:
547
+ | UnionOmit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
548
+ | undefined
549
+ }
550
+
551
+ export type ReturnValue<
552
+ config extends Config,
553
+ selectData = getData.ReturnValue,
554
+ > = RequiredBy<
555
+ Query.QueryOptions<
556
+ getData.ReturnValue,
557
+ Query.DefaultError,
558
+ selectData,
559
+ getData.QueryKey<config>
560
+ >,
561
+ 'queryKey' | 'queryFn'
562
+ >
563
+ }
564
+ }
565
+
566
+ /**
567
+ * Checks if a user is authorized by a policy.
568
+ *
569
+ * @example
570
+ * ```ts
571
+ * import { createConfig, http } from '@wagmi/core'
572
+ * import { tempo } from 'tempo.ts/chains'
573
+ * import { Actions } from 'tempo.ts/wagmi'
574
+ *
575
+ * const config = createConfig({
576
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
577
+ * transports: {
578
+ * [tempo.id]: http(),
579
+ * },
580
+ * })
581
+ *
582
+ * const authorized = await Actions.policy.isAuthorized(config, {
583
+ * policyId: 2n,
584
+ * user: '0x...',
585
+ * })
586
+ * ```
587
+ *
588
+ * @param config - Config.
589
+ * @param parameters - Parameters.
590
+ * @returns Whether the user is authorized.
591
+ */
592
+ export function isAuthorized<config extends Config>(
593
+ config: config,
594
+ parameters: isAuthorized.Parameters<config>,
595
+ ): Promise<isAuthorized.ReturnValue> {
596
+ const { chainId, ...rest } = parameters
597
+ const client = config.getClient({ chainId })
598
+ return viem_Actions.isAuthorized(client, rest)
599
+ }
600
+
601
+ export namespace isAuthorized {
602
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
603
+ viem_Actions.isAuthorized.Parameters
604
+
605
+ export type ReturnValue = viem_Actions.isAuthorized.ReturnValue
606
+
607
+ export function queryKey<config extends Config>(
608
+ parameters: Parameters<config>,
609
+ ) {
610
+ return ['isAuthorized', parameters] as const
611
+ }
612
+
613
+ export type QueryKey<config extends Config> = ReturnType<
614
+ typeof queryKey<config>
615
+ >
616
+
617
+ export function queryOptions<config extends Config, selectData = ReturnValue>(
618
+ config: Config,
619
+ parameters: queryOptions.Parameters<config, selectData>,
620
+ ): queryOptions.ReturnValue<config, selectData> {
621
+ const { query, ...rest } = parameters
622
+ return {
623
+ ...query,
624
+ queryKey: queryKey(rest),
625
+ async queryFn({ queryKey }) {
626
+ const [, parameters] = queryKey
627
+ return await isAuthorized(config, parameters)
628
+ },
629
+ }
630
+ }
631
+
632
+ export declare namespace queryOptions {
633
+ export type Parameters<
634
+ config extends Config,
635
+ selectData = isAuthorized.ReturnValue,
636
+ > = isAuthorized.Parameters<config> & {
637
+ query?:
638
+ | UnionOmit<ReturnValue<config, selectData>, 'queryKey' | 'queryFn'>
639
+ | undefined
640
+ }
641
+
642
+ export type ReturnValue<
643
+ config extends Config,
644
+ selectData = isAuthorized.ReturnValue,
645
+ > = RequiredBy<
646
+ Query.QueryOptions<
647
+ isAuthorized.ReturnValue,
648
+ Query.DefaultError,
649
+ selectData,
650
+ isAuthorized.QueryKey<config>
651
+ >,
652
+ 'queryKey' | 'queryFn'
653
+ >
654
+ }
655
+ }
656
+
657
+ /**
658
+ * Watches for policy creation events.
659
+ *
660
+ * @example
661
+ * ```ts
662
+ * import { createConfig, http } from '@wagmi/core'
663
+ * import { tempo } from 'tempo.ts/chains'
664
+ * import { Actions } from 'tempo.ts/wagmi'
665
+ *
666
+ * const config = createConfig({
667
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
668
+ * transports: {
669
+ * [tempo.id]: http(),
670
+ * },
671
+ * })
672
+ *
673
+ * const unwatch = Actions.policy.watchCreate(config, {
674
+ * onPolicyCreated: (args, log) => {
675
+ * console.log('Policy created:', args)
676
+ * },
677
+ * })
678
+ * ```
679
+ *
680
+ * @param config - Config.
681
+ * @param parameters - Parameters.
682
+ * @returns A function to unsubscribe from the event.
683
+ */
684
+ export function watchCreate<config extends Config>(
685
+ config: config,
686
+ parameters: watchCreate.Parameters<config>,
687
+ ) {
688
+ const { chainId, ...rest } = parameters
689
+ const client = config.getClient({ chainId })
690
+ return viem_Actions.watchCreate(client, rest)
691
+ }
692
+
693
+ export declare namespace watchCreate {
694
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
695
+ viem_Actions.watchCreate.Parameters
696
+ }
697
+
698
+ /**
699
+ * Watches for policy admin update events.
700
+ *
701
+ * @example
702
+ * ```ts
703
+ * import { createConfig, http } from '@wagmi/core'
704
+ * import { tempo } from 'tempo.ts/chains'
705
+ * import { Actions } from 'tempo.ts/wagmi'
706
+ *
707
+ * const config = createConfig({
708
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
709
+ * transports: {
710
+ * [tempo.id]: http(),
711
+ * },
712
+ * })
713
+ *
714
+ * const unwatch = Actions.policy.watchAdminUpdated(config, {
715
+ * onAdminUpdated: (args, log) => {
716
+ * console.log('Policy admin updated:', args)
717
+ * },
718
+ * })
719
+ * ```
720
+ *
721
+ * @param config - Config.
722
+ * @param parameters - Parameters.
723
+ * @returns A function to unsubscribe from the event.
724
+ */
725
+ export function watchAdminUpdated<config extends Config>(
726
+ config: config,
727
+ parameters: watchAdminUpdated.Parameters<config>,
728
+ ) {
729
+ const { chainId, ...rest } = parameters
730
+ const client = config.getClient({ chainId })
731
+ return viem_Actions.watchAdminUpdated(client, rest)
732
+ }
733
+
734
+ export declare namespace watchAdminUpdated {
735
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
736
+ viem_Actions.watchAdminUpdated.Parameters
737
+ }
738
+
739
+ /**
740
+ * Watches for whitelist update events.
741
+ *
742
+ * @example
743
+ * ```ts
744
+ * import { createConfig, http } from '@wagmi/core'
745
+ * import { tempo } from 'tempo.ts/chains'
746
+ * import { Actions } from 'tempo.ts/wagmi'
747
+ *
748
+ * const config = createConfig({
749
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
750
+ * transports: {
751
+ * [tempo.id]: http(),
752
+ * },
753
+ * })
754
+ *
755
+ * const unwatch = Actions.policy.watchWhitelistUpdated(config, {
756
+ * onWhitelistUpdated: (args, log) => {
757
+ * console.log('Whitelist updated:', args)
758
+ * },
759
+ * })
760
+ * ```
761
+ *
762
+ * @param config - Config.
763
+ * @param parameters - Parameters.
764
+ * @returns A function to unsubscribe from the event.
765
+ */
766
+ export function watchWhitelistUpdated<config extends Config>(
767
+ config: config,
768
+ parameters: watchWhitelistUpdated.Parameters<config>,
769
+ ) {
770
+ const { chainId, ...rest } = parameters
771
+ const client = config.getClient({ chainId })
772
+ return viem_Actions.watchWhitelistUpdated(client, rest)
773
+ }
774
+
775
+ export declare namespace watchWhitelistUpdated {
776
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
777
+ viem_Actions.watchWhitelistUpdated.Parameters
778
+ }
779
+
780
+ /**
781
+ * Watches for blacklist update events.
782
+ *
783
+ * @example
784
+ * ```ts
785
+ * import { createConfig, http } from '@wagmi/core'
786
+ * import { tempo } from 'tempo.ts/chains'
787
+ * import { Actions } from 'tempo.ts/wagmi'
788
+ *
789
+ * const config = createConfig({
790
+ * chains: [tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })],
791
+ * transports: {
792
+ * [tempo.id]: http(),
793
+ * },
794
+ * })
795
+ *
796
+ * const unwatch = Actions.policy.watchBlacklistUpdated(config, {
797
+ * onBlacklistUpdated: (args, log) => {
798
+ * console.log('Blacklist updated:', args)
799
+ * },
800
+ * })
801
+ * ```
802
+ *
803
+ * @param config - Config.
804
+ * @param parameters - Parameters.
805
+ * @returns A function to unsubscribe from the event.
806
+ */
807
+ export function watchBlacklistUpdated<config extends Config>(
808
+ config: config,
809
+ parameters: watchBlacklistUpdated.Parameters<config>,
810
+ ) {
811
+ const { chainId, ...rest } = parameters
812
+ const client = config.getClient({ chainId })
813
+ return viem_Actions.watchBlacklistUpdated(client, rest)
814
+ }
815
+
816
+ export declare namespace watchBlacklistUpdated {
817
+ export type Parameters<config extends Config> = ChainIdParameter<config> &
818
+ viem_Actions.watchBlacklistUpdated.Parameters
819
+ }