@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/BoostCore.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  boostCoreAbi,
3
3
  type iAuthAbi,
4
- readBoostCoreClaimFee,
5
4
  readBoostCoreCreateBoostAuth,
6
5
  readBoostCoreGetBoost,
7
6
  readBoostCoreGetBoostCount,
@@ -10,29 +9,37 @@ import {
10
9
  readIAuthIsAuthorized,
11
10
  simulateBoostCoreClaimIncentive,
12
11
  simulateBoostCoreClaimIncentiveFor,
13
- simulateBoostCoreSetClaimFee,
12
+ simulateBoostCoreCreateBoost,
14
13
  simulateBoostCoreSetCreateBoostAuth,
15
14
  simulateBoostCoreSetProtocolFeeReceiver,
16
15
  writeBoostCoreClaimIncentive,
17
16
  writeBoostCoreClaimIncentiveFor,
18
- writeBoostCoreSetClaimFee,
19
17
  writeBoostCoreSetCreateBoostAuth,
20
18
  writeBoostCoreSetProtocolFeeReceiver,
21
19
  } from '@boostxyz/evm';
22
20
  import { bytecode } from '@boostxyz/evm/artifacts/contracts/BoostCore.sol/BoostCore.json';
23
- import { getAccount, waitForTransactionReceipt } from '@wagmi/core';
21
+ import {
22
+ type GetTransactionReceiptParameters,
23
+ getAccount,
24
+ getTransactionReceipt,
25
+ waitForTransactionReceipt,
26
+ } from '@wagmi/core';
27
+ import type { SimulateContractReturnType } from '@wagmi/core/actions';
24
28
  import { createWriteContract } from '@wagmi/core/codegen';
25
29
  import {
26
30
  type Address,
27
31
  type ContractEventName,
28
32
  type Hex,
33
+ parseEther,
29
34
  parseEventLogs,
30
35
  zeroAddress,
31
36
  zeroHash,
32
37
  } from 'viem';
38
+ import { BoostCore as BoostCoreBases } from '../dist/deployments.json';
33
39
  import { type Action, actionFromAddress } from './Actions/Action';
34
- import { EventAction } from './Actions/EventAction';
40
+ import { EventAction, type EventActionPayload } from './Actions/EventAction';
35
41
  import { type AllowList, allowListFromAddress } from './AllowLists/AllowList';
42
+ import { OpenAllowList } from './AllowLists/OpenAllowList';
36
43
  import {
37
44
  SimpleAllowList,
38
45
  type SimpleAllowListPayload,
@@ -42,7 +49,13 @@ import {
42
49
  type SimpleDenyListPayload,
43
50
  } from './AllowLists/SimpleDenyList';
44
51
  import { type Auth, PassthroughAuth } from './Auth/Auth';
45
- import { Boost } from './Boost';
52
+ import {
53
+ Boost,
54
+ type BoostPayload,
55
+ type RawBoost,
56
+ type Target,
57
+ prepareBoostPayload,
58
+ } from './Boost';
46
59
  import { type Budget, budgetFromAddress } from './Budgets/Budget';
47
60
  import {
48
61
  ManagedBudget,
@@ -66,6 +79,11 @@ import {
66
79
  ERC20Incentive,
67
80
  type ERC20IncentivePayload,
68
81
  } from './Incentives/ERC20Incentive';
82
+ import {
83
+ ERC20VariableCriteriaIncentive,
84
+ type ERC20VariableCriteriaIncentivePayload,
85
+ } from './Incentives/ERC20VariableCriteriaIncentive';
86
+ import type { ERC20VariableIncentivePayload } from './Incentives/ERC20VariableIncentive';
69
87
  import {
70
88
  ERC20VariableIncentive,
71
89
  type Incentive,
@@ -82,33 +100,52 @@ import {
82
100
  import { type Validator, validatorFromAddress } from './Validators/Validator';
83
101
  import {
84
102
  BoostCoreNoIdentifierEmitted,
103
+ BoostNotFoundError,
85
104
  BudgetMustAuthorizeBoostCore,
86
105
  DeployableUnknownOwnerProvidedError,
87
106
  IncentiveNotCloneableError,
88
107
  MustInitializeBudgetError,
89
- NoContractAddressUponReceiptError,
90
108
  } from './errors';
91
109
  import {
92
- type ERC20VariableIncentivePayload,
93
- type EventActionPayload,
94
110
  type GenericLog,
95
- type BoostPayload as OnChainBoostPayload,
96
111
  type ReadParams,
97
- type Target,
98
112
  type WriteParams,
99
- prepareBoostPayload,
113
+ assertValidAddressByChainId,
100
114
  } from './utils';
101
115
 
116
+ /**
117
+ * The ABI of the BoostCore contract, if needed for low level operations
118
+ *
119
+ * @type {typeof boostCoreAbi}
120
+ */
102
121
  export { boostCoreAbi };
103
122
 
104
123
  /**
105
- * The fixed address for the deployed Boost Core.
106
- * By default, `new BoostCore` will use this address if not otherwise provided.
124
+ * The fee (in wei) required to claim each incentive, must be provided for the `claimIncentive` transaction
125
+ *
126
+ * @type {bigint}
127
+ */
128
+ export const BOOST_CORE_CLAIM_FEE = parseEther('0.000075');
129
+
130
+ /**
131
+ * The address of the deployed BoostCore instance. In prerelease mode, this will be its sepolia address
107
132
  *
108
133
  * @type {Address}
109
134
  */
110
- export const BOOST_CORE_ADDRESS: Address = import.meta.env
111
- .VITE_BOOST_CORE_ADDRESS;
135
+ export const BOOST_CORE_ADDRESS =
136
+ (BoostCoreBases as Record<string, Address>)[__DEFAULT_CHAIN_ID__] ||
137
+ zeroAddress;
138
+
139
+ /**
140
+ * The fixed addresses for the deployed Boost Core.
141
+ * By default, `new BoostCore` will use the address deployed to the currently connected chain, or `BOOST_CORE_ADDRESS` if not provided.
142
+ *
143
+ * @type {Record<number, Address>}
144
+ */
145
+ export const BOOST_CORE_ADDRESSES: Record<number, Address> = {
146
+ ...(BoostCoreBases as Record<number, Address>),
147
+ 31337: import.meta.env.VITE_BOOST_CORE_ADDRESS,
148
+ };
112
149
 
113
150
  /**
114
151
  * A generic `viem.Log` event with support for `BoostCore` event types.
@@ -206,11 +243,10 @@ export type BoostCoreConfig =
206
243
  export type CreateBoostPayload = {
207
244
  budget: Budget;
208
245
  action: Action;
209
- validator: Validator;
246
+ validator?: Validator;
210
247
  allowList: AllowList;
211
248
  incentives: Array<Incentive>;
212
249
  protocolFee?: bigint;
213
- referralFee?: bigint;
214
250
  maxParticipants?: bigint;
215
251
  owner?: Address;
216
252
  };
@@ -227,6 +263,26 @@ export class BoostCore extends Deployable<
227
263
  [Address, Address],
228
264
  typeof boostCoreAbi
229
265
  > {
266
+ /**
267
+ * A static property representing a map of stringified chain ID's to the address of the deployed implementation on chain
268
+ *
269
+ * @static
270
+ * @readonly
271
+ * @type {Record<string, Address>}
272
+ */
273
+ static readonly addresses: Record<number, Address> = BOOST_CORE_ADDRESSES;
274
+
275
+ /**
276
+ * A getter that will return Boost core's static addresses by numerical chain ID
277
+ *
278
+ * @public
279
+ * @readonly
280
+ * @type {Record<number, Address>}
281
+ */
282
+ public get addresses(): Record<number, Address> {
283
+ return (this.constructor as typeof BoostCore).addresses;
284
+ }
285
+
230
286
  /**
231
287
  * Creates an instance of BoostCore.
232
288
  *
@@ -245,63 +301,155 @@ export class BoostCore extends Deployable<
245
301
  options.protocolFeeReceiver,
246
302
  ]);
247
303
  } else {
248
- super({ account, config }, BOOST_CORE_ADDRESS);
304
+ const { address } = assertValidAddressByChainId(
305
+ config,
306
+ BOOST_CORE_ADDRESSES,
307
+ );
308
+ super({ account, config }, address);
249
309
  }
250
310
  //@ts-expect-error I can't set this property on the class because for some reason it takes super out of constructor scope?
251
311
  this.abi = boostCoreAbi;
252
312
  }
313
+
253
314
  /**
254
315
  * Create a new Boost.
255
316
  *
256
317
  * @public
257
318
  * @async
258
319
  * @param {CreateBoostPayload} _boostPayload
259
- * @param {?DeployableOptions} [_options]
260
- * @returns {Boost}
320
+ * @param {?DeployableOptions} [_params]
321
+ * @returns {Promise<Boost>}
261
322
  */
262
323
  public async createBoost(
263
324
  _boostPayload: CreateBoostPayload,
264
- _options?: DeployableOptions,
325
+ _params?: DeployableOptions &
326
+ WriteParams<typeof boostCoreAbi, 'createBoost'>,
265
327
  ) {
266
- const coreAddress = this.assertValidAddress();
267
328
  const [payload, options] =
268
- this.validateDeploymentConfig<CreateBoostPayload>(
269
- _boostPayload,
270
- _options,
271
- );
272
-
273
- let {
274
- budget,
275
- action,
276
- validator,
277
- allowList,
278
- incentives,
279
- protocolFee = 0n,
280
- referralFee = 0n,
281
- maxParticipants = 0n,
282
- owner,
283
- } = payload;
329
+ this.validateDeploymentConfig<CreateBoostPayload>(_boostPayload, _params);
330
+ const desiredChainId = _params?.chain?.id || _params?.chainId;
331
+ const { chainId, address: coreAddress } = assertValidAddressByChainId(
332
+ options.config,
333
+ this.addresses,
334
+ desiredChainId,
335
+ );
284
336
 
285
337
  const boostFactory = createWriteContract({
286
338
  abi: boostCoreAbi,
287
339
  functionName: 'createBoost',
288
- address: this.address,
340
+ address: coreAddress,
289
341
  });
290
342
 
291
- if (!owner) {
292
- owner =
343
+ const onChainPayload = await this.prepareCreateBoostPayload(
344
+ coreAddress,
345
+ chainId,
346
+ payload,
347
+ options,
348
+ );
349
+
350
+ const boostHash = await boostFactory(options.config, {
351
+ ...this.optionallyAttachAccount(options.account),
352
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
353
+ ...(_params as any),
354
+ chainId,
355
+ args: [prepareBoostPayload(onChainPayload)],
356
+ });
357
+ const receipt = await waitForTransactionReceipt(options.config, {
358
+ hash: boostHash,
359
+ });
360
+ const boostCreatedLog = parseEventLogs({
361
+ abi: boostCoreAbi,
362
+ eventName: 'BoostCreated',
363
+ logs: receipt.logs,
364
+ }).at(0);
365
+ let boostId = 0n;
366
+ if (!boostCreatedLog) throw new BoostCoreNoIdentifierEmitted();
367
+ boostId = boostCreatedLog?.args.boostId;
368
+ const boost = await this.readBoost(boostId);
369
+ return new Boost({
370
+ id: boostId,
371
+ budget: payload.budget.at(boost.budget),
372
+ action: payload.action.at(boost.action),
373
+ validator: payload.validator!.at(boost.validator),
374
+ allowList: payload.allowList.at(boost.allowList),
375
+ incentives: payload.incentives.map((incentive, i) =>
376
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
377
+ incentive.at(boost.incentives.at(i)!),
378
+ ),
379
+ protocolFee: boost.protocolFee,
380
+ maxParticipants: boost.maxParticipants,
381
+ owner: boost.owner,
382
+ });
383
+ }
384
+
385
+ /**
386
+ * Returns a simulated Boost creation.
387
+ *
388
+ * @public
389
+ * @async
390
+ * @param {CreateBoostPayload} _boostPayload
391
+ * @param {?DeployableOptions} [_params]
392
+ * @returns {Promise<SimulateContractReturnType>}
393
+ */
394
+ public async simulateCreateBoost(
395
+ _boostPayload: CreateBoostPayload,
396
+ _params?: DeployableOptions &
397
+ WriteParams<typeof boostCoreAbi, 'createBoost'>,
398
+ ) {
399
+ const [payload, options] =
400
+ this.validateDeploymentConfig<CreateBoostPayload>(_boostPayload, _params);
401
+ const desiredChainId = _params?.chain?.id || _params?.chainId;
402
+ const { chainId, address: coreAddress } = assertValidAddressByChainId(
403
+ options.config,
404
+ this.addresses,
405
+ desiredChainId,
406
+ );
407
+
408
+ const onChainPayload = await this.prepareCreateBoostPayload(
409
+ coreAddress,
410
+ chainId,
411
+ payload,
412
+ options,
413
+ );
414
+
415
+ return await simulateBoostCoreCreateBoost(this._config, {
416
+ ...this.optionallyAttachAccount(),
417
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
418
+ ...(_params as any),
419
+ address: coreAddress,
420
+ chainId,
421
+ args: [prepareBoostPayload(onChainPayload)],
422
+ });
423
+ }
424
+
425
+ // This function mutates payload, which isn't awesome but it's fine
426
+ private async prepareCreateBoostPayload(
427
+ coreAddress: Address,
428
+ chainId: number,
429
+ payload: CreateBoostPayload,
430
+ options: DeployableOptions,
431
+ ): Promise<BoostPayload> {
432
+ if (!payload.owner) {
433
+ payload.owner =
293
434
  this._account?.address ||
294
435
  getAccount(options.config).address ||
295
436
  zeroAddress;
296
- if (owner === zeroAddress) {
437
+ if (payload.owner === zeroAddress) {
297
438
  throw new DeployableUnknownOwnerProvidedError();
298
439
  }
299
440
  }
300
441
 
301
- let budgetPayload: OnChainBoostPayload['budget'] = zeroAddress;
302
- if (budget.address) {
303
- budgetPayload = budget.address;
304
- if (!(await budget.isAuthorized(coreAddress))) {
442
+ if (!payload.validator) {
443
+ payload.validator = this.SignerValidator({
444
+ signers: [payload.owner],
445
+ validatorCaller: coreAddress,
446
+ });
447
+ }
448
+
449
+ let budgetPayload: BoostPayload['budget'] = zeroAddress;
450
+ if (payload.budget.address) {
451
+ budgetPayload = payload.budget.address;
452
+ if (!(await payload.budget.isAuthorized(coreAddress))) {
305
453
  throw new BudgetMustAuthorizeBoostCore(coreAddress);
306
454
  }
307
455
  } else {
@@ -310,92 +458,93 @@ export class BoostCore extends Deployable<
310
458
 
311
459
  // if we're supplying an address, it could be a pre-initialized target
312
460
  // if base is explicitly set to false, then it will not be initialized, and it will be referenced as is if it implements interface correctly
313
- let actionPayload: OnChainBoostPayload['action'] = {
461
+ let actionPayload: BoostPayload['action'] = {
314
462
  instance: zeroAddress,
315
463
  isBase: true,
316
464
  parameters: zeroHash,
317
465
  };
318
- if (action.address) {
319
- const isBase = action.address === action.base || action.isBase;
466
+ if (payload.action.address) {
467
+ const isBase = payload.action.isBase;
320
468
  actionPayload = {
321
469
  isBase: isBase,
322
- instance: action.address,
470
+ instance: payload.action.address,
323
471
  parameters: isBase
324
- ? action.buildParameters(undefined, options).args.at(0) || zeroHash
472
+ ? payload.action.buildParameters(undefined, options).args.at(0) ||
473
+ zeroHash
325
474
  : zeroHash,
326
475
  };
327
476
  } else {
328
477
  actionPayload.parameters =
329
- action.buildParameters(undefined, options).args.at(0) || zeroHash;
330
- actionPayload.instance = action.base;
478
+ payload.action.buildParameters(undefined, options).args.at(0) ||
479
+ zeroHash;
480
+ actionPayload.instance = assertValidAddressByChainId(
481
+ options.config,
482
+ payload.action.bases,
483
+ chainId,
484
+ ).address;
331
485
  }
332
486
 
333
- let validatorPayload: OnChainBoostPayload['validator'] = {
487
+ let validatorPayload: BoostPayload['validator'] = {
334
488
  instance: zeroAddress,
335
489
  isBase: true,
336
490
  parameters: zeroHash,
337
491
  };
338
- if (validator.address) {
339
- const isBase = validator.address === validator.base || validator.isBase;
492
+ if (payload.validator.address) {
493
+ const isBase = payload.validator.isBase;
340
494
  validatorPayload = {
341
495
  isBase: isBase,
342
- instance: validator.address,
496
+ instance: payload.validator.address,
343
497
  parameters: isBase
344
- ? validator
345
- .buildParameters(
346
- {
347
- signers: [owner],
348
- validatorCaller: coreAddress,
349
- },
350
- options,
351
- )
352
- .args.at(0) || zeroHash
498
+ ? payload.validator.buildParameters(undefined, options).args.at(0) ||
499
+ zeroHash
353
500
  : zeroHash,
354
501
  };
355
502
  } else {
356
503
  validatorPayload.parameters =
357
- validator
358
- .buildParameters(
359
- {
360
- signers: [owner],
361
- validatorCaller: coreAddress,
362
- },
363
- options,
364
- )
365
- .args.at(0) || zeroHash;
366
- validatorPayload.instance = validator.base;
504
+ payload.validator.buildParameters(undefined, options).args.at(0) ||
505
+ zeroHash;
506
+ validatorPayload.instance = assertValidAddressByChainId(
507
+ options.config,
508
+ payload.validator.bases,
509
+ chainId,
510
+ ).address;
367
511
  }
368
512
 
369
- let allowListPayload: OnChainBoostPayload['allowList'] = {
513
+ let allowListPayload: BoostPayload['allowList'] = {
370
514
  instance: zeroAddress,
371
515
  isBase: true,
372
516
  parameters: zeroHash,
373
517
  };
374
- if (allowList.address) {
375
- const isBase = allowList.address === allowList.base || allowList.isBase;
518
+ if (payload.allowList.address) {
519
+ const isBase = payload.allowList.isBase;
376
520
  allowListPayload = {
377
521
  isBase: isBase,
378
- instance: allowList.address,
522
+ instance: payload.allowList.address,
379
523
  parameters: isBase
380
524
  ? zeroHash // allowList.buildParameters(undefined, options).args.at(0) || zeroHash
381
525
  : zeroHash,
382
526
  };
383
527
  } else {
384
528
  allowListPayload.parameters =
385
- allowList.buildParameters(undefined, options).args.at(0) || zeroHash;
386
- allowListPayload.instance = allowList.base;
529
+ payload.allowList.buildParameters(undefined, options).args.at(0) ||
530
+ zeroHash;
531
+ allowListPayload.instance = assertValidAddressByChainId(
532
+ options.config,
533
+ payload.allowList.bases,
534
+ chainId,
535
+ ).address;
387
536
  }
388
537
 
389
- let incentivesPayloads: Array<Target> = incentives.map(() => ({
538
+ const incentivesPayloads: Array<Target> = payload.incentives.map(() => ({
390
539
  instance: zeroAddress,
391
540
  isBase: true,
392
541
  parameters: zeroHash,
393
542
  }));
394
- for (let i = 0; i < incentives.length; i++) {
543
+ for (let i = 0; i < payload.incentives.length; i++) {
395
544
  // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
396
- const incentive = incentives.at(i)!;
545
+ const incentive = payload.incentives.at(i)!;
397
546
  if (incentive.address) {
398
- const isBase = incentive.address === incentive.base || incentive.isBase;
547
+ const isBase = incentive.isBase;
399
548
  if (!isBase) throw new IncentiveNotCloneableError(incentive);
400
549
  incentivesPayloads[i] = {
401
550
  isBase: isBase,
@@ -406,9 +555,15 @@ export class BoostCore extends Deployable<
406
555
  : zeroHash,
407
556
  };
408
557
  } else {
558
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
409
559
  incentivesPayloads[i]!.parameters =
410
560
  incentive.buildParameters(undefined, options).args.at(0) || zeroHash;
411
- incentivesPayloads[i]!.instance = incentive.base;
561
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
562
+ incentivesPayloads[i]!.instance = assertValidAddressByChainId(
563
+ options.config,
564
+ incentive.bases,
565
+ chainId,
566
+ ).address;
412
567
  }
413
568
  }
414
569
 
@@ -418,42 +573,12 @@ export class BoostCore extends Deployable<
418
573
  validator: validatorPayload,
419
574
  allowList: allowListPayload,
420
575
  incentives: incentivesPayloads,
421
- protocolFee,
422
- referralFee,
423
- maxParticipants,
424
- owner,
576
+ protocolFee: payload.protocolFee || 0n,
577
+ maxParticipants: payload.maxParticipants || 0n,
578
+ owner: payload.owner,
425
579
  };
426
580
 
427
- const boostHash = await boostFactory(options.config, {
428
- args: [prepareBoostPayload(onChainPayload)],
429
- ...this.optionallyAttachAccount(options.account),
430
- });
431
- const receipt = await waitForTransactionReceipt(options.config, {
432
- hash: boostHash,
433
- });
434
- const boostCreatedLog = parseEventLogs({
435
- abi: boostCoreAbi,
436
- eventName: 'BoostCreated',
437
- logs: receipt.logs,
438
- }).at(0);
439
- let boostId = 0n;
440
- if (!boostCreatedLog) throw new BoostCoreNoIdentifierEmitted();
441
- boostId = boostCreatedLog?.args.boostIndex;
442
- const boost = await this.readBoost(boostId);
443
- return new Boost({
444
- id: boostId,
445
- budget: budget.at(boost.budget),
446
- action: action.at(boost.action),
447
- validator: validator.at(boost.validator),
448
- allowList: allowList.at(boost.allowList),
449
- incentives: incentives.map((incentive, i) =>
450
- incentive.at(boost.incentives.at(i)!),
451
- ),
452
- protocolFee: boost.protocolFee,
453
- referralFee: boost.referralFee,
454
- maxParticipants: boost.maxParticipants,
455
- owner: boost.owner,
456
- });
581
+ return onChainPayload;
457
582
  }
458
583
 
459
584
  /**
@@ -465,8 +590,8 @@ export class BoostCore extends Deployable<
465
590
  * @param {bigint} incentiveId
466
591
  * @param {Address} address
467
592
  * @param {Hex} data
468
- * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentive'>} [params]
469
- * @returns {unknown}
593
+ * @param {?WriteParams} [params]
594
+ * @returns {Promise<void>}
470
595
  */
471
596
  public async claimIncentive(
472
597
  boostId: bigint,
@@ -475,7 +600,7 @@ export class BoostCore extends Deployable<
475
600
  data: Hex,
476
601
  params?: WriteParams<typeof boostCoreAbi, 'claimIncentive'>,
477
602
  ) {
478
- return this.awaitResult(
603
+ return await this.awaitResult(
479
604
  this.claimIncentiveRaw(boostId, incentiveId, address, data, params),
480
605
  );
481
606
  }
@@ -487,23 +612,27 @@ export class BoostCore extends Deployable<
487
612
  * @async
488
613
  * @param {bigint} boostId - The ID of the Boost
489
614
  * @param {bigint} incentiveId - The ID of the Incentive
490
- * @param {Address} address - The address of the referrer (if any)
615
+ * @param {Address} referrer - The address of the referrer (if any)
491
616
  * @param {Hex} data- The data for the claim
492
- * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentive'>} [params]
493
- * @returns {unknown}
617
+ * @param {?WriteParams} [params]
618
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
494
619
  */
495
620
  public async claimIncentiveRaw(
496
621
  boostId: bigint,
497
622
  incentiveId: bigint,
498
- address: Address,
623
+ referrer: Address,
499
624
  data: Hex,
500
625
  params?: WriteParams<typeof boostCoreAbi, 'claimIncentive'>,
501
626
  ) {
502
627
  const { request, result } = await simulateBoostCoreClaimIncentive(
503
628
  this._config,
504
629
  {
505
- address: this.assertValidAddress(),
506
- args: [boostId, incentiveId, address, data],
630
+ ...assertValidAddressByChainId(
631
+ this._config,
632
+ this.addresses,
633
+ params?.chain?.id || params?.chainId,
634
+ ),
635
+ args: [boostId, incentiveId, referrer, data],
507
636
  ...this.optionallyAttachAccount(),
508
637
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
509
638
  ...(params as any),
@@ -523,8 +652,8 @@ export class BoostCore extends Deployable<
523
652
  * @param {Address} referrer
524
653
  * @param {Hex} data
525
654
  * @param {Address} claimant
526
- * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>} [params]
527
- * @returns {unknown}
655
+ * @param {?WriteParams} [params]
656
+ * @returns {Promise<void>}
528
657
  */
529
658
  public async claimIncentiveFor(
530
659
  boostId: bigint,
@@ -534,7 +663,7 @@ export class BoostCore extends Deployable<
534
663
  claimant: Address,
535
664
  params?: WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>,
536
665
  ) {
537
- return this.awaitResult(
666
+ return await this.awaitResult(
538
667
  this.claimIncentiveForRaw(
539
668
  boostId,
540
669
  incentiveId,
@@ -556,8 +685,8 @@ export class BoostCore extends Deployable<
556
685
  * @param {Address} referrer - The address of the referrer (if any)
557
686
  * @param {Hex} data - The data for the claim
558
687
  * @param {Address} claimant - The address of the user eligible for the incentive payout
559
- * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>} [params]
560
- * @returns {unknown}
688
+ * @param {?WriteParams} [params]
689
+ * @returns {Promise<{ hash: Hex; result: void; }>}
561
690
  */
562
691
  public async claimIncentiveForRaw(
563
692
  boostId: bigint,
@@ -570,7 +699,11 @@ export class BoostCore extends Deployable<
570
699
  const { request, result } = await simulateBoostCoreClaimIncentiveFor(
571
700
  this._config,
572
701
  {
573
- address: this.assertValidAddress(),
702
+ ...assertValidAddressByChainId(
703
+ this._config,
704
+ this.addresses,
705
+ params?.chain?.id || params?.chainId,
706
+ ),
574
707
  args: [boostId, incentiveId, referrer, data, claimant],
575
708
  ...this.optionallyAttachAccount(),
576
709
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -586,21 +719,37 @@ export class BoostCore extends Deployable<
586
719
  *
587
720
  * @public
588
721
  * @async
589
- * @param {bigint} id
590
- * @param {?ReadParams<typeof boostCoreAbi, 'getBoost'>} [params]
591
- * @returns {unknown}
722
+ * @param {bigint | string} id
723
+ * @param {?ReadParams} [params]
724
+ * @returns {Promise<RawBoost>}
725
+ * @throws {@link BoostNotFoundError}
592
726
  */
593
727
  public async readBoost(
594
- id: bigint,
728
+ _id: string | bigint,
595
729
  params?: ReadParams<typeof boostCoreAbi, 'getBoost'>,
596
- ) {
597
- return readBoostCoreGetBoost(this._config, {
598
- address: this.assertValidAddress(),
599
- args: [id],
600
- ...this.optionallyAttachAccount(),
601
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
602
- ...(params as any),
603
- });
730
+ ): Promise<RawBoost> {
731
+ try {
732
+ let id: bigint;
733
+ if (typeof _id === 'string') {
734
+ id = BigInt(_id);
735
+ } else id = _id;
736
+ return await readBoostCoreGetBoost(this._config, {
737
+ ...assertValidAddressByChainId(
738
+ this._config,
739
+ this.addresses,
740
+ params?.chainId,
741
+ ),
742
+ args: [id],
743
+ ...this.optionallyAttachAccount(),
744
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
745
+ ...(params as any),
746
+ });
747
+ // biome-ignore lint/suspicious/noExplicitAny: unknown error
748
+ } catch (e: any) {
749
+ if (e?.message?.includes('bounds'))
750
+ throw new BoostNotFoundError(String(_id));
751
+ throw e;
752
+ }
604
753
  }
605
754
 
606
755
  /**
@@ -609,8 +758,9 @@ export class BoostCore extends Deployable<
609
758
  * @public
610
759
  * @async
611
760
  * @param {(string | bigint)} _id
612
- * @param {?ReadParams<typeof boostCoreAbi, 'getBoost'>} [params]
613
- * @returns {unknown}
761
+ * @param {?ReadParams} [params]
762
+ * @returns {Promise<Boost>}
763
+ * @throws {@link BoostNotFoundError}
614
764
  */
615
765
  public async getBoost(
616
766
  _id: string | bigint,
@@ -620,13 +770,8 @@ export class BoostCore extends Deployable<
620
770
  if (typeof _id === 'string') {
621
771
  id = BigInt(_id);
622
772
  } else id = _id;
623
- const {
624
- protocolFee,
625
- referralFee,
626
- maxParticipants,
627
- owner,
628
- ...boostPayload
629
- } = await this.readBoost(id, params);
773
+ const { protocolFee, maxParticipants, owner, ...boostPayload } =
774
+ await this.readBoost(id, params);
630
775
  const options: DeployableOptions = {
631
776
  config: this._config,
632
777
  account: this._account,
@@ -651,7 +796,6 @@ export class BoostCore extends Deployable<
651
796
  allowList,
652
797
  incentives,
653
798
  protocolFee,
654
- referralFee,
655
799
  maxParticipants,
656
800
  owner,
657
801
  });
@@ -662,14 +806,18 @@ export class BoostCore extends Deployable<
662
806
  *
663
807
  * @public
664
808
  * @async
665
- * @param {?ReadParams<typeof boostCoreAbi, 'getBoostCount'>} [params]
809
+ * @param {?ReadParams} [params]
666
810
  * @returns {Promise<bigint>}
667
811
  */
668
812
  public async getBoostCount(
669
813
  params?: ReadParams<typeof boostCoreAbi, 'getBoostCount'>,
670
814
  ) {
671
- return readBoostCoreGetBoostCount(this._config, {
672
- address: this.assertValidAddress(),
815
+ return await readBoostCoreGetBoostCount(this._config, {
816
+ ...assertValidAddressByChainId(
817
+ this._config,
818
+ this.addresses,
819
+ params?.chainId,
820
+ ),
673
821
  args: [],
674
822
  ...this.optionallyAttachAccount(),
675
823
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -683,7 +831,7 @@ export class BoostCore extends Deployable<
683
831
  * @public
684
832
  * @async
685
833
  * @param {Address} address
686
- * @param {?ReadParams<typeof boostCoreAbi, 'createBoostAuth'> &
834
+ * @param {?ReadParams &
687
835
  * ReadParams<typeof iAuthAbi, 'isAuthorized'>} [params]
688
836
  * @returns {Promise<boolean>}
689
837
  */
@@ -692,7 +840,7 @@ export class BoostCore extends Deployable<
692
840
  params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'> &
693
841
  ReadParams<typeof iAuthAbi, 'isAuthorized'>,
694
842
  ) {
695
- const auth = await this.createBoostAuth();
843
+ const auth = await this.createBoostAuth(params);
696
844
  return readIAuthIsAuthorized(this._config, {
697
845
  address: auth,
698
846
  args: [address],
@@ -707,14 +855,18 @@ export class BoostCore extends Deployable<
707
855
  *
708
856
  * @public
709
857
  * @async
710
- * @param {?ReadParams<typeof boostCoreAbi, 'createBoostAuth'>} [params]
711
- * @returns {unknown}
858
+ * @param {?ReadParams} [params]
859
+ * @returns {Promise<Address>}
712
860
  */
713
861
  public async createBoostAuth(
714
862
  params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'>,
715
863
  ) {
716
- return readBoostCoreCreateBoostAuth(this._config, {
717
- address: this.assertValidAddress(),
864
+ return await readBoostCoreCreateBoostAuth(this._config, {
865
+ ...assertValidAddressByChainId(
866
+ this._config,
867
+ this.addresses,
868
+ params?.chainId,
869
+ ),
718
870
  args: [],
719
871
  ...this.optionallyAttachAccount(),
720
872
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -728,14 +880,14 @@ export class BoostCore extends Deployable<
728
880
  * @public
729
881
  * @async
730
882
  * @param {Auth} auth
731
- * @param {?WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>} [params]
732
- * @returns {unknown}
883
+ * @param {?WriteParams} [params]
884
+ * @returns {Promise<void>}
733
885
  */
734
886
  public async setCreateBoostAuth(
735
887
  auth: Auth,
736
888
  params?: WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>,
737
889
  ) {
738
- return this.awaitResult(
890
+ return await this.awaitResult(
739
891
  this.setCreateBoostAuthRaw(auth.assertValidAddress(), {
740
892
  ...params,
741
893
  }),
@@ -748,8 +900,8 @@ export class BoostCore extends Deployable<
748
900
  * @public
749
901
  * @async
750
902
  * @param {Address} address
751
- * @param {?WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>} [params]
752
- * @returns {unknown}
903
+ * @param {?WriteParams} [params]
904
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
753
905
  */
754
906
  public async setCreateBoostAuthRaw(
755
907
  address: Address,
@@ -758,7 +910,11 @@ export class BoostCore extends Deployable<
758
910
  const { request, result } = await simulateBoostCoreSetCreateBoostAuth(
759
911
  this._config,
760
912
  {
761
- address: this.assertValidAddress(),
913
+ ...assertValidAddressByChainId(
914
+ this._config,
915
+ this.addresses,
916
+ params?.chainId,
917
+ ),
762
918
  args: [address],
763
919
  ...this.optionallyAttachAccount(),
764
920
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -774,14 +930,18 @@ export class BoostCore extends Deployable<
774
930
  *
775
931
  * @public
776
932
  * @async
777
- * @param {?ReadParams<typeof boostCoreAbi, 'protocolFee'>} [params]
933
+ * @param {?ReadParams} [params]
778
934
  * @returns {unknown}
779
935
  */
780
936
  public async protocolFee(
781
937
  params?: ReadParams<typeof boostCoreAbi, 'protocolFee'>,
782
938
  ) {
783
- return readBoostCoreProtocolFee(this._config, {
784
- address: this.assertValidAddress(),
939
+ return await readBoostCoreProtocolFee(this._config, {
940
+ ...assertValidAddressByChainId(
941
+ this._config,
942
+ this.addresses,
943
+ params?.chainId,
944
+ ),
785
945
  args: [],
786
946
  ...this.optionallyAttachAccount(),
787
947
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -794,14 +954,18 @@ export class BoostCore extends Deployable<
794
954
  *
795
955
  * @public
796
956
  * @async
797
- * @param {?ReadParams<typeof boostCoreAbi, 'protocolFeeReceiver'>} [params]
798
- * @returns {unknown}
957
+ * @param {?ReadParams} [params]
958
+ * @returns {Promise<Address>}
799
959
  */
800
960
  public async protocolFeeReceiver(
801
961
  params?: ReadParams<typeof boostCoreAbi, 'protocolFeeReceiver'>,
802
962
  ) {
803
- return readBoostCoreProtocolFeeReceiver(this._config, {
804
- address: this.assertValidAddress(),
963
+ return await readBoostCoreProtocolFeeReceiver(this._config, {
964
+ ...assertValidAddressByChainId(
965
+ this._config,
966
+ this.addresses,
967
+ params?.chainId,
968
+ ),
805
969
  args: [],
806
970
  ...this.optionallyAttachAccount(),
807
971
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -815,14 +979,14 @@ export class BoostCore extends Deployable<
815
979
  * @public
816
980
  * @async
817
981
  * @param {Address} address
818
- * @param {?WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>} [params]
819
- * @returns {unknown}
982
+ * @param {?WriteParams} [params]
983
+ * @returns {Promise<void>}
820
984
  */
821
985
  public async setProcolFeeReceiver(
822
986
  address: Address,
823
987
  params?: WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>,
824
988
  ) {
825
- return this.awaitResult(
989
+ return await this.awaitResult(
826
990
  this.setProcolFeeReceiverRaw(address, {
827
991
  ...params,
828
992
  }),
@@ -835,8 +999,8 @@ export class BoostCore extends Deployable<
835
999
  * @public
836
1000
  * @async
837
1001
  * @param {Address} address
838
- * @param {?WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>} [params]
839
- * @returns {unknown}
1002
+ * @param {?WriteParams} [params]
1003
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
840
1004
  */
841
1005
  public async setProcolFeeReceiverRaw(
842
1006
  address: Address,
@@ -845,7 +1009,11 @@ export class BoostCore extends Deployable<
845
1009
  const { request, result } = await simulateBoostCoreSetProtocolFeeReceiver(
846
1010
  this._config,
847
1011
  {
848
- address: this.assertValidAddress(),
1012
+ ...assertValidAddressByChainId(
1013
+ this._config,
1014
+ this.addresses,
1015
+ params?.chainId,
1016
+ ),
849
1017
  args: [address],
850
1018
  ...this.optionallyAttachAccount(),
851
1019
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -860,64 +1028,38 @@ export class BoostCore extends Deployable<
860
1028
  }
861
1029
 
862
1030
  /**
863
- * Get the claim fee.
1031
+ * Retrieves the claim information from a transaction receipt.
864
1032
  *
865
- * @public
866
- * @async
867
- * @param {?ReadParams<typeof boostCoreAbi, 'claimFee'>} [params]
868
- * @returns {unknown}
869
- */
870
- public async claimFee(params?: ReadParams<typeof boostCoreAbi, 'claimFee'>) {
871
- return readBoostCoreClaimFee(this._config, {
872
- address: this.assertValidAddress(),
873
- args: [],
874
- ...this.optionallyAttachAccount(),
875
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
876
- ...(params as any),
877
- });
878
- }
879
-
880
- /**
881
- * Sets the claim fee.
1033
+ * @param {GetTransactionReceiptParameters} params - The parameters required to get the transaction receipt.
1034
+ * @returns {Promise<{ boostId: bigint, incentiveId: bigint, claimer: Address, amount: bigint } | undefined>} The claim information if found, undefined otherwise.
882
1035
  *
883
- * @public
884
- * @async
885
- * @param {bigint} claimFee
886
- * @param {?WriteParams<typeof boostCoreAbi, 'setClaimFee'>} [params]
887
- * @returns {unknown}
888
- */
889
- public async setClaimFee(
890
- claimFee: bigint,
891
- params?: WriteParams<typeof boostCoreAbi, 'setClaimFee'>,
892
- ) {
893
- return this.awaitResult(this.setClaimFeeRaw(claimFee, params));
894
- }
895
-
896
- /**
897
- * Sets the claim fee.
1036
+ * @description
1037
+ * This method retrieves the transaction receipt using the provided parameters,
1038
+ * then parses the logs to find the 'BoostClaimed' event.
1039
+ * If found, it returns the arguments of the event, which include the boost ID,
1040
+ * incentive ID, claimer address, and claimed amount.
898
1041
  *
899
- * @public
900
- * @async
901
- * @param {bigint} claimFee
902
- * @param {?WriteParams<typeof boostCoreAbi, 'setClaimFee'>} [params]
903
- * @returns {unknown}
1042
+ * @example
1043
+ * ```ts
1044
+ * const claimInfo = await boostCore.getClaimFromTransaction({
1045
+ * hash: '0x...',
1046
+ * chainId: 1
1047
+ * });
1048
+ * if (claimInfo) {
1049
+ * console.log(`Boost ${claimInfo.boostId} claimed by ${claimInfo.claimer}`);
1050
+ * }
1051
+ * ```
904
1052
  */
905
- public async setClaimFeeRaw(
906
- claimFee: bigint,
907
- params?: WriteParams<typeof boostCoreAbi, 'setClaimFee'>,
1053
+ public async getClaimFromTransaction(
1054
+ params: GetTransactionReceiptParameters,
908
1055
  ) {
909
- const { request, result } = await simulateBoostCoreSetClaimFee(
910
- this._config,
911
- {
912
- address: this.assertValidAddress(),
913
- args: [claimFee],
914
- ...this.optionallyAttachAccount(),
915
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
916
- ...(params as any),
917
- },
918
- );
919
- const hash = await writeBoostCoreSetClaimFee(this._config, request);
920
- return { hash, result };
1056
+ const receipt = await getTransactionReceipt(this._config, params);
1057
+ const logs = parseEventLogs({
1058
+ abi: boostCoreAbi,
1059
+ eventName: 'BoostClaimed',
1060
+ logs: receipt.logs,
1061
+ });
1062
+ return logs.at(0)?.args;
921
1063
  }
922
1064
 
923
1065
  /**
@@ -928,8 +1070,7 @@ export class BoostCore extends Deployable<
928
1070
  * const auth = core.PassthroughAuth('0x') // is roughly equivalent to
929
1071
  * const auth = new PassthroughAuth({ config: core._config, account: core._account }, '0x')
930
1072
  * ```
931
- * @param {DeployablePayloadOrAddress<{}>} options
932
- * @param {?boolean} [isBase]
1073
+ * @param {Address} address
933
1074
  * @returns {PassthroughAuth}
934
1075
  */
935
1076
  PassthroughAuth(address?: Address) {
@@ -1002,6 +1143,24 @@ export class BoostCore extends Deployable<
1002
1143
  // isBase,
1003
1144
  // );
1004
1145
  // }
1146
+ /**
1147
+ * Bound {@link OpenAllowList} constructor that reuses the same configuration as the Boost Core instance.
1148
+ *
1149
+ * @example
1150
+ * ```ts
1151
+ * const list = core.OpenAllowList('0x') // is roughly equivalent to
1152
+ * const list = new OpenAllowList({ config: core._config, account: core._account }, '0x')
1153
+ * ```
1154
+ * @param {?boolean} [isBase]
1155
+ * @returns {OpenAllowList}
1156
+ */
1157
+ OpenAllowList(isBase?: boolean) {
1158
+ return new OpenAllowList(
1159
+ { config: this._config, account: this._account },
1160
+ undefined,
1161
+ isBase,
1162
+ );
1163
+ }
1005
1164
  /**
1006
1165
  * Bound {@link SimpleAllowList} constructor that reuses the same configuration as the Boost Core instance.
1007
1166
  *
@@ -1206,6 +1365,30 @@ export class BoostCore extends Deployable<
1206
1365
  isBase,
1207
1366
  );
1208
1367
  }
1368
+
1369
+ /**
1370
+ * Bound {@link ERC20VariableCriteriaIncentive} constructor that reuses the same configuration as the Boost Core instance.
1371
+ *
1372
+ * @example
1373
+ * ```ts
1374
+ * const validator = core.ERC20VariableCrtieriaIncentive({ ... }) // is roughly equivalent to
1375
+ * const validator = new ERC20VariableCrtieriaIncentive({ config: core._config, account: core._account }, { ... })
1376
+ * ```
1377
+ * @param {DeployablePayloadOrAddress<ERC20VariableCrtieriaIncentivePayload>} options
1378
+ * @param {?boolean} [isBase]
1379
+ * @returns {ERC20VariableCrtieriaIncentive}
1380
+ * */
1381
+ ERC20VariableCriteriaIncentive(
1382
+ options: DeployablePayloadOrAddress<ERC20VariableCriteriaIncentivePayload>,
1383
+ isBase?: boolean,
1384
+ ) {
1385
+ return new ERC20VariableCriteriaIncentive(
1386
+ { config: this._config, account: this._account },
1387
+ options,
1388
+ isBase,
1389
+ );
1390
+ }
1391
+
1209
1392
  /**
1210
1393
  * Bound {@link ERC20VariableIncentive} constructor that reuses the same configuration as the Boost Core instance.
1211
1394
  *