tempo.ts 0.1.1 → 0.1.2

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