@boostxyz/sdk 0.0.0-alpha.10

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 (242) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +7 -0
  3. package/dist/Actions/Action.cjs +2 -0
  4. package/dist/Actions/Action.cjs.map +1 -0
  5. package/dist/Actions/Action.d.ts +31 -0
  6. package/dist/Actions/Action.d.ts.map +1 -0
  7. package/dist/Actions/Action.js +29 -0
  8. package/dist/Actions/Action.js.map +1 -0
  9. package/dist/Actions/ContractAction.d.ts +370 -0
  10. package/dist/Actions/ContractAction.d.ts.map +1 -0
  11. package/dist/Actions/ERC721MintAction.d.ts +513 -0
  12. package/dist/Actions/ERC721MintAction.d.ts.map +1 -0
  13. package/dist/Actions/EventAction.cjs +2 -0
  14. package/dist/Actions/EventAction.cjs.map +1 -0
  15. package/dist/Actions/EventAction.d.ts +694 -0
  16. package/dist/Actions/EventAction.d.ts.map +1 -0
  17. package/dist/Actions/EventAction.js +491 -0
  18. package/dist/Actions/EventAction.js.map +1 -0
  19. package/dist/AllowLists/AllowList.cjs +2 -0
  20. package/dist/AllowLists/AllowList.cjs.map +1 -0
  21. package/dist/AllowLists/AllowList.d.ts +32 -0
  22. package/dist/AllowLists/AllowList.d.ts.map +1 -0
  23. package/dist/AllowLists/AllowList.js +30 -0
  24. package/dist/AllowLists/AllowList.js.map +1 -0
  25. package/dist/AllowLists/SimpleAllowList.cjs +2 -0
  26. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
  27. package/dist/AllowLists/SimpleAllowList.d.ts +481 -0
  28. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -0
  29. package/dist/AllowLists/SimpleAllowList.js +154 -0
  30. package/dist/AllowLists/SimpleAllowList.js.map +1 -0
  31. package/dist/AllowLists/SimpleDenyList.cjs +2 -0
  32. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
  33. package/dist/AllowLists/SimpleDenyList.d.ts +335 -0
  34. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -0
  35. package/dist/AllowLists/SimpleDenyList.js +115 -0
  36. package/dist/AllowLists/SimpleDenyList.js.map +1 -0
  37. package/dist/Auth/Auth.cjs +2 -0
  38. package/dist/Auth/Auth.cjs.map +1 -0
  39. package/dist/Auth/Auth.d.ts +10 -0
  40. package/dist/Auth/Auth.d.ts.map +1 -0
  41. package/dist/Auth/Auth.js +5 -0
  42. package/dist/Auth/Auth.js.map +1 -0
  43. package/dist/Auth/PassthroughAuth.cjs +2 -0
  44. package/dist/Auth/PassthroughAuth.cjs.map +1 -0
  45. package/dist/Auth/PassthroughAuth.d.ts +51 -0
  46. package/dist/Auth/PassthroughAuth.d.ts.map +1 -0
  47. package/dist/Auth/PassthroughAuth.js +39 -0
  48. package/dist/Auth/PassthroughAuth.js.map +1 -0
  49. package/dist/Boost.cjs +2 -0
  50. package/dist/Boost.cjs.map +1 -0
  51. package/dist/Boost.d.ts +234 -0
  52. package/dist/Boost.d.ts.map +1 -0
  53. package/dist/Boost.js +162 -0
  54. package/dist/Boost.js.map +1 -0
  55. package/dist/BoostCore.cjs +3 -0
  56. package/dist/BoostCore.cjs.map +1 -0
  57. package/dist/BoostCore.d.ts +498 -0
  58. package/dist/BoostCore.d.ts.map +1 -0
  59. package/dist/BoostCore.js +1153 -0
  60. package/dist/BoostCore.js.map +1 -0
  61. package/dist/BoostRegistry.cjs +2 -0
  62. package/dist/BoostRegistry.cjs.map +1 -0
  63. package/dist/BoostRegistry.d.ts +243 -0
  64. package/dist/BoostRegistry.d.ts.map +1 -0
  65. package/dist/BoostRegistry.js +262 -0
  66. package/dist/BoostRegistry.js.map +1 -0
  67. package/dist/Budgets/Budget.cjs +2 -0
  68. package/dist/Budgets/Budget.cjs.map +1 -0
  69. package/dist/Budgets/Budget.d.ts +31 -0
  70. package/dist/Budgets/Budget.d.ts.map +1 -0
  71. package/dist/Budgets/Budget.js +29 -0
  72. package/dist/Budgets/Budget.js.map +1 -0
  73. package/dist/Budgets/ManagedBudget.cjs +2 -0
  74. package/dist/Budgets/ManagedBudget.cjs.map +1 -0
  75. package/dist/Budgets/ManagedBudget.d.ts +1103 -0
  76. package/dist/Budgets/ManagedBudget.d.ts.map +1 -0
  77. package/dist/Budgets/ManagedBudget.js +516 -0
  78. package/dist/Budgets/ManagedBudget.js.map +1 -0
  79. package/dist/Budgets/SimpleBudget.d.ts +824 -0
  80. package/dist/Budgets/SimpleBudget.d.ts.map +1 -0
  81. package/dist/Budgets/VestingBudget.d.ts +778 -0
  82. package/dist/Budgets/VestingBudget.d.ts.map +1 -0
  83. package/dist/Deployable/Contract.cjs +2 -0
  84. package/dist/Deployable/Contract.cjs.map +1 -0
  85. package/dist/Deployable/Contract.d.ts +125 -0
  86. package/dist/Deployable/Contract.d.ts.map +1 -0
  87. package/dist/Deployable/Contract.js +150 -0
  88. package/dist/Deployable/Contract.js.map +1 -0
  89. package/dist/Deployable/Deployable.cjs +2 -0
  90. package/dist/Deployable/Deployable.cjs.map +1 -0
  91. package/dist/Deployable/Deployable.d.ts +161 -0
  92. package/dist/Deployable/Deployable.d.ts.map +1 -0
  93. package/dist/Deployable/Deployable.js +131 -0
  94. package/dist/Deployable/Deployable.js.map +1 -0
  95. package/dist/Deployable/DeployableTarget.cjs +2 -0
  96. package/dist/Deployable/DeployableTarget.cjs.map +1 -0
  97. package/dist/Deployable/DeployableTarget.d.ts +116 -0
  98. package/dist/Deployable/DeployableTarget.d.ts.map +1 -0
  99. package/dist/Deployable/DeployableTarget.js +132 -0
  100. package/dist/Deployable/DeployableTarget.js.map +1 -0
  101. package/dist/Incentives/AllowListIncentive.cjs +2 -0
  102. package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
  103. package/dist/Incentives/AllowListIncentive.d.ts +513 -0
  104. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -0
  105. package/dist/Incentives/AllowListIncentive.js +201 -0
  106. package/dist/Incentives/AllowListIncentive.js.map +1 -0
  107. package/dist/Incentives/CGDAIncentive.cjs +2 -0
  108. package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
  109. package/dist/Incentives/CGDAIncentive.d.ts +644 -0
  110. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -0
  111. package/dist/Incentives/CGDAIncentive.js +271 -0
  112. package/dist/Incentives/CGDAIncentive.js.map +1 -0
  113. package/dist/Incentives/ERC1155Incentive.d.ts +713 -0
  114. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -0
  115. package/dist/Incentives/ERC20Incentive.cjs +2 -0
  116. package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
  117. package/dist/Incentives/ERC20Incentive.d.ts +666 -0
  118. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -0
  119. package/dist/Incentives/ERC20Incentive.js +312 -0
  120. package/dist/Incentives/ERC20Incentive.js.map +1 -0
  121. package/dist/Incentives/ERC20VariableIncentive.d.ts +582 -0
  122. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -0
  123. package/dist/Incentives/Incentive.cjs +2 -0
  124. package/dist/Incentives/Incentive.cjs.map +1 -0
  125. package/dist/Incentives/Incentive.d.ts +36 -0
  126. package/dist/Incentives/Incentive.d.ts.map +1 -0
  127. package/dist/Incentives/Incentive.js +299 -0
  128. package/dist/Incentives/Incentive.js.map +1 -0
  129. package/dist/Incentives/PointsIncentive.cjs +2 -0
  130. package/dist/Incentives/PointsIncentive.cjs.map +1 -0
  131. package/dist/Incentives/PointsIncentive.d.ts +659 -0
  132. package/dist/Incentives/PointsIncentive.d.ts.map +1 -0
  133. package/dist/Incentives/PointsIncentive.js +215 -0
  134. package/dist/Incentives/PointsIncentive.js.map +1 -0
  135. package/dist/Validators/SignerValidator.cjs +2 -0
  136. package/dist/Validators/SignerValidator.cjs.map +1 -0
  137. package/dist/Validators/SignerValidator.d.ts +745 -0
  138. package/dist/Validators/SignerValidator.d.ts.map +1 -0
  139. package/dist/Validators/SignerValidator.js +293 -0
  140. package/dist/Validators/SignerValidator.js.map +1 -0
  141. package/dist/Validators/Validator.cjs +2 -0
  142. package/dist/Validators/Validator.cjs.map +1 -0
  143. package/dist/Validators/Validator.d.ts +31 -0
  144. package/dist/Validators/Validator.d.ts.map +1 -0
  145. package/dist/Validators/Validator.js +27 -0
  146. package/dist/Validators/Validator.js.map +1 -0
  147. package/dist/claiming.cjs +2 -0
  148. package/dist/claiming.cjs.map +1 -0
  149. package/dist/claiming.d.ts +43 -0
  150. package/dist/claiming.d.ts.map +1 -0
  151. package/dist/claiming.js +17 -0
  152. package/dist/claiming.js.map +1 -0
  153. package/dist/componentInterfaces-CKCBwG16.cjs +2 -0
  154. package/dist/componentInterfaces-CKCBwG16.cjs.map +1 -0
  155. package/dist/componentInterfaces-DYkaxBda.js +13 -0
  156. package/dist/componentInterfaces-DYkaxBda.js.map +1 -0
  157. package/dist/errors.cjs +2 -0
  158. package/dist/errors.cjs.map +1 -0
  159. package/dist/errors.d.ts +441 -0
  160. package/dist/errors.d.ts.map +1 -0
  161. package/dist/errors.js +262 -0
  162. package/dist/errors.js.map +1 -0
  163. package/dist/generated-BDeDiaCK.js +4625 -0
  164. package/dist/generated-BDeDiaCK.js.map +1 -0
  165. package/dist/generated-wKBNvm48.cjs +3 -0
  166. package/dist/generated-wKBNvm48.cjs.map +1 -0
  167. package/dist/index.cjs +2 -0
  168. package/dist/index.cjs.map +1 -0
  169. package/dist/index.d.ts +25 -0
  170. package/dist/index.d.ts.map +1 -0
  171. package/dist/index.js +113 -0
  172. package/dist/index.js.map +1 -0
  173. package/dist/transfers.cjs +2 -0
  174. package/dist/transfers.cjs.map +1 -0
  175. package/dist/transfers.d.ts +198 -0
  176. package/dist/transfers.d.ts.map +1 -0
  177. package/dist/transfers.js +84 -0
  178. package/dist/transfers.js.map +1 -0
  179. package/dist/utils.cjs +2 -0
  180. package/dist/utils.cjs.map +1 -0
  181. package/dist/utils.d.ts +116 -0
  182. package/dist/utils.d.ts.map +1 -0
  183. package/dist/utils.js +30 -0
  184. package/dist/utils.js.map +1 -0
  185. package/package.json +211 -0
  186. package/src/Actions/Action.test.ts +75 -0
  187. package/src/Actions/Action.ts +61 -0
  188. package/src/Actions/ContractAction.test.ts +197 -0
  189. package/src/Actions/ContractAction.ts +301 -0
  190. package/src/Actions/ERC721MintAction.test.ts +112 -0
  191. package/src/Actions/ERC721MintAction.ts +292 -0
  192. package/src/Actions/EventAction.test.ts +205 -0
  193. package/src/Actions/EventAction.ts +811 -0
  194. package/src/AllowLists/AllowList.test.ts +64 -0
  195. package/src/AllowLists/AllowList.ts +60 -0
  196. package/src/AllowLists/SimpleAllowList.test.ts +52 -0
  197. package/src/AllowLists/SimpleAllowList.ts +284 -0
  198. package/src/AllowLists/SimpleDenyList.test.ts +52 -0
  199. package/src/AllowLists/SimpleDenyList.ts +227 -0
  200. package/src/Auth/Auth.ts +11 -0
  201. package/src/Auth/PassthroughAuth.test.ts +12 -0
  202. package/src/Auth/PassthroughAuth.ts +80 -0
  203. package/src/Boost.ts +290 -0
  204. package/src/BoostCore.test.ts +773 -0
  205. package/src/BoostCore.ts +1261 -0
  206. package/src/BoostRegistry.ts +467 -0
  207. package/src/Budgets/Budget.test.ts +27 -0
  208. package/src/Budgets/Budget.ts +61 -0
  209. package/src/Budgets/ManagedBudget.test.ts +154 -0
  210. package/src/Budgets/ManagedBudget.ts +796 -0
  211. package/src/Budgets/SimpleBudget.test.ts +152 -0
  212. package/src/Budgets/SimpleBudget.ts +564 -0
  213. package/src/Budgets/VestingBudget.test.ts +123 -0
  214. package/src/Budgets/VestingBudget.ts +602 -0
  215. package/src/Deployable/Contract.ts +229 -0
  216. package/src/Deployable/Deployable.ts +250 -0
  217. package/src/Deployable/DeployableTarget.ts +223 -0
  218. package/src/Incentives/AllowListIncentive.test.ts +143 -0
  219. package/src/Incentives/AllowListIncentive.ts +334 -0
  220. package/src/Incentives/CGDAIncentive.test.ts +132 -0
  221. package/src/Incentives/CGDAIncentive.ts +468 -0
  222. package/src/Incentives/ERC1155Incentive.test.ts +87 -0
  223. package/src/Incentives/ERC1155Incentive.ts +466 -0
  224. package/src/Incentives/ERC20Incentive.test.ts +130 -0
  225. package/src/Incentives/ERC20Incentive.ts +482 -0
  226. package/src/Incentives/ERC20VariableIncentive.test.ts +136 -0
  227. package/src/Incentives/ERC20VariableIncentive.ts +420 -0
  228. package/src/Incentives/Incentive.test.ts +92 -0
  229. package/src/Incentives/Incentive.ts +85 -0
  230. package/src/Incentives/PointsIncentive.test.ts +139 -0
  231. package/src/Incentives/PointsIncentive.ts +365 -0
  232. package/src/Validators/SignerValidator.test.ts +159 -0
  233. package/src/Validators/SignerValidator.ts +681 -0
  234. package/src/Validators/Validator.test.ts +21 -0
  235. package/src/Validators/Validator.ts +55 -0
  236. package/src/claiming.ts +56 -0
  237. package/src/errors.ts +542 -0
  238. package/src/index.test.ts +40 -0
  239. package/src/index.ts +53 -0
  240. package/src/transfers.ts +284 -0
  241. package/src/utils.test.ts +44 -0
  242. package/src/utils.ts +198 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VestingBudget.d.ts","sourceRoot":"","sources":["../../src/Budgets/VestingBudget.ts"],"names":[],"mappings":"AAAA,OAAO,EAeL,gBAAgB,EAMjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,EAKvB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,YAAY,EACZ,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,YAAY,EAAE,uBAAuB,EAAE,CAAC;AACxC;;;;;;GAMG;AACH,MAAM,WAAW,oBAAo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,EAAE,iBAAiB,GAC3B,uBAAuB;CAwB3B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,KAAK,EACL,UAAU,EACV,KAAK,EACL,QAAQ,EACR,KAAK,GACN,EAAE,oBAAoB,iBAQtB"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@wagmi/core"),i=require("viem"),o=require("viem/actions"),d=require("../errors.cjs"),c=require("../utils.cjs");class h{constructor(e,t){this._config=e,this._address=t}get address(){return this._address}at(e){return this._address=e,this}withConfig(e){return this._config=e,this}assertValidAddress(){const e=this.address;if(!e)throw new d.ContractAddressRequiredError;return e}async getLogs(e){return o.getLogs(this._config.getClient({chainId:e==null?void 0:e.chainId}),{...e,...e!=null&&e.eventName?{event:i.getAbiItem({abi:this.abi,name:e.eventName})}:{},...e!=null&&e.eventNames?{events:e.eventNames.map(t=>i.getAbiItem({abi:this.abi,name:t}))}:{},address:this.assertValidAddress()})}async subscribe(e,t){return r.watchContractEvent(this._config,{...t,eventName:t==null?void 0:t.eventName,abi:this.abi,address:this.assertValidAddress(),onLogs:s=>{for(let n of s)e(n)}})}async awaitResult(e,t){return await c.awaitResult(this._config,e,t)}}exports.Contract=h;
2
+ //# sourceMappingURL=Contract.cjs.map
@@ -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 {*}\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 * @async\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 {unknown, params?: any) => unknown}\n */\n public async 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 {unknown}\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,EAAS,MAAM,IAAIC,EAA6B,6BAC9C,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,CAgBA,MAAa,UACXC,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"}
@@ -0,0 +1,125 @@
1
+ import { type Config } from '@wagmi/core';
2
+ import type { ExtractAbiEvent } from 'abitype';
3
+ import { type Abi, type Address, type ContractEventName, type GetLogsReturnType, type WaitForTransactionReceiptParameters, type WatchContractEventOnLogsParameter } from 'viem';
4
+ import { type GetLogsParams, type HashAndSimulatedResult, type WatchParams } from '../utils';
5
+ /**
6
+ * A basic Contract class to encapsulate configuration and a potential address
7
+ *
8
+ * @export
9
+ * @class Contract
10
+ * @typedef {Contract}
11
+ * @template {Abi} [ContractAbi=[]]
12
+ * @template {ContractEventName<ContractAbi>} [ContractEvent=any]
13
+ */
14
+ export declare class Contract<ContractAbi extends Abi> {
15
+ readonly abi: ContractAbi;
16
+ /**
17
+ * @see [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)
18
+ * @protected
19
+ * @type {WagmiConfig}
20
+ */
21
+ protected _config: Config;
22
+ /**
23
+ * The internally managed address for this contract
24
+ *
25
+ * @protected
26
+ * @type {(Address | undefined)}
27
+ */
28
+ protected _address: Address | undefined;
29
+ /**
30
+ * Creates an instance of Contract.
31
+ *
32
+ * @constructor
33
+ * @param {Config} config
34
+ * @param {(Address | undefined)} address
35
+ */
36
+ constructor(config: Config, address: Address | undefined);
37
+ /**
38
+ * A getter returning this contract's deployed address, if it exists.
39
+ *
40
+ * @public
41
+ * @readonly
42
+ * @type {*}
43
+ */
44
+ get address(): `0x${string}` | undefined;
45
+ /**
46
+ * Will set this contract's address and return the instance for chaining. Does not verify that provided address is valid.
47
+ *
48
+ * @public
49
+ * @param {Address} address
50
+ * @returns {this}
51
+ */
52
+ at(address: Address): this;
53
+ /**
54
+ * Will set this contract's internal [Wagmi Configuration](https://en.wikipedia.org/wiki/Factorial) and return the instance for chaining.
55
+ *
56
+ * @public
57
+ * @param {Config} config
58
+ * @returns {this}
59
+ */
60
+ withConfig(config: Config): this;
61
+ /**
62
+ * Utility function to validate the existence of an address on this Contract.
63
+ *
64
+ * @public
65
+ * @returns {Address}
66
+ * @throws {@link ContractAddressRequiredError} if no address exists on this Contract instance
67
+ */
68
+ assertValidAddress(): `0x${string}`;
69
+ /**
70
+ * A typed wrapper for (viem.getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs].
71
+ * Accepts `eventName` and `eventNames` as optional parameters to narrow the returned log types.
72
+ * @example
73
+ * ```ts
74
+ * const logs = contract.getLogs({ eventName: 'EventName' })
75
+ * const logs = contract.getLogs({ eventNames: ['EventName'] })
76
+ *
77
+ * @public
78
+ * @async
79
+ * @template {ContractEvent} event
80
+ * @template {ExtractAbiEvent<
81
+ * ContractAbi,
82
+ * event
83
+ * >} [abiEvent=ExtractAbiEvent<ContractAbi, event>]
84
+ * @param {?Omit<
85
+ * GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,
86
+ * 'event' | 'events'
87
+ * > & {
88
+ * eventName?: event;
89
+ * eventNames?: event[];
90
+ * }} [params]
91
+ * @returns {Promise<GetLogsReturnType<abiEvent, abiEvent[]>>}
92
+ */
93
+ getLogs<event extends ContractEventName<ContractAbi>, const abiEvent extends ExtractAbiEvent<ContractAbi, event> = ExtractAbiEvent<ContractAbi, event>>(params?: Omit<GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>, 'event' | 'events'> & {
94
+ eventName?: event;
95
+ eventNames?: event[];
96
+ }): Promise<GetLogsReturnType<abiEvent, abiEvent[]>>;
97
+ /**
98
+ * A typed wrapper for `wagmi.watchContractEvent`
99
+ *
100
+ * @public
101
+ * @async
102
+ * @template {ContractEvent} event
103
+ * @param {(
104
+ * log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],
105
+ * ) => unknown} cb
106
+ * @param {?WatchParams<ContractAbi, event> & {
107
+ * eventName?: event;
108
+ * }} [params]
109
+ * @returns {unknown, params?: any) => unknown}
110
+ */
111
+ subscribe<event extends ContractEventName<ContractAbi>>(cb: (log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number]) => unknown, params?: WatchParams<ContractAbi, event> & {
112
+ eventName?: event;
113
+ }): Promise<() => void>;
114
+ /**
115
+ * @see {@link awaitResult}
116
+ * @protected
117
+ * @async
118
+ * @template [Result=unknown]
119
+ * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise
120
+ * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
121
+ * @returns {unknown}
122
+ */
123
+ protected awaitResult<Result = unknown>(hashPromise: Promise<HashAndSimulatedResult<Result>>, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<Result>;
124
+ }
125
+ //# sourceMappingURL=Contract.d.ts.map
@@ -0,0 +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,EAC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EACZ,MAAM,CAAC,EAAE,WAAW,CAAC,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"}
@@ -0,0 +1,150 @@
1
+ import { watchContractEvent as o } from "@wagmi/core";
2
+ import { getAbiItem as i } from "viem";
3
+ import { getLogs as d } from "viem/actions";
4
+ import { ContractAddressRequiredError as r } from "../errors.js";
5
+ import { awaitResult as h } from "../utils.js";
6
+ class v {
7
+ /**
8
+ * Creates an instance of Contract.
9
+ *
10
+ * @constructor
11
+ * @param {Config} config
12
+ * @param {(Address | undefined)} address
13
+ */
14
+ constructor(t, e) {
15
+ this._config = t, this._address = e;
16
+ }
17
+ /**
18
+ * A getter returning this contract's deployed address, if it exists.
19
+ *
20
+ * @public
21
+ * @readonly
22
+ * @type {*}
23
+ */
24
+ get address() {
25
+ return this._address;
26
+ }
27
+ /**
28
+ * Will set this contract's address and return the instance for chaining. Does not verify that provided address is valid.
29
+ *
30
+ * @public
31
+ * @param {Address} address
32
+ * @returns {this}
33
+ */
34
+ at(t) {
35
+ return this._address = t, this;
36
+ }
37
+ /**
38
+ * Will set this contract's internal [Wagmi Configuration](https://en.wikipedia.org/wiki/Factorial) and return the instance for chaining.
39
+ *
40
+ * @public
41
+ * @param {Config} config
42
+ * @returns {this}
43
+ */
44
+ withConfig(t) {
45
+ return this._config = t, this;
46
+ }
47
+ /**
48
+ * Utility function to validate the existence of an address on this Contract.
49
+ *
50
+ * @public
51
+ * @returns {Address}
52
+ * @throws {@link ContractAddressRequiredError} if no address exists on this Contract instance
53
+ */
54
+ assertValidAddress() {
55
+ const t = this.address;
56
+ if (!t)
57
+ throw new r();
58
+ return t;
59
+ }
60
+ /**
61
+ * A typed wrapper for (viem.getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs].
62
+ * Accepts `eventName` and `eventNames` as optional parameters to narrow the returned log types.
63
+ * @example
64
+ * ```ts
65
+ * const logs = contract.getLogs({ eventName: 'EventName' })
66
+ * const logs = contract.getLogs({ eventNames: ['EventName'] })
67
+ *
68
+ * @public
69
+ * @async
70
+ * @template {ContractEvent} event
71
+ * @template {ExtractAbiEvent<
72
+ * ContractAbi,
73
+ * event
74
+ * >} [abiEvent=ExtractAbiEvent<ContractAbi, event>]
75
+ * @param {?Omit<
76
+ * GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,
77
+ * 'event' | 'events'
78
+ * > & {
79
+ * eventName?: event;
80
+ * eventNames?: event[];
81
+ * }} [params]
82
+ * @returns {Promise<GetLogsReturnType<abiEvent, abiEvent[]>>}
83
+ */
84
+ async getLogs(t) {
85
+ return d(this._config.getClient({ chainId: t == null ? void 0 : t.chainId }), {
86
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wag
87
+ ...t,
88
+ ...t != null && t.eventName ? {
89
+ event: i({
90
+ abi: this.abi,
91
+ name: t.eventName
92
+ // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue
93
+ })
94
+ } : {},
95
+ ...t != null && t.eventNames ? {
96
+ events: t.eventNames.map(
97
+ (e) => i({
98
+ abi: this.abi,
99
+ name: e
100
+ // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue
101
+ })
102
+ )
103
+ } : {},
104
+ address: this.assertValidAddress()
105
+ });
106
+ }
107
+ /**
108
+ * A typed wrapper for `wagmi.watchContractEvent`
109
+ *
110
+ * @public
111
+ * @async
112
+ * @template {ContractEvent} event
113
+ * @param {(
114
+ * log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],
115
+ * ) => unknown} cb
116
+ * @param {?WatchParams<ContractAbi, event> & {
117
+ * eventName?: event;
118
+ * }} [params]
119
+ * @returns {unknown, params?: any) => unknown}
120
+ */
121
+ async subscribe(t, e) {
122
+ return o(this._config, {
123
+ // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
124
+ ...e,
125
+ eventName: e == null ? void 0 : e.eventName,
126
+ abi: this.abi,
127
+ address: this.assertValidAddress(),
128
+ onLogs: (s) => {
129
+ for (let n of s)
130
+ t(n);
131
+ }
132
+ });
133
+ }
134
+ /**
135
+ * @see {@link awaitResult}
136
+ * @protected
137
+ * @async
138
+ * @template [Result=unknown]
139
+ * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise
140
+ * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
141
+ * @returns {unknown}
142
+ */
143
+ async awaitResult(t, e) {
144
+ return await h(this._config, t, e);
145
+ }
146
+ }
147
+ export {
148
+ v as Contract
149
+ };
150
+ //# 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 {*}\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 * @async\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 {unknown, params?: any) => unknown}\n */\n public async 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 {unknown}\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,EASA,IAAW,UAAU;AACnB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,GAAGA,GAAkB;AAC1B,gBAAK,WAAWA,GACT;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,WAAWD,GAAgB;AAChC,gBAAK,UAAUA,GACR;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,qBAAqB;AAC1B,UAAMC,IAAU,KAAK;AACrB,QAAI,CAACA;AAAS,YAAM,IAAIC,EAA6B;AAC9C,WAAAD;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BA,MAAa,QAOXE,GAOkD;AAC3C,WAAAC,EAAQ,KAAK,QAAQ,UAAU,EAAE,SAASD,KAAA,gBAAAA,EAAQ,QAAQ,CAAC,GAAG;AAAA;AAAA,MAEnE,GAAIA;AAAA,MACJ,GAAIA,KAAA,QAAAA,EAAQ,YACR;AAAA,QACE,OAAOE,EAAW;AAAA,UAChB,KAAK,KAAK;AAAA,UACV,MAAMF,EAAO;AAAA;AAAA,QAAA,CAEP;AAAA,MAAA,IAEV,CAAC;AAAA,MACL,GAAIA,KAAA,QAAAA,EAAQ,aACR;AAAA,QACE,QAAQA,EAAO,WAAW;AAAA,UAAI,CAACG,MAC7BD,EAAW;AAAA,YACT,KAAK,KAAK;AAAA,YACV,MAAAC;AAAA;AAAA,UAAA,CAEM;AAAA,QACV;AAAA,MAAA,IAEF,CAAC;AAAA,MACL,SAAS,KAAK,mBAAmB;AAAA,IAAA,CAClC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAa,UACXC,GAGAJ,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;"}
@@ -0,0 +1,2 @@
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 {unknown}\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,IAAS,KAAK,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,QAAe,MAAA,IAAII,EAA+B,+BAAA,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,CAAQ,EACvB,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,EAAS,MAAM,IAAIG,EAA0C,0CAE3D,MAAA,CADST,GAAY,KAAK,SAChBM,CAAO,CAC1B,CACF"}
@@ -0,0 +1,161 @@
1
+ import { type Config, deployContract } from '@wagmi/core';
2
+ import type { Abi, Account, Address, Hash, Hex, WaitForTransactionReceiptParameters } from 'viem';
3
+ import { Contract } from './Contract';
4
+ /**
5
+ * A base class representing a deployable contract, contains base implementations for deployment and initialization payload construction.
6
+ *
7
+ * @export
8
+ * @typedef {GenericDeployableParams}
9
+ */
10
+ export type GenericDeployableParams = Omit<Parameters<typeof deployContract>[1], 'args' | 'account'> & {
11
+ args: [Hex, ...Array<Hex>];
12
+ account?: Account;
13
+ };
14
+ /**
15
+ * A generic type that encapsulates either an initialization payload for a contract, or a valid address for a previously deployed contract.
16
+ *
17
+ * @export
18
+ * @typedef {DeployablePayloadOrAddress}
19
+ * @template [Payload=unknown]
20
+ */
21
+ export type DeployablePayloadOrAddress<Payload = unknown> = Payload | Address;
22
+ /**
23
+ * Instantion options for the base deployable.
24
+ *
25
+ * @export
26
+ * @interface DeployableOptions
27
+ * @typedef {DeployableOptions}
28
+ */
29
+ export interface DeployableOptions {
30
+ /**
31
+ * [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)
32
+ *
33
+ * @see {@link Config}
34
+ * @type {Config}
35
+ */
36
+ config: Config;
37
+ /**
38
+ * [Viem Local Account](https://viem.sh/docs/accounts/local), required if in a Node environment
39
+ *
40
+ * @see {@link Account}
41
+ * @type {?Account}
42
+ */
43
+ account?: Account;
44
+ }
45
+ /**
46
+ * A generic deployable contract that encapsulates common operations related to contract deployment
47
+ *
48
+ * @export
49
+ * @class Deployable
50
+ * @typedef {Deployable}
51
+ * @template [Payload=unknown]
52
+ * @template {Abi} [ContractAbi=[]]
53
+ * @template {ContractEventName<ContractAbi>} [ContractEvent=ContractEventName<ContractAbi>]
54
+ * @extends {Contract<ContractAbi, ContractEvent>}
55
+ */
56
+ export declare class Deployable<Payload, ContractAbi extends Abi> extends Contract<ContractAbi> {
57
+ /**
58
+ * The deployable payload used either for contract construction or initialization
59
+ *
60
+ * @protected
61
+ * @type {(Payload | undefined)}
62
+ */
63
+ protected _payload: Payload | undefined;
64
+ /**
65
+ * If it exists, [Viem Local Account](https://viem.sh/docs/accounts/local), if in a Node environment
66
+ *
67
+ * @protected
68
+ * @type {?Account}
69
+ */
70
+ protected _account?: Account;
71
+ /**
72
+ * Creates an instance of Deployable.
73
+ *
74
+ * @constructor
75
+ * @param {DeployableOptions} param0
76
+ * @param {?Account} [param0.account]
77
+ * @param {Config} param0.config
78
+ * @param {DeployablePayloadOrAddress<Payload>} payload
79
+ */
80
+ constructor({ account, config }: DeployableOptions, payload?: DeployablePayloadOrAddress<Payload>);
81
+ /**
82
+ * Returns the attached deployable payload, if it exists
83
+ *
84
+ * @readonly
85
+ * @type {Payload}
86
+ */
87
+ get payload(): Payload | undefined;
88
+ /**
89
+ * Attaches a new payload for use with this deployable's initialization
90
+ *
91
+ * @public
92
+ * @param {Payload} payload
93
+ * @returns {this}
94
+ */
95
+ withPayload(payload: Payload): this;
96
+ /**
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.
101
+ *
102
+ * @public
103
+ * @async
104
+ * @param {?Payload} [_payload]
105
+ * @param {?DeployableOptions} [_options]
106
+ * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - See [viem.WaitForTransactionReceipt](https://v1.viem.sh/docs/actions/public/waitForTransactionReceipt.html#waitfortransactionreceipt)
107
+ * @returns {unknown}
108
+ */
109
+ protected deploy(_payload?: Payload, _options?: DeployableOptions, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<this>;
110
+ /**
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.
115
+ *
116
+ * @public
117
+ * @async
118
+ * @param {?Payload} [_payload]
119
+ * @param {?DeployableOptions} [_options]
120
+ * @returns {Promise<Hash>}
121
+ * @throws {@link DeployableAlreadyDeployedError}
122
+ * @throws {@link DeployableWagmiConfigurationRequiredError}
123
+ * @throws {@link DeployableMissingPayloadError}
124
+ */
125
+ protected deployRaw(_payload?: Payload, _options?: DeployableOptions): Promise<Hash>;
126
+ /**
127
+ * Internal function to attach the connected account to write methods to avoid manually passing in an account each call.
128
+ *
129
+ * @protected
130
+ * @param {?Account} [account]
131
+ * @returns {({ account: Account; } | { account?: undefined; })}
132
+ */
133
+ protected optionallyAttachAccount(account?: Account): {
134
+ account: Account;
135
+ } | {
136
+ account?: undefined;
137
+ };
138
+ /**
139
+ * Base parameter constructor, should return a partial `viem.deployContract` parameters shape including abi, bytecode, and arguments, if any.
140
+ * Expected to be overridden by protocol contracts.
141
+ *
142
+ * @public
143
+ * @param {?Payload} [_payload]
144
+ * @param {?DeployableOptions} [_options]
145
+ * @returns {GenericDeployableParams}
146
+ */
147
+ buildParameters(_payload?: Payload, _options?: DeployableOptions): GenericDeployableParams;
148
+ /**
149
+ * Internal method used to ensure that a Wagmi configuration and payload are always present when deploying.
150
+ *
151
+ * @protected
152
+ * @template [P=Payload]
153
+ * @param {?P} [_payload]
154
+ * @param {?DeployableOptions} [_options]
155
+ * @returns {[P, DeployableOptions]}
156
+ * @throws {@link DeployableWagmiConfigurationRequiredError}
157
+ * @throws {@link DeployableMissingPayloadError}
158
+ */
159
+ protected validateDeploymentConfig<P = Payload>(_payload?: P, _options?: DeployableOptions): [P, DeployableOptions];
160
+ }
161
+ //# sourceMappingURL=Deployable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Deployable.d.ts","sourceRoot":"","sources":["../../src/Deployable/Deployable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EACV,GAAG,EACH,OAAO,EACP,OAAO,EAEP,IAAI,EACJ,GAAG,EACH,mCAAmC,EACpC,MAAM,MAAM,CAAC;AAQd,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,EACpC,MAAM,GAAG,SAAS,CACnB,GAAG;IACF,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,CAAC,OAAO,GAAG,OAAO,IAAI,OAAO,GAAG,OAAO,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,UAAU,CACrB,OAAO,EACP,WAAW,SAAS,GAAG,CACvB,SAAQ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