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

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 (203) 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 +13 -13
  4. package/dist/Actions/ContractAction.d.ts +9 -9
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +12 -12
  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 +32 -49
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +13 -962
  13. package/dist/Actions/EventAction.js.map +1 -1
  14. package/dist/AllowLists/AllowList.cjs +1 -1
  15. package/dist/AllowLists/AllowList.js +3 -3
  16. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  17. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  18. package/dist/AllowLists/SimpleAllowList.d.ts +5 -5
  19. package/dist/AllowLists/SimpleAllowList.js +24 -24
  20. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  21. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  22. package/dist/AllowLists/SimpleDenyList.d.ts +6 -6
  23. package/dist/AllowLists/SimpleDenyList.js +3 -3
  24. package/dist/Auth/PassthroughAuth.cjs +1 -1
  25. package/dist/Auth/PassthroughAuth.js +1 -1
  26. package/dist/Boost.cjs.map +1 -1
  27. package/dist/Boost.d.ts +18 -0
  28. package/dist/Boost.d.ts.map +1 -1
  29. package/dist/Boost.js.map +1 -1
  30. package/dist/BoostCore-BiPwp6SR.cjs +3 -0
  31. package/dist/BoostCore-BiPwp6SR.cjs.map +1 -0
  32. package/dist/BoostCore-C00iqvks.js +1477 -0
  33. package/dist/BoostCore-C00iqvks.js.map +1 -0
  34. package/dist/BoostCore.cjs +1 -2
  35. package/dist/BoostCore.cjs.map +1 -1
  36. package/dist/BoostCore.d.ts +80 -35
  37. package/dist/BoostCore.d.ts.map +1 -1
  38. package/dist/BoostCore.js +29 -1273
  39. package/dist/BoostCore.js.map +1 -1
  40. package/dist/BoostRegistry.cjs +1 -1
  41. package/dist/BoostRegistry.cjs.map +1 -1
  42. package/dist/BoostRegistry.d.ts +18 -18
  43. package/dist/BoostRegistry.js +28 -28
  44. package/dist/BoostRegistry.js.map +1 -1
  45. package/dist/Budgets/Budget.cjs +1 -1
  46. package/dist/Budgets/Budget.js +2 -2
  47. package/dist/Budgets/ManagedBudget.cjs +1 -1
  48. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  49. package/dist/Budgets/ManagedBudget.d.ts +18 -18
  50. package/dist/Budgets/ManagedBudget.js +48 -48
  51. package/dist/Budgets/ManagedBudget.js.map +1 -1
  52. package/dist/Budgets/VestingBudget.d.ts +23 -23
  53. package/dist/Deployable/Contract.cjs +1 -1
  54. package/dist/Deployable/Contract.cjs.map +1 -1
  55. package/dist/Deployable/Contract.d.ts +4 -5
  56. package/dist/Deployable/Contract.d.ts.map +1 -1
  57. package/dist/Deployable/Contract.js +4 -5
  58. package/dist/Deployable/Contract.js.map +1 -1
  59. package/dist/Deployable/Deployable.cjs.map +1 -1
  60. package/dist/Deployable/Deployable.d.ts +1 -1
  61. package/dist/Deployable/Deployable.js +1 -1
  62. package/dist/Deployable/Deployable.js.map +1 -1
  63. package/dist/Deployable/DeployableTarget.cjs +1 -1
  64. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  65. package/dist/Deployable/DeployableTarget.d.ts +5 -5
  66. package/dist/Deployable/DeployableTarget.js +10 -10
  67. package/dist/Deployable/DeployableTarget.js.map +1 -1
  68. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  69. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -1
  70. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +15 -15
  71. package/dist/Deployable/DeployableTargetWithRBAC.js +32 -32
  72. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -1
  73. package/dist/EventAction-BO5WI_5s.js +1355 -0
  74. package/dist/EventAction-BO5WI_5s.js.map +1 -0
  75. package/dist/EventAction-DBDRaG4A.cjs +2 -0
  76. package/dist/EventAction-DBDRaG4A.cjs.map +1 -0
  77. package/dist/{Incentive-DJf-vdyL.js → Incentive-CF7kaz_9.js} +61 -62
  78. package/dist/Incentive-CF7kaz_9.js.map +1 -0
  79. package/dist/{Incentive-DNwROd1r.cjs → Incentive-Djnzseoj.cjs} +2 -2
  80. package/dist/Incentive-Djnzseoj.cjs.map +1 -0
  81. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  82. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  83. package/dist/Incentives/AllowListIncentive.d.ts +12 -12
  84. package/dist/Incentives/AllowListIncentive.js +19 -19
  85. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  86. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  87. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  88. package/dist/Incentives/CGDAIncentive.d.ts +15 -15
  89. package/dist/Incentives/CGDAIncentive.js +18 -18
  90. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  91. package/dist/Incentives/ERC1155Incentive.d.ts +30 -30
  92. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  93. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  94. package/dist/Incentives/ERC20Incentive.d.ts +23 -23
  95. package/dist/Incentives/ERC20Incentive.js +25 -25
  96. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  97. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +523 -0
  98. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  99. package/dist/Incentives/ERC20VariableIncentive.d.ts +19 -19
  100. package/dist/Incentives/Incentive.cjs +1 -1
  101. package/dist/Incentives/Incentive.d.ts +3 -3
  102. package/dist/Incentives/Incentive.d.ts.map +1 -1
  103. package/dist/Incentives/Incentive.js +3 -3
  104. package/dist/Incentives/PointsIncentive.cjs +1 -1
  105. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  106. package/dist/Incentives/PointsIncentive.d.ts +14 -14
  107. package/dist/Incentives/PointsIncentive.js +21 -21
  108. package/dist/Incentives/PointsIncentive.js.map +1 -1
  109. package/dist/{SimpleDenyList-DMlUkmAn.cjs → SimpleDenyList-BwfNjRsg.cjs} +2 -2
  110. package/dist/SimpleDenyList-BwfNjRsg.cjs.map +1 -0
  111. package/dist/{SimpleDenyList-DvUvmOeE.js → SimpleDenyList-D9i4rw_F.js} +9 -9
  112. package/dist/SimpleDenyList-D9i4rw_F.js.map +1 -0
  113. package/dist/Validators/SignerValidator.cjs +1 -1
  114. package/dist/Validators/SignerValidator.cjs.map +1 -1
  115. package/dist/Validators/SignerValidator.d.ts +14 -14
  116. package/dist/Validators/SignerValidator.js +19 -19
  117. package/dist/Validators/SignerValidator.js.map +1 -1
  118. package/dist/Validators/Validator.cjs +1 -1
  119. package/dist/Validators/Validator.cjs.map +1 -1
  120. package/dist/Validators/Validator.d.ts +1 -1
  121. package/dist/Validators/Validator.js +6 -6
  122. package/dist/Validators/Validator.js.map +1 -1
  123. package/dist/claiming.cjs.map +1 -1
  124. package/dist/claiming.d.ts +1 -1
  125. package/dist/claiming.js.map +1 -1
  126. package/dist/componentInterfaces-D09mhzxO.cjs +2 -0
  127. package/dist/componentInterfaces-D09mhzxO.cjs.map +1 -0
  128. package/dist/componentInterfaces-RXBMI5yH.js +14 -0
  129. package/dist/componentInterfaces-RXBMI5yH.js.map +1 -0
  130. package/dist/deployments-BM42vImE.js +43 -0
  131. package/dist/deployments-BM42vImE.js.map +1 -0
  132. package/dist/deployments-CMdF5uEC.cjs +2 -0
  133. package/dist/deployments-CMdF5uEC.cjs.map +1 -0
  134. package/dist/deployments.json +15 -12
  135. package/dist/errors.cjs +1 -1
  136. package/dist/errors.cjs.map +1 -1
  137. package/dist/errors.d.ts +132 -0
  138. package/dist/errors.d.ts.map +1 -1
  139. package/dist/errors.js +122 -36
  140. package/dist/errors.js.map +1 -1
  141. package/dist/generated-B0tk-c9b.cjs +3 -0
  142. package/dist/generated-B0tk-c9b.cjs.map +1 -0
  143. package/dist/{generated-C_7Jx3YG.js → generated-B8VWObPa.js} +631 -343
  144. package/dist/generated-B8VWObPa.js.map +1 -0
  145. package/dist/index.cjs +1 -1
  146. package/dist/index.d.ts +1 -0
  147. package/dist/index.d.ts.map +1 -1
  148. package/dist/index.js +133 -125
  149. package/dist/transfers.cjs.map +1 -1
  150. package/dist/transfers.d.ts +1 -1
  151. package/dist/transfers.js.map +1 -1
  152. package/dist/utils.cjs.map +1 -1
  153. package/dist/utils.d.ts +1 -1
  154. package/dist/utils.js.map +1 -1
  155. package/package.json +5 -5
  156. package/src/Actions/ContractAction.ts +9 -10
  157. package/src/Actions/ERC721MintAction.ts +12 -13
  158. package/src/Actions/EventAction.test.ts +45 -54
  159. package/src/Actions/EventAction.ts +100 -100
  160. package/src/AllowLists/SimpleAllowList.ts +5 -5
  161. package/src/AllowLists/SimpleDenyList.ts +6 -6
  162. package/src/Boost.ts +19 -0
  163. package/src/BoostCore.test.ts +117 -1
  164. package/src/BoostCore.ts +113 -54
  165. package/src/BoostRegistry.ts +18 -18
  166. package/src/Budgets/ManagedBudget.ts +18 -18
  167. package/src/Budgets/VestingBudget.ts +23 -23
  168. package/src/Deployable/Contract.ts +4 -5
  169. package/src/Deployable/Deployable.ts +1 -1
  170. package/src/Deployable/DeployableTarget.ts +5 -5
  171. package/src/Deployable/DeployableTargetWithRBAC.ts +15 -15
  172. package/src/Incentives/AllowListIncentive.ts +12 -12
  173. package/src/Incentives/CGDAIncentive.ts +15 -15
  174. package/src/Incentives/ERC1155Incentive.ts +26 -26
  175. package/src/Incentives/ERC20Incentive.ts +23 -23
  176. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  177. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
  178. package/src/Incentives/ERC20VariableIncentive.ts +19 -19
  179. package/src/Incentives/Incentive.ts +6 -5
  180. package/src/Incentives/PointsIncentive.test.ts +21 -21
  181. package/src/Incentives/PointsIncentive.ts +14 -14
  182. package/src/Validators/SignerValidator.ts +14 -14
  183. package/src/Validators/Validator.ts +1 -1
  184. package/src/claiming.ts +1 -1
  185. package/src/errors.ts +165 -0
  186. package/src/index.ts +1 -0
  187. package/src/transfers.ts +1 -1
  188. package/src/utils.ts +1 -1
  189. package/dist/Incentive-DJf-vdyL.js.map +0 -1
  190. package/dist/Incentive-DNwROd1r.cjs.map +0 -1
  191. package/dist/SimpleDenyList-DMlUkmAn.cjs.map +0 -1
  192. package/dist/SimpleDenyList-DvUvmOeE.js.map +0 -1
  193. package/dist/componentInterfaces-BPVR_Ykd.js +0 -13
  194. package/dist/componentInterfaces-BPVR_Ykd.js.map +0 -1
  195. package/dist/componentInterfaces-BfppSIl4.cjs +0 -2
  196. package/dist/componentInterfaces-BfppSIl4.cjs.map +0 -1
  197. package/dist/deployments-BvFcK_eR.js +0 -40
  198. package/dist/deployments-BvFcK_eR.js.map +0 -1
  199. package/dist/deployments-Ho4PnGCS.cjs +0 -2
  200. package/dist/deployments-Ho4PnGCS.cjs.map +0 -1
  201. package/dist/generated-CMQ6ZC2_.cjs +0 -3
  202. package/dist/generated-CMQ6ZC2_.cjs.map +0 -1
  203. package/dist/generated-C_7Jx3YG.js.map +0 -1
@@ -116,8 +116,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
116
116
  *
117
117
  * @public
118
118
  * @async
119
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>} [params]
120
- * @returns {unknown}
119
+ * @param {?ReadParams} [params]
120
+ * @returns {Promise<Address>}
121
121
  */
122
122
  public async owner(
123
123
  params?: ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>,
@@ -135,7 +135,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
135
135
  *
136
136
  * @public
137
137
  * @async
138
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'totalClaimed'>} [params]
138
+ * @param {?ReadParams} [params]
139
139
  * @returns {Promise<bigint>}
140
140
  */
141
141
  public async totalClaimed(
@@ -154,7 +154,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
154
154
  *
155
155
  * @public
156
156
  * @async
157
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]
157
+ * @param {?ReadParams} [params]
158
158
  * @returns {Promise<bigint>} - The current reward
159
159
  */
160
160
  public async currentReward(
@@ -173,7 +173,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
173
173
  *
174
174
  * @public
175
175
  * @async
176
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'claims'>} [params]
176
+ * @param {?ReadParams} [params]
177
177
  * @returns {Promise<bigint>}
178
178
  */
179
179
  public async claims(
@@ -193,7 +193,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
193
193
  * @public
194
194
  * @async
195
195
  * @param {Address} address
196
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'claimed'>} [params]
196
+ * @param {?ReadParams} [params]
197
197
  * @returns {Promise<boolean>}
198
198
  */
199
199
  public async claimed(
@@ -213,7 +213,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
213
213
  *
214
214
  * @public
215
215
  * @async
216
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'asset'>} [params]
216
+ * @param {?ReadParams} [params]
217
217
  * @returns {Promise<Address>}
218
218
  */
219
219
  public async asset(
@@ -231,7 +231,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
231
231
  *
232
232
  * @public
233
233
  * @async
234
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'reward'>} [params]
234
+ * @param {?ReadParams} [params]
235
235
  * @returns {Promise<bigint>}
236
236
  */
237
237
  public async reward(
@@ -249,8 +249,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
249
249
  *
250
250
  * @public
251
251
  * @async
252
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>} [params]
253
- * @returns {unknown}
252
+ * @param {?ReadParams} [params]
253
+ * @returns {Promise<bigint>}
254
254
  */
255
255
  public async limit(
256
256
  params?: ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>,
@@ -268,7 +268,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
268
268
  * @public
269
269
  * @async
270
270
  * @param {ClaimPayload} payload
271
- * @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>} [params]
271
+ * @param {?WriteParams} [params]
272
272
  * @returns {Promise<boolean>} - Returns true if successfully claimed
273
273
  */
274
274
  protected async claim(
@@ -284,8 +284,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
284
284
  * @public
285
285
  * @async
286
286
  * @param {ClaimPayload} payload
287
- * @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>} [params]
288
- * @returns {Promise<boolean>} - Returns true if successfully claimed
287
+ * @param {?WriteParams} [params]
288
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed
289
289
  */
290
290
  protected async claimRaw(
291
291
  payload: ClaimPayload,
@@ -311,7 +311,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
311
311
  * @public
312
312
  * @async
313
313
  * @param {ClaimPayload} payload
314
- * @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]
314
+ * @param {?WriteParams} [params]
315
315
  * @returns {Promise<boolean>} - True if the assets were successfully clawbacked
316
316
  */
317
317
  public async clawback(
@@ -327,8 +327,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
327
327
  * @public
328
328
  * @async
329
329
  * @param {ClaimPayload} payload
330
- * @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]
331
- * @returns {Promise<boolean>} - True if the assets were successfully clawbacked
330
+ * @param {?WriteParams} [params]
331
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked
332
332
  */
333
333
  public async clawbackRaw(
334
334
  payload: ClaimPayload,
@@ -357,8 +357,8 @@ export class ERC20VariableIncentive extends DeployableTarget<
357
357
  * @public
358
358
  * @async
359
359
  * @param {ClaimPayload} payload
360
- * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'isClaimable'>} [params]
361
- * @returns {unknown} = True if the incentive is claimable based on the data payload
360
+ * @param {?ReadParams} [params]
361
+ * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload
362
362
  */
363
363
  public async isClaimable(
364
364
  payload: ClaimPayload,
@@ -404,7 +404,7 @@ export class ERC20VariableIncentive extends DeployableTarget<
404
404
  * @param {Address} param0.asset - The address of the incentivized asset.
405
405
  * @param {bigint} param0.reward - The amount of the asset to distribute.
406
406
  * @param {bigint} param0.limit - How many times can this incentive be claimed.
407
- * @returns {*}
407
+ * @returns {Hex}
408
408
  */
409
409
  export function prepareERC20VariableIncentivePayload({
410
410
  asset,
@@ -13,6 +13,7 @@ import { InvalidComponentInterfaceError } from '../errors';
13
13
  import { AllowListIncentive } from './AllowListIncentive';
14
14
  import { CGDAIncentive } from './CGDAIncentive';
15
15
  import { ERC20Incentive } from './ERC20Incentive';
16
+ import type { ERC20VariableCriteriaIncentive } from './ERC20VariableCriteriaIncentive';
16
17
  import { ERC20VariableIncentive } from './ERC20VariableIncentive';
17
18
  // import { ERC1155Incentive } from './ERC1155Incentive';
18
19
  import { PointsIncentive } from './PointsIncentive';
@@ -38,7 +39,8 @@ export type Incentive =
38
39
  | ERC20Incentive
39
40
  // | ERC1155Incentive
40
41
  | PointsIncentive
41
- | ERC20VariableIncentive;
42
+ | ERC20VariableIncentive
43
+ | ERC20VariableCriteriaIncentive;
42
44
 
43
45
  /**
44
46
  * A map of Incentive component interfaces to their constructors.
@@ -48,9 +50,8 @@ export type Incentive =
48
50
  export const IncentiveByComponentInterface = {
49
51
  [APointsIncentive as Hex]: PointsIncentive,
50
52
  [AERC20Incentive as Hex]: ERC20Incentive,
51
- // TODO: figure out why evm generates bad bytes4 here
52
- ['0x0a466e6f']: AllowListIncentive,
53
- // [APointsIncentive as Hex]: ERC1155Incentive,
53
+ [AAllowListIncentive]: AllowListIncentive,
54
+ // [AERC1155Incentive as Hex]: ERC1155Incentive,
54
55
  [ACGDAIncentive as Hex]: CGDAIncentive,
55
56
  [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,
56
57
  };
@@ -62,7 +63,7 @@ export const IncentiveByComponentInterface = {
62
63
  * @async
63
64
  * @param {DeployableOptions} options
64
65
  * @param {Address} address
65
- * @returns {unknown}
66
+ * @returns {Incentive}
66
67
  * @throws {@link InvalidComponentInterfaceError}
67
68
  */
68
69
  export async function incentiveFromAddress(
@@ -1,22 +1,22 @@
1
- import { readPointsBalanceOf, writePointsGrantRoles } from '@boostxyz/evm';
2
- import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
3
- import { isAddress, pad, parseEther, zeroAddress } from 'viem';
4
- import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
5
- import type { MockPoints } from '@boostxyz/test/MockPoints';
6
- import { accounts } from '@boostxyz/test/accounts';
1
+ import { readPointsBalanceOf, writePointsGrantRoles } from "@boostxyz/evm";
2
+ import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
3
+ import { isAddress, pad, parseEther, zeroAddress } from "viem";
4
+ import { beforeAll, beforeEach, describe, expect, test } from "vitest";
5
+ import type { MockPoints } from "@boostxyz/test/MockPoints";
6
+ import { accounts } from "@boostxyz/test/accounts";
7
7
  import {
8
8
  type Fixtures,
9
9
  defaultOptions,
10
10
  deployFixtures,
11
11
  freshBoost,
12
12
  freshPoints,
13
- } from '@boostxyz/test/helpers';
14
- import { bytes4 } from '../utils';
15
- import { PointsIncentive } from './PointsIncentive';
13
+ } from "@boostxyz/test/helpers";
14
+ import { bytes4 } from "../utils";
15
+ import { PointsIncentive } from "./PointsIncentive";
16
16
 
17
17
  let fixtures: Fixtures, points: MockPoints;
18
18
 
19
- describe('PointsIncentive', () => {
19
+ describe("PointsIncentive", () => {
20
20
  beforeAll(async () => {
21
21
  fixtures = await loadFixture(deployFixtures(defaultOptions));
22
22
  });
@@ -25,10 +25,10 @@ describe('PointsIncentive', () => {
25
25
  points = await loadFixture(freshPoints);
26
26
  });
27
27
 
28
- test('can successfully be deployed', async () => {
28
+ test("can successfully be deployed", async () => {
29
29
  const action = new PointsIncentive(defaultOptions, {
30
30
  venue: zeroAddress,
31
- selector: '0xdeadb33f',
31
+ selector: "0xdeadb33f",
32
32
  reward: 1n,
33
33
  limit: 1n,
34
34
  });
@@ -36,14 +36,14 @@ describe('PointsIncentive', () => {
36
36
  expect(isAddress(action.assertValidAddress())).toBe(true);
37
37
  });
38
38
 
39
- test('can claim', async () => {
39
+ test("can claim", async () => {
40
40
  // biome-ignore lint/style/noNonNullAssertion: we know this is defined
41
41
  const referrer = accounts.at(1)!.account!;
42
42
  // biome-ignore lint/style/noNonNullAssertion: we know this is defined
43
43
  const trustedSigner = accounts.at(0)!;
44
44
  const pointsIncentive = fixtures.core.PointsIncentive({
45
45
  venue: points.assertValidAddress(),
46
- selector: bytes4('issue(address,uint256)'),
46
+ selector: bytes4("issue(address,uint256)"),
47
47
  reward: 1n,
48
48
  limit: 10n,
49
49
  });
@@ -52,7 +52,7 @@ describe('PointsIncentive', () => {
52
52
  });
53
53
 
54
54
  const claimant = trustedSigner.account;
55
- const incentiveData = pad('0xdef456232173821931823712381232131391321934');
55
+ const incentiveData = pad("0xdef456232173821931823712381232131391321934");
56
56
  const incentiveQuantity = 1;
57
57
  const claimDataPayload = await boost.validator.encodeClaimData({
58
58
  signer: trustedSigner,
@@ -73,7 +73,7 @@ describe('PointsIncentive', () => {
73
73
  0n,
74
74
  referrer,
75
75
  claimDataPayload,
76
- { value: parseEther('0.000075') },
76
+ { value: parseEther("0.000075") },
77
77
  );
78
78
  expect(
79
79
  await readPointsBalanceOf(defaultOptions.config, {
@@ -83,7 +83,7 @@ describe('PointsIncentive', () => {
83
83
  ).toBe(1n);
84
84
  });
85
85
 
86
- test('cannot claim twice', async () => {
86
+ test("cannot claim twice", async () => {
87
87
  const reward = 1n;
88
88
  // biome-ignore lint/style/noNonNullAssertion: we know this is defined
89
89
  const referrer = accounts.at(1)!.account!;
@@ -92,7 +92,7 @@ describe('PointsIncentive', () => {
92
92
 
93
93
  const pointsIncentive = fixtures.core.PointsIncentive({
94
94
  venue: points.assertValidAddress(),
95
- selector: bytes4('issue(address,uint256)'),
95
+ selector: bytes4("issue(address,uint256)"),
96
96
  reward,
97
97
  limit: 10n,
98
98
  });
@@ -101,7 +101,7 @@ describe('PointsIncentive', () => {
101
101
  });
102
102
 
103
103
  const claimant = trustedSigner.account;
104
- const incentiveData = pad('0xdef456232173821931823712381232131391321934');
104
+ const incentiveData = pad("0xdef456232173821931823712381232131391321934");
105
105
  const incentiveQuantity = 1;
106
106
  const claimDataPayload = await boost.validator.encodeClaimData({
107
107
  signer: trustedSigner,
@@ -122,7 +122,7 @@ describe('PointsIncentive', () => {
122
122
  0n,
123
123
  referrer,
124
124
  claimDataPayload,
125
- { value: parseEther('0.000075') },
125
+ { value: parseEther("0.000075") },
126
126
  );
127
127
  try {
128
128
  await fixtures.core.claimIncentive(
@@ -130,7 +130,7 @@ describe('PointsIncentive', () => {
130
130
  0n,
131
131
  referrer,
132
132
  claimDataPayload,
133
- { value: parseEther('0.000075') },
133
+ { value: parseEther("0.000075") },
134
134
  );
135
135
  } catch (e) {
136
136
  expect(e).toBeInstanceOf(Error);
@@ -125,7 +125,7 @@ export class PointsIncentive extends DeployableTarget<
125
125
  *
126
126
  * @public
127
127
  * @async
128
- * @param {?ReadParams<typeof erc20IncentiveAbi, 'claims'>} [params]
128
+ * @param {?ReadParams} [params]
129
129
  * @returns {Promise<bigint>}
130
130
  */
131
131
  public async claims(
@@ -144,7 +144,7 @@ export class PointsIncentive extends DeployableTarget<
144
144
  *
145
145
  * @public
146
146
  * @async
147
- * @param {?ReadParams<typeof erc20IncentiveAbi, 'currentReward'>} [params]
147
+ * @param {?ReadParams} [params]
148
148
  * @returns {Promise<bigint>} - The current reward
149
149
  */
150
150
  public async currentReward(
@@ -163,8 +163,8 @@ export class PointsIncentive extends DeployableTarget<
163
163
  *
164
164
  * @public
165
165
  * @async
166
- * @param {?ReadParams<typeof pointsIncentiveAbi, 'reward'>} [params]
167
- * @returns {unknown}
166
+ * @param {?ReadParams} [params]
167
+ * @returns {Promise<bigint>} The reward amount issued for each claim
168
168
  */
169
169
  public async reward(
170
170
  params?: ReadParams<typeof pointsIncentiveAbi, 'reward'>,
@@ -183,8 +183,8 @@ export class PointsIncentive extends DeployableTarget<
183
183
  * @public
184
184
  * @async
185
185
  * @param {Address} address
186
- * @param {?ReadParams<typeof pointsIncentiveAbi, 'claimed'>} [params]
187
- * @returns {unknown}
186
+ * @param {?ReadParams} [params]
187
+ * @returns {Promise<boolean>}
188
188
  */
189
189
  public async claimed(
190
190
  address: Address,
@@ -203,8 +203,8 @@ export class PointsIncentive extends DeployableTarget<
203
203
  *
204
204
  * @public
205
205
  * @async
206
- * @param {?ReadParams<typeof pointsIncentiveAbi, 'venue'>} [params]
207
- * @returns {unknown}
206
+ * @param {?ReadParams} [params]
207
+ * @returns {Promise<Address>}
208
208
  */
209
209
  public async venue(params?: ReadParams<typeof pointsIncentiveAbi, 'venue'>) {
210
210
  return await readPointsIncentiveVenue(this._config, {
@@ -219,7 +219,7 @@ export class PointsIncentive extends DeployableTarget<
219
219
  *
220
220
  * @public
221
221
  * @async
222
- * @param {?ReadParams<typeof pointsIncentiveAbi, 'limit'>} [params]
222
+ * @param {?ReadParams} [params]
223
223
  * @returns {Promise<bigint>}
224
224
  */
225
225
  public async limit(params?: ReadParams<typeof pointsIncentiveAbi, 'limit'>) {
@@ -235,7 +235,7 @@ export class PointsIncentive extends DeployableTarget<
235
235
  *
236
236
  * @public
237
237
  * @async
238
- * @param {?ReadParams<typeof pointsIncentiveAbi, 'selector'>} [params]
238
+ * @param {?ReadParams} [params]
239
239
  * @returns {Promise<Hex>}
240
240
  */
241
241
  public async selector(
@@ -254,7 +254,7 @@ export class PointsIncentive extends DeployableTarget<
254
254
  * @public
255
255
  * @async
256
256
  * @param {ClaimPayload} payload
257
- * @param {?WriteParams<typeof pointsIncentiveAbi, 'claim'>} [params]
257
+ * @param {?WriteParams} [params]
258
258
  * @returns {Promise<boolean>} - True if the incentive was successfully claimed
259
259
  */
260
260
  protected async claim(
@@ -270,8 +270,8 @@ export class PointsIncentive extends DeployableTarget<
270
270
  * @public
271
271
  * @async
272
272
  * @param {ClaimPayload} payload
273
- * @param {?WriteParams<typeof pointsIncentiveAbi, 'claim'>} [params]
274
- * @returns {Promise<boolean>} - True if the incentive was successfully claimed
273
+ * @param {?WriteParams} [params]
274
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the incentive was successfully claimed
275
275
  */
276
276
  protected async claimRaw(
277
277
  payload: ClaimPayload,
@@ -299,7 +299,7 @@ export class PointsIncentive extends DeployableTarget<
299
299
  * @public
300
300
  * @async
301
301
  * @param {ClaimPayload} payload
302
- * @param {?ReadParams<typeof pointsIncentiveAbi, 'isClaimable'>} [params]
302
+ * @param {?ReadParams} [params]
303
303
  * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload
304
304
  */
305
305
  public async isClaimable(
@@ -327,8 +327,8 @@ export class SignerValidator extends DeployableTarget<
327
327
  * @public
328
328
  * @async
329
329
  * @param {Address} address
330
- * @param {?ReadParams<typeof signerValidatorAbi, 'signers'>} [params]
331
- * @returns {unknown}
330
+ * @param {?ReadParams} [params]
331
+ * @returns {Promise<boolean>}
332
332
  */
333
333
  public async signers(
334
334
  address: Address,
@@ -348,8 +348,8 @@ export class SignerValidator extends DeployableTarget<
348
348
  * @public
349
349
  * @async
350
350
  * @param {SignerValidatorSignaturePayload} payload
351
- * @param {?ReadParams<typeof signerValidatorAbi, 'hashSignerData'>} [params]
352
- * @returns {unknown}
351
+ * @param {?ReadParams} [params]
352
+ * @returns {Promise<Hex>}
353
353
  */
354
354
  public async hashSignerData(
355
355
  payload: SignerValidatorSignaturePayload,
@@ -374,7 +374,7 @@ export class SignerValidator extends DeployableTarget<
374
374
  * @public
375
375
  * @async
376
376
  * @param {SignerValidatorValidatePayload} payload
377
- * @param {?WriteParams<typeof signerValidatorAbi, 'validate'>} [params]
377
+ * @param {?WriteParams} [params]
378
378
  * @returns {Promise<boolean>} - True if the action has been validated based on the data payload
379
379
  */
380
380
  protected async validate(
@@ -390,7 +390,7 @@ export class SignerValidator extends DeployableTarget<
390
390
  * @public
391
391
  * @async
392
392
  * @param {SignerValidatorValidatePayload} payload
393
- * @param {?WriteParams<typeof signerValidatorAbi, 'validate'>} [params]
393
+ * @param {?WriteParams} [params]
394
394
  * @returns {Promise<boolean>} - True if the action has been validated based on the data payload
395
395
  */
396
396
  protected async validateRaw(
@@ -423,8 +423,8 @@ export class SignerValidator extends DeployableTarget<
423
423
  * @async
424
424
  * @param {Address[]} addresses - The list of signers to update
425
425
  * @param {boolean[]} allowed - The authorized status of each signer
426
- * @param {?WriteParams<typeof signerValidatorAbi, 'setAuthorized'>} [params]
427
- * @returns {unknown}
426
+ * @param {?WriteParams} [params]
427
+ * @returns {Promise<void>}
428
428
  */
429
429
  public async setAuthorized(
430
430
  addresses: Address[],
@@ -443,8 +443,8 @@ export class SignerValidator extends DeployableTarget<
443
443
  * @async
444
444
  * @param {Address[]} addresses - The list of signers to update
445
445
  * @param {boolean[]} allowed - The authorized status of each signer
446
- * @param {?WriteParams<typeof signerValidatorAbi, 'setAuthorized'>} [params]
447
- * @returns {unknown}
446
+ * @param {?WriteParams} [params]
447
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
448
448
  */
449
449
  public async setAuthorizedRaw(
450
450
  addresses: Address[],
@@ -471,8 +471,8 @@ export class SignerValidator extends DeployableTarget<
471
471
  * @public
472
472
  * @async
473
473
  * @param {Address} address
474
- * @param {?WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>} [params]
475
- * @returns {unknown}
474
+ * @param {?WriteParams} [params]
475
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
476
476
  */
477
477
  public async setValidatorCallerRaw(
478
478
  address: Address,
@@ -501,8 +501,8 @@ export class SignerValidator extends DeployableTarget<
501
501
  * @public
502
502
  * @async
503
503
  * @param {Address} address
504
- * @param {?WriteParams<typeof signerValidatorAbi, 'setValidatorCaller'>} [params]
505
- * @returns {unknown}
504
+ * @param {?WriteParams} [params]
505
+ * @returns {Promise<void>}
506
506
  */
507
507
  public async setValidatorCaller(
508
508
  address: Address,
@@ -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
@@ -421,6 +421,45 @@ export class TooManyEventActionStepsProvidedError extends Error {
421
421
  }
422
422
  }
423
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
+ * Thrown when missing logs for validating action steps.
446
+ *
447
+ * @export
448
+ * @class ValidationLogsMissingError
449
+ * @typedef {ValidationLogsMissingError}
450
+ * @extends {Error}
451
+ */
452
+ export class ValidationLogsMissingError extends Error {
453
+ /**
454
+ * Creates an instance of ValidationLogsMissingError.
455
+ *
456
+ * @constructor
457
+ */
458
+ constructor() {
459
+ super('Logs are required for validation');
460
+ }
461
+ }
462
+
424
463
  /**
425
464
  * Function action validation context to help debug other validation errors
426
465
  *
@@ -681,18 +720,144 @@ export class UnrecognizedFilterTypeError extends FieldActionValidationError {
681
720
  }
682
721
  }
683
722
 
723
+ /**
724
+ * Thrown when no chain ID is provided in the Wagmi configuration.
725
+ *
726
+ * @export
727
+ * @class NoConnectedChainIdError
728
+ * @typedef {NoConnectedChainIdError}
729
+ * @extends {Error}
730
+ */
684
731
  export class NoConnectedChainIdError extends Error {
732
+ /**
733
+ * Creates an instance of NoConnectedChainIdError.
734
+ *
735
+ * @constructor
736
+ */
685
737
  constructor() {
686
738
  super(
687
739
  'Provided Wagmi configuration does not define `chainId` property with which to target protocol contracts',
688
740
  );
741
+ this.name = 'NoConnectedChainIdError';
689
742
  }
690
743
  }
691
744
 
745
+ /**
746
+ * Thrown when an invalid chain ID is provided that doesn't match any deployed protocol.
747
+ *
748
+ * @export
749
+ * @class InvalidProtocolChainIdError
750
+ * @typedef {InvalidProtocolChainIdError}
751
+ * @extends {Error}
752
+ */
692
753
  export class InvalidProtocolChainIdError extends Error {
754
+ /**
755
+ * Creates an instance of InvalidProtocolChainIdError.
756
+ *
757
+ * @constructor
758
+ * @param {number} chainId - The chain ID provided in the configuration.
759
+ * @param {number[]} validChainIds - A list of valid chain IDs where the protocol is deployed.
760
+ */
693
761
  constructor(chainId: number, validChainIds: number[]) {
694
762
  super(
695
763
  `Provided Wagmi configuration supplied a "chainId" where protocol is not deployed, provided: ${chainId}, but valid chains are: ${validChainIds}`,
696
764
  );
765
+ this.name = 'InvalidProtocolChainIdError';
766
+ }
767
+ }
768
+
769
+ /**
770
+ * Thrown when the incentive criteria cannot be fetched from the contract.
771
+ *
772
+ * @export
773
+ * @class IncentiveCriteriaNotFoundError
774
+ * @typedef {IncentiveCriteriaNotFoundError}
775
+ * @extends {Error}
776
+ */
777
+ export class IncentiveCriteriaNotFoundError extends Error {
778
+ /**
779
+ * Creates an instance of IncentiveCriteriaNotFoundError.
780
+ *
781
+ * @constructor
782
+ * @param {Error} [e] - Optional error object for further context.
783
+ * @param {string} [message='Unable to fetch Incentive Criteria from contract'] - Custom error message.
784
+ */
785
+ constructor(
786
+ e?: Error,
787
+ message = 'Unable to fetch Incentive Criteria from contract',
788
+ ) {
789
+ super(message + (e ? `: ${e.message}` : ''));
790
+ this.name = 'IncentiveCriteriaNotFoundError';
791
+ }
792
+ }
793
+
794
+ /**
795
+ * Thrown when no matching logs are found for a given event signature.
796
+ *
797
+ * @export
798
+ * @class NoMatchingLogsError
799
+ * @typedef {NoMatchingLogsError}
800
+ * @extends {Error}
801
+ */
802
+ export class NoMatchingLogsError extends Error {
803
+ /**
804
+ * Creates an instance of NoMatchingLogsError.
805
+ *
806
+ * @constructor
807
+ * @param {string} signature - The event signature for which logs are being searched.
808
+ * @param {string} [message] - Optional custom error message.
809
+ */
810
+ constructor(
811
+ signature: string,
812
+ message = `No logs found for event signature ${signature}`,
813
+ ) {
814
+ super(message);
815
+ this.name = 'NoMatchingLogsError';
816
+ }
817
+ }
818
+
819
+ /**
820
+ * Thrown when an invalid criteria type is provided.
821
+ *
822
+ * @export
823
+ * @class InvalidCriteriaTypeError
824
+ * @typedef {InvalidCriteriaTypeError}
825
+ * @extends {Error}
826
+ */
827
+ export class InvalidCriteriaTypeError extends Error {
828
+ /**
829
+ * Creates an instance of InvalidCriteriaTypeError.
830
+ *
831
+ * @constructor
832
+ * @param {string} [criteriaType='unknown'] - The invalid criteria type that was provided.
833
+ * @param {string} [message] - Optional custom error message.
834
+ */
835
+ constructor(
836
+ criteriaType = 'unknown',
837
+ message = `Invalid criteria type ${criteriaType}`,
838
+ ) {
839
+ super(message);
840
+ this.name = 'InvalidCriteriaTypeError';
841
+ }
842
+ }
843
+
844
+ /**
845
+ * Thrown when decoding function arguments fails.
846
+ *
847
+ * @export
848
+ * @class DecodedArgsError
849
+ * @typedef {DecodedArgsError}
850
+ * @extends {Error}
851
+ */
852
+ export class DecodedArgsError extends Error {
853
+ /**
854
+ * Creates an instance of DecodedArgsError.
855
+ *
856
+ * @constructor
857
+ * @param {string} [message='Issue decoding args'] - Custom error message.
858
+ */
859
+ constructor(message = 'Issue decoding args') {
860
+ super(message);
861
+ this.name = 'DecodedArgsError';
697
862
  }
698
863
  }