@boostxyz/sdk 0.0.0-alpha.8 → 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 (266) 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 +57 -14
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +50 -23
  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 +420 -45
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +15 -225
  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 +123 -39
  25. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  26. package/dist/AllowLists/SimpleAllowList.js +75 -76
  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 +234 -13
  31. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  32. package/dist/AllowLists/SimpleDenyList.js +11 -200
  33. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  34. package/dist/Auth/PassthroughAuth.cjs +1 -1
  35. package/dist/Auth/PassthroughAuth.cjs.map +1 -1
  36. package/dist/Auth/PassthroughAuth.js +4 -4
  37. package/dist/Auth/PassthroughAuth.js.map +1 -1
  38. package/dist/Boost.cjs +1 -1
  39. package/dist/Boost.cjs.map +1 -1
  40. package/dist/Boost.d.ts +105 -14
  41. package/dist/Boost.d.ts.map +1 -1
  42. package/dist/Boost.js +137 -5
  43. package/dist/Boost.js.map +1 -1
  44. package/dist/BoostCore-BVZExPPu.js +1462 -0
  45. package/dist/BoostCore-BVZExPPu.js.map +1 -0
  46. package/dist/BoostCore-D-E-cnGI.cjs +3 -0
  47. package/dist/BoostCore-D-E-cnGI.cjs.map +1 -0
  48. package/dist/BoostCore.cjs +1 -2
  49. package/dist/BoostCore.cjs.map +1 -1
  50. package/dist/BoostCore.d.ts +759 -82
  51. package/dist/BoostCore.d.ts.map +1 -1
  52. package/dist/BoostCore.js +29 -1148
  53. package/dist/BoostCore.js.map +1 -1
  54. package/dist/BoostRegistry.cjs +1 -1
  55. package/dist/BoostRegistry.cjs.map +1 -1
  56. package/dist/BoostRegistry.d.ts +83 -28
  57. package/dist/BoostRegistry.d.ts.map +1 -1
  58. package/dist/BoostRegistry.js +170 -93
  59. package/dist/BoostRegistry.js.map +1 -1
  60. package/dist/Budgets/Budget.cjs +1 -1
  61. package/dist/Budgets/Budget.cjs.map +1 -1
  62. package/dist/Budgets/Budget.d.ts.map +1 -1
  63. package/dist/Budgets/Budget.js +2 -2
  64. package/dist/Budgets/Budget.js.map +1 -1
  65. package/dist/Budgets/ManagedBudget.cjs +1 -1
  66. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  67. package/dist/Budgets/ManagedBudget.d.ts +112 -192
  68. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  69. package/dist/Budgets/ManagedBudget.js +89 -290
  70. package/dist/Budgets/ManagedBudget.js.map +1 -1
  71. package/dist/Budgets/VestingBudget.d.ts +277 -91
  72. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  73. package/dist/Deployable/Contract.cjs +1 -1
  74. package/dist/Deployable/Contract.cjs.map +1 -1
  75. package/dist/Deployable/Contract.d.ts +4 -5
  76. package/dist/Deployable/Contract.d.ts.map +1 -1
  77. package/dist/Deployable/Contract.js +6 -8
  78. package/dist/Deployable/Contract.js.map +1 -1
  79. package/dist/Deployable/Deployable.cjs.map +1 -1
  80. package/dist/Deployable/Deployable.d.ts +1 -1
  81. package/dist/Deployable/Deployable.d.ts.map +1 -1
  82. package/dist/Deployable/Deployable.js +3 -5
  83. package/dist/Deployable/Deployable.js.map +1 -1
  84. package/dist/Deployable/DeployableTarget.cjs +1 -1
  85. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  86. package/dist/Deployable/DeployableTarget.d.ts +13 -13
  87. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  88. package/dist/Deployable/DeployableTarget.js +30 -27
  89. package/dist/Deployable/DeployableTarget.js.map +1 -1
  90. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  94. package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
  95. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  96. package/dist/EventAction-BZt5cjbe.cjs +2 -0
  97. package/dist/EventAction-BZt5cjbe.cjs.map +1 -0
  98. package/dist/EventAction-C_-hJXWm.js +1541 -0
  99. package/dist/EventAction-C_-hJXWm.js.map +1 -0
  100. package/dist/Incentive-BhHaK3PZ.cjs +2 -0
  101. package/dist/Incentive-BhHaK3PZ.cjs.map +1 -0
  102. package/dist/Incentive-Cqg1w6wD.js +312 -0
  103. package/dist/Incentive-Cqg1w6wD.js.map +1 -0
  104. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  105. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  106. package/dist/Incentives/AllowListIncentive.d.ts +73 -21
  107. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  108. package/dist/Incentives/AllowListIncentive.js +61 -36
  109. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  110. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  111. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  112. package/dist/Incentives/CGDAIncentive.d.ts +323 -26
  113. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  114. package/dist/Incentives/CGDAIncentive.js +73 -39
  115. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  116. package/dist/Incentives/ERC1155Incentive.d.ts +291 -43
  117. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  118. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  119. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  120. package/dist/Incentives/ERC20Incentive.d.ts +278 -33
  121. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  122. package/dist/Incentives/ERC20Incentive.js +79 -47
  123. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  124. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +346 -420
  125. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  126. package/dist/Incentives/ERC20VariableIncentive.d.ts +271 -32
  127. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  128. package/dist/Incentives/Incentive.cjs +1 -1
  129. package/dist/Incentives/Incentive.cjs.map +1 -1
  130. package/dist/Incentives/Incentive.d.ts +4 -4
  131. package/dist/Incentives/Incentive.d.ts.map +1 -1
  132. package/dist/Incentives/Incentive.js +16 -280
  133. package/dist/Incentives/Incentive.js.map +1 -1
  134. package/dist/Incentives/PointsIncentive.cjs +1 -1
  135. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  136. package/dist/Incentives/PointsIncentive.d.ts +89 -23
  137. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  138. package/dist/Incentives/PointsIncentive.js +66 -36
  139. package/dist/Incentives/PointsIncentive.js.map +1 -1
  140. package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
  141. package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
  142. package/dist/SimpleDenyList-CGaWjuld.js +132 -0
  143. package/dist/SimpleDenyList-CGaWjuld.js.map +1 -0
  144. package/dist/Validators/SignerValidator.cjs +1 -1
  145. package/dist/Validators/SignerValidator.cjs.map +1 -1
  146. package/dist/Validators/SignerValidator.d.ts +310 -17
  147. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  148. package/dist/Validators/SignerValidator.js +164 -36
  149. package/dist/Validators/SignerValidator.js.map +1 -1
  150. package/dist/Validators/Validator.cjs +1 -1
  151. package/dist/Validators/Validator.cjs.map +1 -1
  152. package/dist/Validators/Validator.d.ts +1 -1
  153. package/dist/Validators/Validator.js +2 -2
  154. package/dist/Validators/Validator.js.map +1 -1
  155. package/dist/claiming.cjs +2 -0
  156. package/dist/claiming.cjs.map +1 -0
  157. package/dist/claiming.d.ts +43 -0
  158. package/dist/claiming.d.ts.map +1 -0
  159. package/dist/claiming.js +17 -0
  160. package/dist/claiming.js.map +1 -0
  161. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  162. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  163. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  164. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  165. package/dist/deployments-DVXioW2i.cjs +2 -0
  166. package/dist/deployments-DVXioW2i.cjs.map +1 -0
  167. package/dist/deployments-oykLv3_Z.js +43 -0
  168. package/dist/deployments-oykLv3_Z.js.map +1 -0
  169. package/dist/deployments.json +44 -0
  170. package/dist/errors.cjs +1 -1
  171. package/dist/errors.cjs.map +1 -1
  172. package/dist/errors.d.ts +257 -21
  173. package/dist/errors.d.ts.map +1 -1
  174. package/dist/errors.js +183 -26
  175. package/dist/errors.js.map +1 -1
  176. package/dist/{generated-Cbv8zFkf.js → generated-CKt2yCQd.js} +3615 -1868
  177. package/dist/generated-CKt2yCQd.js.map +1 -0
  178. package/dist/generated-CyTNlOwM.cjs +3 -0
  179. package/dist/generated-CyTNlOwM.cjs.map +1 -0
  180. package/dist/index.cjs +1 -1
  181. package/dist/index.d.ts +9 -4
  182. package/dist/index.d.ts.map +1 -1
  183. package/dist/index.js +143 -126
  184. package/dist/index.js.map +1 -1
  185. package/dist/transfers.cjs +2 -0
  186. package/dist/transfers.cjs.map +1 -0
  187. package/dist/transfers.d.ts +198 -0
  188. package/dist/transfers.d.ts.map +1 -0
  189. package/dist/transfers.js +84 -0
  190. package/dist/transfers.js.map +1 -0
  191. package/dist/utils.cjs +1 -1
  192. package/dist/utils.cjs.map +1 -1
  193. package/dist/utils.d.ts +25 -1380
  194. package/dist/utils.d.ts.map +1 -1
  195. package/dist/utils.js +36 -648
  196. package/dist/utils.js.map +1 -1
  197. package/package.json +34 -10
  198. package/src/Actions/Action.test.ts +19 -17
  199. package/src/Actions/ContractAction.test.ts +14 -16
  200. package/src/Actions/ContractAction.ts +84 -22
  201. package/src/Actions/ERC721MintAction.test.ts +8 -8
  202. package/src/Actions/ERC721MintAction.ts +83 -30
  203. package/src/Actions/EventAction.test.ts +759 -113
  204. package/src/Actions/EventAction.ts +991 -116
  205. package/src/AllowLists/AllowList.test.ts +7 -7
  206. package/src/AllowLists/AllowList.ts +5 -3
  207. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  208. package/src/AllowLists/OpenAllowList.ts +45 -0
  209. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  210. package/src/AllowLists/SimpleAllowList.ts +86 -65
  211. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  212. package/src/AllowLists/SimpleDenyList.ts +87 -126
  213. package/src/Auth/PassthroughAuth.test.ts +1 -1
  214. package/src/Auth/PassthroughAuth.ts +1 -1
  215. package/src/Boost.ts +147 -15
  216. package/src/BoostCore.test.ts +326 -278
  217. package/src/BoostCore.ts +425 -242
  218. package/src/BoostRegistry.test.ts +53 -0
  219. package/src/BoostRegistry.ts +168 -50
  220. package/src/Budgets/Budget.test.ts +2 -2
  221. package/src/Budgets/Budget.ts +1 -2
  222. package/src/Budgets/ManagedBudget.test.ts +82 -19
  223. package/src/Budgets/ManagedBudget.ts +106 -315
  224. package/src/Budgets/VestingBudget.test.ts +7 -7
  225. package/src/Budgets/VestingBudget.ts +110 -112
  226. package/src/Deployable/Contract.ts +5 -6
  227. package/src/Deployable/Deployable.ts +1 -1
  228. package/src/Deployable/DeployableTarget.ts +32 -21
  229. package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
  230. package/src/Incentives/AllowListIncentive.test.ts +7 -10
  231. package/src/Incentives/AllowListIncentive.ts +88 -30
  232. package/src/Incentives/CGDAIncentive.test.ts +11 -12
  233. package/src/Incentives/CGDAIncentive.ts +161 -37
  234. package/src/Incentives/ERC1155Incentive.test.ts +5 -16
  235. package/src/Incentives/ERC1155Incentive.ts +132 -51
  236. package/src/Incentives/ERC20Incentive.test.ts +15 -23
  237. package/src/Incentives/ERC20Incentive.ts +131 -46
  238. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  239. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +324 -0
  240. package/src/Incentives/ERC20VariableIncentive.test.ts +12 -35
  241. package/src/Incentives/ERC20VariableIncentive.ts +118 -43
  242. package/src/Incentives/Incentive.test.ts +5 -2
  243. package/src/Incentives/Incentive.ts +7 -6
  244. package/src/Incentives/PointsIncentive.test.ts +26 -30
  245. package/src/Incentives/PointsIncentive.ts +110 -34
  246. package/src/Validators/SignerValidator.test.ts +9 -13
  247. package/src/Validators/SignerValidator.ts +437 -26
  248. package/src/Validators/Validator.test.ts +2 -2
  249. package/src/Validators/Validator.ts +1 -1
  250. package/src/claiming.ts +56 -0
  251. package/src/errors.ts +346 -22
  252. package/src/index.test.ts +118 -36
  253. package/src/index.ts +15 -7
  254. package/src/transfers.ts +284 -0
  255. package/src/utils.test.ts +2 -2
  256. package/src/utils.ts +61 -2061
  257. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  258. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  259. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  260. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  261. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  262. package/dist/generated-BzszviNp.cjs +0 -3
  263. package/dist/generated-BzszviNp.cjs.map +0 -1
  264. package/dist/generated-Cbv8zFkf.js.map +0 -1
  265. package/src/Budgets/SimpleBudget.test.ts +0 -152
  266. package/src/Budgets/SimpleBudget.ts +0 -521
@@ -1,4 +1,5 @@
1
1
  import {
2
+ readSimpleAllowListOwner,
2
3
  readSimpleDenyListIsAllowed,
3
4
  simpleDenyListAbi,
4
5
  simulateSimpleDenyListSetDenied,
@@ -10,26 +11,47 @@ import {
10
11
  type Address,
11
12
  type ContractEventName,
12
13
  type Hex,
14
+ encodeAbiParameters,
13
15
  zeroAddress,
14
16
  zeroHash,
15
17
  } from 'viem';
18
+ import { SimpleDenyList as SimpleDenyListBases } from '../../dist/deployments.json';
16
19
  import type {
17
20
  DeployableOptions,
18
21
  GenericDeployableParams,
19
22
  } from '../Deployable/Deployable';
20
- import { DeployableTarget } from '../Deployable/DeployableTarget';
23
+ import { DeployableTargetWithRBAC } from '../Deployable/DeployableTargetWithRBAC';
21
24
  import { DeployableUnknownOwnerProvidedError } from '../errors';
22
25
  import {
23
26
  type GenericLog,
24
27
  type ReadParams,
25
28
  RegistryType,
26
- type SimpleDenyListPayload,
27
29
  type WriteParams,
28
- prepareSimpleDenyListPayload,
29
30
  } from '../utils';
30
31
 
31
32
  export { simpleDenyListAbi };
32
- export type { SimpleDenyListPayload };
33
+
34
+ /**
35
+ * Object representation of a {@link SimpleDenyList} initialization payload.
36
+ *
37
+ * @export
38
+ * @interface SimpleDenyListPayload
39
+ * @typedef {SimpleDenyListPayload}
40
+ */
41
+ export interface SimpleDenyListPayload {
42
+ /**
43
+ * The allow list's owner
44
+ *
45
+ * @type {Address}
46
+ */
47
+ owner: Address;
48
+ /**
49
+ * List of denied addresses.
50
+ *
51
+ * @type {Address[]}
52
+ */
53
+ denied: Address[];
54
+ }
33
55
 
34
56
  /**
35
57
  * A generic `viem.Log` event with support for `SimpleDenyList` event types.
@@ -52,10 +74,12 @@ export type SimpleDenyListLog<
52
74
  * @export
53
75
  * @class SimpleDenyList
54
76
  * @typedef {SimpleDenyList}
55
- * @extends {DeployableTarget<SimpleDenyListPayload>}
77
+ * @extends {DeployableTargetWithRBAC<SimpleDenyListPayload>}
56
78
  */
57
- export class SimpleDenyList extends DeployableTarget<
58
- SimpleDenyListPayload,
79
+ export class SimpleDenyList<
80
+ Payload = SimpleDenyListPayload,
81
+ > extends DeployableTargetWithRBAC<
82
+ Payload | undefined,
59
83
  typeof simpleDenyListAbi
60
84
  > {
61
85
  public override readonly abi = simpleDenyListAbi;
@@ -64,10 +88,11 @@ export class SimpleDenyList extends DeployableTarget<
64
88
  *
65
89
  * @public
66
90
  * @static
67
- * @type {Address}
91
+ * @type {Record<number, Address>}
68
92
  */
69
- public static override base: Address = import.meta.env
70
- .VITE_SIMPLE_DENYLIST_BASE;
93
+ public static override bases: Record<number, Address> = {
94
+ ...(SimpleDenyListBases as Record<number, Address>),
95
+ };
71
96
  /**
72
97
  * @inheritdoc
73
98
  *
@@ -77,13 +102,33 @@ export class SimpleDenyList extends DeployableTarget<
77
102
  */
78
103
  public static override registryType: RegistryType = RegistryType.ALLOW_LIST;
79
104
 
105
+ /**
106
+ * Retrieves the owner
107
+ *
108
+ * @public
109
+ * @async
110
+ * @param {?ReadParams} [params]
111
+ * @returns {Promise<Address>} - The address of the owner
112
+ */
113
+ public async owner(
114
+ params?: ReadParams<typeof simpleDenyListAbi, 'owner'>,
115
+ ): Promise<Address> {
116
+ return await readSimpleAllowListOwner(this._config, {
117
+ ...this.optionallyAttachAccount(),
118
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
119
+ ...(params as any),
120
+ address: this.assertValidAddress(),
121
+ args: [],
122
+ });
123
+ }
124
+
80
125
  /**
81
126
  * Check if a user is authorized (i.e. not denied)
82
127
  *
83
128
  * @public
84
129
  * @async
85
130
  * @param {Address} address - The address of the user
86
- * @param {?ReadParams<typeof simpleDenyListAbi, 'isAllowed'>} [params]
131
+ * @param {?ReadParams} [params]
87
132
  * @returns {Promise<boolean>} - True if the user is authorized
88
133
  */
89
134
  public async isAllowed(
@@ -106,15 +151,17 @@ export class SimpleDenyList extends DeployableTarget<
106
151
  * @async
107
152
  * @param {Address[]} addresses - The list of users to update
108
153
  * @param {boolean[]} allowed - The denied status of each user
109
- * @param {?WriteParams<typeof simpleDenyListAbi, 'setDenied'>} [params]
110
- * @returns {unknown}
154
+ * @param {?WriteParams} [params]
155
+ * @returns {Promise<void>}
111
156
  */
112
157
  public async setDenied(
113
158
  addresses: Address[],
114
159
  allowed: boolean[],
115
160
  params?: WriteParams<typeof simpleDenyListAbi, 'setDenied'>,
116
161
  ) {
117
- return this.awaitResult(this.setDeniedRaw(addresses, allowed, params));
162
+ return await this.awaitResult(
163
+ this.setDeniedRaw(addresses, allowed, params),
164
+ );
118
165
  }
119
166
 
120
167
  /**
@@ -124,8 +171,8 @@ export class SimpleDenyList extends DeployableTarget<
124
171
  * @async
125
172
  * @param {Address[]} addresses - The list of users to update
126
173
  * @param {boolean[]} allowed - The denied status of each user
127
- * @param {?WriteParams<typeof simpleDenyListAbi, 'setDenied'>} [params]
128
- * @returns {unknown}
174
+ * @param {?WriteParams} [params]
175
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
129
176
  */
130
177
  public async setDeniedRaw(
131
178
  addresses: Address[],
@@ -146,111 +193,6 @@ export class SimpleDenyList extends DeployableTarget<
146
193
  return { hash, result };
147
194
  }
148
195
 
149
- // /**
150
- // * A typed wrapper for (viem.getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs].
151
- // * Accepts `eventName` and `eventNames` as optional parameters to narrow the returned log types.
152
- // * @example
153
- // * ```ts
154
- // * const logs = contract.getLogs({ eventName: 'EventName' })
155
- // * const logs = contract.getLogs({ eventNames: ['EventName'] })
156
- // * ```
157
- // * @public
158
- // * @async
159
- // * @template {ContractEventName<typeof simpleDenyListAbi>} event
160
- // * @template {ExtractAbiEvent<
161
- // * typeof simpleDenyListAbi,
162
- // * event
163
- // * >} [abiEvent=ExtractAbiEvent<typeof simpleDenyListAbi, event>]
164
- // * @param {?Omit<
165
- // * GetLogsParams<typeof simpleDenyListAbi, event, abiEvent, abiEvent[]>,
166
- // * 'event' | 'events'
167
- // * > & {
168
- // * eventName?: event;
169
- // * eventNames?: event[];
170
- // * }} [params]
171
- // * @returns {Promise<GetLogsReturnType<abiEvent, abiEvent[]>>}
172
- // */
173
- // public async getLogs<
174
- // event extends ContractEventName<typeof simpleDenyListAbi>,
175
- // const abiEvent extends ExtractAbiEvent<
176
- // typeof simpleDenyListAbi,
177
- // event
178
- // > = ExtractAbiEvent<typeof simpleDenyListAbi, event>,
179
- // >(
180
- // params?: Omit<
181
- // GetLogsParams<typeof simpleDenyListAbi, event, abiEvent, abiEvent[]>,
182
- // 'event' | 'events'
183
- // > & {
184
- // eventName?: event;
185
- // eventNames?: event[];
186
- // },
187
- // ): Promise<GetLogsReturnType<abiEvent, abiEvent[]>> {
188
- // return getLogs(this._config.getClient({ chainId: params?.chainId }), {
189
- // // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wag
190
- // ...(params as any),
191
- // ...(params?.eventName
192
- // ? {
193
- // event: getAbiItem({
194
- // abi: simpleDenyListAbi,
195
- // name: params.eventName,
196
- // // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue
197
- // } as any),
198
- // }
199
- // : {}),
200
- // ...(params?.eventNames
201
- // ? {
202
- // events: params.eventNames.map((name) =>
203
- // getAbiItem({
204
- // abi: simpleDenyListAbi,
205
- // name,
206
- // // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue
207
- // } as any),
208
- // ),
209
- // }
210
- // : {}),
211
- // address: this.assertValidAddress(),
212
- // });
213
- // }
214
-
215
- // /**
216
- // * A typed wrapper for `wagmi.watchContractEvent`
217
- // *
218
- // * @public
219
- // * @async
220
- // * @template {ContractEventName<typeof simpleDenyListAbi>} event
221
- // * @param {(log: SimpleDenyListLog<event>) => unknown} cb
222
- // * @param {?WatchParams<typeof simpleDenyListAbi, event> & {
223
- // * eventName?: event;
224
- // * }} [params]
225
- // * @returns {unknown, params?: any) => unknown} Unsubscribe function
226
- // */
227
- // public async subscribe<
228
- // event extends ContractEventName<typeof simpleDenyListAbi>,
229
- // >(
230
- // cb: (log: SimpleDenyListLog<event>) => unknown,
231
- // params?: WatchParams<typeof simpleDenyListAbi, event> & {
232
- // eventName?: event;
233
- // },
234
- // ) {
235
- // return watchContractEvent<
236
- // typeof this._config,
237
- // (typeof this._config)['chains'][number]['id'],
238
- // typeof simpleDenyListAbi,
239
- // event
240
- // >(this._config, {
241
- // // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
242
- // ...(params as any),
243
- // eventName: params?.eventName,
244
- // abi: simpleDenyListAbi,
245
- // address: this.assertValidAddress(),
246
- // onLogs: (logs) => {
247
- // for (let l of logs) {
248
- // cb(l as unknown as SimpleDenyListLog<event>);
249
- // }
250
- // },
251
- // });
252
- // }
253
-
254
196
  /**
255
197
  * @inheritdoc
256
198
  *
@@ -260,13 +202,11 @@ export class SimpleDenyList extends DeployableTarget<
260
202
  * @returns {GenericDeployableParams}
261
203
  */
262
204
  public override buildParameters(
263
- _payload?: SimpleDenyListPayload,
205
+ _payload?: Payload,
264
206
  _options?: DeployableOptions,
265
207
  ): GenericDeployableParams {
266
- const [payload, options] = this.validateDeploymentConfig(
267
- _payload,
268
- _options,
269
- );
208
+ const [p, options] = this.validateDeploymentConfig(_payload, _options);
209
+ const payload = p as SimpleDenyListPayload;
270
210
  if (!payload.owner || payload.owner === zeroAddress) {
271
211
  const owner = options.account
272
212
  ? options.account.address
@@ -287,3 +227,24 @@ export class SimpleDenyList extends DeployableTarget<
287
227
  };
288
228
  }
289
229
  }
230
+
231
+ /**
232
+ * Given a {@link SimpleDenyListPayload}, properly encode the initialization payload.
233
+ *
234
+ * @param {SimpleDenyListPayload} param0
235
+ * @param {Address} param0.owner - The allow list's owner
236
+ * @param {Address[]} param0.denied - List of denied addresses.
237
+ * @returns {Hex}
238
+ */
239
+ export function prepareSimpleDenyListPayload({
240
+ owner,
241
+ denied,
242
+ }: SimpleDenyListPayload) {
243
+ return encodeAbiParameters(
244
+ [
245
+ { type: 'address', name: 'owner' },
246
+ { type: 'address[]', name: 'denied' },
247
+ ],
248
+ [owner, denied],
249
+ );
250
+ }
@@ -1,6 +1,6 @@
1
1
  import { zeroAddress } from 'viem';
2
2
  import { describe, expect, test } from 'vitest';
3
- import { defaultOptions } from '../../test/helpers';
3
+ import { defaultOptions } from '@boostxyz/test/helpers';
4
4
  import { PassthroughAuth } from './PassthroughAuth';
5
5
 
6
6
  describe('PassthroughAuth', () => {
@@ -48,7 +48,7 @@ export class PassthroughAuth extends Deployable<
48
48
  address: Address,
49
49
  params?: ReadParams<typeof passthroughAuthAbi, 'isAuthorized'>,
50
50
  ) {
51
- return readPassthroughAuthIsAuthorized(this._config, {
51
+ return await readPassthroughAuthIsAuthorized(this._config, {
52
52
  address: this.assertValidAddress(),
53
53
  args: [address],
54
54
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
package/src/Boost.ts CHANGED
@@ -1,16 +1,41 @@
1
- import { type Address, zeroAddress } from 'viem';
1
+ import { LibZip } from 'solady';
2
+ import {
3
+ type Address,
4
+ type Hex,
5
+ encodeAbiParameters,
6
+ parseAbiParameters,
7
+ zeroAddress,
8
+ } from 'viem';
2
9
  import type { Action } from './Actions/Action';
3
10
  import type { AllowList } from './AllowLists/AllowList';
4
11
  import type { Budget } from './Budgets/Budget';
5
12
  import type { Incentive } from './Incentives/Incentive';
6
13
  import type { Validator } from './Validators/Validator';
7
14
 
15
+ /**
16
+ * Interface representing a `BoostLib.Boost` on-chain struct
17
+ *
18
+ * @export
19
+ * @interface RawBoost
20
+ * @typedef {RawBoost}
21
+ */
22
+ export interface RawBoost {
23
+ action: Address;
24
+ validator: Address;
25
+ allowList: Address;
26
+ budget: Address;
27
+ incentives: readonly Address[];
28
+ protocolFee: bigint;
29
+ maxParticipants: bigint;
30
+ owner: Address;
31
+ }
32
+
8
33
  /**
9
34
  * Configuration used to instantiate a `Boost` instance.
10
35
  *
11
36
  * @export
12
- * @interface BoostPayload
13
- * @typedef {BoostPayload}
37
+ * @interface BoostConfig
38
+ * @typedef {BoostConfig}
14
39
  */
15
40
  export interface BoostConfig {
16
41
  /**
@@ -48,11 +73,6 @@ export interface BoostConfig {
48
73
  * @type {?bigint}
49
74
  */
50
75
  protocolFee?: bigint;
51
- /**
52
- *
53
- * @type {?bigint}
54
- */
55
- referralFee?: bigint;
56
76
  /**
57
77
  *
58
78
  * @type {?bigint}
@@ -115,12 +135,6 @@ export class Boost {
115
135
  * @type {bigint}
116
136
  */
117
137
  readonly protocolFee: bigint;
118
- /**
119
- *
120
- * @readonly
121
- * @type {bigint}
122
- */
123
- readonly referralFee: bigint;
124
138
  /**
125
139
  *
126
140
  * @readonly
@@ -148,8 +162,126 @@ export class Boost {
148
162
  this.allowList = config.allowList;
149
163
  this.incentives = config.incentives;
150
164
  this.protocolFee = config.protocolFee || 0n;
151
- this.referralFee = config.referralFee || 0n;
152
165
  this.maxParticipants = config.maxParticipants || 0n;
153
166
  this.owner = config.owner || zeroAddress;
154
167
  }
155
168
  }
169
+
170
+ /**
171
+ * Object representation of `BoostLib.Target` struct. Used for low level Boost creation operations.
172
+ * This is used to pass the base contract and its initialization parameters in an efficient manner
173
+ *
174
+ * @export
175
+ * @typedef {Target}
176
+ */
177
+ export type Target = {
178
+ isBase: boolean;
179
+ instance: Address;
180
+ parameters: Hex;
181
+ };
182
+
183
+ /**
184
+ * Object representation of `BoostCore.InitPayload` struct.
185
+ *
186
+ * @export
187
+ * @interface BoostPayload
188
+ * @typedef {BoostPayload}
189
+ */
190
+ export interface BoostPayload {
191
+ /**
192
+ * Address to valid budget.
193
+ *
194
+ * @type {Address}
195
+ */
196
+ budget: Address;
197
+ /**
198
+ * Target for existing action, or base with initialization payload.
199
+ *
200
+ * @type {Target}
201
+ */
202
+ action: Target;
203
+ /**
204
+ * Target for existing validator, or base with initialization payload.
205
+ *
206
+ * @type {Target}
207
+ */
208
+ validator: Target;
209
+ /**
210
+ * Target for existing allowList, or base with initialization payload.
211
+ *
212
+ * @type {Target}
213
+ */
214
+ allowList: Target;
215
+ /**
216
+ * Targets for new incentives, with initialization payloads.
217
+ *
218
+ * @type {Target[]}
219
+ */
220
+ incentives: Target[];
221
+ /**
222
+ * The base protocol fee (in bps)
223
+ *
224
+ * @type {?bigint}
225
+ */
226
+ protocolFee?: bigint;
227
+ /**
228
+ * Optional maximum amount of participants in the Boost.
229
+ *
230
+ * @type {?bigint}
231
+ */
232
+ maxParticipants?: bigint;
233
+ /**
234
+ * The owner of the Boost.
235
+ *
236
+ * @type {Address}
237
+ */
238
+ owner: Address;
239
+ }
240
+
241
+ /**
242
+ * Given a valid {@link BoostPayload}, properly encode and compress the payload for use with `createBoost`
243
+ *
244
+ * @export
245
+ * @param {BoostPayload} param0
246
+ * @param {Address} param0.budget - Address to valid budget.
247
+ * @param {Target} param0.action - Target for existing action, or base with initialization payload.
248
+ * @param {Target} param0.validator - Target for existing validator, or base with initialization payload.
249
+ * @param {Target} param0.allowList - Target for existing allowList, or base with initialization payload.
250
+ * @param {Target[]} param0.incentives - Targets for new incentives, with initialization payloads.
251
+ * @param {bigint} [param0.protocolFee=0n] - The base protocol fee (in bps)
252
+ * @param {bigint} [param0.maxParticipants=0n] - Optional maximum amount of participants in the Boost.
253
+ * @param {Address} param0.owner - The owner of the Boost.
254
+ * @returns {Hex}
255
+ */
256
+ export function prepareBoostPayload({
257
+ budget,
258
+ action,
259
+ validator,
260
+ allowList,
261
+ incentives,
262
+ protocolFee = 0n,
263
+ maxParticipants = 0n,
264
+ owner,
265
+ }: BoostPayload): Hex {
266
+ return LibZip.cdCompress(
267
+ encodeAbiParameters(
268
+ parseAbiParameters([
269
+ 'BoostPayload payload',
270
+ 'struct BoostPayload { address budget; Target action; Target validator; Target allowList; Target[] incentives; uint64 protocolFee; uint256 maxParticipants; address owner; }',
271
+ 'struct Target { bool isBase; address instance; bytes parameters; }',
272
+ ]),
273
+ [
274
+ {
275
+ budget,
276
+ action,
277
+ validator,
278
+ allowList,
279
+ incentives,
280
+ protocolFee,
281
+ maxParticipants,
282
+ owner,
283
+ },
284
+ ],
285
+ ),
286
+ ) as Hex;
287
+ }