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

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 (254) 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 +2 -2
  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 +174 -41
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +557 -129
  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 +60 -75
  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-Btl5BdAs.cjs +3 -0
  43. package/dist/BoostCore-Btl5BdAs.cjs.map +1 -0
  44. package/dist/BoostCore-CD56zbYX.js +2641 -0
  45. package/dist/BoostCore-CD56zbYX.js.map +1 -0
  46. package/dist/BoostCore.cjs +1 -2
  47. package/dist/BoostCore.cjs.map +1 -1
  48. package/dist/BoostCore.d.ts +749 -78
  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 +164 -82
  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 +103 -221
  66. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  67. package/dist/Budgets/ManagedBudget.js +81 -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 +248 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.js +320 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  94. package/dist/Incentive-CcnOIc8L.cjs +2 -0
  95. package/dist/Incentive-CcnOIc8L.cjs.map +1 -0
  96. package/dist/Incentive-rM5nKznp.js +313 -0
  97. package/dist/Incentive-rM5nKznp.js.map +1 -0
  98. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  99. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  100. package/dist/Incentives/AllowListIncentive.d.ts +38 -16
  101. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  102. package/dist/Incentives/AllowListIncentive.js +43 -29
  103. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  104. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  105. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  106. package/dist/Incentives/CGDAIncentive.d.ts +234 -21
  107. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  108. package/dist/Incentives/CGDAIncentive.js +46 -32
  109. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  110. package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
  111. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  112. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  113. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  114. package/dist/Incentives/ERC20Incentive.d.ts +234 -30
  115. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  116. package/dist/Incentives/ERC20Incentive.js +62 -46
  117. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  118. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +333 -438
  119. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  120. package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
  121. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  122. package/dist/Incentives/Incentive.cjs +1 -1
  123. package/dist/Incentives/Incentive.cjs.map +1 -1
  124. package/dist/Incentives/Incentive.d.ts +4 -4
  125. package/dist/Incentives/Incentive.d.ts.map +1 -1
  126. package/dist/Incentives/Incentive.js +16 -296
  127. package/dist/Incentives/Incentive.js.map +1 -1
  128. package/dist/Incentives/PointsIncentive.cjs +1 -1
  129. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  130. package/dist/Incentives/PointsIncentive.d.ts +40 -18
  131. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  132. package/dist/Incentives/PointsIncentive.js +38 -24
  133. package/dist/Incentives/PointsIncentive.js.map +1 -1
  134. package/dist/SimpleDenyList-BDXpY74P.js +133 -0
  135. package/dist/SimpleDenyList-BDXpY74P.js.map +1 -0
  136. package/dist/SimpleDenyList-DNj5qDWM.cjs +2 -0
  137. package/dist/SimpleDenyList-DNj5qDWM.cjs.map +1 -0
  138. package/dist/Validators/SignerValidator.cjs +1 -1
  139. package/dist/Validators/SignerValidator.cjs.map +1 -1
  140. package/dist/Validators/SignerValidator.d.ts +16 -16
  141. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  142. package/dist/Validators/SignerValidator.js +32 -28
  143. package/dist/Validators/SignerValidator.js.map +1 -1
  144. package/dist/Validators/Validator.cjs +1 -1
  145. package/dist/Validators/Validator.cjs.map +1 -1
  146. package/dist/Validators/Validator.d.ts +1 -1
  147. package/dist/Validators/Validator.js +2 -2
  148. package/dist/Validators/Validator.js.map +1 -1
  149. package/dist/claiming.cjs.map +1 -1
  150. package/dist/claiming.d.ts +1 -1
  151. package/dist/claiming.js.map +1 -1
  152. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  153. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  154. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  155. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  156. package/dist/deployments-DF_6-7hH.cjs +2 -0
  157. package/dist/deployments-DF_6-7hH.cjs.map +1 -0
  158. package/dist/deployments-fJsWblwS.js +56 -0
  159. package/dist/deployments-fJsWblwS.js.map +1 -0
  160. package/dist/deployments.json +58 -0
  161. package/dist/errors.cjs +1 -1
  162. package/dist/errors.cjs.map +1 -1
  163. package/dist/errors.d.ts +256 -20
  164. package/dist/errors.d.ts.map +1 -1
  165. package/dist/errors.js +183 -26
  166. package/dist/errors.js.map +1 -1
  167. package/dist/{generated-57_Kffpz.js → generated-CsNyWPKA.js} +3843 -2084
  168. package/dist/generated-CsNyWPKA.js.map +1 -0
  169. package/dist/generated-DHerxf1y.cjs +3 -0
  170. package/dist/generated-DHerxf1y.cjs.map +1 -0
  171. package/dist/index.cjs +1 -1
  172. package/dist/index.d.ts +5 -0
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +142 -108
  175. package/dist/index.js.map +1 -1
  176. package/dist/transfers.cjs.map +1 -1
  177. package/dist/transfers.d.ts +1 -1
  178. package/dist/transfers.js.map +1 -1
  179. package/dist/utils.cjs +1 -1
  180. package/dist/utils.cjs.map +1 -1
  181. package/dist/utils.d.ts +26 -12
  182. package/dist/utils.d.ts.map +1 -1
  183. package/dist/utils.js +38 -23
  184. package/dist/utils.js.map +1 -1
  185. package/package.json +20 -10
  186. package/src/Actions/Action.test.ts +14 -13
  187. package/src/Actions/ContractAction.test.ts +10 -10
  188. package/src/Actions/ContractAction.ts +11 -12
  189. package/src/Actions/ERC721MintAction.test.ts +6 -6
  190. package/src/Actions/ERC721MintAction.ts +14 -15
  191. package/src/Actions/EventAction.test.ts +735 -109
  192. package/src/Actions/EventAction.ts +527 -88
  193. package/src/AllowLists/AllowList.test.ts +7 -7
  194. package/src/AllowLists/AllowList.ts +5 -3
  195. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  196. package/src/AllowLists/OpenAllowList.ts +45 -0
  197. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  198. package/src/AllowLists/SimpleAllowList.ts +40 -61
  199. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  200. package/src/AllowLists/SimpleDenyList.ts +41 -17
  201. package/src/Auth/PassthroughAuth.test.ts +1 -1
  202. package/src/Boost.ts +21 -24
  203. package/src/BoostCore.test.ts +361 -306
  204. package/src/BoostCore.ts +403 -220
  205. package/src/BoostRegistry.test.ts +53 -0
  206. package/src/BoostRegistry.ts +161 -40
  207. package/src/Budgets/Budget.test.ts +2 -2
  208. package/src/Budgets/Budget.ts +1 -2
  209. package/src/Budgets/ManagedBudget.test.ts +106 -19
  210. package/src/Budgets/ManagedBudget.ts +49 -321
  211. package/src/Budgets/VestingBudget.test.ts +7 -7
  212. package/src/Budgets/VestingBudget.ts +36 -106
  213. package/src/Deployable/Contract.ts +4 -5
  214. package/src/Deployable/Deployable.ts +1 -1
  215. package/src/Deployable/DeployableTarget.ts +30 -19
  216. package/src/Deployable/DeployableTargetWithRBAC.test.ts +103 -0
  217. package/src/Deployable/DeployableTargetWithRBAC.ts +447 -0
  218. package/src/Incentives/AllowListIncentive.test.ts +12 -12
  219. package/src/Incentives/AllowListIncentive.ts +30 -15
  220. package/src/Incentives/CGDAIncentive.test.ts +9 -6
  221. package/src/Incentives/CGDAIncentive.ts +39 -18
  222. package/src/Incentives/ERC1155Incentive.test.ts +3 -3
  223. package/src/Incentives/ERC1155Incentive.ts +30 -29
  224. package/src/Incentives/ERC20Incentive.test.ts +9 -6
  225. package/src/Incentives/ERC20Incentive.ts +54 -27
  226. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  227. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +325 -0
  228. package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
  229. package/src/Incentives/ERC20VariableIncentive.ts +50 -26
  230. package/src/Incentives/Incentive.test.ts +4 -1
  231. package/src/Incentives/Incentive.ts +7 -6
  232. package/src/Incentives/PointsIncentive.test.ts +24 -25
  233. package/src/Incentives/PointsIncentive.ts +32 -17
  234. package/src/Validators/SignerValidator.test.ts +6 -6
  235. package/src/Validators/SignerValidator.ts +20 -17
  236. package/src/Validators/Validator.test.ts +2 -2
  237. package/src/Validators/Validator.ts +1 -1
  238. package/src/claiming.ts +1 -1
  239. package/src/errors.ts +345 -21
  240. package/src/index.test.ts +118 -36
  241. package/src/index.ts +5 -0
  242. package/src/transfers.ts +1 -1
  243. package/src/utils.test.ts +2 -2
  244. package/src/utils.ts +61 -12
  245. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  246. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  247. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  248. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  249. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  250. package/dist/generated-57_Kffpz.js.map +0 -1
  251. package/dist/generated-wKBNvm48.cjs +0 -3
  252. package/dist/generated-wKBNvm48.cjs.map +0 -1
  253. package/src/Budgets/SimpleBudget.test.ts +0 -152
  254. package/src/Budgets/SimpleBudget.ts +0 -564
package/dist/utils.js CHANGED
@@ -1,30 +1,45 @@
1
- import { waitForTransactionReceipt as n } from "@wagmi/core";
2
- import { slice as s, isHex as I, keccak256 as c, toHex as d } from "viem";
3
- import { NoContractAddressUponReceiptError as e } from "./errors.js";
4
- function u(t) {
5
- return s(I(t) ? c(t) : c(d(t)), 0, 4);
1
+ import { waitForTransactionReceipt as f, getAccount as A, getClient as u } from "@wagmi/core";
2
+ import { slice as e, isHex as w, keccak256 as i, toHex as m } from "viem";
3
+ import { NoContractAddressUponReceiptError as I, InvalidProtocolChainIdError as s } from "./errors.js";
4
+ var N = /* @__PURE__ */ ((o) => (o[o.ACTION = 0] = "ACTION", o[o.ALLOW_LIST = 1] = "ALLOW_LIST", o[o.BUDGET = 2] = "BUDGET", o[o.INCENTIVE = 3] = "INCENTIVE", o[o.VALIDATOR = 4] = "VALIDATOR", o))(N || {});
5
+ function L(o) {
6
+ return e(w(o) ? i(o) : i(m(o)), 0, 4);
6
7
  }
7
- async function E(t, a, r) {
8
- const o = await n(t, {
9
- ...r,
10
- hash: await a
8
+ async function l(o, c, n) {
9
+ const t = await f(o, {
10
+ ...n,
11
+ hash: await c
11
12
  });
12
- if (!o.contractAddress)
13
- throw new e(o);
14
- return o.contractAddress;
13
+ if (!t.contractAddress)
14
+ throw new I(t);
15
+ return t.contractAddress;
15
16
  }
16
- async function N(t, a, r) {
17
- const { hash: o, result: A } = await a;
18
- return await n(t, {
19
- ...r,
20
- hash: o
21
- }), A;
17
+ async function v(o, c, n) {
18
+ const { hash: t, result: a } = await c;
19
+ return await f(o, {
20
+ ...n,
21
+ hash: t
22
+ }), a;
23
+ }
24
+ function O(o, c, n) {
25
+ let t;
26
+ const a = A(o);
27
+ if (n !== void 0 ? c[n] && (t = n) : a.chainId !== void 0 && c[a.chainId] && (t = a.chainId), t === void 0) {
28
+ const r = u(o);
29
+ r != null && r.chain.id && c[r == null ? void 0 : r.chain.id] && (t = r.chain.id);
30
+ }
31
+ if (t === void 0 && (t = 11155111), !c[t])
32
+ throw new s(
33
+ t,
34
+ Object.keys(c).map(Number)
35
+ );
36
+ return { chainId: t, address: c[t] };
22
37
  }
23
- var i = /* @__PURE__ */ ((t) => (t[t.ACTION = 0] = "ACTION", t[t.ALLOW_LIST = 1] = "ALLOW_LIST", t[t.BUDGET = 2] = "BUDGET", t[t.INCENTIVE = 3] = "INCENTIVE", t[t.VALIDATOR = 4] = "VALIDATOR", t))(i || {});
24
38
  export {
25
- i as RegistryType,
26
- N as awaitResult,
27
- u as bytes4,
28
- E as getDeployedContractAddress
39
+ N as RegistryType,
40
+ O as assertValidAddressByChainId,
41
+ v as awaitResult,
42
+ L as bytes4,
43
+ l as getDeployedContractAddress
29
44
  };
30
45
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport { NoContractAddressUponReceiptError } from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {unknown}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n"],"names":["bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","RegistryType"],"mappings":";;;AA2HO,SAASA,EAAOC,GAAe;AACpC,SAAOC,EAAMC,EAAMF,CAAK,IAAIG,EAAUH,CAAK,IAAIG,EAAUC,EAAMJ,CAAK,CAAC,GAAG,GAAG,CAAC;AAC9E;AAasB,eAAAK,EACpBC,GACAC,GACAC,GACA;AACM,QAAAC,IAAU,MAAMC,EAA0BJ,GAAQ;AAAA,IACtD,GAAGE;AAAA,IACH,MAAM,MAAMD;AAAA,EAAA,CACb;AACD,MAAI,CAACE,EAAQ;AACL,UAAA,IAAIE,EAAkCF,CAAO;AACrD,SAAOA,EAAQ;AACjB;AAsBsB,eAAAG,EACpBN,GACAO,GACAL,GACiB;AACjB,QAAM,EAAE,MAAAD,GAAM,QAAAO,EAAO,IAAI,MAAMD;AAC/B,eAAMH,EAA0BJ,GAAQ;AAAA,IACtC,GAAGE;AAAA,IACH,MAAAD;AAAA,EAAA,CACD,GACMO;AACT;AAQY,IAAAC,sBAAAA,OACVA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,aAAa,CAAb,IAAA,cACAA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aALUA,IAAAA,KAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import {\n type Config,\n type ReadContractParameters,\n type WatchContractEventParameters,\n type WriteContractParameters,\n getAccount,\n getClient,\n waitForTransactionReceipt,\n} from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport type {\n Abi,\n AbiEvent,\n Address,\n ContractEventName,\n ContractFunctionName,\n GetLogsParameters,\n Hash,\n Hex,\n Log,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport { isHex, keccak256, slice, toHex } from 'viem';\nimport {\n InvalidProtocolChainIdError,\n NoConnectedChainIdError,\n NoContractAddressUponReceiptError,\n} from './errors';\n\nexport type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;\n\n/**\n * Enum encapsulating all the different types of targets used in the Boost V2 Protocol.\n *\n * @export\n * @enum {number}\n */\nexport enum RegistryType {\n ACTION = 0,\n ALLOW_LIST = 1,\n BUDGET = 2,\n INCENTIVE = 3,\n VALIDATOR = 4,\n}\n\n/**\n * Helper type that encapsulates common writeContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (writeContract)[https://viem.sh/docs/contract/writeContract]\n *\n * @export\n * @typedef {WriteParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type WriteParams<\n abi extends Abi = Abi,\n functionName extends ContractFunctionName<abi> = ContractFunctionName<abi>,\n> = Partial<\n Omit<\n WriteContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common readContract parameters without fields like `abi`, `args`, `functionName`, `address` that are expected to be provided the SDK.\n * See (readContract)[https://viem.sh/docs/contract/readContract]\n *\n * @export\n * @typedef {ReadParams}\n * @template {Abi} abi\n * @template {ContractFunctionName<abi>} functionName\n */\nexport type ReadParams<\n abi extends Abi,\n functionName extends ContractFunctionName<abi>,\n> = Partial<\n Omit<\n ReadContractParameters<abi, functionName>,\n 'address' | 'args' | 'functionName' | 'abi'\n >\n>;\n\n/**\n * Helper type that encapsulates common `watchContractEvent` parameters without fields like `address`, and `abi` that are expected to be provided the SDK.\n * See (watchContractEvent)[https://wagmi.sh/core/api/actions/watchContractEvent]\n *\n * @export\n * @typedef {WatchParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi> | undefined} [eventName=undefined]\n */\nexport type WatchParams<\n abi extends Abi,\n eventName extends ContractEventName<abi> | undefined = undefined,\n> = Partial<\n Omit<WatchContractEventParameters<abi, eventName>, 'address' | 'abi'>\n>;\n\n/**\n * Helper type that encapsulates common `getLogs` parameters without fields like `address` that are expected to be provided the SDK.\n * See (getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs]\n *\n * @export\n * @typedef {GetLogsParams}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} event\n * @template {ExtractAbiEvent<abi, event>} [abiEvent=ExtractAbiEvent<abi, event>]\n * @template {| readonly AbiEvent[]\n * | readonly unknown[]\n * | undefined} [abiEvents=abiEvent extends AbiEvent ? [abiEvent] : undefined]\n */\nexport type GetLogsParams<\n abi extends Abi,\n event extends ContractEventName<abi>,\n abiEvent extends ExtractAbiEvent<abi, event> = ExtractAbiEvent<abi, event>,\n abiEvents extends\n | readonly AbiEvent[]\n | readonly unknown[]\n | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined,\n> = Partial<Omit<GetLogsParameters<abiEvent, abiEvents>, 'address'>> & {\n chainId?: number | undefined;\n};\n\n/**\n * A generic `viem.Log` event with typed `args` support via a given `Abi` and `ContractEventName`\n *\n * @export\n * @typedef {GenericLog}\n * @template {Abi} abi\n * @template {ContractEventName<abi>} [event=ContractEventName<abi>]\n */\nexport type GenericLog<\n abi extends Abi,\n event extends ContractEventName<abi> = ContractEventName<abi>,\n> = Log<bigint, number, false, ExtractAbiEvent<abi, event>, false>;\n\n/**\n * Helper utility to convert a string to a `bytes4` type\n *\n * @export\n * @param {string} input\n * @returns {Hex}\n */\nexport function bytes4(input: string) {\n return slice(isHex(input) ? keccak256(input) : keccak256(toHex(input)), 0, 4);\n}\n\n/**\n * Utility function to wait for a transaction receipt, and extract the contractAddress\n *\n * @export\n * @async\n * @param {WagmiConfig} config - [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @param {Promise<Hash>} hash - A transaction hash promise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - @see {@link WaitForTransactionReceiptParameters}\n * @returns {Promise<Address>}\n * @throws {@link NoContractAddressUponReceiptError} if no `contractAddress` exists after the transaction has been received\n */\nexport async function getDeployedContractAddress(\n config: Config,\n hash: Promise<Hash>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n) {\n const receipt = await waitForTransactionReceipt(config, {\n ...waitParams,\n hash: await hash,\n });\n if (!receipt.contractAddress)\n throw new NoContractAddressUponReceiptError(receipt);\n return receipt.contractAddress;\n}\n\n/**\n * Utility type to encapsulate a transaction hash, and the simulated result prior to submitting the transaction.\n *\n * @export\n * @typedef {HashAndSimulatedResult}\n * @template [T=unknown]\n */\nexport type HashAndSimulatedResult<T = unknown> = { hash: Hash; result: T };\n\n/**\n * Helper function to wait for a transaction receipt given a hash promise.\n *\n * @export\n * @async\n * @template [Result=unknown]\n * @param {WagmiConfig} config\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\nexport async function awaitResult<Result = unknown>(\n config: Config,\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n): Promise<Result> {\n const { hash, result } = await hashPromise;\n await waitForTransactionReceipt(config, {\n ...waitParams,\n hash,\n });\n return result;\n}\n\n/**\n * Given a wagmi config and a map of chain id's to addresses, determine an address/chainId combo that maps to the currently connected chain id, or throw a typed error.\n *\n * @export\n * @param {Config} config\n * @param {Record<string, Address>} addressByChainId\n * @param {number} desiredChainId\n * @returns {{ chainId: number, address: Address }}\n * @throws {@link InvalidProtocolChainIdError}\n */\nexport function assertValidAddressByChainId(\n config: Config,\n addressByChainId: Record<number, Address>,\n desiredChainId?: number,\n): { chainId: number; address: Address } {\n let chainId: number | undefined = undefined;\n const wagmiAccount = getAccount(config);\n // if manually providing a chain id for some contract operation, try to use it\n if (desiredChainId !== undefined) {\n if (addressByChainId[desiredChainId]) chainId = desiredChainId;\n } else if (wagmiAccount.chainId !== undefined) {\n // otherwise if we can get the current chain id off the connected account and it matches one of ours, use it\n if (addressByChainId[wagmiAccount.chainId]) chainId = wagmiAccount.chainId;\n }\n // chainId is still undefined, try to get chain id off viem client\n if (chainId === undefined) {\n const client = getClient(config);\n if (client?.chain.id && addressByChainId[client?.chain.id])\n chainId = client.chain.id;\n }\n // if chainId is STILL undefined, use our default addresses\n // TODO: update this when on prod network\n if (chainId === undefined) chainId = Number(__DEFAULT_CHAIN_ID__);\n if (!addressByChainId[chainId])\n throw new InvalidProtocolChainIdError(\n chainId,\n Object.keys(addressByChainId).map(Number),\n );\n // biome-ignore lint/style/noNonNullAssertion: this type should be narrowed by the above statement but isn't?\n return { chainId, address: addressByChainId[chainId]! };\n}\n"],"names":["RegistryType","bytes4","input","slice","isHex","keccak256","toHex","getDeployedContractAddress","config","hash","waitParams","receipt","waitForTransactionReceipt","NoContractAddressUponReceiptError","awaitResult","hashPromise","result","assertValidAddressByChainId","addressByChainId","desiredChainId","chainId","wagmiAccount","getAccount","client","getClient","InvalidProtocolChainIdError"],"mappings":";;;AAqCY,IAAAA,sBAAAA,OACVA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,aAAa,CAAb,IAAA,cACAA,EAAAA,EAAA,SAAS,CAAT,IAAA,UACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aACAA,EAAAA,EAAA,YAAY,CAAZ,IAAA,aALUA,IAAAA,KAAA,CAAA,CAAA;AA2GL,SAASC,EAAOC,GAAe;AACpC,SAAOC,EAAMC,EAAMF,CAAK,IAAIG,EAAUH,CAAK,IAAIG,EAAUC,EAAMJ,CAAK,CAAC,GAAG,GAAG,CAAC;AAC9E;AAasB,eAAAK,EACpBC,GACAC,GACAC,GACA;AACM,QAAAC,IAAU,MAAMC,EAA0BJ,GAAQ;AAAA,IACtD,GAAGE;AAAA,IACH,MAAM,MAAMD;AAAA,EAAA,CACb;AACD,MAAI,CAACE,EAAQ;AACL,UAAA,IAAIE,EAAkCF,CAAO;AACrD,SAAOA,EAAQ;AACjB;AAsBsB,eAAAG,EACpBN,GACAO,GACAL,GACiB;AACjB,QAAM,EAAE,MAAAD,GAAM,QAAAO,EAAO,IAAI,MAAMD;AAC/B,eAAMH,EAA0BJ,GAAQ;AAAA,IACtC,GAAGE;AAAA,IACH,MAAAD;AAAA,EAAA,CACD,GACMO;AACT;AAYgB,SAAAC,EACdT,GACAU,GACAC,GACuC;AACvC,MAAIC;AACE,QAAAC,IAAeC,EAAWd,CAAM;AAStC,MAPIW,MAAmB,SACjBD,EAAiBC,CAAc,MAAaC,IAAAD,KACvCE,EAAa,YAAY,UAE9BH,EAAiBG,EAAa,OAAO,UAAaA,EAAa,UAGjED,MAAY,QAAW;AACnB,UAAAG,IAASC,EAAUhB,CAAM;AAC/B,IAAIe,KAAA,QAAAA,EAAQ,MAAM,MAAML,EAAiBK,KAAA,gBAAAA,EAAQ,MAAM,EAAE,MACvDH,IAAUG,EAAO,MAAM;AAAA,EAC3B;AAII,MADAH,MAAY,WAAqBA,IAAO,WACxC,CAACF,EAAiBE,CAAO;AAC3B,UAAM,IAAIK;AAAA,MACRL;AAAA,MACA,OAAO,KAAKF,CAAgB,EAAE,IAAI,MAAM;AAAA,IAAA;AAG5C,SAAO,EAAE,SAAAE,GAAS,SAASF,EAAiBE,CAAO,EAAG;AACxD;"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@boostxyz/sdk",
3
- "version": "0.0.0-alpha.9",
3
+ "version": "1.1.0-alpha.23",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
8
8
  "src"
9
9
  ],
10
- "repository": "https://github.com/rabbitholegg/boost-protocol",
10
+ "repository": "https://github.com/boostxyz/boost-protocol",
11
11
  "author": "Boost Team<boost-team@boost.xyz>",
12
12
  "access": "public",
13
13
  "private": false,
@@ -54,6 +54,7 @@
54
54
  "node": "./dist/transfers.js",
55
55
  "types": "./dist/transfers.d.ts"
56
56
  },
57
+ "./deployments.json": "./dist/deployments.json",
57
58
  "./Boost": {
58
59
  "require": "./dist/Boost.cjs",
59
60
  "import": "./dist/Boost.js",
@@ -96,6 +97,12 @@
96
97
  "node": "./dist/Deployable/DeployableTarget.js",
97
98
  "types": "./dist/Deployable/DeployableTarget.d.ts"
98
99
  },
100
+ "./Deployable/DeployableTargetWithRBAC": {
101
+ "require": "./dist/Deployable/DeployableTargetWithRBAC.cjs",
102
+ "import": "./dist/Deployable/DeployableTargetWithRBAC.js",
103
+ "node": "./dist/Deployable/DeployableTargetWithRBAC.js",
104
+ "types": "./dist/Deployable/DeployableTargetWithRBAC.d.ts"
105
+ },
99
106
  "./Deployable/Contract": {
100
107
  "require": "./dist/Deployable/Contract.cjs",
101
108
  "import": "./dist/Deployable/Contract.js",
@@ -188,26 +195,29 @@
188
195
  }
189
196
  },
190
197
  "dependencies": {
191
- "@boostxyz/signatures": "0.0.0-alpha.1"
198
+ "ts-pattern": "5.4.0",
199
+ "@boostxyz/signatures": "1.1.0-alpha.23"
192
200
  },
193
201
  "optionalDependencies": {
194
- "@boostxyz/evm": "0.0.0-alpha.1"
202
+ "@boostxyz/signatures": "1.1.0-alpha.23",
203
+ "@boostxyz/evm": "1.1.0-alpha.23"
195
204
  },
196
205
  "peerDependencies": {
197
- "@wagmi/core": "2",
198
- "viem": "2",
199
- "abitype": "1"
206
+ "@wagmi/core": "2.x",
207
+ "abitype": "1",
208
+ "viem": "2.x"
200
209
  },
201
210
  "scripts": {
202
- "build": "vite build && tsc --build --emitDeclarationOnly --declaration --declarationMap --force",
211
+ "build": "mkdir -p dist && vite build && tsc -p ./tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap",
212
+ "typecheck": "tsc -p ./tsconfig.build.json --noEmit",
203
213
  "lint:ci": "npx biome ci",
204
214
  "lint": "npx biome check",
205
215
  "bench": "vitest bench",
206
216
  "bench:ci": "CI=true vitest bench",
207
217
  "clean": "rm -rf dist",
208
- "dev": "vite build --watch",
218
+ "dev": "mkdir -p dist && vite build --watch",
209
219
  "test": "vitest dev",
210
220
  "test:ci": "CI=true vitest --coverage",
211
- "typedoc": "npx typedoc --sort required-first --sort visibility --sort kind"
221
+ "typedoc": "npx typedoc --tsconfig ./tsconfig.build.json --sort required-first --sort visibility --sort kind"
212
222
  }
213
223
  }
@@ -2,14 +2,14 @@ import { selectors } from '@boostxyz/signatures/events';
2
2
  import { loadFixture } from '@nomicfoundation/hardhat-toolbox-viem/network-helpers';
3
3
  import type { Hex } from 'viem';
4
4
  import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
5
- import type { MockERC721 } from '../../test/MockERC721';
6
- import { accounts } from '../../test/accounts';
5
+ import type { MockERC721 } from '@boostxyz/test/MockERC721';
6
+ import { accounts } from '@boostxyz/test/accounts';
7
7
  import {
8
8
  type Fixtures,
9
9
  defaultOptions,
10
10
  deployFixtures,
11
11
  fundErc721,
12
- } from '../../test/helpers';
12
+ } from '@boostxyz/test/helpers';
13
13
  import { EventAction, actionFromAddress } from './Action';
14
14
  import {
15
15
  type EventActionPayloadSimple,
@@ -27,20 +27,24 @@ export function basicErc721TransferAction(
27
27
  actionClaimant: {
28
28
  chainid: 31337,
29
29
  signatureType: SignatureType.EVENT,
30
- signature: selectors['Transfer(address,address,uint256)'] as Hex,
31
- fieldIndex: 2,
30
+ signature: selectors[
31
+ 'Transfer(address indexed,address indexed,uint256 indexed)'
32
+ ] as Hex,
33
+ fieldIndex: 1,
32
34
  targetContract: erc721.assertValidAddress(),
33
35
  },
34
36
  actionSteps: [
35
37
  {
36
38
  chainid: 31337,
37
- signature: selectors['Transfer(address,address,uint256)'] as Hex,
39
+ signature: selectors[
40
+ 'Transfer(address indexed,address indexed,uint256 indexed)'
41
+ ] as Hex,
38
42
  signatureType: SignatureType.EVENT,
39
43
  targetContract: erc721.assertValidAddress(),
40
44
  actionParameter: {
41
45
  filterType: FilterType.EQUAL,
42
46
  fieldType: PrimitiveType.ADDRESS,
43
- fieldIndex: 2,
47
+ fieldIndex: 1,
44
48
  filterData: accounts[1].account,
45
49
  },
46
50
  },
@@ -50,18 +54,15 @@ export function basicErc721TransferAction(
50
54
 
51
55
  export function cloneEventAction(fixtures: Fixtures, erc721: MockERC721) {
52
56
  return function cloneEventAction() {
53
- return fixtures.registry.clone(
57
+ return fixtures.registry.initialize(
54
58
  crypto.randomUUID(),
55
- new fixtures.bases.EventAction(
56
- defaultOptions,
57
- basicErc721TransferAction(erc721),
58
- ),
59
+ fixtures.core.EventAction(basicErc721TransferAction(erc721)),
59
60
  );
60
61
  };
61
62
  }
62
63
 
63
64
  beforeAll(async () => {
64
- fixtures = await loadFixture(deployFixtures);
65
+ fixtures = await loadFixture(deployFixtures(defaultOptions));
65
66
  });
66
67
 
67
68
  describe('Action', () => {
@@ -10,20 +10,20 @@ import {
10
10
  zeroAddress,
11
11
  } from 'viem';
12
12
  import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
13
- import type { MockERC20 } from '../../test/MockERC20';
14
- import { accounts } from '../../test/accounts';
13
+ import type { MockERC20 } from '@boostxyz/test/MockERC20';
14
+ import { accounts } from '@boostxyz/test/accounts';
15
15
  import {
16
16
  type Fixtures,
17
17
  defaultOptions,
18
18
  deployFixtures,
19
19
  fundErc20,
20
- } from '../../test/helpers';
20
+ } from '@boostxyz/test/helpers';
21
21
  import { ContractAction } from './ContractAction';
22
22
 
23
23
  let fixtures: Fixtures, erc20: MockERC20;
24
24
 
25
25
  beforeAll(async () => {
26
- fixtures = await loadFixture(deployFixtures);
26
+ fixtures = await loadFixture(deployFixtures(defaultOptions));
27
27
  });
28
28
 
29
29
  const mintPayableSelector = toFunctionSelector(
@@ -36,9 +36,9 @@ const mintSelector = toFunctionSelector(
36
36
 
37
37
  function payableContractAction(fixtures: Fixtures, erc20: MockERC20) {
38
38
  return function payableContractAction() {
39
- return fixtures.registry.clone(
39
+ return fixtures.registry.initialize(
40
40
  crypto.randomUUID(),
41
- new fixtures.bases.ContractAction(defaultOptions, {
41
+ fixtures.core.ContractAction({
42
42
  chainId: BigInt(31_337),
43
43
  target: erc20.assertValidAddress(),
44
44
  selector: mintPayableSelector,
@@ -50,9 +50,9 @@ function payableContractAction(fixtures: Fixtures, erc20: MockERC20) {
50
50
 
51
51
  function nonPayableAction(fixtures: Fixtures, erc20: MockERC20) {
52
52
  return function nonPayableAction() {
53
- return fixtures.registry.clone(
53
+ return fixtures.registry.initialize(
54
54
  crypto.randomUUID(),
55
- new fixtures.bases.ContractAction(defaultOptions, {
55
+ fixtures.core.ContractAction({
56
56
  chainId: BigInt(31_337),
57
57
  target: erc20.assertValidAddress(),
58
58
  selector: mintSelector,
@@ -64,9 +64,9 @@ function nonPayableAction(fixtures: Fixtures, erc20: MockERC20) {
64
64
 
65
65
  function otherAction(fixtures: Fixtures, erc20: MockERC20) {
66
66
  return function nonPayableAction() {
67
- return fixtures.registry.clone(
67
+ return fixtures.registry.initialize(
68
68
  crypto.randomUUID(),
69
- new fixtures.bases.ContractAction(defaultOptions, {
69
+ fixtures.core.ContractAction({
70
70
  chainId: BigInt(31_337) + 1n,
71
71
  target: erc20.assertValidAddress(),
72
72
  selector: mintSelector,
@@ -99,10 +99,9 @@ export class ContractAction<
99
99
  *
100
100
  * @public
101
101
  * @static
102
- * @type {Address}
102
+ * @type {Record<number, Address>}
103
103
  */
104
- public static override base: Address = import.meta.env
105
- .VITE_CONTRACT_ACTION_BASE;
104
+ public static override bases: Record<number, Address> = {};
106
105
  /**
107
106
  * @inheritdoc
108
107
  *
@@ -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,
@@ -9,29 +9,29 @@ import {
9
9
  zeroAddress,
10
10
  } from 'viem';
11
11
  import { beforeAll, beforeEach, describe, expect, test } from 'vitest';
12
- import type { MockERC721 } from '../../test/MockERC721';
13
- import { accounts } from '../../test/accounts';
12
+ import type { MockERC721 } from '@boostxyz/test/MockERC721';
13
+ import { accounts } from '@boostxyz/test/accounts';
14
14
  import {
15
15
  type Fixtures,
16
16
  defaultOptions,
17
17
  deployFixtures,
18
18
  fundErc721,
19
- } from '../../test/helpers';
19
+ } from '@boostxyz/test/helpers';
20
20
  import { ERC721MintAction } from './ERC721MintAction';
21
21
 
22
22
  let fixtures: Fixtures, erc721: MockERC721;
23
23
 
24
24
  beforeAll(async () => {
25
- fixtures = await loadFixture(deployFixtures);
25
+ fixtures = await loadFixture(deployFixtures(defaultOptions));
26
26
  });
27
27
 
28
28
  const mintSelector = toFunctionSelector('function mint(address to)');
29
29
 
30
30
  function nonPayableAction(fixtures: Fixtures, erc721: MockERC721) {
31
31
  return function nonPayableAction() {
32
- return fixtures.registry.clone(
32
+ return fixtures.registry.initialize(
33
33
  crypto.randomUUID(),
34
- new fixtures.bases.ERC721MintAction(defaultOptions, {
34
+ fixtures.core.ERC721MintAction({
35
35
  chainId: BigInt(31_337),
36
36
  target: erc721.assertValidAddress(),
37
37
  selector: mintSelector,
@@ -77,10 +77,9 @@ export class ERC721MintAction extends ContractAction<
77
77
  *
78
78
  * @public
79
79
  * @static
80
- * @type {Address}
80
+ * @type {Record<number, Address>}
81
81
  */
82
- public static override base: Address = import.meta.env
83
- .VITE_ERC721_MINT_ACTION_BASE;
82
+ public static override bases: Record<number, Address> = {};
84
83
  /**
85
84
  * @inheritdoc
86
85
  *
@@ -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,