@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
@@ -18,6 +18,7 @@ import {
18
18
  encodeAbiParameters,
19
19
  } from 'viem';
20
20
  import { signTypedData } from 'viem/accounts';
21
+ import { SignerValidator as SignerValidatorBases } from '../../dist/deployments.json';
21
22
  import type {
22
23
  DeployableOptions,
23
24
  GenericDeployableParams,
@@ -306,10 +307,11 @@ export class SignerValidator extends DeployableTarget<
306
307
  *
307
308
  * @public
308
309
  * @static
309
- * @type {Address}
310
+ * @type {Record<number, Address>}
310
311
  */
311
- public static override base: Address = import.meta.env
312
- .VITE_SIGNER_VALIDATOR_BASE;
312
+ public static override bases: Record<number, Address> = {
313
+ ...(SignerValidatorBases as Record<number, Address>),
314
+ };
313
315
  /**
314
316
  * @inheritdoc
315
317
  *
@@ -325,8 +327,8 @@ export class SignerValidator extends DeployableTarget<
325
327
  * @public
326
328
  * @async
327
329
  * @param {Address} address
328
- * @param {?ReadParams<typeof signerValidatorAbi, 'signers'>} [params]
329
- * @returns {unknown}
330
+ * @param {?ReadParams} [params]
331
+ * @returns {Promise<boolean>}
330
332
  */
331
333
  public async signers(
332
334
  address: Address,
@@ -346,8 +348,8 @@ export class SignerValidator extends DeployableTarget<
346
348
  * @public
347
349
  * @async
348
350
  * @param {SignerValidatorSignaturePayload} payload
349
- * @param {?ReadParams<typeof signerValidatorAbi, 'hashSignerData'>} [params]
350
- * @returns {unknown}
351
+ * @param {?ReadParams} [params]
352
+ * @returns {Promise<Hex>}
351
353
  */
352
354
  public async hashSignerData(
353
355
  payload: SignerValidatorSignaturePayload,
@@ -372,7 +374,7 @@ export class SignerValidator extends DeployableTarget<
372
374
  * @public
373
375
  * @async
374
376
  * @param {SignerValidatorValidatePayload} payload
375
- * @param {?WriteParams<typeof signerValidatorAbi, 'validate'>} [params]
377
+ * @param {?WriteParams} [params]
376
378
  * @returns {Promise<boolean>} - True if the action has been validated based on the data payload
377
379
  */
378
380
  protected async validate(
@@ -388,7 +390,7 @@ export class SignerValidator extends DeployableTarget<
388
390
  * @public
389
391
  * @async
390
392
  * @param {SignerValidatorValidatePayload} payload
391
- * @param {?WriteParams<typeof signerValidatorAbi, 'validate'>} [params]
393
+ * @param {?WriteParams} [params]
392
394
  * @returns {Promise<boolean>} - True if the action has been validated based on the data payload
393
395
  */
394
396
  protected async validateRaw(
@@ -421,8 +423,8 @@ export class SignerValidator extends DeployableTarget<
421
423
  * @async
422
424
  * @param {Address[]} addresses - The list of signers to update
423
425
  * @param {boolean[]} allowed - The authorized status of each signer
424
- * @param {?WriteParams<typeof signerValidatorAbi, 'setAuthorized'>} [params]
425
- * @returns {unknown}
426
+ * @param {?WriteParams} [params]
427
+ * @returns {Promise<void>}
426
428
  */
427
429
  public async setAuthorized(
428
430
  addresses: Address[],
@@ -441,8 +443,8 @@ export class SignerValidator extends DeployableTarget<
441
443
  * @async
442
444
  * @param {Address[]} addresses - The list of signers to update
443
445
  * @param {boolean[]} allowed - The authorized status of each signer
444
- * @param {?WriteParams<typeof signerValidatorAbi, 'setAuthorized'>} [params]
445
- * @returns {unknown}
446
+ * @param {?WriteParams} [params]
447
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
446
448
  */
447
449
  public async setAuthorizedRaw(
448
450
  addresses: Address[],
@@ -469,8 +471,8 @@ export class SignerValidator extends DeployableTarget<
469
471
  * @public
470
472
  * @async
471
473
  * @param {Address} address
472
- * @param {?WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>} [params]
473
- * @returns {unknown}
474
+ * @param {?WriteParams} [params]
475
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
474
476
  */
475
477
  public async setValidatorCallerRaw(
476
478
  address: Address,
@@ -499,8 +501,8 @@ export class SignerValidator extends DeployableTarget<
499
501
  * @public
500
502
  * @async
501
503
  * @param {Address} address
502
- * @param {?WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>} [params]
503
- * @returns {unknown}
504
+ * @param {?WriteParams} [params]
505
+ * @returns {Promise<void>}
504
506
  */
505
507
  public async setValidatorCaller(
506
508
  address: Address,
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test } from 'vitest';
2
- import { defaultOptions } from '../../test/helpers';
3
- import { testAccount } from '../../test/viem';
2
+ import { defaultOptions } from '@boostxyz/test/helpers';
3
+ import { testAccount } from '@boostxyz/test/viem';
4
4
  import { SignerValidator } from './SignerValidator';
5
5
  import { validatorFromAddress } from './Validator';
6
6
 
@@ -32,7 +32,7 @@ export const ValidatorByComponentInterface = {
32
32
  * @async
33
33
  * @param {DeployableOptions} options
34
34
  * @param {Address} address
35
- * @returns {unknown}
35
+ * @returns {Promise<Validator>}
36
36
  * @throws {@link InvalidComponentInterfaceError}
37
37
  */
38
38
  export async function validatorFromAddress(
package/src/claiming.ts CHANGED
@@ -40,7 +40,7 @@ export interface ClaimPayload {
40
40
  * @param {ClaimPayload} param0
41
41
  * @param {Address} param0.target - The address of the recipient
42
42
  * @param {Hex} [param0.data=zeroHash] - The implementation-specific data for the claim, if needed
43
- * @returns {*}
43
+ * @returns {Hex}
44
44
  */
45
45
  export const prepareClaimPayload = ({
46
46
  target,
package/src/errors.ts CHANGED
@@ -1,10 +1,13 @@
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';
7
9
  import type { Criteria } from './Actions/EventAction';
10
+ import type { EventLogs } from './Actions/EventAction';
8
11
  import type { BoostRegistry } from './BoostRegistry';
9
12
  import type { Incentive } from './Incentives/Incentive';
10
13
 
@@ -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
+ }