@boostxyz/sdk 0.0.0-alpha.9 → 1.1.0-alpha.22

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 (257) 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 +7 -7
  4. package/dist/Actions/ContractAction.d.ts +11 -11
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +14 -14
  7. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  8. package/dist/Actions/EventAction.cjs +1 -1
  9. package/dist/Actions/EventAction.cjs.map +1 -1
  10. package/dist/Actions/EventAction.d.ts +171 -41
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +15 -392
  13. package/dist/Actions/EventAction.js.map +1 -1
  14. package/dist/AllowLists/AllowList.cjs +1 -1
  15. package/dist/AllowLists/AllowList.cjs.map +1 -1
  16. package/dist/AllowLists/AllowList.d.ts +6 -4
  17. package/dist/AllowLists/AllowList.d.ts.map +1 -1
  18. package/dist/AllowLists/AllowList.js +45 -23
  19. package/dist/AllowLists/AllowList.js.map +1 -1
  20. package/dist/AllowLists/OpenAllowList.d.ts +423 -0
  21. package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
  22. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  23. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  24. package/dist/AllowLists/SimpleAllowList.d.ts +92 -37
  25. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  26. package/dist/AllowLists/SimpleAllowList.js +55 -71
  27. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  28. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  29. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  30. package/dist/AllowLists/SimpleDenyList.d.ts +203 -11
  31. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  32. package/dist/AllowLists/SimpleDenyList.js +11 -112
  33. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  34. package/dist/Auth/PassthroughAuth.cjs +1 -1
  35. package/dist/Auth/PassthroughAuth.js +1 -1
  36. package/dist/Boost.cjs +1 -1
  37. package/dist/Boost.cjs.map +1 -1
  38. package/dist/Boost.d.ts +20 -21
  39. package/dist/Boost.d.ts.map +1 -1
  40. package/dist/Boost.js +43 -57
  41. package/dist/Boost.js.map +1 -1
  42. package/dist/BoostCore-BVZExPPu.js +1462 -0
  43. package/dist/BoostCore-BVZExPPu.js.map +1 -0
  44. package/dist/BoostCore-D-E-cnGI.cjs +3 -0
  45. package/dist/BoostCore-D-E-cnGI.cjs.map +1 -0
  46. package/dist/BoostCore.cjs +1 -2
  47. package/dist/BoostCore.cjs.map +1 -1
  48. package/dist/BoostCore.d.ts +748 -77
  49. package/dist/BoostCore.d.ts.map +1 -1
  50. package/dist/BoostCore.js +29 -1150
  51. package/dist/BoostCore.js.map +1 -1
  52. package/dist/BoostRegistry.cjs +1 -1
  53. package/dist/BoostRegistry.cjs.map +1 -1
  54. package/dist/BoostRegistry.d.ts +80 -25
  55. package/dist/BoostRegistry.d.ts.map +1 -1
  56. package/dist/BoostRegistry.js +165 -83
  57. package/dist/BoostRegistry.js.map +1 -1
  58. package/dist/Budgets/Budget.cjs +1 -1
  59. package/dist/Budgets/Budget.cjs.map +1 -1
  60. package/dist/Budgets/Budget.d.ts.map +1 -1
  61. package/dist/Budgets/Budget.js +2 -2
  62. package/dist/Budgets/Budget.js.map +1 -1
  63. package/dist/Budgets/ManagedBudget.cjs +1 -1
  64. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  65. package/dist/Budgets/ManagedBudget.d.ts +75 -193
  66. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  67. package/dist/Budgets/ManagedBudget.js +80 -298
  68. package/dist/Budgets/ManagedBudget.js.map +1 -1
  69. package/dist/Budgets/VestingBudget.d.ts +223 -89
  70. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  71. package/dist/Deployable/Contract.cjs +1 -1
  72. package/dist/Deployable/Contract.cjs.map +1 -1
  73. package/dist/Deployable/Contract.d.ts +4 -5
  74. package/dist/Deployable/Contract.d.ts.map +1 -1
  75. package/dist/Deployable/Contract.js +5 -7
  76. package/dist/Deployable/Contract.js.map +1 -1
  77. package/dist/Deployable/Deployable.cjs.map +1 -1
  78. package/dist/Deployable/Deployable.d.ts +1 -1
  79. package/dist/Deployable/Deployable.d.ts.map +1 -1
  80. package/dist/Deployable/Deployable.js +3 -5
  81. package/dist/Deployable/Deployable.js.map +1 -1
  82. package/dist/Deployable/DeployableTarget.cjs +1 -1
  83. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  84. package/dist/Deployable/DeployableTarget.d.ts +13 -13
  85. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  86. package/dist/Deployable/DeployableTarget.js +28 -25
  87. package/dist/Deployable/DeployableTarget.js.map +1 -1
  88. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  89. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  90. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  94. package/dist/EventAction-BZt5cjbe.cjs +2 -0
  95. package/dist/EventAction-BZt5cjbe.cjs.map +1 -0
  96. package/dist/EventAction-C_-hJXWm.js +1541 -0
  97. package/dist/EventAction-C_-hJXWm.js.map +1 -0
  98. package/dist/Incentive-BhHaK3PZ.cjs +2 -0
  99. package/dist/Incentive-BhHaK3PZ.cjs.map +1 -0
  100. package/dist/Incentive-Cqg1w6wD.js +312 -0
  101. package/dist/Incentive-Cqg1w6wD.js.map +1 -0
  102. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  103. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  104. package/dist/Incentives/AllowListIncentive.d.ts +38 -16
  105. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  106. package/dist/Incentives/AllowListIncentive.js +42 -29
  107. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  108. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  109. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  110. package/dist/Incentives/CGDAIncentive.d.ts +234 -21
  111. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  112. package/dist/Incentives/CGDAIncentive.js +45 -32
  113. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  114. package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
  115. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  116. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  117. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  118. package/dist/Incentives/ERC20Incentive.d.ts +230 -29
  119. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  120. package/dist/Incentives/ERC20Incentive.js +56 -43
  121. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  122. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +335 -440
  123. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  124. package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
  125. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  126. package/dist/Incentives/Incentive.cjs +1 -1
  127. package/dist/Incentives/Incentive.cjs.map +1 -1
  128. package/dist/Incentives/Incentive.d.ts +4 -4
  129. package/dist/Incentives/Incentive.d.ts.map +1 -1
  130. package/dist/Incentives/Incentive.js +16 -296
  131. package/dist/Incentives/Incentive.js.map +1 -1
  132. package/dist/Incentives/PointsIncentive.cjs +1 -1
  133. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  134. package/dist/Incentives/PointsIncentive.d.ts +40 -18
  135. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  136. package/dist/Incentives/PointsIncentive.js +37 -24
  137. package/dist/Incentives/PointsIncentive.js.map +1 -1
  138. package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
  139. package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
  140. package/dist/SimpleDenyList-CGaWjuld.js +132 -0
  141. package/dist/SimpleDenyList-CGaWjuld.js.map +1 -0
  142. package/dist/Validators/SignerValidator.cjs +1 -1
  143. package/dist/Validators/SignerValidator.cjs.map +1 -1
  144. package/dist/Validators/SignerValidator.d.ts +16 -16
  145. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  146. package/dist/Validators/SignerValidator.js +30 -27
  147. package/dist/Validators/SignerValidator.js.map +1 -1
  148. package/dist/Validators/Validator.cjs +1 -1
  149. package/dist/Validators/Validator.cjs.map +1 -1
  150. package/dist/Validators/Validator.d.ts +1 -1
  151. package/dist/Validators/Validator.js +2 -2
  152. package/dist/Validators/Validator.js.map +1 -1
  153. package/dist/claiming.cjs.map +1 -1
  154. package/dist/claiming.d.ts +1 -1
  155. package/dist/claiming.js.map +1 -1
  156. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  157. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  158. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  159. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  160. package/dist/deployments-DVXioW2i.cjs +2 -0
  161. package/dist/deployments-DVXioW2i.cjs.map +1 -0
  162. package/dist/deployments-oykLv3_Z.js +43 -0
  163. package/dist/deployments-oykLv3_Z.js.map +1 -0
  164. package/dist/deployments.json +44 -0
  165. package/dist/errors.cjs +1 -1
  166. package/dist/errors.cjs.map +1 -1
  167. package/dist/errors.d.ts +256 -20
  168. package/dist/errors.d.ts.map +1 -1
  169. package/dist/errors.js +183 -26
  170. package/dist/errors.js.map +1 -1
  171. package/dist/{generated-57_Kffpz.js → generated-CKt2yCQd.js} +3613 -1869
  172. package/dist/generated-CKt2yCQd.js.map +1 -0
  173. package/dist/generated-CyTNlOwM.cjs +3 -0
  174. package/dist/generated-CyTNlOwM.cjs.map +1 -0
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.d.ts +5 -0
  177. package/dist/index.d.ts.map +1 -1
  178. package/dist/index.js +142 -108
  179. package/dist/index.js.map +1 -1
  180. package/dist/transfers.cjs.map +1 -1
  181. package/dist/transfers.d.ts +1 -1
  182. package/dist/transfers.js.map +1 -1
  183. package/dist/utils.cjs +1 -1
  184. package/dist/utils.cjs.map +1 -1
  185. package/dist/utils.d.ts +26 -12
  186. package/dist/utils.d.ts.map +1 -1
  187. package/dist/utils.js +38 -23
  188. package/dist/utils.js.map +1 -1
  189. package/package.json +20 -10
  190. package/src/Actions/Action.test.ts +14 -13
  191. package/src/Actions/ContractAction.test.ts +10 -10
  192. package/src/Actions/ContractAction.ts +11 -12
  193. package/src/Actions/ERC721MintAction.test.ts +6 -6
  194. package/src/Actions/ERC721MintAction.ts +14 -15
  195. package/src/Actions/EventAction.test.ts +729 -109
  196. package/src/Actions/EventAction.ts +542 -84
  197. package/src/AllowLists/AllowList.test.ts +7 -7
  198. package/src/AllowLists/AllowList.ts +5 -3
  199. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  200. package/src/AllowLists/OpenAllowList.ts +45 -0
  201. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  202. package/src/AllowLists/SimpleAllowList.ts +39 -61
  203. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  204. package/src/AllowLists/SimpleDenyList.ts +40 -17
  205. package/src/Auth/PassthroughAuth.test.ts +1 -1
  206. package/src/Boost.ts +21 -24
  207. package/src/BoostCore.test.ts +323 -268
  208. package/src/BoostCore.ts +396 -219
  209. package/src/BoostRegistry.test.ts +53 -0
  210. package/src/BoostRegistry.ts +161 -40
  211. package/src/Budgets/Budget.test.ts +2 -2
  212. package/src/Budgets/Budget.ts +1 -2
  213. package/src/Budgets/ManagedBudget.test.ts +82 -19
  214. package/src/Budgets/ManagedBudget.ts +48 -310
  215. package/src/Budgets/VestingBudget.test.ts +7 -7
  216. package/src/Budgets/VestingBudget.ts +34 -106
  217. package/src/Deployable/Contract.ts +4 -5
  218. package/src/Deployable/Deployable.ts +1 -1
  219. package/src/Deployable/DeployableTarget.ts +30 -19
  220. package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
  221. package/src/Incentives/AllowListIncentive.test.ts +5 -5
  222. package/src/Incentives/AllowListIncentive.ts +29 -15
  223. package/src/Incentives/CGDAIncentive.test.ts +9 -6
  224. package/src/Incentives/CGDAIncentive.ts +38 -18
  225. package/src/Incentives/ERC1155Incentive.test.ts +3 -3
  226. package/src/Incentives/ERC1155Incentive.ts +28 -29
  227. package/src/Incentives/ERC20Incentive.test.ts +9 -6
  228. package/src/Incentives/ERC20Incentive.ts +46 -26
  229. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  230. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +324 -0
  231. package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
  232. package/src/Incentives/ERC20VariableIncentive.ts +49 -26
  233. package/src/Incentives/Incentive.test.ts +4 -1
  234. package/src/Incentives/Incentive.ts +7 -6
  235. package/src/Incentives/PointsIncentive.test.ts +24 -25
  236. package/src/Incentives/PointsIncentive.ts +31 -17
  237. package/src/Validators/SignerValidator.test.ts +6 -6
  238. package/src/Validators/SignerValidator.ts +19 -17
  239. package/src/Validators/Validator.test.ts +2 -2
  240. package/src/Validators/Validator.ts +1 -1
  241. package/src/claiming.ts +1 -1
  242. package/src/errors.ts +345 -21
  243. package/src/index.test.ts +118 -36
  244. package/src/index.ts +5 -0
  245. package/src/transfers.ts +1 -1
  246. package/src/utils.test.ts +2 -2
  247. package/src/utils.ts +61 -12
  248. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  249. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  250. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  251. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  252. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  253. package/dist/generated-57_Kffpz.js.map +0 -1
  254. package/dist/generated-wKBNvm48.cjs +0 -3
  255. package/dist/generated-wKBNvm48.cjs.map +0 -1
  256. package/src/Budgets/SimpleBudget.test.ts +0 -152
  257. package/src/Budgets/SimpleBudget.ts +0 -564
@@ -33,11 +33,13 @@ import {
33
33
  parseAbiParameters,
34
34
  zeroAddress,
35
35
  } from 'viem';
36
+ import { ManagedBudget as ManagedBudgetBases } from '../../dist/deployments.json';
36
37
  import type {
37
38
  DeployableOptions,
38
39
  GenericDeployableParams,
39
40
  } from '../Deployable/Deployable';
40
41
  import { DeployableTarget } from '../Deployable/DeployableTarget';
42
+ import { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';
41
43
  import {
42
44
  DeployableUnknownOwnerProvidedError,
43
45
  UnknownTransferPayloadSupplied,
@@ -54,7 +56,6 @@ import {
54
56
  RegistryType,
55
57
  type WriteParams,
56
58
  } from '../utils';
57
-
58
59
  export { managedBudgetAbi };
59
60
  export type { ERC1155TransferPayload, FungibleTransferPayload };
60
61
 
@@ -81,22 +82,26 @@ export interface ManagedBudgetPayload {
81
82
  /**
82
83
  * List of roles to assign to the corresponding account by index.
83
84
  *
84
- * @type {bigint[]}
85
+ * @type {ManagedBudgetRoles[]}
85
86
  */
86
- roles: bigint[];
87
+ roles: ManagedBudgetRoles[];
87
88
  }
88
89
 
89
90
  /**
90
- * Enum representing available roles for use in the `ManagedBudget`.
91
+ * Enum representing available roles for use in the `ManagedBudget`.
91
92
  * `MANAGER` can disburse funds.
92
93
  * `ADMIN` can additionally manage authorized users on the budget.
93
94
  *
95
+ * @export
94
96
  * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}
97
+ * @enum {bigint}
95
98
  */
96
- export const ManagedBudgetRoles = {
97
- MANAGER: 1n,
98
- ADMIN: 2n,
99
- } as const;
99
+ export enum ManagedBudgetRoles {
100
+ //@ts-expect-error ts doesn't like bigint enum values
101
+ MANAGER = 1n,
102
+ //@ts-expect-error ts doesn't like bigint enum values
103
+ ADMIN = 2n,
104
+ }
100
105
 
101
106
  /**
102
107
  * A generic `viem.Log` event with support for `ManagedBudget` event types.
@@ -144,7 +149,7 @@ export function isERC1155TransferPayload(
144
149
  *
145
150
  * @export
146
151
  * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer
147
- * @returns {*}
152
+ * @returns {Hex}
148
153
  * @throws {@link UnknownTransferPayloadSupplied}
149
154
  */
150
155
  export function prepareTransfer(
@@ -152,9 +157,11 @@ export function prepareTransfer(
152
157
  ) {
153
158
  if (isFungibleTransfer(transfer)) {
154
159
  return prepareFungibleTransfer(transfer);
155
- } else if (isERC1155TransferPayload(transfer)) {
160
+ }
161
+ if (isERC1155TransferPayload(transfer)) {
156
162
  return prepareERC1155Transfer(transfer);
157
- } else throw new UnknownTransferPayloadSupplied(transfer);
163
+ }
164
+ throw new UnknownTransferPayloadSupplied(transfer);
158
165
  }
159
166
 
160
167
  /**
@@ -164,9 +171,9 @@ export function prepareTransfer(
164
171
  * @export
165
172
  * @class ManagedBudget
166
173
  * @typedef {ManagedBudget}
167
- * @extends {DeployableTarget<ManagedBudgetPayload>}
174
+ * @extends {DeployableTargetWithRBAC<ManagedBudgetPayload>}
168
175
  */
169
- export class ManagedBudget extends DeployableTarget<
176
+ export class ManagedBudget extends DeployableTargetWithRBAC<
170
177
  ManagedBudgetPayload,
171
178
  typeof managedBudgetAbi
172
179
  > {
@@ -183,10 +190,11 @@ export class ManagedBudget extends DeployableTarget<
183
190
  *
184
191
  * @public
185
192
  * @static
186
- * @type {Address}
193
+ * @type {Record<number, Address>}
187
194
  */
188
- public static override base: Address = import.meta.env
189
- .VITE_MANAGED_BUDGET_BASE;
195
+ public static override bases: Record<number, Address> = {
196
+ ...(ManagedBudgetBases as Record<number, Address>),
197
+ };
190
198
  /**
191
199
  * @inheritdoc
192
200
  *
@@ -204,7 +212,7 @@ export class ManagedBudget extends DeployableTarget<
204
212
  * @public
205
213
  * @async
206
214
  * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer
207
- * @param {?WriteParams<typeof managedBudgetAbi, 'allocate'>} [params]
215
+ * @param {?WriteParams} [params]
208
216
  * @returns {Promise<boolean>} - True if the allocation was successful
209
217
  */
210
218
  public async allocate(
@@ -222,8 +230,8 @@ export class ManagedBudget extends DeployableTarget<
222
230
  * @public
223
231
  * @async
224
232
  * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer
225
- * @param {?WriteParams<typeof managedBudgetAbi, 'allocate'>} [params]
226
- * @returns {Promise<boolean>} - True if the allocation was successful
233
+ * @param {?WriteParams} [params]
234
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the allocation was successful
227
235
  */
228
236
  public async allocateRaw(
229
237
  transfer: FungibleTransferPayload | ERC1155TransferPayload,
@@ -252,7 +260,7 @@ export class ManagedBudget extends DeployableTarget<
252
260
  * @public
253
261
  * @async
254
262
  * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer
255
- * @param {?WriteParams<typeof managedBudgetAbi, 'clawback'>} [params]
263
+ * @param {?WriteParams} [params]
256
264
  * @returns {Promise<boolean>} - True if the request was successful
257
265
  */
258
266
  public async clawback(
@@ -271,8 +279,8 @@ export class ManagedBudget extends DeployableTarget<
271
279
  * @public
272
280
  * @async
273
281
  * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer
274
- * @param {?WriteParams<typeof managedBudgetAbi, 'clawback'>} [params]
275
- * @returns {Promise<boolean>} - True if the request was successful
282
+ * @param {?WriteParams} [params]
283
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the request was successful
276
284
  */
277
285
  public async clawbackRaw(
278
286
  transfer: FungibleTransferPayload | ERC1155TransferPayload,
@@ -299,7 +307,7 @@ export class ManagedBudget extends DeployableTarget<
299
307
  * @public
300
308
  * @async
301
309
  * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer
302
- * @param {?WriteParams<typeof managedBudgetAbi, 'disburse'>} [params]
310
+ * @param {?WriteParams} [params]
303
311
  * @returns {Promise<boolean>} - True if the disbursement was successful
304
312
  */
305
313
  public async disburse(
@@ -316,8 +324,8 @@ export class ManagedBudget extends DeployableTarget<
316
324
  * @public
317
325
  * @async
318
326
  * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer
319
- * @param {?WriteParams<typeof managedBudgetAbi, 'disburse'>} [params]
320
- * @returns {Promise<boolean>} - True if the disbursement was successful
327
+ * @param {?WriteParams} [params]
328
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the disbursement was successful
321
329
  */
322
330
  public async disburseRaw(
323
331
  transfer: FungibleTransferPayload | ERC1155TransferPayload,
@@ -343,7 +351,7 @@ export class ManagedBudget extends DeployableTarget<
343
351
  * @public
344
352
  * @async
345
353
  * @param {Array<FungibleTransferPayload | ERC1155TransferPayload>} transfers
346
- * @param {?WriteParams<typeof managedBudgetAbi, 'disburseBatch'>} [params]
354
+ * @param {?WriteParams} [params]
347
355
  * @returns {Promise<boolean>} - True if all disbursements were successful
348
356
  */
349
357
  public async disburseBatch(
@@ -359,8 +367,8 @@ export class ManagedBudget extends DeployableTarget<
359
367
  * @public
360
368
  * @async
361
369
  * @param {Array<FungibleTransferPayload | ERC1155TransferPayload>} transfers
362
- * @param {?WriteParams<typeof managedBudgetAbi, 'disburseBatch'>} [params]
363
- * @returns {Promise<boolean>} - True if all disbursements were successful
370
+ * @param {?WriteParams} [params]
371
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if all disbursements were successful
364
372
  */
365
373
  public async disburseBatchRaw(
366
374
  transfers: Array<FungibleTransferPayload | ERC1155TransferPayload>,
@@ -380,281 +388,11 @@ export class ManagedBudget extends DeployableTarget<
380
388
  return { hash, result };
381
389
  }
382
390
 
383
- /**
384
- * Set the authorized status of the given accounts
385
- * The mechanism for managing authorization is left to the implementing contract
386
- *
387
- * @public
388
- * @async
389
- * @param {Address[]} addresses - The accounts to authorize or deauthorize
390
- * @param {boolean[]} allowed - The authorization status for the given accounts
391
- * @param {?WriteParams<typeof managedBudgetAbi, 'setAuthorized'>} [params]
392
- * @returns {Promise<void>}
393
- */
394
- public async setAuthorized(
395
- addresses: Address[],
396
- allowed: boolean[],
397
- params?: WriteParams<typeof managedBudgetAbi, 'setAuthorized'>,
398
- ) {
399
- return await this.awaitResult(
400
- this.setAuthorizedRaw(addresses, allowed, params),
401
- );
402
- }
403
-
404
- /**
405
- * Set the authorized status of the given accounts
406
- * The mechanism for managing authorization is left to the implementing contract
407
- *
408
- * @public
409
- * @async
410
- * @param {Address[]} addresses - The accounts to authorize or deauthorize
411
- * @param {boolean[]} allowed - The authorization status for the given accounts
412
- * @param {?WriteParams<typeof managedBudgetAbi, 'setAuthorized'>} [params]
413
- * @returns {Promise<void>}
414
- */
415
- public async setAuthorizedRaw(
416
- addresses: Address[],
417
- allowed: boolean[],
418
- params?: WriteParams<typeof managedBudgetAbi, 'setAuthorized'>,
419
- ) {
420
- const { request, result } = await simulateManagedBudgetSetAuthorized(
421
- this._config,
422
- {
423
- address: this.assertValidAddress(),
424
- args: [addresses, allowed],
425
- ...this.optionallyAttachAccount(),
426
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
427
- ...(params as any),
428
- },
429
- );
430
- const hash = await writeManagedBudgetSetAuthorized(this._config, request);
431
- return { hash, result };
432
- }
433
-
434
- /**
435
- * Grant many accounts permissions on the budget.
436
- *
437
- * @example
438
- * ```ts
439
- * await budget.grantRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])
440
- * ```
441
- * @public
442
- * @async
443
- * @param {Address[]} addresses
444
- * @param {bigint[]} roles
445
- * @param {?WriteParams<typeof managedBudgetAbi, 'grantRoles'>} [params]
446
- * @returns {unknown}
447
- */
448
- public async grantRoles(
449
- addresses: Address[],
450
- roles: bigint[],
451
- params?: WriteParams<typeof managedBudgetAbi, 'grantRoles'>,
452
- ) {
453
- return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));
454
- }
455
-
456
- /**
457
- * Grant many accounts permissions on the budget.
458
- *
459
- * @example
460
- * ```ts
461
- * await budget.grantRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])
462
- *
463
- * @public
464
- * @async
465
- * @param {Address[]} addresses
466
- * @param {bigint[]} roles
467
- * @param {?WriteParams<typeof managedBudgetAbi, 'grantRoles'>} [params]
468
- * @returns {unknown}
469
- */
470
- public async grantRolesRaw(
471
- addresses: Address[],
472
- roles: bigint[],
473
- params?: WriteParams<typeof managedBudgetAbi, 'grantRoles'>,
474
- ) {
475
- const { request, result } = await simulateManagedBudgetGrantRoles(
476
- this._config,
477
- {
478
- address: this.assertValidAddress(),
479
- args: [addresses, roles],
480
- ...this.optionallyAttachAccount(),
481
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
482
- ...(params as any),
483
- },
484
- );
485
- const hash = await writeManagedBudgetGrantRoles(
486
- this._config,
487
- // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
488
- request as any,
489
- );
490
- return { hash, result };
491
- }
492
-
493
- /**
494
- * Revoke many accounts' permissions on the budget.
495
- *
496
- * @example
497
- * ```ts
498
- * await budget.revokeRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])
499
- *
500
- * @public
501
- * @async
502
- * @param {Address[]} addresses
503
- * @param {bigint[]} roles
504
- * @param {?WriteParams<typeof managedBudgetAbi, 'revokeRoles'>} [params]
505
- * @returns {unknown}
506
- */
507
- public async revokeRoles(
508
- addresses: Address[],
509
- roles: bigint[],
510
- params?: WriteParams<typeof managedBudgetAbi, 'revokeRoles'>,
511
- ) {
512
- return await this.awaitResult(
513
- this.revokeRolesRaw(addresses, roles, params),
514
- );
515
- }
516
-
517
- /**
518
- * Revoke many accounts' permissions on the budget.
519
- *
520
- * @example
521
- * ```ts
522
- * await budget.revokeRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])
523
- * @public
524
- * @async
525
- * @param {Address[]} addresses
526
- * @param {bigint[]} roles
527
- * @param {?WriteParams<typeof managedBudgetAbi, 'revokeRoles'>} [params]
528
- * @returns {unknown}
529
- */
530
- public async revokeRolesRaw(
531
- addresses: Address[],
532
- roles: bigint[],
533
- params?: WriteParams<typeof managedBudgetAbi, 'revokeRoles'>,
534
- ) {
535
- const { request, result } = await simulateManagedBudgetRevokeRoles(
536
- this._config,
537
- {
538
- address: this.assertValidAddress(),
539
- args: [addresses, roles],
540
- ...this.optionallyAttachAccount(),
541
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
542
- ...(params as any),
543
- },
544
- );
545
- const hash = await writeManagedBudgetRevokeRoles(
546
- this._config,
547
- // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
548
- request as any,
549
- );
550
- return { hash, result };
551
- }
552
-
553
- /**
554
- * Return an array of the roles assigned to the given account.
555
- * @example
556
- * ```ts
557
- * (await budget.rolesOf(0xfoo)).includes(ManagedBudgetRoles.ADMIN)
558
- * @public
559
- * @param {Address} account
560
- * @param {?ReadParams<typeof managedBudgetAbi, 'rolesOf'>} [params]
561
- * @returns {Promise<Array<bigint>>}
562
- */
563
- public async rolesOf(
564
- account: Address,
565
- params?: ReadParams<typeof managedBudgetAbi, 'rolesOf'>,
566
- ) {
567
- const roles = await readManagedBudgetRolesOf(this._config, {
568
- address: this.assertValidAddress(),
569
- args: [account],
570
- ...this.optionallyAttachAccount(),
571
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
572
- ...(params as any),
573
- });
574
- return [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN].filter(
575
- (role) => (roles & role) === role,
576
- );
577
- }
578
-
579
- /**
580
- * Returns whether given account has any of the provided roles bitmap.
581
- *
582
- * @example
583
- * ```ts
584
- * await budget.hasAnyRole(0xfoo, ManagedBudgetRoles.ADMIN | ManagedBudgetRoles.MANAGER)
585
- * @public
586
- * @param {Address} account
587
- * @param {bigint} roles
588
- * @param {?ReadParams<typeof managedBudgetAbi, 'hasAnyRole'>} [params]
589
- * @returns {Promise<boolean>}
590
- */
591
- public hasAnyRole(
592
- account: Address,
593
- roles: bigint,
594
- params?: ReadParams<typeof managedBudgetAbi, 'hasAnyRole'>,
595
- ) {
596
- return readManagedBudgetHasAnyRole(this._config, {
597
- address: this.assertValidAddress(),
598
- args: [account, roles],
599
- ...this.optionallyAttachAccount(),
600
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
601
- ...(params as any),
602
- });
603
- }
604
-
605
- /**
606
- * Returns whether given account has all of the provided roles bitmap.
607
- *
608
- * @example
609
- * ```ts
610
- * await budget.hasAllRoles(0xfoo, ManagedBudgetRoles.ADMIN & ManagedBudgetRoles.MANAGER)
611
- *
612
- * @public
613
- * @param {Address} account
614
- * @param {bigint} roles
615
- * @param {?ReadParams<typeof managedBudgetAbi, 'hasAllRoles'>} [params]
616
- * @returns {*}
617
- */
618
- public hasAllRoles(
619
- account: Address,
620
- roles: bigint,
621
- params?: ReadParams<typeof managedBudgetAbi, 'hasAllRoles'>,
622
- ) {
623
- return readManagedBudgetHasAllRoles(this._config, {
624
- address: this.assertValidAddress(),
625
- args: [account, roles],
626
- ...this.optionallyAttachAccount(),
627
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
628
- ...(params as any),
629
- });
630
- }
631
-
632
- /**
633
- * Check if the given account is authorized to use the budget
634
- *
635
- * @public
636
- * @param {Address} account
637
- * @param {?ReadParams<typeof managedBudgetAbi, 'isAuthorized'>} [params]
638
- * @returns {Promise<boolean>} - True if the account is authorized
639
- */
640
- public isAuthorized(
641
- account: Address,
642
- params?: ReadParams<typeof managedBudgetAbi, 'isAuthorized'>,
643
- ) {
644
- return readManagedBudgetIsAuthorized(this._config, {
645
- address: this.assertValidAddress(),
646
- args: [account],
647
- ...this.optionallyAttachAccount(),
648
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
649
- ...(params as any),
650
- });
651
- }
652
-
653
391
  /**
654
392
  * Get the owner of the budget
655
393
  *
656
394
  * @public
657
- * @param {?ReadParams<typeof managedBudgetAbi, 'owner'>} [params]
395
+ * @param {?ReadParams} [params]
658
396
  * @returns {Promise<Address>}
659
397
  */
660
398
  public owner(params?: ReadParams<typeof managedBudgetAbi, 'owner'>) {
@@ -671,13 +409,13 @@ export class ManagedBudget extends DeployableTarget<
671
409
  * If a tokenId is provided, get the total amount of ERC1155 assets allocated to the budget, including any that have been distributed
672
410
  *
673
411
  * @public
674
- * @param {Address} asset - The address of the asset
412
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"] - The address of the asset
675
413
  * @param {?(bigint | undefined)} [tokenId] - The ID of the token
676
- * @param {?ReadParams<typeof managedBudgetAbi, 'total'>} [params]
414
+ * @param {?ReadParams} [params]
677
415
  * @returns {Promise<bigint>} - The total amount of assets
678
416
  */
679
417
  public total(
680
- asset: Address,
418
+ asset: Address = zeroAddress,
681
419
  tokenId?: bigint | undefined,
682
420
  params?: ReadParams<typeof managedBudgetAbi, 'total'>,
683
421
  ) {
@@ -694,13 +432,13 @@ export class ManagedBudget extends DeployableTarget<
694
432
  * If a tokenId is provided, get the amount of ERC1155 assets available for distribution from the budget
695
433
  *
696
434
  * @public
697
- * @param {Address} asset
435
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"]
698
436
  * @param {?(bigint | undefined)} [tokenId]
699
- * @param {?ReadParams<typeof managedBudgetAbi, 'available'>} [params]
437
+ * @param {?ReadParams} [params]
700
438
  * @returns {Promise<bigint>} - The amount of assets available
701
439
  */
702
440
  public available(
703
- asset: Address,
441
+ asset: Address = zeroAddress,
704
442
  tokenId?: bigint | undefined,
705
443
  params?: ReadParams<typeof managedBudgetAbi, 'available'>,
706
444
  ) {
@@ -717,13 +455,13 @@ export class ManagedBudget extends DeployableTarget<
717
455
  * If a tokenId is provided, get the amount of ERC1155 assets that have been distributed from the budget
718
456
  *
719
457
  * @public
720
- * @param {Address} asset
458
+ * @param {Address} [asset="0x0000000000000000000000000000000000000000"]
721
459
  * @param {?(bigint | undefined)} [tokenId]
722
- * @param {?ReadParams<typeof managedBudgetAbi, 'distributed'>} [params]
460
+ * @param {?ReadParams} [params]
723
461
  * @returns {Promise<bigint>} - The amount of assets distributed
724
462
  */
725
463
  public distributed(
726
- asset: Address,
464
+ asset: Address = zeroAddress,
727
465
  tokenId?: bigint | undefined,
728
466
  params?: ReadParams<typeof managedBudgetAbi, 'distributed'>,
729
467
  ) {
@@ -779,7 +517,7 @@ export class ManagedBudget extends DeployableTarget<
779
517
  * @param {Address} param0.owner - The budget's owner
780
518
  * @param {{}} param0.authorized - List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
781
519
  * @param {{}} param0.roles - List of roles to assign to the corresponding account by index.
782
- * @returns {*}
520
+ * @returns {Hex}
783
521
  */
784
522
  export const prepareManagedBudgetPayload = ({
785
523
  owner,
@@ -791,6 +529,6 @@ export const prepareManagedBudgetPayload = ({
791
529
  'ManagedBudgetPayload payload',
792
530
  'struct ManagedBudgetPayload { address owner; address[] authorized; uint256[] roles; }',
793
531
  ]),
794
- [{ owner, authorized, roles }],
532
+ [{ owner, authorized, roles: roles as unknown as Array<bigint> }],
795
533
  );
796
534
  };
@@ -1,7 +1,7 @@
1
1
  import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
2
2
  import { isAddress, parseEther, zeroAddress } from 'viem';
3
3
  import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
4
- import type { MockERC20 } from '../../test/MockERC20';
4
+ import type { MockERC20 } from '@boostxyz/test/MockERC20';
5
5
  import {
6
6
  type Fixtures,
7
7
  defaultOptions,
@@ -9,14 +9,14 @@ import {
9
9
  freshVestingBudget,
10
10
  fundErc20,
11
11
  fundVestingBudget,
12
- } from '../../test/helpers';
13
- import { testAccount } from '../../test/viem';
12
+ } from '@boostxyz/test/helpers';
13
+ import { testAccount } from '@boostxyz/test/viem';
14
14
  import { VestingBudget } from './VestingBudget';
15
15
 
16
16
  let fixtures: Fixtures, budget: VestingBudget, erc20: MockERC20;
17
17
 
18
18
  beforeAll(async () => {
19
- fixtures = await loadFixture(deployFixtures);
19
+ fixtures = await loadFixture(deployFixtures(defaultOptions));
20
20
  });
21
21
 
22
22
  describe.skip('VestingBudget', () => {
@@ -53,7 +53,7 @@ describe.skip('VestingBudget', () => {
53
53
  const budget = await loadFixture(
54
54
  freshVestingBudget(defaultOptions, fixtures),
55
55
  );
56
- expect(await budget.available(zeroAddress)).toBe(0n);
56
+ expect(await budget.available()).toBe(0n);
57
57
  });
58
58
 
59
59
  describe('can allocate', () => {
@@ -73,7 +73,7 @@ describe.skip('VestingBudget', () => {
73
73
  value: parseEther('1.0'),
74
74
  },
75
75
  );
76
- expect(await budget.available(zeroAddress)).toBe(parseEther('1.0'));
76
+ expect(await budget.available()).toBe(parseEther('1.0'));
77
77
  });
78
78
 
79
79
  test('erc20', async () => {
@@ -105,7 +105,7 @@ describe.skip('VestingBudget', () => {
105
105
  target: defaultOptions.account.address,
106
106
  });
107
107
 
108
- expect(await budget.available(zeroAddress)).toBe(0n);
108
+ expect(await budget.available()).toBe(0n);
109
109
  });
110
110
 
111
111
  test('erc20 assets', async () => {