@boostxyz/sdk 8.0.0-canary.3 → 8.0.0-canary.5

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 (165) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.js +2 -2
  3. package/dist/Actions/EventAction.cjs +1 -1
  4. package/dist/Actions/EventAction.cjs.map +1 -1
  5. package/dist/Actions/EventAction.d.ts.map +1 -1
  6. package/dist/Actions/EventAction.js +184 -181
  7. package/dist/Actions/EventAction.js.map +1 -1
  8. package/dist/{AllowList-DQf-8HQC.js → AllowList-CTRuUBCQ.js} +41 -41
  9. package/dist/{AllowList-DQf-8HQC.js.map → AllowList-CTRuUBCQ.js.map} +1 -1
  10. package/dist/{AllowList-DaX239DR.cjs → AllowList-GEmUfOR1.cjs} +2 -2
  11. package/dist/{AllowList-DaX239DR.cjs.map → AllowList-GEmUfOR1.cjs.map} +1 -1
  12. package/dist/AllowLists/AllowList.cjs +1 -1
  13. package/dist/AllowLists/AllowList.js +4 -4
  14. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  15. package/dist/AllowLists/SimpleAllowList.js +7 -7
  16. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  17. package/dist/AllowLists/SimpleDenyList.js +3 -3
  18. package/dist/Auth/PassthroughAuth.cjs +1 -1
  19. package/dist/Auth/PassthroughAuth.js +2 -2
  20. package/dist/BoostCore.cjs +2 -2
  21. package/dist/BoostCore.cjs.map +1 -1
  22. package/dist/BoostCore.d.ts +137 -2
  23. package/dist/BoostCore.d.ts.map +1 -1
  24. package/dist/BoostCore.js +336 -206
  25. package/dist/BoostCore.js.map +1 -1
  26. package/dist/BoostRegistry.cjs +1 -1
  27. package/dist/BoostRegistry.js +21 -21
  28. package/dist/{Budget-LnAQ_Slw.js → Budget-BH0s7Bxu.js} +52 -52
  29. package/dist/{Budget-LnAQ_Slw.js.map → Budget-BH0s7Bxu.js.map} +1 -1
  30. package/dist/{Budget-WIB8IJoM.cjs → Budget-CwNhsa3m.cjs} +2 -2
  31. package/dist/{Budget-WIB8IJoM.cjs.map → Budget-CwNhsa3m.cjs.map} +1 -1
  32. package/dist/Budgets/Budget.cjs +1 -1
  33. package/dist/Budgets/Budget.js +3 -3
  34. package/dist/Budgets/ManagedBudget.cjs +1 -1
  35. package/dist/Budgets/ManagedBudget.js +26 -26
  36. package/dist/Deployable/DeployableTarget.cjs +1 -1
  37. package/dist/Deployable/DeployableTarget.js +1 -1
  38. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  39. package/dist/Deployable/DeployableTargetWithRBAC.js +17 -17
  40. package/dist/{Incentive-gT7z-4v3.cjs → Incentive-B2ZBE5LU.cjs} +2 -2
  41. package/dist/{Incentive-gT7z-4v3.cjs.map → Incentive-B2ZBE5LU.cjs.map} +1 -1
  42. package/dist/{Incentive-D_IBex5V.js → Incentive-BCSV7OtF.js} +41 -41
  43. package/dist/{Incentive-D_IBex5V.js.map → Incentive-BCSV7OtF.js.map} +1 -1
  44. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  45. package/dist/Incentives/AllowListIncentive.js +17 -17
  46. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  47. package/dist/Incentives/CGDAIncentive.js +14 -14
  48. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  49. package/dist/Incentives/ERC20Incentive.js +13 -13
  50. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs +1 -1
  51. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js +71 -71
  52. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs +1 -1
  53. package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js +35 -35
  54. package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
  55. package/dist/Incentives/ERC20VariableCriteriaIncentive.js +9 -9
  56. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs +1 -1
  57. package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js +12 -12
  58. package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
  59. package/dist/Incentives/ERC20VariableIncentive.js +8 -8
  60. package/dist/Incentives/Incentive.cjs +1 -1
  61. package/dist/Incentives/Incentive.js +3 -3
  62. package/dist/Incentives/PointsIncentive.cjs +1 -1
  63. package/dist/Incentives/PointsIncentive.js +28 -28
  64. package/dist/{SimpleDenyList-D5AoBdVi.cjs → SimpleDenyList-6_sxnZB0.cjs} +2 -2
  65. package/dist/{SimpleDenyList-D5AoBdVi.cjs.map → SimpleDenyList-6_sxnZB0.cjs.map} +1 -1
  66. package/dist/{SimpleDenyList-CtdXM49y.js → SimpleDenyList-CrjjFnn5.js} +17 -17
  67. package/dist/{SimpleDenyList-CtdXM49y.js.map → SimpleDenyList-CrjjFnn5.js.map} +1 -1
  68. package/dist/Validators/LimitedSignerValidator.cjs +1 -1
  69. package/dist/Validators/LimitedSignerValidator.cjs.map +1 -1
  70. package/dist/Validators/LimitedSignerValidator.d.ts +9 -9
  71. package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
  72. package/dist/Validators/LimitedSignerValidator.js +19 -19
  73. package/dist/Validators/LimitedSignerValidator.js.map +1 -1
  74. package/dist/Validators/LimitedSignerValidatorV2.cjs +2 -0
  75. package/dist/Validators/LimitedSignerValidatorV2.cjs.map +1 -0
  76. package/dist/Validators/LimitedSignerValidatorV2.d.ts +842 -0
  77. package/dist/Validators/LimitedSignerValidatorV2.d.ts.map +1 -0
  78. package/dist/Validators/LimitedSignerValidatorV2.js +301 -0
  79. package/dist/Validators/LimitedSignerValidatorV2.js.map +1 -0
  80. package/dist/Validators/PayableLimitedSignerValidator.cjs +2 -0
  81. package/dist/Validators/PayableLimitedSignerValidator.cjs.map +1 -0
  82. package/dist/Validators/PayableLimitedSignerValidator.d.ts.map +1 -1
  83. package/dist/{Validator-BEUqV28V.js → Validators/PayableLimitedSignerValidator.js} +56 -102
  84. package/dist/Validators/PayableLimitedSignerValidator.js.map +1 -0
  85. package/dist/Validators/PayableLimitedSignerValidatorV2.cjs +2 -0
  86. package/dist/Validators/PayableLimitedSignerValidatorV2.cjs.map +1 -0
  87. package/dist/Validators/PayableLimitedSignerValidatorV2.d.ts +855 -0
  88. package/dist/Validators/PayableLimitedSignerValidatorV2.d.ts.map +1 -0
  89. package/dist/Validators/PayableLimitedSignerValidatorV2.js +372 -0
  90. package/dist/Validators/PayableLimitedSignerValidatorV2.js.map +1 -0
  91. package/dist/Validators/SignerValidator.cjs +1 -1
  92. package/dist/Validators/SignerValidator.cjs.map +1 -1
  93. package/dist/Validators/SignerValidator.d.ts +4 -2
  94. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  95. package/dist/Validators/SignerValidator.js +12 -12
  96. package/dist/Validators/SignerValidator.js.map +1 -1
  97. package/dist/Validators/SignerValidatorV2.cjs +2 -0
  98. package/dist/Validators/SignerValidatorV2.cjs.map +1 -0
  99. package/dist/Validators/SignerValidatorV2.d.ts +728 -0
  100. package/dist/Validators/SignerValidatorV2.d.ts.map +1 -0
  101. package/dist/Validators/SignerValidatorV2.js +299 -0
  102. package/dist/Validators/SignerValidatorV2.js.map +1 -0
  103. package/dist/Validators/Validator.cjs +1 -1
  104. package/dist/Validators/Validator.cjs.map +1 -1
  105. package/dist/Validators/Validator.d.ts +19 -4
  106. package/dist/Validators/Validator.d.ts.map +1 -1
  107. package/dist/Validators/Validator.js +79 -14
  108. package/dist/Validators/Validator.js.map +1 -1
  109. package/dist/componentInterfaces-43ygGrVO.js +28 -0
  110. package/dist/componentInterfaces-43ygGrVO.js.map +1 -0
  111. package/dist/componentInterfaces-JU4NBkEc.cjs +2 -0
  112. package/dist/componentInterfaces-JU4NBkEc.cjs.map +1 -0
  113. package/dist/{deployments-Dw5Suk_D.js → deployments-COm00j8v.js} +48 -39
  114. package/dist/{deployments-Dw5Suk_D.js.map → deployments-COm00j8v.js.map} +1 -1
  115. package/dist/deployments-uLDgrxCp.cjs +2 -0
  116. package/dist/deployments-uLDgrxCp.cjs.map +1 -0
  117. package/dist/deployments.json +30 -21
  118. package/dist/generated-CkZm1EVH.cjs +3 -0
  119. package/dist/generated-CkZm1EVH.cjs.map +1 -0
  120. package/dist/{generated-krkFnwbV.js → generated-DRbljODL.js} +2314 -1284
  121. package/dist/generated-DRbljODL.js.map +1 -0
  122. package/dist/index.cjs +1 -1
  123. package/dist/index.d.ts +3 -0
  124. package/dist/index.d.ts.map +1 -1
  125. package/dist/index.js +185 -165
  126. package/dist/index.js.map +1 -1
  127. package/package.json +25 -1
  128. package/src/Actions/EventAction.ts +24 -5
  129. package/src/BoostCore.test.ts +77 -11
  130. package/src/BoostCore.ts +165 -4
  131. package/src/Budgets/ManagedBudgetWithFees.test.ts +14 -14
  132. package/src/Budgets/ManagedBudgetWithFeesV2.test.ts +3 -3
  133. package/src/Incentives/AllowListIncentive.test.ts +5 -5
  134. package/src/Incentives/CGDAIncentive.test.ts +6 -6
  135. package/src/Incentives/ERC1155Incentive.test.ts +2 -2
  136. package/src/Incentives/ERC20Incentive.test.ts +6 -6
  137. package/src/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.test.ts +5 -5
  138. package/src/Incentives/ERC20VariableCriteriaIncentiveV2.test.ts +5 -5
  139. package/src/Incentives/ERC20VariableIncentive.test.ts +7 -8
  140. package/src/Incentives/PointsIncentive.test.ts +5 -5
  141. package/src/Validators/LimitedSignerValidator.test.ts +1 -1
  142. package/src/Validators/LimitedSignerValidator.ts +9 -10
  143. package/src/Validators/LimitedSignerValidatorV2.test.ts +231 -0
  144. package/src/Validators/LimitedSignerValidatorV2.ts +707 -0
  145. package/src/Validators/PayableLimitedSignerValidator.test.ts +1 -1
  146. package/src/Validators/PayableLimitedSignerValidator.ts +0 -1
  147. package/src/Validators/PayableLimitedSignerValidatorV2.test.ts +202 -0
  148. package/src/Validators/PayableLimitedSignerValidatorV2.ts +688 -0
  149. package/src/Validators/SignerValidator.ts +4 -2
  150. package/src/Validators/SignerValidatorV2.test.ts +163 -0
  151. package/src/Validators/SignerValidatorV2.ts +635 -0
  152. package/src/Validators/Validator.ts +45 -2
  153. package/src/index.ts +3 -0
  154. package/dist/Validator-BEUqV28V.js.map +0 -1
  155. package/dist/Validator-FxcxYKhR.cjs +0 -2
  156. package/dist/Validator-FxcxYKhR.cjs.map +0 -1
  157. package/dist/componentInterfaces-BZ3fSNkT.cjs +0 -2
  158. package/dist/componentInterfaces-BZ3fSNkT.cjs.map +0 -1
  159. package/dist/componentInterfaces-D2s6AXlV.js +0 -25
  160. package/dist/componentInterfaces-D2s6AXlV.js.map +0 -1
  161. package/dist/deployments-DimWVnA4.cjs +0 -2
  162. package/dist/deployments-DimWVnA4.cjs.map +0 -1
  163. package/dist/generated-Cf82M-QP.cjs +0 -3
  164. package/dist/generated-Cf82M-QP.cjs.map +0 -1
  165. package/dist/generated-krkFnwbV.js.map +0 -1
@@ -0,0 +1,688 @@
1
+ import {
2
+ payableLimitedSignerValidatorV2Abi,
3
+ readPayableLimitedSignerValidatorV2GetClaimFee,
4
+ readPayableLimitedSignerValidatorV2HashSignerData,
5
+ readPayableLimitedSignerValidatorV2Signers,
6
+ simulatePayableLimitedSignerValidatorV2SetAuthorized,
7
+ simulatePayableLimitedSignerValidatorV2SetClaimFee,
8
+ simulatePayableLimitedSignerValidatorV2SetValidatorCaller,
9
+ simulatePayableLimitedSignerValidatorV2Validate,
10
+ writePayableLimitedSignerValidatorV2SetAuthorized,
11
+ writePayableLimitedSignerValidatorV2SetClaimFee,
12
+ writePayableLimitedSignerValidatorV2SetValidatorCaller,
13
+ writePayableLimitedSignerValidatorV2Validate,
14
+ } from '@boostxyz/evm';
15
+ import { bytecode } from '@boostxyz/evm/artifacts/contracts/validators/PayableLimitedSignerValidatorV2.sol/PayableLimitedSignerValidatorV2.json';
16
+ import {
17
+ type Address,
18
+ type ContractEventName,
19
+ type Hex,
20
+ type PrivateKeyAccount,
21
+ encodeAbiParameters,
22
+ } from 'viem';
23
+ import { PayableLimitedSignerValidatorV2 as PayableLimitedSignerValidatorV2Bases } from '../../dist/deployments.json';
24
+ import type {
25
+ DeployableOptions,
26
+ GenericDeployableParams,
27
+ } from '../Deployable/Deployable';
28
+ import { DeployableTarget } from '../Deployable/DeployableTarget';
29
+ import {
30
+ type GenericLog,
31
+ type ReadParams,
32
+ RegistryType,
33
+ type WriteParams,
34
+ } from '../utils';
35
+ import type {
36
+ LimitedSignerValidatorInputParams,
37
+ LimitedSignerValidatorValidatePayload,
38
+ } from './LimitedSignerValidator';
39
+
40
+ export { payableLimitedSignerValidatorV2Abi };
41
+
42
+ /**
43
+ * Object representation of a {@link PayableLimitedSignerValidatorV2} initialization payload
44
+ *
45
+ * @export
46
+ * @interface PayableLimitedSignerValidatorV2Payload
47
+ * @typedef {PayableLimitedSignerValidatorV2Payload}
48
+ */
49
+ export interface PayableLimitedSignerValidatorV2Payload {
50
+ /**
51
+ * The list of authorized signers. The first address in the list will be the initial owner of the contract.
52
+ *
53
+ * @type {Address[]}
54
+ */
55
+ signers: Address[];
56
+ /**
57
+ * The authorized caller of the validator function
58
+ * @type {Address}
59
+ */
60
+ validatorCaller: Address;
61
+ /**
62
+ * The max quantity of claims a user can make for a given incentive
63
+ * @type {number}
64
+ */
65
+ maxClaimCount: number;
66
+ }
67
+
68
+ /**
69
+ * Extended validate payload that includes the payment value
70
+ *
71
+ * @export
72
+ * @interface PayableLimitedSignerValidatorV2ValidatePayload
73
+ * @typedef {PayableLimitedSignerValidatorV2ValidatePayload}
74
+ */
75
+ export interface PayableLimitedSignerValidatorV2ValidatePayload
76
+ extends LimitedSignerValidatorValidatePayload {
77
+ /**
78
+ * The amount of ETH to send with the validation call (must match claimFee exactly)
79
+ *
80
+ * @type {bigint}
81
+ */
82
+ value: bigint;
83
+ }
84
+
85
+ /**
86
+ * Signer Validator Claim Data Payload
87
+ *
88
+ * @export
89
+ * @interface PayableLimitedSignerValidatorV2ClaimDataParams
90
+ * @typedef {PayableLimitedSignerValidatorV2ClaimDataParams}
91
+ */
92
+ export interface PayableLimitedSignerValidatorV2ClaimDataParams {
93
+ /**
94
+ * The signer with which to sign the input
95
+ *
96
+ * @type {{
97
+ * account: Address;
98
+ * key: Hex;
99
+ * privateKey: PrivateKeyAccount;
100
+ * }}
101
+ */
102
+ signer: {
103
+ account: Address;
104
+ key: Hex;
105
+ privateKey: PrivateKeyAccount;
106
+ };
107
+ /**
108
+ * The encoded data to provide the underlying incentive
109
+ *
110
+ * @type {Hex}
111
+ */
112
+ incentiveData: Hex;
113
+ /**
114
+ * The chain id to target
115
+ *
116
+ * @type {number}
117
+ */
118
+ chainId: number;
119
+ /**
120
+ * The address of the validator
121
+ *
122
+ * @type {Address}
123
+ */
124
+ validator: Address;
125
+ /**
126
+ * The incentive quantity.
127
+ *
128
+ * @type {number}
129
+ */
130
+ incentiveQuantity: number;
131
+ /**
132
+ * The address of the claimant
133
+ *
134
+ * @type {Address}
135
+ */
136
+ claimant: Address;
137
+ /**
138
+ * The ID of the boost
139
+ *
140
+ * @type {bigint}
141
+ */
142
+ boostId: bigint;
143
+ /**
144
+ * The address of the referrer
145
+ *
146
+ * @type {?Address}
147
+ */
148
+ referrer?: Address;
149
+ }
150
+
151
+ /**
152
+ * Object representing the payload for signing before validation.
153
+ *
154
+ * @export
155
+ * @interface PayableLimitedSignerValidatorV2SignaturePayload
156
+ * @typedef {PayableLimitedSignerValidatorV2SignaturePayload}
157
+ */
158
+ export interface PayableLimitedSignerValidatorV2SignaturePayload {
159
+ /**
160
+ * The ID of the boost.
161
+ *
162
+ * @type {bigint}
163
+ */
164
+ boostId: bigint;
165
+ /**
166
+ * The ID of the incentive.
167
+ *
168
+ * @type {number}
169
+ */
170
+ incentiveQuantity: number;
171
+ /**
172
+ * The address of the claimant.
173
+ *
174
+ * @type {Address}
175
+ */
176
+ claimant: Address;
177
+ /**
178
+ * The claim data.
179
+ *
180
+ * @type {Hex}
181
+ */
182
+ incentiveData: Hex;
183
+ /**
184
+ * The address of the referrer (defaults to claimant if omitted)
185
+ *
186
+ * @type {?Address}
187
+ */
188
+ referrer?: Address;
189
+ }
190
+
191
+ /**
192
+ * A generic `viem.Log` event with support for `PayableLimitedSignerValidatorV2` event types.
193
+ *
194
+ * @export
195
+ * @typedef {PayableLimitedSignerValidatorV2Log}
196
+ */
197
+ export type PayableLimitedSignerValidatorV2Log<
198
+ event extends ContractEventName<
199
+ typeof payableLimitedSignerValidatorV2Abi
200
+ > = ContractEventName<typeof payableLimitedSignerValidatorV2Abi>,
201
+ > = GenericLog<typeof payableLimitedSignerValidatorV2Abi, event>;
202
+
203
+ /**
204
+ * A validator that verifies signatures, limits claims per address, and requires a claim fee.
205
+ * The claim fee is stored on the base implementation and all clones read from it.
206
+ * This allows updating the fee globally by only changing it on the base.
207
+ *
208
+ * @export
209
+ * @class PayableLimitedSignerValidatorV2
210
+ * @extends {DeployableTarget}
211
+ */
212
+ export class PayableLimitedSignerValidatorV2 extends DeployableTarget<
213
+ PayableLimitedSignerValidatorV2Payload,
214
+ typeof payableLimitedSignerValidatorV2Abi
215
+ > {
216
+ /**
217
+ * @inheritdoc
218
+ *
219
+ * @public
220
+ * @readonly
221
+ * @type {*}
222
+ */
223
+ public override readonly abi = payableLimitedSignerValidatorV2Abi;
224
+
225
+ /**
226
+ * @inheritdoc
227
+ *
228
+ * @public
229
+ * @static
230
+ * @type {Record<number, Address>}
231
+ */
232
+ public static override bases: Record<number, Address> = {
233
+ ...(import.meta.env?.VITE_PAYABLE_LIMITED_SIGNER_VALIDATOR_BASE
234
+ ? { 31337: import.meta.env.VITE_PAYABLE_LIMITED_SIGNER_VALIDATOR_BASE }
235
+ : {}),
236
+ ...(PayableLimitedSignerValidatorV2Bases as Record<number, Address>),
237
+ };
238
+
239
+ /**
240
+ * @inheritdoc
241
+ *
242
+ * @public
243
+ * @static
244
+ * @type {RegistryType}
245
+ */
246
+ public static override registryType: RegistryType = RegistryType.VALIDATOR;
247
+
248
+ /**
249
+ * Get the current claim fee. For clones, this reads from the base implementation.
250
+ *
251
+ * @public
252
+ * @async
253
+ * @param {?ReadParams} [params]
254
+ * @returns {Promise<bigint>}
255
+ */
256
+ public async getClaimFee(params?: ReadParams): Promise<bigint> {
257
+ return await readPayableLimitedSignerValidatorV2GetClaimFee(this._config, {
258
+ address: this.assertValidAddress(),
259
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters
260
+ ...(params as any),
261
+ });
262
+ }
263
+
264
+ /**
265
+ * Set the claim fee (only callable on the base implementation by the owner)
266
+ *
267
+ * @public
268
+ * @async
269
+ * @param {bigint} newFee - The new claim fee amount in wei
270
+ * @param {?WriteParams} [params]
271
+ * @returns {Promise<void>}
272
+ */
273
+ public async setClaimFee(
274
+ newFee: bigint,
275
+ params?: WriteParams,
276
+ ): Promise<void> {
277
+ return await this.awaitResult(this.setClaimFeeRaw(newFee, params));
278
+ }
279
+
280
+ /**
281
+ * Set the claim fee (only callable on the base implementation by the owner)
282
+ *
283
+ * @public
284
+ * @async
285
+ * @param {bigint} newFee - The new claim fee amount in wei
286
+ * @param {?WriteParams} [params]
287
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
288
+ */
289
+ public async setClaimFeeRaw(newFee: bigint, params?: WriteParams) {
290
+ const { request, result } =
291
+ await simulatePayableLimitedSignerValidatorV2SetClaimFee(this._config, {
292
+ address: this.assertValidAddress(),
293
+ args: [newFee],
294
+ ...this.optionallyAttachAccount(),
295
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters
296
+ ...(params as any),
297
+ });
298
+ const hash = await writePayableLimitedSignerValidatorV2SetClaimFee(
299
+ this._config,
300
+ request,
301
+ );
302
+ return { hash, result };
303
+ }
304
+
305
+ /**
306
+ * The set of authorized signers
307
+ *
308
+ * @public
309
+ * @async
310
+ * @param {Address} address
311
+ * @param {?ReadParams} [params]
312
+ * @returns {Promise<boolean>}
313
+ */
314
+ public async signers(address: Address, params?: ReadParams) {
315
+ return await readPayableLimitedSignerValidatorV2Signers(this._config, {
316
+ address: this.assertValidAddress(),
317
+ args: [address],
318
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
319
+ ...(params as any),
320
+ });
321
+ }
322
+
323
+ /**
324
+ * Retrieve the hash and signer data for a given hash
325
+ *
326
+ * @public
327
+ * @async
328
+ * @param {PayableLimitedSignerValidatorV2SignaturePayload} payload
329
+ * @param {?ReadParams} [params]
330
+ * @returns {Promise<Hex>}
331
+ */
332
+ public async hashSignerData(
333
+ payload: PayableLimitedSignerValidatorV2SignaturePayload,
334
+ params?: ReadParams,
335
+ ) {
336
+ const referrer = payload.referrer ?? payload.claimant;
337
+ return await readPayableLimitedSignerValidatorV2HashSignerData(
338
+ this._config,
339
+ {
340
+ address: this.assertValidAddress(),
341
+ args: [
342
+ payload.boostId,
343
+ payload.incentiveQuantity,
344
+ payload.claimant,
345
+ payload.incentiveData,
346
+ referrer,
347
+ ],
348
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
349
+ ...(params as any),
350
+ },
351
+ );
352
+ }
353
+
354
+ /**
355
+ * Validate that the action has been completed successfully.
356
+ * Requires exact payment of the claim fee.
357
+ *
358
+ * @public
359
+ * @async
360
+ * @param {PayableLimitedSignerValidatorV2ValidatePayload} payload
361
+ * @param {?WriteParams} [params]
362
+ * @returns {Promise<boolean>} - True if the action has been validated
363
+ */
364
+ protected async validate(
365
+ payload: PayableLimitedSignerValidatorV2ValidatePayload,
366
+ params?: WriteParams,
367
+ ): Promise<boolean> {
368
+ return await this.awaitResult(this.validateRaw(payload, params));
369
+ }
370
+
371
+ /**
372
+ * Validate that the action has been completed successfully.
373
+ * Requires exact payment of the claim fee.
374
+ *
375
+ * @public
376
+ * @async
377
+ * @param {PayableLimitedSignerValidatorV2ValidatePayload} payload
378
+ * @param {?WriteParams} [params]
379
+ * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>}
380
+ */
381
+ protected async validateRaw(
382
+ payload: PayableLimitedSignerValidatorV2ValidatePayload,
383
+ params?: WriteParams,
384
+ ) {
385
+ const { request, result } =
386
+ await simulatePayableLimitedSignerValidatorV2Validate(this._config, {
387
+ address: this.assertValidAddress(),
388
+ args: [
389
+ payload.boostId,
390
+ payload.incentiveId,
391
+ payload.claimant,
392
+ payload.claimData,
393
+ ],
394
+ value: payload.value,
395
+ ...this.optionallyAttachAccount(),
396
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters
397
+ ...(params as any),
398
+ });
399
+ const hash = await writePayableLimitedSignerValidatorV2Validate(
400
+ this._config,
401
+ request,
402
+ );
403
+ return { hash, result };
404
+ }
405
+
406
+ /**
407
+ * Set the authorized status of a signer
408
+ *
409
+ * @public
410
+ * @async
411
+ * @param {Address[]} addresses - The list of signers to update
412
+ * @param {boolean[]} allowed - The authorized status of each signer
413
+ * @param {?WriteParams} [params]
414
+ * @returns {Promise<void>}
415
+ */
416
+ public async setAuthorized(
417
+ addresses: Address[],
418
+ allowed: boolean[],
419
+ params?: WriteParams,
420
+ ) {
421
+ return await this.awaitResult(
422
+ this.setAuthorizedRaw(addresses, allowed, params),
423
+ );
424
+ }
425
+
426
+ /**
427
+ * Set the authorized status of a signer
428
+ *
429
+ * @public
430
+ * @async
431
+ * @param {Address[]} addresses - The list of signers to update
432
+ * @param {boolean[]} allowed - The authorized status of each signer
433
+ * @param {?WriteParams} [params]
434
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
435
+ */
436
+ public async setAuthorizedRaw(
437
+ addresses: Address[],
438
+ allowed: boolean[],
439
+ params?: WriteParams,
440
+ ) {
441
+ const { request, result } =
442
+ await simulatePayableLimitedSignerValidatorV2SetAuthorized(this._config, {
443
+ address: this.assertValidAddress(),
444
+ args: [addresses, allowed],
445
+ ...this.optionallyAttachAccount(),
446
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters
447
+ ...(params as any),
448
+ });
449
+ const hash = await writePayableLimitedSignerValidatorV2SetAuthorized(
450
+ this._config,
451
+ request,
452
+ );
453
+ return { hash, result };
454
+ }
455
+
456
+ /**
457
+ * Update the authorized caller of the validator function
458
+ *
459
+ * @public
460
+ * @async
461
+ * @param {Address} address
462
+ * @param {?WriteParams} [params]
463
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
464
+ */
465
+ public async setValidatorCallerRaw(address: Address, params?: WriteParams) {
466
+ const { request, result } =
467
+ await simulatePayableLimitedSignerValidatorV2SetValidatorCaller(
468
+ this._config,
469
+ {
470
+ address: this.assertValidAddress(),
471
+ args: [address],
472
+ ...this.optionallyAttachAccount(),
473
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters
474
+ ...(params as any),
475
+ },
476
+ );
477
+ const hash = await writePayableLimitedSignerValidatorV2SetValidatorCaller(
478
+ this._config,
479
+ request,
480
+ );
481
+ return { hash, result };
482
+ }
483
+
484
+ /**
485
+ * Update the authorized caller of the validator function
486
+ *
487
+ * @public
488
+ * @async
489
+ * @param {Address} address
490
+ * @param {?WriteParams} [params]
491
+ * @returns {Promise<void>}
492
+ */
493
+ public async setValidatorCaller(address: Address, params?: WriteParams) {
494
+ return await this.awaitResult(this.setValidatorCallerRaw(address, params));
495
+ }
496
+
497
+ /**
498
+ * Properly encodes the data needed to claim
499
+ *
500
+ * @public
501
+ * @async
502
+ * @param {PayableLimitedSignerValidatorV2ClaimDataParams} params
503
+ * @returns {Promise<Hex>}
504
+ */
505
+ public async encodeClaimData(
506
+ params: Omit<PayableLimitedSignerValidatorV2ClaimDataParams, 'validator'>,
507
+ ): Promise<Hex> {
508
+ return await preparePayableLimitedSignerValidatorV2ClaimDataPayload({
509
+ ...params,
510
+ validator: this.assertValidAddress(),
511
+ });
512
+ }
513
+
514
+ /**
515
+ * @inheritdoc
516
+ *
517
+ * @public
518
+ * @param {?PayableLimitedSignerValidatorV2Payload} [_payload]
519
+ * @param {?DeployableOptions} [_options]
520
+ * @returns {GenericDeployableParams}
521
+ */
522
+ public override buildParameters(
523
+ _payload?: PayableLimitedSignerValidatorV2Payload,
524
+ _options?: DeployableOptions,
525
+ ): GenericDeployableParams {
526
+ const [payload, options] = this.validateDeploymentConfig(
527
+ _payload,
528
+ _options,
529
+ );
530
+
531
+ // set the base implementation address
532
+ const chainId = this._config.getClient().chain?.id;
533
+ if (!chainId) {
534
+ throw new Error(
535
+ 'Chain ID is required for PayableLimitedSignerValidatorV2 deployment',
536
+ );
537
+ }
538
+ const baseImplementation = PayableLimitedSignerValidatorV2.bases[chainId];
539
+ if (!baseImplementation) {
540
+ throw new Error(
541
+ `Base implementation not found for chain ID ${chainId}. Please ensure PayableLimitedSignerValidatorV2 is deployed on this chain.`,
542
+ );
543
+ }
544
+
545
+ return {
546
+ abi: payableLimitedSignerValidatorV2Abi,
547
+ bytecode: bytecode as Hex,
548
+ args: [
549
+ preparePayableLimitedSignerValidatorV2Payload({
550
+ ...payload,
551
+ baseImplementation,
552
+ }),
553
+ ],
554
+ ...this.optionallyAttachAccount(options.account),
555
+ };
556
+ }
557
+ }
558
+
559
+ /**
560
+ * Payable Limited Signer Validator Claim Data Payload Preparation
561
+ *
562
+ * @export
563
+ * @async
564
+ * @param {PayableLimitedSignerValidatorV2ClaimDataParams} param0
565
+ * @returns {Promise<Hex>}
566
+ */
567
+ export async function preparePayableLimitedSignerValidatorV2ClaimDataPayload({
568
+ signer,
569
+ incentiveData,
570
+ chainId,
571
+ validator,
572
+ incentiveQuantity,
573
+ claimant,
574
+ boostId,
575
+ referrer,
576
+ }: PayableLimitedSignerValidatorV2ClaimDataParams): Promise<Hex> {
577
+ const _referrer = referrer ?? claimant;
578
+ const domain = {
579
+ name: 'PayableLimitedSignerValidatorV2',
580
+ version: '1',
581
+ chainId: chainId,
582
+ verifyingContract: validator,
583
+ };
584
+ const typedData = {
585
+ domain,
586
+ types: {
587
+ SignerValidatorData: [
588
+ { name: 'boostId', type: 'uint256' },
589
+ { name: 'incentiveQuantity', type: 'uint8' },
590
+ { name: 'claimant', type: 'address' },
591
+ { name: 'incentiveData', type: 'bytes' },
592
+ { name: 'referrer', type: 'address' },
593
+ ],
594
+ },
595
+ primaryType: 'SignerValidatorData' as const,
596
+ message: {
597
+ boostId,
598
+ incentiveQuantity,
599
+ claimant,
600
+ incentiveData: incentiveData,
601
+ referrer: _referrer,
602
+ },
603
+ };
604
+
605
+ const trustedSignature = await signer.privateKey.signTypedData(typedData);
606
+
607
+ // Prepare the claim data payload using the new helper
608
+ const validatorData = preparePayableLimitedSignerValidatorV2InputParams({
609
+ signer: signer.account,
610
+ signature: trustedSignature,
611
+ incentiveQuantity,
612
+ });
613
+
614
+ const boostClaimDataPayload = encodeAbiParameters(
615
+ [
616
+ {
617
+ type: 'tuple',
618
+ name: 'BoostClaimData',
619
+ components: [
620
+ { type: 'bytes', name: 'validatorData' },
621
+ { type: 'bytes', name: 'incentiveData' },
622
+ { type: 'address', name: 'referrer' },
623
+ ],
624
+ },
625
+ ],
626
+ [{ validatorData, incentiveData, referrer: _referrer }],
627
+ );
628
+
629
+ return boostClaimDataPayload;
630
+ }
631
+
632
+ /**
633
+ * Given a {@link PayableLimitedSignerValidatorV2InputParams}, properly encode the initialization payload.
634
+ *
635
+ * @param {LimitedSignerValidatorInputParams} param0
636
+ * @param {Address} param0.signer
637
+ * @param {Hex} param0.signature
638
+ * @param {number} param0.incentiveQuantity
639
+ * @returns {Hex}
640
+ */
641
+ export function preparePayableLimitedSignerValidatorV2InputParams({
642
+ signer,
643
+ signature,
644
+ incentiveQuantity,
645
+ }: LimitedSignerValidatorInputParams) {
646
+ return encodeAbiParameters(
647
+ [
648
+ {
649
+ type: 'tuple',
650
+ name: 'SignerValidatorInputParams',
651
+ components: [
652
+ { type: 'address', name: 'signer' },
653
+ { type: 'bytes', name: 'signature' },
654
+ { type: 'uint8', name: 'incentiveQuantity' },
655
+ ],
656
+ },
657
+ ],
658
+ [{ signer, signature, incentiveQuantity }],
659
+ );
660
+ }
661
+
662
+ /**
663
+ * Prepare the initialization payload for a PayableLimitedSignerValidatorV2
664
+ *
665
+ * @export
666
+ * @param {PayableLimitedSignerValidatorV2Payload & { baseImplementation: Address }} payload
667
+ * @returns {Hex}
668
+ */
669
+ export function preparePayableLimitedSignerValidatorV2Payload(
670
+ payload: PayableLimitedSignerValidatorV2Payload & {
671
+ baseImplementation: Address;
672
+ },
673
+ ): Hex {
674
+ return encodeAbiParameters(
675
+ [
676
+ { name: 'signers', type: 'address[]' },
677
+ { name: 'validatorCaller', type: 'address' },
678
+ { name: 'maxClaimCount', type: 'uint256' },
679
+ { name: 'baseImplementation', type: 'address' },
680
+ ],
681
+ [
682
+ payload.signers,
683
+ payload.validatorCaller,
684
+ BigInt(payload.maxClaimCount),
685
+ payload.baseImplementation,
686
+ ],
687
+ );
688
+ }
@@ -88,6 +88,8 @@ export interface SignerValidatorValidatePayload {
88
88
  }
89
89
 
90
90
  /**
91
+ * @deprecated Use {@link SignerValidatorV2} instead.
92
+ *
91
93
  * Object reprentation of a {@link SignerValidator} initialization payload
92
94
  *
93
95
  * @export
@@ -376,7 +378,7 @@ export class SignerValidator extends DeployableTarget<
376
378
  * @param {?WriteParams} [params]
377
379
  * @returns {Promise<boolean>} - True if the action has been validated based on the data payload
378
380
  */
379
- protected async validate(
381
+ public async validate(
380
382
  payload: SignerValidatorValidatePayload,
381
383
  params?: WriteParams,
382
384
  ) {
@@ -392,7 +394,7 @@ export class SignerValidator extends DeployableTarget<
392
394
  * @param {?WriteParams} [params]
393
395
  * @returns {Promise<boolean>} - True if the action has been validated based on the data payload
394
396
  */
395
- protected async validateRaw(
397
+ public async validateRaw(
396
398
  payload: SignerValidatorValidatePayload,
397
399
  params?: WriteParams,
398
400
  ) {