@boostxyz/sdk 0.0.0-alpha.9 → 1.1.0-alpha.23

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 (254) 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 +2 -2
  4. package/dist/Actions/ContractAction.d.ts +11 -11
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +14 -14
  7. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  8. package/dist/Actions/EventAction.cjs +1 -1
  9. package/dist/Actions/EventAction.cjs.map +1 -1
  10. package/dist/Actions/EventAction.d.ts +174 -41
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +557 -129
  13. package/dist/Actions/EventAction.js.map +1 -1
  14. package/dist/AllowLists/AllowList.cjs +1 -1
  15. package/dist/AllowLists/AllowList.cjs.map +1 -1
  16. package/dist/AllowLists/AllowList.d.ts +6 -4
  17. package/dist/AllowLists/AllowList.d.ts.map +1 -1
  18. package/dist/AllowLists/AllowList.js +45 -23
  19. package/dist/AllowLists/AllowList.js.map +1 -1
  20. package/dist/AllowLists/OpenAllowList.d.ts +423 -0
  21. package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
  22. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  23. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  24. package/dist/AllowLists/SimpleAllowList.d.ts +92 -37
  25. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  26. package/dist/AllowLists/SimpleAllowList.js +60 -75
  27. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  28. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  29. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  30. package/dist/AllowLists/SimpleDenyList.d.ts +203 -11
  31. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  32. package/dist/AllowLists/SimpleDenyList.js +11 -112
  33. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  34. package/dist/Auth/PassthroughAuth.cjs +1 -1
  35. package/dist/Auth/PassthroughAuth.js +1 -1
  36. package/dist/Boost.cjs +1 -1
  37. package/dist/Boost.cjs.map +1 -1
  38. package/dist/Boost.d.ts +20 -21
  39. package/dist/Boost.d.ts.map +1 -1
  40. package/dist/Boost.js +43 -57
  41. package/dist/Boost.js.map +1 -1
  42. package/dist/BoostCore-Btl5BdAs.cjs +3 -0
  43. package/dist/BoostCore-Btl5BdAs.cjs.map +1 -0
  44. package/dist/BoostCore-CD56zbYX.js +2641 -0
  45. package/dist/BoostCore-CD56zbYX.js.map +1 -0
  46. package/dist/BoostCore.cjs +1 -2
  47. package/dist/BoostCore.cjs.map +1 -1
  48. package/dist/BoostCore.d.ts +749 -78
  49. package/dist/BoostCore.d.ts.map +1 -1
  50. package/dist/BoostCore.js +29 -1150
  51. package/dist/BoostCore.js.map +1 -1
  52. package/dist/BoostRegistry.cjs +1 -1
  53. package/dist/BoostRegistry.cjs.map +1 -1
  54. package/dist/BoostRegistry.d.ts +80 -25
  55. package/dist/BoostRegistry.d.ts.map +1 -1
  56. package/dist/BoostRegistry.js +164 -82
  57. package/dist/BoostRegistry.js.map +1 -1
  58. package/dist/Budgets/Budget.cjs +1 -1
  59. package/dist/Budgets/Budget.cjs.map +1 -1
  60. package/dist/Budgets/Budget.d.ts.map +1 -1
  61. package/dist/Budgets/Budget.js +2 -2
  62. package/dist/Budgets/Budget.js.map +1 -1
  63. package/dist/Budgets/ManagedBudget.cjs +1 -1
  64. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  65. package/dist/Budgets/ManagedBudget.d.ts +103 -221
  66. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  67. package/dist/Budgets/ManagedBudget.js +81 -298
  68. package/dist/Budgets/ManagedBudget.js.map +1 -1
  69. package/dist/Budgets/VestingBudget.d.ts +223 -89
  70. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  71. package/dist/Deployable/Contract.cjs +1 -1
  72. package/dist/Deployable/Contract.cjs.map +1 -1
  73. package/dist/Deployable/Contract.d.ts +4 -5
  74. package/dist/Deployable/Contract.d.ts.map +1 -1
  75. package/dist/Deployable/Contract.js +5 -7
  76. package/dist/Deployable/Contract.js.map +1 -1
  77. package/dist/Deployable/Deployable.cjs.map +1 -1
  78. package/dist/Deployable/Deployable.d.ts +1 -1
  79. package/dist/Deployable/Deployable.d.ts.map +1 -1
  80. package/dist/Deployable/Deployable.js +3 -5
  81. package/dist/Deployable/Deployable.js.map +1 -1
  82. package/dist/Deployable/DeployableTarget.cjs +1 -1
  83. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  84. package/dist/Deployable/DeployableTarget.d.ts +13 -13
  85. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  86. package/dist/Deployable/DeployableTarget.js +28 -25
  87. package/dist/Deployable/DeployableTarget.js.map +1 -1
  88. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  89. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  90. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +248 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.js +320 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  94. package/dist/Incentive-CcnOIc8L.cjs +2 -0
  95. package/dist/Incentive-CcnOIc8L.cjs.map +1 -0
  96. package/dist/Incentive-rM5nKznp.js +313 -0
  97. package/dist/Incentive-rM5nKznp.js.map +1 -0
  98. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  99. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  100. package/dist/Incentives/AllowListIncentive.d.ts +38 -16
  101. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  102. package/dist/Incentives/AllowListIncentive.js +43 -29
  103. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  104. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  105. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  106. package/dist/Incentives/CGDAIncentive.d.ts +234 -21
  107. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  108. package/dist/Incentives/CGDAIncentive.js +46 -32
  109. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  110. package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
  111. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  112. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  113. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  114. package/dist/Incentives/ERC20Incentive.d.ts +234 -30
  115. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  116. package/dist/Incentives/ERC20Incentive.js +62 -46
  117. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  118. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +333 -438
  119. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  120. package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
  121. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  122. package/dist/Incentives/Incentive.cjs +1 -1
  123. package/dist/Incentives/Incentive.cjs.map +1 -1
  124. package/dist/Incentives/Incentive.d.ts +4 -4
  125. package/dist/Incentives/Incentive.d.ts.map +1 -1
  126. package/dist/Incentives/Incentive.js +16 -296
  127. package/dist/Incentives/Incentive.js.map +1 -1
  128. package/dist/Incentives/PointsIncentive.cjs +1 -1
  129. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  130. package/dist/Incentives/PointsIncentive.d.ts +40 -18
  131. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  132. package/dist/Incentives/PointsIncentive.js +38 -24
  133. package/dist/Incentives/PointsIncentive.js.map +1 -1
  134. package/dist/SimpleDenyList-BDXpY74P.js +133 -0
  135. package/dist/SimpleDenyList-BDXpY74P.js.map +1 -0
  136. package/dist/SimpleDenyList-DNj5qDWM.cjs +2 -0
  137. package/dist/SimpleDenyList-DNj5qDWM.cjs.map +1 -0
  138. package/dist/Validators/SignerValidator.cjs +1 -1
  139. package/dist/Validators/SignerValidator.cjs.map +1 -1
  140. package/dist/Validators/SignerValidator.d.ts +16 -16
  141. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  142. package/dist/Validators/SignerValidator.js +32 -28
  143. package/dist/Validators/SignerValidator.js.map +1 -1
  144. package/dist/Validators/Validator.cjs +1 -1
  145. package/dist/Validators/Validator.cjs.map +1 -1
  146. package/dist/Validators/Validator.d.ts +1 -1
  147. package/dist/Validators/Validator.js +2 -2
  148. package/dist/Validators/Validator.js.map +1 -1
  149. package/dist/claiming.cjs.map +1 -1
  150. package/dist/claiming.d.ts +1 -1
  151. package/dist/claiming.js.map +1 -1
  152. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  153. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  154. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  155. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  156. package/dist/deployments-DF_6-7hH.cjs +2 -0
  157. package/dist/deployments-DF_6-7hH.cjs.map +1 -0
  158. package/dist/deployments-fJsWblwS.js +56 -0
  159. package/dist/deployments-fJsWblwS.js.map +1 -0
  160. package/dist/deployments.json +58 -0
  161. package/dist/errors.cjs +1 -1
  162. package/dist/errors.cjs.map +1 -1
  163. package/dist/errors.d.ts +256 -20
  164. package/dist/errors.d.ts.map +1 -1
  165. package/dist/errors.js +183 -26
  166. package/dist/errors.js.map +1 -1
  167. package/dist/{generated-57_Kffpz.js → generated-CsNyWPKA.js} +3843 -2084
  168. package/dist/generated-CsNyWPKA.js.map +1 -0
  169. package/dist/generated-DHerxf1y.cjs +3 -0
  170. package/dist/generated-DHerxf1y.cjs.map +1 -0
  171. package/dist/index.cjs +1 -1
  172. package/dist/index.d.ts +5 -0
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +142 -108
  175. package/dist/index.js.map +1 -1
  176. package/dist/transfers.cjs.map +1 -1
  177. package/dist/transfers.d.ts +1 -1
  178. package/dist/transfers.js.map +1 -1
  179. package/dist/utils.cjs +1 -1
  180. package/dist/utils.cjs.map +1 -1
  181. package/dist/utils.d.ts +26 -12
  182. package/dist/utils.d.ts.map +1 -1
  183. package/dist/utils.js +38 -23
  184. package/dist/utils.js.map +1 -1
  185. package/package.json +20 -10
  186. package/src/Actions/Action.test.ts +14 -13
  187. package/src/Actions/ContractAction.test.ts +10 -10
  188. package/src/Actions/ContractAction.ts +11 -12
  189. package/src/Actions/ERC721MintAction.test.ts +6 -6
  190. package/src/Actions/ERC721MintAction.ts +14 -15
  191. package/src/Actions/EventAction.test.ts +735 -109
  192. package/src/Actions/EventAction.ts +527 -88
  193. package/src/AllowLists/AllowList.test.ts +7 -7
  194. package/src/AllowLists/AllowList.ts +5 -3
  195. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  196. package/src/AllowLists/OpenAllowList.ts +45 -0
  197. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  198. package/src/AllowLists/SimpleAllowList.ts +40 -61
  199. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  200. package/src/AllowLists/SimpleDenyList.ts +41 -17
  201. package/src/Auth/PassthroughAuth.test.ts +1 -1
  202. package/src/Boost.ts +21 -24
  203. package/src/BoostCore.test.ts +361 -306
  204. package/src/BoostCore.ts +403 -220
  205. package/src/BoostRegistry.test.ts +53 -0
  206. package/src/BoostRegistry.ts +161 -40
  207. package/src/Budgets/Budget.test.ts +2 -2
  208. package/src/Budgets/Budget.ts +1 -2
  209. package/src/Budgets/ManagedBudget.test.ts +106 -19
  210. package/src/Budgets/ManagedBudget.ts +49 -321
  211. package/src/Budgets/VestingBudget.test.ts +7 -7
  212. package/src/Budgets/VestingBudget.ts +36 -106
  213. package/src/Deployable/Contract.ts +4 -5
  214. package/src/Deployable/Deployable.ts +1 -1
  215. package/src/Deployable/DeployableTarget.ts +30 -19
  216. package/src/Deployable/DeployableTargetWithRBAC.test.ts +103 -0
  217. package/src/Deployable/DeployableTargetWithRBAC.ts +447 -0
  218. package/src/Incentives/AllowListIncentive.test.ts +12 -12
  219. package/src/Incentives/AllowListIncentive.ts +30 -15
  220. package/src/Incentives/CGDAIncentive.test.ts +9 -6
  221. package/src/Incentives/CGDAIncentive.ts +39 -18
  222. package/src/Incentives/ERC1155Incentive.test.ts +3 -3
  223. package/src/Incentives/ERC1155Incentive.ts +30 -29
  224. package/src/Incentives/ERC20Incentive.test.ts +9 -6
  225. package/src/Incentives/ERC20Incentive.ts +54 -27
  226. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  227. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +325 -0
  228. package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
  229. package/src/Incentives/ERC20VariableIncentive.ts +50 -26
  230. package/src/Incentives/Incentive.test.ts +4 -1
  231. package/src/Incentives/Incentive.ts +7 -6
  232. package/src/Incentives/PointsIncentive.test.ts +24 -25
  233. package/src/Incentives/PointsIncentive.ts +32 -17
  234. package/src/Validators/SignerValidator.test.ts +6 -6
  235. package/src/Validators/SignerValidator.ts +20 -17
  236. package/src/Validators/Validator.test.ts +2 -2
  237. package/src/Validators/Validator.ts +1 -1
  238. package/src/claiming.ts +1 -1
  239. package/src/errors.ts +345 -21
  240. package/src/index.test.ts +118 -36
  241. package/src/index.ts +5 -0
  242. package/src/transfers.ts +1 -1
  243. package/src/utils.test.ts +2 -2
  244. package/src/utils.ts +61 -12
  245. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  246. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  247. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  248. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  249. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  250. package/dist/generated-57_Kffpz.js.map +0 -1
  251. package/dist/generated-wKBNvm48.cjs +0 -3
  252. package/dist/generated-wKBNvm48.cjs.map +0 -1
  253. package/src/Budgets/SimpleBudget.test.ts +0 -152
  254. package/src/Budgets/SimpleBudget.ts +0 -564
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,17 +9,22 @@ 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,
@@ -31,9 +35,11 @@ import {
31
35
  zeroAddress,
32
36
  zeroHash,
33
37
  } from 'viem';
38
+ import { BoostCore as BoostCoreBases } from '../dist/deployments.json';
34
39
  import { type Action, actionFromAddress } from './Actions/Action';
35
40
  import { EventAction, type EventActionPayload } from './Actions/EventAction';
36
41
  import { type AllowList, allowListFromAddress } from './AllowLists/AllowList';
42
+ import { OpenAllowList } from './AllowLists/OpenAllowList';
37
43
  import {
38
44
  SimpleAllowList,
39
45
  type SimpleAllowListPayload,
@@ -46,6 +52,7 @@ import { type Auth, PassthroughAuth } from './Auth/Auth';
46
52
  import {
47
53
  Boost,
48
54
  type BoostPayload,
55
+ type RawBoost,
49
56
  type Target,
50
57
  prepareBoostPayload,
51
58
  } from './Boost';
@@ -72,6 +79,10 @@ import {
72
79
  ERC20Incentive,
73
80
  type ERC20IncentivePayload,
74
81
  } from './Incentives/ERC20Incentive';
82
+ import {
83
+ ERC20VariableCriteriaIncentive,
84
+ type ERC20VariableCriteriaIncentivePayload,
85
+ } from './Incentives/ERC20VariableCriteriaIncentive';
75
86
  import type { ERC20VariableIncentivePayload } from './Incentives/ERC20VariableIncentive';
76
87
  import {
77
88
  ERC20VariableIncentive,
@@ -89,13 +100,24 @@ import {
89
100
  import { type Validator, validatorFromAddress } from './Validators/Validator';
90
101
  import {
91
102
  BoostCoreNoIdentifierEmitted,
103
+ BoostNotFoundError,
92
104
  BudgetMustAuthorizeBoostCore,
93
105
  DeployableUnknownOwnerProvidedError,
94
106
  IncentiveNotCloneableError,
95
107
  MustInitializeBudgetError,
96
108
  } from './errors';
97
- import type { GenericLog, ReadParams, WriteParams } from './utils';
109
+ import {
110
+ type GenericLog,
111
+ type ReadParams,
112
+ type WriteParams,
113
+ assertValidAddressByChainId,
114
+ } from './utils';
98
115
 
116
+ /**
117
+ * The ABI of the BoostCore contract, if needed for low level operations
118
+ *
119
+ * @type {typeof boostCoreAbi}
120
+ */
99
121
  export { boostCoreAbi };
100
122
 
101
123
  /**
@@ -106,13 +128,24 @@ export { boostCoreAbi };
106
128
  export const BOOST_CORE_CLAIM_FEE = parseEther('0.000075');
107
129
 
108
130
  /**
109
- * The fixed address for the deployed Boost Core.
110
- * By default, `new BoostCore` will use this address if not otherwise provided.
131
+ * The fixed addresses for the deployed Boost Core.
132
+ * By default, `new BoostCore` will use the address deployed to the currently connected chain, or `BOOST_CORE_ADDRESS` if not provided.
133
+ *
134
+ * @type {Record<number, Address>}
135
+ */
136
+ export const BOOST_CORE_ADDRESSES: Record<number, Address> = {
137
+ 31337: import.meta.env.VITE_BOOST_CORE_ADDRESS,
138
+ ...(BoostCoreBases as Record<number, Address>),
139
+ };
140
+
141
+ /**
142
+ * The address of the deployed BoostCore instance. In prerelease mode, this will be its sepolia address
111
143
  *
112
144
  * @type {Address}
113
145
  */
114
- export const BOOST_CORE_ADDRESS: Address = import.meta.env
115
- .VITE_BOOST_CORE_ADDRESS;
146
+ export const BOOST_CORE_ADDRESS =
147
+ BOOST_CORE_ADDRESSES[__DEFAULT_CHAIN_ID__ as unknown as number] ||
148
+ zeroAddress;
116
149
 
117
150
  /**
118
151
  * A generic `viem.Log` event with support for `BoostCore` event types.
@@ -210,11 +243,10 @@ export type BoostCoreConfig =
210
243
  export type CreateBoostPayload = {
211
244
  budget: Budget;
212
245
  action: Action;
213
- validator: Validator;
214
- allowList: AllowList;
246
+ validator?: Validator;
247
+ allowList?: AllowList;
215
248
  incentives: Array<Incentive>;
216
249
  protocolFee?: bigint;
217
- referralFee?: bigint;
218
250
  maxParticipants?: bigint;
219
251
  owner?: Address;
220
252
  };
@@ -231,6 +263,26 @@ export class BoostCore extends Deployable<
231
263
  [Address, Address],
232
264
  typeof boostCoreAbi
233
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
+
234
286
  /**
235
287
  * Creates an instance of BoostCore.
236
288
  *
@@ -249,63 +301,157 @@ export class BoostCore extends Deployable<
249
301
  options.protocolFeeReceiver,
250
302
  ]);
251
303
  } else {
252
- super({ account, config }, BOOST_CORE_ADDRESS);
304
+ const { address } = assertValidAddressByChainId(
305
+ config,
306
+ BOOST_CORE_ADDRESSES,
307
+ );
308
+ super({ account, config }, address);
253
309
  }
254
310
  //@ts-expect-error I can't set this property on the class because for some reason it takes super out of constructor scope?
255
311
  this.abi = boostCoreAbi;
256
312
  }
313
+
257
314
  /**
258
315
  * Create a new Boost.
259
316
  *
260
317
  * @public
261
318
  * @async
262
319
  * @param {CreateBoostPayload} _boostPayload
263
- * @param {?DeployableOptions} [_options]
264
- * @returns {Boost}
320
+ * @param {?DeployableOptions} [_params]
321
+ * @returns {Promise<Boost>}
265
322
  */
266
323
  public async createBoost(
267
324
  _boostPayload: CreateBoostPayload,
268
- _options?: DeployableOptions,
325
+ _params?: DeployableOptions &
326
+ WriteParams<typeof boostCoreAbi, 'createBoost'>,
269
327
  ) {
270
- const coreAddress = this.assertValidAddress();
271
328
  const [payload, options] =
272
- this.validateDeploymentConfig<CreateBoostPayload>(
273
- _boostPayload,
274
- _options,
275
- );
276
-
277
- let {
278
- budget,
279
- action,
280
- validator,
281
- allowList,
282
- incentives,
283
- protocolFee = 0n,
284
- referralFee = 0n,
285
- maxParticipants = 0n,
286
- owner,
287
- } = 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
+ );
288
336
 
289
337
  const boostFactory = createWriteContract({
290
338
  abi: boostCoreAbi,
291
339
  functionName: 'createBoost',
292
- address: this.address,
340
+ address: coreAddress,
341
+ });
342
+
343
+ const onChainPayload = await this.prepareCreateBoostPayload(
344
+ coreAddress,
345
+ chainId,
346
+ payload,
347
+ options,
348
+ );
349
+
350
+ console.log(onChainPayload);
351
+
352
+ const boostHash = await boostFactory(options.config, {
353
+ ...this.optionallyAttachAccount(options.account),
354
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
355
+ ...(_params as any),
356
+ chainId,
357
+ args: [prepareBoostPayload(onChainPayload)],
358
+ });
359
+ const receipt = await waitForTransactionReceipt(options.config, {
360
+ hash: boostHash,
361
+ });
362
+ const boostCreatedLog = parseEventLogs({
363
+ abi: boostCoreAbi,
364
+ eventName: 'BoostCreated',
365
+ logs: receipt.logs,
366
+ }).at(0);
367
+ let boostId = 0n;
368
+ if (!boostCreatedLog) throw new BoostCoreNoIdentifierEmitted();
369
+ boostId = boostCreatedLog?.args.boostId;
370
+ const boost = await this.readBoost(boostId);
371
+ return new Boost({
372
+ id: boostId,
373
+ budget: payload.budget.at(boost.budget),
374
+ action: payload.action.at(boost.action),
375
+ validator: payload.validator!.at(boost.validator),
376
+ allowList: payload.allowList!.at(boost.allowList),
377
+ incentives: payload.incentives.map((incentive, i) =>
378
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
379
+ incentive.at(boost.incentives.at(i)!),
380
+ ),
381
+ protocolFee: boost.protocolFee,
382
+ maxParticipants: boost.maxParticipants,
383
+ owner: boost.owner,
293
384
  });
385
+ }
294
386
 
295
- if (!owner) {
296
- owner =
387
+ /**
388
+ * Returns a simulated Boost creation.
389
+ *
390
+ * @public
391
+ * @async
392
+ * @param {CreateBoostPayload} _boostPayload
393
+ * @param {?DeployableOptions} [_params]
394
+ * @returns {Promise<SimulateContractReturnType>}
395
+ */
396
+ public async simulateCreateBoost(
397
+ _boostPayload: CreateBoostPayload,
398
+ _params?: DeployableOptions &
399
+ WriteParams<typeof boostCoreAbi, 'createBoost'>,
400
+ ) {
401
+ const [payload, options] =
402
+ this.validateDeploymentConfig<CreateBoostPayload>(_boostPayload, _params);
403
+ const desiredChainId = _params?.chain?.id || _params?.chainId;
404
+ const { chainId, address: coreAddress } = assertValidAddressByChainId(
405
+ options.config,
406
+ this.addresses,
407
+ desiredChainId,
408
+ );
409
+
410
+ const onChainPayload = await this.prepareCreateBoostPayload(
411
+ coreAddress,
412
+ chainId,
413
+ payload,
414
+ options,
415
+ );
416
+
417
+ return await simulateBoostCoreCreateBoost(this._config, {
418
+ ...this.optionallyAttachAccount(),
419
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
420
+ ...(_params as any),
421
+ address: coreAddress,
422
+ chainId,
423
+ args: [prepareBoostPayload(onChainPayload)],
424
+ });
425
+ }
426
+
427
+ // This function mutates payload, which isn't awesome but it's fine
428
+ private async prepareCreateBoostPayload(
429
+ coreAddress: Address,
430
+ chainId: number,
431
+ payload: CreateBoostPayload,
432
+ options: DeployableOptions,
433
+ ): Promise<Required<BoostPayload>> {
434
+ if (!payload.owner) {
435
+ payload.owner =
297
436
  this._account?.address ||
298
437
  getAccount(options.config).address ||
299
438
  zeroAddress;
300
- if (owner === zeroAddress) {
439
+ if (payload.owner === zeroAddress) {
301
440
  throw new DeployableUnknownOwnerProvidedError();
302
441
  }
303
442
  }
304
443
 
444
+ if (!payload.validator) {
445
+ payload.validator = this.SignerValidator({
446
+ signers: [payload.owner],
447
+ validatorCaller: coreAddress,
448
+ });
449
+ }
450
+
305
451
  let budgetPayload: BoostPayload['budget'] = zeroAddress;
306
- if (budget.address) {
307
- budgetPayload = budget.address;
308
- if (!(await budget.isAuthorized(coreAddress))) {
452
+ if (payload.budget.address) {
453
+ budgetPayload = payload.budget.address;
454
+ if (!(await payload.budget.isAuthorized(coreAddress))) {
309
455
  throw new BudgetMustAuthorizeBoostCore(coreAddress);
310
456
  }
311
457
  } else {
@@ -319,19 +465,25 @@ export class BoostCore extends Deployable<
319
465
  isBase: true,
320
466
  parameters: zeroHash,
321
467
  };
322
- if (action.address) {
323
- const isBase = action.address === action.base || action.isBase;
468
+ if (payload.action.address) {
469
+ const isBase = payload.action.isBase;
324
470
  actionPayload = {
325
471
  isBase: isBase,
326
- instance: action.address,
472
+ instance: payload.action.address,
327
473
  parameters: isBase
328
- ? action.buildParameters(undefined, options).args.at(0) || zeroHash
474
+ ? payload.action.buildParameters(undefined, options).args.at(0) ||
475
+ zeroHash
329
476
  : zeroHash,
330
477
  };
331
478
  } else {
332
479
  actionPayload.parameters =
333
- action.buildParameters(undefined, options).args.at(0) || zeroHash;
334
- actionPayload.instance = action.base;
480
+ payload.action.buildParameters(undefined, options).args.at(0) ||
481
+ zeroHash;
482
+ actionPayload.instance = assertValidAddressByChainId(
483
+ options.config,
484
+ payload.action.bases,
485
+ chainId,
486
+ ).address;
335
487
  }
336
488
 
337
489
  let validatorPayload: BoostPayload['validator'] = {
@@ -339,35 +491,25 @@ export class BoostCore extends Deployable<
339
491
  isBase: true,
340
492
  parameters: zeroHash,
341
493
  };
342
- if (validator.address) {
343
- const isBase = validator.address === validator.base || validator.isBase;
494
+ if (payload.validator.address) {
495
+ const isBase = payload.validator.isBase;
344
496
  validatorPayload = {
345
497
  isBase: isBase,
346
- instance: validator.address,
498
+ instance: payload.validator.address,
347
499
  parameters: isBase
348
- ? validator
349
- .buildParameters(
350
- {
351
- signers: [owner],
352
- validatorCaller: coreAddress,
353
- },
354
- options,
355
- )
356
- .args.at(0) || zeroHash
500
+ ? payload.validator.buildParameters(undefined, options).args.at(0) ||
501
+ zeroHash
357
502
  : zeroHash,
358
503
  };
359
504
  } else {
360
505
  validatorPayload.parameters =
361
- validator
362
- .buildParameters(
363
- {
364
- signers: [owner],
365
- validatorCaller: coreAddress,
366
- },
367
- options,
368
- )
369
- .args.at(0) || zeroHash;
370
- validatorPayload.instance = validator.base;
506
+ payload.validator.buildParameters(undefined, options).args.at(0) ||
507
+ zeroHash;
508
+ validatorPayload.instance = assertValidAddressByChainId(
509
+ options.config,
510
+ payload.validator.bases,
511
+ chainId,
512
+ ).address;
371
513
  }
372
514
 
373
515
  let allowListPayload: BoostPayload['allowList'] = {
@@ -375,31 +517,40 @@ export class BoostCore extends Deployable<
375
517
  isBase: true,
376
518
  parameters: zeroHash,
377
519
  };
378
- if (allowList.address) {
379
- const isBase = allowList.address === allowList.base || allowList.isBase;
520
+ // if allowlist not provided, assume open allowlist
521
+ if (!payload.allowList) {
522
+ payload.allowList = this.OpenAllowList();
523
+ }
524
+ if (payload.allowList.address) {
525
+ const isBase = payload.allowList.isBase;
380
526
  allowListPayload = {
381
527
  isBase: isBase,
382
- instance: allowList.address,
528
+ instance: payload.allowList.address,
383
529
  parameters: isBase
384
530
  ? zeroHash // allowList.buildParameters(undefined, options).args.at(0) || zeroHash
385
531
  : zeroHash,
386
532
  };
387
533
  } else {
388
534
  allowListPayload.parameters =
389
- allowList.buildParameters(undefined, options).args.at(0) || zeroHash;
390
- allowListPayload.instance = allowList.base;
535
+ payload.allowList.buildParameters(undefined, options).args.at(0) ||
536
+ zeroHash;
537
+ allowListPayload.instance = assertValidAddressByChainId(
538
+ options.config,
539
+ payload.allowList.bases,
540
+ chainId,
541
+ ).address;
391
542
  }
392
543
 
393
- let incentivesPayloads: Array<Target> = incentives.map(() => ({
544
+ const incentivesPayloads: Array<Target> = payload.incentives.map(() => ({
394
545
  instance: zeroAddress,
395
546
  isBase: true,
396
547
  parameters: zeroHash,
397
548
  }));
398
- for (let i = 0; i < incentives.length; i++) {
549
+ for (let i = 0; i < payload.incentives.length; i++) {
399
550
  // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
400
- const incentive = incentives.at(i)!;
551
+ const incentive = payload.incentives.at(i)!;
401
552
  if (incentive.address) {
402
- const isBase = incentive.address === incentive.base || incentive.isBase;
553
+ const isBase = incentive.isBase;
403
554
  if (!isBase) throw new IncentiveNotCloneableError(incentive);
404
555
  incentivesPayloads[i] = {
405
556
  isBase: isBase,
@@ -414,7 +565,11 @@ export class BoostCore extends Deployable<
414
565
  incentivesPayloads[i]!.parameters =
415
566
  incentive.buildParameters(undefined, options).args.at(0) || zeroHash;
416
567
  // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
417
- incentivesPayloads[i]!.instance = incentive.base;
568
+ incentivesPayloads[i]!.instance = assertValidAddressByChainId(
569
+ options.config,
570
+ incentive.bases,
571
+ chainId,
572
+ ).address;
418
573
  }
419
574
  }
420
575
 
@@ -424,43 +579,12 @@ export class BoostCore extends Deployable<
424
579
  validator: validatorPayload,
425
580
  allowList: allowListPayload,
426
581
  incentives: incentivesPayloads,
427
- protocolFee,
428
- referralFee,
429
- maxParticipants,
430
- owner,
582
+ protocolFee: payload.protocolFee || 0n,
583
+ maxParticipants: payload.maxParticipants || 0n,
584
+ owner: payload.owner,
431
585
  };
432
586
 
433
- const boostHash = await boostFactory(options.config, {
434
- args: [prepareBoostPayload(onChainPayload)],
435
- ...this.optionallyAttachAccount(options.account),
436
- });
437
- const receipt = await waitForTransactionReceipt(options.config, {
438
- hash: boostHash,
439
- });
440
- const boostCreatedLog = parseEventLogs({
441
- abi: boostCoreAbi,
442
- eventName: 'BoostCreated',
443
- logs: receipt.logs,
444
- }).at(0);
445
- let boostId = 0n;
446
- if (!boostCreatedLog) throw new BoostCoreNoIdentifierEmitted();
447
- boostId = boostCreatedLog?.args.boostIndex;
448
- const boost = await this.readBoost(boostId);
449
- return new Boost({
450
- id: boostId,
451
- budget: budget.at(boost.budget),
452
- action: action.at(boost.action),
453
- validator: validator.at(boost.validator),
454
- allowList: allowList.at(boost.allowList),
455
- incentives: incentives.map((incentive, i) =>
456
- // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
457
- incentive.at(boost.incentives.at(i)!),
458
- ),
459
- protocolFee: boost.protocolFee,
460
- referralFee: boost.referralFee,
461
- maxParticipants: boost.maxParticipants,
462
- owner: boost.owner,
463
- });
587
+ return onChainPayload;
464
588
  }
465
589
 
466
590
  /**
@@ -472,8 +596,8 @@ export class BoostCore extends Deployable<
472
596
  * @param {bigint} incentiveId
473
597
  * @param {Address} address
474
598
  * @param {Hex} data
475
- * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentive'>} [params]
476
- * @returns {unknown}
599
+ * @param {?WriteParams} [params]
600
+ * @returns {Promise<void>}
477
601
  */
478
602
  public async claimIncentive(
479
603
  boostId: bigint,
@@ -496,8 +620,8 @@ export class BoostCore extends Deployable<
496
620
  * @param {bigint} incentiveId - The ID of the Incentive
497
621
  * @param {Address} referrer - The address of the referrer (if any)
498
622
  * @param {Hex} data- The data for the claim
499
- * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentive'>} [params]
500
- * @returns {unknown}
623
+ * @param {?WriteParams} [params]
624
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
501
625
  */
502
626
  public async claimIncentiveRaw(
503
627
  boostId: bigint,
@@ -509,7 +633,11 @@ export class BoostCore extends Deployable<
509
633
  const { request, result } = await simulateBoostCoreClaimIncentive(
510
634
  this._config,
511
635
  {
512
- address: this.assertValidAddress(),
636
+ ...assertValidAddressByChainId(
637
+ this._config,
638
+ this.addresses,
639
+ params?.chain?.id || params?.chainId,
640
+ ),
513
641
  args: [boostId, incentiveId, referrer, data],
514
642
  ...this.optionallyAttachAccount(),
515
643
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -530,8 +658,8 @@ export class BoostCore extends Deployable<
530
658
  * @param {Address} referrer
531
659
  * @param {Hex} data
532
660
  * @param {Address} claimant
533
- * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>} [params]
534
- * @returns {unknown}
661
+ * @param {?WriteParams} [params]
662
+ * @returns {Promise<void>}
535
663
  */
536
664
  public async claimIncentiveFor(
537
665
  boostId: bigint,
@@ -563,8 +691,8 @@ export class BoostCore extends Deployable<
563
691
  * @param {Address} referrer - The address of the referrer (if any)
564
692
  * @param {Hex} data - The data for the claim
565
693
  * @param {Address} claimant - The address of the user eligible for the incentive payout
566
- * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>} [params]
567
- * @returns {unknown}
694
+ * @param {?WriteParams} [params]
695
+ * @returns {Promise<{ hash: Hex; result: void; }>}
568
696
  */
569
697
  public async claimIncentiveForRaw(
570
698
  boostId: bigint,
@@ -577,7 +705,11 @@ export class BoostCore extends Deployable<
577
705
  const { request, result } = await simulateBoostCoreClaimIncentiveFor(
578
706
  this._config,
579
707
  {
580
- address: this.assertValidAddress(),
708
+ ...assertValidAddressByChainId(
709
+ this._config,
710
+ this.addresses,
711
+ params?.chain?.id || params?.chainId,
712
+ ),
581
713
  args: [boostId, incentiveId, referrer, data, claimant],
582
714
  ...this.optionallyAttachAccount(),
583
715
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -593,21 +725,37 @@ export class BoostCore extends Deployable<
593
725
  *
594
726
  * @public
595
727
  * @async
596
- * @param {bigint} id
597
- * @param {?ReadParams<typeof boostCoreAbi, 'getBoost'>} [params]
598
- * @returns {unknown}
728
+ * @param {bigint | string} id
729
+ * @param {?ReadParams} [params]
730
+ * @returns {Promise<RawBoost>}
731
+ * @throws {@link BoostNotFoundError}
599
732
  */
600
733
  public async readBoost(
601
- id: bigint,
734
+ _id: string | bigint,
602
735
  params?: ReadParams<typeof boostCoreAbi, 'getBoost'>,
603
- ) {
604
- return await readBoostCoreGetBoost(this._config, {
605
- address: this.assertValidAddress(),
606
- args: [id],
607
- ...this.optionallyAttachAccount(),
608
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
609
- ...(params as any),
610
- });
736
+ ): Promise<RawBoost> {
737
+ try {
738
+ let id: bigint;
739
+ if (typeof _id === 'string') {
740
+ id = BigInt(_id);
741
+ } else id = _id;
742
+ return await readBoostCoreGetBoost(this._config, {
743
+ ...assertValidAddressByChainId(
744
+ this._config,
745
+ this.addresses,
746
+ params?.chainId,
747
+ ),
748
+ args: [id],
749
+ ...this.optionallyAttachAccount(),
750
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
751
+ ...(params as any),
752
+ });
753
+ // biome-ignore lint/suspicious/noExplicitAny: unknown error
754
+ } catch (e: any) {
755
+ if (e?.message?.includes('bounds'))
756
+ throw new BoostNotFoundError(String(_id));
757
+ throw e;
758
+ }
611
759
  }
612
760
 
613
761
  /**
@@ -616,8 +764,9 @@ export class BoostCore extends Deployable<
616
764
  * @public
617
765
  * @async
618
766
  * @param {(string | bigint)} _id
619
- * @param {?ReadParams<typeof boostCoreAbi, 'getBoost'>} [params]
620
- * @returns {unknown}
767
+ * @param {?ReadParams} [params]
768
+ * @returns {Promise<Boost>}
769
+ * @throws {@link BoostNotFoundError}
621
770
  */
622
771
  public async getBoost(
623
772
  _id: string | bigint,
@@ -627,13 +776,8 @@ export class BoostCore extends Deployable<
627
776
  if (typeof _id === 'string') {
628
777
  id = BigInt(_id);
629
778
  } else id = _id;
630
- const {
631
- protocolFee,
632
- referralFee,
633
- maxParticipants,
634
- owner,
635
- ...boostPayload
636
- } = await this.readBoost(id, params);
779
+ const { protocolFee, maxParticipants, owner, ...boostPayload } =
780
+ await this.readBoost(id, params);
637
781
  const options: DeployableOptions = {
638
782
  config: this._config,
639
783
  account: this._account,
@@ -658,7 +802,6 @@ export class BoostCore extends Deployable<
658
802
  allowList,
659
803
  incentives,
660
804
  protocolFee,
661
- referralFee,
662
805
  maxParticipants,
663
806
  owner,
664
807
  });
@@ -669,14 +812,18 @@ export class BoostCore extends Deployable<
669
812
  *
670
813
  * @public
671
814
  * @async
672
- * @param {?ReadParams<typeof boostCoreAbi, 'getBoostCount'>} [params]
815
+ * @param {?ReadParams} [params]
673
816
  * @returns {Promise<bigint>}
674
817
  */
675
818
  public async getBoostCount(
676
819
  params?: ReadParams<typeof boostCoreAbi, 'getBoostCount'>,
677
820
  ) {
678
821
  return await readBoostCoreGetBoostCount(this._config, {
679
- address: this.assertValidAddress(),
822
+ ...assertValidAddressByChainId(
823
+ this._config,
824
+ this.addresses,
825
+ params?.chainId,
826
+ ),
680
827
  args: [],
681
828
  ...this.optionallyAttachAccount(),
682
829
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -690,7 +837,7 @@ export class BoostCore extends Deployable<
690
837
  * @public
691
838
  * @async
692
839
  * @param {Address} address
693
- * @param {?ReadParams<typeof boostCoreAbi, 'createBoostAuth'> &
840
+ * @param {?ReadParams &
694
841
  * ReadParams<typeof iAuthAbi, 'isAuthorized'>} [params]
695
842
  * @returns {Promise<boolean>}
696
843
  */
@@ -699,7 +846,7 @@ export class BoostCore extends Deployable<
699
846
  params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'> &
700
847
  ReadParams<typeof iAuthAbi, 'isAuthorized'>,
701
848
  ) {
702
- const auth = await this.createBoostAuth();
849
+ const auth = await this.createBoostAuth(params);
703
850
  return readIAuthIsAuthorized(this._config, {
704
851
  address: auth,
705
852
  args: [address],
@@ -714,14 +861,18 @@ export class BoostCore extends Deployable<
714
861
  *
715
862
  * @public
716
863
  * @async
717
- * @param {?ReadParams<typeof boostCoreAbi, 'createBoostAuth'>} [params]
718
- * @returns {unknown}
864
+ * @param {?ReadParams} [params]
865
+ * @returns {Promise<Address>}
719
866
  */
720
867
  public async createBoostAuth(
721
868
  params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'>,
722
869
  ) {
723
870
  return await readBoostCoreCreateBoostAuth(this._config, {
724
- address: this.assertValidAddress(),
871
+ ...assertValidAddressByChainId(
872
+ this._config,
873
+ this.addresses,
874
+ params?.chainId,
875
+ ),
725
876
  args: [],
726
877
  ...this.optionallyAttachAccount(),
727
878
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -735,8 +886,8 @@ export class BoostCore extends Deployable<
735
886
  * @public
736
887
  * @async
737
888
  * @param {Auth} auth
738
- * @param {?WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>} [params]
739
- * @returns {unknown}
889
+ * @param {?WriteParams} [params]
890
+ * @returns {Promise<void>}
740
891
  */
741
892
  public async setCreateBoostAuth(
742
893
  auth: Auth,
@@ -755,8 +906,8 @@ export class BoostCore extends Deployable<
755
906
  * @public
756
907
  * @async
757
908
  * @param {Address} address
758
- * @param {?WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>} [params]
759
- * @returns {unknown}
909
+ * @param {?WriteParams} [params]
910
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
760
911
  */
761
912
  public async setCreateBoostAuthRaw(
762
913
  address: Address,
@@ -765,7 +916,11 @@ export class BoostCore extends Deployable<
765
916
  const { request, result } = await simulateBoostCoreSetCreateBoostAuth(
766
917
  this._config,
767
918
  {
768
- address: this.assertValidAddress(),
919
+ ...assertValidAddressByChainId(
920
+ this._config,
921
+ this.addresses,
922
+ params?.chainId,
923
+ ),
769
924
  args: [address],
770
925
  ...this.optionallyAttachAccount(),
771
926
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -781,14 +936,18 @@ export class BoostCore extends Deployable<
781
936
  *
782
937
  * @public
783
938
  * @async
784
- * @param {?ReadParams<typeof boostCoreAbi, 'protocolFee'>} [params]
939
+ * @param {?ReadParams} [params]
785
940
  * @returns {unknown}
786
941
  */
787
942
  public async protocolFee(
788
943
  params?: ReadParams<typeof boostCoreAbi, 'protocolFee'>,
789
944
  ) {
790
945
  return await readBoostCoreProtocolFee(this._config, {
791
- address: this.assertValidAddress(),
946
+ ...assertValidAddressByChainId(
947
+ this._config,
948
+ this.addresses,
949
+ params?.chainId,
950
+ ),
792
951
  args: [],
793
952
  ...this.optionallyAttachAccount(),
794
953
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -801,14 +960,18 @@ export class BoostCore extends Deployable<
801
960
  *
802
961
  * @public
803
962
  * @async
804
- * @param {?ReadParams<typeof boostCoreAbi, 'protocolFeeReceiver'>} [params]
805
- * @returns {unknown}
963
+ * @param {?ReadParams} [params]
964
+ * @returns {Promise<Address>}
806
965
  */
807
966
  public async protocolFeeReceiver(
808
967
  params?: ReadParams<typeof boostCoreAbi, 'protocolFeeReceiver'>,
809
968
  ) {
810
969
  return await readBoostCoreProtocolFeeReceiver(this._config, {
811
- address: this.assertValidAddress(),
970
+ ...assertValidAddressByChainId(
971
+ this._config,
972
+ this.addresses,
973
+ params?.chainId,
974
+ ),
812
975
  args: [],
813
976
  ...this.optionallyAttachAccount(),
814
977
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -822,8 +985,8 @@ export class BoostCore extends Deployable<
822
985
  * @public
823
986
  * @async
824
987
  * @param {Address} address
825
- * @param {?WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>} [params]
826
- * @returns {unknown}
988
+ * @param {?WriteParams} [params]
989
+ * @returns {Promise<void>}
827
990
  */
828
991
  public async setProcolFeeReceiver(
829
992
  address: Address,
@@ -842,8 +1005,8 @@ export class BoostCore extends Deployable<
842
1005
  * @public
843
1006
  * @async
844
1007
  * @param {Address} address
845
- * @param {?WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>} [params]
846
- * @returns {unknown}
1008
+ * @param {?WriteParams} [params]
1009
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
847
1010
  */
848
1011
  public async setProcolFeeReceiverRaw(
849
1012
  address: Address,
@@ -852,7 +1015,11 @@ export class BoostCore extends Deployable<
852
1015
  const { request, result } = await simulateBoostCoreSetProtocolFeeReceiver(
853
1016
  this._config,
854
1017
  {
855
- address: this.assertValidAddress(),
1018
+ ...assertValidAddressByChainId(
1019
+ this._config,
1020
+ this.addresses,
1021
+ params?.chainId,
1022
+ ),
856
1023
  args: [address],
857
1024
  ...this.optionallyAttachAccount(),
858
1025
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
@@ -867,64 +1034,38 @@ export class BoostCore extends Deployable<
867
1034
  }
868
1035
 
869
1036
  /**
870
- * Get the claim fee.
1037
+ * Retrieves the claim information from a transaction receipt.
871
1038
  *
872
- * @public
873
- * @async
874
- * @param {?ReadParams<typeof boostCoreAbi, 'claimFee'>} [params]
875
- * @returns {unknown}
876
- */
877
- public async claimFee(params?: ReadParams<typeof boostCoreAbi, 'claimFee'>) {
878
- return await readBoostCoreClaimFee(this._config, {
879
- address: this.assertValidAddress(),
880
- args: [],
881
- ...this.optionallyAttachAccount(),
882
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
883
- ...(params as any),
884
- });
885
- }
886
-
887
- /**
888
- * Sets the claim fee.
1039
+ * @param {GetTransactionReceiptParameters} params - The parameters required to get the transaction receipt.
1040
+ * @returns {Promise<{ boostId: bigint, incentiveId: bigint, claimer: Address, amount: bigint } | undefined>} The claim information if found, undefined otherwise.
889
1041
  *
890
- * @public
891
- * @async
892
- * @param {bigint} claimFee
893
- * @param {?WriteParams<typeof boostCoreAbi, 'setClaimFee'>} [params]
894
- * @returns {unknown}
895
- */
896
- public async setClaimFee(
897
- claimFee: bigint,
898
- params?: WriteParams<typeof boostCoreAbi, 'setClaimFee'>,
899
- ) {
900
- return await this.awaitResult(this.setClaimFeeRaw(claimFee, params));
901
- }
902
-
903
- /**
904
- * Sets the claim fee.
1042
+ * @description
1043
+ * This method retrieves the transaction receipt using the provided parameters,
1044
+ * then parses the logs to find the 'BoostClaimed' event.
1045
+ * If found, it returns the arguments of the event, which include the boost ID,
1046
+ * incentive ID, claimer address, and claimed amount.
905
1047
  *
906
- * @public
907
- * @async
908
- * @param {bigint} claimFee
909
- * @param {?WriteParams<typeof boostCoreAbi, 'setClaimFee'>} [params]
910
- * @returns {unknown}
1048
+ * @example
1049
+ * ```ts
1050
+ * const claimInfo = await boostCore.getClaimFromTransaction({
1051
+ * hash: '0x...',
1052
+ * chainId: 1
1053
+ * });
1054
+ * if (claimInfo) {
1055
+ * console.log(`Boost ${claimInfo.boostId} claimed by ${claimInfo.claimer}`);
1056
+ * }
1057
+ * ```
911
1058
  */
912
- public async setClaimFeeRaw(
913
- claimFee: bigint,
914
- params?: WriteParams<typeof boostCoreAbi, 'setClaimFee'>,
1059
+ public async getClaimFromTransaction(
1060
+ params: GetTransactionReceiptParameters,
915
1061
  ) {
916
- const { request, result } = await simulateBoostCoreSetClaimFee(
917
- this._config,
918
- {
919
- address: this.assertValidAddress(),
920
- args: [claimFee],
921
- ...this.optionallyAttachAccount(),
922
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
923
- ...(params as any),
924
- },
925
- );
926
- const hash = await writeBoostCoreSetClaimFee(this._config, request);
927
- return { hash, result };
1062
+ const receipt = await getTransactionReceipt(this._config, params);
1063
+ const logs = parseEventLogs({
1064
+ abi: boostCoreAbi,
1065
+ eventName: 'BoostClaimed',
1066
+ logs: receipt.logs,
1067
+ });
1068
+ return logs.at(0)?.args;
928
1069
  }
929
1070
 
930
1071
  /**
@@ -1008,6 +1149,24 @@ export class BoostCore extends Deployable<
1008
1149
  // isBase,
1009
1150
  // );
1010
1151
  // }
1152
+ /**
1153
+ * Bound {@link OpenAllowList} constructor that reuses the same configuration as the Boost Core instance.
1154
+ *
1155
+ * @example
1156
+ * ```ts
1157
+ * const list = core.OpenAllowList('0x') // is roughly equivalent to
1158
+ * const list = new OpenAllowList({ config: core._config, account: core._account }, '0x')
1159
+ * ```
1160
+ * @param {?boolean} [isBase]
1161
+ * @returns {OpenAllowList}
1162
+ */
1163
+ OpenAllowList(isBase?: boolean) {
1164
+ return new OpenAllowList(
1165
+ { config: this._config, account: this._account },
1166
+ undefined,
1167
+ isBase,
1168
+ );
1169
+ }
1011
1170
  /**
1012
1171
  * Bound {@link SimpleAllowList} constructor that reuses the same configuration as the Boost Core instance.
1013
1172
  *
@@ -1212,6 +1371,30 @@ export class BoostCore extends Deployable<
1212
1371
  isBase,
1213
1372
  );
1214
1373
  }
1374
+
1375
+ /**
1376
+ * Bound {@link ERC20VariableCriteriaIncentive} constructor that reuses the same configuration as the Boost Core instance.
1377
+ *
1378
+ * @example
1379
+ * ```ts
1380
+ * const validator = core.ERC20VariableCrtieriaIncentive({ ... }) // is roughly equivalent to
1381
+ * const validator = new ERC20VariableCrtieriaIncentive({ config: core._config, account: core._account }, { ... })
1382
+ * ```
1383
+ * @param {DeployablePayloadOrAddress<ERC20VariableCrtieriaIncentivePayload>} options
1384
+ * @param {?boolean} [isBase]
1385
+ * @returns {ERC20VariableCrtieriaIncentive}
1386
+ * */
1387
+ ERC20VariableCriteriaIncentive(
1388
+ options: DeployablePayloadOrAddress<ERC20VariableCriteriaIncentivePayload>,
1389
+ isBase?: boolean,
1390
+ ) {
1391
+ return new ERC20VariableCriteriaIncentive(
1392
+ { config: this._config, account: this._account },
1393
+ options,
1394
+ isBase,
1395
+ );
1396
+ }
1397
+
1215
1398
  /**
1216
1399
  * Bound {@link ERC20VariableIncentive} constructor that reuses the same configuration as the Boost Core instance.
1217
1400
  *