@boostxyz/sdk 0.0.0-alpha.8 → 0.0.0-alpha.9

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 (180) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.js +1 -1
  3. package/dist/Actions/ContractAction.d.ts +46 -3
  4. package/dist/Actions/ContractAction.d.ts.map +1 -1
  5. package/dist/Actions/ERC721MintAction.d.ts +37 -10
  6. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  7. package/dist/Actions/EventAction.cjs +1 -1
  8. package/dist/Actions/EventAction.cjs.map +1 -1
  9. package/dist/Actions/EventAction.d.ts +257 -12
  10. package/dist/Actions/EventAction.d.ts.map +1 -1
  11. package/dist/Actions/EventAction.js +249 -82
  12. package/dist/Actions/EventAction.js.map +1 -1
  13. package/dist/AllowLists/AllowList.cjs +1 -1
  14. package/dist/AllowLists/AllowList.js +1 -1
  15. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  16. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  17. package/dist/AllowLists/SimpleAllowList.d.ts +31 -2
  18. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  19. package/dist/AllowLists/SimpleAllowList.js +52 -37
  20. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  21. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  22. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  23. package/dist/AllowLists/SimpleDenyList.d.ts +31 -2
  24. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  25. package/dist/AllowLists/SimpleDenyList.js +41 -129
  26. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  27. package/dist/Auth/PassthroughAuth.cjs +1 -1
  28. package/dist/Auth/PassthroughAuth.cjs.map +1 -1
  29. package/dist/Auth/PassthroughAuth.js +4 -4
  30. package/dist/Auth/PassthroughAuth.js.map +1 -1
  31. package/dist/Boost.cjs +1 -1
  32. package/dist/Boost.cjs.map +1 -1
  33. package/dist/Boost.d.ts +93 -1
  34. package/dist/Boost.d.ts.map +1 -1
  35. package/dist/Boost.js +151 -5
  36. package/dist/Boost.js.map +1 -1
  37. package/dist/BoostCore.cjs +2 -2
  38. package/dist/BoostCore.cjs.map +1 -1
  39. package/dist/BoostCore.d.ts +12 -6
  40. package/dist/BoostCore.d.ts.map +1 -1
  41. package/dist/BoostCore.js +168 -166
  42. package/dist/BoostCore.js.map +1 -1
  43. package/dist/BoostRegistry.cjs +1 -1
  44. package/dist/BoostRegistry.cjs.map +1 -1
  45. package/dist/BoostRegistry.d.ts +4 -4
  46. package/dist/BoostRegistry.d.ts.map +1 -1
  47. package/dist/BoostRegistry.js +19 -24
  48. package/dist/BoostRegistry.js.map +1 -1
  49. package/dist/Budgets/Budget.cjs +1 -1
  50. package/dist/Budgets/Budget.js +1 -1
  51. package/dist/Budgets/ManagedBudget.cjs +1 -1
  52. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  53. package/dist/Budgets/ManagedBudget.d.ts +40 -2
  54. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  55. package/dist/Budgets/ManagedBudget.js +53 -36
  56. package/dist/Budgets/ManagedBudget.js.map +1 -1
  57. package/dist/Budgets/SimpleBudget.d.ts +33 -2
  58. package/dist/Budgets/SimpleBudget.d.ts.map +1 -1
  59. package/dist/Budgets/VestingBudget.d.ts +54 -2
  60. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  61. package/dist/Deployable/Contract.cjs +1 -1
  62. package/dist/Deployable/Contract.cjs.map +1 -1
  63. package/dist/Deployable/Contract.js +1 -1
  64. package/dist/Deployable/Contract.js.map +1 -1
  65. package/dist/Deployable/DeployableTarget.cjs +1 -1
  66. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  67. package/dist/Deployable/DeployableTarget.js +3 -3
  68. package/dist/Deployable/DeployableTarget.js.map +1 -1
  69. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  70. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  71. package/dist/Incentives/AllowListIncentive.d.ts +35 -5
  72. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  73. package/dist/Incentives/AllowListIncentive.js +33 -21
  74. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  75. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  76. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  77. package/dist/Incentives/CGDAIncentive.d.ts +89 -5
  78. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  79. package/dist/Incentives/CGDAIncentive.js +44 -23
  80. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  81. package/dist/Incentives/ERC1155Incentive.d.ts +67 -6
  82. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  83. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  84. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  85. package/dist/Incentives/ERC20Incentive.d.ts +49 -5
  86. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  87. package/dist/Incentives/ERC20Incentive.js +46 -27
  88. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  89. package/dist/Incentives/ERC20VariableIncentive.d.ts +42 -5
  90. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  91. package/dist/Incentives/Incentive.cjs +1 -1
  92. package/dist/Incentives/Incentive.cjs.map +1 -1
  93. package/dist/Incentives/Incentive.js +48 -32
  94. package/dist/Incentives/Incentive.js.map +1 -1
  95. package/dist/Incentives/PointsIncentive.cjs +1 -1
  96. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  97. package/dist/Incentives/PointsIncentive.d.ts +49 -5
  98. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  99. package/dist/Incentives/PointsIncentive.js +38 -21
  100. package/dist/Incentives/PointsIncentive.js.map +1 -1
  101. package/dist/Validators/SignerValidator.cjs +1 -1
  102. package/dist/Validators/SignerValidator.cjs.map +1 -1
  103. package/dist/Validators/SignerValidator.d.ts +298 -5
  104. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  105. package/dist/Validators/SignerValidator.js +151 -26
  106. package/dist/Validators/SignerValidator.js.map +1 -1
  107. package/dist/Validators/Validator.cjs +1 -1
  108. package/dist/Validators/Validator.js +1 -1
  109. package/dist/claiming.cjs +2 -0
  110. package/dist/claiming.cjs.map +1 -0
  111. package/dist/claiming.d.ts +43 -0
  112. package/dist/claiming.d.ts.map +1 -0
  113. package/dist/claiming.js +17 -0
  114. package/dist/claiming.js.map +1 -0
  115. package/dist/errors.cjs.map +1 -1
  116. package/dist/errors.d.ts +1 -1
  117. package/dist/errors.d.ts.map +1 -1
  118. package/dist/errors.js.map +1 -1
  119. package/dist/{generated-Cbv8zFkf.js → generated-57_Kffpz.js} +8 -5
  120. package/dist/generated-57_Kffpz.js.map +1 -0
  121. package/dist/{generated-BzszviNp.cjs → generated-wKBNvm48.cjs} +2 -2
  122. package/dist/generated-wKBNvm48.cjs.map +1 -0
  123. package/dist/index.cjs +1 -1
  124. package/dist/index.d.ts +4 -4
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +108 -125
  127. package/dist/transfers.cjs +2 -0
  128. package/dist/transfers.cjs.map +1 -0
  129. package/dist/transfers.d.ts +198 -0
  130. package/dist/transfers.d.ts.map +1 -0
  131. package/dist/transfers.js +84 -0
  132. package/dist/transfers.js.map +1 -0
  133. package/dist/utils.cjs +1 -1
  134. package/dist/utils.cjs.map +1 -1
  135. package/dist/utils.d.ts +2 -1371
  136. package/dist/utils.d.ts.map +1 -1
  137. package/dist/utils.js +26 -653
  138. package/dist/utils.js.map +1 -1
  139. package/package.json +17 -3
  140. package/src/Actions/Action.test.ts +5 -4
  141. package/src/Actions/ContractAction.test.ts +4 -6
  142. package/src/Actions/ContractAction.ts +73 -10
  143. package/src/Actions/ERC721MintAction.test.ts +2 -2
  144. package/src/Actions/ERC721MintAction.ts +70 -16
  145. package/src/Actions/EventAction.test.ts +43 -17
  146. package/src/Actions/EventAction.ts +452 -35
  147. package/src/AllowLists/SimpleAllowList.ts +48 -5
  148. package/src/AllowLists/SimpleDenyList.ts +47 -109
  149. package/src/Auth/PassthroughAuth.ts +1 -1
  150. package/src/Boost.ts +136 -1
  151. package/src/BoostCore.test.ts +4 -11
  152. package/src/BoostCore.ts +39 -33
  153. package/src/BoostRegistry.ts +19 -22
  154. package/src/Budgets/ManagedBudget.ts +69 -16
  155. package/src/Budgets/SimpleBudget.ts +57 -14
  156. package/src/Budgets/VestingBudget.ts +79 -9
  157. package/src/Deployable/Contract.ts +1 -1
  158. package/src/Deployable/DeployableTarget.ts +2 -2
  159. package/src/Incentives/AllowListIncentive.test.ts +2 -5
  160. package/src/Incentives/AllowListIncentive.ts +59 -15
  161. package/src/Incentives/CGDAIncentive.test.ts +3 -7
  162. package/src/Incentives/CGDAIncentive.ts +123 -19
  163. package/src/Incentives/ERC1155Incentive.test.ts +2 -13
  164. package/src/Incentives/ERC1155Incentive.ts +104 -22
  165. package/src/Incentives/ERC20Incentive.test.ts +6 -17
  166. package/src/Incentives/ERC20Incentive.ts +86 -21
  167. package/src/Incentives/ERC20VariableIncentive.test.ts +4 -24
  168. package/src/Incentives/ERC20VariableIncentive.ts +71 -19
  169. package/src/Incentives/Incentive.test.ts +1 -1
  170. package/src/Incentives/PointsIncentive.test.ts +3 -6
  171. package/src/Incentives/PointsIncentive.ts +79 -17
  172. package/src/Validators/SignerValidator.test.ts +3 -7
  173. package/src/Validators/SignerValidator.ts +422 -13
  174. package/src/claiming.ts +56 -0
  175. package/src/errors.ts +1 -1
  176. package/src/index.ts +10 -7
  177. package/src/transfers.ts +284 -0
  178. package/src/utils.ts +3 -2052
  179. package/dist/generated-BzszviNp.cjs.map +0 -1
  180. package/dist/generated-Cbv8zFkf.js.map +0 -1
@@ -10,6 +10,7 @@ import {
10
10
  type Address,
11
11
  type ContractEventName,
12
12
  type Hex,
13
+ encodeAbiParameters,
13
14
  zeroAddress,
14
15
  zeroHash,
15
16
  } from 'viem';
@@ -23,13 +24,32 @@ import {
23
24
  type GenericLog,
24
25
  type ReadParams,
25
26
  RegistryType,
26
- type SimpleDenyListPayload,
27
27
  type WriteParams,
28
- prepareSimpleDenyListPayload,
29
28
  } from '../utils';
30
29
 
31
30
  export { simpleDenyListAbi };
32
- export type { SimpleDenyListPayload };
31
+
32
+ /**
33
+ * Object representation of a {@link SimpleDenyList} initialization payload.
34
+ *
35
+ * @export
36
+ * @interface SimpleDenyListPayload
37
+ * @typedef {SimpleDenyListPayload}
38
+ */
39
+ export interface SimpleDenyListPayload {
40
+ /**
41
+ * The allow list's owner
42
+ *
43
+ * @type {Address}
44
+ */
45
+ owner: Address;
46
+ /**
47
+ * List of denied addresses.
48
+ *
49
+ * @type {Address[]}
50
+ */
51
+ denied: Address[];
52
+ }
33
53
 
34
54
  /**
35
55
  * A generic `viem.Log` event with support for `SimpleDenyList` event types.
@@ -114,7 +134,9 @@ export class SimpleDenyList extends DeployableTarget<
114
134
  allowed: boolean[],
115
135
  params?: WriteParams<typeof simpleDenyListAbi, 'setDenied'>,
116
136
  ) {
117
- return this.awaitResult(this.setDeniedRaw(addresses, allowed, params));
137
+ return await this.awaitResult(
138
+ this.setDeniedRaw(addresses, allowed, params),
139
+ );
118
140
  }
119
141
 
120
142
  /**
@@ -146,111 +168,6 @@ export class SimpleDenyList extends DeployableTarget<
146
168
  return { hash, result };
147
169
  }
148
170
 
149
- // /**
150
- // * A typed wrapper for (viem.getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs].
151
- // * Accepts `eventName` and `eventNames` as optional parameters to narrow the returned log types.
152
- // * @example
153
- // * ```ts
154
- // * const logs = contract.getLogs({ eventName: 'EventName' })
155
- // * const logs = contract.getLogs({ eventNames: ['EventName'] })
156
- // * ```
157
- // * @public
158
- // * @async
159
- // * @template {ContractEventName<typeof simpleDenyListAbi>} event
160
- // * @template {ExtractAbiEvent<
161
- // * typeof simpleDenyListAbi,
162
- // * event
163
- // * >} [abiEvent=ExtractAbiEvent<typeof simpleDenyListAbi, event>]
164
- // * @param {?Omit<
165
- // * GetLogsParams<typeof simpleDenyListAbi, event, abiEvent, abiEvent[]>,
166
- // * 'event' | 'events'
167
- // * > & {
168
- // * eventName?: event;
169
- // * eventNames?: event[];
170
- // * }} [params]
171
- // * @returns {Promise<GetLogsReturnType<abiEvent, abiEvent[]>>}
172
- // */
173
- // public async getLogs<
174
- // event extends ContractEventName<typeof simpleDenyListAbi>,
175
- // const abiEvent extends ExtractAbiEvent<
176
- // typeof simpleDenyListAbi,
177
- // event
178
- // > = ExtractAbiEvent<typeof simpleDenyListAbi, event>,
179
- // >(
180
- // params?: Omit<
181
- // GetLogsParams<typeof simpleDenyListAbi, event, abiEvent, abiEvent[]>,
182
- // 'event' | 'events'
183
- // > & {
184
- // eventName?: event;
185
- // eventNames?: event[];
186
- // },
187
- // ): Promise<GetLogsReturnType<abiEvent, abiEvent[]>> {
188
- // return getLogs(this._config.getClient({ chainId: params?.chainId }), {
189
- // // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wag
190
- // ...(params as any),
191
- // ...(params?.eventName
192
- // ? {
193
- // event: getAbiItem({
194
- // abi: simpleDenyListAbi,
195
- // name: params.eventName,
196
- // // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue
197
- // } as any),
198
- // }
199
- // : {}),
200
- // ...(params?.eventNames
201
- // ? {
202
- // events: params.eventNames.map((name) =>
203
- // getAbiItem({
204
- // abi: simpleDenyListAbi,
205
- // name,
206
- // // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue
207
- // } as any),
208
- // ),
209
- // }
210
- // : {}),
211
- // address: this.assertValidAddress(),
212
- // });
213
- // }
214
-
215
- // /**
216
- // * A typed wrapper for `wagmi.watchContractEvent`
217
- // *
218
- // * @public
219
- // * @async
220
- // * @template {ContractEventName<typeof simpleDenyListAbi>} event
221
- // * @param {(log: SimpleDenyListLog<event>) => unknown} cb
222
- // * @param {?WatchParams<typeof simpleDenyListAbi, event> & {
223
- // * eventName?: event;
224
- // * }} [params]
225
- // * @returns {unknown, params?: any) => unknown} Unsubscribe function
226
- // */
227
- // public async subscribe<
228
- // event extends ContractEventName<typeof simpleDenyListAbi>,
229
- // >(
230
- // cb: (log: SimpleDenyListLog<event>) => unknown,
231
- // params?: WatchParams<typeof simpleDenyListAbi, event> & {
232
- // eventName?: event;
233
- // },
234
- // ) {
235
- // return watchContractEvent<
236
- // typeof this._config,
237
- // (typeof this._config)['chains'][number]['id'],
238
- // typeof simpleDenyListAbi,
239
- // event
240
- // >(this._config, {
241
- // // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
242
- // ...(params as any),
243
- // eventName: params?.eventName,
244
- // abi: simpleDenyListAbi,
245
- // address: this.assertValidAddress(),
246
- // onLogs: (logs) => {
247
- // for (let l of logs) {
248
- // cb(l as unknown as SimpleDenyListLog<event>);
249
- // }
250
- // },
251
- // });
252
- // }
253
-
254
171
  /**
255
172
  * @inheritdoc
256
173
  *
@@ -287,3 +204,24 @@ export class SimpleDenyList extends DeployableTarget<
287
204
  };
288
205
  }
289
206
  }
207
+
208
+ /**
209
+ * Given a {@link SimpleDenyListPayload}, properly encode the initialization payload.
210
+ *
211
+ * @param {SimpleDenyListPayload} param0
212
+ * @param {Address} param0.owner - The allow list's owner
213
+ * @param {Address[]} param0.denied - List of denied addresses.
214
+ * @returns {Hex}
215
+ */
216
+ export function prepareSimpleDenyListPayload({
217
+ owner,
218
+ denied,
219
+ }: SimpleDenyListPayload) {
220
+ return encodeAbiParameters(
221
+ [
222
+ { type: 'address', name: 'owner' },
223
+ { type: 'address[]', name: 'denied' },
224
+ ],
225
+ [owner, denied],
226
+ );
227
+ }
@@ -48,7 +48,7 @@ export class PassthroughAuth extends Deployable<
48
48
  address: Address,
49
49
  params?: ReadParams<typeof passthroughAuthAbi, 'isAuthorized'>,
50
50
  ) {
51
- return readPassthroughAuthIsAuthorized(this._config, {
51
+ return await readPassthroughAuthIsAuthorized(this._config, {
52
52
  address: this.assertValidAddress(),
53
53
  args: [address],
54
54
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
package/src/Boost.ts CHANGED
@@ -1,4 +1,11 @@
1
- import { type Address, zeroAddress } from 'viem';
1
+ import { LibZip } from 'solady';
2
+ import {
3
+ type Address,
4
+ type Hex,
5
+ encodeAbiParameters,
6
+ parseAbiParameters,
7
+ zeroAddress,
8
+ } from 'viem';
2
9
  import type { Action } from './Actions/Action';
3
10
  import type { AllowList } from './AllowLists/AllowList';
4
11
  import type { Budget } from './Budgets/Budget';
@@ -153,3 +160,131 @@ export class Boost {
153
160
  this.owner = config.owner || zeroAddress;
154
161
  }
155
162
  }
163
+
164
+ /**
165
+ * Object representation of `BoostLib.Target` struct. Used for low level Boost creation operations.
166
+ * This is used to pass the base contract and its initialization parameters in an efficient manner
167
+ *
168
+ * @export
169
+ * @typedef {Target}
170
+ */
171
+ export type Target = {
172
+ isBase: boolean;
173
+ instance: Address;
174
+ parameters: Hex;
175
+ };
176
+
177
+ /**
178
+ * Object representation of `BoostCore.InitPayload` struct.
179
+ *
180
+ * @export
181
+ * @interface BoostPayload
182
+ * @typedef {BoostPayload}
183
+ */
184
+ export interface BoostPayload {
185
+ /**
186
+ * Address to valid budget.
187
+ *
188
+ * @type {Address}
189
+ */
190
+ budget: Address;
191
+ /**
192
+ * Target for existing action, or base with initialization payload.
193
+ *
194
+ * @type {Target}
195
+ */
196
+ action: Target;
197
+ /**
198
+ * Target for existing validator, or base with initialization payload.
199
+ *
200
+ * @type {Target}
201
+ */
202
+ validator: Target;
203
+ /**
204
+ * Target for existing allowList, or base with initialization payload.
205
+ *
206
+ * @type {Target}
207
+ */
208
+ allowList: Target;
209
+ /**
210
+ * Targets for new incentives, with initialization payloads.
211
+ *
212
+ * @type {Target[]}
213
+ */
214
+ incentives: Target[];
215
+ /**
216
+ * The base protocol fee (in bps)
217
+ *
218
+ * @type {?bigint}
219
+ */
220
+ protocolFee?: bigint;
221
+ /**
222
+ * The base referral fee (in bps)
223
+ *
224
+ * @type {?bigint}
225
+ */
226
+ referralFee?: bigint;
227
+ /**
228
+ * Optional maximum amount of participants in the Boost.
229
+ *
230
+ * @type {?bigint}
231
+ */
232
+ maxParticipants?: bigint;
233
+ /**
234
+ * The owner of the Boost.
235
+ *
236
+ * @type {Address}
237
+ */
238
+ owner: Address;
239
+ }
240
+
241
+ /**
242
+ * Given a valid {@link BoostPayload}, properly encode and compress the payload for use with `createBoost`
243
+ *
244
+ * @export
245
+ * @param {BoostPayload} param0
246
+ * @param {Address} param0.budget - Address to valid budget.
247
+ * @param {Target} param0.action - Target for existing action, or base with initialization payload.
248
+ * @param {Target} param0.validator - Target for existing validator, or base with initialization payload.
249
+ * @param {Target} param0.allowList - Target for existing allowList, or base with initialization payload.
250
+ * @param {Target[]} param0.incentives - Targets for new incentives, with initialization payloads.
251
+ * @param {bigint} [param0.protocolFee=0n] - The base protocol fee (in bps)
252
+ * @param {bigint} [param0.referralFee=0n] - The base referral fee (in bps)
253
+ * @param {bigint} [param0.maxParticipants=0n] - Optional maximum amount of participants in the Boost.
254
+ * @param {Address} param0.owner - The owner of the Boost.
255
+ * @returns {Hex}
256
+ */
257
+ export function prepareBoostPayload({
258
+ budget,
259
+ action,
260
+ validator,
261
+ allowList,
262
+ incentives,
263
+ protocolFee = 0n,
264
+ referralFee = 0n,
265
+ maxParticipants = 0n,
266
+ owner,
267
+ }: BoostPayload): Hex {
268
+ return LibZip.cdCompress(
269
+ encodeAbiParameters(
270
+ parseAbiParameters([
271
+ 'BoostPayload payload',
272
+ 'struct BoostPayload { address budget; Target action; Target validator; Target allowList; Target[] incentives; uint64 protocolFee; uint64 referralFee; uint256 maxParticipants; address owner; }',
273
+ 'struct Target { bool isBase; address instance; bytes parameters; }',
274
+ ]),
275
+ [
276
+ {
277
+ budget,
278
+ action,
279
+ validator,
280
+ allowList,
281
+ incentives,
282
+ protocolFee,
283
+ referralFee,
284
+ maxParticipants,
285
+ owner,
286
+ },
287
+ ],
288
+ ),
289
+ ) as Hex;
290
+ }
@@ -10,19 +10,12 @@ import {
10
10
  makeMockEventActionPayload,
11
11
  } from '../test/helpers';
12
12
  import { ContractAction } from './Actions/ContractAction';
13
- import { PassthroughAuth } from './Auth/PassthroughAuth';
14
13
  import { BoostCore } from './BoostCore';
15
14
  import type { ERC20Incentive } from './Incentives/ERC20Incentive';
15
+ import { ERC1155StrategyType } from './Incentives/ERC1155Incentive';
16
+ import { StrategyType } from './claiming';
16
17
  import { IncentiveNotCloneableError } from './errors';
17
- import {
18
- ActionStep,
19
- ERC1155StrategyType,
20
- FilterType,
21
- PrimitiveType,
22
- SignatureType,
23
- StrategyType,
24
- bytes4,
25
- } from './utils';
18
+ import { bytes4 } from './utils';
26
19
 
27
20
  let fixtures: Fixtures, budgets: BudgetFixtures;
28
21
 
@@ -683,7 +676,7 @@ describe('BoostCore', () => {
683
676
  expect(await client.claimFee()).toBe(100n);
684
677
  });
685
678
 
686
- test('binds all actions, budgets, allowlists, incentives, and validators to reuse core options and account', async () => {
679
+ test('binds all actions, budgets, allowlists, incentives, and validators to reuse core options and account', () => {
687
680
  const { core } = fixtures;
688
681
 
689
682
  // const contractAction = core.ContractAction(zeroAddress);
package/src/BoostCore.ts CHANGED
@@ -26,12 +26,13 @@ import {
26
26
  type Address,
27
27
  type ContractEventName,
28
28
  type Hex,
29
+ parseEther,
29
30
  parseEventLogs,
30
31
  zeroAddress,
31
32
  zeroHash,
32
33
  } from 'viem';
33
34
  import { type Action, actionFromAddress } from './Actions/Action';
34
- import { EventAction } from './Actions/EventAction';
35
+ import { EventAction, type EventActionPayload } from './Actions/EventAction';
35
36
  import { type AllowList, allowListFromAddress } from './AllowLists/AllowList';
36
37
  import {
37
38
  SimpleAllowList,
@@ -42,7 +43,12 @@ import {
42
43
  type SimpleDenyListPayload,
43
44
  } from './AllowLists/SimpleDenyList';
44
45
  import { type Auth, PassthroughAuth } from './Auth/Auth';
45
- import { Boost } from './Boost';
46
+ import {
47
+ Boost,
48
+ type BoostPayload,
49
+ type Target,
50
+ prepareBoostPayload,
51
+ } from './Boost';
46
52
  import { type Budget, budgetFromAddress } from './Budgets/Budget';
47
53
  import {
48
54
  ManagedBudget,
@@ -66,6 +72,7 @@ import {
66
72
  ERC20Incentive,
67
73
  type ERC20IncentivePayload,
68
74
  } from './Incentives/ERC20Incentive';
75
+ import type { ERC20VariableIncentivePayload } from './Incentives/ERC20VariableIncentive';
69
76
  import {
70
77
  ERC20VariableIncentive,
71
78
  type Incentive,
@@ -86,21 +93,18 @@ import {
86
93
  DeployableUnknownOwnerProvidedError,
87
94
  IncentiveNotCloneableError,
88
95
  MustInitializeBudgetError,
89
- NoContractAddressUponReceiptError,
90
96
  } from './errors';
91
- import {
92
- type ERC20VariableIncentivePayload,
93
- type EventActionPayload,
94
- type GenericLog,
95
- type BoostPayload as OnChainBoostPayload,
96
- type ReadParams,
97
- type Target,
98
- type WriteParams,
99
- prepareBoostPayload,
100
- } from './utils';
97
+ import type { GenericLog, ReadParams, WriteParams } from './utils';
101
98
 
102
99
  export { boostCoreAbi };
103
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
+
104
108
  /**
105
109
  * The fixed address for the deployed Boost Core.
106
110
  * By default, `new BoostCore` will use this address if not otherwise provided.
@@ -298,7 +302,7 @@ export class BoostCore extends Deployable<
298
302
  }
299
303
  }
300
304
 
301
- let budgetPayload: OnChainBoostPayload['budget'] = zeroAddress;
305
+ let budgetPayload: BoostPayload['budget'] = zeroAddress;
302
306
  if (budget.address) {
303
307
  budgetPayload = budget.address;
304
308
  if (!(await budget.isAuthorized(coreAddress))) {
@@ -310,7 +314,7 @@ export class BoostCore extends Deployable<
310
314
 
311
315
  // if we're supplying an address, it could be a pre-initialized target
312
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
313
- let actionPayload: OnChainBoostPayload['action'] = {
317
+ let actionPayload: BoostPayload['action'] = {
314
318
  instance: zeroAddress,
315
319
  isBase: true,
316
320
  parameters: zeroHash,
@@ -330,7 +334,7 @@ export class BoostCore extends Deployable<
330
334
  actionPayload.instance = action.base;
331
335
  }
332
336
 
333
- let validatorPayload: OnChainBoostPayload['validator'] = {
337
+ let validatorPayload: BoostPayload['validator'] = {
334
338
  instance: zeroAddress,
335
339
  isBase: true,
336
340
  parameters: zeroHash,
@@ -366,7 +370,7 @@ export class BoostCore extends Deployable<
366
370
  validatorPayload.instance = validator.base;
367
371
  }
368
372
 
369
- let allowListPayload: OnChainBoostPayload['allowList'] = {
373
+ let allowListPayload: BoostPayload['allowList'] = {
370
374
  instance: zeroAddress,
371
375
  isBase: true,
372
376
  parameters: zeroHash,
@@ -406,8 +410,10 @@ export class BoostCore extends Deployable<
406
410
  : zeroHash,
407
411
  };
408
412
  } else {
413
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
409
414
  incentivesPayloads[i]!.parameters =
410
415
  incentive.buildParameters(undefined, options).args.at(0) || zeroHash;
416
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
411
417
  incentivesPayloads[i]!.instance = incentive.base;
412
418
  }
413
419
  }
@@ -447,6 +453,7 @@ export class BoostCore extends Deployable<
447
453
  validator: validator.at(boost.validator),
448
454
  allowList: allowList.at(boost.allowList),
449
455
  incentives: incentives.map((incentive, i) =>
456
+ // biome-ignore lint/style/noNonNullAssertion: this will never be undefined
450
457
  incentive.at(boost.incentives.at(i)!),
451
458
  ),
452
459
  protocolFee: boost.protocolFee,
@@ -475,7 +482,7 @@ export class BoostCore extends Deployable<
475
482
  data: Hex,
476
483
  params?: WriteParams<typeof boostCoreAbi, 'claimIncentive'>,
477
484
  ) {
478
- return this.awaitResult(
485
+ return await this.awaitResult(
479
486
  this.claimIncentiveRaw(boostId, incentiveId, address, data, params),
480
487
  );
481
488
  }
@@ -487,7 +494,7 @@ export class BoostCore extends Deployable<
487
494
  * @async
488
495
  * @param {bigint} boostId - The ID of the Boost
489
496
  * @param {bigint} incentiveId - The ID of the Incentive
490
- * @param {Address} address - The address of the referrer (if any)
497
+ * @param {Address} referrer - The address of the referrer (if any)
491
498
  * @param {Hex} data- The data for the claim
492
499
  * @param {?WriteParams<typeof boostCoreAbi, 'claimIncentive'>} [params]
493
500
  * @returns {unknown}
@@ -495,7 +502,7 @@ export class BoostCore extends Deployable<
495
502
  public async claimIncentiveRaw(
496
503
  boostId: bigint,
497
504
  incentiveId: bigint,
498
- address: Address,
505
+ referrer: Address,
499
506
  data: Hex,
500
507
  params?: WriteParams<typeof boostCoreAbi, 'claimIncentive'>,
501
508
  ) {
@@ -503,7 +510,7 @@ export class BoostCore extends Deployable<
503
510
  this._config,
504
511
  {
505
512
  address: this.assertValidAddress(),
506
- args: [boostId, incentiveId, address, data],
513
+ args: [boostId, incentiveId, referrer, data],
507
514
  ...this.optionallyAttachAccount(),
508
515
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
509
516
  ...(params as any),
@@ -534,7 +541,7 @@ export class BoostCore extends Deployable<
534
541
  claimant: Address,
535
542
  params?: WriteParams<typeof boostCoreAbi, 'claimIncentiveFor'>,
536
543
  ) {
537
- return this.awaitResult(
544
+ return await this.awaitResult(
538
545
  this.claimIncentiveForRaw(
539
546
  boostId,
540
547
  incentiveId,
@@ -594,7 +601,7 @@ export class BoostCore extends Deployable<
594
601
  id: bigint,
595
602
  params?: ReadParams<typeof boostCoreAbi, 'getBoost'>,
596
603
  ) {
597
- return readBoostCoreGetBoost(this._config, {
604
+ return await readBoostCoreGetBoost(this._config, {
598
605
  address: this.assertValidAddress(),
599
606
  args: [id],
600
607
  ...this.optionallyAttachAccount(),
@@ -668,7 +675,7 @@ export class BoostCore extends Deployable<
668
675
  public async getBoostCount(
669
676
  params?: ReadParams<typeof boostCoreAbi, 'getBoostCount'>,
670
677
  ) {
671
- return readBoostCoreGetBoostCount(this._config, {
678
+ return await readBoostCoreGetBoostCount(this._config, {
672
679
  address: this.assertValidAddress(),
673
680
  args: [],
674
681
  ...this.optionallyAttachAccount(),
@@ -713,7 +720,7 @@ export class BoostCore extends Deployable<
713
720
  public async createBoostAuth(
714
721
  params?: ReadParams<typeof boostCoreAbi, 'createBoostAuth'>,
715
722
  ) {
716
- return readBoostCoreCreateBoostAuth(this._config, {
723
+ return await readBoostCoreCreateBoostAuth(this._config, {
717
724
  address: this.assertValidAddress(),
718
725
  args: [],
719
726
  ...this.optionallyAttachAccount(),
@@ -735,7 +742,7 @@ export class BoostCore extends Deployable<
735
742
  auth: Auth,
736
743
  params?: WriteParams<typeof boostCoreAbi, 'setCreateBoostAuth'>,
737
744
  ) {
738
- return this.awaitResult(
745
+ return await this.awaitResult(
739
746
  this.setCreateBoostAuthRaw(auth.assertValidAddress(), {
740
747
  ...params,
741
748
  }),
@@ -780,7 +787,7 @@ export class BoostCore extends Deployable<
780
787
  public async protocolFee(
781
788
  params?: ReadParams<typeof boostCoreAbi, 'protocolFee'>,
782
789
  ) {
783
- return readBoostCoreProtocolFee(this._config, {
790
+ return await readBoostCoreProtocolFee(this._config, {
784
791
  address: this.assertValidAddress(),
785
792
  args: [],
786
793
  ...this.optionallyAttachAccount(),
@@ -800,7 +807,7 @@ export class BoostCore extends Deployable<
800
807
  public async protocolFeeReceiver(
801
808
  params?: ReadParams<typeof boostCoreAbi, 'protocolFeeReceiver'>,
802
809
  ) {
803
- return readBoostCoreProtocolFeeReceiver(this._config, {
810
+ return await readBoostCoreProtocolFeeReceiver(this._config, {
804
811
  address: this.assertValidAddress(),
805
812
  args: [],
806
813
  ...this.optionallyAttachAccount(),
@@ -822,7 +829,7 @@ export class BoostCore extends Deployable<
822
829
  address: Address,
823
830
  params?: WriteParams<typeof boostCoreAbi, 'setProtocolFeeReceiver'>,
824
831
  ) {
825
- return this.awaitResult(
832
+ return await this.awaitResult(
826
833
  this.setProcolFeeReceiverRaw(address, {
827
834
  ...params,
828
835
  }),
@@ -868,7 +875,7 @@ export class BoostCore extends Deployable<
868
875
  * @returns {unknown}
869
876
  */
870
877
  public async claimFee(params?: ReadParams<typeof boostCoreAbi, 'claimFee'>) {
871
- return readBoostCoreClaimFee(this._config, {
878
+ return await readBoostCoreClaimFee(this._config, {
872
879
  address: this.assertValidAddress(),
873
880
  args: [],
874
881
  ...this.optionallyAttachAccount(),
@@ -890,7 +897,7 @@ export class BoostCore extends Deployable<
890
897
  claimFee: bigint,
891
898
  params?: WriteParams<typeof boostCoreAbi, 'setClaimFee'>,
892
899
  ) {
893
- return this.awaitResult(this.setClaimFeeRaw(claimFee, params));
900
+ return await this.awaitResult(this.setClaimFeeRaw(claimFee, params));
894
901
  }
895
902
 
896
903
  /**
@@ -928,8 +935,7 @@ export class BoostCore extends Deployable<
928
935
  * const auth = core.PassthroughAuth('0x') // is roughly equivalent to
929
936
  * const auth = new PassthroughAuth({ config: core._config, account: core._account }, '0x')
930
937
  * ```
931
- * @param {DeployablePayloadOrAddress<{}>} options
932
- * @param {?boolean} [isBase]
938
+ * @param {Address} address
933
939
  * @returns {PassthroughAuth}
934
940
  */
935
941
  PassthroughAuth(address?: Address) {