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

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 (257) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.cjs.map +1 -1
  3. package/dist/Actions/Action.js +7 -7
  4. package/dist/Actions/ContractAction.d.ts +11 -11
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +14 -14
  7. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  8. package/dist/Actions/EventAction.cjs +1 -1
  9. package/dist/Actions/EventAction.cjs.map +1 -1
  10. package/dist/Actions/EventAction.d.ts +171 -41
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +15 -392
  13. package/dist/Actions/EventAction.js.map +1 -1
  14. package/dist/AllowLists/AllowList.cjs +1 -1
  15. package/dist/AllowLists/AllowList.cjs.map +1 -1
  16. package/dist/AllowLists/AllowList.d.ts +6 -4
  17. package/dist/AllowLists/AllowList.d.ts.map +1 -1
  18. package/dist/AllowLists/AllowList.js +45 -23
  19. package/dist/AllowLists/AllowList.js.map +1 -1
  20. package/dist/AllowLists/OpenAllowList.d.ts +423 -0
  21. package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
  22. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  23. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  24. package/dist/AllowLists/SimpleAllowList.d.ts +92 -37
  25. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  26. package/dist/AllowLists/SimpleAllowList.js +55 -71
  27. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  28. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  29. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  30. package/dist/AllowLists/SimpleDenyList.d.ts +203 -11
  31. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  32. package/dist/AllowLists/SimpleDenyList.js +11 -112
  33. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  34. package/dist/Auth/PassthroughAuth.cjs +1 -1
  35. package/dist/Auth/PassthroughAuth.js +1 -1
  36. package/dist/Boost.cjs +1 -1
  37. package/dist/Boost.cjs.map +1 -1
  38. package/dist/Boost.d.ts +20 -21
  39. package/dist/Boost.d.ts.map +1 -1
  40. package/dist/Boost.js +43 -57
  41. package/dist/Boost.js.map +1 -1
  42. package/dist/BoostCore-BVZExPPu.js +1462 -0
  43. package/dist/BoostCore-BVZExPPu.js.map +1 -0
  44. package/dist/BoostCore-D-E-cnGI.cjs +3 -0
  45. package/dist/BoostCore-D-E-cnGI.cjs.map +1 -0
  46. package/dist/BoostCore.cjs +1 -2
  47. package/dist/BoostCore.cjs.map +1 -1
  48. package/dist/BoostCore.d.ts +748 -77
  49. package/dist/BoostCore.d.ts.map +1 -1
  50. package/dist/BoostCore.js +29 -1150
  51. package/dist/BoostCore.js.map +1 -1
  52. package/dist/BoostRegistry.cjs +1 -1
  53. package/dist/BoostRegistry.cjs.map +1 -1
  54. package/dist/BoostRegistry.d.ts +80 -25
  55. package/dist/BoostRegistry.d.ts.map +1 -1
  56. package/dist/BoostRegistry.js +165 -83
  57. package/dist/BoostRegistry.js.map +1 -1
  58. package/dist/Budgets/Budget.cjs +1 -1
  59. package/dist/Budgets/Budget.cjs.map +1 -1
  60. package/dist/Budgets/Budget.d.ts.map +1 -1
  61. package/dist/Budgets/Budget.js +2 -2
  62. package/dist/Budgets/Budget.js.map +1 -1
  63. package/dist/Budgets/ManagedBudget.cjs +1 -1
  64. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  65. package/dist/Budgets/ManagedBudget.d.ts +75 -193
  66. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  67. package/dist/Budgets/ManagedBudget.js +80 -298
  68. package/dist/Budgets/ManagedBudget.js.map +1 -1
  69. package/dist/Budgets/VestingBudget.d.ts +223 -89
  70. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  71. package/dist/Deployable/Contract.cjs +1 -1
  72. package/dist/Deployable/Contract.cjs.map +1 -1
  73. package/dist/Deployable/Contract.d.ts +4 -5
  74. package/dist/Deployable/Contract.d.ts.map +1 -1
  75. package/dist/Deployable/Contract.js +5 -7
  76. package/dist/Deployable/Contract.js.map +1 -1
  77. package/dist/Deployable/Deployable.cjs.map +1 -1
  78. package/dist/Deployable/Deployable.d.ts +1 -1
  79. package/dist/Deployable/Deployable.d.ts.map +1 -1
  80. package/dist/Deployable/Deployable.js +3 -5
  81. package/dist/Deployable/Deployable.js.map +1 -1
  82. package/dist/Deployable/DeployableTarget.cjs +1 -1
  83. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  84. package/dist/Deployable/DeployableTarget.d.ts +13 -13
  85. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  86. package/dist/Deployable/DeployableTarget.js +28 -25
  87. package/dist/Deployable/DeployableTarget.js.map +1 -1
  88. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  89. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  90. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  94. package/dist/EventAction-BZt5cjbe.cjs +2 -0
  95. package/dist/EventAction-BZt5cjbe.cjs.map +1 -0
  96. package/dist/EventAction-C_-hJXWm.js +1541 -0
  97. package/dist/EventAction-C_-hJXWm.js.map +1 -0
  98. package/dist/Incentive-BhHaK3PZ.cjs +2 -0
  99. package/dist/Incentive-BhHaK3PZ.cjs.map +1 -0
  100. package/dist/Incentive-Cqg1w6wD.js +312 -0
  101. package/dist/Incentive-Cqg1w6wD.js.map +1 -0
  102. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  103. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  104. package/dist/Incentives/AllowListIncentive.d.ts +38 -16
  105. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  106. package/dist/Incentives/AllowListIncentive.js +42 -29
  107. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  108. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  109. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  110. package/dist/Incentives/CGDAIncentive.d.ts +234 -21
  111. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  112. package/dist/Incentives/CGDAIncentive.js +45 -32
  113. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  114. package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
  115. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  116. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  117. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  118. package/dist/Incentives/ERC20Incentive.d.ts +230 -29
  119. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  120. package/dist/Incentives/ERC20Incentive.js +56 -43
  121. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  122. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +335 -440
  123. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  124. package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
  125. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  126. package/dist/Incentives/Incentive.cjs +1 -1
  127. package/dist/Incentives/Incentive.cjs.map +1 -1
  128. package/dist/Incentives/Incentive.d.ts +4 -4
  129. package/dist/Incentives/Incentive.d.ts.map +1 -1
  130. package/dist/Incentives/Incentive.js +16 -296
  131. package/dist/Incentives/Incentive.js.map +1 -1
  132. package/dist/Incentives/PointsIncentive.cjs +1 -1
  133. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  134. package/dist/Incentives/PointsIncentive.d.ts +40 -18
  135. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  136. package/dist/Incentives/PointsIncentive.js +37 -24
  137. package/dist/Incentives/PointsIncentive.js.map +1 -1
  138. package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
  139. package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
  140. package/dist/SimpleDenyList-CGaWjuld.js +132 -0
  141. package/dist/SimpleDenyList-CGaWjuld.js.map +1 -0
  142. package/dist/Validators/SignerValidator.cjs +1 -1
  143. package/dist/Validators/SignerValidator.cjs.map +1 -1
  144. package/dist/Validators/SignerValidator.d.ts +16 -16
  145. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  146. package/dist/Validators/SignerValidator.js +30 -27
  147. package/dist/Validators/SignerValidator.js.map +1 -1
  148. package/dist/Validators/Validator.cjs +1 -1
  149. package/dist/Validators/Validator.cjs.map +1 -1
  150. package/dist/Validators/Validator.d.ts +1 -1
  151. package/dist/Validators/Validator.js +2 -2
  152. package/dist/Validators/Validator.js.map +1 -1
  153. package/dist/claiming.cjs.map +1 -1
  154. package/dist/claiming.d.ts +1 -1
  155. package/dist/claiming.js.map +1 -1
  156. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  157. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  158. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  159. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  160. package/dist/deployments-DVXioW2i.cjs +2 -0
  161. package/dist/deployments-DVXioW2i.cjs.map +1 -0
  162. package/dist/deployments-oykLv3_Z.js +43 -0
  163. package/dist/deployments-oykLv3_Z.js.map +1 -0
  164. package/dist/deployments.json +44 -0
  165. package/dist/errors.cjs +1 -1
  166. package/dist/errors.cjs.map +1 -1
  167. package/dist/errors.d.ts +256 -20
  168. package/dist/errors.d.ts.map +1 -1
  169. package/dist/errors.js +183 -26
  170. package/dist/errors.js.map +1 -1
  171. package/dist/{generated-57_Kffpz.js → generated-CKt2yCQd.js} +3613 -1869
  172. package/dist/generated-CKt2yCQd.js.map +1 -0
  173. package/dist/generated-CyTNlOwM.cjs +3 -0
  174. package/dist/generated-CyTNlOwM.cjs.map +1 -0
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.d.ts +5 -0
  177. package/dist/index.d.ts.map +1 -1
  178. package/dist/index.js +142 -108
  179. package/dist/index.js.map +1 -1
  180. package/dist/transfers.cjs.map +1 -1
  181. package/dist/transfers.d.ts +1 -1
  182. package/dist/transfers.js.map +1 -1
  183. package/dist/utils.cjs +1 -1
  184. package/dist/utils.cjs.map +1 -1
  185. package/dist/utils.d.ts +26 -12
  186. package/dist/utils.d.ts.map +1 -1
  187. package/dist/utils.js +38 -23
  188. package/dist/utils.js.map +1 -1
  189. package/package.json +20 -10
  190. package/src/Actions/Action.test.ts +14 -13
  191. package/src/Actions/ContractAction.test.ts +10 -10
  192. package/src/Actions/ContractAction.ts +11 -12
  193. package/src/Actions/ERC721MintAction.test.ts +6 -6
  194. package/src/Actions/ERC721MintAction.ts +14 -15
  195. package/src/Actions/EventAction.test.ts +729 -109
  196. package/src/Actions/EventAction.ts +542 -84
  197. package/src/AllowLists/AllowList.test.ts +7 -7
  198. package/src/AllowLists/AllowList.ts +5 -3
  199. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  200. package/src/AllowLists/OpenAllowList.ts +45 -0
  201. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  202. package/src/AllowLists/SimpleAllowList.ts +39 -61
  203. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  204. package/src/AllowLists/SimpleDenyList.ts +40 -17
  205. package/src/Auth/PassthroughAuth.test.ts +1 -1
  206. package/src/Boost.ts +21 -24
  207. package/src/BoostCore.test.ts +323 -268
  208. package/src/BoostCore.ts +396 -219
  209. package/src/BoostRegistry.test.ts +53 -0
  210. package/src/BoostRegistry.ts +161 -40
  211. package/src/Budgets/Budget.test.ts +2 -2
  212. package/src/Budgets/Budget.ts +1 -2
  213. package/src/Budgets/ManagedBudget.test.ts +82 -19
  214. package/src/Budgets/ManagedBudget.ts +48 -310
  215. package/src/Budgets/VestingBudget.test.ts +7 -7
  216. package/src/Budgets/VestingBudget.ts +34 -106
  217. package/src/Deployable/Contract.ts +4 -5
  218. package/src/Deployable/Deployable.ts +1 -1
  219. package/src/Deployable/DeployableTarget.ts +30 -19
  220. package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
  221. package/src/Incentives/AllowListIncentive.test.ts +5 -5
  222. package/src/Incentives/AllowListIncentive.ts +29 -15
  223. package/src/Incentives/CGDAIncentive.test.ts +9 -6
  224. package/src/Incentives/CGDAIncentive.ts +38 -18
  225. package/src/Incentives/ERC1155Incentive.test.ts +3 -3
  226. package/src/Incentives/ERC1155Incentive.ts +28 -29
  227. package/src/Incentives/ERC20Incentive.test.ts +9 -6
  228. package/src/Incentives/ERC20Incentive.ts +46 -26
  229. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  230. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +324 -0
  231. package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
  232. package/src/Incentives/ERC20VariableIncentive.ts +49 -26
  233. package/src/Incentives/Incentive.test.ts +4 -1
  234. package/src/Incentives/Incentive.ts +7 -6
  235. package/src/Incentives/PointsIncentive.test.ts +24 -25
  236. package/src/Incentives/PointsIncentive.ts +31 -17
  237. package/src/Validators/SignerValidator.test.ts +6 -6
  238. package/src/Validators/SignerValidator.ts +19 -17
  239. package/src/Validators/Validator.test.ts +2 -2
  240. package/src/Validators/Validator.ts +1 -1
  241. package/src/claiming.ts +1 -1
  242. package/src/errors.ts +345 -21
  243. package/src/index.test.ts +118 -36
  244. package/src/index.ts +5 -0
  245. package/src/transfers.ts +1 -1
  246. package/src/utils.test.ts +2 -2
  247. package/src/utils.ts +61 -12
  248. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  249. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  250. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  251. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  252. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  253. package/dist/generated-57_Kffpz.js.map +0 -1
  254. package/dist/generated-wKBNvm48.cjs +0 -3
  255. package/dist/generated-wKBNvm48.cjs.map +0 -1
  256. package/src/Budgets/SimpleBudget.test.ts +0 -152
  257. package/src/Budgets/SimpleBudget.ts +0 -564
@@ -7,29 +7,52 @@ import {
7
7
  } from '@boostxyz/evm';
8
8
  import { bytecode } from '@boostxyz/evm/artifacts/contracts/actions/EventAction.sol/EventAction.json';
9
9
  import events from '@boostxyz/signatures/events';
10
+ import functions from '@boostxyz/signatures/functions';
11
+ import {
12
+ GetTransactionReceiptParameters,
13
+ getTransaction,
14
+ getTransactionReceipt,
15
+ } from '@wagmi/core';
16
+ import { match } from 'ts-pattern';
10
17
  import {
11
18
  type Abi,
12
19
  type AbiEvent,
20
+ type AbiFunction,
21
+ AbiItem,
13
22
  type Address,
14
23
  type ContractEventName,
24
+ type ContractFunctionName,
25
+ type GetLogsReturnType,
26
+ type GetTransactionParameters,
15
27
  type Hex,
16
28
  type Log,
29
+ type PublicClient,
30
+ type Transaction,
31
+ decodeEventLog,
32
+ decodeFunctionData,
17
33
  encodeAbiParameters,
34
+ fromHex,
35
+ isAddress,
18
36
  isAddressEqual,
37
+ zeroHash,
19
38
  } from 'viem';
20
- import { getLogs } from 'viem/actions';
39
+ import { EventAction as EventActionBases } from '../../dist/deployments.json';
21
40
  import type {
22
41
  DeployableOptions,
23
42
  GenericDeployableParams,
24
43
  } from '../Deployable/Deployable';
25
44
  import { DeployableTarget } from '../Deployable/DeployableTarget';
26
45
  import {
46
+ DecodedArgsMalformedError,
27
47
  FieldValueNotComparableError,
28
48
  FieldValueUndefinedError,
49
+ FunctionDataDecodeError,
29
50
  InvalidNumericalCriteriaError,
30
51
  NoEventActionStepsProvidedError,
31
52
  TooManyEventActionStepsProvidedError,
53
+ UnparseableAbiParamError,
32
54
  UnrecognizedFilterTypeError,
55
+ ValidationAbiMissingError,
33
56
  } from '../errors';
34
57
  import {
35
58
  type GetLogsParams,
@@ -55,6 +78,7 @@ export enum FilterType {
55
78
  GREATER_THAN = 2,
56
79
  LESS_THAN = 3,
57
80
  CONTAINS = 4,
81
+ REGEX = 5,
58
82
  }
59
83
 
60
84
  /**
@@ -198,6 +222,22 @@ export interface ActionStep {
198
222
  */
199
223
  actionParameter: Criteria;
200
224
  }
225
+
226
+ /**
227
+ * Parameters for validating an action step.
228
+ *
229
+ * @typedef {Object} ValidateActionStepParams
230
+ * @property {Record<Hex, AbiEvent | AbiFunction>} [knownSignatures] - Optional record of known events, keyed by 32 byte selectors.
231
+ * @property {AbiEvent | AbiFunction} [abiItem] - Optional ABI item definition.
232
+ * @property {EventLogs} [logs] - Event logs to validate against. Required if 'hash' is not provided.
233
+ * @property {Hex} [hash] - Transaction hash to validate against. Required if 'logs' is not provided.
234
+ * @property {number} [chainId] - Chain ID for the transaction. Required if 'hash' is provided.
235
+ */
236
+ export type ValidateActionStepParams = {
237
+ knownSignatures?: Record<Hex, AbiEvent | AbiFunction>;
238
+ abiItem?: AbiEvent | AbiFunction;
239
+ } & ({ logs: EventLogs } | { hash: Hex; chainId: number });
240
+
201
241
  /**
202
242
  * You can either supply a simplified version of the payload, or one that explicitly declares action steps.
203
243
  *
@@ -280,6 +320,24 @@ export interface EventActionPayloadRaw {
280
320
  actionStepFour: ActionStep;
281
321
  }
282
322
 
323
+ /**
324
+ * Array of event logs to pass into TxParams
325
+ * @export
326
+ * @typedef {EventLogs}
327
+ */
328
+ export type EventLogs = GetLogsReturnType<AbiEvent, AbiEvent[], true>;
329
+
330
+ /**
331
+ * Getter params from the event action contract
332
+ *
333
+ * @export
334
+ * @typedef {ReadEventActionParams}
335
+ * @param {fnName} fnName - The getter function name
336
+ */
337
+ export type ReadEventActionParams<
338
+ fnName extends ContractFunctionName<typeof eventActionAbi, 'pure' | 'view'>,
339
+ > = ReadParams<typeof eventActionAbi, fnName>;
340
+
283
341
  /**
284
342
  * A generic event action
285
343
  *
@@ -305,9 +363,11 @@ export class EventAction extends DeployableTarget<
305
363
  *
306
364
  * @public
307
365
  * @static
308
- * @type {Address}
366
+ * @type {Record<number, Address>}
309
367
  */
310
- public static override base: Address = import.meta.env.VITE_EVENT_ACTION_BASE;
368
+ public static override bases: Record<number, Address> = {
369
+ ...(EventActionBases as Record<number, Address>),
370
+ };
311
371
  /**
312
372
  * @inheritdoc
313
373
  *
@@ -323,12 +383,12 @@ export class EventAction extends DeployableTarget<
323
383
  * @public
324
384
  * @async
325
385
  * @param {number} index The index of the action event to retrieve
326
- * @param {?ReadParams<typeof eventActionAbi, 'getActionStep'>} [params]
386
+ * @param {?ReadEventActionParams<'getActionStep'>} [params]
327
387
  * @returns {Promise<ActionStep>}
328
388
  */
329
389
  public async getActionStep(
330
390
  index: number,
331
- params?: ReadParams<typeof eventActionAbi, 'getActionStep'>,
391
+ params?: ReadEventActionParams<'getActionStep'>,
332
392
  ) {
333
393
  const steps = await this.getActionSteps(params);
334
394
  return steps.at(index);
@@ -339,11 +399,11 @@ export class EventAction extends DeployableTarget<
339
399
  *
340
400
  * @public
341
401
  * @async
342
- * @param {?ReadParams<typeof eventActionAbi, 'getActionSteps'>} [params]
402
+ * @param {?ReadEventActionParams<'getActionSteps'>} [params]
343
403
  * @returns {Promise<ActionStep[]>}
344
404
  */
345
405
  public async getActionSteps(
346
- params?: ReadParams<typeof eventActionAbi, 'getActionSteps'>,
406
+ params?: ReadEventActionParams<'getActionSteps'>,
347
407
  ) {
348
408
  const steps = (await readEventActionGetActionSteps(this._config, {
349
409
  address: this.assertValidAddress(),
@@ -359,11 +419,11 @@ export class EventAction extends DeployableTarget<
359
419
  *
360
420
  * @public
361
421
  * @async
362
- * @param {?ReadParams<typeof eventActionAbi, 'getActionStepsCount'>} [params]
422
+ * @param {?ReadEventActionParams<'getActionStepsCount'>} [params]
363
423
  * @returns {Promise<bigint>}
364
424
  */
365
425
  public async getActionStepsCount(
366
- params?: ReadParams<typeof eventActionAbi, 'getActionStepsCount'>,
426
+ params?: ReadEventActionParams<'getActionStepsCount'>,
367
427
  ) {
368
428
  const steps = await this.getActionSteps(params);
369
429
  return steps.length;
@@ -374,17 +434,16 @@ export class EventAction extends DeployableTarget<
374
434
  *
375
435
  * @public
376
436
  * @async
377
- * @param {?ReadParams<typeof eventActionAbi, 'getActionClaimant'>} [params]
437
+ * @param {?ReadEventActionParams<'getActionClaimant'>} [params]
378
438
  * @returns {Promise<ActionClaimant>}
379
439
  */
380
440
  public async getActionClaimant(
381
- params?: ReadParams<typeof eventActionAbi, 'getActionClaimant'>,
382
- ) {
441
+ params?: ReadEventActionParams<'getActionClaimant'>,
442
+ ): Promise<ActionClaimant> {
383
443
  const result = (await readEventActionGetActionClaimant(this._config, {
384
444
  address: this.assertValidAddress(),
385
445
  ...this.optionallyAttachAccount(),
386
- // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
387
- ...(params as any),
446
+ ...params,
388
447
  })) as RawActionClaimant;
389
448
  return _fromRawActionStep(result);
390
449
  }
@@ -395,7 +454,7 @@ export class EventAction extends DeployableTarget<
395
454
  * @public
396
455
  * @async
397
456
  * @param {Hex} data
398
- * @param {?WriteParams<typeof eventActionAbi, 'execute'>} [params]
457
+ * @param {?WriteParams} [params]
399
458
  * @returns {Promise<readonly [boolean, `0x${string}`]>}
400
459
  */
401
460
  public async execute(
@@ -411,8 +470,8 @@ export class EventAction extends DeployableTarget<
411
470
  * @public
412
471
  * @async
413
472
  * @param {Hex} data
414
- * @param {?WriteParams<typeof eventActionAbi, 'execute'>} [params]
415
- * @returns {unknown}
473
+ * @param {?WriteParams} [params]
474
+ * @returns {Promise<{ hash: `0x${string}`; result: readonly [boolean, `0x${string}`]; }>}
416
475
  */
417
476
  public async executeRaw(
418
477
  data: Hex,
@@ -429,27 +488,154 @@ export class EventAction extends DeployableTarget<
429
488
  return { hash, result };
430
489
  }
431
490
 
491
+ /**
492
+ * Derives the action claimant address from a transaction based on the provided ActionClaimant configuration.
493
+ * This method supports both event-based and function-based claimant derivation.
494
+ *
495
+ ** @example
496
+ * // Example usage
497
+ * const eventAction = boost.action as EventAction
498
+ * const claimant = await eventAction.getActionClaimant() // {
499
+ * signatureType: SignatureType.EVENT,
500
+ * signature: '0x1234...',
501
+ * fieldIndex: 2,
502
+ * targetContract: '0xabcd...',
503
+ * chainid: 1
504
+ * };
505
+ * const params: ValidateActionStepParams = {
506
+ * hash: '0x5678...',
507
+ * chainId: 1,
508
+ * knownSignatures?: {
509
+ * '0x1234...': {}
510
+ * }
511
+ * };
512
+ * const claimantAddress = await eventAction.deriveActionClaimantFromTransaction(claimant, params);
513
+ *
514
+ * @param {ActionClaimant} claimant - The configuration specifying how to derive the claimant.
515
+ * @param {ValidateActionStepParams} params - Parameters for validation, including transaction hash, known signatures, logs, and chain ID.
516
+ * @returns {Promise<Address | undefined>} The derived claimant address if found, undefined otherwise.
517
+ * @throws {ValidationAbiMissingError} If the ABI for the specified signature is not found.
518
+ * @throws {FunctionDataDecodeError} If there's an error decoding function data (for function-based derivation).
519
+ */
520
+ public async deriveActionClaimantFromTransaction(
521
+ claimant: ActionClaimant,
522
+ params: ValidateActionStepParams,
523
+ ): Promise<Address | undefined> {
524
+ const signature = claimant.signature;
525
+ if (claimant.signatureType === SignatureType.EVENT) {
526
+ let event: AbiEvent;
527
+ if (params.abiItem) event = params.abiItem as AbiEvent;
528
+ else {
529
+ const sigPool: Record<Hex, AbiEvent> = {
530
+ ...(events.abi as Record<Hex, AbiEvent>),
531
+ ...((params.knownSignatures as Record<Hex, AbiEvent>) || {}),
532
+ };
533
+ event = sigPool[signature] as AbiEvent;
534
+ }
535
+
536
+ if (!event) {
537
+ throw new ValidationAbiMissingError(signature);
538
+ }
539
+
540
+ let address: Address | undefined;
541
+ if ('logs' in params) {
542
+ for (let log of params.logs) {
543
+ if (!isAddressEqual(log.address, claimant.targetContract)) continue;
544
+ let addressCandidate = this.validateClaimantAgainstArgs(
545
+ claimant,
546
+ log,
547
+ );
548
+ if (addressCandidate) address = addressCandidate;
549
+ }
550
+ return address;
551
+ }
552
+ const receipt = await getTransactionReceipt(this._config, params);
553
+ const decodedLogs = receipt.logs.map((log) => {
554
+ const { eventName, args } = decodeEventLog({
555
+ abi: [event],
556
+ data: log.data,
557
+ topics: log.topics,
558
+ });
559
+ return { ...log, eventName, args };
560
+ });
561
+
562
+ for (let log of decodedLogs) {
563
+ if (!isAddressEqual(log.address, claimant.targetContract)) continue;
564
+ let addressCandidate = this.validateClaimantAgainstArgs(claimant, log);
565
+ if (addressCandidate) address = addressCandidate;
566
+ }
567
+ return address;
568
+ }
569
+ if (
570
+ claimant.signatureType === SignatureType.FUNC &&
571
+ 'hash' in params &&
572
+ 'chainId' in params
573
+ ) {
574
+ const transaction = await getTransaction(this._config, {
575
+ hash: params.hash,
576
+ });
577
+ if (!isAddressEqual(transaction.to!, claimant.targetContract)) return;
578
+ let func: AbiFunction;
579
+ if (params.abiItem) func = params.abiItem as AbiFunction;
580
+ else {
581
+ const sigPool: Record<Hex, AbiFunction> = {
582
+ ...(functions.abi as Record<Hex, AbiFunction>),
583
+ ...((params.knownSignatures as Record<Hex, AbiFunction>) || {}),
584
+ };
585
+ func = sigPool[signature] as AbiFunction;
586
+ }
587
+ if (!func) {
588
+ throw new ValidationAbiMissingError(claimant.signature);
589
+ }
590
+ let decodedData;
591
+ try {
592
+ decodedData = decodeFunctionData({
593
+ abi: [func],
594
+ data: transaction.input,
595
+ });
596
+ } catch (e) {
597
+ throw new FunctionDataDecodeError([func], e as Error);
598
+ }
599
+ return this.validateClaimantAgainstArgs(claimant, decodedData);
600
+ }
601
+ }
602
+
603
+ /**
604
+ * Validates the action claimant against the arguments of a log or function data.
605
+ *
606
+ * @param {ActionClaimant} claimant - The action claimant to validate.
607
+ * @param {Object} [logOrFnData] - Optional object containing the arguments to validate against.
608
+ * @param {Array<any> | readonly unknown[] | Record<string, unknown>} [logOrFnData.args] - The arguments from the log or function data.
609
+ * @returns {Address | undefined} The validated address if found and valid, otherwise undefined.
610
+ */
611
+ public validateClaimantAgainstArgs(
612
+ claimant: ActionClaimant,
613
+ logOrFnData?: {
614
+ args: Array<unknown> | readonly unknown[] | Record<string, unknown>;
615
+ },
616
+ ): Address | undefined {
617
+ if (
618
+ !logOrFnData ||
619
+ !Array.isArray(logOrFnData?.args) ||
620
+ logOrFnData?.args.length <= claimant.fieldIndex
621
+ ) {
622
+ return;
623
+ }
624
+ const maybeAddress = logOrFnData.args.at(claimant.fieldIndex);
625
+ if (isAddress(maybeAddress)) return maybeAddress;
626
+ }
627
+
432
628
  /**
433
629
  * Retrieves action steps, and uses them to validate against, and optionally fetch logs that match the step's signature.
434
630
  * If logs are provided in the optional `params` argument, then those logs will be used instead of fetched with the configured client.
435
631
  *
436
632
  * @public
437
633
  * @async
438
- * @param {?ReadParams<typeof eventActionAbi, 'getActionSteps'> &
439
- * GetLogsParams<Abi, ContractEventName<Abi>> & {
440
- * knownEvents?: Record<Hex, AbiEvent>;
441
- * logs?: Log[];
442
- * }} [params]
634
+ * @param ValidateActionStepParams params
443
635
  * @returns {Promise<boolean>}
444
636
  */
445
- public async validateActionSteps(
446
- params?: ReadParams<typeof eventActionAbi, 'getActionSteps'> &
447
- GetLogsParams<Abi, ContractEventName<Abi>> & {
448
- knownEvents?: Record<Hex, AbiEvent>;
449
- logs?: Log[];
450
- },
451
- ) {
452
- const actionSteps = await this.getActionSteps(params);
637
+ public async validateActionSteps(params: ValidateActionStepParams) {
638
+ const actionSteps = await this.getActionSteps();
453
639
  for (const actionStep of actionSteps) {
454
640
  if (!(await this.isActionStepValid(actionStep, params))) {
455
641
  return false;
@@ -459,108 +645,341 @@ export class EventAction extends DeployableTarget<
459
645
  }
460
646
 
461
647
  /**
462
- * Validates a single action step with a given criteria against logs.
463
- * If logs are provided in the optional `params` argument, then those logs will be used instead of fetched with the configured client.
648
+ * Validates a single action step with a given criteria against logs or function calls.
649
+ * If logs are provided in the optional `params` argument, then those logs will be used instead of being fetched with the configured client.
650
+ * For functions a hash is required.
464
651
  *
465
652
  * @public
466
653
  * @async
467
- * @param {ActionStep} actionStep
468
- * @param {?GetLogsParams<Abi, ContractEventName<Abi>> & {
469
- * knownEvents?: Record<Hex, AbiEvent>;
470
- * logs?: Log[];
471
- * }} [params]
654
+ * @param {ActionStep} actionStep - The action step to validate. Can be a function of event step.
655
+ * @param {ValidateActionStepParams} params - Additional parameters for validation, including hash, known events, logs, and chain ID.
472
656
  * @returns {Promise<boolean>}
473
657
  */
474
658
  public async isActionStepValid(
475
659
  actionStep: ActionStep,
476
- params?: GetLogsParams<Abi, ContractEventName<Abi>> & {
477
- knownEvents?: Record<Hex, AbiEvent>;
478
- logs?: Log[];
479
- },
660
+ params: ValidateActionStepParams,
480
661
  ) {
481
- const criteria = actionStep.actionParameter;
482
- const signature = actionStep.signature;
483
- let event: AbiEvent;
484
- // Lookup ABI based on event signature
485
- if (params?.knownEvents) {
486
- event = params.knownEvents[signature] as AbiEvent;
487
- } else {
488
- event = (events.abi as Record<Hex, AbiEvent>)[signature] as AbiEvent;
662
+ if (actionStep.signatureType === SignatureType.EVENT) {
663
+ const signature = actionStep.signature;
664
+ let event: AbiEvent;
665
+ if (params.abiItem) event = params.abiItem as AbiEvent;
666
+ else {
667
+ const sigPool: Record<Hex, AbiEvent> = {
668
+ ...(events.abi as Record<Hex, AbiEvent>),
669
+ ...((params.knownSignatures as Record<Hex, AbiEvent>) || {}),
670
+ };
671
+ event = sigPool[signature] as AbiEvent;
672
+ }
673
+
674
+ if (!event) {
675
+ throw new ValidationAbiMissingError(signature);
676
+ }
677
+
678
+ if (this.isArraylikeIndexed(actionStep, event)) {
679
+ // If the field is indexed, we can't filter on it
680
+ throw new UnparseableAbiParamError(
681
+ actionStep.actionParameter.fieldIndex,
682
+ event,
683
+ );
684
+ }
685
+
686
+ // Use the provided logs, no need to fetch receipt
687
+ if ('logs' in params) {
688
+ return this.isActionEventValid(actionStep, params.logs);
689
+ }
690
+
691
+ const client = this._config.getClient({
692
+ chainId: params.chainId,
693
+ }) as PublicClient;
694
+ const receipt = await client.getTransactionReceipt({
695
+ hash: params.hash,
696
+ });
697
+ const decodedLogs = receipt.logs.map((log) => {
698
+ const { eventName, args } = decodeEventLog({
699
+ abi: [event],
700
+ data: log.data,
701
+ topics: log.topics,
702
+ });
703
+
704
+ return { ...log, eventName, args };
705
+ });
706
+
707
+ return this.isActionEventValid(actionStep, decodedLogs);
489
708
  }
490
- if (!event) {
491
- throw new Error(`No known ABI for given event signature: ${signature}`);
709
+ if (actionStep.signatureType === SignatureType.FUNC) {
710
+ if ('hash' in params && 'chainId' in params) {
711
+ const client = this._config.getClient({
712
+ chainId: params.chainId,
713
+ }) as PublicClient;
714
+ const transaction = await client.getTransaction({
715
+ hash: params.hash,
716
+ });
717
+ return this.isActionFunctionValid(actionStep, transaction, params);
718
+ }
492
719
  }
493
- const targetContract = actionStep.targetContract;
494
- // Get all logs matching the event signature from the target contract
495
- const logs =
496
- params?.logs ||
497
- (await getLogs(this._config.getClient({ chainId: params?.chainId }), {
498
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
499
- ...(params as any),
500
- address: targetContract,
501
- event,
502
- }));
720
+ return false;
721
+ }
722
+
723
+ /**
724
+ * Validates a single action event with a given criteria against logs.
725
+ * If logs are provided in the optional `params` argument, then those logs will be used instead of being fetched with the configured client.
726
+ *
727
+ * @public
728
+ * @async
729
+ * @param {ActionStep} actionStep - The action step containing the event to validate.
730
+ * @param {EventLogs} logs - Event logs to validate the given step against
731
+ * @returns {Promise<boolean>} Resolves to true if the action event is valid, throws if input is invalid, otherwise false.
732
+ */
733
+ public isActionEventValid(actionStep: ActionStep, logs: EventLogs) {
734
+ const criteria = actionStep.actionParameter;
503
735
  if (!logs.length) return false;
504
736
  for (let log of logs) {
505
- if (!this.validateLogAgainstCriteria(criteria, log)) {
506
- return false;
737
+ if (this.validateLogAgainstCriteria(criteria, log)) {
738
+ return true;
507
739
  }
508
740
  }
509
- return true;
741
+ return false;
510
742
  }
511
743
 
512
744
  /**
513
- * Validates a {@link Log} against a given criteria.
745
+ * Validates a single action function with a given criteria against the transaction input.
746
+ *
747
+ * @public
748
+ * @param {ActionStep} actionStep - The action step containing the function to validate.
749
+ * @param {Transaction} transaction - The transaction that will be validated against.
750
+ * @param {Object} [params] - Optional parameters for validation.
751
+ * @param {AbiItem} [params.abiItem] - The ABI item for the function, if known.
752
+ * @param {Record<Hex, AbiEvent | AbiFunction>} [params.knownSignatures] - A record of known signatures.
753
+ * @returns {boolean} Returns true if the action function is valid, false otherwise.
754
+ * @throws {ValidationAbiMissingError} Throws if the ABI for the function signature is not found.
755
+ * @throws {FunctionDataDecodeError} Throws if there's an error decoding the function data.
756
+ */
757
+ public isActionFunctionValid(
758
+ actionStep: ActionStep,
759
+ transaction: Transaction,
760
+ params?: Pick<ValidateActionStepParams, 'abiItem' | 'knownSignatures'>,
761
+ ) {
762
+ const criteria = actionStep.actionParameter;
763
+ let signature = actionStep.signature;
764
+
765
+ let func: AbiFunction;
766
+ if (params?.abiItem) func = params?.abiItem as AbiFunction;
767
+ else {
768
+ const sigPool: Record<Hex, AbiFunction> = {
769
+ ...(functions.abi as Record<Hex, AbiFunction>),
770
+ ...((params?.knownSignatures as Record<Hex, AbiFunction>) || {}),
771
+ };
772
+ func = sigPool[signature] as AbiFunction;
773
+ }
774
+ if (!func) {
775
+ throw new ValidationAbiMissingError(signature);
776
+ }
777
+
778
+ let decodedData;
779
+ try {
780
+ decodedData = decodeFunctionData({
781
+ abi: [func],
782
+ data: transaction.input,
783
+ });
784
+ } catch (e) {
785
+ throw new FunctionDataDecodeError([func], e as Error);
786
+ }
787
+
788
+ // Validate the criteria against decoded arguments using fieldIndex
789
+ const decodedArgs = decodedData.args;
790
+
791
+ if (!decodedArgs || !decodedData) return false;
792
+
793
+ if (
794
+ !this.validateFunctionAgainstCriteria(
795
+ criteria,
796
+ decodedArgs as (string | bigint)[],
797
+ )
798
+ ) {
799
+ return false;
800
+ }
801
+
802
+ return true;
803
+ }
804
+ /**
805
+ * Validates a field against a given criteria.
514
806
  *
515
807
  * @param {Criteria} criteria - The criteria to validate against.
516
- * @param {Log} log - The Viem event log.
517
- * @returns {boolean} - Returns true if the log passes the criteria, false otherwise.
808
+ * @param {string | bigint | Hex} fieldValue - The field value to validate.
809
+ * @param {Object} input - Additional context for validation.
810
+ * @param {EventLogs[0]} [input.log] - The event log, if validating an event.
811
+ * @param {readonly (string | bigint)[]} [input.decodedArgs] - The decoded function arguments, if validating a function call.
812
+ * @returns {Promise<boolean>} - Returns true if the field passes the criteria, false otherwise.
518
813
  */
519
- public validateLogAgainstCriteria(criteria: Criteria, log: Log) {
520
- const fieldValue = log.topics.at(criteria.fieldIndex);
521
- if (fieldValue === undefined) {
522
- throw new FieldValueUndefinedError({ log, criteria, fieldValue });
814
+ public validateFieldAgainstCriteria(
815
+ criteria: Criteria,
816
+ fieldValue: string | bigint | Hex,
817
+ input:
818
+ | { log: EventLogs[0] }
819
+ | { decodedArgs: readonly (string | bigint)[] },
820
+ ): boolean {
821
+ if (
822
+ criteria.filterType === FilterType.EQUAL &&
823
+ criteria.fieldType === PrimitiveType.BYTES &&
824
+ criteria.fieldIndex === 255
825
+ ) {
826
+ return true;
523
827
  }
828
+
524
829
  // Type narrow based on criteria.filterType
525
830
  switch (criteria.filterType) {
526
831
  case FilterType.EQUAL:
527
- if (criteria.fieldType === PrimitiveType.ADDRESS) {
528
- return isAddressEqual(
529
- criteria.filterData,
530
- `0x${fieldValue.slice(-40)}`,
531
- );
532
- }
533
- return fieldValue === criteria.filterData;
832
+ return match(criteria.fieldType)
833
+ .with(PrimitiveType.ADDRESS, () =>
834
+ isAddressEqual(criteria.filterData, fieldValue as Address),
835
+ )
836
+ .with(
837
+ PrimitiveType.UINT,
838
+ () => BigInt(fieldValue) === BigInt(criteria.filterData),
839
+ )
840
+ .with(
841
+ PrimitiveType.STRING,
842
+ () => fieldValue === fromHex(criteria.filterData, 'string'),
843
+ )
844
+ .otherwise(() => fieldValue === criteria.filterData);
534
845
 
535
846
  case FilterType.NOT_EQUAL:
536
- return fieldValue !== criteria.filterData;
847
+ return match(criteria.fieldType)
848
+ .with(
849
+ PrimitiveType.ADDRESS,
850
+ () => !isAddressEqual(criteria.filterData, fieldValue as Address),
851
+ )
852
+ .with(
853
+ PrimitiveType.UINT,
854
+ () => BigInt(fieldValue) !== BigInt(criteria.filterData),
855
+ )
856
+ .with(
857
+ PrimitiveType.STRING,
858
+ () => fieldValue !== fromHex(criteria.filterData, 'string'),
859
+ )
860
+ .otherwise(() => fieldValue !== criteria.filterData);
537
861
 
538
862
  case FilterType.GREATER_THAN:
539
863
  if (criteria.fieldType === PrimitiveType.UINT) {
540
864
  return BigInt(fieldValue) > BigInt(criteria.filterData);
541
865
  }
542
- throw new InvalidNumericalCriteriaError({ log, criteria, fieldValue });
866
+ throw new InvalidNumericalCriteriaError({
867
+ ...input,
868
+ criteria,
869
+ fieldValue,
870
+ });
543
871
 
544
872
  case FilterType.LESS_THAN:
545
873
  if (criteria.fieldType === PrimitiveType.UINT) {
546
874
  return BigInt(fieldValue) < BigInt(criteria.filterData);
547
875
  }
548
- throw new InvalidNumericalCriteriaError({ log, criteria, fieldValue });
876
+ throw new InvalidNumericalCriteriaError({
877
+ ...input,
878
+ criteria,
879
+ fieldValue,
880
+ });
549
881
 
550
882
  case FilterType.CONTAINS:
551
883
  if (
552
884
  criteria.fieldType === PrimitiveType.BYTES ||
553
885
  criteria.fieldType === PrimitiveType.STRING
554
886
  ) {
555
- return fieldValue.includes(criteria.filterData);
887
+ let substring;
888
+ if (criteria.fieldType === PrimitiveType.STRING) {
889
+ substring = fromHex(criteria.filterData, 'string');
890
+ } else {
891
+ // truncate the `0x` prefix
892
+ substring = criteria.filterData.slice(2);
893
+ }
894
+ return (fieldValue as string).includes(substring);
895
+ }
896
+ throw new FieldValueNotComparableError({
897
+ ...input,
898
+ criteria,
899
+ fieldValue,
900
+ });
901
+
902
+ case FilterType.REGEX:
903
+ if (typeof fieldValue !== 'string') {
904
+ throw new FieldValueNotComparableError({
905
+ ...input,
906
+ criteria,
907
+ fieldValue,
908
+ });
909
+ }
910
+
911
+ if (criteria.fieldType === PrimitiveType.STRING) {
912
+ // fieldValue is decoded by the ABI
913
+ const regexString = fromHex(criteria.filterData, 'string');
914
+ return new RegExp(regexString).test(fieldValue);
556
915
  }
557
- throw new FieldValueNotComparableError({ log, criteria, fieldValue });
558
916
 
559
917
  default:
560
- throw new UnrecognizedFilterTypeError({ log, criteria, fieldValue });
918
+ throw new UnrecognizedFilterTypeError({
919
+ ...input,
920
+ criteria,
921
+ fieldValue,
922
+ });
561
923
  }
562
924
  }
563
925
 
926
+ /**
927
+ * Validates a {@link Log} against a given criteria.
928
+ * If the criteria's fieldIndex is 255, it is reserved for anyValidation
929
+ *
930
+ * @param {Criteria} criteria - The criteria to validate against.
931
+ * @param {Log} log - The Viem event log.
932
+ * @returns {boolean} - Returns true if the log passes the criteria, false otherwise.
933
+ */
934
+ public validateLogAgainstCriteria(
935
+ criteria: Criteria,
936
+ log: EventLogs[0],
937
+ ): boolean {
938
+ if (
939
+ !Array.isArray(log.args) ||
940
+ (log.args.length <= criteria.fieldIndex && criteria.fieldIndex !== 255)
941
+ ) {
942
+ throw new DecodedArgsMalformedError({
943
+ log,
944
+ criteria,
945
+ fieldValue: undefined,
946
+ });
947
+ }
948
+
949
+ const fieldValue =
950
+ criteria.fieldIndex === 255 ? zeroHash : log.args.at(criteria.fieldIndex);
951
+
952
+ if (fieldValue === undefined) {
953
+ throw new FieldValueUndefinedError({ log, criteria, fieldValue });
954
+ }
955
+ return this.validateFieldAgainstCriteria(criteria, fieldValue, { log });
956
+ }
957
+
958
+ /**
959
+ * Validates a function's decoded arguments against a given criteria.
960
+ * If the criteria's fieldIndex is 255, it is reserved for anyValidation
961
+ *
962
+ * @param {Criteria} criteria - The criteria to validate against.
963
+ * @param {unknown[]} decodedArgs - The decoded arguments of the function call.
964
+ * @returns {Promise<boolean>} - Returns true if the decoded argument passes the criteria, false otherwise.
965
+ */
966
+ public validateFunctionAgainstCriteria(
967
+ criteria: Criteria,
968
+ decodedArgs: readonly (string | bigint)[],
969
+ ): boolean {
970
+ const fieldValue =
971
+ criteria.fieldIndex === 255 ? zeroHash : decodedArgs[criteria.fieldIndex];
972
+ if (fieldValue === undefined) {
973
+ throw new FieldValueUndefinedError({
974
+ criteria,
975
+ fieldValue,
976
+ });
977
+ }
978
+ return this.validateFieldAgainstCriteria(criteria, fieldValue, {
979
+ decodedArgs,
980
+ });
981
+ }
982
+
564
983
  /**
565
984
  * @inheritdoc
566
985
  *
@@ -609,6 +1028,17 @@ export class EventAction extends DeployableTarget<
609
1028
  ...this.optionallyAttachAccount(options.account),
610
1029
  };
611
1030
  }
1031
+
1032
+ public isArraylikeIndexed(step: ActionStep, event: AbiEvent) {
1033
+ if (
1034
+ (step.actionParameter.fieldType === PrimitiveType.STRING ||
1035
+ step.actionParameter.fieldType === PrimitiveType.BYTES) &&
1036
+ event.inputs[step.actionParameter.fieldIndex]?.indexed
1037
+ ) {
1038
+ return true;
1039
+ }
1040
+ return false;
1041
+ }
612
1042
  }
613
1043
 
614
1044
  function _dedupeActionSteps(_steps: ActionStep[]): ActionStep[] {
@@ -803,3 +1233,31 @@ export function prepareEventActionPayload({
803
1233
  ],
804
1234
  );
805
1235
  }
1236
+
1237
+ /**
1238
+ * Creates a default Criteria object that allows validation to pass. This is used if you don't care about targeting specific parameters in the action step.
1239
+ *
1240
+ * This function returns a Criteria object with the following properties:
1241
+ * - filterType: Set to EQUAL for exact matching
1242
+ * - fieldType: Set to BYTES to handle any data type
1243
+ * - fieldIndex: Set to 255, which is typically used to indicate "any" or "all" in this context
1244
+ * - filterData: Set to zeroHash (0x0000...0000)
1245
+ *
1246
+ * @returns {Criteria} A Criteria object that can be used to match any action parameter
1247
+ *
1248
+ * @example
1249
+ * const anyCriteria = anyActionParameter();
1250
+ * // Use this criteria in an ActionStep to match any parameter
1251
+ * const actionStep = {
1252
+ * // ... other properties ...
1253
+ * actionParameter: anyCriteria
1254
+ * };
1255
+ */
1256
+ export function anyActionParameter(): Criteria {
1257
+ return {
1258
+ filterType: FilterType.EQUAL,
1259
+ fieldType: PrimitiveType.BYTES,
1260
+ fieldIndex: 255,
1261
+ filterData: zeroHash,
1262
+ };
1263
+ }