@boostxyz/sdk 0.0.0-alpha.8 → 0.0.0-alpha.9

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 (180) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.js +1 -1
  3. package/dist/Actions/ContractAction.d.ts +46 -3
  4. package/dist/Actions/ContractAction.d.ts.map +1 -1
  5. package/dist/Actions/ERC721MintAction.d.ts +37 -10
  6. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  7. package/dist/Actions/EventAction.cjs +1 -1
  8. package/dist/Actions/EventAction.cjs.map +1 -1
  9. package/dist/Actions/EventAction.d.ts +257 -12
  10. package/dist/Actions/EventAction.d.ts.map +1 -1
  11. package/dist/Actions/EventAction.js +249 -82
  12. package/dist/Actions/EventAction.js.map +1 -1
  13. package/dist/AllowLists/AllowList.cjs +1 -1
  14. package/dist/AllowLists/AllowList.js +1 -1
  15. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  16. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  17. package/dist/AllowLists/SimpleAllowList.d.ts +31 -2
  18. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  19. package/dist/AllowLists/SimpleAllowList.js +52 -37
  20. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  21. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  22. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  23. package/dist/AllowLists/SimpleDenyList.d.ts +31 -2
  24. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  25. package/dist/AllowLists/SimpleDenyList.js +41 -129
  26. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  27. package/dist/Auth/PassthroughAuth.cjs +1 -1
  28. package/dist/Auth/PassthroughAuth.cjs.map +1 -1
  29. package/dist/Auth/PassthroughAuth.js +4 -4
  30. package/dist/Auth/PassthroughAuth.js.map +1 -1
  31. package/dist/Boost.cjs +1 -1
  32. package/dist/Boost.cjs.map +1 -1
  33. package/dist/Boost.d.ts +93 -1
  34. package/dist/Boost.d.ts.map +1 -1
  35. package/dist/Boost.js +151 -5
  36. package/dist/Boost.js.map +1 -1
  37. package/dist/BoostCore.cjs +2 -2
  38. package/dist/BoostCore.cjs.map +1 -1
  39. package/dist/BoostCore.d.ts +12 -6
  40. package/dist/BoostCore.d.ts.map +1 -1
  41. package/dist/BoostCore.js +168 -166
  42. package/dist/BoostCore.js.map +1 -1
  43. package/dist/BoostRegistry.cjs +1 -1
  44. package/dist/BoostRegistry.cjs.map +1 -1
  45. package/dist/BoostRegistry.d.ts +4 -4
  46. package/dist/BoostRegistry.d.ts.map +1 -1
  47. package/dist/BoostRegistry.js +19 -24
  48. package/dist/BoostRegistry.js.map +1 -1
  49. package/dist/Budgets/Budget.cjs +1 -1
  50. package/dist/Budgets/Budget.js +1 -1
  51. package/dist/Budgets/ManagedBudget.cjs +1 -1
  52. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  53. package/dist/Budgets/ManagedBudget.d.ts +40 -2
  54. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  55. package/dist/Budgets/ManagedBudget.js +53 -36
  56. package/dist/Budgets/ManagedBudget.js.map +1 -1
  57. package/dist/Budgets/SimpleBudget.d.ts +33 -2
  58. package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
  59. package/dist/Budgets/VestingBudget.d.ts +54 -2
  60. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  61. package/dist/Deployable/Contract.cjs +1 -1
  62. package/dist/Deployable/Contract.cjs.map +1 -1
  63. package/dist/Deployable/Contract.js +1 -1
  64. package/dist/Deployable/Contract.js.map +1 -1
  65. package/dist/Deployable/DeployableTarget.cjs +1 -1
  66. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  67. package/dist/Deployable/DeployableTarget.js +3 -3
  68. package/dist/Deployable/DeployableTarget.js.map +1 -1
  69. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  70. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  71. package/dist/Incentives/AllowListIncentive.d.ts +35 -5
  72. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  73. package/dist/Incentives/AllowListIncentive.js +33 -21
  74. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  75. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  76. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  77. package/dist/Incentives/CGDAIncentive.d.ts +89 -5
  78. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  79. package/dist/Incentives/CGDAIncentive.js +44 -23
  80. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  81. package/dist/Incentives/ERC1155Incentive.d.ts +67 -6
  82. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  83. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  84. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  85. package/dist/Incentives/ERC20Incentive.d.ts +49 -5
  86. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  87. package/dist/Incentives/ERC20Incentive.js +46 -27
  88. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  89. package/dist/Incentives/ERC20VariableIncentive.d.ts +42 -5
  90. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  91. package/dist/Incentives/Incentive.cjs +1 -1
  92. package/dist/Incentives/Incentive.cjs.map +1 -1
  93. package/dist/Incentives/Incentive.js +48 -32
  94. package/dist/Incentives/Incentive.js.map +1 -1
  95. package/dist/Incentives/PointsIncentive.cjs +1 -1
  96. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  97. package/dist/Incentives/PointsIncentive.d.ts +49 -5
  98. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  99. package/dist/Incentives/PointsIncentive.js +38 -21
  100. package/dist/Incentives/PointsIncentive.js.map +1 -1
  101. package/dist/Validators/SignerValidator.cjs +1 -1
  102. package/dist/Validators/SignerValidator.cjs.map +1 -1
  103. package/dist/Validators/SignerValidator.d.ts +298 -5
  104. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  105. package/dist/Validators/SignerValidator.js +151 -26
  106. package/dist/Validators/SignerValidator.js.map +1 -1
  107. package/dist/Validators/Validator.cjs +1 -1
  108. package/dist/Validators/Validator.js +1 -1
  109. package/dist/claiming.cjs +2 -0
  110. package/dist/claiming.cjs.map +1 -0
  111. package/dist/claiming.d.ts +43 -0
  112. package/dist/claiming.d.ts.map +1 -0
  113. package/dist/claiming.js +17 -0
  114. package/dist/claiming.js.map +1 -0
  115. package/dist/errors.cjs.map +1 -1
  116. package/dist/errors.d.ts +1 -1
  117. package/dist/errors.d.ts.map +1 -1
  118. package/dist/errors.js.map +1 -1
  119. package/dist/{generated-Cbv8zFkf.js → generated-57_Kffpz.js} +8 -5
  120. package/dist/generated-57_Kffpz.js.map +1 -0
  121. package/dist/{generated-BzszviNp.cjs → generated-wKBNvm48.cjs} +2 -2
  122. package/dist/generated-wKBNvm48.cjs.map +1 -0
  123. package/dist/index.cjs +1 -1
  124. package/dist/index.d.ts +4 -4
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +108 -125
  127. package/dist/transfers.cjs +2 -0
  128. package/dist/transfers.cjs.map +1 -0
  129. package/dist/transfers.d.ts +198 -0
  130. package/dist/transfers.d.ts.map +1 -0
  131. package/dist/transfers.js +84 -0
  132. package/dist/transfers.js.map +1 -0
  133. package/dist/utils.cjs +1 -1
  134. package/dist/utils.cjs.map +1 -1
  135. package/dist/utils.d.ts +2 -1371
  136. package/dist/utils.d.ts.map +1 -1
  137. package/dist/utils.js +26 -653
  138. package/dist/utils.js.map +1 -1
  139. package/package.json +17 -3
  140. package/src/Actions/Action.test.ts +5 -4
  141. package/src/Actions/ContractAction.test.ts +4 -6
  142. package/src/Actions/ContractAction.ts +73 -10
  143. package/src/Actions/ERC721MintAction.test.ts +2 -2
  144. package/src/Actions/ERC721MintAction.ts +70 -16
  145. package/src/Actions/EventAction.test.ts +43 -17
  146. package/src/Actions/EventAction.ts +452 -35
  147. package/src/AllowLists/SimpleAllowList.ts +48 -5
  148. package/src/AllowLists/SimpleDenyList.ts +47 -109
  149. package/src/Auth/PassthroughAuth.ts +1 -1
  150. package/src/Boost.ts +136 -1
  151. package/src/BoostCore.test.ts +4 -11
  152. package/src/BoostCore.ts +39 -33
  153. package/src/BoostRegistry.ts +19 -22
  154. package/src/Budgets/ManagedBudget.ts +69 -16
  155. package/src/Budgets/SimpleBudget.ts +57 -14
  156. package/src/Budgets/VestingBudget.ts +79 -9
  157. package/src/Deployable/Contract.ts +1 -1
  158. package/src/Deployable/DeployableTarget.ts +2 -2
  159. package/src/Incentives/AllowListIncentive.test.ts +2 -5
  160. package/src/Incentives/AllowListIncentive.ts +59 -15
  161. package/src/Incentives/CGDAIncentive.test.ts +3 -7
  162. package/src/Incentives/CGDAIncentive.ts +123 -19
  163. package/src/Incentives/ERC1155Incentive.test.ts +2 -13
  164. package/src/Incentives/ERC1155Incentive.ts +104 -22
  165. package/src/Incentives/ERC20Incentive.test.ts +6 -17
  166. package/src/Incentives/ERC20Incentive.ts +86 -21
  167. package/src/Incentives/ERC20VariableIncentive.test.ts +4 -24
  168. package/src/Incentives/ERC20VariableIncentive.ts +71 -19
  169. package/src/Incentives/Incentive.test.ts +1 -1
  170. package/src/Incentives/PointsIncentive.test.ts +3 -6
  171. package/src/Incentives/PointsIncentive.ts +79 -17
  172. package/src/Validators/SignerValidator.test.ts +3 -7
  173. package/src/Validators/SignerValidator.ts +422 -13
  174. package/src/claiming.ts +56 -0
  175. package/src/errors.ts +1 -1
  176. package/src/index.ts +10 -7
  177. package/src/transfers.ts +284 -0
  178. package/src/utils.ts +3 -2052
  179. package/dist/generated-BzszviNp.cjs.map +0 -1
  180. package/dist/generated-Cbv8zFkf.js.map +0 -1
@@ -21,15 +21,15 @@ import {
21
21
  type GenericDeployableParams,
22
22
  } from './Deployable/Deployable';
23
23
  import type { DeployableTarget } from './Deployable/DeployableTarget';
24
- import {
25
- type GenericLog,
26
- type HashAndSimulatedResult,
27
- type ReadParams,
24
+ import type {
25
+ GenericLog,
26
+ HashAndSimulatedResult,
27
+ ReadParams,
28
28
  RegistryType,
29
- type WriteParams,
29
+ WriteParams,
30
30
  } from './utils';
31
31
 
32
- export { RegistryType, boostRegistryAbi };
32
+ export { boostRegistryAbi };
33
33
 
34
34
  /**
35
35
  * The fixed address for the Boost Registry.
@@ -192,7 +192,7 @@ export class BoostRegistry extends Deployable<
192
192
  implementation: Address,
193
193
  params?: WriteParams<typeof boostRegistryAbi, 'register'>,
194
194
  ) {
195
- return this.awaitResult(
195
+ return await this.awaitResult(
196
196
  this.registerRaw(registryType, name, implementation, params),
197
197
  );
198
198
  }
@@ -240,7 +240,7 @@ export class BoostRegistry extends Deployable<
240
240
  * @returns {Target} - The provided instance, but with a new address attached.
241
241
  * biome-ignore lint/suspicious/noExplicitAny: any deployable target will suffice
242
242
  */
243
- public async initialize<Target extends DeployableTarget<any, any>>(
243
+ public initialize<Target extends DeployableTarget<any, any>>(
244
244
  displayName: string,
245
245
  target: Target,
246
246
  params?: WriteParams<typeof boostRegistryAbi, 'deployClone'>,
@@ -286,7 +286,9 @@ export class BoostRegistry extends Deployable<
286
286
  target: Target,
287
287
  params?: WriteParams<typeof boostRegistryAbi, 'deployClone'>,
288
288
  ): Promise<Address> {
289
- return this.awaitResult(this.deployCloneRaw(displayName, target, params));
289
+ return await this.awaitResult(
290
+ this.deployCloneRaw(displayName, target, params),
291
+ );
290
292
  }
291
293
 
292
294
  /**
@@ -312,12 +314,7 @@ export class BoostRegistry extends Deployable<
312
314
  this._config,
313
315
  {
314
316
  address: this.assertValidAddress(),
315
- args: [
316
- target.registryType,
317
- target.base,
318
- displayName,
319
- payload.args.at(0)!,
320
- ],
317
+ args: [target.registryType, target.base, displayName, payload.args[0]],
321
318
  ...this.optionallyAttachAccount(),
322
319
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
323
320
  ...(params as any),
@@ -341,7 +338,7 @@ export class BoostRegistry extends Deployable<
341
338
  identifier: Hex,
342
339
  params?: ReadParams<typeof boostRegistryAbi, 'getBaseImplementation'>,
343
340
  ) {
344
- return readBoostRegistryGetBaseImplementation(this._config, {
341
+ return await readBoostRegistryGetBaseImplementation(this._config, {
345
342
  address: this.assertValidAddress(),
346
343
  args: [identifier],
347
344
  ...this.optionallyAttachAccount(),
@@ -351,7 +348,7 @@ export class BoostRegistry extends Deployable<
351
348
  }
352
349
 
353
350
  /**
354
- * Get the address of a deployed clone by its identifier (index in incentives array)
351
+ * Get the address of a deployed clone by its identifier
355
352
  *
356
353
  * @public
357
354
  * @async
@@ -363,7 +360,7 @@ export class BoostRegistry extends Deployable<
363
360
  identifier: Hex,
364
361
  params?: ReadParams<typeof boostRegistryAbi, 'getClone'>,
365
362
  ) {
366
- return readBoostRegistryGetBaseImplementation(this._config, {
363
+ return await readBoostRegistryGetBaseImplementation(this._config, {
367
364
  address: this.assertValidAddress(),
368
365
  args: [identifier],
369
366
  ...this.optionallyAttachAccount(),
@@ -379,13 +376,13 @@ export class BoostRegistry extends Deployable<
379
376
  * @async
380
377
  * @param {Address} deployer - The address of the deployer
381
378
  * @param {?ReadParams<typeof boostRegistryAbi, 'getClones'>} [params]
382
- * @returns {Promise<Address[]>} - The list of deployed clones for the given deployer
379
+ * @returns {Promise<Hex[]>} - The list of deployed clones for the given deployer
383
380
  */
384
381
  public async getClones(
385
382
  deployer: Address,
386
383
  params?: ReadParams<typeof boostRegistryAbi, 'getClones'>,
387
384
  ) {
388
- return readBoostRegistryGetClones(this._config, {
385
+ return await readBoostRegistryGetClones(this._config, {
389
386
  address: this.assertValidAddress(),
390
387
  args: [deployer],
391
388
  ...this.optionallyAttachAccount(),
@@ -413,7 +410,7 @@ export class BoostRegistry extends Deployable<
413
410
  displayName: string,
414
411
  params?: ReadParams<typeof boostRegistryAbi, 'getCloneIdentifier'>,
415
412
  ) {
416
- return readBoostRegistryGetCloneIdentifier(this._config, {
413
+ return await readBoostRegistryGetCloneIdentifier(this._config, {
417
414
  address: this.assertValidAddress(),
418
415
  args: [registryType, base, deployer, displayName],
419
416
  ...this.optionallyAttachAccount(),
@@ -437,7 +434,7 @@ export class BoostRegistry extends Deployable<
437
434
  displayName: string,
438
435
  params?: ReadParams<typeof boostRegistryAbi, 'getIdentifier'>,
439
436
  ) {
440
- return readBoostRegistryGetCloneIdentifier(this._config, {
437
+ return await readBoostRegistryGetCloneIdentifier(this._config, {
441
438
  address: this.assertValidAddress(),
442
439
  args: [registryType, displayName],
443
440
  ...this.optionallyAttachAccount(),
@@ -29,6 +29,8 @@ import {
29
29
  type Address,
30
30
  type ContractEventName,
31
31
  type Hex,
32
+ encodeAbiParameters,
33
+ parseAbiParameters,
32
34
  zeroAddress,
33
35
  } from 'viem';
34
36
  import type {
@@ -43,22 +45,46 @@ import {
43
45
  import {
44
46
  type ERC1155TransferPayload,
45
47
  type FungibleTransferPayload,
48
+ prepareERC1155Transfer,
49
+ prepareFungibleTransfer,
50
+ } from '../transfers';
51
+ import {
46
52
  type GenericLog,
47
- type ManagedBudgetPayload,
48
53
  type ReadParams,
49
54
  RegistryType,
50
55
  type WriteParams,
51
- prepareERC1155Transfer,
52
- prepareFungibleTransfer,
53
- prepareManagedBudgetPayload,
54
56
  } from '../utils';
55
57
 
56
58
  export { managedBudgetAbi };
57
- export type {
58
- ERC1155TransferPayload,
59
- FungibleTransferPayload,
60
- ManagedBudgetPayload,
61
- };
59
+ export type { ERC1155TransferPayload, FungibleTransferPayload };
60
+
61
+ /**
62
+ * The object representation of a `ManagedBudgetPayload.InitPayload`
63
+ *
64
+ * @export
65
+ * @interface ManagedBudgetPayload
66
+ * @typedef {ManagedBudgetPayload}
67
+ */
68
+ export interface ManagedBudgetPayload {
69
+ /**
70
+ * The budget's owner
71
+ *
72
+ * @type {Address}
73
+ */
74
+ owner: Address;
75
+ /**
76
+ * List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
77
+ *
78
+ * @type {Address[]}
79
+ */
80
+ authorized: Address[];
81
+ /**
82
+ * List of roles to assign to the corresponding account by index.
83
+ *
84
+ * @type {bigint[]}
85
+ */
86
+ roles: bigint[];
87
+ }
62
88
 
63
89
  /**
64
90
  * Enum representing available roles for use in the `ManagedBudget`.
@@ -185,7 +211,7 @@ export class ManagedBudget extends DeployableTarget<
185
211
  transfer: FungibleTransferPayload | ERC1155TransferPayload,
186
212
  params?: WriteParams<typeof managedBudgetAbi, 'allocate'>,
187
213
  ) {
188
- return this.awaitResult(this.allocateRaw(transfer, params));
214
+ return await this.awaitResult(this.allocateRaw(transfer, params));
189
215
  }
190
216
 
191
217
  /**
@@ -233,7 +259,7 @@ export class ManagedBudget extends DeployableTarget<
233
259
  transfer: FungibleTransferPayload | ERC1155TransferPayload,
234
260
  params?: WriteParams<typeof managedBudgetAbi, 'clawback'>,
235
261
  ) {
236
- return this.awaitResult(this.clawbackRaw(transfer, params));
262
+ return await this.awaitResult(this.clawbackRaw(transfer, params));
237
263
  }
238
264
 
239
265
  /**
@@ -280,7 +306,7 @@ export class ManagedBudget extends DeployableTarget<
280
306
  transfer: FungibleTransferPayload | ERC1155TransferPayload,
281
307
  params?: WriteParams<typeof managedBudgetAbi, 'disburse'>,
282
308
  ) {
283
- return this.awaitResult(this.disburseRaw(transfer, params));
309
+ return await this.awaitResult(this.disburseRaw(transfer, params));
284
310
  }
285
311
 
286
312
  /**
@@ -324,7 +350,7 @@ export class ManagedBudget extends DeployableTarget<
324
350
  transfers: Array<FungibleTransferPayload | ERC1155TransferPayload>,
325
351
  params?: WriteParams<typeof managedBudgetAbi, 'disburseBatch'>,
326
352
  ) {
327
- return this.awaitResult(this.disburseBatchRaw(transfers, params));
353
+ return await this.awaitResult(this.disburseBatchRaw(transfers, params));
328
354
  }
329
355
 
330
356
  /**
@@ -370,7 +396,9 @@ export class ManagedBudget extends DeployableTarget<
370
396
  allowed: boolean[],
371
397
  params?: WriteParams<typeof managedBudgetAbi, 'setAuthorized'>,
372
398
  ) {
373
- return this.awaitResult(this.setAuthorizedRaw(addresses, allowed, params));
399
+ return await this.awaitResult(
400
+ this.setAuthorizedRaw(addresses, allowed, params),
401
+ );
374
402
  }
375
403
 
376
404
  /**
@@ -422,7 +450,7 @@ export class ManagedBudget extends DeployableTarget<
422
450
  roles: bigint[],
423
451
  params?: WriteParams<typeof managedBudgetAbi, 'grantRoles'>,
424
452
  ) {
425
- return this.awaitResult(this.grantRolesRaw(addresses, roles, params));
453
+ return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));
426
454
  }
427
455
 
428
456
  /**
@@ -481,7 +509,9 @@ export class ManagedBudget extends DeployableTarget<
481
509
  roles: bigint[],
482
510
  params?: WriteParams<typeof managedBudgetAbi, 'revokeRoles'>,
483
511
  ) {
484
- return this.awaitResult(this.revokeRolesRaw(addresses, roles, params));
512
+ return await this.awaitResult(
513
+ this.revokeRolesRaw(addresses, roles, params),
514
+ );
485
515
  }
486
516
 
487
517
  /**
@@ -741,3 +771,26 @@ export class ManagedBudget extends DeployableTarget<
741
771
  };
742
772
  }
743
773
  }
774
+
775
+ /**
776
+ * Given a {@link ManagedBudgetPayload}, properly encode a `ManagedBudget.InitPayload` for use with {@link ManagedBudget} initialization.
777
+ *
778
+ * @param {ManagedBudgetPayload} param0
779
+ * @param {Address} param0.owner - The budget's owner
780
+ * @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
+ * @param {{}} param0.roles - List of roles to assign to the corresponding account by index.
782
+ * @returns {*}
783
+ */
784
+ export const prepareManagedBudgetPayload = ({
785
+ owner,
786
+ authorized,
787
+ roles,
788
+ }: ManagedBudgetPayload) => {
789
+ return encodeAbiParameters(
790
+ parseAbiParameters([
791
+ 'ManagedBudgetPayload payload',
792
+ 'struct ManagedBudgetPayload { address owner; address[] authorized; uint256[] roles; }',
793
+ ]),
794
+ [{ owner, authorized, roles }],
795
+ );
796
+ };
@@ -22,6 +22,8 @@ import {
22
22
  type Address,
23
23
  type ContractEventName,
24
24
  type Hex,
25
+ encodeAbiParameters,
26
+ parseAbiParameters,
25
27
  zeroAddress,
26
28
  } from 'viem';
27
29
  import type {
@@ -36,22 +38,40 @@ import {
36
38
  import {
37
39
  type ERC1155TransferPayload,
38
40
  type FungibleTransferPayload,
41
+ prepareERC1155Transfer,
42
+ prepareFungibleTransfer,
43
+ } from '../transfers';
44
+ import {
39
45
  type GenericLog,
40
46
  type ReadParams,
41
47
  RegistryType,
42
- type SimpleBudgetPayload,
43
48
  type WriteParams,
44
- prepareERC1155Transfer,
45
- prepareFungibleTransfer,
46
- prepareSimpleBudgetPayload,
47
49
  } from '../utils';
48
50
 
49
51
  export { simpleBudgetAbi };
50
- export type {
51
- ERC1155TransferPayload,
52
- FungibleTransferPayload,
53
- SimpleBudgetPayload,
54
- };
52
+ export type { ERC1155TransferPayload, FungibleTransferPayload };
53
+
54
+ /**
55
+ * The object representation of a `SimpleBudgetPayload.InitPayload`
56
+ *
57
+ * @export
58
+ * @interface SimpleBudgetPayload
59
+ * @typedef {SimpleBudgetPayload}
60
+ */
61
+ export interface SimpleBudgetPayload {
62
+ /**
63
+ * The budget's owner
64
+ *
65
+ * @type {Address}
66
+ */
67
+ owner: Address;
68
+ /**
69
+ * List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
70
+ *
71
+ * @type {Address[]}
72
+ */
73
+ authorized: Address[];
74
+ }
55
75
 
56
76
  /**
57
77
  * A generic `viem.Log` event with support for `SimpleBudget` event types.
@@ -159,7 +179,7 @@ export class SimpleBudget extends DeployableTarget<
159
179
  transfer: FungibleTransferPayload | ERC1155TransferPayload,
160
180
  params?: WriteParams<typeof simpleBudgetAbi, 'allocate'>,
161
181
  ) {
162
- return this.awaitResult(this.allocateRaw(transfer, params));
182
+ return await this.awaitResult(this.allocateRaw(transfer, params));
163
183
  }
164
184
 
165
185
  /**
@@ -207,7 +227,7 @@ export class SimpleBudget extends DeployableTarget<
207
227
  transfer: FungibleTransferPayload | ERC1155TransferPayload,
208
228
  params?: WriteParams<typeof simpleBudgetAbi, 'clawback'>,
209
229
  ) {
210
- return this.awaitResult(this.clawbackRaw(transfer, params));
230
+ return await this.awaitResult(this.clawbackRaw(transfer, params));
211
231
  }
212
232
 
213
233
  /**
@@ -254,7 +274,7 @@ export class SimpleBudget extends DeployableTarget<
254
274
  transfer: FungibleTransferPayload | ERC1155TransferPayload,
255
275
  params?: WriteParams<typeof simpleBudgetAbi, 'disburse'>,
256
276
  ) {
257
- return this.awaitResult(this.disburseRaw(transfer, params));
277
+ return await this.awaitResult(this.disburseRaw(transfer, params));
258
278
  }
259
279
 
260
280
  /**
@@ -298,7 +318,7 @@ export class SimpleBudget extends DeployableTarget<
298
318
  transfers: Array<FungibleTransferPayload | ERC1155TransferPayload>,
299
319
  params?: WriteParams<typeof simpleBudgetAbi, 'disburseBatch'>,
300
320
  ) {
301
- return this.awaitResult(this.disburseBatchRaw(transfers, params));
321
+ return await this.awaitResult(this.disburseBatchRaw(transfers, params));
302
322
  }
303
323
 
304
324
  /**
@@ -344,7 +364,9 @@ export class SimpleBudget extends DeployableTarget<
344
364
  allowed: boolean[],
345
365
  params?: WriteParams<typeof simpleBudgetAbi, 'setAuthorized'>,
346
366
  ) {
347
- return this.awaitResult(this.setAuthorizedRaw(addresses, allowed, params));
367
+ return await this.awaitResult(
368
+ this.setAuthorizedRaw(addresses, allowed, params),
369
+ );
348
370
  }
349
371
 
350
372
  /**
@@ -519,3 +541,24 @@ export class SimpleBudget extends DeployableTarget<
519
541
  };
520
542
  }
521
543
  }
544
+
545
+ /**
546
+ * Given a {@link SimpleBudgetPayload}, properly encode a `SimpleBudget.InitPayload` for use with {@link SimpleBudget} initialization.
547
+ *
548
+ * @param {SimpleBudgetPayload} param0
549
+ * @param {Address} param0.owner - The budget's owner
550
+ * @param {{}} param0.authorized - List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
551
+ * @returns {*}
552
+ */
553
+ export const prepareSimpleBudgetPayload = ({
554
+ owner,
555
+ authorized,
556
+ }: SimpleBudgetPayload) => {
557
+ return encodeAbiParameters(
558
+ parseAbiParameters([
559
+ 'SimpleBudgetPayload payload',
560
+ 'struct SimpleBudgetPayload { address owner; address[] authorized; }',
561
+ ]),
562
+ [{ owner, authorized }],
563
+ );
564
+ };
@@ -26,6 +26,8 @@ import {
26
26
  type Address,
27
27
  type ContractEventName,
28
28
  type Hex,
29
+ encodeAbiParameters,
30
+ parseAbiParameters,
29
31
  zeroAddress,
30
32
  } from 'viem';
31
33
  import type {
@@ -36,17 +38,56 @@ import { DeployableTarget } from '../Deployable/DeployableTarget';
36
38
  import { DeployableUnknownOwnerProvidedError } from '../errors';
37
39
  import {
38
40
  type FungibleTransferPayload,
41
+ prepareFungibleTransfer,
42
+ } from '../transfers';
43
+ import {
39
44
  type GenericLog,
40
45
  type ReadParams,
41
46
  RegistryType,
42
- type VestingBudgetPayload,
43
47
  type WriteParams,
44
- prepareFungibleTransfer,
45
- prepareVestingBudgetPayload,
46
48
  } from '../utils';
47
49
 
48
50
  export { vestingBudgetAbi };
49
- export type { VestingBudgetPayload };
51
+ export type { FungibleTransferPayload };
52
+ /**
53
+ * The object representation of a `VestingBudget.InitPayload`
54
+ *
55
+ * @export
56
+ * @interface VestingBudgetPayload
57
+ * @typedef {VestingBudgetPayload}
58
+ */
59
+ export interface VestingBudgetPayload {
60
+ /**
61
+ * The budget's owner.
62
+ *
63
+ * @type {Address}
64
+ */
65
+ owner: Address;
66
+ /**
67
+ * List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
68
+ *
69
+ * @type {Address[]}
70
+ */
71
+ authorized: Address[];
72
+ /**
73
+ * The timestamp at which the vesting schedule begins
74
+ *
75
+ * @type {bigint}
76
+ */
77
+ start: bigint;
78
+ /**
79
+ * The duration of the vesting schedule (in seconds)
80
+ *
81
+ * @type {bigint}
82
+ */
83
+ duration: bigint;
84
+ /**
85
+ * The duration of the cliff period (in seconds)
86
+ *
87
+ * @type {bigint}
88
+ */
89
+ cliff: bigint;
90
+ }
50
91
 
51
92
  /**
52
93
  * A generic `viem.Log` event with support for `VestingBudget` event types.
@@ -178,7 +219,7 @@ export class VestingBudget extends DeployableTarget<
178
219
  transfer: FungibleTransferPayload,
179
220
  params?: WriteParams<typeof vestingBudgetAbi, 'allocate'>,
180
221
  ) {
181
- return this.awaitResult(this.allocateRaw(transfer, params));
222
+ return await this.awaitResult(this.allocateRaw(transfer, params));
182
223
  }
183
224
 
184
225
  /**
@@ -226,7 +267,7 @@ export class VestingBudget extends DeployableTarget<
226
267
  transfer: FungibleTransferPayload,
227
268
  params?: WriteParams<typeof vestingBudgetAbi, 'clawback'>,
228
269
  ) {
229
- return this.awaitResult(this.clawbackRaw(transfer, params));
270
+ return await this.awaitResult(this.clawbackRaw(transfer, params));
230
271
  }
231
272
 
232
273
  /**
@@ -273,7 +314,7 @@ export class VestingBudget extends DeployableTarget<
273
314
  transfer: FungibleTransferPayload,
274
315
  params?: WriteParams<typeof vestingBudgetAbi, 'disburse'>,
275
316
  ) {
276
- return this.awaitResult(this.disburseRaw(transfer, params));
317
+ return await this.awaitResult(this.disburseRaw(transfer, params));
277
318
  }
278
319
 
279
320
  /**
@@ -317,7 +358,7 @@ export class VestingBudget extends DeployableTarget<
317
358
  transfers: FungibleTransferPayload[],
318
359
  params?: WriteParams<typeof vestingBudgetAbi, 'disburseBatch'>,
319
360
  ) {
320
- return this.awaitResult(this.disburseBatchRaw(transfers, params));
361
+ return await this.awaitResult(this.disburseBatchRaw(transfers, params));
321
362
  }
322
363
 
323
364
  /**
@@ -363,7 +404,9 @@ export class VestingBudget extends DeployableTarget<
363
404
  allowed: boolean[],
364
405
  params?: WriteParams<typeof vestingBudgetAbi, 'setAuthorized'>,
365
406
  ) {
366
- return this.awaitResult(this.setAuthorizedRaw(addresses, allowed, params));
407
+ return await this.awaitResult(
408
+ this.setAuthorizedRaw(addresses, allowed, params),
409
+ );
367
410
  }
368
411
 
369
412
  /**
@@ -530,3 +573,30 @@ export class VestingBudget extends DeployableTarget<
530
573
  };
531
574
  }
532
575
  }
576
+
577
+ /**
578
+ * Given a {@link VestingBudgetPayload}, properly encode a `VestingBudget.InitPayload` for use with {@link VestingBudget} initialization.
579
+ *
580
+ * @param {VestingBudgetPayload} param0
581
+ * @param {Address} param0.owner - The budget's owner.
582
+ * @param {{}} param0.authorized - List of accounts authorized to use the budget. This list should include a Boost core address to interact with the protocol.
583
+ * @param {bigint} param0.start - The timestamp at which the vesting schedule begins
584
+ * @param {bigint} param0.duration - The duration of the vesting schedule (in seconds)
585
+ * @param {bigint} param0.cliff - The duration of the cliff period (in seconds)
586
+ * @returns {Hex}
587
+ */
588
+ export function prepareVestingBudgetPayload({
589
+ owner,
590
+ authorized,
591
+ start,
592
+ duration,
593
+ cliff,
594
+ }: VestingBudgetPayload) {
595
+ return encodeAbiParameters(
596
+ parseAbiParameters([
597
+ 'VestingBudgetPayload payload',
598
+ 'struct VestingBudgetPayload { address owner; address[] authorized; uint64 start; uint64 duration; uint64 cliff; }',
599
+ ]),
600
+ [{ owner, authorized, start, duration, cliff }],
601
+ );
602
+ }
@@ -224,6 +224,6 @@ export class Contract<ContractAbi extends Abi> {
224
224
  hashPromise: Promise<HashAndSimulatedResult<Result>>,
225
225
  waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,
226
226
  ) {
227
- return awaitResult(this._config, hashPromise, waitParams);
227
+ return await awaitResult(this._config, hashPromise, waitParams);
228
228
  }
229
229
  }
@@ -170,7 +170,7 @@ export class DeployableTarget<
170
170
  interfaceId: Hex,
171
171
  params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,
172
172
  ) {
173
- return readACloneableSupportsInterface(this._config, {
173
+ return await readACloneableSupportsInterface(this._config, {
174
174
  address: this.assertValidAddress(),
175
175
  ...this.optionallyAttachAccount(),
176
176
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -191,7 +191,7 @@ export class DeployableTarget<
191
191
  public async getComponentInterface(
192
192
  params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,
193
193
  ) {
194
- return readACloneableGetComponentInterface(this._config, {
194
+ return await readACloneableGetComponentInterface(this._config, {
195
195
  address: this.assertValidAddress(),
196
196
  ...this.optionallyAttachAccount(),
197
197
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -9,7 +9,6 @@ import {
9
9
  freshBoost,
10
10
  } from '../../test/helpers';
11
11
  import { LIST_MANAGER_ROLE } from '../AllowLists/SimpleAllowList';
12
- import { prepareSignerValidatorClaimDataPayload } from '../utils';
13
12
  import { PointsIncentive } from './PointsIncentive';
14
13
 
15
14
  let fixtures: Fixtures;
@@ -68,11 +67,10 @@ describe('AllowListIncentive', () => {
68
67
  console.log(claimant);
69
68
 
70
69
  const incentiveQuantity = 1;
71
- const claimDataPayload = await prepareSignerValidatorClaimDataPayload({
70
+ const claimDataPayload = await boost.validator.encodeClaimData({
72
71
  signer: trustedSigner,
73
72
  incentiveData,
74
73
  chainId: defaultOptions.config.chains[0].id,
75
- validator: boost.validator.assertValidAddress(),
76
74
  incentiveQuantity,
77
75
  claimant,
78
76
  boostId: boost.id,
@@ -114,11 +112,10 @@ describe('AllowListIncentive', () => {
114
112
  const incentiveData = pad('0xdef456232173821931823712381232131391321934');
115
113
  console.log(claimant);
116
114
 
117
- const claimDataPayload = await prepareSignerValidatorClaimDataPayload({
115
+ const claimDataPayload = await boost.validator.encodeClaimData({
118
116
  signer: trustedSigner,
119
117
  incentiveData,
120
118
  chainId: defaultOptions.config.chains[0].id,
121
- validator: boost.validator.assertValidAddress(),
122
119
  incentiveQuantity,
123
120
  claimant,
124
121
  boostId: boost.id,