@boostxyz/sdk 0.0.0-alpha.17 → 0.0.0-alpha.19

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 (205) 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 +13 -13
  4. package/dist/Actions/ContractAction.d.ts +9 -9
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +12 -12
  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 +32 -49
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +13 -962
  13. package/dist/Actions/EventAction.js.map +1 -1
  14. package/dist/AllowLists/AllowList.cjs +1 -1
  15. package/dist/AllowLists/AllowList.js +3 -3
  16. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  17. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  18. package/dist/AllowLists/SimpleAllowList.d.ts +5 -5
  19. package/dist/AllowLists/SimpleAllowList.js +24 -24
  20. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  21. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  22. package/dist/AllowLists/SimpleDenyList.d.ts +6 -6
  23. package/dist/AllowLists/SimpleDenyList.js +3 -3
  24. package/dist/Auth/PassthroughAuth.cjs +1 -1
  25. package/dist/Auth/PassthroughAuth.js +1 -1
  26. package/dist/Boost.cjs.map +1 -1
  27. package/dist/Boost.d.ts +18 -0
  28. package/dist/Boost.d.ts.map +1 -1
  29. package/dist/Boost.js.map +1 -1
  30. package/dist/BoostCore-BiPwp6SR.cjs +3 -0
  31. package/dist/BoostCore-BiPwp6SR.cjs.map +1 -0
  32. package/dist/BoostCore-kwoUw7YE.js +1477 -0
  33. package/dist/BoostCore-kwoUw7YE.js.map +1 -0
  34. package/dist/BoostCore.cjs +1 -2
  35. package/dist/BoostCore.cjs.map +1 -1
  36. package/dist/BoostCore.d.ts +86 -36
  37. package/dist/BoostCore.d.ts.map +1 -1
  38. package/dist/BoostCore.js +29 -1273
  39. package/dist/BoostCore.js.map +1 -1
  40. package/dist/BoostRegistry.cjs +1 -1
  41. package/dist/BoostRegistry.cjs.map +1 -1
  42. package/dist/BoostRegistry.d.ts +25 -19
  43. package/dist/BoostRegistry.d.ts.map +1 -1
  44. package/dist/BoostRegistry.js +30 -29
  45. package/dist/BoostRegistry.js.map +1 -1
  46. package/dist/Budgets/Budget.cjs +1 -1
  47. package/dist/Budgets/Budget.js +2 -2
  48. package/dist/Budgets/ManagedBudget.cjs +1 -1
  49. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  50. package/dist/Budgets/ManagedBudget.d.ts +18 -18
  51. package/dist/Budgets/ManagedBudget.js +48 -48
  52. package/dist/Budgets/ManagedBudget.js.map +1 -1
  53. package/dist/Budgets/VestingBudget.d.ts +23 -23
  54. package/dist/Deployable/Contract.cjs +1 -1
  55. package/dist/Deployable/Contract.cjs.map +1 -1
  56. package/dist/Deployable/Contract.d.ts +4 -5
  57. package/dist/Deployable/Contract.d.ts.map +1 -1
  58. package/dist/Deployable/Contract.js +4 -5
  59. package/dist/Deployable/Contract.js.map +1 -1
  60. package/dist/Deployable/Deployable.cjs.map +1 -1
  61. package/dist/Deployable/Deployable.d.ts +1 -1
  62. package/dist/Deployable/Deployable.js +1 -1
  63. package/dist/Deployable/Deployable.js.map +1 -1
  64. package/dist/Deployable/DeployableTarget.cjs +1 -1
  65. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  66. package/dist/Deployable/DeployableTarget.d.ts +5 -5
  67. package/dist/Deployable/DeployableTarget.js +6 -6
  68. package/dist/Deployable/DeployableTarget.js.map +1 -1
  69. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  70. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -1
  71. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +15 -15
  72. package/dist/Deployable/DeployableTargetWithRBAC.js +33 -33
  73. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -1
  74. package/dist/EventAction-D5tnm00s.js +1355 -0
  75. package/dist/EventAction-D5tnm00s.js.map +1 -0
  76. package/dist/EventAction-DBDRaG4A.cjs +2 -0
  77. package/dist/EventAction-DBDRaG4A.cjs.map +1 -0
  78. package/dist/{Incentive-DJf-vdyL.js → Incentive-Bp8Sez7M.js} +61 -62
  79. package/dist/Incentive-Bp8Sez7M.js.map +1 -0
  80. package/dist/{Incentive-DNwROd1r.cjs → Incentive-Djnzseoj.cjs} +2 -2
  81. package/dist/Incentive-Djnzseoj.cjs.map +1 -0
  82. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  83. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  84. package/dist/Incentives/AllowListIncentive.d.ts +12 -12
  85. package/dist/Incentives/AllowListIncentive.js +19 -19
  86. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  87. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  88. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  89. package/dist/Incentives/CGDAIncentive.d.ts +15 -15
  90. package/dist/Incentives/CGDAIncentive.js +18 -18
  91. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  92. package/dist/Incentives/ERC1155Incentive.d.ts +30 -30
  93. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  94. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  95. package/dist/Incentives/ERC20Incentive.d.ts +23 -23
  96. package/dist/Incentives/ERC20Incentive.js +25 -25
  97. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  98. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +523 -0
  99. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  100. package/dist/Incentives/ERC20VariableIncentive.d.ts +19 -19
  101. package/dist/Incentives/Incentive.cjs +1 -1
  102. package/dist/Incentives/Incentive.d.ts +3 -3
  103. package/dist/Incentives/Incentive.d.ts.map +1 -1
  104. package/dist/Incentives/Incentive.js +3 -3
  105. package/dist/Incentives/PointsIncentive.cjs +1 -1
  106. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  107. package/dist/Incentives/PointsIncentive.d.ts +14 -14
  108. package/dist/Incentives/PointsIncentive.js +21 -21
  109. package/dist/Incentives/PointsIncentive.js.map +1 -1
  110. package/dist/{SimpleDenyList-DMlUkmAn.cjs → SimpleDenyList-BwfNjRsg.cjs} +2 -2
  111. package/dist/SimpleDenyList-BwfNjRsg.cjs.map +1 -0
  112. package/dist/{SimpleDenyList-DvUvmOeE.js → SimpleDenyList-Cn5WpNn0.js} +9 -9
  113. package/dist/SimpleDenyList-Cn5WpNn0.js.map +1 -0
  114. package/dist/Validators/SignerValidator.cjs +1 -1
  115. package/dist/Validators/SignerValidator.cjs.map +1 -1
  116. package/dist/Validators/SignerValidator.d.ts +14 -14
  117. package/dist/Validators/SignerValidator.js +19 -19
  118. package/dist/Validators/SignerValidator.js.map +1 -1
  119. package/dist/Validators/Validator.cjs +1 -1
  120. package/dist/Validators/Validator.cjs.map +1 -1
  121. package/dist/Validators/Validator.d.ts +1 -1
  122. package/dist/Validators/Validator.js +6 -6
  123. package/dist/Validators/Validator.js.map +1 -1
  124. package/dist/claiming.cjs.map +1 -1
  125. package/dist/claiming.d.ts +1 -1
  126. package/dist/claiming.js.map +1 -1
  127. package/dist/componentInterfaces-D09mhzxO.cjs +2 -0
  128. package/dist/componentInterfaces-D09mhzxO.cjs.map +1 -0
  129. package/dist/componentInterfaces-RXBMI5yH.js +14 -0
  130. package/dist/componentInterfaces-RXBMI5yH.js.map +1 -0
  131. package/dist/deployments-BM42vImE.js +43 -0
  132. package/dist/deployments-BM42vImE.js.map +1 -0
  133. package/dist/deployments-CMdF5uEC.cjs +2 -0
  134. package/dist/deployments-CMdF5uEC.cjs.map +1 -0
  135. package/dist/deployments.json +15 -12
  136. package/dist/errors.cjs +1 -1
  137. package/dist/errors.cjs.map +1 -1
  138. package/dist/errors.d.ts +132 -0
  139. package/dist/errors.d.ts.map +1 -1
  140. package/dist/errors.js +122 -36
  141. package/dist/errors.js.map +1 -1
  142. package/dist/generated-B0tk-c9b.cjs +3 -0
  143. package/dist/generated-B0tk-c9b.cjs.map +1 -0
  144. package/dist/{generated-C_7Jx3YG.js → generated-B7VaSah4.js} +631 -343
  145. package/dist/generated-B7VaSah4.js.map +1 -0
  146. package/dist/index.cjs +1 -1
  147. package/dist/index.d.ts +1 -0
  148. package/dist/index.d.ts.map +1 -1
  149. package/dist/index.js +135 -126
  150. package/dist/transfers.cjs.map +1 -1
  151. package/dist/transfers.d.ts +1 -1
  152. package/dist/transfers.js.map +1 -1
  153. package/dist/utils.cjs.map +1 -1
  154. package/dist/utils.d.ts +1 -1
  155. package/dist/utils.js.map +1 -1
  156. package/package.json +5 -5
  157. package/src/Actions/ContractAction.ts +9 -10
  158. package/src/Actions/ERC721MintAction.ts +12 -13
  159. package/src/Actions/EventAction.test.ts +45 -54
  160. package/src/Actions/EventAction.ts +100 -100
  161. package/src/AllowLists/SimpleAllowList.ts +5 -5
  162. package/src/AllowLists/SimpleDenyList.ts +6 -6
  163. package/src/Boost.ts +19 -0
  164. package/src/BoostCore.test.ts +117 -1
  165. package/src/BoostCore.ts +121 -57
  166. package/src/BoostRegistry.ts +29 -21
  167. package/src/Budgets/ManagedBudget.ts +18 -18
  168. package/src/Budgets/VestingBudget.ts +23 -23
  169. package/src/Deployable/Contract.ts +4 -5
  170. package/src/Deployable/Deployable.ts +1 -1
  171. package/src/Deployable/DeployableTarget.ts +5 -5
  172. package/src/Deployable/DeployableTargetWithRBAC.ts +15 -15
  173. package/src/Incentives/AllowListIncentive.ts +12 -12
  174. package/src/Incentives/CGDAIncentive.ts +15 -15
  175. package/src/Incentives/ERC1155Incentive.ts +26 -26
  176. package/src/Incentives/ERC20Incentive.ts +23 -23
  177. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  178. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
  179. package/src/Incentives/ERC20VariableIncentive.ts +19 -19
  180. package/src/Incentives/Incentive.ts +6 -5
  181. package/src/Incentives/PointsIncentive.test.ts +21 -21
  182. package/src/Incentives/PointsIncentive.ts +14 -14
  183. package/src/Validators/SignerValidator.ts +14 -14
  184. package/src/Validators/Validator.ts +1 -1
  185. package/src/claiming.ts +1 -1
  186. package/src/errors.ts +165 -0
  187. package/src/index.test.ts +117 -33
  188. package/src/index.ts +1 -0
  189. package/src/transfers.ts +1 -1
  190. package/src/utils.ts +1 -1
  191. package/dist/Incentive-DJf-vdyL.js.map +0 -1
  192. package/dist/Incentive-DNwROd1r.cjs.map +0 -1
  193. package/dist/SimpleDenyList-DMlUkmAn.cjs.map +0 -1
  194. package/dist/SimpleDenyList-DvUvmOeE.js.map +0 -1
  195. package/dist/componentInterfaces-BPVR_Ykd.js +0 -13
  196. package/dist/componentInterfaces-BPVR_Ykd.js.map +0 -1
  197. package/dist/componentInterfaces-BfppSIl4.cjs +0 -2
  198. package/dist/componentInterfaces-BfppSIl4.cjs.map +0 -1
  199. package/dist/deployments-BvFcK_eR.js +0 -40
  200. package/dist/deployments-BvFcK_eR.js.map +0 -1
  201. package/dist/deployments-Ho4PnGCS.cjs +0 -2
  202. package/dist/deployments-Ho4PnGCS.cjs.map +0 -1
  203. package/dist/generated-CMQ6ZC2_.cjs +0 -3
  204. package/dist/generated-CMQ6ZC2_.cjs.map +0 -1
  205. package/dist/generated-C_7Jx3YG.js.map +0 -1
@@ -17,7 +17,6 @@ import {
17
17
  encodeAbiParameters,
18
18
  parseAbiParameters,
19
19
  } from 'viem';
20
- import {} from '../../dist/deployments.json';
21
20
  import type {
22
21
  DeployableOptions,
23
22
  GenericDeployableParams,
@@ -117,7 +116,7 @@ export class ContractAction<
117
116
  *
118
117
  * @public
119
118
  * @async
120
- * @param {?ReadParams<typeof contractActionAbi, 'chainId'>} [params]
119
+ * @param {?ReadParams} [params]
121
120
  * @returns {Promise<bigint>}
122
121
  */
123
122
  public async chainId(
@@ -136,7 +135,7 @@ export class ContractAction<
136
135
  *
137
136
  * @public
138
137
  * @async
139
- * @param {?ReadParams<typeof contractActionAbi, 'target'>} [params]
138
+ * @param {?ReadParams} [params]
140
139
  * @returns {Promise<`0x${string}`>}
141
140
  */
142
141
  public async target(params?: ReadParams<typeof contractActionAbi, 'target'>) {
@@ -154,7 +153,7 @@ export class ContractAction<
154
153
  * @example `function mint(address to, uint256 amount)`
155
154
  * @public
156
155
  * @async
157
- * @param {?ReadParams<typeof contractActionAbi, 'selector'>} [params]
156
+ * @param {?ReadParams} [params]
158
157
  * @returns {Promise<`0x${string}`>}
159
158
  */
160
159
  public async selector(
@@ -173,7 +172,7 @@ export class ContractAction<
173
172
  *
174
173
  * @public
175
174
  * @async
176
- * @param {?ReadParams<typeof contractActionAbi, 'value'>} [params]
175
+ * @param {?ReadParams} [params]
177
176
  * @returns {Promise<bigint>}
178
177
  */
179
178
  public async value(params?: ReadParams<typeof contractActionAbi, 'value'>) {
@@ -191,7 +190,7 @@ export class ContractAction<
191
190
  * @public
192
191
  * @async
193
192
  * @param {Hex} data
194
- * @param {?WriteParams<typeof contractActionAbi, 'execute'>} [params]
193
+ * @param {?WriteParams} [params]
195
194
  * @returns {Promise<readonly [boolean, `0x${string}`]>}
196
195
  */
197
196
  public async execute(
@@ -207,8 +206,8 @@ export class ContractAction<
207
206
  * @public
208
207
  * @async
209
208
  * @param {Hex} data
210
- * @param {?WriteParams<typeof contractActionAbi, 'execute'>} [params]
211
- * @returns {unknown}
209
+ * @param {?WriteParams} [params]
210
+ * @returns {Promise<{ hash: `0x${string}`; result: readonly [boolean, `0x${string}`]; }>}
212
211
  */
213
212
  public async executeRaw(
214
213
  data: Hex,
@@ -234,8 +233,8 @@ export class ContractAction<
234
233
  * @public
235
234
  * @async
236
235
  * @param {Hex} calldata
237
- * @param {?ReadParams<typeof contractActionAbi, 'prepare'>} [params]
238
- * @returns {unknown}
236
+ * @param {?ReadParams} [params]
237
+ * @returns {Promise<`0x${string}`>}
239
238
  */
240
239
  public async prepare(
241
240
  calldata: Hex,
@@ -15,7 +15,6 @@ import {
15
15
  encodeAbiParameters,
16
16
  toHex,
17
17
  } from 'viem';
18
- import {} from '../../dist/deployments.json';
19
18
  import type {
20
19
  DeployableOptions,
21
20
  GenericDeployableParams,
@@ -97,8 +96,8 @@ export class ERC721MintAction extends ContractAction<
97
96
  * @public
98
97
  * @async
99
98
  * @param {bigint} token
100
- * @param {?ReadParams<typeof erc721MintActionAbi, 'validated'>} [params]
101
- * @returns {unknown}
99
+ * @param {?ReadParams} [params]
100
+ * @returns {Promise<boolean>}
102
101
  */
103
102
  public async validated(
104
103
  token: bigint,
@@ -119,8 +118,8 @@ export class ERC721MintAction extends ContractAction<
119
118
  * @public
120
119
  * @async
121
120
  * @param {Hex} data
122
- * @param {?WriteParams<typeof erc721MintActionAbi, 'execute'>} [params]
123
- * @returns {unknown}
121
+ * @param {?WriteParams} [params]
122
+ * @returns {Promise<readonly [boolean, `0x${string}`]>}
124
123
  */
125
124
  public override async execute(
126
125
  data: Hex,
@@ -135,8 +134,8 @@ export class ERC721MintAction extends ContractAction<
135
134
  * @public
136
135
  * @async
137
136
  * @param {Hex} data
138
- * @param {?WriteParams<typeof erc721MintActionAbi, 'execute'>} [params]
139
- * @returns {unknown}
137
+ * @param {?WriteParams} [params]
138
+ * @returns {Promise<{ hash: `0x${string}`; result: readonly [boolean, `0x${string}`]; }>}
140
139
  */
141
140
  public override async executeRaw(
142
141
  data: Hex,
@@ -162,8 +161,8 @@ export class ERC721MintAction extends ContractAction<
162
161
  * @public
163
162
  * @async
164
163
  * @param {Hex} data
165
- * @param {?ReadParams<typeof erc721MintActionAbi, 'prepare'>} [params]
166
- * @returns {unknown}
164
+ * @param {?ReadParams} [params]
165
+ * @returns {Promise<`0x${string}`>}
167
166
  */
168
167
  public override async prepare(
169
168
  data: Hex,
@@ -185,8 +184,8 @@ export class ERC721MintAction extends ContractAction<
185
184
  * @async
186
185
  * @param {Address} holder - The holder
187
186
  * @param {BigInt} tokenId - The token ID
188
- * @param {?WriteParams<typeof erc721MintActionAbi, 'validate'>} [params]
189
- * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the action has been validated for the user
187
+ * @param {?WriteParams} [params]
188
+ * @returns {Promise<boolean>} - True if the action has been validated for the user
190
189
  */
191
190
  protected async validate(
192
191
  holder: Address,
@@ -203,7 +202,7 @@ export class ERC721MintAction extends ContractAction<
203
202
  * @async
204
203
  * @param {Address} holder - The holder
205
204
  * @param {BigInt} tokenId - The token ID
206
- * @param {?WriteParams<typeof erc721MintActionAbi, 'validate'>} [params]
205
+ * @param {?WriteParams} [params]
207
206
  * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the action has been validated for the user
208
207
  */
209
208
  protected async validateRaw(
@@ -280,7 +279,7 @@ export function prepareERC721MintActionValidate(
280
279
  * @param {Address} param0.target - The target contract address
281
280
  * @param {Hex} param0.selector - The selector for the function to be called
282
281
  * @param {bigint} param0.value - The native token value to send with the function call
283
- * @returns {*}
282
+ * @returns {Hex}
284
283
  */
285
284
  export function prepareERC721MintActionPayload({
286
285
  chainId,
@@ -17,7 +17,6 @@ import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
17
17
  import type { MockERC20 } from '@boostxyz/test/MockERC20';
18
18
  import type { MockERC721 } from '@boostxyz/test/MockERC721';
19
19
  import { accounts } from '@boostxyz/test/accounts';
20
- import { InvalidNumericalCriteriaError, FieldValueNotComparableError, UnrecognizedFilterTypeError } from '../errors';
21
20
  import {
22
21
  type Fixtures,
23
22
  type StringEmitterFixtures,
@@ -41,10 +40,12 @@ let fixtures: Fixtures,
41
40
  erc721: MockERC721,
42
41
  erc20: MockERC20,
43
42
  stringEmitterFixtures: StringEmitterFixtures;
43
+ let chainId: number;
44
44
 
45
45
  beforeAll(async () => {
46
46
  fixtures = await loadFixture(deployFixtures(defaultOptions));
47
47
  stringEmitterFixtures = await loadFixture(deployStringEmitterMock);
48
+ chainId = defaultOptions.config.chains[0].id;
48
49
  });
49
50
 
50
51
  function basicErc721TransferAction(
@@ -58,7 +59,7 @@ function basicErc721TransferAction(
58
59
  ] as Hex,
59
60
  fieldIndex: 1,
60
61
  targetContract: erc721.assertValidAddress(),
61
- chainid: defaultOptions.config.chains[0].id,
62
+ chainid: chainId,
62
63
  },
63
64
  actionSteps: [
64
65
  {
@@ -67,7 +68,7 @@ function basicErc721TransferAction(
67
68
  ] as Hex,
68
69
  signatureType: SignatureType.EVENT,
69
70
  targetContract: erc721.assertValidAddress(),
70
- chainid: defaultOptions.config.chains[0].id,
71
+ chainid: chainId,
71
72
  actionParameter: {
72
73
  filterType: FilterType.EQUAL,
73
74
  fieldType: PrimitiveType.ADDRESS,
@@ -91,14 +92,13 @@ function cloneEventAction(fixtures: Fixtures, erc721: MockERC721) {
91
92
  function basicErc721MintFuncAction(
92
93
  erc721: MockERC721,
93
94
  ): EventActionPayloadSimple {
94
- console.log(funcSelectors["mint(address)"] as Hex);
95
95
  return {
96
96
  actionClaimant: {
97
97
  signatureType: SignatureType.FUNC,
98
98
  signature: funcSelectors["mint(address)"] as Hex,
99
99
  fieldIndex: 0,
100
100
  targetContract: erc721.assertValidAddress(),
101
- chainid: defaultOptions.config.chains[0].id,
101
+ chainid: chainId,
102
102
  },
103
103
  actionSteps: [
104
104
  {
@@ -106,7 +106,7 @@ function basicErc721MintFuncAction(
106
106
  signatureType: SignatureType.FUNC,
107
107
  actionType: 0,
108
108
  targetContract: erc721.assertValidAddress(),
109
- chainid: defaultOptions.config.chains[0].id,
109
+ chainid: chainId,
110
110
  actionParameter: {
111
111
  filterType: FilterType.EQUAL,
112
112
  fieldType: PrimitiveType.ADDRESS,
@@ -125,7 +125,7 @@ function basicErc20MintFuncAction(erc20: MockERC20): EventActionPayloadSimple {
125
125
  signature: funcSelectors["mint(address to, uint256 amount)"] as Hex,
126
126
  fieldIndex: 0,
127
127
  targetContract: erc20.assertValidAddress(),
128
- chainid: defaultOptions.config.chains[0].id,
128
+ chainid: chainId,
129
129
  },
130
130
  actionSteps: [
131
131
  {
@@ -133,7 +133,7 @@ function basicErc20MintFuncAction(erc20: MockERC20): EventActionPayloadSimple {
133
133
  signatureType: SignatureType.FUNC,
134
134
  actionType: 0,
135
135
  targetContract: erc20.assertValidAddress(),
136
- chainid: defaultOptions.config.chains[0].id,
136
+ chainid: chainId,
137
137
  actionParameter: {
138
138
  filterType: FilterType.EQUAL,
139
139
  fieldType: PrimitiveType.ADDRESS,
@@ -159,7 +159,7 @@ function indexedStringErc721TransferAction(
159
159
  ] as Hex,
160
160
  fieldIndex: 1,
161
161
  targetContract: erc721.assertValidAddress(),
162
- chainid: defaultOptions.config.chains[0].id,
162
+ chainid: chainId,
163
163
  },
164
164
  actionSteps: [
165
165
  {
@@ -169,7 +169,7 @@ function indexedStringErc721TransferAction(
169
169
  signatureType: SignatureType.EVENT,
170
170
  actionType: 0,
171
171
  targetContract: stringEmitterAddress,
172
- chainid: defaultOptions.config.chains[0].id,
172
+ chainid: chainId,
173
173
  actionParameter: {
174
174
  filterType,
175
175
  fieldType: PrimitiveType.STRING,
@@ -195,7 +195,7 @@ function stringErc721TransferAction(
195
195
  ] as Hex,
196
196
  fieldIndex: 1,
197
197
  targetContract: erc721.assertValidAddress(),
198
- chainid: defaultOptions.config.chains[0].id,
198
+ chainid: chainId,
199
199
  },
200
200
  actionSteps: [
201
201
  {
@@ -203,7 +203,7 @@ function stringErc721TransferAction(
203
203
  signatureType: SignatureType.EVENT,
204
204
  actionType: 0,
205
205
  targetContract: stringEmitterAddress,
206
- chainid: defaultOptions.config.chains[0].id,
206
+ chainid: chainId,
207
207
  actionParameter: {
208
208
  filterType,
209
209
  fieldType: PrimitiveType.STRING,
@@ -308,7 +308,7 @@ describe("EventAction Event Selector", () => {
308
308
  const action = await loadFixture(cloneEventAction(fixtures, erc721));
309
309
  const steps = await action.getActionSteps();
310
310
  expect(steps.length).toBe(1);
311
- const step = steps[0];
311
+ const step = steps[0]!;
312
312
  step.targetContract = step.targetContract.toUpperCase() as Hex;
313
313
  step.actionParameter.filterData =
314
314
  step.actionParameter.filterData.toUpperCase() as Hex;
@@ -351,7 +351,7 @@ describe("EventAction Event Selector", () => {
351
351
  const action = await loadFixture(cloneEventAction(fixtures, erc721));
352
352
  const steps = await action.getActionSteps();
353
353
  expect(steps.length).toBe(1);
354
- const step = steps[0];
354
+ const step = steps[0]!;
355
355
  step.targetContract = step.targetContract.toUpperCase() as Hex;
356
356
  step.actionParameter.filterData =
357
357
  step.actionParameter.filterData.toUpperCase() as Hex;
@@ -391,20 +391,16 @@ describe("EventAction Event Selector", () => {
391
391
  });
392
392
  });
393
393
 
394
- test("with no logs, does not validate", async () => {
395
- const action = await loadFixture(cloneEventAction(fixtures, erc721));
396
- expect(await action.validateActionSteps()).toBe(false);
397
- });
398
-
399
394
  test("with a correct log, validates", async () => {
400
395
  const action = await loadFixture(cloneEventAction(fixtures, erc721));
401
396
  const recipient = accounts[1].account;
402
397
  await erc721.approve(recipient, 1n);
403
- await erc721.transferFrom(defaultOptions.account.address, recipient, 1n);
404
- expect(await action.validateActionSteps()).toBe(true);
398
+ const { hash } = await erc721.transferFromRaw(defaultOptions.account.address, recipient, 1n);
399
+ expect(await action.validateActionSteps({ hash, chainId })).toBe(true);
405
400
  });
406
401
 
407
402
  test("can supply your own logs to validate against", async () => {
403
+ const hash = "0xff0e6ab0c4961ec14b7b40afec83ed7d7a77582683512a262e641d21f82efea5"
408
404
  const logs: EventLogs = [
409
405
  {
410
406
  eventName: "Transfer",
@@ -432,7 +428,7 @@ describe("EventAction Event Selector", () => {
432
428
  },
433
429
  ];
434
430
  const action = await loadFixture(cloneEventAction(fixtures, erc721));
435
- expect(await action.validateActionSteps({ logs })).toBe(true);
431
+ expect(await action.validateActionSteps({ hash, chainId, logs })).toBe(true);
436
432
  });
437
433
 
438
434
  describe("string event actions", () => {
@@ -449,8 +445,8 @@ describe("EventAction Event Selector", () => {
449
445
  ),
450
446
  );
451
447
 
452
- await stringEmitterFixtures.emitIndexedString("Hello world");
453
- await expect(() => action.validateActionSteps()).rejects.toThrowError(
448
+ const hash = await stringEmitterFixtures.emitIndexedString("Hello world");
449
+ await expect(() => action.validateActionSteps({ hash, chainId })).rejects.toThrowError(
454
450
  /Parameter is not transparently stored onchain/,
455
451
  );
456
452
  });
@@ -466,8 +462,8 @@ describe("EventAction Event Selector", () => {
466
462
  ),
467
463
  ),
468
464
  );
469
- await stringEmitterFixtures.emitString("Hello world");
470
- expect(await action.validateActionSteps()).toBe(true);
465
+ const hash = await stringEmitterFixtures.emitString("Hello world");
466
+ expect(await action.validateActionSteps({ hash, chainId })).toBe(true);
471
467
  });
472
468
  test("can parse and validate regex for an emitted string event", async () => {
473
469
  const action = await loadFixture(
@@ -482,8 +478,8 @@ describe("EventAction Event Selector", () => {
482
478
  ),
483
479
  );
484
480
 
485
- await stringEmitterFixtures.emitString("Hello world");
486
- expect(await action.validateActionSteps()).toBe(true);
481
+ const hash = await stringEmitterFixtures.emitString("Hello world");
482
+ expect(await action.validateActionSteps({ hash, chainId })).toBe(true);
487
483
  });
488
484
  });
489
485
  });
@@ -628,42 +624,29 @@ describe("EventAction Func Selector", () => {
628
624
  test("validates function action step with correct hash", async () => {
629
625
  const action = await loadFixture(cloneFunctionAction(fixtures, erc721));
630
626
  const actionSteps = await action.getActionSteps();
627
+ const actionStep = actionSteps[0]!
631
628
  const recipient = accounts[1].account;
632
629
  const { hash } = await erc721.mintRaw(recipient, {
633
630
  value: parseEther(".1"),
634
631
  });
635
632
 
636
633
  expect(
637
- await action.isActionFunctionValid(actionSteps[0], {
638
- hash,
639
- }),
634
+ await action.isActionStepValid(actionStep, { hash, chainId })
640
635
  ).toBe(true);
641
636
  });
642
637
 
643
- test("throws an error when hash is missing", async () => {
644
- const action = await loadFixture(cloneFunctionAction(fixtures, erc721));
645
- const actionSteps = await action.getActionSteps();
646
- try {
647
- await action.isActionFunctionValid(actionSteps[0], {});
648
- } catch (e) {
649
- expect(e).toBeInstanceOf(Error);
650
- expect((e as Error).message).toBe(
651
- "Hash is required for function validation",
652
- );
653
- }
654
- });
655
-
656
638
  test("validates function step with EQUAL filter", async () => {
657
639
  const action = await loadFixture(cloneFunctionAction(fixtures, erc721));
658
640
  const actionSteps = await action.getActionSteps();
659
-
641
+ const actionStep = actionSteps[0]!
660
642
  const recipient = accounts[1].account;
661
643
  const { hash } = await erc721.mintRaw(recipient, {
662
644
  value: parseEther(".1"),
663
645
  });
664
646
 
665
- const criteriaMatch = await action.isActionFunctionValid(actionSteps[0], {
647
+ const criteriaMatch = await action.isActionStepValid(actionStep, {
666
648
  hash,
649
+ chainId,
667
650
  });
668
651
 
669
652
  expect(criteriaMatch).toBe(true);
@@ -672,10 +655,11 @@ describe("EventAction Func Selector", () => {
672
655
  test("fails validation with incorrect function signature", async () => {
673
656
  const action = await loadFixture(cloneFunctionAction(fixtures, erc721));
674
657
  const actionSteps = await action.getActionSteps();
658
+ const actionStep = actionSteps[0]!;
675
659
  const recipient = accounts[1].account;
676
660
 
677
661
  const invalidStep = {
678
- ...actionSteps[0],
662
+ ...actionStep,
679
663
  signature: funcSelectors["mint(address to, uint256 amount)"] as Hex, // Intentional mismatch
680
664
  };
681
665
 
@@ -684,7 +668,7 @@ describe("EventAction Func Selector", () => {
684
668
  });
685
669
 
686
670
  try {
687
- await action.isActionFunctionValid(invalidStep, { hash });
671
+ await action.isActionStepValid(invalidStep, { hash, chainId });
688
672
  } catch (e) {
689
673
  expect(e).toBeInstanceOf(Error);
690
674
  expect((e as Error).message).toContain(
@@ -696,15 +680,17 @@ describe("EventAction Func Selector", () => {
696
680
  test("validates against NOT_EQUAL filter criteria", async () => {
697
681
  const action = await loadFixture(cloneFunctionAction(fixtures, erc721));
698
682
  const actionSteps = await action.getActionSteps();
699
- actionSteps[0].actionParameter.filterType = FilterType.NOT_EQUAL;
683
+ const actionStep = actionSteps[0]!;
684
+ actionStep.actionParameter.filterType = FilterType.NOT_EQUAL;
700
685
  const recipient = accounts[2].account;
701
686
  const { hash } = await erc721.mintRaw(recipient, {
702
687
  value: parseEther(".1"),
703
688
  });
704
689
 
705
690
  expect(
706
- await action.isActionFunctionValid(actionSteps[0], {
691
+ await action.isActionStepValid(actionStep, {
707
692
  hash,
693
+ chainId,
708
694
  }),
709
695
  ).toBe(true);
710
696
  });
@@ -712,8 +698,9 @@ describe("EventAction Func Selector", () => {
712
698
  test("validates GREATER_THAN criteria for numeric values", async () => {
713
699
  const action = await loadFixture(cloneFunctionAction20(fixtures, erc20));
714
700
  const actionSteps = await action.getActionSteps();
701
+ const actionStep = actionSteps[0]!;
715
702
 
716
- actionSteps[0].actionParameter = {
703
+ actionStep.actionParameter = {
717
704
  filterType: FilterType.GREATER_THAN,
718
705
  fieldType: PrimitiveType.UINT,
719
706
  fieldIndex: 1,
@@ -725,8 +712,9 @@ describe("EventAction Func Selector", () => {
725
712
  const { hash } = await erc20.mintRaw(address, value);
726
713
 
727
714
  expect(
728
- await action.isActionFunctionValid(actionSteps[0], {
715
+ await action.isActionStepValid(actionStep, {
729
716
  hash,
717
+ chainId,
730
718
  }),
731
719
  ).toBe(true);
732
720
  });
@@ -734,7 +722,8 @@ describe("EventAction Func Selector", () => {
734
722
  test("validates LESS_THAN criteria for numeric values", async () => {
735
723
  const action = await loadFixture(cloneFunctionAction20(fixtures, erc20));
736
724
  const actionSteps = await action.getActionSteps();
737
- actionSteps[0].actionParameter = {
725
+ const actionStep = actionSteps[0]!;
726
+ actionStep.actionParameter = {
738
727
  filterType: FilterType.LESS_THAN,
739
728
  fieldType: PrimitiveType.UINT,
740
729
  fieldIndex: 1,
@@ -746,8 +735,9 @@ describe("EventAction Func Selector", () => {
746
735
  const { hash } = await erc20.mintRaw(address, value);
747
736
 
748
737
  expect(
749
- await action.isActionFunctionValid(actionSteps[0], {
738
+ await action.isActionStepValid(actionStep, {
750
739
  hash,
740
+ chainId,
751
741
  }),
752
742
  ).toBe(true);
753
743
  });
@@ -762,6 +752,7 @@ describe("EventAction Func Selector", () => {
762
752
  expect(
763
753
  await action.validateActionSteps({
764
754
  hash,
755
+ chainId,
765
756
  }),
766
757
  ).toBe(true);
767
758
  });