@boostxyz/sdk 0.0.0-alpha.2 → 0.0.0-alpha.21

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 (271) hide show
  1. package/dist/Actions/Action.cjs +2 -1
  2. package/dist/Actions/Action.cjs.map +1 -0
  3. package/dist/Actions/Action.d.ts +1 -1
  4. package/dist/Actions/Action.d.ts.map +1 -1
  5. package/dist/Actions/Action.js +14 -12
  6. package/dist/Actions/Action.js.map +1 -0
  7. package/dist/Actions/ContractAction.d.ts +57 -14
  8. package/dist/Actions/ContractAction.d.ts.map +1 -1
  9. package/dist/Actions/ERC721MintAction.d.ts +50 -23
  10. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  11. package/dist/Actions/EventAction.cjs +2 -1
  12. package/dist/Actions/EventAction.cjs.map +1 -0
  13. package/dist/Actions/EventAction.d.ts +405 -36
  14. package/dist/Actions/EventAction.d.ts.map +1 -1
  15. package/dist/Actions/EventAction.js +15 -209
  16. package/dist/Actions/EventAction.js.map +1 -0
  17. package/dist/AllowLists/AllowList.cjs +2 -1
  18. package/dist/AllowLists/AllowList.cjs.map +1 -0
  19. package/dist/AllowLists/AllowList.d.ts +6 -5
  20. package/dist/AllowLists/AllowList.d.ts.map +1 -1
  21. package/dist/AllowLists/AllowList.js +46 -22
  22. package/dist/AllowLists/AllowList.js.map +1 -0
  23. package/dist/AllowLists/OpenAllowList.d.ts +423 -0
  24. package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
  25. package/dist/AllowLists/SimpleAllowList.cjs +2 -1
  26. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
  27. package/dist/AllowLists/SimpleAllowList.d.ts +124 -40
  28. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  29. package/dist/AllowLists/SimpleAllowList.js +76 -76
  30. package/dist/AllowLists/SimpleAllowList.js.map +1 -0
  31. package/dist/AllowLists/SimpleDenyList.cjs +2 -1
  32. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
  33. package/dist/AllowLists/SimpleDenyList.d.ts +234 -13
  34. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  35. package/dist/AllowLists/SimpleDenyList.js +12 -200
  36. package/dist/AllowLists/SimpleDenyList.js.map +1 -0
  37. package/dist/Auth/Auth.cjs +1 -0
  38. package/dist/Auth/Auth.cjs.map +1 -0
  39. package/dist/Auth/Auth.js +1 -0
  40. package/dist/Auth/Auth.js.map +1 -0
  41. package/dist/Auth/PassthroughAuth.cjs +2 -1
  42. package/dist/Auth/PassthroughAuth.cjs.map +1 -0
  43. package/dist/Auth/PassthroughAuth.js +5 -4
  44. package/dist/Auth/PassthroughAuth.js.map +1 -0
  45. package/dist/Boost.cjs +2 -1
  46. package/dist/Boost.cjs.map +1 -0
  47. package/dist/Boost.d.ts +105 -14
  48. package/dist/Boost.d.ts.map +1 -1
  49. package/dist/Boost.js +138 -5
  50. package/dist/Boost.js.map +1 -0
  51. package/dist/BoostCore-DolmDuXW.cjs +3 -0
  52. package/dist/BoostCore-DolmDuXW.cjs.map +1 -0
  53. package/dist/BoostCore-Z97KVu4V.js +1448 -0
  54. package/dist/BoostCore-Z97KVu4V.js.map +1 -0
  55. package/dist/BoostCore.cjs +2 -2
  56. package/dist/BoostCore.cjs.map +1 -0
  57. package/dist/BoostCore.d.ts +788 -79
  58. package/dist/BoostCore.d.ts.map +1 -1
  59. package/dist/BoostCore.js +30 -1103
  60. package/dist/BoostCore.js.map +1 -0
  61. package/dist/BoostRegistry.cjs +2 -1
  62. package/dist/BoostRegistry.cjs.map +1 -0
  63. package/dist/BoostRegistry.d.ts +95 -26
  64. package/dist/BoostRegistry.d.ts.map +1 -1
  65. package/dist/BoostRegistry.js +183 -89
  66. package/dist/BoostRegistry.js.map +1 -0
  67. package/dist/Budgets/Budget.cjs +2 -1
  68. package/dist/Budgets/Budget.cjs.map +1 -0
  69. package/dist/Budgets/Budget.d.ts +1 -1
  70. package/dist/Budgets/Budget.d.ts.map +1 -1
  71. package/dist/Budgets/Budget.js +15 -13
  72. package/dist/Budgets/Budget.js.map +1 -0
  73. package/dist/Budgets/ManagedBudget.cjs +2 -1
  74. package/dist/Budgets/ManagedBudget.cjs.map +1 -0
  75. package/dist/Budgets/ManagedBudget.d.ts +112 -192
  76. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  77. package/dist/Budgets/ManagedBudget.js +91 -291
  78. package/dist/Budgets/ManagedBudget.js.map +1 -0
  79. package/dist/Budgets/VestingBudget.d.ts +277 -91
  80. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  81. package/dist/Deployable/Contract.cjs +2 -1
  82. package/dist/Deployable/Contract.cjs.map +1 -0
  83. package/dist/Deployable/Contract.d.ts +4 -5
  84. package/dist/Deployable/Contract.d.ts.map +1 -1
  85. package/dist/Deployable/Contract.js +7 -8
  86. package/dist/Deployable/Contract.js.map +1 -0
  87. package/dist/Deployable/Deployable.cjs +1 -0
  88. package/dist/Deployable/Deployable.cjs.map +1 -0
  89. package/dist/Deployable/Deployable.d.ts +9 -3
  90. package/dist/Deployable/Deployable.d.ts.map +1 -1
  91. package/dist/Deployable/Deployable.js +10 -5
  92. package/dist/Deployable/Deployable.js.map +1 -0
  93. package/dist/Deployable/DeployableTarget.cjs +2 -1
  94. package/dist/Deployable/DeployableTarget.cjs.map +1 -0
  95. package/dist/Deployable/DeployableTarget.d.ts +16 -15
  96. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  97. package/dist/Deployable/DeployableTarget.js +49 -42
  98. package/dist/Deployable/DeployableTarget.js.map +1 -0
  99. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  100. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  101. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +179 -0
  102. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  103. package/dist/Deployable/DeployableTargetWithRBAC.js +222 -0
  104. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  105. package/dist/EventAction-CBKzuNoN.cjs +2 -0
  106. package/dist/EventAction-CBKzuNoN.cjs.map +1 -0
  107. package/dist/EventAction-DWuuc_Qy.js +1528 -0
  108. package/dist/EventAction-DWuuc_Qy.js.map +1 -0
  109. package/dist/Incentive-BxzEtN26.js +298 -0
  110. package/dist/Incentive-BxzEtN26.js.map +1 -0
  111. package/dist/Incentive-CrF3-ayL.cjs +2 -0
  112. package/dist/Incentive-CrF3-ayL.cjs.map +1 -0
  113. package/dist/Incentives/AllowListIncentive.cjs +2 -1
  114. package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
  115. package/dist/Incentives/AllowListIncentive.d.ts +65 -21
  116. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  117. package/dist/Incentives/AllowListIncentive.js +52 -36
  118. package/dist/Incentives/AllowListIncentive.js.map +1 -0
  119. package/dist/Incentives/CGDAIncentive.cjs +2 -1
  120. package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
  121. package/dist/Incentives/CGDAIncentive.d.ts +315 -26
  122. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  123. package/dist/Incentives/CGDAIncentive.js +64 -39
  124. package/dist/Incentives/CGDAIncentive.js.map +1 -0
  125. package/dist/Incentives/ERC1155Incentive.d.ts +291 -43
  126. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  127. package/dist/Incentives/ERC20Incentive.cjs +2 -1
  128. package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
  129. package/dist/Incentives/ERC20Incentive.d.ts +270 -33
  130. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  131. package/dist/Incentives/ERC20Incentive.js +69 -46
  132. package/dist/Incentives/ERC20Incentive.js.map +1 -0
  133. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +338 -421
  134. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  135. package/dist/Incentives/ERC20VariableIncentive.d.ts +262 -32
  136. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  137. package/dist/Incentives/Incentive.cjs +2 -1
  138. package/dist/Incentives/Incentive.cjs.map +1 -0
  139. package/dist/Incentives/Incentive.d.ts +5 -8
  140. package/dist/Incentives/Incentive.d.ts.map +1 -1
  141. package/dist/Incentives/Incentive.js +17 -278
  142. package/dist/Incentives/Incentive.js.map +1 -0
  143. package/dist/Incentives/PointsIncentive.cjs +2 -1
  144. package/dist/Incentives/PointsIncentive.cjs.map +1 -0
  145. package/dist/Incentives/PointsIncentive.d.ts +81 -23
  146. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  147. package/dist/Incentives/PointsIncentive.js +57 -36
  148. package/dist/Incentives/PointsIncentive.js.map +1 -0
  149. package/dist/SimpleDenyList-BUR17Tt1.cjs +2 -0
  150. package/dist/SimpleDenyList-BUR17Tt1.cjs.map +1 -0
  151. package/dist/SimpleDenyList-CGaWjuld.js +132 -0
  152. package/dist/SimpleDenyList-CGaWjuld.js.map +1 -0
  153. package/dist/Validators/SignerValidator.cjs +2 -1
  154. package/dist/Validators/SignerValidator.cjs.map +1 -0
  155. package/dist/Validators/SignerValidator.d.ts +310 -17
  156. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  157. package/dist/Validators/SignerValidator.js +165 -36
  158. package/dist/Validators/SignerValidator.js.map +1 -0
  159. package/dist/Validators/Validator.cjs +2 -1
  160. package/dist/Validators/Validator.cjs.map +1 -0
  161. package/dist/Validators/Validator.d.ts +2 -2
  162. package/dist/Validators/Validator.d.ts.map +1 -1
  163. package/dist/Validators/Validator.js +10 -8
  164. package/dist/Validators/Validator.js.map +1 -0
  165. package/dist/claiming.cjs +2 -0
  166. package/dist/claiming.cjs.map +1 -0
  167. package/dist/claiming.d.ts +43 -0
  168. package/dist/claiming.d.ts.map +1 -0
  169. package/dist/claiming.js +17 -0
  170. package/dist/claiming.js.map +1 -0
  171. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  172. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  173. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  174. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  175. package/dist/deployments-DVXioW2i.cjs +2 -0
  176. package/dist/deployments-DVXioW2i.cjs.map +1 -0
  177. package/dist/deployments-oykLv3_Z.js +43 -0
  178. package/dist/deployments-oykLv3_Z.js.map +1 -0
  179. package/dist/deployments.json +44 -0
  180. package/dist/errors.cjs +2 -1
  181. package/dist/errors.cjs.map +1 -0
  182. package/dist/errors.d.ts +421 -1
  183. package/dist/errors.d.ts.map +1 -1
  184. package/dist/errors.js +297 -39
  185. package/dist/errors.js.map +1 -0
  186. package/dist/{generated-x_abr3Yv.js → generated-CKt2yCQd.js} +3143 -3002
  187. package/dist/generated-CKt2yCQd.js.map +1 -0
  188. package/dist/generated-CyTNlOwM.cjs +3 -0
  189. package/dist/generated-CyTNlOwM.cjs.map +1 -0
  190. package/dist/index.cjs +2 -1
  191. package/dist/index.cjs.map +1 -0
  192. package/dist/index.d.ts +10 -9
  193. package/dist/index.d.ts.map +1 -1
  194. package/dist/index.js +144 -1353
  195. package/dist/index.js.map +1 -0
  196. package/dist/transfers.cjs +2 -0
  197. package/dist/transfers.cjs.map +1 -0
  198. package/dist/transfers.d.ts +198 -0
  199. package/dist/transfers.d.ts.map +1 -0
  200. package/dist/transfers.js +84 -0
  201. package/dist/transfers.js.map +1 -0
  202. package/dist/utils.cjs +2 -1
  203. package/dist/utils.cjs.map +1 -0
  204. package/dist/utils.d.ts +26 -1350
  205. package/dist/utils.d.ts.map +1 -1
  206. package/dist/utils.js +38 -636
  207. package/dist/utils.js.map +1 -0
  208. package/package.json +37 -11
  209. package/src/Actions/Action.test.ts +79 -0
  210. package/src/Actions/Action.ts +61 -0
  211. package/src/Actions/ContractAction.test.ts +197 -0
  212. package/src/Actions/ContractAction.ts +300 -0
  213. package/src/Actions/ERC721MintAction.test.ts +112 -0
  214. package/src/Actions/ERC721MintAction.ts +291 -0
  215. package/src/Actions/EventAction.test.ts +787 -0
  216. package/src/Actions/EventAction.ts +1218 -0
  217. package/src/AllowLists/AllowList.test.ts +64 -0
  218. package/src/AllowLists/AllowList.ts +62 -0
  219. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  220. package/src/AllowLists/OpenAllowList.ts +45 -0
  221. package/src/AllowLists/SimpleAllowList.test.ts +52 -0
  222. package/src/AllowLists/SimpleAllowList.ts +262 -0
  223. package/src/AllowLists/SimpleDenyList.test.ts +52 -0
  224. package/src/AllowLists/SimpleDenyList.ts +250 -0
  225. package/src/Auth/Auth.ts +11 -0
  226. package/src/Auth/PassthroughAuth.test.ts +12 -0
  227. package/src/Auth/PassthroughAuth.ts +80 -0
  228. package/src/Boost.ts +287 -0
  229. package/src/BoostCore.test.ts +894 -0
  230. package/src/BoostCore.ts +1438 -0
  231. package/src/BoostRegistry.test.ts +53 -0
  232. package/src/BoostRegistry.ts +588 -0
  233. package/src/Budgets/Budget.test.ts +27 -0
  234. package/src/Budgets/Budget.ts +60 -0
  235. package/src/Budgets/ManagedBudget.test.ts +217 -0
  236. package/src/Budgets/ManagedBudget.ts +534 -0
  237. package/src/Budgets/VestingBudget.test.ts +123 -0
  238. package/src/Budgets/VestingBudget.ts +530 -0
  239. package/src/Deployable/Contract.ts +228 -0
  240. package/src/Deployable/Deployable.ts +250 -0
  241. package/src/Deployable/DeployableTarget.ts +234 -0
  242. package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
  243. package/src/Incentives/AllowListIncentive.test.ts +143 -0
  244. package/src/Incentives/AllowListIncentive.ts +336 -0
  245. package/src/Incentives/CGDAIncentive.test.ts +135 -0
  246. package/src/Incentives/CGDAIncentive.ts +476 -0
  247. package/src/Incentives/ERC1155Incentive.test.ts +87 -0
  248. package/src/Incentives/ERC1155Incentive.ts +465 -0
  249. package/src/Incentives/ERC20Incentive.test.ts +133 -0
  250. package/src/Incentives/ERC20Incentive.ts +490 -0
  251. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  252. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
  253. package/src/Incentives/ERC20VariableIncentive.test.ts +139 -0
  254. package/src/Incentives/ERC20VariableIncentive.ts +428 -0
  255. package/src/Incentives/Incentive.test.ts +95 -0
  256. package/src/Incentives/Incentive.ts +86 -0
  257. package/src/Incentives/PointsIncentive.test.ts +138 -0
  258. package/src/Incentives/PointsIncentive.ts +367 -0
  259. package/src/Validators/SignerValidator.test.ts +159 -0
  260. package/src/Validators/SignerValidator.ts +683 -0
  261. package/src/Validators/Validator.test.ts +21 -0
  262. package/src/Validators/Validator.ts +55 -0
  263. package/src/claiming.ts +56 -0
  264. package/src/errors.ts +866 -0
  265. package/src/index.test.ts +122 -0
  266. package/src/index.ts +58 -0
  267. package/src/transfers.ts +284 -0
  268. package/src/utils.test.ts +44 -0
  269. package/src/utils.ts +247 -0
  270. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  271. package/dist/generated-BaaleHW-.cjs +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Contract.cjs","sources":["../../src/Deployable/Contract.ts"],"sourcesContent":["import { type Config, watchContractEvent } from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport {\n type Abi,\n type Address,\n type ContractEventName,\n type GetLogsReturnType,\n type WaitForTransactionReceiptParameters,\n type WatchContractEventOnLogsParameter,\n getAbiItem,\n} from 'viem';\nimport { getLogs } from 'viem/actions';\nimport { ContractAddressRequiredError } from '../errors';\nimport {\n type GetLogsParams,\n type HashAndSimulatedResult,\n type WatchParams,\n awaitResult,\n} from '../utils';\n\n/**\n * A basic Contract class to encapsulate configuration and a potential address\n *\n * @export\n * @class Contract\n * @typedef {Contract}\n * @template {Abi} [ContractAbi=[]]\n * @template {ContractEventName<ContractAbi>} [ContractEvent=any]\n */\nexport class Contract<ContractAbi extends Abi> {\n //@ts-expect-error this should always be set by implementing contract\n public readonly abi: ContractAbi;\n /**\n * @see [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @protected\n * @type {WagmiConfig}\n */\n protected _config: Config;\n /**\n * The internally managed address for this contract\n *\n * @protected\n * @type {(Address | undefined)}\n */\n protected _address: Address | undefined;\n\n /**\n * Creates an instance of Contract.\n *\n * @constructor\n * @param {Config} config\n * @param {(Address | undefined)} address\n */\n constructor(config: Config, address: Address | undefined) {\n this._config = config;\n this._address = address;\n }\n\n /**\n * A getter returning this contract's deployed address, if it exists.\n *\n * @public\n * @readonly\n * @type {Address | undefined}\n */\n public get address() {\n return this._address;\n }\n\n /**\n * Will set this contract's address and return the instance for chaining. Does not verify that provided address is valid.\n *\n * @public\n * @param {Address} address\n * @returns {this}\n */\n public at(address: Address) {\n this._address = address;\n return this;\n }\n\n /**\n * Will set this contract's internal [Wagmi Configuration](https://en.wikipedia.org/wiki/Factorial) and return the instance for chaining.\n *\n * @public\n * @param {Config} config\n * @returns {this}\n */\n public withConfig(config: Config) {\n this._config = config;\n return this;\n }\n\n /**\n * Utility function to validate the existence of an address on this Contract.\n *\n * @public\n * @returns {Address}\n * @throws {@link ContractAddressRequiredError} if no address exists on this Contract instance\n */\n public assertValidAddress() {\n const address = this.address;\n if (!address) throw new ContractAddressRequiredError();\n return address;\n }\n\n /**\n * A typed wrapper for (viem.getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs].\n * Accepts `eventName` and `eventNames` as optional parameters to narrow the returned log types.\n * @example\n * ```ts\n * const logs = contract.getLogs({ eventName: 'EventName' })\n * const logs = contract.getLogs({ eventNames: ['EventName'] })\n *\n * @public\n * @async\n * @template {ContractEvent} event\n * @template {ExtractAbiEvent<\n * ContractAbi,\n * event\n * >} [abiEvent=ExtractAbiEvent<ContractAbi, event>]\n * @param {?Omit<\n * GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,\n * 'event' | 'events'\n * > & {\n * eventName?: event;\n * eventNames?: event[];\n * }} [params]\n * @returns {Promise<GetLogsReturnType<abiEvent, abiEvent[]>>}\n */\n public async getLogs<\n event extends ContractEventName<ContractAbi>,\n const abiEvent extends ExtractAbiEvent<\n ContractAbi,\n event\n > = ExtractAbiEvent<ContractAbi, event>,\n >(\n params?: Omit<\n GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,\n 'event' | 'events'\n > & {\n eventName?: event;\n eventNames?: event[];\n },\n ): Promise<GetLogsReturnType<abiEvent, abiEvent[]>> {\n return getLogs(this._config.getClient({ chainId: params?.chainId }), {\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wag\n ...(params as any),\n ...(params?.eventName\n ? {\n event: getAbiItem({\n abi: this.abi,\n name: params.eventName,\n // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue\n } as any),\n }\n : {}),\n ...(params?.eventNames\n ? {\n events: params.eventNames.map((name) =>\n getAbiItem({\n abi: this.abi,\n name,\n // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue\n } as any),\n ),\n }\n : {}),\n address: this.assertValidAddress(),\n });\n }\n\n /**\n * A typed wrapper for `wagmi.watchContractEvent`\n *\n * @public\n * @template {ContractEvent} event\n * @param {(\n * log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],\n * ) => unknown} cb\n * @param {?WatchParams<ContractAbi, event> & {\n * eventName?: event;\n * }} [params]\n * @returns {() => void}\n */\n public subscribe<event extends ContractEventName<ContractAbi>>(\n cb: (\n log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],\n ) => unknown,\n params?: WatchParams<ContractAbi, event> & {\n eventName?: event;\n },\n ) {\n return watchContractEvent<\n typeof this._config,\n (typeof this._config)['chains'][number]['id'],\n ContractAbi,\n event\n >(this._config, {\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n eventName: params?.eventName,\n abi: this.abi,\n address: this.assertValidAddress(),\n onLogs: (logs) => {\n for (let l of logs) {\n cb(l);\n }\n },\n });\n }\n\n /**\n * @see {@link awaitResult}\n * @protected\n * @async\n * @template [Result=unknown]\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\n protected async awaitResult<Result = unknown>(\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n return await awaitResult(this._config, hashPromise, waitParams);\n }\n}\n"],"names":["Contract","config","address","ContractAddressRequiredError","params","getLogs","getAbiItem","name","cb","watchContractEvent","logs","l","hashPromise","waitParams","awaitResult"],"mappings":"gNA6BO,MAAMA,CAAkC,CAwB7C,YAAYC,EAAgBC,EAA8B,CACxD,KAAK,QAAUD,EACf,KAAK,SAAWC,CAClB,CASA,IAAW,SAAU,CACnB,OAAO,KAAK,QACd,CASO,GAAGA,EAAkB,CAC1B,YAAK,SAAWA,EACT,IACT,CASO,WAAWD,EAAgB,CAChC,YAAK,QAAUA,EACR,IACT,CASO,oBAAqB,CAC1B,MAAMC,EAAU,KAAK,QACrB,GAAI,CAACA,EAAe,MAAA,IAAIC,EAAAA,6BACjB,OAAAD,CACT,CA0BA,MAAa,QAOXE,EAOkD,CAC3C,OAAAC,EAAA,QAAQ,KAAK,QAAQ,UAAU,CAAE,QAASD,GAAA,YAAAA,EAAQ,OAAQ,CAAC,EAAG,CAEnE,GAAIA,EACJ,GAAIA,GAAA,MAAAA,EAAQ,UACR,CACE,MAAOE,EAAAA,WAAW,CAChB,IAAK,KAAK,IACV,KAAMF,EAAO,SAAA,CAEP,CAAA,EAEV,CAAC,EACL,GAAIA,GAAA,MAAAA,EAAQ,WACR,CACE,OAAQA,EAAO,WAAW,IAAKG,GAC7BD,EAAAA,WAAW,CACT,IAAK,KAAK,IACV,KAAAC,CAAA,CAEM,CACV,CAAA,EAEF,CAAC,EACL,QAAS,KAAK,mBAAmB,CAAA,CAClC,CACH,CAeO,UACLC,EAGAJ,EAGA,CACO,OAAAK,EAAA,mBAKL,KAAK,QAAS,CAEd,GAAIL,EACJ,UAAWA,GAAA,YAAAA,EAAQ,UACnB,IAAK,KAAK,IACV,QAAS,KAAK,mBAAmB,EACjC,OAASM,GAAS,CAChB,QAASC,KAAKD,EACZF,EAAGG,CAAC,CAER,CAAA,CACD,CACH,CAWA,MAAgB,YACdC,EACAC,EACA,CACA,OAAO,MAAMC,EAAA,YAAY,KAAK,QAASF,EAAaC,CAAU,CAChE,CACF"}
@@ -39,7 +39,7 @@ export declare class Contract<ContractAbi extends Abi> {
39
39
  *
40
40
  * @public
41
41
  * @readonly
42
- * @type {*}
42
+ * @type {Address | undefined}
43
43
  */
44
44
  get address(): `0x${string}` | undefined;
45
45
  /**
@@ -98,7 +98,6 @@ export declare class Contract<ContractAbi extends Abi> {
98
98
  * A typed wrapper for `wagmi.watchContractEvent`
99
99
  *
100
100
  * @public
101
- * @async
102
101
  * @template {ContractEvent} event
103
102
  * @param {(
104
103
  * log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],
@@ -106,11 +105,11 @@ export declare class Contract<ContractAbi extends Abi> {
106
105
  * @param {?WatchParams<ContractAbi, event> & {
107
106
  * eventName?: event;
108
107
  * }} [params]
109
- * @returns {unknown, params?: any) => unknown}
108
+ * @returns {() => void}
110
109
  */
111
110
  subscribe<event extends ContractEventName<ContractAbi>>(cb: (log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number]) => unknown, params?: WatchParams<ContractAbi, event> & {
112
111
  eventName?: event;
113
- }): Promise<() => void>;
112
+ }): () => void;
114
113
  /**
115
114
  * @see {@link awaitResult}
116
115
  * @protected
@@ -118,7 +117,7 @@ export declare class Contract<ContractAbi extends Abi> {
118
117
  * @template [Result=unknown]
119
118
  * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise
120
119
  * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
121
- * @returns {unknown}
120
+ * @returns {Promise<Result>}
122
121
  */
123
122
  protected awaitResult<Result = unknown>(hashPromise: Promise<HashAndSimulatedResult<Result>>, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<Result>;
124
123
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Contract.d.ts","sourceRoot":"","sources":["../../src/Deployable/Contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAsB,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,EAEvC,MAAM,MAAM,CAAC;AAGd,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAEjB,MAAM,UAAU,CAAC;AAElB;;;;;;;;GAQG;AACH,qBAAa,QAAQ,CAAC,WAAW,SAAS,GAAG;IAE3C,SAAgB,GAAG,EAAE,WAAW,CAAC;IACjC;;;;OAIG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAExC;;;;;;OAMG;gBACS,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS;IAKxD;;;;;;OAMG;IACH,IAAW,OAAO,8BAEjB;IAED;;;;;;OAMG;IACI,EAAE,CAAC,OAAO,EAAE,OAAO;IAK1B;;;;;;OAMG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM;IAKhC;;;;;;OAMG;IACI,kBAAkB;IAMzB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACU,OAAO,CAClB,KAAK,SAAS,iBAAiB,CAAC,WAAW,CAAC,EAC5C,KAAK,CAAC,QAAQ,SAAS,eAAe,CACpC,WAAW,EACX,KAAK,CACN,GAAG,eAAe,CAAC,WAAW,EAAE,KA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AC,WAAW,EAAE,KAAK,CAAC,GAAG;QACzC,SAAS,CAAC,EAAE,KAAK,CAAC;KACnB;IAqBH;;;;;;;;OAQG;cACa,WAAW,CAAC,MAAM,GAAG,OAAO,EAC1C,WAAW,EAAE,OAAO,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,EACpD,UAAU,CAAC,EAAE,IAAI,CAAC,mCAAmC,EAAE,MAAM,CAAC;CAIjE"}
@@ -19,7 +19,7 @@ class v {
19
19
  *
20
20
  * @public
21
21
  * @readonly
22
- * @type {*}
22
+ * @type {Address | undefined}
23
23
  */
24
24
  get address() {
25
25
  return this._address;
@@ -53,8 +53,7 @@ class v {
53
53
  */
54
54
  assertValidAddress() {
55
55
  const t = this.address;
56
- if (!t)
57
- throw new r();
56
+ if (!t) throw new r();
58
57
  return t;
59
58
  }
60
59
  /**
@@ -108,7 +107,6 @@ class v {
108
107
  * A typed wrapper for `wagmi.watchContractEvent`
109
108
  *
110
109
  * @public
111
- * @async
112
110
  * @template {ContractEvent} event
113
111
  * @param {(
114
112
  * log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],
@@ -116,9 +114,9 @@ class v {
116
114
  * @param {?WatchParams<ContractAbi, event> & {
117
115
  * eventName?: event;
118
116
  * }} [params]
119
- * @returns {unknown, params?: any) => unknown}
117
+ * @returns {() => void}
120
118
  */
121
- async subscribe(t, e) {
119
+ subscribe(t, e) {
122
120
  return o(this._config, {
123
121
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
124
122
  ...e,
@@ -138,12 +136,13 @@ class v {
138
136
  * @template [Result=unknown]
139
137
  * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise
140
138
  * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
141
- * @returns {unknown}
139
+ * @returns {Promise<Result>}
142
140
  */
143
141
  async awaitResult(t, e) {
144
- return h(this._config, t, e);
142
+ return await h(this._config, t, e);
145
143
  }
146
144
  }
147
145
  export {
148
146
  v as Contract
149
147
  };
148
+ //# sourceMappingURL=Contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Contract.js","sources":["../../src/Deployable/Contract.ts"],"sourcesContent":["import { type Config, watchContractEvent } from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport {\n type Abi,\n type Address,\n type ContractEventName,\n type GetLogsReturnType,\n type WaitForTransactionReceiptParameters,\n type WatchContractEventOnLogsParameter,\n getAbiItem,\n} from 'viem';\nimport { getLogs } from 'viem/actions';\nimport { ContractAddressRequiredError } from '../errors';\nimport {\n type GetLogsParams,\n type HashAndSimulatedResult,\n type WatchParams,\n awaitResult,\n} from '../utils';\n\n/**\n * A basic Contract class to encapsulate configuration and a potential address\n *\n * @export\n * @class Contract\n * @typedef {Contract}\n * @template {Abi} [ContractAbi=[]]\n * @template {ContractEventName<ContractAbi>} [ContractEvent=any]\n */\nexport class Contract<ContractAbi extends Abi> {\n //@ts-expect-error this should always be set by implementing contract\n public readonly abi: ContractAbi;\n /**\n * @see [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @protected\n * @type {WagmiConfig}\n */\n protected _config: Config;\n /**\n * The internally managed address for this contract\n *\n * @protected\n * @type {(Address | undefined)}\n */\n protected _address: Address | undefined;\n\n /**\n * Creates an instance of Contract.\n *\n * @constructor\n * @param {Config} config\n * @param {(Address | undefined)} address\n */\n constructor(config: Config, address: Address | undefined) {\n this._config = config;\n this._address = address;\n }\n\n /**\n * A getter returning this contract's deployed address, if it exists.\n *\n * @public\n * @readonly\n * @type {Address | undefined}\n */\n public get address() {\n return this._address;\n }\n\n /**\n * Will set this contract's address and return the instance for chaining. Does not verify that provided address is valid.\n *\n * @public\n * @param {Address} address\n * @returns {this}\n */\n public at(address: Address) {\n this._address = address;\n return this;\n }\n\n /**\n * Will set this contract's internal [Wagmi Configuration](https://en.wikipedia.org/wiki/Factorial) and return the instance for chaining.\n *\n * @public\n * @param {Config} config\n * @returns {this}\n */\n public withConfig(config: Config) {\n this._config = config;\n return this;\n }\n\n /**\n * Utility function to validate the existence of an address on this Contract.\n *\n * @public\n * @returns {Address}\n * @throws {@link ContractAddressRequiredError} if no address exists on this Contract instance\n */\n public assertValidAddress() {\n const address = this.address;\n if (!address) throw new ContractAddressRequiredError();\n return address;\n }\n\n /**\n * A typed wrapper for (viem.getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs].\n * Accepts `eventName` and `eventNames` as optional parameters to narrow the returned log types.\n * @example\n * ```ts\n * const logs = contract.getLogs({ eventName: 'EventName' })\n * const logs = contract.getLogs({ eventNames: ['EventName'] })\n *\n * @public\n * @async\n * @template {ContractEvent} event\n * @template {ExtractAbiEvent<\n * ContractAbi,\n * event\n * >} [abiEvent=ExtractAbiEvent<ContractAbi, event>]\n * @param {?Omit<\n * GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,\n * 'event' | 'events'\n * > & {\n * eventName?: event;\n * eventNames?: event[];\n * }} [params]\n * @returns {Promise<GetLogsReturnType<abiEvent, abiEvent[]>>}\n */\n public async getLogs<\n event extends ContractEventName<ContractAbi>,\n const abiEvent extends ExtractAbiEvent<\n ContractAbi,\n event\n > = ExtractAbiEvent<ContractAbi, event>,\n >(\n params?: Omit<\n GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,\n 'event' | 'events'\n > & {\n eventName?: event;\n eventNames?: event[];\n },\n ): Promise<GetLogsReturnType<abiEvent, abiEvent[]>> {\n return getLogs(this._config.getClient({ chainId: params?.chainId }), {\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wag\n ...(params as any),\n ...(params?.eventName\n ? {\n event: getAbiItem({\n abi: this.abi,\n name: params.eventName,\n // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue\n } as any),\n }\n : {}),\n ...(params?.eventNames\n ? {\n events: params.eventNames.map((name) =>\n getAbiItem({\n abi: this.abi,\n name,\n // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue\n } as any),\n ),\n }\n : {}),\n address: this.assertValidAddress(),\n });\n }\n\n /**\n * A typed wrapper for `wagmi.watchContractEvent`\n *\n * @public\n * @template {ContractEvent} event\n * @param {(\n * log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],\n * ) => unknown} cb\n * @param {?WatchParams<ContractAbi, event> & {\n * eventName?: event;\n * }} [params]\n * @returns {() => void}\n */\n public subscribe<event extends ContractEventName<ContractAbi>>(\n cb: (\n log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],\n ) => unknown,\n params?: WatchParams<ContractAbi, event> & {\n eventName?: event;\n },\n ) {\n return watchContractEvent<\n typeof this._config,\n (typeof this._config)['chains'][number]['id'],\n ContractAbi,\n event\n >(this._config, {\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n eventName: params?.eventName,\n abi: this.abi,\n address: this.assertValidAddress(),\n onLogs: (logs) => {\n for (let l of logs) {\n cb(l);\n }\n },\n });\n }\n\n /**\n * @see {@link awaitResult}\n * @protected\n * @async\n * @template [Result=unknown]\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<Result>}\n */\n protected async awaitResult<Result = unknown>(\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n return await awaitResult(this._config, hashPromise, waitParams);\n }\n}\n"],"names":["Contract","config","address","ContractAddressRequiredError","params","getLogs","getAbiItem","name","cb","watchContractEvent","logs","l","hashPromise","waitParams","awaitResult"],"mappings":";;;;;AA6BO,MAAMA,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwB7C,YAAYC,GAAgBC,GAA8B;AACxD,SAAK,UAAUD,GACf,KAAK,WAAWC;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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AJ,GAGA;AACO,WAAAK,EAKL,KAAK,SAAS;AAAA;AAAA,MAEd,GAAIL;AAAA,MACJ,WAAWA,KAAA,gBAAAA,EAAQ;AAAA,MACnB,KAAK,KAAK;AAAA,MACV,SAAS,KAAK,mBAAmB;AAAA,MACjC,QAAQ,CAACM,MAAS;AAChB,iBAASC,KAAKD;AACZ,UAAAF,EAAGG,CAAC;AAAA,MAER;AAAA,IAAA,CACD;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAgB,YACdC,GACAC,GACA;AACA,WAAO,MAAMC,EAAY,KAAK,SAASF,GAAaC,CAAU;AAAA,EAChE;AACF;"}
@@ -1 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@wagmi/core"),a=require("../errors.cjs"),n=require("../utils.cjs"),c=require("./Contract.cjs");class l extends c.Contract{constructor({account:t,config:e},o){typeof o=="string"?super(e,o):(super(e,void 0),this._payload=o),t&&(this._account=t)}get payload(){return this._payload}withPayload(t){return this._payload=t,this}async deploy(t,e,o){const r=(e==null?void 0:e.config)||this._config,i=await n.getDeployedContractAddress(r,this.deployRaw(t,e),o);return this._address=i,this}async deployRaw(t,e){if(this.address)throw new a.DeployableAlreadyDeployedError(this.address);const[o,r]=this.validateDeploymentConfig(t,e);return await s.deployContract(r.config,{...this.buildParameters(o),...this.optionallyAttachAccount(r.account)})}optionallyAttachAccount(t){return t?{account:t}:this._account?{account:this._account}:{}}buildParameters(t,e){throw new a.DeployableBuildParametersUnspecifiedError}validateDeploymentConfig(t,e){const o=e||{config:this._config,account:this._account};if(!o)throw new a.DeployableWagmiConfigurationRequiredError;return[t||this._payload,o]}}exports.Deployable=l;
2
+ //# sourceMappingURL=Deployable.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Deployable.cjs","sources":["../../src/Deployable/Deployable.ts"],"sourcesContent":["import { type Config, deployContract } from '@wagmi/core';\nimport type {\n Abi,\n Account,\n Address,\n ContractEventName,\n Hash,\n Hex,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableBuildParametersUnspecifiedError,\n DeployableMissingPayloadError,\n DeployableWagmiConfigurationRequiredError,\n} from '../errors';\nimport { getDeployedContractAddress } from '../utils';\nimport { Contract } from './Contract';\n\n/**\n * A base class representing a deployable contract, contains base implementations for deployment and initialization payload construction.\n *\n * @export\n * @typedef {GenericDeployableParams}\n */\nexport type GenericDeployableParams = Omit<\n Parameters<typeof deployContract>[1],\n 'args' | 'account'\n> & {\n args: [Hex, ...Array<Hex>];\n account?: Account;\n};\n\n/**\n * A generic type that encapsulates either an initialization payload for a contract, or a valid address for a previously deployed contract.\n *\n * @export\n * @typedef {DeployablePayloadOrAddress}\n * @template [Payload=unknown]\n */\nexport type DeployablePayloadOrAddress<Payload = unknown> = Payload | Address;\n\n/**\n * Instantion options for the base deployable.\n *\n * @export\n * @interface DeployableOptions\n * @typedef {DeployableOptions}\n */\nexport interface DeployableOptions {\n /**\n * [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n *\n * @see {@link Config}\n * @type {Config}\n */\n config: Config;\n /**\n * [Viem Local Account](https://viem.sh/docs/accounts/local), required if in a Node environment\n *\n * @see {@link Account}\n * @type {?Account}\n */\n account?: Account;\n}\n\n/**\n * A generic deployable contract that encapsulates common operations related to contract deployment\n *\n * @export\n * @class Deployable\n * @typedef {Deployable}\n * @template [Payload=unknown]\n * @template {Abi} [ContractAbi=[]]\n * @template {ContractEventName<ContractAbi>} [ContractEvent=ContractEventName<ContractAbi>]\n * @extends {Contract<ContractAbi, ContractEvent>}\n */\nexport class Deployable<\n Payload,\n ContractAbi extends Abi,\n> extends Contract<ContractAbi> {\n /**\n * The deployable payload used either for contract construction or initialization\n *\n * @protected\n * @type {(Payload | undefined)}\n */\n protected _payload: Payload | undefined;\n /**\n * If it exists, [Viem Local Account](https://viem.sh/docs/accounts/local), if in a Node environment\n *\n * @protected\n * @type {?Account}\n */\n protected _account?: Account;\n\n /**\n * Creates an instance of Deployable.\n *\n * @constructor\n * @param {DeployableOptions} param0\n * @param {?Account} [param0.account]\n * @param {Config} param0.config\n * @param {DeployablePayloadOrAddress<Payload>} payload\n */\n constructor(\n { account, config }: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n ) {\n if (typeof payload === 'string') {\n super(config, payload as Address);\n } else {\n super(config, undefined);\n this._payload = payload as Payload;\n }\n if (account) this._account = account;\n }\n\n /**\n * Returns the attached deployable payload, if it exists\n *\n * @readonly\n * @type {Payload}\n */\n get payload() {\n return this._payload;\n }\n\n /**\n * Attaches a new payload for use with this deployable's initialization\n *\n * @public\n * @param {Payload} payload\n * @returns {this}\n */\n public withPayload(payload: Payload) {\n this._payload = payload;\n return this;\n }\n\n /**\n * High level deployment function to deploy and await the contract address.\n * This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,\n * which makes it useless for Boost components.\n * Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - See [viem.WaitForTransactionReceipt](https://v1.viem.sh/docs/actions/public/waitForTransactionReceipt.html#waitfortransactionreceipt)\n * @returns {Promise<this>}\n */\n protected async deploy(\n _payload?: Payload,\n _options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n const config = _options?.config || this._config;\n const address = await getDeployedContractAddress(\n config,\n this.deployRaw(_payload, _options),\n waitParams,\n );\n this._address = address;\n return this;\n }\n\n /**\n * The lower level contract deployment function that does not await for the transaction receipt.\n * This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,\n * which makes it useless for Boost components.\n * Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n * @throws {@link DeployableAlreadyDeployedError}\n * @throws {@link DeployableWagmiConfigurationRequiredError}\n * @throws {@link DeployableMissingPayloadError}\n */\n protected async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return await deployContract(options.config, {\n ...this.buildParameters(payload),\n ...this.optionallyAttachAccount(options.account),\n });\n }\n\n /**\n * Internal function to attach the connected account to write methods to avoid manually passing in an account each call.\n *\n * @protected\n * @param {?Account} [account]\n * @returns {({ account: Account; } | { account?: undefined; })}\n */\n protected optionallyAttachAccount(account?: Account) {\n if (account) return { account };\n return this._account ? { account: this._account } : {};\n }\n\n /**\n * Base parameter constructor, should return a partial `viem.deployContract` parameters shape including abi, bytecode, and arguments, if any.\n * Expected to be overridden by protocol contracts.\n *\n * @public\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public buildParameters(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n throw new DeployableBuildParametersUnspecifiedError();\n }\n\n /**\n * Internal method used to ensure that a Wagmi configuration and payload are always present when deploying.\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n * @throws {@link DeployableWagmiConfigurationRequiredError}\n * @throws {@link DeployableMissingPayloadError}\n */\n protected validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const options = _options || {\n config: this._config,\n account: this._account,\n };\n if (!options) throw new DeployableWagmiConfigurationRequiredError();\n const payload = _payload || this._payload;\n return [payload, options] as [P, DeployableOptions];\n }\n}\n"],"names":["Deployable","Contract","account","config","payload","_payload","_options","waitParams","address","getDeployedContractAddress","DeployableAlreadyDeployedError","options","deployContract","DeployableBuildParametersUnspecifiedError","DeployableWagmiConfigurationRequiredError"],"mappings":"gMA6EO,MAAMA,UAGHC,EAAAA,QAAsB,CAyB9B,YACE,CAAE,QAAAC,EAAS,OAAAC,CAAA,EACXC,EACA,CACI,OAAOA,GAAY,SACrB,MAAMD,EAAQC,CAAkB,GAEhC,MAAMD,EAAQ,MAAS,EACvB,KAAK,SAAWC,GAEdF,SAAc,SAAWA,EAC/B,CAQA,IAAI,SAAU,CACZ,OAAO,KAAK,QACd,CASO,YAAYE,EAAkB,CACnC,YAAK,SAAWA,EACT,IACT,CAeA,MAAgB,OACdC,EACAC,EACAC,EACA,CACM,MAAAJ,GAASG,GAAA,YAAAA,EAAU,SAAU,KAAK,QAClCE,EAAU,MAAMC,EAAA,2BACpBN,EACA,KAAK,UAAUE,EAAUC,CAAQ,EACjCC,CAAA,EAEF,YAAK,SAAWC,EACT,IACT,CAiBA,MAAgB,UACdH,EACAC,EACe,CACf,GAAI,KAAK,QAAS,MAAM,IAAII,EAAAA,+BAA+B,KAAK,OAAO,EACvE,KAAM,CAACN,EAASO,CAAO,EAAI,KAAK,yBAC9BN,EACAC,CAAA,EAEK,OAAA,MAAMM,EAAAA,eAAeD,EAAQ,OAAQ,CAC1C,GAAG,KAAK,gBAAgBP,CAAO,EAC/B,GAAG,KAAK,wBAAwBO,EAAQ,OAAO,CAAA,CAChD,CACH,CASU,wBAAwBT,EAAmB,CAC/C,OAAAA,EAAgB,CAAE,QAAAA,GACf,KAAK,SAAW,CAAE,QAAS,KAAK,UAAa,EACtD,CAWO,gBACLG,EACAC,EACyB,CACzB,MAAM,IAAIO,EAA0C,yCACtD,CAaU,yBACRR,EACAC,EACA,CACA,MAAMK,EAAUL,GAAY,CAC1B,OAAQ,KAAK,QACb,QAAS,KAAK,QAAA,EAEhB,GAAI,CAACK,EAAe,MAAA,IAAIG,EAAAA,0CAEjB,MAAA,CADST,GAAY,KAAK,SAChBM,CAAO,CAC1B,CACF"}
@@ -95,17 +95,23 @@ export declare class Deployable<Payload, ContractAbi extends Abi> extends Contra
95
95
  withPayload(payload: Payload): this;
96
96
  /**
97
97
  * High level deployment function to deploy and await the contract address.
98
+ * This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,
99
+ * which makes it useless for Boost components.
100
+ * Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.
98
101
  *
99
102
  * @public
100
103
  * @async
101
104
  * @param {?Payload} [_payload]
102
105
  * @param {?DeployableOptions} [_options]
103
106
  * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - See [viem.WaitForTransactionReceipt](https://v1.viem.sh/docs/actions/public/waitForTransactionReceipt.html#waitfortransactionreceipt)
104
- * @returns {unknown}
107
+ * @returns {Promise<this>}
105
108
  */
106
- deploy(_payload?: Payload, _options?: DeployableOptions, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<this>;
109
+ protected deploy(_payload?: Payload, _options?: DeployableOptions, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<this>;
107
110
  /**
108
111
  * The lower level contract deployment function that does not await for the transaction receipt.
112
+ * This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,
113
+ * which makes it useless for Boost components.
114
+ * Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.
109
115
  *
110
116
  * @public
111
117
  * @async
@@ -116,7 +122,7 @@ export declare class Deployable<Payload, ContractAbi extends Abi> extends Contra
116
122
  * @throws {@link DeployableWagmiConfigurationRequiredError}
117
123
  * @throws {@link DeployableMissingPayloadError}
118
124
  */
119
- deployRaw(_payload?: Payload, _options?: DeployableOptions): Promise<Hash>;
125
+ protected deployRaw(_payload?: Payload, _options?: DeployableOptions): Promise<Hash>;
120
126
  /**
121
127
  * Internal function to attach the connected account to write methods to avoid manually passing in an account each call.
122
128
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Deployable.d.ts","sourceRoot":"","sources":["../../src/Deployable/Deployable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK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,CAAC,EAAE,CAAC,EACZ,QAAQ,CAAC,EAAE,iBAAiB,GAQC,CAAC,CAAC,EAAE,iBAAiB,CAAC;CAEtD"}
@@ -36,13 +36,16 @@ class m extends d {
36
36
  }
37
37
  /**
38
38
  * High level deployment function to deploy and await the contract address.
39
+ * This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,
40
+ * which makes it useless for Boost components.
41
+ * Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.
39
42
  *
40
43
  * @public
41
44
  * @async
42
45
  * @param {?Payload} [_payload]
43
46
  * @param {?DeployableOptions} [_options]
44
47
  * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - See [viem.WaitForTransactionReceipt](https://v1.viem.sh/docs/actions/public/waitForTransactionReceipt.html#waitfortransactionreceipt)
45
- * @returns {unknown}
48
+ * @returns {Promise<this>}
46
49
  */
47
50
  async deploy(t, o, a) {
48
51
  const e = (o == null ? void 0 : o.config) || this._config, r = await c(
@@ -54,6 +57,9 @@ class m extends d {
54
57
  }
55
58
  /**
56
59
  * The lower level contract deployment function that does not await for the transaction receipt.
60
+ * This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,
61
+ * which makes it useless for Boost components.
62
+ * Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.
57
63
  *
58
64
  * @public
59
65
  * @async
@@ -65,8 +71,7 @@ class m extends d {
65
71
  * @throws {@link DeployableMissingPayloadError}
66
72
  */
67
73
  async deployRaw(t, o) {
68
- if (this.address)
69
- throw new s(this.address);
74
+ if (this.address) throw new s(this.address);
70
75
  const [a, e] = this.validateDeploymentConfig(
71
76
  t,
72
77
  o
@@ -114,11 +119,11 @@ class m extends d {
114
119
  config: this._config,
115
120
  account: this._account
116
121
  };
117
- if (!a)
118
- throw new l();
122
+ if (!a) throw new l();
119
123
  return [t || this._payload, a];
120
124
  }
121
125
  }
122
126
  export {
123
127
  m as Deployable
124
128
  };
129
+ //# sourceMappingURL=Deployable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Deployable.js","sources":["../../src/Deployable/Deployable.ts"],"sourcesContent":["import { type Config, deployContract } from '@wagmi/core';\nimport type {\n Abi,\n Account,\n Address,\n ContractEventName,\n Hash,\n Hex,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableBuildParametersUnspecifiedError,\n DeployableMissingPayloadError,\n DeployableWagmiConfigurationRequiredError,\n} from '../errors';\nimport { getDeployedContractAddress } from '../utils';\nimport { Contract } from './Contract';\n\n/**\n * A base class representing a deployable contract, contains base implementations for deployment and initialization payload construction.\n *\n * @export\n * @typedef {GenericDeployableParams}\n */\nexport type GenericDeployableParams = Omit<\n Parameters<typeof deployContract>[1],\n 'args' | 'account'\n> & {\n args: [Hex, ...Array<Hex>];\n account?: Account;\n};\n\n/**\n * A generic type that encapsulates either an initialization payload for a contract, or a valid address for a previously deployed contract.\n *\n * @export\n * @typedef {DeployablePayloadOrAddress}\n * @template [Payload=unknown]\n */\nexport type DeployablePayloadOrAddress<Payload = unknown> = Payload | Address;\n\n/**\n * Instantion options for the base deployable.\n *\n * @export\n * @interface DeployableOptions\n * @typedef {DeployableOptions}\n */\nexport interface DeployableOptions {\n /**\n * [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n *\n * @see {@link Config}\n * @type {Config}\n */\n config: Config;\n /**\n * [Viem Local Account](https://viem.sh/docs/accounts/local), required if in a Node environment\n *\n * @see {@link Account}\n * @type {?Account}\n */\n account?: Account;\n}\n\n/**\n * A generic deployable contract that encapsulates common operations related to contract deployment\n *\n * @export\n * @class Deployable\n * @typedef {Deployable}\n * @template [Payload=unknown]\n * @template {Abi} [ContractAbi=[]]\n * @template {ContractEventName<ContractAbi>} [ContractEvent=ContractEventName<ContractAbi>]\n * @extends {Contract<ContractAbi, ContractEvent>}\n */\nexport class Deployable<\n Payload,\n ContractAbi extends Abi,\n> extends Contract<ContractAbi> {\n /**\n * The deployable payload used either for contract construction or initialization\n *\n * @protected\n * @type {(Payload | undefined)}\n */\n protected _payload: Payload | undefined;\n /**\n * If it exists, [Viem Local Account](https://viem.sh/docs/accounts/local), if in a Node environment\n *\n * @protected\n * @type {?Account}\n */\n protected _account?: Account;\n\n /**\n * Creates an instance of Deployable.\n *\n * @constructor\n * @param {DeployableOptions} param0\n * @param {?Account} [param0.account]\n * @param {Config} param0.config\n * @param {DeployablePayloadOrAddress<Payload>} payload\n */\n constructor(\n { account, config }: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n ) {\n if (typeof payload === 'string') {\n super(config, payload as Address);\n } else {\n super(config, undefined);\n this._payload = payload as Payload;\n }\n if (account) this._account = account;\n }\n\n /**\n * Returns the attached deployable payload, if it exists\n *\n * @readonly\n * @type {Payload}\n */\n get payload() {\n return this._payload;\n }\n\n /**\n * Attaches a new payload for use with this deployable's initialization\n *\n * @public\n * @param {Payload} payload\n * @returns {this}\n */\n public withPayload(payload: Payload) {\n this._payload = payload;\n return this;\n }\n\n /**\n * High level deployment function to deploy and await the contract address.\n * This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,\n * which makes it useless for Boost components.\n * Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - See [viem.WaitForTransactionReceipt](https://v1.viem.sh/docs/actions/public/waitForTransactionReceipt.html#waitfortransactionreceipt)\n * @returns {Promise<this>}\n */\n protected async deploy(\n _payload?: Payload,\n _options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n const config = _options?.config || this._config;\n const address = await getDeployedContractAddress(\n config,\n this.deployRaw(_payload, _options),\n waitParams,\n );\n this._address = address;\n return this;\n }\n\n /**\n * The lower level contract deployment function that does not await for the transaction receipt.\n * This is mainly a convenience method to easily deploy a contract, but will not initialize a `Cloneable`,\n * which makes it useless for Boost components.\n * Obviously you can ignore the TS warnings and use this, but you shouldn't in most all cases.\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n * @throws {@link DeployableAlreadyDeployedError}\n * @throws {@link DeployableWagmiConfigurationRequiredError}\n * @throws {@link DeployableMissingPayloadError}\n */\n protected async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return await deployContract(options.config, {\n ...this.buildParameters(payload),\n ...this.optionallyAttachAccount(options.account),\n });\n }\n\n /**\n * Internal function to attach the connected account to write methods to avoid manually passing in an account each call.\n *\n * @protected\n * @param {?Account} [account]\n * @returns {({ account: Account; } | { account?: undefined; })}\n */\n protected optionallyAttachAccount(account?: Account) {\n if (account) return { account };\n return this._account ? { account: this._account } : {};\n }\n\n /**\n * Base parameter constructor, should return a partial `viem.deployContract` parameters shape including abi, bytecode, and arguments, if any.\n * Expected to be overridden by protocol contracts.\n *\n * @public\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public buildParameters(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n throw new DeployableBuildParametersUnspecifiedError();\n }\n\n /**\n * Internal method used to ensure that a Wagmi configuration and payload are always present when deploying.\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n * @throws {@link DeployableWagmiConfigurationRequiredError}\n * @throws {@link DeployableMissingPayloadError}\n */\n protected validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const options = _options || {\n config: this._config,\n account: this._account,\n };\n if (!options) throw new DeployableWagmiConfigurationRequiredError();\n const payload = _payload || this._payload;\n return [payload, options] as [P, DeployableOptions];\n }\n}\n"],"names":["Deployable","Contract","account","config","payload","_payload","_options","waitParams","address","getDeployedContractAddress","DeployableAlreadyDeployedError","options","deployContract","DeployableBuildParametersUnspecifiedError","DeployableWagmiConfigurationRequiredError"],"mappings":";;;;AA6EO,MAAMA,UAGHC,EAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyB9B,YACE,EAAE,SAAAC,GAAS,QAAAC,EAAA,GACXC,GACA;AACI,IAAA,OAAOA,KAAY,WACrB,MAAMD,GAAQC,CAAkB,KAEhC,MAAMD,GAAQ,MAAS,GACvB,KAAK,WAAWC,IAEdF,WAAc,WAAWA;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,UAAU;AACZ,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,YAAYE,GAAkB;AACnC,gBAAK,WAAWA,GACT;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,MAAgB,OACdC,GACAC,GACAC,GACA;AACM,UAAAJ,KAASG,KAAA,gBAAAA,EAAU,WAAU,KAAK,SAClCE,IAAU,MAAMC;AAAA,MACpBN;AAAA,MACA,KAAK,UAAUE,GAAUC,CAAQ;AAAA,MACjCC;AAAA,IAAA;AAEF,gBAAK,WAAWC,GACT;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,MAAgB,UACdH,GACAC,GACe;AACf,QAAI,KAAK,QAAS,OAAM,IAAII,EAA+B,KAAK,OAAO;AACvE,UAAM,CAACN,GAASO,CAAO,IAAI,KAAK;AAAA,MAC9BN;AAAA,MACAC;AAAA,IAAA;AAEK,WAAA,MAAMM,EAAeD,EAAQ,QAAQ;AAAA,MAC1C,GAAG,KAAK,gBAAgBP,CAAO;AAAA,MAC/B,GAAG,KAAK,wBAAwBO,EAAQ,OAAO;AAAA,IAAA,CAChD;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASU,wBAAwBT,GAAmB;AAC/C,WAAAA,IAAgB,EAAE,SAAAA,MACf,KAAK,WAAW,EAAE,SAAS,KAAK,aAAa;EACtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,gBACLG,GACAC,GACyB;AACzB,UAAM,IAAIO,EAA0C;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaU,yBACRR,GACAC,GACA;AACA,UAAMK,IAAUL,KAAY;AAAA,MAC1B,QAAQ,KAAK;AAAA,MACb,SAAS,KAAK;AAAA,IAAA;AAEhB,QAAI,CAACK,EAAe,OAAA,IAAIG;AAEjB,WAAA,CADST,KAAY,KAAK,UAChBM,CAAO;AAAA,EAC1B;AACF;"}
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../generated-BaaleHW-.cjs"),d=require("@wagmi/core"),l=require("viem"),n=require("../errors.cjs"),y=require("../utils.cjs"),u=require("./Deployable.cjs"),s=class s extends u.Deployable{constructor(t,e,r){super(t,e),this.isBase=!0,r!==void 0&&(this.isBase=r)}get base(){return this.constructor.base}get registryType(){return this.constructor.registryType}async deploy(t,e,r){return await super.deploy(t,e,r),this.assertValidAddress(),this}async deployRaw(t,e){if(this.address)throw new n.DeployableAlreadyDeployedError(this.address);const r=t||this._payload,o=(e==null?void 0:e.config)||this._config,{args:h,...c}=this.buildParameters(r);return await d.deployContract(o,{...c,...this.optionallyAttachAccount(e==null?void 0:e.account),args:[]})}async supportsInterface(t,e){return i.Xn(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...e,args:[t]})}async getComponentInterface(t){return i.Kn(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...t,args:[]})}validateDeploymentConfig(t,e){const r=t||this._payload;if(!r)throw new n.DeployableMissingPayloadError;return super.validateDeploymentConfig(r,e)}};s.base=l.zeroAddress,s.registryType=y.RegistryType.ACTION;let a=s;exports.DeployableTarget=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../generated-CyTNlOwM.cjs"),u=require("@wagmi/core"),i=require("viem"),d=require("../errors.cjs"),l=require("../utils.cjs"),h=require("./Deployable.cjs"),a=class a extends h.Deployable{constructor(e,s,t){super(e,s),this._isBase=!0,typeof s=="string"&&i.isAddress(s)&&s!==i.zeroAddress&&!Object.values(this.bases).some(r=>!s||!r?!1:i.isAddressEqual(s,r))&&(t=!1),t!==void 0&&(this._isBase=t)}get isBase(){return this.address&&Object.values(this.bases).some(e=>i.isAddressEqual(this.address,e))?!0:this._isBase}get bases(){return this.constructor.bases}get registryType(){return this.constructor.registryType}async deploy(e,s,t){return await super.deploy(e,s,t),this.assertValidAddress(),this}async deployRaw(e,s){if(this.address)throw new d.DeployableAlreadyDeployedError(this.address);const t=e||this._payload,r=(s==null?void 0:s.config)||this._config,{args:y,...o}=this.buildParameters(t);return await u.deployContract(r,{...o,...this.optionallyAttachAccount(s==null?void 0:s.account),args:[]})}async supportsInterface(e,s){return await c.hi(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...s,args:[e]})}async getComponentInterface(e){return await c.Ii(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...e,args:[]})}validateDeploymentConfig(e,s){const t=e||this._payload;if(!t)throw new d.DeployableMissingPayloadError;return super.validateDeploymentConfig(t,s)}};a.bases={},a.registryType=l.RegistryType.ACTION;let n=a;exports.DeployableTarget=n;
2
+ //# sourceMappingURL=DeployableTarget.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeployableTarget.cjs","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing a map of stringified chain ID's to the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Record<string, Address>}\n */\n static readonly bases: Record<number, Address> = {};\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n readonly _isBase: boolean = true;\n public get isBase() {\n if (\n !!this.address &&\n Object.values(this.bases).some((base) =>\n // biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above\n isAddressEqual(this.address!, base),\n )\n )\n return true;\n return this._isBase;\n }\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n // if supplying a custom address, safe enough to assume it is not a base address which makes reusing contracts like budgets easier\n if (\n typeof payload === 'string' &&\n isAddress(payload) &&\n payload !== zeroAddress &&\n !Object.values(this.bases).some((base) => {\n if (!payload || !base) return false;\n return isAddressEqual(payload, base);\n })\n )\n isBase = false;\n if (isBase !== undefined) this._isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static addresses by numerical chain ID\n *\n * @public\n * @readonly\n * @type {Record<number, Address>}\n */\n public get bases(): Record<number, Address> {\n return (this.constructor as typeof DeployableTarget).bases;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<this>}\n */\n protected override async deploy(\n payload?: Payload,\n options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n await super.deploy(payload, options, waitParams);\n this.assertValidAddress();\n return this;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n */\n protected override async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const payload = _payload || this._payload;\n const config = _options?.config || this._config;\n const { args, ...deployment } = this.buildParameters(payload);\n return await deployContract(config, {\n ...deployment,\n ...this.optionallyAttachAccount(_options?.account),\n // Deployable targets don't construct with arguments, they initialize with encoded payloads\n args: [],\n });\n }\n\n /**\n * Check if the contract supports the given interface\n *\n * @public\n * @async\n * @param {Hex} interfaceId - The interface identifier\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the contract supports the interface\n */\n public async supportsInterface(\n interfaceId: Hex,\n params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,\n ) {\n return await readACloneableSupportsInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [interfaceId],\n });\n }\n\n /**\n * Return a cloneable's unique identifier for downstream consumers to differentiate various targets\n * All implementations must override this function\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Hex>}\n */\n public async getComponentInterface(\n params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,\n ) {\n return await readACloneableGetComponentInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [],\n });\n }\n\n /**\n * @inheritdoc\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n */\n protected override validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const payload = _payload || this._payload;\n if (!payload) throw new DeployableMissingPayloadError();\n return super.validateDeploymentConfig(payload, _options) as [\n P,\n DeployableOptions,\n ];\n }\n}\n"],"names":["_DeployableTarget","Deployable","options","payload","isBase","isAddress","zeroAddress","base","isAddressEqual","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","RegistryType","DeployableTarget"],"mappings":"2PAoCaA,EAAN,MAAMA,UAGHC,EAAAA,UAAiC,CA4CzC,YACEC,EACAC,EACAC,EACA,CACA,MAAMF,EAASC,CAAO,EA1BxB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AS,CAC7D,QAAS,KAAK,mBAAmB,EACjC,GAAG,KAAK,wBAAwB,EAEhC,GAAIF,EACJ,KAAM,CAAC,CAAA,CACR,CACH,CAWmB,yBACjBR,EACAC,EACA,CACM,MAAAR,EAAUO,GAAY,KAAK,SACjC,GAAI,CAACP,EAAe,MAAA,IAAIkB,EAAAA,8BACjB,OAAA,MAAM,yBAAyBlB,EAASQ,CAAQ,CAIzD,CACF,EA1LEX,EAAgB,MAAiC,GAQjDA,EAAgB,aAA6BsB,EAAa,aAAA,OAnBrD,IAAMC,EAANvB"}
@@ -13,13 +13,13 @@ import { Deployable, type DeployableOptions, type DeployablePayloadOrAddress } f
13
13
  */
14
14
  export declare class DeployableTarget<Payload, ContractAbi extends Abi> extends Deployable<Payload, ContractAbi> {
15
15
  /**
16
- * A static property representing the address of the base implementation on chain, used when cloning base contracts.
16
+ * A static property representing a map of stringified chain ID's to the address of the base implementation on chain, used when cloning base contracts.
17
17
  *
18
18
  * @static
19
19
  * @readonly
20
- * @type {Address}
20
+ * @type {Record<string, Address>}
21
21
  */
22
- static readonly base: Address;
22
+ static readonly bases: Record<number, Address>;
23
23
  /**
24
24
  * The target's registry type.
25
25
  *
@@ -34,7 +34,8 @@ export declare class DeployableTarget<Payload, ContractAbi extends Abi> extends
34
34
  * @readonly
35
35
  * @type {boolean}
36
36
  */
37
- readonly isBase: boolean;
37
+ readonly _isBase: boolean;
38
+ get isBase(): boolean;
38
39
  /**
39
40
  * Creates an instance of DeployableTarget.
40
41
  *
@@ -43,15 +44,15 @@ export declare class DeployableTarget<Payload, ContractAbi extends Abi> extends
43
44
  * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.
44
45
  * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.
45
46
  */
46
- constructor(options: DeployableOptions, payload: DeployablePayloadOrAddress<Payload>, isBase?: boolean);
47
+ constructor(options: DeployableOptions, payload?: DeployablePayloadOrAddress<Payload>, isBase?: boolean);
47
48
  /**
48
- * A getter that will return the base implementation's static address
49
+ * A getter that will return the base implementation's static addresses by numerical chain ID
49
50
  *
50
51
  * @public
51
52
  * @readonly
52
- * @type {Address}
53
+ * @type {Record<number, Address>}
53
54
  */
54
- get base(): Address;
55
+ get bases(): Record<number, Address>;
55
56
  /**
56
57
  * A getter that returns the registry type of the base implementation
57
58
  *
@@ -68,9 +69,9 @@ export declare class DeployableTarget<Payload, ContractAbi extends Abi> extends
68
69
  * @param {?Payload} [payload]
69
70
  * @param {?DeployableOptions} [options]
70
71
  * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
71
- * @returns {unknown}
72
+ * @returns {Promise<this>}
72
73
  */
73
- deploy(payload?: Payload, options?: DeployableOptions, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<this>;
74
+ protected deploy(payload?: Payload, options?: DeployableOptions, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<this>;
74
75
  /**
75
76
  * @inheritdoc
76
77
  *
@@ -80,15 +81,15 @@ export declare class DeployableTarget<Payload, ContractAbi extends Abi> extends
80
81
  * @param {?DeployableOptions} [_options]
81
82
  * @returns {Promise<Hash>}
82
83
  */
83
- deployRaw(_payload?: Payload, _options?: DeployableOptions): Promise<Hash>;
84
+ protected deployRaw(_payload?: Payload, _options?: DeployableOptions): Promise<Hash>;
84
85
  /**
85
86
  * Check if the contract supports the given interface
86
87
  *
87
88
  * @public
88
89
  * @async
89
90
  * @param {Hex} interfaceId - The interface identifier
90
- * @param {?ReadParams<typeof contractActionAbi, 'supportsInterface'>} [params]
91
- * @returns {unknown} - True if the contract supports the interface
91
+ * @param {?ReadParams} [params]
92
+ * @returns {Promise<boolean>} - True if the contract supports the interface
92
93
  */
93
94
  supportsInterface(interfaceId: Hex, params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>): Promise<boolean>;
94
95
  /**
@@ -97,8 +98,8 @@ export declare class DeployableTarget<Payload, ContractAbi extends Abi> extends
97
98
  *
98
99
  * @public
99
100
  * @async
100
- * @param {?ReadParams<typeof contractActionAbi, 'getComponentInterface'>} [params]
101
- * @returns {unknown}
101
+ * @param {?ReadParams} [params]
102
+ * @returns {Promise<Hex>}
102
103
  */
103
104
  getComponentInterface(params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>): Promise<`0x${string}`>;
104
105
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"DeployableTarget.d.ts","sourceRoot":"","sources":["../../src/Deployable/DeployableTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,GAAG,EACR,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,GAAG,EACR,KAAK,mCAAmC,EAEzC,MAAM,MAAM,CAAC;AAKd,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAChC,MAAM,cAAc,CAAC;AAEtB;;;;;;;;GAQG;AACH,qBAAa,gBAAgB,CAC3B,OAAO,EACP,WAAW,SAAS,GAAG,CACvB,SAAQ,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC;IACxC;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAe;IAC5C;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAuB;IACjE;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAQ;IAEhC;;;;;;;OAOG;gBAED,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,0BAA0B,CAAC,OAAO,CAAC,EAC5C,MAAM,CAAC,EAAE,OAAO;IAMlB;;;;;;OAMG;IACH,IAAW,IAAI,IAAI,OAAO,CAEzB;IAED;;;;;;OAMG;IACH,IAA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1,10 @@
1
- import { a as n, K as c } from "../generated-x_abr3Yv.js";
2
- import { deployContract as d } from "@wagmi/core";
3
- import { zeroAddress as y } from "viem";
4
- import { DeployableAlreadyDeployedError as l, DeployableMissingPayloadError as h } from "../errors.js";
5
- import { RegistryType as p } from "../utils.js";
6
- import { Deployable as u } from "./Deployable.js";
7
- const e = class e extends u {
1
+ import { k as d, I as c } from "../generated-CKt2yCQd.js";
2
+ import { deployContract as h } from "@wagmi/core";
3
+ import { isAddress as u, zeroAddress as l, isAddressEqual as a } from "viem";
4
+ import { DeployableAlreadyDeployedError as y, DeployableMissingPayloadError as f } from "../errors.js";
5
+ import { RegistryType as m } from "../utils.js";
6
+ import { Deployable as p } from "./Deployable.js";
7
+ const i = class i extends p {
8
8
  /**
9
9
  * Creates an instance of DeployableTarget.
10
10
  *
@@ -13,18 +13,26 @@ const e = class e extends u {
13
13
  * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.
14
14
  * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.
15
15
  */
16
- constructor(s, t, r) {
17
- super(s, t), this.isBase = !0, r !== void 0 && (this.isBase = r);
16
+ constructor(t, s, r) {
17
+ super(t, s), this._isBase = !0, typeof s == "string" && u(s) && s !== l && !Object.values(this.bases).some((e) => !s || !e ? !1 : a(s, e)) && (r = !1), r !== void 0 && (this._isBase = r);
18
+ }
19
+ get isBase() {
20
+ return this.address && Object.values(this.bases).some(
21
+ (t) => (
22
+ // biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above
23
+ a(this.address, t)
24
+ )
25
+ ) ? !0 : this._isBase;
18
26
  }
19
27
  /**
20
- * A getter that will return the base implementation's static address
28
+ * A getter that will return the base implementation's static addresses by numerical chain ID
21
29
  *
22
30
  * @public
23
31
  * @readonly
24
- * @type {Address}
32
+ * @type {Record<number, Address>}
25
33
  */
26
- get base() {
27
- return this.constructor.base;
34
+ get bases() {
35
+ return this.constructor.bases;
28
36
  }
29
37
  /**
30
38
  * A getter that returns the registry type of the base implementation
@@ -44,10 +52,10 @@ const e = class e extends u {
44
52
  * @param {?Payload} [payload]
45
53
  * @param {?DeployableOptions} [options]
46
54
  * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
47
- * @returns {unknown}
55
+ * @returns {Promise<this>}
48
56
  */
49
- async deploy(s, t, r) {
50
- return await super.deploy(s, t, r), this.assertValidAddress(), this;
57
+ async deploy(t, s, r) {
58
+ return await super.deploy(t, s, r), this.assertValidAddress(), this;
51
59
  }
52
60
  /**
53
61
  * @inheritdoc
@@ -58,13 +66,12 @@ const e = class e extends u {
58
66
  * @param {?DeployableOptions} [_options]
59
67
  * @returns {Promise<Hash>}
60
68
  */
61
- async deployRaw(s, t) {
62
- if (this.address)
63
- throw new l(this.address);
64
- const r = s || this._payload, i = (t == null ? void 0 : t.config) || this._config, { args: f, ...o } = this.buildParameters(r);
65
- return await d(i, {
66
- ...o,
67
- ...this.optionallyAttachAccount(t == null ? void 0 : t.account),
69
+ async deployRaw(t, s) {
70
+ if (this.address) throw new y(this.address);
71
+ const r = t || this._payload, e = (s == null ? void 0 : s.config) || this._config, { args: g, ...n } = this.buildParameters(r);
72
+ return await h(e, {
73
+ ...n,
74
+ ...this.optionallyAttachAccount(s == null ? void 0 : s.account),
68
75
  // Deployable targets don't construct with arguments, they initialize with encoded payloads
69
76
  args: []
70
77
  });
@@ -75,16 +82,16 @@ const e = class e extends u {
75
82
  * @public
76
83
  * @async
77
84
  * @param {Hex} interfaceId - The interface identifier
78
- * @param {?ReadParams<typeof contractActionAbi, 'supportsInterface'>} [params]
79
- * @returns {unknown} - True if the contract supports the interface
85
+ * @param {?ReadParams} [params]
86
+ * @returns {Promise<boolean>} - True if the contract supports the interface
80
87
  */
81
- async supportsInterface(s, t) {
82
- return n(this._config, {
88
+ async supportsInterface(t, s) {
89
+ return await d(this._config, {
83
90
  address: this.assertValidAddress(),
84
91
  ...this.optionallyAttachAccount(),
85
92
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
86
- ...t,
87
- args: [s]
93
+ ...s,
94
+ args: [t]
88
95
  });
89
96
  }
90
97
  /**
@@ -93,15 +100,15 @@ const e = class e extends u {
93
100
  *
94
101
  * @public
95
102
  * @async
96
- * @param {?ReadParams<typeof contractActionAbi, 'getComponentInterface'>} [params]
97
- * @returns {unknown}
103
+ * @param {?ReadParams} [params]
104
+ * @returns {Promise<Hex>}
98
105
  */
99
- async getComponentInterface(s) {
100
- return c(this._config, {
106
+ async getComponentInterface(t) {
107
+ return await c(this._config, {
101
108
  address: this.assertValidAddress(),
102
109
  ...this.optionallyAttachAccount(),
103
110
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
104
- ...s,
111
+ ...t,
105
112
  args: []
106
113
  });
107
114
  }
@@ -114,15 +121,15 @@ const e = class e extends u {
114
121
  * @param {?DeployableOptions} [_options]
115
122
  * @returns {[P, DeployableOptions]}
116
123
  */
117
- validateDeploymentConfig(s, t) {
118
- const r = s || this._payload;
119
- if (!r)
120
- throw new h();
121
- return super.validateDeploymentConfig(r, t);
124
+ validateDeploymentConfig(t, s) {
125
+ const r = t || this._payload;
126
+ if (!r) throw new f();
127
+ return super.validateDeploymentConfig(r, s);
122
128
  }
123
129
  };
124
- e.base = y, e.registryType = p.ACTION;
125
- let a = e;
130
+ i.bases = {}, i.registryType = m.ACTION;
131
+ let o = i;
126
132
  export {
127
- a as DeployableTarget
133
+ o as DeployableTarget
128
134
  };
135
+ //# sourceMappingURL=DeployableTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeployableTarget.js","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing a map of stringified chain ID's to the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Record<string, Address>}\n */\n static readonly bases: Record<number, Address> = {};\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n readonly _isBase: boolean = true;\n public get isBase() {\n if (\n !!this.address &&\n Object.values(this.bases).some((base) =>\n // biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above\n isAddressEqual(this.address!, base),\n )\n )\n return true;\n return this._isBase;\n }\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n // if supplying a custom address, safe enough to assume it is not a base address which makes reusing contracts like budgets easier\n if (\n typeof payload === 'string' &&\n isAddress(payload) &&\n payload !== zeroAddress &&\n !Object.values(this.bases).some((base) => {\n if (!payload || !base) return false;\n return isAddressEqual(payload, base);\n })\n )\n isBase = false;\n if (isBase !== undefined) this._isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static addresses by numerical chain ID\n *\n * @public\n * @readonly\n * @type {Record<number, Address>}\n */\n public get bases(): Record<number, Address> {\n return (this.constructor as typeof DeployableTarget).bases;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<this>}\n */\n protected override async deploy(\n payload?: Payload,\n options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n await super.deploy(payload, options, waitParams);\n this.assertValidAddress();\n return this;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n */\n protected override async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const payload = _payload || this._payload;\n const config = _options?.config || this._config;\n const { args, ...deployment } = this.buildParameters(payload);\n return await deployContract(config, {\n ...deployment,\n ...this.optionallyAttachAccount(_options?.account),\n // Deployable targets don't construct with arguments, they initialize with encoded payloads\n args: [],\n });\n }\n\n /**\n * Check if the contract supports the given interface\n *\n * @public\n * @async\n * @param {Hex} interfaceId - The interface identifier\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the contract supports the interface\n */\n public async supportsInterface(\n interfaceId: Hex,\n params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,\n ) {\n return await readACloneableSupportsInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [interfaceId],\n });\n }\n\n /**\n * Return a cloneable's unique identifier for downstream consumers to differentiate various targets\n * All implementations must override this function\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Hex>}\n */\n public async getComponentInterface(\n params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,\n ) {\n return await readACloneableGetComponentInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [],\n });\n }\n\n /**\n * @inheritdoc\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n */\n protected override validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const payload = _payload || this._payload;\n if (!payload) throw new DeployableMissingPayloadError();\n return super.validateDeploymentConfig(payload, _options) as [\n P,\n DeployableOptions,\n ];\n }\n}\n"],"names":["_DeployableTarget","Deployable","options","payload","isBase","isAddress","zeroAddress","base","isAddressEqual","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","RegistryType","DeployableTarget"],"mappings":";;;;;;AAoCO,MAAMA,IAAN,MAAMA,UAGHC,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4CzC,YACEC,GACAC,GACAC,GACA;AACA,UAAMF,GAASC,CAAO,GA1BxB,KAAS,UAAmB,IA6BxB,OAAOA,KAAY,YACnBE,EAAUF,CAAO,KACj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