@boostxyz/sdk 7.3.0 → 7.5.0

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