@boostxyz/sdk 0.0.0-alpha.10

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 (242) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +7 -0
  3. package/dist/Actions/Action.cjs +2 -0
  4. package/dist/Actions/Action.cjs.map +1 -0
  5. package/dist/Actions/Action.d.ts +31 -0
  6. package/dist/Actions/Action.d.ts.map +1 -0
  7. package/dist/Actions/Action.js +29 -0
  8. package/dist/Actions/Action.js.map +1 -0
  9. package/dist/Actions/ContractAction.d.ts +370 -0
  10. package/dist/Actions/ContractAction.d.ts.map +1 -0
  11. package/dist/Actions/ERC721MintAction.d.ts +513 -0
  12. package/dist/Actions/ERC721MintAction.d.ts.map +1 -0
  13. package/dist/Actions/EventAction.cjs +2 -0
  14. package/dist/Actions/EventAction.cjs.map +1 -0
  15. package/dist/Actions/EventAction.d.ts +694 -0
  16. package/dist/Actions/EventAction.d.ts.map +1 -0
  17. package/dist/Actions/EventAction.js +491 -0
  18. package/dist/Actions/EventAction.js.map +1 -0
  19. package/dist/AllowLists/AllowList.cjs +2 -0
  20. package/dist/AllowLists/AllowList.cjs.map +1 -0
  21. package/dist/AllowLists/AllowList.d.ts +32 -0
  22. package/dist/AllowLists/AllowList.d.ts.map +1 -0
  23. package/dist/AllowLists/AllowList.js +30 -0
  24. package/dist/AllowLists/AllowList.js.map +1 -0
  25. package/dist/AllowLists/SimpleAllowList.cjs +2 -0
  26. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
  27. package/dist/AllowLists/SimpleAllowList.d.ts +481 -0
  28. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -0
  29. package/dist/AllowLists/SimpleAllowList.js +154 -0
  30. package/dist/AllowLists/SimpleAllowList.js.map +1 -0
  31. package/dist/AllowLists/SimpleDenyList.cjs +2 -0
  32. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
  33. package/dist/AllowLists/SimpleDenyList.d.ts +335 -0
  34. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -0
  35. package/dist/AllowLists/SimpleDenyList.js +115 -0
  36. package/dist/AllowLists/SimpleDenyList.js.map +1 -0
  37. package/dist/Auth/Auth.cjs +2 -0
  38. package/dist/Auth/Auth.cjs.map +1 -0
  39. package/dist/Auth/Auth.d.ts +10 -0
  40. package/dist/Auth/Auth.d.ts.map +1 -0
  41. package/dist/Auth/Auth.js +5 -0
  42. package/dist/Auth/Auth.js.map +1 -0
  43. package/dist/Auth/PassthroughAuth.cjs +2 -0
  44. package/dist/Auth/PassthroughAuth.cjs.map +1 -0
  45. package/dist/Auth/PassthroughAuth.d.ts +51 -0
  46. package/dist/Auth/PassthroughAuth.d.ts.map +1 -0
  47. package/dist/Auth/PassthroughAuth.js +39 -0
  48. package/dist/Auth/PassthroughAuth.js.map +1 -0
  49. package/dist/Boost.cjs +2 -0
  50. package/dist/Boost.cjs.map +1 -0
  51. package/dist/Boost.d.ts +234 -0
  52. package/dist/Boost.d.ts.map +1 -0
  53. package/dist/Boost.js +162 -0
  54. package/dist/Boost.js.map +1 -0
  55. package/dist/BoostCore.cjs +3 -0
  56. package/dist/BoostCore.cjs.map +1 -0
  57. package/dist/BoostCore.d.ts +498 -0
  58. package/dist/BoostCore.d.ts.map +1 -0
  59. package/dist/BoostCore.js +1153 -0
  60. package/dist/BoostCore.js.map +1 -0
  61. package/dist/BoostRegistry.cjs +2 -0
  62. package/dist/BoostRegistry.cjs.map +1 -0
  63. package/dist/BoostRegistry.d.ts +243 -0
  64. package/dist/BoostRegistry.d.ts.map +1 -0
  65. package/dist/BoostRegistry.js +262 -0
  66. package/dist/BoostRegistry.js.map +1 -0
  67. package/dist/Budgets/Budget.cjs +2 -0
  68. package/dist/Budgets/Budget.cjs.map +1 -0
  69. package/dist/Budgets/Budget.d.ts +31 -0
  70. package/dist/Budgets/Budget.d.ts.map +1 -0
  71. package/dist/Budgets/Budget.js +29 -0
  72. package/dist/Budgets/Budget.js.map +1 -0
  73. package/dist/Budgets/ManagedBudget.cjs +2 -0
  74. package/dist/Budgets/ManagedBudget.cjs.map +1 -0
  75. package/dist/Budgets/ManagedBudget.d.ts +1103 -0
  76. package/dist/Budgets/ManagedBudget.d.ts.map +1 -0
  77. package/dist/Budgets/ManagedBudget.js +516 -0
  78. package/dist/Budgets/ManagedBudget.js.map +1 -0
  79. package/dist/Budgets/SimpleBudget.d.ts +824 -0
  80. package/dist/Budgets/SimpleBudget.d.ts.map +1 -0
  81. package/dist/Budgets/VestingBudget.d.ts +778 -0
  82. package/dist/Budgets/VestingBudget.d.ts.map +1 -0
  83. package/dist/Deployable/Contract.cjs +2 -0
  84. package/dist/Deployable/Contract.cjs.map +1 -0
  85. package/dist/Deployable/Contract.d.ts +125 -0
  86. package/dist/Deployable/Contract.d.ts.map +1 -0
  87. package/dist/Deployable/Contract.js +150 -0
  88. package/dist/Deployable/Contract.js.map +1 -0
  89. package/dist/Deployable/Deployable.cjs +2 -0
  90. package/dist/Deployable/Deployable.cjs.map +1 -0
  91. package/dist/Deployable/Deployable.d.ts +161 -0
  92. package/dist/Deployable/Deployable.d.ts.map +1 -0
  93. package/dist/Deployable/Deployable.js +131 -0
  94. package/dist/Deployable/Deployable.js.map +1 -0
  95. package/dist/Deployable/DeployableTarget.cjs +2 -0
  96. package/dist/Deployable/DeployableTarget.cjs.map +1 -0
  97. package/dist/Deployable/DeployableTarget.d.ts +116 -0
  98. package/dist/Deployable/DeployableTarget.d.ts.map +1 -0
  99. package/dist/Deployable/DeployableTarget.js +132 -0
  100. package/dist/Deployable/DeployableTarget.js.map +1 -0
  101. package/dist/Incentives/AllowListIncentive.cjs +2 -0
  102. package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
  103. package/dist/Incentives/AllowListIncentive.d.ts +513 -0
  104. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -0
  105. package/dist/Incentives/AllowListIncentive.js +201 -0
  106. package/dist/Incentives/AllowListIncentive.js.map +1 -0
  107. package/dist/Incentives/CGDAIncentive.cjs +2 -0
  108. package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
  109. package/dist/Incentives/CGDAIncentive.d.ts +644 -0
  110. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -0
  111. package/dist/Incentives/CGDAIncentive.js +271 -0
  112. package/dist/Incentives/CGDAIncentive.js.map +1 -0
  113. package/dist/Incentives/ERC1155Incentive.d.ts +713 -0
  114. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -0
  115. package/dist/Incentives/ERC20Incentive.cjs +2 -0
  116. package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
  117. package/dist/Incentives/ERC20Incentive.d.ts +666 -0
  118. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -0
  119. package/dist/Incentives/ERC20Incentive.js +312 -0
  120. package/dist/Incentives/ERC20Incentive.js.map +1 -0
  121. package/dist/Incentives/ERC20VariableIncentive.d.ts +582 -0
  122. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -0
  123. package/dist/Incentives/Incentive.cjs +2 -0
  124. package/dist/Incentives/Incentive.cjs.map +1 -0
  125. package/dist/Incentives/Incentive.d.ts +36 -0
  126. package/dist/Incentives/Incentive.d.ts.map +1 -0
  127. package/dist/Incentives/Incentive.js +299 -0
  128. package/dist/Incentives/Incentive.js.map +1 -0
  129. package/dist/Incentives/PointsIncentive.cjs +2 -0
  130. package/dist/Incentives/PointsIncentive.cjs.map +1 -0
  131. package/dist/Incentives/PointsIncentive.d.ts +659 -0
  132. package/dist/Incentives/PointsIncentive.d.ts.map +1 -0
  133. package/dist/Incentives/PointsIncentive.js +215 -0
  134. package/dist/Incentives/PointsIncentive.js.map +1 -0
  135. package/dist/Validators/SignerValidator.cjs +2 -0
  136. package/dist/Validators/SignerValidator.cjs.map +1 -0
  137. package/dist/Validators/SignerValidator.d.ts +745 -0
  138. package/dist/Validators/SignerValidator.d.ts.map +1 -0
  139. package/dist/Validators/SignerValidator.js +293 -0
  140. package/dist/Validators/SignerValidator.js.map +1 -0
  141. package/dist/Validators/Validator.cjs +2 -0
  142. package/dist/Validators/Validator.cjs.map +1 -0
  143. package/dist/Validators/Validator.d.ts +31 -0
  144. package/dist/Validators/Validator.d.ts.map +1 -0
  145. package/dist/Validators/Validator.js +27 -0
  146. package/dist/Validators/Validator.js.map +1 -0
  147. package/dist/claiming.cjs +2 -0
  148. package/dist/claiming.cjs.map +1 -0
  149. package/dist/claiming.d.ts +43 -0
  150. package/dist/claiming.d.ts.map +1 -0
  151. package/dist/claiming.js +17 -0
  152. package/dist/claiming.js.map +1 -0
  153. package/dist/componentInterfaces-CKCBwG16.cjs +2 -0
  154. package/dist/componentInterfaces-CKCBwG16.cjs.map +1 -0
  155. package/dist/componentInterfaces-DYkaxBda.js +13 -0
  156. package/dist/componentInterfaces-DYkaxBda.js.map +1 -0
  157. package/dist/errors.cjs +2 -0
  158. package/dist/errors.cjs.map +1 -0
  159. package/dist/errors.d.ts +441 -0
  160. package/dist/errors.d.ts.map +1 -0
  161. package/dist/errors.js +262 -0
  162. package/dist/errors.js.map +1 -0
  163. package/dist/generated-BDeDiaCK.js +4625 -0
  164. package/dist/generated-BDeDiaCK.js.map +1 -0
  165. package/dist/generated-wKBNvm48.cjs +3 -0
  166. package/dist/generated-wKBNvm48.cjs.map +1 -0
  167. package/dist/index.cjs +2 -0
  168. package/dist/index.cjs.map +1 -0
  169. package/dist/index.d.ts +25 -0
  170. package/dist/index.d.ts.map +1 -0
  171. package/dist/index.js +113 -0
  172. package/dist/index.js.map +1 -0
  173. package/dist/transfers.cjs +2 -0
  174. package/dist/transfers.cjs.map +1 -0
  175. package/dist/transfers.d.ts +198 -0
  176. package/dist/transfers.d.ts.map +1 -0
  177. package/dist/transfers.js +84 -0
  178. package/dist/transfers.js.map +1 -0
  179. package/dist/utils.cjs +2 -0
  180. package/dist/utils.cjs.map +1 -0
  181. package/dist/utils.d.ts +116 -0
  182. package/dist/utils.d.ts.map +1 -0
  183. package/dist/utils.js +30 -0
  184. package/dist/utils.js.map +1 -0
  185. package/package.json +211 -0
  186. package/src/Actions/Action.test.ts +75 -0
  187. package/src/Actions/Action.ts +61 -0
  188. package/src/Actions/ContractAction.test.ts +197 -0
  189. package/src/Actions/ContractAction.ts +301 -0
  190. package/src/Actions/ERC721MintAction.test.ts +112 -0
  191. package/src/Actions/ERC721MintAction.ts +292 -0
  192. package/src/Actions/EventAction.test.ts +205 -0
  193. package/src/Actions/EventAction.ts +811 -0
  194. package/src/AllowLists/AllowList.test.ts +64 -0
  195. package/src/AllowLists/AllowList.ts +60 -0
  196. package/src/AllowLists/SimpleAllowList.test.ts +52 -0
  197. package/src/AllowLists/SimpleAllowList.ts +284 -0
  198. package/src/AllowLists/SimpleDenyList.test.ts +52 -0
  199. package/src/AllowLists/SimpleDenyList.ts +227 -0
  200. package/src/Auth/Auth.ts +11 -0
  201. package/src/Auth/PassthroughAuth.test.ts +12 -0
  202. package/src/Auth/PassthroughAuth.ts +80 -0
  203. package/src/Boost.ts +290 -0
  204. package/src/BoostCore.test.ts +773 -0
  205. package/src/BoostCore.ts +1261 -0
  206. package/src/BoostRegistry.ts +467 -0
  207. package/src/Budgets/Budget.test.ts +27 -0
  208. package/src/Budgets/Budget.ts +61 -0
  209. package/src/Budgets/ManagedBudget.test.ts +154 -0
  210. package/src/Budgets/ManagedBudget.ts +796 -0
  211. package/src/Budgets/SimpleBudget.test.ts +152 -0
  212. package/src/Budgets/SimpleBudget.ts +564 -0
  213. package/src/Budgets/VestingBudget.test.ts +123 -0
  214. package/src/Budgets/VestingBudget.ts +602 -0
  215. package/src/Deployable/Contract.ts +229 -0
  216. package/src/Deployable/Deployable.ts +250 -0
  217. package/src/Deployable/DeployableTarget.ts +223 -0
  218. package/src/Incentives/AllowListIncentive.test.ts +143 -0
  219. package/src/Incentives/AllowListIncentive.ts +334 -0
  220. package/src/Incentives/CGDAIncentive.test.ts +132 -0
  221. package/src/Incentives/CGDAIncentive.ts +468 -0
  222. package/src/Incentives/ERC1155Incentive.test.ts +87 -0
  223. package/src/Incentives/ERC1155Incentive.ts +466 -0
  224. package/src/Incentives/ERC20Incentive.test.ts +130 -0
  225. package/src/Incentives/ERC20Incentive.ts +482 -0
  226. package/src/Incentives/ERC20VariableIncentive.test.ts +136 -0
  227. package/src/Incentives/ERC20VariableIncentive.ts +420 -0
  228. package/src/Incentives/Incentive.test.ts +92 -0
  229. package/src/Incentives/Incentive.ts +85 -0
  230. package/src/Incentives/PointsIncentive.test.ts +139 -0
  231. package/src/Incentives/PointsIncentive.ts +365 -0
  232. package/src/Validators/SignerValidator.test.ts +159 -0
  233. package/src/Validators/SignerValidator.ts +681 -0
  234. package/src/Validators/Validator.test.ts +21 -0
  235. package/src/Validators/Validator.ts +55 -0
  236. package/src/claiming.ts +56 -0
  237. package/src/errors.ts +542 -0
  238. package/src/index.test.ts +40 -0
  239. package/src/index.ts +53 -0
  240. package/src/transfers.ts +284 -0
  241. package/src/utils.test.ts +44 -0
  242. package/src/utils.ts +198 -0
@@ -0,0 +1,1261 @@
1
+ import {
2
+ boostCoreAbi,
3
+ type iAuthAbi,
4
+ readBoostCoreClaimFee,
5
+ readBoostCoreCreateBoostAuth,
6
+ readBoostCoreGetBoost,
7
+ readBoostCoreGetBoostCount,
8
+ readBoostCoreProtocolFee,
9
+ readBoostCoreProtocolFeeReceiver,
10
+ readIAuthIsAuthorized,
11
+ simulateBoostCoreClaimIncentive,
12
+ simulateBoostCoreClaimIncentiveFor,
13
+ simulateBoostCoreSetClaimFee,
14
+ simulateBoostCoreSetCreateBoostAuth,
15
+ simulateBoostCoreSetProtocolFeeReceiver,
16
+ writeBoostCoreClaimIncentive,
17
+ writeBoostCoreClaimIncentiveFor,
18
+ writeBoostCoreSetClaimFee,
19
+ writeBoostCoreSetCreateBoostAuth,
20
+ writeBoostCoreSetProtocolFeeReceiver,
21
+ } from '@boostxyz/evm';
22
+ import { bytecode } from '@boostxyz/evm/artifacts/contracts/BoostCore.sol/BoostCore.json';
23
+ import { getAccount, waitForTransactionReceipt } from '@wagmi/core';
24
+ import { createWriteContract } from '@wagmi/core/codegen';
25
+ import {
26
+ type Address,
27
+ type ContractEventName,
28
+ type Hex,
29
+ parseEther,
30
+ parseEventLogs,
31
+ zeroAddress,
32
+ zeroHash,
33
+ } from 'viem';
34
+ import { type Action, actionFromAddress } from './Actions/Action';
35
+ import { EventAction, type EventActionPayload } from './Actions/EventAction';
36
+ import { type AllowList, allowListFromAddress } from './AllowLists/AllowList';
37
+ import {
38
+ SimpleAllowList,
39
+ type SimpleAllowListPayload,
40
+ } from './AllowLists/SimpleAllowList';
41
+ import {
42
+ SimpleDenyList,
43
+ type SimpleDenyListPayload,
44
+ } from './AllowLists/SimpleDenyList';
45
+ import { type Auth, PassthroughAuth } from './Auth/Auth';
46
+ import {
47
+ Boost,
48
+ type BoostPayload,
49
+ type Target,
50
+ prepareBoostPayload,
51
+ } from './Boost';
52
+ import { type Budget, budgetFromAddress } from './Budgets/Budget';
53
+ import {
54
+ ManagedBudget,
55
+ type ManagedBudgetPayload,
56
+ } from './Budgets/ManagedBudget';
57
+ import {
58
+ Deployable,
59
+ type DeployableOptions,
60
+ type DeployablePayloadOrAddress,
61
+ type GenericDeployableParams,
62
+ } from './Deployable/Deployable';
63
+ import {
64
+ AllowListIncentive,
65
+ type AllowListIncentivePayload,
66
+ } from './Incentives/AllowListIncentive';
67
+ import {
68
+ CGDAIncentive,
69
+ type CGDAIncentivePayload,
70
+ } from './Incentives/CGDAIncentive';
71
+ import {
72
+ ERC20Incentive,
73
+ type ERC20IncentivePayload,
74
+ } from './Incentives/ERC20Incentive';
75
+ import type { ERC20VariableIncentivePayload } from './Incentives/ERC20VariableIncentive';
76
+ import {
77
+ ERC20VariableIncentive,
78
+ type Incentive,
79
+ incentiveFromAddress,
80
+ } from './Incentives/Incentive';
81
+ import {
82
+ PointsIncentive,
83
+ type PointsIncentivePayload,
84
+ } from './Incentives/PointsIncentive';
85
+ import {
86
+ SignerValidator,
87
+ type SignerValidatorPayload,
88
+ } from './Validators/SignerValidator';
89
+ import { type Validator, validatorFromAddress } from './Validators/Validator';
90
+ import {
91
+ BoostCoreNoIdentifierEmitted,
92
+ BudgetMustAuthorizeBoostCore,
93
+ DeployableUnknownOwnerProvidedError,
94
+ IncentiveNotCloneableError,
95
+ MustInitializeBudgetError,
96
+ } from './errors';
97
+ import type { GenericLog, ReadParams, WriteParams } from './utils';
98
+
99
+ export { boostCoreAbi };
100
+
101
+ /**
102
+ * The fee (in wei) required to claim each incentive, must be provided for the `claimIncentive` transaction
103
+ *
104
+ * @type {bigint}
105
+ */
106
+ export const BOOST_CORE_CLAIM_FEE = parseEther('0.000075');
107
+
108
+ /**
109
+ * The fixed address for the deployed Boost Core.
110
+ * By default, `new BoostCore` will use this address if not otherwise provided.
111
+ *
112
+ * @type {Address}
113
+ */
114
+ export const BOOST_CORE_ADDRESS: Address = import.meta.env
115
+ .VITE_BOOST_CORE_ADDRESS;
116
+
117
+ /**
118
+ * A generic `viem.Log` event with support for `BoostCore` event types.
119
+ *
120
+ * @export
121
+ * @typedef {BoostCoreLog}
122
+ * @template {ContractEventName<typeof boostCoreAbi>} [event=ContractEventName<
123
+ * typeof boostCoreAbi
124
+ * >]
125
+ */
126
+ export type BoostCoreLog<
127
+ event extends ContractEventName<typeof boostCoreAbi> = ContractEventName<
128
+ typeof boostCoreAbi
129
+ >,
130
+ > = GenericLog<typeof boostCoreAbi, event>;
131
+
132
+ /**
133
+ * Boost Core instantiation options for a custom deployed instance.
134
+ *
135
+ * @export
136
+ * @interface BoostCoreDeployedOptions
137
+ * @typedef {BoostCoreDeployedOptions}
138
+ * @extends {DeployableOptions}
139
+ */
140
+ export interface BoostCoreDeployedOptions extends DeployableOptions {
141
+ /**
142
+ * The address of a deployed, custom Boost Core contract.
143
+ *
144
+ * @type {?Address}
145
+ */
146
+ address?: Address;
147
+ }
148
+
149
+ /**
150
+ * Typeguard to determine if a user is supplying a custom address for a Boost Core contract.
151
+ *
152
+ * @param {*} opts
153
+ * @returns {opts is BoostCoreDeployedOptions}
154
+ */
155
+ // biome-ignore lint/suspicious/noExplicitAny: type guard
156
+ function isBoostCoreDeployed(opts: any): opts is BoostCoreDeployedOptions {
157
+ return opts.address;
158
+ }
159
+
160
+ /**
161
+ * Boost Core instantiation options when a user intends to deploy a new instance of Boost Core, setting their own registry address and protocol fee receiver.
162
+ *
163
+ * @export
164
+ * @interface BoostCoreOptionsWithPayload
165
+ * @typedef {BoostCoreOptionsWithPayload}
166
+ * @extends {DeployableOptions}
167
+ */
168
+ export interface BoostCoreOptionsWithPayload extends DeployableOptions {
169
+ /**
170
+ * The address of a deployed Boost Registry contract.
171
+ *
172
+ * @type {Address}
173
+ */
174
+ registryAddress: Address;
175
+ /**
176
+ * The address to send fees.
177
+ *
178
+ * @type {Address}
179
+ */
180
+ protocolFeeReceiver: Address;
181
+ }
182
+
183
+ /**
184
+ * Typeguard to determine if a user is intending to deploy a new instance of the Boost Core contracts with {@link BoostCoreOptionsWithPayload}.
185
+ *
186
+ * @param {*} opts
187
+ * @returns {opts is BoostCoreOptionsWithPayload}
188
+ */
189
+ // biome-ignore lint/suspicious/noExplicitAny: type guard
190
+ function isBoostCoreDeployable(opts: any): opts is BoostCoreOptionsWithPayload {
191
+ return opts.registryAddress && opts.protocolFeeReceiver;
192
+ }
193
+
194
+ /**
195
+ * A union representing both of the valid Boost Core instantiation parameters.
196
+ *
197
+ * @export
198
+ * @typedef {BoostCoreConfig}
199
+ */
200
+ export type BoostCoreConfig =
201
+ | BoostCoreDeployedOptions
202
+ | BoostCoreOptionsWithPayload;
203
+
204
+ /**
205
+ * The interface required to create a new Boost.
206
+ *
207
+ * @export
208
+ * @typedef {CreateBoostPayload}
209
+ */
210
+ export type CreateBoostPayload = {
211
+ budget: Budget;
212
+ action: Action;
213
+ validator: Validator;
214
+ allowList: AllowList;
215
+ incentives: Array<Incentive>;
216
+ protocolFee?: bigint;
217
+ referralFee?: bigint;
218
+ maxParticipants?: bigint;
219
+ owner?: Address;
220
+ };
221
+
222
+ /**
223
+ * The core contract for the Boost protocol. Used to create and retrieve deployed Boosts.
224
+ *
225
+ * @export
226
+ * @class BoostCore
227
+ * @typedef {BoostCore}
228
+ * @extends {Deployable<[Address, Address]>}
229
+ */
230
+ export class BoostCore extends Deployable<
231
+ [Address, Address],
232
+ typeof boostCoreAbi
233
+ > {
234
+ /**
235
+ * Creates an instance of BoostCore.
236
+ *
237
+ * @constructor
238
+ * @param {BoostCoreConfig} param0
239
+ * @param {Config} param0.config
240
+ * @param {?Account} [param0.account]
241
+ * @param {({ address?: Address; } | { registryAddress: Address; protocolFeeReceiver: Address; })} param0....options
242
+ */
243
+ constructor({ config, account, ...options }: BoostCoreConfig) {
244
+ if (isBoostCoreDeployed(options) && options.address) {
245
+ super({ account, config }, options.address);
246
+ } else if (isBoostCoreDeployable(options)) {
247
+ super({ account, config }, [
248
+ options.registryAddress,
249
+ options.protocolFeeReceiver,
250
+ ]);
251
+ } else {
252
+ super({ account, config }, BOOST_CORE_ADDRESS);
253
+ }
254
+ //@ts-expect-error I can't set this property on the class because for some reason it takes super out of constructor scope?
255
+ this.abi = boostCoreAbi;
256
+ }
257
+ /**
258
+ * Create a new Boost.
259
+ *
260
+ * @public
261
+ * @async
262
+ * @param {CreateBoostPayload} _boostPayload
263
+ * @param {?DeployableOptions} [_options]
264
+ * @returns {Boost}
265
+ */
266
+ public async createBoost(
267
+ _boostPayload: CreateBoostPayload,
268
+ _options?: DeployableOptions,
269
+ ) {
270
+ const coreAddress = this.assertValidAddress();
271
+ 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;
288
+
289
+ const boostFactory = createWriteContract({
290
+ abi: boostCoreAbi,
291
+ functionName: 'createBoost',
292
+ address: this.address,
293
+ });
294
+
295
+ if (!owner) {
296
+ owner =
297
+ this._account?.address ||
298
+ getAccount(options.config).address ||
299
+ zeroAddress;
300
+ if (owner === zeroAddress) {
301
+ throw new DeployableUnknownOwnerProvidedError();
302
+ }
303
+ }
304
+
305
+ let budgetPayload: BoostPayload['budget'] = zeroAddress;
306
+ if (budget.address) {
307
+ budgetPayload = budget.address;
308
+ if (!(await budget.isAuthorized(coreAddress))) {
309
+ throw new BudgetMustAuthorizeBoostCore(coreAddress);
310
+ }
311
+ } else {
312
+ throw new MustInitializeBudgetError();
313
+ }
314
+
315
+ // if we're supplying an address, it could be a pre-initialized target
316
+ // 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
317
+ let actionPayload: BoostPayload['action'] = {
318
+ instance: zeroAddress,
319
+ isBase: true,
320
+ parameters: zeroHash,
321
+ };
322
+ if (action.address) {
323
+ const isBase = action.address === action.base || action.isBase;
324
+ actionPayload = {
325
+ isBase: isBase,
326
+ instance: action.address,
327
+ parameters: isBase
328
+ ? action.buildParameters(undefined, options).args.at(0) || zeroHash
329
+ : zeroHash,
330
+ };
331
+ } else {
332
+ actionPayload.parameters =
333
+ action.buildParameters(undefined, options).args.at(0) || zeroHash;
334
+ actionPayload.instance = action.base;
335
+ }
336
+
337
+ let validatorPayload: BoostPayload['validator'] = {
338
+ instance: zeroAddress,
339
+ isBase: true,
340
+ parameters: zeroHash,
341
+ };
342
+ if (validator.address) {
343
+ const isBase = validator.address === validator.base || validator.isBase;
344
+ validatorPayload = {
345
+ isBase: isBase,
346
+ instance: validator.address,
347
+ parameters: isBase
348
+ ? validator
349
+ .buildParameters(
350
+ {
351
+ signers: [owner],
352
+ validatorCaller: coreAddress,
353
+ },
354
+ options,
355
+ )
356
+ .args.at(0) || zeroHash
357
+ : zeroHash,
358
+ };
359
+ } else {
360
+ 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;
371
+ }
372
+
373
+ let allowListPayload: BoostPayload['allowList'] = {
374
+ instance: zeroAddress,
375
+ isBase: true,
376
+ parameters: zeroHash,
377
+ };
378
+ if (allowList.address) {
379
+ const isBase = allowList.address === allowList.base || allowList.isBase;
380
+ allowListPayload = {
381
+ isBase: isBase,
382
+ instance: allowList.address,
383
+ parameters: isBase
384
+ ? zeroHash // allowList.buildParameters(undefined, options).args.at(0) || zeroHash
385
+ : zeroHash,
386
+ };
387
+ } else {
388
+ allowListPayload.parameters =
389
+ allowList.buildParameters(undefined, options).args.at(0) || zeroHash;
390
+ allowListPayload.instance = allowList.base;
391
+ }
392
+
393
+ let incentivesPayloads: Array<Target> = incentives.map(() => ({
394
+ instance: zeroAddress,
395
+ isBase: true,
396
+ parameters: zeroHash,
397
+ }));
398
+ for (let i = 0; i < incentives.length; i++) {
399
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
400
+ const incentive = incentives.at(i)!;
401
+ if (incentive.address) {
402
+ const isBase = incentive.address === incentive.base || incentive.isBase;
403
+ if (!isBase) throw new IncentiveNotCloneableError(incentive);
404
+ incentivesPayloads[i] = {
405
+ isBase: isBase,
406
+ instance: incentive.address,
407
+ parameters: isBase
408
+ ? incentive.buildParameters(undefined, options).args.at(0) ||
409
+ zeroHash
410
+ : zeroHash,
411
+ };
412
+ } else {
413
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
414
+ incentivesPayloads[i]!.parameters =
415
+ incentive.buildParameters(undefined, options).args.at(0) || zeroHash;
416
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
417
+ incentivesPayloads[i]!.instance = incentive.base;
418
+ }
419
+ }
420
+
421
+ const onChainPayload = {
422
+ budget: budgetPayload,
423
+ action: actionPayload,
424
+ validator: validatorPayload,
425
+ allowList: allowListPayload,
426
+ incentives: incentivesPayloads,
427
+ protocolFee,
428
+ referralFee,
429
+ maxParticipants,
430
+ owner,
431
+ };
432
+
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
+ });
464
+ }
465
+
466
+ /**
467
+ * Claims one incentive from a given `Boost` by `boostId` and `incentiveId`
468
+ *
469
+ * @public
470
+ * @async
471
+ * @param {bigint} boostId
472
+ * @param {bigint} incentiveId
473
+ * @param {Address} address
474
+ * @param {Hex} data
475
+ * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentive'>} [params]
476
+ * @returns {unknown}
477
+ */
478
+ public async claimIncentive(
479
+ boostId: bigint,
480
+ incentiveId: bigint,
481
+ address: Address,
482
+ data: Hex,
483
+ params?: WriteParams<typeof boostCoreAbi, 'claimIncentive'>,
484
+ ) {
485
+ return await this.awaitResult(
486
+ this.claimIncentiveRaw(boostId, incentiveId, address, data, params),
487
+ );
488
+ }
489
+
490
+ /**
491
+ * Claim an incentive for a Boost
492
+ *
493
+ * @public
494
+ * @async
495
+ * @param {bigint} boostId - The ID of the Boost
496
+ * @param {bigint} incentiveId - The ID of the Incentive
497
+ * @param {Address} referrer - The address of the referrer (if any)
498
+ * @param {Hex} data- The data for the claim
499
+ * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentive'>} [params]
500
+ * @returns {unknown}
501
+ */
502
+ public async claimIncentiveRaw(
503
+ boostId: bigint,
504
+ incentiveId: bigint,
505
+ referrer: Address,
506
+ data: Hex,
507
+ params?: WriteParams<typeof boostCoreAbi, 'claimIncentive'>,
508
+ ) {
509
+ const { request, result } = await simulateBoostCoreClaimIncentive(
510
+ this._config,
511
+ {
512
+ address: this.assertValidAddress(),
513
+ args: [boostId, incentiveId, referrer, data],
514
+ ...this.optionallyAttachAccount(),
515
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
516
+ ...(params as any),
517
+ },
518
+ );
519
+ const hash = await writeBoostCoreClaimIncentive(this._config, request);
520
+ return { hash, result };
521
+ }
522
+
523
+ /**
524
+ * Claims one incentive for a given `Boost` on behalf of another user by `boostId` and `incentiveId`
525
+ *
526
+ * @public
527
+ * @async
528
+ * @param {bigint} boostId
529
+ * @param {bigint} incentiveId
530
+ * @param {Address} referrer
531
+ * @param {Hex} data
532
+ * @param {Address} claimant
533
+ * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>} [params]
534
+ * @returns {unknown}
535
+ */
536
+ public async claimIncentiveFor(
537
+ boostId: bigint,
538
+ incentiveId: bigint,
539
+ referrer: Address,
540
+ data: Hex,
541
+ claimant: Address,
542
+ params?: WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>,
543
+ ) {
544
+ return await this.awaitResult(
545
+ this.claimIncentiveForRaw(
546
+ boostId,
547
+ incentiveId,
548
+ referrer,
549
+ data,
550
+ claimant,
551
+ params,
552
+ ),
553
+ );
554
+ }
555
+
556
+ /**
557
+ * Claim an incentive for a Boost on behalf of another user
558
+ *
559
+ * @public
560
+ * @async
561
+ * @param {bigint} boostId - The ID of the Boost
562
+ * @param {bigint} incentiveId - The ID of the Incentive
563
+ * @param {Address} referrer - The address of the referrer (if any)
564
+ * @param {Hex} data - The data for the claim
565
+ * @param {Address} claimant - The address of the user eligible for the incentive payout
566
+ * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>} [params]
567
+ * @returns {unknown}
568
+ */
569
+ public async claimIncentiveForRaw(
570
+ boostId: bigint,
571
+ incentiveId: bigint,
572
+ referrer: Address,
573
+ data: Hex,
574
+ claimant: Address,
575
+ params?: WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>,
576
+ ) {
577
+ const { request, result } = await simulateBoostCoreClaimIncentiveFor(
578
+ this._config,
579
+ {
580
+ address: this.assertValidAddress(),
581
+ args: [boostId, incentiveId, referrer, data, claimant],
582
+ ...this.optionallyAttachAccount(),
583
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
584
+ ...(params as any),
585
+ },
586
+ );
587
+ const hash = await writeBoostCoreClaimIncentiveFor(this._config, request);
588
+ return { hash, result };
589
+ }
590
+
591
+ /**
592
+ * Get a Boost by index, will return the raw on chain representation of a Boost.
593
+ *
594
+ * @public
595
+ * @async
596
+ * @param {bigint} id
597
+ * @param {?ReadParams<typeof boostCoreAbi, 'getBoost'>} [params]
598
+ * @returns {unknown}
599
+ */
600
+ public async readBoost(
601
+ id: bigint,
602
+ 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
+ });
611
+ }
612
+
613
+ /**
614
+ * Get a Boost by index, will return a new {@link Boost} with correct target implementations instantiated, ie `(await core.getBoost(0n)).allowList instanceof SimpleAllowList` vs `SimpleDenyList`
615
+ *
616
+ * @public
617
+ * @async
618
+ * @param {(string | bigint)} _id
619
+ * @param {?ReadParams<typeof boostCoreAbi, 'getBoost'>} [params]
620
+ * @returns {unknown}
621
+ */
622
+ public async getBoost(
623
+ _id: string | bigint,
624
+ params?: ReadParams<typeof boostCoreAbi, 'getBoost'>,
625
+ ) {
626
+ let id: bigint;
627
+ if (typeof _id === 'string') {
628
+ id = BigInt(_id);
629
+ } else id = _id;
630
+ const {
631
+ protocolFee,
632
+ referralFee,
633
+ maxParticipants,
634
+ owner,
635
+ ...boostPayload
636
+ } = await this.readBoost(id, params);
637
+ const options: DeployableOptions = {
638
+ config: this._config,
639
+ account: this._account,
640
+ };
641
+ const [action, budget, validator, allowList, incentives] =
642
+ await Promise.all([
643
+ actionFromAddress(options, boostPayload.action),
644
+ budgetFromAddress(options, boostPayload.budget),
645
+ validatorFromAddress(options, boostPayload.validator),
646
+ allowListFromAddress(options, boostPayload.allowList),
647
+ Promise.all(
648
+ boostPayload.incentives.map((incentiveAddress) =>
649
+ incentiveFromAddress(options, incentiveAddress),
650
+ ),
651
+ ),
652
+ ]);
653
+ return new Boost({
654
+ id,
655
+ action,
656
+ budget,
657
+ validator,
658
+ allowList,
659
+ incentives,
660
+ protocolFee,
661
+ referralFee,
662
+ maxParticipants,
663
+ owner,
664
+ });
665
+ }
666
+
667
+ /**
668
+ * Retrieve the total number of deployed Boosts
669
+ *
670
+ * @public
671
+ * @async
672
+ * @param {?ReadParams<typeof boostCoreAbi, 'getBoostCount'>} [params]
673
+ * @returns {Promise<bigint>}
674
+ */
675
+ public async getBoostCount(
676
+ params?: ReadParams<typeof boostCoreAbi, 'getBoostCount'>,
677
+ ) {
678
+ return await readBoostCoreGetBoostCount(this._config, {
679
+ address: this.assertValidAddress(),
680
+ args: [],
681
+ ...this.optionallyAttachAccount(),
682
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
683
+ ...(params as any),
684
+ });
685
+ }
686
+
687
+ /**
688
+ * Checks if an address is authorized
689
+ *
690
+ * @public
691
+ * @async
692
+ * @param {Address} address
693
+ * @param {?ReadParams<typeof boostCoreAbi, 'createBoostAuth'> &
694
+ * ReadParams<typeof iAuthAbi, 'isAuthorized'>} [params]
695
+ * @returns {Promise<boolean>}
696
+ */
697
+ public async isAuthorized(
698
+ address: Address,
699
+ params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'> &
700
+ ReadParams<typeof iAuthAbi, 'isAuthorized'>,
701
+ ) {
702
+ const auth = await this.createBoostAuth();
703
+ return readIAuthIsAuthorized(this._config, {
704
+ address: auth,
705
+ args: [address],
706
+ ...this.optionallyAttachAccount(),
707
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
708
+ ...(params as any),
709
+ });
710
+ }
711
+
712
+ /**
713
+ * Retrieve the address of the current creation auth provider.
714
+ *
715
+ * @public
716
+ * @async
717
+ * @param {?ReadParams<typeof boostCoreAbi, 'createBoostAuth'>} [params]
718
+ * @returns {unknown}
719
+ */
720
+ public async createBoostAuth(
721
+ params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'>,
722
+ ) {
723
+ return await readBoostCoreCreateBoostAuth(this._config, {
724
+ address: this.assertValidAddress(),
725
+ args: [],
726
+ ...this.optionallyAttachAccount(),
727
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
728
+ ...(params as any),
729
+ });
730
+ }
731
+
732
+ /**
733
+ * Replace the current auth scheme.
734
+ *
735
+ * @public
736
+ * @async
737
+ * @param {Auth} auth
738
+ * @param {?WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>} [params]
739
+ * @returns {unknown}
740
+ */
741
+ public async setCreateBoostAuth(
742
+ auth: Auth,
743
+ params?: WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>,
744
+ ) {
745
+ return await this.awaitResult(
746
+ this.setCreateBoostAuthRaw(auth.assertValidAddress(), {
747
+ ...params,
748
+ }),
749
+ );
750
+ }
751
+
752
+ /**
753
+ * Set the createBoostAuth address
754
+ *
755
+ * @public
756
+ * @async
757
+ * @param {Address} address
758
+ * @param {?WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>} [params]
759
+ * @returns {unknown}
760
+ */
761
+ public async setCreateBoostAuthRaw(
762
+ address: Address,
763
+ params?: WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>,
764
+ ) {
765
+ const { request, result } = await simulateBoostCoreSetCreateBoostAuth(
766
+ this._config,
767
+ {
768
+ address: this.assertValidAddress(),
769
+ args: [address],
770
+ ...this.optionallyAttachAccount(),
771
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
772
+ ...(params as any),
773
+ },
774
+ );
775
+ const hash = await writeBoostCoreSetCreateBoostAuth(this._config, request);
776
+ return { hash, result };
777
+ }
778
+
779
+ /**
780
+ * Get the protocol fee.
781
+ *
782
+ * @public
783
+ * @async
784
+ * @param {?ReadParams<typeof boostCoreAbi, 'protocolFee'>} [params]
785
+ * @returns {unknown}
786
+ */
787
+ public async protocolFee(
788
+ params?: ReadParams<typeof boostCoreAbi, 'protocolFee'>,
789
+ ) {
790
+ return await readBoostCoreProtocolFee(this._config, {
791
+ address: this.assertValidAddress(),
792
+ args: [],
793
+ ...this.optionallyAttachAccount(),
794
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
795
+ ...(params as any),
796
+ });
797
+ }
798
+
799
+ /**
800
+ * Get the protocol fee receiver.
801
+ *
802
+ * @public
803
+ * @async
804
+ * @param {?ReadParams<typeof boostCoreAbi, 'protocolFeeReceiver'>} [params]
805
+ * @returns {unknown}
806
+ */
807
+ public async protocolFeeReceiver(
808
+ params?: ReadParams<typeof boostCoreAbi, 'protocolFeeReceiver'>,
809
+ ) {
810
+ return await readBoostCoreProtocolFeeReceiver(this._config, {
811
+ address: this.assertValidAddress(),
812
+ args: [],
813
+ ...this.optionallyAttachAccount(),
814
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
815
+ ...(params as any),
816
+ });
817
+ }
818
+
819
+ /**
820
+ * Set the protocol fee receiver address. This function is only callable by the owner.
821
+ *
822
+ * @public
823
+ * @async
824
+ * @param {Address} address
825
+ * @param {?WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>} [params]
826
+ * @returns {unknown}
827
+ */
828
+ public async setProcolFeeReceiver(
829
+ address: Address,
830
+ params?: WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>,
831
+ ) {
832
+ return await this.awaitResult(
833
+ this.setProcolFeeReceiverRaw(address, {
834
+ ...params,
835
+ }),
836
+ );
837
+ }
838
+
839
+ /**
840
+ * Set the protocol fee receiver address. This function is only callable by the owner.
841
+ *
842
+ * @public
843
+ * @async
844
+ * @param {Address} address
845
+ * @param {?WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>} [params]
846
+ * @returns {unknown}
847
+ */
848
+ public async setProcolFeeReceiverRaw(
849
+ address: Address,
850
+ params?: WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>,
851
+ ) {
852
+ const { request, result } = await simulateBoostCoreSetProtocolFeeReceiver(
853
+ this._config,
854
+ {
855
+ address: this.assertValidAddress(),
856
+ args: [address],
857
+ ...this.optionallyAttachAccount(),
858
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
859
+ ...(params as any),
860
+ },
861
+ );
862
+ const hash = await writeBoostCoreSetProtocolFeeReceiver(
863
+ this._config,
864
+ request,
865
+ );
866
+ return { hash, result };
867
+ }
868
+
869
+ /**
870
+ * Get the claim fee.
871
+ *
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.
889
+ *
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.
905
+ *
906
+ * @public
907
+ * @async
908
+ * @param {bigint} claimFee
909
+ * @param {?WriteParams<typeof boostCoreAbi, 'setClaimFee'>} [params]
910
+ * @returns {unknown}
911
+ */
912
+ public async setClaimFeeRaw(
913
+ claimFee: bigint,
914
+ params?: WriteParams<typeof boostCoreAbi, 'setClaimFee'>,
915
+ ) {
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 };
928
+ }
929
+
930
+ /**
931
+ * Bound {@link PassthroughAuth} constructor that reuses the same configuration as the Boost Core instance.
932
+ *
933
+ * @example
934
+ * ```ts
935
+ * const auth = core.PassthroughAuth('0x') // is roughly equivalent to
936
+ * const auth = new PassthroughAuth({ config: core._config, account: core._account }, '0x')
937
+ * ```
938
+ * @param {Address} address
939
+ * @returns {PassthroughAuth}
940
+ */
941
+ PassthroughAuth(address?: Address) {
942
+ return new PassthroughAuth(
943
+ { config: this._config, account: this._account },
944
+ address,
945
+ );
946
+ }
947
+
948
+ // /**
949
+ // * Bound {@link ContractAction} constructor that reuses the same configuration as the Boost Core instance.
950
+ // *
951
+ // * @example
952
+ // * ```ts
953
+ // * const action = core.ContractAction('0x') // is roughly equivalent to
954
+ // * const action = new ContractAction({ config: core._config, account: core._account }, '0x')
955
+ // * ```
956
+ // * @param {DeployablePayloadOrAddress<ContractActionPayload>} options
957
+ // * @param {?boolean} [isBase]
958
+ // * @returns {ContractAction}
959
+ // */
960
+ // ContractAction(
961
+ // options: DeployablePayloadOrAddress<ContractActionPayload>,
962
+ // isBase?: boolean,
963
+ // ) {
964
+ // return new ContractAction(
965
+ // { config: this._config, account: this._account },
966
+ // options,
967
+ // isBase,
968
+ // );
969
+ // }
970
+
971
+ /**
972
+ * Bound {@link EventAction} constructor that reuses the same configuration as the Boost Core instance.
973
+ *
974
+ * @example
975
+ * ```ts
976
+ * const action = core.EventAction('0x') // is roughly equivalent to
977
+ * const action = new EventAction({ config: core._config, account: core._account }, '0x')
978
+ */
979
+ EventAction(
980
+ options: DeployablePayloadOrAddress<EventActionPayload>,
981
+ isBase?: boolean,
982
+ ) {
983
+ return new EventAction(
984
+ { config: this._config, account: this._account },
985
+ options,
986
+ isBase,
987
+ );
988
+ }
989
+ // /**
990
+ // * Bound {@link ERC721MintAction} constructor that reuses the same configuration as the Boost Core instance.
991
+ // *
992
+ // * @example
993
+ // * ```ts
994
+ // * const action = core.ERC721MintAction('0x') // is roughly equivalent to
995
+ // * const action = new ERC721MintAction({ config: core._config, account: core._account }, '0x')
996
+ // * ```
997
+ // * @param {DeployablePayloadOrAddress<ERC721MintActionPayload>} options
998
+ // * @param {?boolean} [isBase]
999
+ // * @returns {ERC721MintAction}
1000
+ // */
1001
+ // ERC721MintAction(
1002
+ // options: DeployablePayloadOrAddress<ERC721MintActionPayload>,
1003
+ // isBase?: boolean,
1004
+ // ) {
1005
+ // return new ERC721MintAction(
1006
+ // { config: this._config, account: this._account },
1007
+ // options,
1008
+ // isBase,
1009
+ // );
1010
+ // }
1011
+ /**
1012
+ * Bound {@link SimpleAllowList} constructor that reuses the same configuration as the Boost Core instance.
1013
+ *
1014
+ * @example
1015
+ * ```ts
1016
+ * const list = core.SimpleAllowList('0x') // is roughly equivalent to
1017
+ * const list = new SimpleAllowList({ config: core._config, account: core._account }, '0x')
1018
+ * ```
1019
+ * @param {DeployablePayloadOrAddress<SimpleAllowListPayload>} options
1020
+ * @param {?boolean} [isBase]
1021
+ * @returns {SimpleAllowList}
1022
+ */
1023
+ SimpleAllowList(
1024
+ options: DeployablePayloadOrAddress<SimpleAllowListPayload>,
1025
+ isBase?: boolean,
1026
+ ) {
1027
+ return new SimpleAllowList(
1028
+ { config: this._config, account: this._account },
1029
+ options,
1030
+ isBase,
1031
+ );
1032
+ }
1033
+ /**
1034
+ * Bound {@link SimpleDenyList} constructor that reuses the same configuration as the Boost Core instance.
1035
+ *
1036
+ * @example
1037
+ * ```ts
1038
+ * const list = core.SimpleDenyList('0x') // is roughly equivalent to
1039
+ * const list = new SimpleDenyList({ config: core._config, account: core._account }, '0x')
1040
+ * ```
1041
+ * @param {DeployablePayloadOrAddress<SimpleDenyListPayload>} options
1042
+ * @param {?boolean} [isBase]
1043
+ * @returns {SimpleDenyList}
1044
+ */
1045
+ SimpleDenyList(
1046
+ options: DeployablePayloadOrAddress<SimpleDenyListPayload>,
1047
+ isBase?: boolean,
1048
+ ) {
1049
+ return new SimpleDenyList(
1050
+ { config: this._config, account: this._account },
1051
+ options,
1052
+ isBase,
1053
+ );
1054
+ }
1055
+ // /**
1056
+ // * Bound {@link SimpleBudget} constructor that reuses the same configuration as the Boost Core instance.
1057
+ // *
1058
+ // * @example
1059
+ // * ```ts
1060
+ // * const budget = core.SimpleBudget('0x') // is roughly equivalent to
1061
+ // * const budget = new SimpleBudget({ config: core._config, account: core._account }, '0x')
1062
+ // * ```
1063
+ // * @param {DeployablePayloadOrAddress<SimpleBudgetPayload>} options
1064
+ // * @returns {SimpleBudget}
1065
+ // */
1066
+ // SimpleBudget(options: DeployablePayloadOrAddress<SimpleBudgetPayload>) {
1067
+ // return new SimpleBudget(
1068
+ // { config: this._config, account: this._account },
1069
+ // options,
1070
+ // );
1071
+ // }
1072
+ /**
1073
+ * Bound {@link ManagedBudget} constructor that reuses the same configuration as the Boost Core instance.
1074
+ *
1075
+ * @example
1076
+ * ```ts
1077
+ * const budget = core.ManagedBudget('0x') // is roughly equivalent to
1078
+ * const budget = new ManagedBudget({ config: core._config, account: core._account }, '0x')
1079
+ * ```
1080
+ * @param {DeployablePayloadOrAddress<ManagedBudgetPayload>} options
1081
+ * @returns {ManagedBudget}
1082
+ */
1083
+ ManagedBudget(options: DeployablePayloadOrAddress<ManagedBudgetPayload>) {
1084
+ return new ManagedBudget(
1085
+ { config: this._config, account: this._account },
1086
+ options,
1087
+ );
1088
+ }
1089
+ // /**
1090
+ // * Bound {@link VestingBudget} constructor that reuses the same configuration as the Boost Core instance.
1091
+ // *
1092
+ // * @example
1093
+ // * ```ts
1094
+ // * const budget = core.VestingBudget('0x') // is roughly equivalent to
1095
+ // * const budget = new VestingBudget({ config: core._config, account: core._account }, '0x')
1096
+ // * ```
1097
+ // * @param {DeployablePayloadOrAddress<VestingBudgetPayload>} options
1098
+ // * @returns {VestingBudget}
1099
+ // */
1100
+ // VestingBudget(options: DeployablePayloadOrAddress<VestingBudgetPayload>) {
1101
+ // return new VestingBudget(
1102
+ // { config: this._config, account: this._account },
1103
+ // options,
1104
+ // );
1105
+ // }
1106
+ /**
1107
+ * Bound {@link AllowListIncentive} constructor that reuses the same configuration as the Boost Core instance.
1108
+ *
1109
+ * @example
1110
+ * ```ts
1111
+ * const incentive = core.AllowListIncentive({ ... }) // is roughly equivalent to
1112
+ * const incentive = new AllowListIncentive({ config: core._config, account: core._account }, { ... })
1113
+ * ```
1114
+ * @param {DeployablePayloadOrAddress<VestingBudgetPayload>} options
1115
+ * @returns {VestingBudget}
1116
+ */
1117
+ AllowListIncentive(options: AllowListIncentivePayload) {
1118
+ return new AllowListIncentive(
1119
+ { config: this._config, account: this._account },
1120
+ options,
1121
+ );
1122
+ }
1123
+ /**
1124
+ * Bound {@link CGDAIncentive} constructor that reuses the same configuration as the Boost Core instance.
1125
+ *
1126
+ * @example
1127
+ * ```ts
1128
+ * const incentive = core.CGDAIncentive({ ... }) // is roughly equivalent to
1129
+ * const incentive = new CGDAIncentive({ config: core._config, account: core._account }, { ... })
1130
+ * ```
1131
+ * @param {CGDAIncentivePayload} options
1132
+ * @returns {CGDAIncentive}
1133
+ */
1134
+ CGDAIncentive(options: CGDAIncentivePayload) {
1135
+ return new CGDAIncentive(
1136
+ { config: this._config, account: this._account },
1137
+ options,
1138
+ );
1139
+ }
1140
+ /**
1141
+ * Bound {@link ERC20Incentive} constructor that reuses the same configuration as the Boost Core instance.
1142
+ *
1143
+ * @example
1144
+ * ```ts
1145
+ * const incentive = core.ERC20Incentive({ ... }) // is roughly equivalent to
1146
+ * const incentive = new ERC20Incentive({ config: core._config, account: core._account }, { ... })
1147
+ * ```
1148
+ * @param {ERC20IncentivePayload} options
1149
+ * @returns {ERC20Incentive}
1150
+ */
1151
+ ERC20Incentive(options: ERC20IncentivePayload) {
1152
+ return new ERC20Incentive(
1153
+ { config: this._config, account: this._account },
1154
+ options,
1155
+ );
1156
+ }
1157
+ // /**
1158
+ // * Temporarily disabled until low level ABI encoding bugs are resolved
1159
+ // * Bound {@link ERC1155Incentive} constructor that reuses the same configuration as the Boost Core instance.
1160
+ // *
1161
+ // * @experimental
1162
+ // * @example
1163
+ // * ```ts
1164
+ // * const incentive = core.ERC1155Incentive({ ... }) // is roughly equivalent to
1165
+ // * const incentive = new ERC1155Incentive({ config: core._config, account: core._account }, { ... })
1166
+ // * ```
1167
+ // * @param {ERC1155IncentivePayload} options
1168
+ // * @returns {ERC1155Incentive}
1169
+ // */
1170
+ // ERC1155Incentive(options: ERC1155IncentivePayload) {
1171
+ // return new ERC1155Incentive(
1172
+ // { config: this._config, account: this._account },
1173
+ // options,
1174
+ // );
1175
+ // }
1176
+ /**
1177
+ * Bound {@link PointsIncentive} constructor that reuses the same configuration as the Boost Core instance.
1178
+ *
1179
+ * @example
1180
+ * ```ts
1181
+ * const incentive = core.PointsIncentive({ ... }) // is roughly equivalent to
1182
+ * const incentive = new PointsIncentive({ config: core._config, account: core._account }, { ... })
1183
+ * ```
1184
+ * @param {PointsIncentivePayload} options
1185
+ * @returns {PointsIncentive}
1186
+ */
1187
+ PointsIncentive(options: PointsIncentivePayload) {
1188
+ return new PointsIncentive(
1189
+ { config: this._config, account: this._account },
1190
+ options,
1191
+ );
1192
+ }
1193
+ /**
1194
+ * Bound {@link SignerValidator} constructor that reuses the same configuration as the Boost Core instance.
1195
+ *
1196
+ * @example
1197
+ * ```ts
1198
+ * const validator = core.SignerValidator({ ... }) // is roughly equivalent to
1199
+ * const validator = new SignerValidator({ config: core._config, account: core._account }, { ... })
1200
+ * ```
1201
+ * @param {DeployablePayloadOrAddress<SignerValidatorPayload>} options
1202
+ * @param {?boolean} [isBase]
1203
+ * @returns {SignerValidator}
1204
+ */
1205
+ SignerValidator(
1206
+ options: DeployablePayloadOrAddress<SignerValidatorPayload>,
1207
+ isBase?: boolean,
1208
+ ) {
1209
+ return new SignerValidator(
1210
+ { config: this._config, account: this._account },
1211
+ options,
1212
+ isBase,
1213
+ );
1214
+ }
1215
+ /**
1216
+ * Bound {@link ERC20VariableIncentive} constructor that reuses the same configuration as the Boost Core instance.
1217
+ *
1218
+ * @example
1219
+ * ```ts
1220
+ * const validator = core.ERC20VariableIncentive({ ... }) // is roughly equivalent to
1221
+ * const validator = new ERC20VariableIncentive({ config: core._config, account: core._account }, { ... })
1222
+ * ```
1223
+ * @param {DeployablePayloadOrAddress<ERC20VariableIncentivePayload>} options
1224
+ * @param {?boolean} [isBase]
1225
+ * @returns {ERC20VariableIncentive}
1226
+ */
1227
+ ERC20VariableIncentive(
1228
+ options: DeployablePayloadOrAddress<ERC20VariableIncentivePayload>,
1229
+ isBase?: boolean,
1230
+ ) {
1231
+ return new ERC20VariableIncentive(
1232
+ { config: this._config, account: this._account },
1233
+ options,
1234
+ isBase,
1235
+ );
1236
+ }
1237
+
1238
+ /**
1239
+ * @inheritdoc
1240
+ *
1241
+ * @public
1242
+ * @param {?[Address, Address]} [_payload]
1243
+ * @param {?DeployableOptions} [_options]
1244
+ * @returns {GenericDeployableParams}
1245
+ */
1246
+ public override buildParameters(
1247
+ _payload?: [Address, Address],
1248
+ _options?: DeployableOptions,
1249
+ ): GenericDeployableParams {
1250
+ const [payload, options] = this.validateDeploymentConfig(
1251
+ _payload,
1252
+ _options,
1253
+ );
1254
+ return {
1255
+ abi: boostCoreAbi,
1256
+ bytecode: bytecode as Hex,
1257
+ args: payload,
1258
+ ...this.optionallyAttachAccount(options.account),
1259
+ };
1260
+ }
1261
+ }