@boostxyz/sdk 0.0.0-alpha.15 → 0.0.0-alpha.17

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 (110) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.cjs.map +1 -1
  3. package/dist/Actions/Action.js +8 -8
  4. package/dist/Actions/EventAction.cjs +1 -1
  5. package/dist/Actions/EventAction.cjs.map +1 -1
  6. package/dist/Actions/EventAction.d.ts.map +1 -1
  7. package/dist/Actions/EventAction.js +416 -135
  8. package/dist/Actions/EventAction.js.map +1 -1
  9. package/dist/AllowLists/AllowList.cjs +1 -1
  10. package/dist/AllowLists/AllowList.cjs.map +1 -1
  11. package/dist/AllowLists/AllowList.js +3 -3
  12. package/dist/AllowLists/OpenAllowList.d.ts +183 -0
  13. package/dist/AllowLists/OpenAllowList.d.ts.map +1 -1
  14. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  15. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  16. package/dist/AllowLists/SimpleAllowList.d.ts +86 -31
  17. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  18. package/dist/AllowLists/SimpleAllowList.js +54 -73
  19. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  20. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  21. package/dist/AllowLists/SimpleDenyList.d.ts +195 -3
  22. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  23. package/dist/AllowLists/SimpleDenyList.js +4 -4
  24. package/dist/Auth/PassthroughAuth.cjs +1 -1
  25. package/dist/Auth/PassthroughAuth.js +1 -1
  26. package/dist/BoostCore.cjs +2 -2
  27. package/dist/BoostCore.js +22 -22
  28. package/dist/BoostRegistry.cjs +1 -1
  29. package/dist/BoostRegistry.js +10 -10
  30. package/dist/Budgets/Budget.cjs +1 -1
  31. package/dist/Budgets/Budget.cjs.map +1 -1
  32. package/dist/Budgets/Budget.d.ts.map +1 -1
  33. package/dist/Budgets/Budget.js +2 -2
  34. package/dist/Budgets/Budget.js.map +1 -1
  35. package/dist/Budgets/ManagedBudget.cjs +1 -1
  36. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  37. package/dist/Budgets/ManagedBudget.d.ts +6 -156
  38. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  39. package/dist/Budgets/ManagedBudget.js +60 -282
  40. package/dist/Budgets/ManagedBudget.js.map +1 -1
  41. package/dist/Budgets/VestingBudget.d.ts +158 -54
  42. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  43. package/dist/Deployable/DeployableTarget.cjs +1 -1
  44. package/dist/Deployable/DeployableTarget.js +1 -1
  45. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  46. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  47. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
  48. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  49. package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
  50. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  51. package/dist/{Incentive-CSnbCt3P.js → Incentive-DJf-vdyL.js} +23 -23
  52. package/dist/{Incentive-CSnbCt3P.js.map → Incentive-DJf-vdyL.js.map} +1 -1
  53. package/dist/{Incentive-BroOQqVi.cjs → Incentive-DNwROd1r.cjs} +2 -2
  54. package/dist/{Incentive-BroOQqVi.cjs.map → Incentive-DNwROd1r.cjs.map} +1 -1
  55. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  56. package/dist/Incentives/AllowListIncentive.js +10 -10
  57. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  58. package/dist/Incentives/CGDAIncentive.js +9 -9
  59. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  60. package/dist/Incentives/ERC20Incentive.js +23 -23
  61. package/dist/Incentives/Incentive.cjs +1 -1
  62. package/dist/Incentives/Incentive.js +3 -3
  63. package/dist/Incentives/PointsIncentive.cjs +1 -1
  64. package/dist/Incentives/PointsIncentive.js +6 -6
  65. package/dist/SimpleDenyList-DMlUkmAn.cjs +2 -0
  66. package/dist/SimpleDenyList-DMlUkmAn.cjs.map +1 -0
  67. package/dist/SimpleDenyList-DvUvmOeE.js +132 -0
  68. package/dist/SimpleDenyList-DvUvmOeE.js.map +1 -0
  69. package/dist/Validators/SignerValidator.cjs +1 -1
  70. package/dist/Validators/SignerValidator.js +7 -7
  71. package/dist/Validators/Validator.cjs +1 -1
  72. package/dist/Validators/Validator.js +2 -2
  73. package/dist/componentInterfaces-BPVR_Ykd.js +13 -0
  74. package/dist/componentInterfaces-BPVR_Ykd.js.map +1 -0
  75. package/dist/{componentInterfaces-CKCBwG16.cjs → componentInterfaces-BfppSIl4.cjs} +2 -2
  76. package/dist/componentInterfaces-BfppSIl4.cjs.map +1 -0
  77. package/dist/generated-CMQ6ZC2_.cjs +3 -0
  78. package/dist/generated-CMQ6ZC2_.cjs.map +1 -0
  79. package/dist/{generated-CdXG-MpB.js → generated-C_7Jx3YG.js} +1666 -890
  80. package/dist/generated-C_7Jx3YG.js.map +1 -0
  81. package/dist/index.cjs +1 -1
  82. package/dist/index.d.ts +1 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +100 -96
  85. package/dist/index.js.map +1 -1
  86. package/package.json +11 -4
  87. package/src/Actions/EventAction.test.ts +138 -0
  88. package/src/Actions/EventAction.ts +28 -7
  89. package/src/AllowLists/SimpleAllowList.ts +29 -54
  90. package/src/AllowLists/SimpleDenyList.ts +27 -3
  91. package/src/Budgets/Budget.ts +1 -2
  92. package/src/Budgets/ManagedBudget.ts +3 -277
  93. package/src/Budgets/VestingBudget.ts +3 -74
  94. package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
  95. package/src/index.test.ts +3 -4
  96. package/src/index.ts +1 -0
  97. package/dist/Budgets/SimpleBudget.d.ts +0 -824
  98. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  99. package/dist/SimpleDenyList-CzNNbmmV.cjs +0 -2
  100. package/dist/SimpleDenyList-CzNNbmmV.cjs.map +0 -1
  101. package/dist/SimpleDenyList-sfskWLfa.js +0 -115
  102. package/dist/SimpleDenyList-sfskWLfa.js.map +0 -1
  103. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  104. package/dist/componentInterfaces-Cmg8tUxq.js +0 -13
  105. package/dist/componentInterfaces-Cmg8tUxq.js.map +0 -1
  106. package/dist/generated-BulULVyy.cjs +0 -3
  107. package/dist/generated-BulULVyy.cjs.map +0 -1
  108. package/dist/generated-CdXG-MpB.js.map +0 -1
  109. package/src/Budgets/SimpleBudget.test.ts +0 -152
  110. package/src/Budgets/SimpleBudget.ts +0 -563
@@ -2,9 +2,7 @@ import {
2
2
  readSimpleAllowListIsAllowed,
3
3
  readSimpleAllowListOwner,
4
4
  simpleAllowListAbi,
5
- simulateSimpleAllowListGrantRoles,
6
5
  simulateSimpleAllowListSetAllowed,
7
- writeSimpleAllowListGrantRoles,
8
6
  writeSimpleAllowListSetAllowed,
9
7
  } from '@boostxyz/evm';
10
8
  import { bytecode } from '@boostxyz/evm/artifacts/contracts/allowlists/SimpleAllowList.sol/SimpleAllowList.json';
@@ -22,7 +20,10 @@ import type {
22
20
  DeployableOptions,
23
21
  GenericDeployableParams,
24
22
  } from '../Deployable/Deployable';
25
- import { DeployableTarget } from '../Deployable/DeployableTarget';
23
+ import {
24
+ DeployableTargetWithRBAC,
25
+ Roles,
26
+ } from '../Deployable/DeployableTargetWithRBAC';
26
27
  import { DeployableUnknownOwnerProvidedError } from '../errors';
27
28
  import {
28
29
  type GenericLog,
@@ -73,18 +74,19 @@ export type SimpleAllowListLog<
73
74
  /**
74
75
  * A constant representing the list manager's role
75
76
  *
76
- * @type {2n}
77
+ * @deprecated use {@link Roles} instead
78
+ * @type {1n}
77
79
  */
78
- export const LIST_MANAGER_ROLE = 2n;
80
+ export const LIST_MANAGER_ROLE = Roles.MANAGER;
79
81
  /**
80
82
  * A simple implementation of an AllowList that checks if a user is authorized based on a list of allowed addresses
81
83
  *
82
84
  * @export
83
85
  * @class SimpleAllowList
84
86
  * @typedef {SimpleAllowList}
85
- * @extends {DeployableTarget<SimpleAllowListPayload>}
87
+ * @extends {DeployableTargetWithRBAC<SimpleAllowListPayload>}
86
88
  */
87
- export class SimpleAllowList extends DeployableTarget<
89
+ export class SimpleAllowList extends DeployableTargetWithRBAC<
88
90
  SimpleAllowListPayload,
89
91
  typeof simpleAllowListAbi
90
92
  > {
@@ -108,6 +110,26 @@ export class SimpleAllowList extends DeployableTarget<
108
110
  */
109
111
  public static override registryType: RegistryType = RegistryType.ALLOW_LIST;
110
112
 
113
+ /**
114
+ * Retrieves the owner
115
+ *
116
+ * @public
117
+ * @async
118
+ * @param {?ReadParams<typeof simpleAllowListAbi, 'owner'>} [params]
119
+ * @returns {Promise<Address>} - The address of the owner
120
+ */
121
+ public async owner(
122
+ params?: ReadParams<typeof simpleAllowListAbi, 'owner'>,
123
+ ): Promise<Address> {
124
+ return await readSimpleAllowListOwner(this._config, {
125
+ ...this.optionallyAttachAccount(),
126
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
127
+ ...(params as any),
128
+ address: this.assertValidAddress(),
129
+ args: [],
130
+ });
131
+ }
132
+
111
133
  /**
112
134
  * Check if a user is authorized.
113
135
  *
@@ -181,53 +203,6 @@ export class SimpleAllowList extends DeployableTarget<
181
203
  return { hash, result };
182
204
  }
183
205
 
184
- /**
185
- * Allows the owner to grant `user` `roles`.
186
- *
187
- * @public
188
- * @async
189
- * @param {Address} address
190
- * @param {bigint} role
191
- * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]
192
- * @returns {Promise<void>}
193
- */
194
- public async grantRoles(
195
- address: Address,
196
- role: bigint,
197
- params?: WriteParams<typeof simpleAllowListAbi, 'grantRoles'>,
198
- ) {
199
- return await this.awaitResult(this.grantRolesRaw(address, role, params));
200
- }
201
-
202
- /**
203
- * Allows the owner to grant `user` `roles`.
204
- *
205
- * @public
206
- * @async
207
- * @param {Address} address
208
- * @param {bigint} role
209
- * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]
210
- * @returns {Promise<void>}
211
- */
212
- public async grantRolesRaw(
213
- address: Address,
214
- role: bigint,
215
- params?: ReadParams<typeof simpleAllowListAbi, 'grantRoles'>,
216
- ) {
217
- const { request, result } = await simulateSimpleAllowListGrantRoles(
218
- this._config,
219
- {
220
- address: this.assertValidAddress(),
221
- args: [address, role],
222
- ...this.optionallyAttachAccount(),
223
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
224
- ...(params as any),
225
- },
226
- );
227
- const hash = await writeSimpleAllowListGrantRoles(this._config, request);
228
- return { hash, result };
229
- }
230
-
231
206
  /**
232
207
  * @inheritdoc
233
208
  *
@@ -1,4 +1,5 @@
1
1
  import {
2
+ readSimpleAllowListOwner,
2
3
  readSimpleDenyListIsAllowed,
3
4
  simpleDenyListAbi,
4
5
  simulateSimpleDenyListSetDenied,
@@ -19,7 +20,7 @@ import type {
19
20
  DeployableOptions,
20
21
  GenericDeployableParams,
21
22
  } from '../Deployable/Deployable';
22
- import { DeployableTarget } from '../Deployable/DeployableTarget';
23
+ import { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';
23
24
  import { DeployableUnknownOwnerProvidedError } from '../errors';
24
25
  import {
25
26
  type GenericLog,
@@ -73,11 +74,14 @@ export type SimpleDenyListLog<
73
74
  * @export
74
75
  * @class SimpleDenyList
75
76
  * @typedef {SimpleDenyList}
76
- * @extends {DeployableTarget<SimpleDenyListPayload>}
77
+ * @extends {DeployableTargetWithRBAC<SimpleDenyListPayload>}
77
78
  */
78
79
  export class SimpleDenyList<
79
80
  Payload = SimpleDenyListPayload,
80
- > extends DeployableTarget<Payload | undefined, typeof simpleDenyListAbi> {
81
+ > extends DeployableTargetWithRBAC<
82
+ Payload | undefined,
83
+ typeof simpleDenyListAbi
84
+ > {
81
85
  public override readonly abi = simpleDenyListAbi;
82
86
  /**
83
87
  * @inheritdoc
@@ -98,6 +102,26 @@ export class SimpleDenyList<
98
102
  */
99
103
  public static override registryType: RegistryType = RegistryType.ALLOW_LIST;
100
104
 
105
+ /**
106
+ * Retrieves the owner
107
+ *
108
+ * @public
109
+ * @async
110
+ * @param {?ReadParams<typeof simpleDenyListAbi, 'owner'>} [params]
111
+ * @returns {Promise<Address>} - The address of the owner
112
+ */
113
+ public async owner(
114
+ params?: ReadParams<typeof simpleDenyListAbi, 'owner'>,
115
+ ): Promise<Address> {
116
+ return await readSimpleAllowListOwner(this._config, {
117
+ ...this.optionallyAttachAccount(),
118
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
119
+ ...(params as any),
120
+ address: this.assertValidAddress(),
121
+ args: [],
122
+ });
123
+ }
124
+
101
125
  /**
102
126
  * Check if a user is authorized (i.e. not denied)
103
127
  *
@@ -7,7 +7,6 @@ import { InvalidComponentInterfaceError } from '../errors';
7
7
  import { ManagedBudget } from './ManagedBudget';
8
8
 
9
9
  export {
10
- // SimpleBudget,
11
10
  // VestingBudget,
12
11
  ManagedBudget,
13
12
  };
@@ -18,7 +17,7 @@ export {
18
17
  * @export
19
18
  * @typedef {Budget}
20
19
  */
21
- export type Budget = ManagedBudget; // | SimpleBudget | VestingBudget
20
+ export type Budget = ManagedBudget; // | VestingBudget
22
21
 
23
22
  /**
24
23
  * A map of Budget component interfaces to their constructors.
@@ -39,6 +39,7 @@ import type {
39
39
  GenericDeployableParams,
40
40
  } from '../Deployable/Deployable';
41
41
  import { DeployableTarget } from '../Deployable/DeployableTarget';
42
+ import { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';
42
43
  import {
43
44
  DeployableUnknownOwnerProvidedError,
44
45
  UnknownTransferPayloadSupplied,
@@ -170,9 +171,9 @@ export function prepareTransfer(
170
171
  * @export
171
172
  * @class ManagedBudget
172
173
  * @typedef {ManagedBudget}
173
- * @extends {DeployableTarget<ManagedBudgetPayload>}
174
+ * @extends {DeployableTargetWithRBAC<ManagedBudgetPayload>}
174
175
  */
175
- export class ManagedBudget extends DeployableTarget<
176
+ export class ManagedBudget extends DeployableTargetWithRBAC<
176
177
  ManagedBudgetPayload,
177
178
  typeof managedBudgetAbi
178
179
  > {
@@ -387,281 +388,6 @@ export class ManagedBudget extends DeployableTarget<
387
388
  return { hash, result };
388
389
  }
389
390
 
390
- /**
391
- * Set the authorized status of the given accounts
392
- * The mechanism for managing authorization is left to the implementing contract
393
- *
394
- * @public
395
- * @async
396
- * @param {Address[]} addresses - The accounts to authorize or deauthorize
397
- * @param {boolean[]} allowed - The authorization status for the given accounts
398
- * @param {?WriteParams<typeof managedBudgetAbi, 'setAuthorized'>} [params]
399
- * @returns {Promise<void>}
400
- */
401
- public async setAuthorized(
402
- addresses: Address[],
403
- allowed: boolean[],
404
- params?: WriteParams<typeof managedBudgetAbi, 'setAuthorized'>,
405
- ) {
406
- return await this.awaitResult(
407
- this.setAuthorizedRaw(addresses, allowed, params),
408
- );
409
- }
410
-
411
- /**
412
- * Set the authorized status of the given accounts
413
- * The mechanism for managing authorization is left to the implementing contract
414
- *
415
- * @public
416
- * @async
417
- * @param {Address[]} addresses - The accounts to authorize or deauthorize
418
- * @param {boolean[]} allowed - The authorization status for the given accounts
419
- * @param {?WriteParams<typeof managedBudgetAbi, 'setAuthorized'>} [params]
420
- * @returns {Promise<void>}
421
- */
422
- public async setAuthorizedRaw(
423
- addresses: Address[],
424
- allowed: boolean[],
425
- params?: WriteParams<typeof managedBudgetAbi, 'setAuthorized'>,
426
- ) {
427
- const { request, result } = await simulateManagedBudgetSetAuthorized(
428
- this._config,
429
- {
430
- address: this.assertValidAddress(),
431
- args: [addresses, allowed],
432
- ...this.optionallyAttachAccount(),
433
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
434
- ...(params as any),
435
- },
436
- );
437
- const hash = await writeManagedBudgetSetAuthorized(this._config, request);
438
- return { hash, result };
439
- }
440
-
441
- /**
442
- * Grant many accounts permissions on the budget.
443
- *
444
- * @example
445
- * ```ts
446
- * await budget.grantRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])
447
- * ```
448
- * @public
449
- * @async
450
- * @param {Address[]} addresses
451
- * @param {ManagedBudgetRoles[]} roles
452
- * @param {?WriteParams<typeof managedBudgetAbi, 'grantRoles'>} [params]
453
- * @returns {unknown}
454
- */
455
- public async grantRoles(
456
- addresses: Address[],
457
- roles: ManagedBudgetRoles[],
458
- params?: WriteParams<typeof managedBudgetAbi, 'grantRoles'>,
459
- ) {
460
- return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));
461
- }
462
-
463
- /**
464
- * Grant many accounts permissions on the budget.
465
- *
466
- * @example
467
- * ```ts
468
- * await budget.grantRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])
469
- *
470
- * @public
471
- * @async
472
- * @param {Address[]} addresses
473
- * @param {ManagedBudgetRoles[]} roles
474
- * @param {?WriteParams<typeof managedBudgetAbi, 'grantRoles'>} [params]
475
- * @returns {unknown}
476
- */
477
- public async grantRolesRaw(
478
- addresses: Address[],
479
- roles: ManagedBudgetRoles[],
480
- params?: WriteParams<typeof managedBudgetAbi, 'grantRoles'>,
481
- ) {
482
- const { request, result } = await simulateManagedBudgetGrantRoles(
483
- this._config,
484
- {
485
- address: this.assertValidAddress(),
486
- args: [addresses, roles],
487
- ...this.optionallyAttachAccount(),
488
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
489
- ...(params as any),
490
- },
491
- );
492
- const hash = await writeManagedBudgetGrantRoles(
493
- this._config,
494
- // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
495
- request as any,
496
- );
497
- return { hash, result };
498
- }
499
-
500
- /**
501
- * Revoke many accounts' permissions on the budget.
502
- *
503
- * @example
504
- * ```ts
505
- * await budget.revokeRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])
506
- *
507
- * @public
508
- * @async
509
- * @param {Address[]} addresses
510
- * @param {ManagedBudgetRoles[]} roles
511
- * @param {?WriteParams<typeof managedBudgetAbi, 'revokeRoles'>} [params]
512
- * @returns {unknown}
513
- */
514
- public async revokeRoles(
515
- addresses: Address[],
516
- roles: ManagedBudgetRoles[],
517
- params?: WriteParams<typeof managedBudgetAbi, 'revokeRoles'>,
518
- ) {
519
- return await this.awaitResult(
520
- this.revokeRolesRaw(addresses, roles, params),
521
- );
522
- }
523
-
524
- /**
525
- * Revoke many accounts' permissions on the budget.
526
- *
527
- * @example
528
- * ```ts
529
- * await budget.revokeRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])
530
- * @public
531
- * @async
532
- * @param {Address[]} addresses
533
- * @param {ManagedBudgetRoles[]} roles
534
- * @param {?WriteParams<typeof managedBudgetAbi, 'revokeRoles'>} [params]
535
- * @returns {unknown}
536
- */
537
- public async revokeRolesRaw(
538
- addresses: Address[],
539
- roles: ManagedBudgetRoles[],
540
- params?: WriteParams<typeof managedBudgetAbi, 'revokeRoles'>,
541
- ) {
542
- const { request, result } = await simulateManagedBudgetRevokeRoles(
543
- this._config,
544
- {
545
- address: this.assertValidAddress(),
546
- args: [addresses, roles],
547
- ...this.optionallyAttachAccount(),
548
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
549
- ...(params as any),
550
- },
551
- );
552
- const hash = await writeManagedBudgetRevokeRoles(
553
- this._config,
554
- // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
555
- request as any,
556
- );
557
- return { hash, result };
558
- }
559
-
560
- /**
561
- * Return an array of the roles assigned to the given account.
562
- * @example
563
- * ```ts
564
- * (await budget.rolesOf(0xfoo)).includes(ManagedBudgetRoles.ADMIN)
565
- * @public
566
- * @param {Address} account
567
- * @param {?ReadParams<typeof managedBudgetAbi, 'rolesOf'>} [params]
568
- * @returns {Promise<Array<ManagedBudgetRoles>>}
569
- */
570
- public async rolesOf(
571
- account: Address,
572
- params?: ReadParams<typeof managedBudgetAbi, 'rolesOf'>,
573
- ) {
574
- const roles = await readManagedBudgetRolesOf(this._config, {
575
- address: this.assertValidAddress(),
576
- args: [account],
577
- ...this.optionallyAttachAccount(),
578
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
579
- ...(params as any),
580
- });
581
- return (
582
- [
583
- ManagedBudgetRoles.MANAGER,
584
- ManagedBudgetRoles.ADMIN,
585
- ] as unknown as Array<bigint>
586
- ).filter(
587
- (role) => (roles & role) === role,
588
- ) as unknown as ManagedBudgetRoles[];
589
- }
590
-
591
- /**
592
- * Returns whether given account has any of the provided roles bitmap.
593
- *
594
- * @example
595
- * ```ts
596
- * await budget.hasAnyRole(0xfoo, ManagedBudgetRoles.ADMIN | ManagedBudgetRoles.MANAGER)
597
- * @public
598
- * @param {Address} account
599
- * @param {ManagedBudgetRoles} roles
600
- * @param {?ReadParams<typeof managedBudgetAbi, 'hasAnyRole'>} [params]
601
- * @returns {Promise<boolean>}
602
- */
603
- public hasAnyRole(
604
- account: Address,
605
- roles: ManagedBudgetRoles,
606
- params?: ReadParams<typeof managedBudgetAbi, 'hasAnyRole'>,
607
- ) {
608
- return readManagedBudgetHasAnyRole(this._config, {
609
- address: this.assertValidAddress(),
610
- args: [account, roles],
611
- ...this.optionallyAttachAccount(),
612
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
613
- ...(params as any),
614
- });
615
- }
616
-
617
- /**
618
- * Returns whether given account has all of the provided roles bitmap.
619
- *
620
- * @example
621
- * ```ts
622
- * await budget.hasAllRoles(0xfoo, ManagedBudgetRoles.ADMIN & ManagedBudgetRoles.MANAGER)
623
- *
624
- * @public
625
- * @param {Address} account
626
- * @param {ManagedBudgetRoles} roles
627
- * @param {?ReadParams<typeof managedBudgetAbi, 'hasAllRoles'>} [params]
628
- * @returns {*}
629
- */
630
- public hasAllRoles(
631
- account: Address,
632
- roles: ManagedBudgetRoles,
633
- params?: ReadParams<typeof managedBudgetAbi, 'hasAllRoles'>,
634
- ) {
635
- return readManagedBudgetHasAllRoles(this._config, {
636
- address: this.assertValidAddress(),
637
- args: [account, roles],
638
- ...this.optionallyAttachAccount(),
639
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
640
- ...(params as any),
641
- });
642
- }
643
-
644
- /**
645
- * Check if the given account is authorized to use the budget
646
- *
647
- * @public
648
- * @param {Address} account
649
- * @param {?ReadParams<typeof managedBudgetAbi, 'isAuthorized'>} [params]
650
- * @returns {Promise<boolean>} - True if the account is authorized
651
- */
652
- public isAuthorized(
653
- account: Address,
654
- params?: ReadParams<typeof managedBudgetAbi, 'isAuthorized'>,
655
- ) {
656
- return readManagedBudgetIsAuthorized(this._config, {
657
- address: this.assertValidAddress(),
658
- args: [account],
659
- ...this.optionallyAttachAccount(),
660
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
661
- ...(params as any),
662
- });
663
- }
664
-
665
391
  /**
666
392
  * Get the owner of the budget
667
393
  *
@@ -34,7 +34,7 @@ import type {
34
34
  DeployableOptions,
35
35
  GenericDeployableParams,
36
36
  } from '../Deployable/Deployable';
37
- import { DeployableTarget } from '../Deployable/DeployableTarget';
37
+ import { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';
38
38
  import { DeployableUnknownOwnerProvidedError } from '../errors';
39
39
  import {
40
40
  type FungibleTransferPayload,
@@ -115,9 +115,9 @@ export type VestingBudgetLog<
115
115
  * @export
116
116
  * @class VestingBudget
117
117
  * @typedef {VestingBudget}
118
- * @extends {DeployableTarget<VestingBudgetPayload>}
118
+ * @extends {DeployableTargetWithRBAC<VestingBudgetPayload>}
119
119
  */
120
- export class VestingBudget extends DeployableTarget<
120
+ export class VestingBudget extends DeployableTargetWithRBAC<
121
121
  VestingBudgetPayload,
122
122
  typeof vestingBudgetAbi
123
123
  > {
@@ -387,77 +387,6 @@ export class VestingBudget extends DeployableTarget<
387
387
  return { hash, result };
388
388
  }
389
389
 
390
- /**
391
- * Set the authorized status of the given accounts
392
- * The mechanism for managing authorization is left to the implementing contract
393
- *
394
- * @public
395
- * @async
396
- * @param {Address[]} addresses - The accounts to authorize or deauthorize
397
- * @param {boolean[]} allowed - The authorization status for the given accounts
398
- * @param {?WriteParams<typeof vestingBudgetAbi, 'setAuthorized'>} [params]
399
- * @returns {Promise<void>}
400
- */
401
- public async setAuthorized(
402
- addresses: Address[],
403
- allowed: boolean[],
404
- params?: WriteParams<typeof vestingBudgetAbi, 'setAuthorized'>,
405
- ) {
406
- return await this.awaitResult(
407
- this.setAuthorizedRaw(addresses, allowed, params),
408
- );
409
- }
410
-
411
- /**
412
- * Set the authorized status of the given accounts
413
- * The mechanism for managing authorization is left to the implementing contract
414
- *
415
- * @public
416
- * @async
417
- * @param {Address[]} addresses - The accounts to authorize or deauthorize
418
- * @param {boolean[]} allowed - The authorization status for the given accounts
419
- * @param {?WriteParams<typeof vestingBudgetAbi, 'setAuthorized'>} [params]
420
- * @returns {Promise<void>}
421
- */
422
- public async setAuthorizedRaw(
423
- addresses: Address[],
424
- allowed: boolean[],
425
- params?: WriteParams<typeof vestingBudgetAbi, 'setAuthorized'>,
426
- ) {
427
- const { request, result } = await simulateVestingBudgetSetAuthorized(
428
- this._config,
429
- {
430
- address: this.assertValidAddress(),
431
- args: [addresses, allowed],
432
- ...this.optionallyAttachAccount(),
433
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
434
- ...(params as any),
435
- },
436
- );
437
- const hash = await writeVestingBudgetSetAuthorized(this._config, request);
438
- return { hash, result };
439
- }
440
-
441
- /**
442
- * Check if the given account is authorized to use the budget
443
- *
444
- * @public
445
- * @param {Address} account
446
- * @param {?ReadParams<typeof vestingBudgetAbi, 'isAuthorized'>} [params]
447
- * @returns {Promise<boolean>} - True if the account is authorized
448
- */
449
- public isAuthorized(
450
- account: Address,
451
- params?: ReadParams<typeof vestingBudgetAbi, 'isAuthorized'>,
452
- ) {
453
- return readVestingBudgetIsAuthorized(this._config, {
454
- address: this.assertValidAddress(),
455
- args: [account],
456
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
457
- ...(params as any),
458
- });
459
- }
460
-
461
390
  /**
462
391
  * Get the end time of the vesting schedule
463
392
  *