@boostxyz/sdk 0.0.0-alpha.8 → 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 (266) 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 +57 -14
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +50 -23
  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 +420 -45
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +15 -225
  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 +123 -39
  25. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  26. package/dist/AllowLists/SimpleAllowList.js +75 -76
  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 +234 -13
  31. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  32. package/dist/AllowLists/SimpleDenyList.js +11 -200
  33. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  34. package/dist/Auth/PassthroughAuth.cjs +1 -1
  35. package/dist/Auth/PassthroughAuth.cjs.map +1 -1
  36. package/dist/Auth/PassthroughAuth.js +4 -4
  37. package/dist/Auth/PassthroughAuth.js.map +1 -1
  38. package/dist/Boost.cjs +1 -1
  39. package/dist/Boost.cjs.map +1 -1
  40. package/dist/Boost.d.ts +105 -14
  41. package/dist/Boost.d.ts.map +1 -1
  42. package/dist/Boost.js +137 -5
  43. package/dist/Boost.js.map +1 -1
  44. package/dist/BoostCore-BVZExPPu.js +1462 -0
  45. package/dist/BoostCore-BVZExPPu.js.map +1 -0
  46. package/dist/BoostCore-D-E-cnGI.cjs +3 -0
  47. package/dist/BoostCore-D-E-cnGI.cjs.map +1 -0
  48. package/dist/BoostCore.cjs +1 -2
  49. package/dist/BoostCore.cjs.map +1 -1
  50. package/dist/BoostCore.d.ts +759 -82
  51. package/dist/BoostCore.d.ts.map +1 -1
  52. package/dist/BoostCore.js +29 -1148
  53. package/dist/BoostCore.js.map +1 -1
  54. package/dist/BoostRegistry.cjs +1 -1
  55. package/dist/BoostRegistry.cjs.map +1 -1
  56. package/dist/BoostRegistry.d.ts +83 -28
  57. package/dist/BoostRegistry.d.ts.map +1 -1
  58. package/dist/BoostRegistry.js +170 -93
  59. package/dist/BoostRegistry.js.map +1 -1
  60. package/dist/Budgets/Budget.cjs +1 -1
  61. package/dist/Budgets/Budget.cjs.map +1 -1
  62. package/dist/Budgets/Budget.d.ts.map +1 -1
  63. package/dist/Budgets/Budget.js +2 -2
  64. package/dist/Budgets/Budget.js.map +1 -1
  65. package/dist/Budgets/ManagedBudget.cjs +1 -1
  66. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  67. package/dist/Budgets/ManagedBudget.d.ts +112 -192
  68. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  69. package/dist/Budgets/ManagedBudget.js +89 -290
  70. package/dist/Budgets/ManagedBudget.js.map +1 -1
  71. package/dist/Budgets/VestingBudget.d.ts +277 -91
  72. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  73. package/dist/Deployable/Contract.cjs +1 -1
  74. package/dist/Deployable/Contract.cjs.map +1 -1
  75. package/dist/Deployable/Contract.d.ts +4 -5
  76. package/dist/Deployable/Contract.d.ts.map +1 -1
  77. package/dist/Deployable/Contract.js +6 -8
  78. package/dist/Deployable/Contract.js.map +1 -1
  79. package/dist/Deployable/Deployable.cjs.map +1 -1
  80. package/dist/Deployable/Deployable.d.ts +1 -1
  81. package/dist/Deployable/Deployable.d.ts.map +1 -1
  82. package/dist/Deployable/Deployable.js +3 -5
  83. package/dist/Deployable/Deployable.js.map +1 -1
  84. package/dist/Deployable/DeployableTarget.cjs +1 -1
  85. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  86. package/dist/Deployable/DeployableTarget.d.ts +13 -13
  87. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  88. package/dist/Deployable/DeployableTarget.js +30 -27
  89. package/dist/Deployable/DeployableTarget.js.map +1 -1
  90. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  94. package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
  95. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  96. package/dist/EventAction-BZt5cjbe.cjs +2 -0
  97. package/dist/EventAction-BZt5cjbe.cjs.map +1 -0
  98. package/dist/EventAction-C_-hJXWm.js +1541 -0
  99. package/dist/EventAction-C_-hJXWm.js.map +1 -0
  100. package/dist/Incentive-BhHaK3PZ.cjs +2 -0
  101. package/dist/Incentive-BhHaK3PZ.cjs.map +1 -0
  102. package/dist/Incentive-Cqg1w6wD.js +312 -0
  103. package/dist/Incentive-Cqg1w6wD.js.map +1 -0
  104. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  105. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  106. package/dist/Incentives/AllowListIncentive.d.ts +73 -21
  107. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  108. package/dist/Incentives/AllowListIncentive.js +61 -36
  109. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  110. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  111. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  112. package/dist/Incentives/CGDAIncentive.d.ts +323 -26
  113. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  114. package/dist/Incentives/CGDAIncentive.js +73 -39
  115. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  116. package/dist/Incentives/ERC1155Incentive.d.ts +291 -43
  117. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  118. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  119. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  120. package/dist/Incentives/ERC20Incentive.d.ts +278 -33
  121. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  122. package/dist/Incentives/ERC20Incentive.js +79 -47
  123. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  124. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +346 -420
  125. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  126. package/dist/Incentives/ERC20VariableIncentive.d.ts +271 -32
  127. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  128. package/dist/Incentives/Incentive.cjs +1 -1
  129. package/dist/Incentives/Incentive.cjs.map +1 -1
  130. package/dist/Incentives/Incentive.d.ts +4 -4
  131. package/dist/Incentives/Incentive.d.ts.map +1 -1
  132. package/dist/Incentives/Incentive.js +16 -280
  133. package/dist/Incentives/Incentive.js.map +1 -1
  134. package/dist/Incentives/PointsIncentive.cjs +1 -1
  135. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  136. package/dist/Incentives/PointsIncentive.d.ts +89 -23
  137. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  138. package/dist/Incentives/PointsIncentive.js +66 -36
  139. package/dist/Incentives/PointsIncentive.js.map +1 -1
  140. package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
  141. package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
  142. package/dist/SimpleDenyList-CGaWjuld.js +132 -0
  143. package/dist/SimpleDenyList-CGaWjuld.js.map +1 -0
  144. package/dist/Validators/SignerValidator.cjs +1 -1
  145. package/dist/Validators/SignerValidator.cjs.map +1 -1
  146. package/dist/Validators/SignerValidator.d.ts +310 -17
  147. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  148. package/dist/Validators/SignerValidator.js +164 -36
  149. package/dist/Validators/SignerValidator.js.map +1 -1
  150. package/dist/Validators/Validator.cjs +1 -1
  151. package/dist/Validators/Validator.cjs.map +1 -1
  152. package/dist/Validators/Validator.d.ts +1 -1
  153. package/dist/Validators/Validator.js +2 -2
  154. package/dist/Validators/Validator.js.map +1 -1
  155. package/dist/claiming.cjs +2 -0
  156. package/dist/claiming.cjs.map +1 -0
  157. package/dist/claiming.d.ts +43 -0
  158. package/dist/claiming.d.ts.map +1 -0
  159. package/dist/claiming.js +17 -0
  160. package/dist/claiming.js.map +1 -0
  161. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  162. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  163. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  164. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  165. package/dist/deployments-DVXioW2i.cjs +2 -0
  166. package/dist/deployments-DVXioW2i.cjs.map +1 -0
  167. package/dist/deployments-oykLv3_Z.js +43 -0
  168. package/dist/deployments-oykLv3_Z.js.map +1 -0
  169. package/dist/deployments.json +44 -0
  170. package/dist/errors.cjs +1 -1
  171. package/dist/errors.cjs.map +1 -1
  172. package/dist/errors.d.ts +257 -21
  173. package/dist/errors.d.ts.map +1 -1
  174. package/dist/errors.js +183 -26
  175. package/dist/errors.js.map +1 -1
  176. package/dist/{generated-Cbv8zFkf.js → generated-CKt2yCQd.js} +3615 -1868
  177. package/dist/generated-CKt2yCQd.js.map +1 -0
  178. package/dist/generated-CyTNlOwM.cjs +3 -0
  179. package/dist/generated-CyTNlOwM.cjs.map +1 -0
  180. package/dist/index.cjs +1 -1
  181. package/dist/index.d.ts +9 -4
  182. package/dist/index.d.ts.map +1 -1
  183. package/dist/index.js +143 -126
  184. package/dist/index.js.map +1 -1
  185. package/dist/transfers.cjs +2 -0
  186. package/dist/transfers.cjs.map +1 -0
  187. package/dist/transfers.d.ts +198 -0
  188. package/dist/transfers.d.ts.map +1 -0
  189. package/dist/transfers.js +84 -0
  190. package/dist/transfers.js.map +1 -0
  191. package/dist/utils.cjs +1 -1
  192. package/dist/utils.cjs.map +1 -1
  193. package/dist/utils.d.ts +25 -1380
  194. package/dist/utils.d.ts.map +1 -1
  195. package/dist/utils.js +36 -648
  196. package/dist/utils.js.map +1 -1
  197. package/package.json +34 -10
  198. package/src/Actions/Action.test.ts +19 -17
  199. package/src/Actions/ContractAction.test.ts +14 -16
  200. package/src/Actions/ContractAction.ts +84 -22
  201. package/src/Actions/ERC721MintAction.test.ts +8 -8
  202. package/src/Actions/ERC721MintAction.ts +83 -30
  203. package/src/Actions/EventAction.test.ts +759 -113
  204. package/src/Actions/EventAction.ts +991 -116
  205. package/src/AllowLists/AllowList.test.ts +7 -7
  206. package/src/AllowLists/AllowList.ts +5 -3
  207. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  208. package/src/AllowLists/OpenAllowList.ts +45 -0
  209. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  210. package/src/AllowLists/SimpleAllowList.ts +86 -65
  211. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  212. package/src/AllowLists/SimpleDenyList.ts +87 -126
  213. package/src/Auth/PassthroughAuth.test.ts +1 -1
  214. package/src/Auth/PassthroughAuth.ts +1 -1
  215. package/src/Boost.ts +147 -15
  216. package/src/BoostCore.test.ts +326 -278
  217. package/src/BoostCore.ts +425 -242
  218. package/src/BoostRegistry.test.ts +53 -0
  219. package/src/BoostRegistry.ts +168 -50
  220. package/src/Budgets/Budget.test.ts +2 -2
  221. package/src/Budgets/Budget.ts +1 -2
  222. package/src/Budgets/ManagedBudget.test.ts +82 -19
  223. package/src/Budgets/ManagedBudget.ts +106 -315
  224. package/src/Budgets/VestingBudget.test.ts +7 -7
  225. package/src/Budgets/VestingBudget.ts +110 -112
  226. package/src/Deployable/Contract.ts +5 -6
  227. package/src/Deployable/Deployable.ts +1 -1
  228. package/src/Deployable/DeployableTarget.ts +32 -21
  229. package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
  230. package/src/Incentives/AllowListIncentive.test.ts +7 -10
  231. package/src/Incentives/AllowListIncentive.ts +88 -30
  232. package/src/Incentives/CGDAIncentive.test.ts +11 -12
  233. package/src/Incentives/CGDAIncentive.ts +161 -37
  234. package/src/Incentives/ERC1155Incentive.test.ts +5 -16
  235. package/src/Incentives/ERC1155Incentive.ts +132 -51
  236. package/src/Incentives/ERC20Incentive.test.ts +15 -23
  237. package/src/Incentives/ERC20Incentive.ts +131 -46
  238. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  239. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +324 -0
  240. package/src/Incentives/ERC20VariableIncentive.test.ts +12 -35
  241. package/src/Incentives/ERC20VariableIncentive.ts +118 -43
  242. package/src/Incentives/Incentive.test.ts +5 -2
  243. package/src/Incentives/Incentive.ts +7 -6
  244. package/src/Incentives/PointsIncentive.test.ts +26 -30
  245. package/src/Incentives/PointsIncentive.ts +110 -34
  246. package/src/Validators/SignerValidator.test.ts +9 -13
  247. package/src/Validators/SignerValidator.ts +437 -26
  248. package/src/Validators/Validator.test.ts +2 -2
  249. package/src/Validators/Validator.ts +1 -1
  250. package/src/claiming.ts +56 -0
  251. package/src/errors.ts +346 -22
  252. package/src/index.test.ts +118 -36
  253. package/src/index.ts +15 -7
  254. package/src/transfers.ts +284 -0
  255. package/src/utils.test.ts +2 -2
  256. package/src/utils.ts +61 -2061
  257. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  258. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  259. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  260. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  261. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  262. package/dist/generated-BzszviNp.cjs +0 -3
  263. package/dist/generated-BzszviNp.cjs.map +0 -1
  264. package/dist/generated-Cbv8zFkf.js.map +0 -1
  265. package/src/Budgets/SimpleBudget.test.ts +0 -152
  266. package/src/Budgets/SimpleBudget.ts +0 -521
package/src/errors.ts CHANGED
@@ -1,12 +1,15 @@
1
1
  import {
2
+ type AbiEvent,
3
+ type AbiFunction,
2
4
  type Hex,
3
5
  type Log,
4
6
  type WaitForTransactionReceiptReturnType,
5
7
  zeroHash,
6
8
  } from 'viem';
9
+ import type { Criteria } from './Actions/EventAction';
10
+ import type { EventLogs } from './Actions/EventAction';
7
11
  import type { BoostRegistry } from './BoostRegistry';
8
12
  import type { Incentive } from './Incentives/Incentive';
9
- import type { Criteria } from './utils';
10
13
 
11
14
  /**
12
15
  * This error is thrown during Boost creation if no `BoostCreated` event was emitted.
@@ -84,7 +87,7 @@ export class DeployableAlreadyDeployedError extends Error {
84
87
  */
85
88
  constructor(address: string) {
86
89
  super(
87
- `Attempted to deploy a contract that already has an address configured`,
90
+ 'Attempted to deploy a contract that already has an address configured',
88
91
  );
89
92
  this.address = address;
90
93
  }
@@ -248,6 +251,44 @@ export class InvalidComponentInterfaceError extends Error {
248
251
  }
249
252
  }
250
253
 
254
+ /**
255
+ * This error is thrown when a param is not transparently stored onchain
256
+ *
257
+ * @export
258
+ * @class UnparseableAbiParamError
259
+ * @typedef {UnparseableAbiParamError}
260
+ * @extends {Error}
261
+ */
262
+ export class UnparseableAbiParamError extends Error {
263
+ /**
264
+ * the param index that is unparseable
265
+ *
266
+ * @type {number}
267
+ */
268
+ input_param_idx: number;
269
+ /**
270
+ * The given event that contains the unparseable param
271
+ *
272
+ * @type {AbiEvent}
273
+ */
274
+ event: AbiEvent;
275
+ /**
276
+ * Creates an instance of UnknownTransferPayloadSupplied.
277
+ *
278
+ * @constructor
279
+ * @param {number} input_param_idx
280
+ * @param {AbiEvent} event
281
+ */
282
+ constructor(input_param_idx: number, event: AbiEvent) {
283
+ super(
284
+ `Parameter is not transparently stored onchain. Parameter ${input_param_idx} in event ${event.name} cannot be used in an action`,
285
+ { cause: event },
286
+ );
287
+ this.event = event;
288
+ this.input_param_idx = input_param_idx;
289
+ }
290
+ }
291
+
251
292
  /**
252
293
  * This error is thrown when attempting a Budget transfer and arguments aren't of the type `FungibleTransferPayload` or `ERC1155TransferPayload`
253
294
  *
@@ -380,6 +421,48 @@ export class TooManyEventActionStepsProvidedError extends Error {
380
421
  }
381
422
  }
382
423
 
424
+ /**
425
+ * The error is thrown when trying to reuse an existing deployed Incentive that isn't a base implementation.
426
+ *
427
+ * @export
428
+ * @class ValidationAbiMissingError
429
+ * @typedef {ValidationAbiMissingError}
430
+ * @extends {Error}
431
+ */
432
+ export class ValidationAbiMissingError extends Error {
433
+ /**
434
+ * Creates an instance of ValidationAbiMissingError.
435
+ *
436
+ * @constructor
437
+ * @param {Hex} signature
438
+ */
439
+ constructor(signature: Hex) {
440
+ super(`No known ABI for given signature: ${signature}`);
441
+ }
442
+ }
443
+
444
+ /**
445
+ * Function action validation context to help debug other validation errors
446
+ *
447
+ * @interface FunctionActionValidationMeta
448
+ * @typedef {FunctionActionValidationMeta}
449
+ */
450
+ interface FunctionActionValidationMeta {
451
+ decodedArgs: readonly (string | bigint)[];
452
+ /**
453
+ * The value pulled off the log being validated against
454
+ *
455
+ * @type {*}
456
+ * biome-ignore lint/suspicious/noExplicitAny: this can be a few different types based on what the log emits
457
+ */
458
+ fieldValue: any;
459
+ /**
460
+ * The criteria being used to compare during validation
461
+ *
462
+ * @type {Criteria}
463
+ */
464
+ criteria: Criteria;
465
+ }
383
466
  /**
384
467
  * Event action validation context to help debug other validation errors
385
468
  *
@@ -392,7 +475,7 @@ interface EventActionValidationMeta {
392
475
  *
393
476
  * @type {Log}
394
477
  */
395
- log: Log;
478
+ log?: EventLogs[0];
396
479
  /**
397
480
  * The value pulled off the log being validated against
398
481
  *
@@ -413,17 +496,23 @@ interface EventActionValidationMeta {
413
496
  * Instantiated with relevent context data for more in depth debugging.
414
497
  *
415
498
  * @export
416
- * @class EventActionValidationError
417
- * @typedef {EventActionValidationError}
499
+ * @class FieldActionValidationError
500
+ * @typedef {FieldActionValidationError}
418
501
  * @extends {Error}
419
502
  */
420
- export class EventActionValidationError extends Error {
503
+ export class FieldActionValidationError extends Error {
504
+ /**
505
+ * The function input arguments being validated against
506
+ *
507
+ * @type {decodedArgs}
508
+ */
509
+ decodedArgs?: readonly (string | bigint)[];
421
510
  /**
422
511
  * The viem log being validated against
423
512
  *
424
513
  * @type {Log}
425
514
  */
426
- log: Log;
515
+ log?: EventLogs[0];
427
516
  /**
428
517
  * The value pulled off the log being validated against
429
518
  *
@@ -438,7 +527,7 @@ export class EventActionValidationError extends Error {
438
527
  */
439
528
  criteria: Criteria;
440
529
  /**
441
- * Creates an instance of EventActionValidationError.
530
+ * Creates an instance of FieldActionValidationError.
442
531
  *
443
532
  * @constructor
444
533
  * @param {string} message
@@ -449,12 +538,48 @@ export class EventActionValidationError extends Error {
449
538
  */
450
539
  constructor(
451
540
  message: string,
452
- { fieldValue, criteria, log }: EventActionValidationMeta,
541
+ {
542
+ fieldValue,
543
+ criteria,
544
+ ...args
545
+ }: EventActionValidationMeta | FunctionActionValidationMeta,
453
546
  ) {
454
547
  super(message);
455
548
  this.fieldValue = fieldValue;
456
549
  this.criteria = criteria;
457
- this.log = log;
550
+
551
+ switch (true) {
552
+ case 'log' in args:
553
+ this.log = args.log;
554
+ break;
555
+ case 'decodedArgs' in args:
556
+ this.decodedArgs = args.decodedArgs;
557
+ }
558
+ }
559
+ }
560
+
561
+ /**
562
+ * Thrown when abi-decoded args on log is undefined
563
+ *
564
+ * @export
565
+ * @class FieldValueUndefinedError
566
+ * @typedef {FieldValueUndefinedError}
567
+ * @extends {FieldActionValidationError}
568
+ */
569
+ export class DecodedArgsMalformedError extends FieldActionValidationError {
570
+ /**
571
+ * Creates an instance of DecodedArgsUndefinedError.
572
+ *
573
+ * @constructor
574
+ * @param {DecodedArgsMalformedError} metadata
575
+ */
576
+ constructor(
577
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
578
+ ) {
579
+ super(
580
+ 'Decoded Args are malformed; Check which params are indexed',
581
+ metadata,
582
+ );
458
583
  }
459
584
  }
460
585
 
@@ -464,16 +589,18 @@ export class EventActionValidationError extends Error {
464
589
  * @export
465
590
  * @class FieldValueUndefinedError
466
591
  * @typedef {FieldValueUndefinedError}
467
- * @extends {EventActionValidationError}
592
+ * @extends {FieldActionValidationError}
468
593
  */
469
- export class FieldValueUndefinedError extends EventActionValidationError {
594
+ export class FieldValueUndefinedError extends FieldActionValidationError {
470
595
  /**
471
596
  * Creates an instance of FieldValueUndefinedError.
472
597
  *
473
598
  * @constructor
474
599
  * @param {EventActionValidationMeta} metadata
475
600
  */
476
- constructor(metadata: EventActionValidationMeta) {
601
+ constructor(
602
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
603
+ ) {
477
604
  super('Field value is undefined', metadata);
478
605
  }
479
606
  }
@@ -484,16 +611,18 @@ export class FieldValueUndefinedError extends EventActionValidationError {
484
611
  * @export
485
612
  * @class InvalidNumericalCriteriaError
486
613
  * @typedef {InvalidNumericalCriteriaError}
487
- * @extends {EventActionValidationError}
614
+ * @extends {FieldActionValidationError}
488
615
  */
489
- export class InvalidNumericalCriteriaError extends EventActionValidationError {
616
+ export class InvalidNumericalCriteriaError extends FieldActionValidationError {
490
617
  /**
491
618
  * Creates an instance of InvalidNumericalCriteria.
492
619
  *
493
620
  * @constructor
494
621
  * @param {EventActionValidationMeta} metadata
495
622
  */
496
- constructor(metadata: EventActionValidationMeta) {
623
+ constructor(
624
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
625
+ ) {
497
626
  super(
498
627
  'Numerical comparisons cannot be used with non-numerical criteria',
499
628
  metadata,
@@ -501,22 +630,51 @@ export class InvalidNumericalCriteriaError extends EventActionValidationError {
501
630
  }
502
631
  }
503
632
 
633
+ /**
634
+ * Thrown when decoding function data fails.
635
+ *
636
+ * @export
637
+ * @class FunctionDataDecodeError
638
+ * @typedef {FunctionDataDecodeError}
639
+ * @extends {Error}
640
+ */
641
+ export class FunctionDataDecodeError extends Error {
642
+ public abi: AbiFunction[];
643
+ public originalError: Error;
644
+
645
+ /**
646
+ * Creates an instance of FunctionDataDecodeError.
647
+ *
648
+ * @constructor
649
+ * @param {AbiFunction[]} abi - The ABI of the function.
650
+ * @param {Error} originalError - The original error that was thrown.
651
+ */
652
+ constructor(abi: AbiFunction[], originalError: Error) {
653
+ super(`Failed to decode function data: ${originalError.message}`);
654
+ this.name = 'FunctionDataDecodeError';
655
+ this.abi = abi;
656
+ this.originalError = originalError;
657
+ }
658
+ }
659
+
504
660
  /**
505
661
  * Thrown when an the log's field value is being compared a field type that isn't bytes or string during event action validation
506
662
  *
507
663
  * @export
508
664
  * @class FieldValueNotComparableError
509
665
  * @typedef {FieldValueNotComparableError}
510
- * @extends {EventActionValidationError}
666
+ * @extends {FieldActionValidationError}
511
667
  */
512
- export class FieldValueNotComparableError extends EventActionValidationError {
668
+ export class FieldValueNotComparableError extends FieldActionValidationError {
513
669
  /**
514
670
  * Creates an instance of FieldValueNotComparableError.
515
671
  *
516
672
  * @constructor
517
673
  * @param {EventActionValidationMeta} metadata
518
674
  */
519
- constructor(metadata: EventActionValidationMeta) {
675
+ constructor(
676
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
677
+ ) {
520
678
  super('Filter can only be used with bytes or string field type', metadata);
521
679
  }
522
680
  }
@@ -527,16 +685,182 @@ export class FieldValueNotComparableError extends EventActionValidationError {
527
685
  * @export
528
686
  * @class UnrecognizedFilterTypeError
529
687
  * @typedef {UnrecognizedFilterTypeError}
530
- * @extends {EventActionValidationError}
688
+ * @extends {FieldActionValidationError}
531
689
  */
532
- export class UnrecognizedFilterTypeError extends EventActionValidationError {
690
+ export class UnrecognizedFilterTypeError extends FieldActionValidationError {
533
691
  /**
534
692
  * Creates an instance of UnrecognizedFilterTypeError.
535
693
  *
536
694
  * @constructor
537
695
  * @param {EventActionValidationMeta} metadata
538
696
  */
539
- constructor(metadata: EventActionValidationMeta) {
697
+ constructor(
698
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
699
+ ) {
540
700
  super('Invalid FilterType provided', metadata);
541
701
  }
542
702
  }
703
+
704
+ /**
705
+ * Thrown when no chain ID is provided in the Wagmi configuration.
706
+ *
707
+ * @export
708
+ * @class NoConnectedChainIdError
709
+ * @typedef {NoConnectedChainIdError}
710
+ * @extends {Error}
711
+ */
712
+ export class NoConnectedChainIdError extends Error {
713
+ /**
714
+ * Creates an instance of NoConnectedChainIdError.
715
+ *
716
+ * @constructor
717
+ */
718
+ constructor() {
719
+ super(
720
+ 'Provided Wagmi configuration does not define `chainId` property with which to target protocol contracts',
721
+ );
722
+ this.name = 'NoConnectedChainIdError';
723
+ }
724
+ }
725
+
726
+ /**
727
+ * Thrown when an invalid chain ID is provided that doesn't match any deployed protocol.
728
+ *
729
+ * @export
730
+ * @class InvalidProtocolChainIdError
731
+ * @typedef {InvalidProtocolChainIdError}
732
+ * @extends {Error}
733
+ */
734
+ export class InvalidProtocolChainIdError extends Error {
735
+ /**
736
+ * Creates an instance of InvalidProtocolChainIdError.
737
+ *
738
+ * @constructor
739
+ * @param {number} chainId - The chain ID provided in the configuration.
740
+ * @param {number[]} validChainIds - A list of valid chain IDs where the protocol is deployed.
741
+ */
742
+ constructor(chainId: number, validChainIds: number[]) {
743
+ super(
744
+ `Provided Wagmi configuration supplied a "chainId" where protocol is not deployed, provided: ${chainId}, but valid chains are: ${validChainIds}`,
745
+ );
746
+ this.name = 'InvalidProtocolChainIdError';
747
+ }
748
+ }
749
+
750
+ /**
751
+ * Thrown when the incentive criteria cannot be fetched from the contract.
752
+ *
753
+ * @export
754
+ * @class IncentiveCriteriaNotFoundError
755
+ * @typedef {IncentiveCriteriaNotFoundError}
756
+ * @extends {Error}
757
+ */
758
+ export class IncentiveCriteriaNotFoundError extends Error {
759
+ /**
760
+ * Creates an instance of IncentiveCriteriaNotFoundError.
761
+ *
762
+ * @constructor
763
+ * @param {Error} [e] - Optional error object for further context.
764
+ * @param {string} [message='Unable to fetch Incentive Criteria from contract'] - Custom error message.
765
+ */
766
+ constructor(
767
+ e?: Error,
768
+ message = 'Unable to fetch Incentive Criteria from contract',
769
+ ) {
770
+ super(message + (e ? `: ${e.message}` : ''));
771
+ this.name = 'IncentiveCriteriaNotFoundError';
772
+ }
773
+ }
774
+
775
+ /**
776
+ * Thrown when no matching logs are found for a given event signature.
777
+ *
778
+ * @export
779
+ * @class NoMatchingLogsError
780
+ * @typedef {NoMatchingLogsError}
781
+ * @extends {Error}
782
+ */
783
+ export class NoMatchingLogsError extends Error {
784
+ /**
785
+ * Creates an instance of NoMatchingLogsError.
786
+ *
787
+ * @constructor
788
+ * @param {string} signature - The event signature for which logs are being searched.
789
+ * @param {string} [message] - Optional custom error message.
790
+ */
791
+ constructor(
792
+ signature: string,
793
+ message = `No logs found for event signature ${signature}`,
794
+ ) {
795
+ super(message);
796
+ this.name = 'NoMatchingLogsError';
797
+ }
798
+ }
799
+
800
+ /**
801
+ * Thrown when an invalid criteria type is provided.
802
+ *
803
+ * @export
804
+ * @class InvalidCriteriaTypeError
805
+ * @typedef {InvalidCriteriaTypeError}
806
+ * @extends {Error}
807
+ */
808
+ export class InvalidCriteriaTypeError extends Error {
809
+ /**
810
+ * Creates an instance of InvalidCriteriaTypeError.
811
+ *
812
+ * @constructor
813
+ * @param {string} [criteriaType='unknown'] - The invalid criteria type that was provided.
814
+ * @param {string} [message] - Optional custom error message.
815
+ */
816
+ constructor(
817
+ criteriaType = 'unknown',
818
+ message = `Invalid criteria type ${criteriaType}`,
819
+ ) {
820
+ super(message);
821
+ this.name = 'InvalidCriteriaTypeError';
822
+ }
823
+ }
824
+
825
+ /**
826
+ * Thrown when decoding function arguments fails.
827
+ *
828
+ * @export
829
+ * @class DecodedArgsError
830
+ * @typedef {DecodedArgsError}
831
+ * @extends {Error}
832
+ */
833
+ export class DecodedArgsError extends Error {
834
+ /**
835
+ * Creates an instance of DecodedArgsError.
836
+ *
837
+ * @constructor
838
+ * @param {string} [message='Issue decoding args'] - Custom error message.
839
+ */
840
+ constructor(message = 'Issue decoding args') {
841
+ super(message);
842
+ this.name = 'DecodedArgsError';
843
+ }
844
+ }
845
+
846
+ /**
847
+ * Thrown when reading a Boost that does not exist
848
+ *
849
+ * @export
850
+ * @class BoostNotFoundError
851
+ * @typedef {BoostNotFoundError}
852
+ * @extends {Error}
853
+ */
854
+ export class BoostNotFoundError extends Error {
855
+ public readonly id: string;
856
+ /**
857
+ * Creates an instance of BoostNotFoundError.
858
+ *
859
+ * @constructor
860
+ * @param {string} [id] - stringified boost id that does not exist
861
+ */
862
+ constructor(id: string) {
863
+ super(`Boost with not found with id: ${id}`);
864
+ this.id = id;
865
+ }
866
+ }
package/src/index.test.ts CHANGED
@@ -1,40 +1,122 @@
1
- import { describe, expect, test } from 'vitest';
2
- import * as SDK from './index';
1
+ import { describe, expect, test } from "vitest";
2
+ import * as SDK from "./index";
3
3
 
4
- describe('sdk exports', () => {
5
- test(`should export all public API`, () => {
6
- expect(SDK.BoostRegistry).toBeDefined();
7
- expect(SDK.BoostCore).toBeDefined();
8
- expect(SDK.Boost).toBeDefined();
9
-
10
- // interfaces
11
- expect(SDK.PassthroughAuth).toBeDefined();
12
- // expect(SDK.ContractAction).toBeDefined();
13
- // expect(SDK.ERC721MintAction).toBeDefined();
14
- expect(SDK.SimpleAllowList).toBeDefined();
15
- expect(SDK.SimpleDenyList).toBeDefined();
16
- expect(SDK.ManagedBudget).toBeDefined();
17
- // expect(SDK.SimpleBudget).toBeDefined();
18
- // expect(SDK.VestingBudget).toBeDefined();
19
- expect(SDK.AllowListIncentive).toBeDefined();
20
- expect(SDK.CGDAIncentive).toBeDefined();
21
- expect(SDK.ERC20Incentive).toBeDefined();
22
- // expect(SDK.ERC1155Incentive).toBeDefined();
23
- expect(SDK.PointsIncentive).toBeDefined();
24
- expect(SDK.SignerValidator).toBeDefined();
4
+ // Please add any public interface you'd like to verify exists on the root export here
5
+ // Types don't exist in .js so only list objects, constants, classes, etc, no interfaces
6
+ const allExports = [
7
+ "BoostRegistry",
8
+ "BoostCore",
9
+ "Boost",
10
+ "EventAction",
11
+ "OpenAllowList",
12
+ "SimpleAllowList",
13
+ "SimpleDenyList",
14
+ "ManagedBudget",
15
+ "Deployable",
16
+ "Contract",
17
+ "DeployableTarget",
18
+ "DeployableTargetWithRBAC",
19
+ "AllowListIncentive",
20
+ "CGDAIncentive",
21
+ "ERC20Incentive",
22
+ "ERC20VariableIncentive",
23
+ "ERC20VariableCriteriaIncentive",
24
+ "PointsIncentive",
25
+ "SignerValidator",
26
+ "BoostCoreNoIdentifierEmitted",
27
+ "ContractAddressRequiredError",
28
+ "DeployableAlreadyDeployedError",
29
+ "DeployableBuildParametersUnspecifiedError",
30
+ "DeployableUnknownOwnerProvidedError",
31
+ "DeployableWagmiConfigurationRequiredError",
32
+ "DeployableMissingPayloadError",
33
+ "NoContractAddressUponReceiptError",
34
+ "InvalidComponentInterfaceError",
35
+ "UnparseableAbiParamError",
36
+ "UnknownTransferPayloadSupplied",
37
+ "BudgetMustAuthorizeBoostCore",
38
+ "MustInitializeBudgetError",
39
+ "IncentiveNotCloneableError",
40
+ "NoEventActionStepsProvidedError",
41
+ "TooManyEventActionStepsProvidedError",
42
+ "ValidationAbiMissingError",
43
+ "FieldActionValidationError",
44
+ "DecodedArgsMalformedError",
45
+ "FieldValueUndefinedError",
46
+ "InvalidNumericalCriteriaError",
47
+ "FunctionDataDecodeError",
48
+ "FieldValueNotComparableError",
49
+ "UnrecognizedFilterTypeError",
50
+ "NoConnectedChainIdError",
51
+ "InvalidProtocolChainIdError",
52
+ "IncentiveCriteriaNotFoundError",
53
+ "NoMatchingLogsError",
54
+ "InvalidCriteriaTypeError",
55
+ "DecodedArgsError",
56
+ "PassthroughAuth",
57
+ "prepareBoostPayload",
58
+ "actionFromAddress",
59
+ "isEventActionPayloadSimple",
60
+ "prepareEventActionPayload",
61
+ "allowListFromAddress",
62
+ "prepareSimpleAllowListPayload",
63
+ "prepareSimpleDenyListPayload",
64
+ "budgetFromAddress",
65
+ "isFungibleTransfer",
66
+ "isERC1155TransferPayload",
67
+ "prepareTransfer",
68
+ "prepareManagedBudgetPayload",
69
+ "prepareAllowListIncentivePayload",
70
+ "prepareCGDAIncentivePayload",
71
+ "prepareERC20IncentivePayload",
72
+ "prepareERC20VariableIncentivePayload",
73
+ "prepareERC20VariableCriteriaIncentivePayload",
74
+ "incentiveFromAddress",
75
+ "preparePointsIncentivePayload",
76
+ "prepareSignerValidatorClaimDataPayload",
77
+ "prepareSignerValidatorInputParams",
78
+ "prepareSignerValidatorPayload",
79
+ "validatorFromAddress",
80
+ "bytes4",
81
+ "getDeployedContractAddress",
82
+ "awaitResult",
83
+ "assertValidAddressByChainId",
84
+ "prepareClaimPayload",
85
+ "prepareERC1155Payload",
86
+ "prepareERC1155Transfer",
87
+ "prepareFungiblePayload",
88
+ "prepareFungibleTransfer",
89
+ "prepareTransferPayload",
90
+ "BOOST_REGISTRY_ADDRESS",
91
+ "BOOST_REGISTRY_ADDRESSES",
92
+ "boostCoreAbi",
93
+ "boostRegistryAbi",
94
+ "BOOST_CORE_CLAIM_FEE",
95
+ "BOOST_CORE_ADDRESS",
96
+ "BOOST_CORE_ADDRESSES",
97
+ "ActionByComponentInterface",
98
+ "AllowListByComponentInterface",
99
+ "simpleAllowListAbi",
100
+ "LIST_MANAGER_ROLE",
101
+ "simpleDenyListAbi",
102
+ "BudgetByComponentInterface",
103
+ "managedBudgetAbi",
104
+ "rbacAbi",
105
+ "allowListIncentiveAbi",
106
+ "cgdaIncentiveAbi",
107
+ "erc20IncentiveAbi",
108
+ "erc20VariableIncentiveAbi",
109
+ "IncentiveByComponentInterface",
110
+ "pointsIncentiveAbi",
111
+ "signerValidatorAbi",
112
+ "ValidatorByComponentInterface",
113
+ "passthroughAuthAbi"
114
+ ]
25
115
 
26
- // errors
27
- expect(SDK.BoostCoreNoIdentifierEmitted).toBeDefined();
28
- expect(SDK.ContractAddressRequiredError).toBeDefined();
29
- expect(SDK.DeployableAlreadyDeployedError).toBeDefined();
30
- expect(SDK.DeployableBuildParametersUnspecifiedError).toBeDefined();
31
- expect(SDK.DeployableUnknownOwnerProvidedError).toBeDefined();
32
- expect(SDK.DeployableWagmiConfigurationRequiredError).toBeDefined();
33
- expect(SDK.DeployableMissingPayloadError).toBeDefined();
34
- expect(SDK.NoContractAddressUponReceiptError).toBeDefined();
35
- expect(SDK.InvalidComponentInterfaceError).toBeDefined();
36
- expect(SDK.UnknownTransferPayloadSupplied).toBeDefined();
37
- expect(SDK.BudgetMustAuthorizeBoostCore).toBeDefined();
38
- expect(SDK.IncentiveNotCloneableError).toBeDefined();
116
+ describe("SDK exports", () => {
117
+ test(`should export all public API`, () => {
118
+ for(let exp of allExports) {
119
+ expect((SDK as any)[exp]).toBeDefined()
120
+ }
39
121
  });
40
122
  });
package/src/index.ts CHANGED
@@ -1,13 +1,6 @@
1
1
  export * from './BoostRegistry';
2
2
  export * from './BoostCore';
3
3
  export * from './Boost';
4
- export * from './errors';
5
- export * from './utils';
6
-
7
- // Auth
8
-
9
- export * from './Auth/Auth';
10
- export * from './Auth/PassthroughAuth';
11
4
 
12
5
  // Actions
13
6
 
@@ -34,12 +27,15 @@ export * from './Budgets/ManagedBudget';
34
27
  export * from './Deployable/Deployable';
35
28
  export * from './Deployable/Contract';
36
29
  export * from './Deployable/DeployableTarget';
30
+ export * from './Deployable/DeployableTargetWithRBAC';
37
31
 
38
32
  // Incentives
39
33
 
40
34
  export * from './Incentives/AllowListIncentive';
41
35
  export * from './Incentives/CGDAIncentive';
42
36
  export * from './Incentives/ERC20Incentive';
37
+ export * from './Incentives/ERC20VariableIncentive';
38
+ export * from './Incentives/ERC20VariableCriteriaIncentive';
43
39
  // export * from './Incentives/ERC1155Incentive';
44
40
  export * from './Incentives/Incentive';
45
41
  export * from './Incentives/PointsIncentive';
@@ -48,3 +44,15 @@ export * from './Incentives/PointsIncentive';
48
44
 
49
45
  export * from './Validators/SignerValidator';
50
46
  export * from './Validators/Validator';
47
+
48
+ // Extra
49
+
50
+ export * from './errors';
51
+ export * from './utils';
52
+ export * from './claiming';
53
+ export * from './transfers';
54
+
55
+ // Auth
56
+
57
+ export * from './Auth/Auth';
58
+ export * from './Auth/PassthroughAuth';