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

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 +77 -77
  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 +111 -1
  48. package/dist/Boost.d.ts.map +1 -1
  49. package/dist/Boost.js +140 -5
  50. package/dist/Boost.js.map +1 -0
  51. package/dist/BoostCore-3-U1xTQN.cjs +3 -0
  52. package/dist/BoostCore-3-U1xTQN.cjs.map +1 -0
  53. package/dist/BoostCore-DVGBUr2y.js +1477 -0
  54. package/dist/BoostCore-DVGBUr2y.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 +166 -43
  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 +64 -23
  64. package/dist/BoostRegistry.d.ts.map +1 -1
  65. package/dist/BoostRegistry.js +162 -88
  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 +78 -188
  76. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  77. package/dist/Budgets/ManagedBudget.js +86 -286
  78. package/dist/Budgets/ManagedBudget.js.map +1 -0
  79. package/dist/Budgets/VestingBudget.d.ts +243 -87
  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-CIPqmAoP.js +1450 -0
  106. package/dist/EventAction-CIPqmAoP.js.map +1 -0
  107. package/dist/EventAction-d-oeqZQs.cjs +2 -0
  108. package/dist/EventAction-d-oeqZQs.cjs.map +1 -0
  109. package/dist/Incentive-Bp8Sez7M.js +298 -0
  110. package/dist/Incentive-Bp8Sez7M.js.map +1 -0
  111. package/dist/Incentive-Djnzseoj.cjs +2 -0
  112. package/dist/Incentive-Djnzseoj.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 +49 -19
  116. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  117. package/dist/Incentives/AllowListIncentive.js +50 -34
  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 +118 -22
  122. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  123. package/dist/Incentives/CGDAIncentive.js +67 -42
  124. package/dist/Incentives/CGDAIncentive.js.map +1 -0
  125. package/dist/Incentives/ERC1155Incentive.d.ts +99 -38
  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 +73 -29
  130. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  131. package/dist/Incentives/ERC20Incentive.js +71 -48
  132. package/dist/Incentives/ERC20Incentive.js.map +1 -0
  133. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +523 -0
  134. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  135. package/dist/Incentives/ERC20VariableIncentive.d.ts +65 -28
  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 +4 -7
  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 +65 -21
  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-BwfNjRsg.cjs +2 -0
  150. package/dist/SimpleDenyList-BwfNjRsg.cjs.map +1 -0
  151. package/dist/SimpleDenyList-Cn5WpNn0.js +132 -0
  152. package/dist/SimpleDenyList-Cn5WpNn0.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 +12 -10
  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-D09mhzxO.cjs +2 -0
  172. package/dist/componentInterfaces-D09mhzxO.cjs.map +1 -0
  173. package/dist/componentInterfaces-RXBMI5yH.js +14 -0
  174. package/dist/componentInterfaces-RXBMI5yH.js.map +1 -0
  175. package/dist/deployments-BM42vImE.js +43 -0
  176. package/dist/deployments-BM42vImE.js.map +1 -0
  177. package/dist/deployments-CMdF5uEC.cjs +2 -0
  178. package/dist/deployments-CMdF5uEC.cjs.map +1 -0
  179. package/dist/deployments.json +41 -0
  180. package/dist/errors.cjs +2 -1
  181. package/dist/errors.cjs.map +1 -0
  182. package/dist/errors.d.ts +403 -1
  183. package/dist/errors.d.ts.map +1 -1
  184. package/dist/errors.js +285 -39
  185. package/dist/errors.js.map +1 -0
  186. package/dist/generated-B0tk-c9b.cjs +3 -0
  187. package/dist/generated-B0tk-c9b.cjs.map +1 -0
  188. package/dist/{generated-x_abr3Yv.js → generated-B7VaSah4.js} +2058 -2541
  189. package/dist/generated-B7VaSah4.js.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 +143 -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 +1214 -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 +309 -0
  229. package/src/BoostCore.test.ts +827 -0
  230. package/src/BoostCore.ts +1447 -0
  231. package/src/BoostRegistry.ts +543 -0
  232. package/src/Budgets/Budget.test.ts +27 -0
  233. package/src/Budgets/Budget.ts +60 -0
  234. package/src/Budgets/ManagedBudget.test.ts +217 -0
  235. package/src/Budgets/ManagedBudget.ts +534 -0
  236. package/src/Budgets/VestingBudget.test.ts +123 -0
  237. package/src/Budgets/VestingBudget.ts +530 -0
  238. package/src/Deployable/Contract.ts +228 -0
  239. package/src/Deployable/Deployable.ts +250 -0
  240. package/src/Deployable/DeployableTarget.ts +234 -0
  241. package/src/Deployable/DeployableTargetWithRBAC.ts +323 -0
  242. package/src/Incentives/AllowListIncentive.test.ts +143 -0
  243. package/src/Incentives/AllowListIncentive.ts +336 -0
  244. package/src/Incentives/CGDAIncentive.test.ts +132 -0
  245. package/src/Incentives/CGDAIncentive.ts +470 -0
  246. package/src/Incentives/ERC1155Incentive.test.ts +87 -0
  247. package/src/Incentives/ERC1155Incentive.ts +465 -0
  248. package/src/Incentives/ERC20Incentive.test.ts +130 -0
  249. package/src/Incentives/ERC20Incentive.ts +484 -0
  250. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  251. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
  252. package/src/Incentives/ERC20VariableIncentive.test.ts +136 -0
  253. package/src/Incentives/ERC20VariableIncentive.ts +422 -0
  254. package/src/Incentives/Incentive.test.ts +92 -0
  255. package/src/Incentives/Incentive.ts +86 -0
  256. package/src/Incentives/PointsIncentive.test.ts +139 -0
  257. package/src/Incentives/PointsIncentive.ts +367 -0
  258. package/src/Validators/SignerValidator.test.ts +159 -0
  259. package/src/Validators/SignerValidator.ts +683 -0
  260. package/src/Validators/Validator.test.ts +21 -0
  261. package/src/Validators/Validator.ts +55 -0
  262. package/src/claiming.ts +56 -0
  263. package/src/errors.ts +844 -0
  264. package/src/index.test.ts +122 -0
  265. package/src/index.ts +58 -0
  266. package/src/transfers.ts +284 -0
  267. package/src/utils.test.ts +44 -0
  268. package/src/utils.ts +247 -0
  269. package/dist/Budgets/SimpleBudget.d.ts +0 -793
  270. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  271. package/dist/generated-BaaleHW-.cjs +0 -2
package/src/errors.ts ADDED
@@ -0,0 +1,844 @@
1
+ import {
2
+ type AbiEvent,
3
+ type AbiFunction,
4
+ type Hex,
5
+ type Log,
6
+ type WaitForTransactionReceiptReturnType,
7
+ zeroHash,
8
+ } from 'viem';
9
+ import type { Criteria } from './Actions/EventAction';
10
+ import type { EventLogs } from './Actions/EventAction';
11
+ import type { BoostRegistry } from './BoostRegistry';
12
+ import type { Incentive } from './Incentives/Incentive';
13
+
14
+ /**
15
+ * This error is thrown during Boost creation if no `BoostCreated` event was emitted.
16
+ *
17
+ * @export
18
+ * @class BoostCoreNoIdentifierEmitted
19
+ * @typedef {BoostCoreNoIdentifierEmitted}
20
+ * @extends {Error}
21
+ * @example
22
+ * ```ts
23
+ * try {
24
+ * await boostCore.createBoost(...)
25
+ * } catch(e) {
26
+ * if(e instanceof BoostCoreNoIdentifierEmitted) {}
27
+ * }
28
+ * ```
29
+ */
30
+ export class BoostCoreNoIdentifierEmitted extends Error {
31
+ /**
32
+ * Creates an instance of BoostCoreNoIdentifierEmitted.
33
+ *
34
+ * @constructor
35
+ */
36
+ constructor() {
37
+ super(`No "BoostCreated" log was emitted from which to extract boostId`);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * This error is thrown when `assertValidAddress` is called, usually because a contract call expects the class to have a valid address attached.
43
+ *
44
+ * @export
45
+ * @class ContractAddressRequiredError
46
+ * @typedef {ContractAddressRequiredError}
47
+ * @extends {Error}
48
+ * @example
49
+ * ```ts
50
+ * try {
51
+ * target.assertValidAddress()
52
+ * } catch(e) {
53
+ * if(e instanceof ContractAddressRequiredError) {}
54
+ * }
55
+ */
56
+ export class ContractAddressRequiredError extends Error {
57
+ /**
58
+ * Creates an instance of ContractAddressRequiredError.
59
+ *
60
+ * @constructor
61
+ */
62
+ constructor() {
63
+ super('Attempted to call contract method without providing an address');
64
+ }
65
+ }
66
+
67
+ /**
68
+ * This error is thrown when attempting to deploy a contract that has already been deployed, or has an address attached.
69
+ *
70
+ * @export
71
+ * @class DeployableAlreadyDeployedError
72
+ * @typedef {DeployableAlreadyDeployedError}
73
+ * @extends {Error}
74
+ */
75
+ export class DeployableAlreadyDeployedError extends Error {
76
+ /**
77
+ * The address already attached to the target.
78
+ *
79
+ * @type {string}
80
+ */
81
+ address: string;
82
+ /**
83
+ * Creates an instance of DeployableAlreadyDeployedError.
84
+ *
85
+ * @constructor
86
+ * @param {string} address
87
+ */
88
+ constructor(address: string) {
89
+ super(
90
+ 'Attempted to deploy a contract that already has an address configured',
91
+ );
92
+ this.address = address;
93
+ }
94
+ }
95
+
96
+ /**
97
+ * You should never see this error if we did our jobs and every target overrides the `buildParameters` method.
98
+ *
99
+ * @export
100
+ * @class DeployableBuildParametersUnspecifiedError
101
+ * @typedef {DeployableBuildParametersUnspecifiedError}
102
+ * @extends {Error}
103
+ */
104
+ export class DeployableBuildParametersUnspecifiedError extends Error {
105
+ /**
106
+ * Creates an instance of DeployableBuildParametersUnspecifiedError.
107
+ *
108
+ * @constructor
109
+ */
110
+ constructor() {
111
+ super(
112
+ 'Implementing class did not properly override the `buildParameters` method',
113
+ );
114
+ }
115
+ }
116
+
117
+ /**
118
+ * This error is thrown when attempting to deploy an `ownable` contract and the owner cannot be ascertained from the initialization payload or configured account.
119
+ *
120
+ * @export
121
+ * @class DeployableUnknownOwnerProvidedError
122
+ * @typedef {DeployableUnknownOwnerProvidedError}
123
+ * @extends {Error}
124
+ */
125
+ export class DeployableUnknownOwnerProvidedError extends Error {
126
+ /**
127
+ * Creates an instance of DeployableUnknownOwnerProvidedError.
128
+ *
129
+ * @constructor
130
+ */
131
+ constructor() {
132
+ super(
133
+ 'Expected an an owner to be provided in configuration or an account to exist on Wagmi config.',
134
+ );
135
+ }
136
+ }
137
+
138
+ /**
139
+ * This error is thrown when deploying a contract with no valid Wagmi configuration on the instance.
140
+ *
141
+ * @export
142
+ * @class DeployableWagmiConfigurationRequiredError
143
+ * @typedef {DeployableWagmiConfigurationRequiredError}
144
+ * @extends {Error}
145
+ */
146
+ export class DeployableWagmiConfigurationRequiredError extends Error {
147
+ /**
148
+ * Creates an instance of DeployableWagmiConfigurationRequiredError.
149
+ *
150
+ * @constructor
151
+ */
152
+ constructor() {
153
+ super(
154
+ 'Expected a valid Wagmi configuration to be available either on Deployable, or as argument to deploy.',
155
+ );
156
+ }
157
+ }
158
+
159
+ /**
160
+ * This error is thrown when deploying a contract with no valid initialization payload.
161
+ *
162
+ * @export
163
+ * @class DeployableMissingPayloadError
164
+ * @typedef {DeployableMissingPayloadError}
165
+ * @extends {Error}
166
+ */
167
+ export class DeployableMissingPayloadError extends Error {
168
+ /**
169
+ * Creates an instance of DeployableMissingPayloadError.
170
+ *
171
+ * @constructor
172
+ */
173
+ constructor() {
174
+ super(
175
+ 'Expected a valid payload to be available either on Deployable or as argument to deploy.',
176
+ );
177
+ }
178
+ }
179
+
180
+ /**
181
+ * This error is thrown when we receive a transaction receipt for a contract deployment without a contract address on it.
182
+ *
183
+ * @export
184
+ * @class NoContractAddressUponReceiptError
185
+ * @typedef {NoContractAddressUponReceiptError}
186
+ * @extends {Error}
187
+ */
188
+ export class NoContractAddressUponReceiptError extends Error {
189
+ /**
190
+ * The raw receipt we receive from [waitForTransactionReceipt](https://v1.viem.sh/docs/actions/public/waitForTransactionReceipt.html#waitfortransactionreceipt)
191
+ *
192
+ * @public
193
+ * @readonly
194
+ * @type {WaitForTransactionReceiptReturnType}
195
+ */
196
+ public readonly receipt: WaitForTransactionReceiptReturnType;
197
+ /**
198
+ * Creates an instance of NoContractAddressUponReceiptError.
199
+ *
200
+ * @constructor
201
+ * @param {WaitForTransactionReceiptReturnType} receipt
202
+ */
203
+ constructor(receipt: WaitForTransactionReceiptReturnType) {
204
+ super(`Expected a contract address to exist on receipt.`, {
205
+ cause: receipt,
206
+ });
207
+ this.receipt = receipt;
208
+ }
209
+ }
210
+
211
+ /**
212
+ * This error is thrown when a target address was provided that doesn't match any supported interface for the given registry type.
213
+ * For example, if you try to do `incentiveFromAddress()` with the address of a deployed `SimpleBudget`
214
+ *
215
+ * @export
216
+ * @class InvalidComponentInterfaceError
217
+ * @typedef {InvalidComponentInterfaceError}
218
+ * @extends {Error}
219
+ */
220
+ export class InvalidComponentInterfaceError extends Error {
221
+ /**
222
+ * Expected interface hashes.
223
+ *
224
+ * @public
225
+ * @readonly
226
+ * @type {Hex[]}
227
+ */
228
+ public readonly expected: Hex[] = [];
229
+ /**
230
+ * The actual interface hash.
231
+ *
232
+ * @public
233
+ * @readonly
234
+ * @type {Hex}
235
+ */
236
+ public readonly received: Hex = zeroHash;
237
+
238
+ /**
239
+ * Creates an instance of InvalidComponentInterfaceError.
240
+ *
241
+ * @constructor
242
+ * @param {Hex[]} expected
243
+ * @param {Hex} received
244
+ */
245
+ constructor(expected: Hex[], received: Hex) {
246
+ super(`Address provided does not match any expected protocol interface`, {
247
+ cause: { expected, received },
248
+ });
249
+ this.expected = expected;
250
+ this.received = received;
251
+ }
252
+ }
253
+
254
+ /**
255
+ * This error is thrown when a param is not transparently stored onchain
256
+ *
257
+ * @export
258
+ * @class UnparseableAbiParamError
259
+ * @typedef {UnparseableAbiParamError}
260
+ * @extends {Error}
261
+ */
262
+ export class UnparseableAbiParamError extends Error {
263
+ /**
264
+ * the param index that is unparseable
265
+ *
266
+ * @type {number}
267
+ */
268
+ input_param_idx: number;
269
+ /**
270
+ * The given event that contains the unparseable param
271
+ *
272
+ * @type {AbiEvent}
273
+ */
274
+ event: AbiEvent;
275
+ /**
276
+ * Creates an instance of UnknownTransferPayloadSupplied.
277
+ *
278
+ * @constructor
279
+ * @param {number} input_param_idx
280
+ * @param {AbiEvent} event
281
+ */
282
+ constructor(input_param_idx: number, event: AbiEvent) {
283
+ super(
284
+ `Parameter is not transparently stored onchain. Parameter ${input_param_idx} in event ${event.name} cannot be used in an action`,
285
+ { cause: event },
286
+ );
287
+ this.event = event;
288
+ this.input_param_idx = input_param_idx;
289
+ }
290
+ }
291
+
292
+ /**
293
+ * This error is thrown when attempting a Budget transfer and arguments aren't of the type `FungibleTransferPayload` or `ERC1155TransferPayload`
294
+ *
295
+ * @see {@link FungibleTransferPayload}
296
+ * @see {@link ERC1155TransferPayload}
297
+ * @export
298
+ * @class UnknownTransferPayloadSupplied
299
+ * @typedef {UnknownTransferPayloadSupplied}
300
+ * @extends {Error}
301
+ */
302
+ export class UnknownTransferPayloadSupplied extends Error {
303
+ /**
304
+ * The given payload that does not conform to the correct payload shape.
305
+ *
306
+ * @type {unknown}
307
+ */
308
+ received: unknown;
309
+ /**
310
+ * Creates an instance of UnknownTransferPayloadSupplied.
311
+ *
312
+ * @constructor
313
+ * @param {unknown} received
314
+ */
315
+ constructor(received: unknown) {
316
+ super(
317
+ `Did not provide a valid FungibleTransferPayload or ERC1155 transfer payload.`,
318
+ { cause: received },
319
+ );
320
+ this.received = received;
321
+ }
322
+ }
323
+
324
+ /**
325
+ * This error is thrown during Boost creation when the budget doesn't authorize the Boost Core address.
326
+ *
327
+ * @export
328
+ * @class BudgetMustAuthorizeBoostCore
329
+ * @typedef {BudgetMustAuthorizeBoostCore}
330
+ * @extends {Error}
331
+ */
332
+ export class BudgetMustAuthorizeBoostCore extends Error {
333
+ /**
334
+ * Creates an instance of BudgetMustAuthorizeBoostCore.
335
+ *
336
+ * @constructor
337
+ * @param {string} boostCoreAddress
338
+ */
339
+ constructor(boostCoreAddress: string) {
340
+ super(
341
+ `Budget needs to explicitly authorize ${boostCoreAddress}. You can retrieve this value from BoostCore.address`,
342
+ );
343
+ }
344
+ }
345
+
346
+ /**
347
+ * Because this contract is a base implementation, it should not be initialized through the constructor. Instead, it should be cloned and initialized using the {@link BoostRegistry}
348
+ *
349
+ * @export
350
+ * @class MustInitializeBudgetError
351
+ * @typedef {MustInitializeBudgetError}
352
+ * @extends {Error}
353
+ */
354
+ export class MustInitializeBudgetError extends Error {
355
+ /**
356
+ * Creates an instance of MustInitializeBudgetError.
357
+ */
358
+ constructor() {
359
+ super(`Budgets must be preinitialized before being used with a new Boost`);
360
+ }
361
+ }
362
+
363
+ /**
364
+ * The error is thrown when trying to reuse an existing deployed Incentive that isn't a base implementation.
365
+ * The protocol doesn't allow this.
366
+ *
367
+ * @export
368
+ * @class IncentiveNotCloneableError
369
+ * @typedef {IncentiveNotCloneableError}
370
+ * @extends {Error}
371
+ */
372
+ export class IncentiveNotCloneableError extends Error {
373
+ /**
374
+ * Creates an instance of IncentiveNotCloneableError.
375
+ *
376
+ * @constructor
377
+ * @param {Incentive} incentive
378
+ */
379
+ constructor(incentive: Incentive) {
380
+ super(`Incentive not cloneable: ${incentive.constructor.name}`);
381
+ }
382
+ }
383
+
384
+ /**
385
+ * Thrown when encoding an EventAction payload and no action steps are provided
386
+ *
387
+ * @export
388
+ * @class NoEventActionStepsProvidedError
389
+ * @typedef {NoEventActionStepsProvidedError}
390
+ * @extends {Error}
391
+ */
392
+ export class NoEventActionStepsProvidedError extends Error {
393
+ /**
394
+ * Creates an instance of NoEventActionStepsProvidedError.
395
+ *
396
+ * @constructor
397
+ */
398
+ constructor() {
399
+ super('Must supply at least one action step');
400
+ }
401
+ }
402
+
403
+ /**
404
+ * Thrown when encoding an EventAction payload and > 4 steps are provided
405
+ *
406
+ * @export
407
+ * @class TooManyEventActionStepsProvidedError
408
+ * @typedef {TooManyEventActionStepsProvidedError}
409
+ * @extends {Error}
410
+ */
411
+ export class TooManyEventActionStepsProvidedError extends Error {
412
+ /**
413
+ * Creates an instance of TooManyEventActionStepsProvidedError.
414
+ *
415
+ * @constructor
416
+ */
417
+ constructor() {
418
+ super(
419
+ 'Cannot supply more than 4 action steps with current protocol version',
420
+ );
421
+ }
422
+ }
423
+
424
+ /**
425
+ * The error is thrown when trying to reuse an existing deployed Incentive that isn't a base implementation.
426
+ *
427
+ * @export
428
+ * @class ValidationAbiMissingError
429
+ * @typedef {ValidationAbiMissingError}
430
+ * @extends {Error}
431
+ */
432
+ export class ValidationAbiMissingError extends Error {
433
+ /**
434
+ * Creates an instance of ValidationAbiMissingError.
435
+ *
436
+ * @constructor
437
+ * @param {Hex} signature
438
+ */
439
+ constructor(signature: Hex) {
440
+ super(`No known ABI for given signature: ${signature}`);
441
+ }
442
+ }
443
+
444
+ /**
445
+ * Function action validation context to help debug other validation errors
446
+ *
447
+ * @interface FunctionActionValidationMeta
448
+ * @typedef {FunctionActionValidationMeta}
449
+ */
450
+ interface FunctionActionValidationMeta {
451
+ decodedArgs: readonly (string | bigint)[];
452
+ /**
453
+ * The value pulled off the log being validated against
454
+ *
455
+ * @type {*}
456
+ * biome-ignore lint/suspicious/noExplicitAny: this can be a few different types based on what the log emits
457
+ */
458
+ fieldValue: any;
459
+ /**
460
+ * The criteria being used to compare during validation
461
+ *
462
+ * @type {Criteria}
463
+ */
464
+ criteria: Criteria;
465
+ }
466
+ /**
467
+ * Event action validation context to help debug other validation errors
468
+ *
469
+ * @interface EventActionValidationMeta
470
+ * @typedef {EventActionValidationMeta}
471
+ */
472
+ interface EventActionValidationMeta {
473
+ /**
474
+ * The viem log being validated against
475
+ *
476
+ * @type {Log}
477
+ */
478
+ log?: EventLogs[0];
479
+ /**
480
+ * The value pulled off the log being validated against
481
+ *
482
+ * @type {*}
483
+ * biome-ignore lint/suspicious/noExplicitAny: this can be a few different types based on what the log emits
484
+ */
485
+ fieldValue: any;
486
+ /**
487
+ * The criteria being used to compare during validation
488
+ *
489
+ * @type {Criteria}
490
+ */
491
+ criteria: Criteria;
492
+ }
493
+
494
+ /**
495
+ * The base error thrown during event action validation extended by more specific validation errors.
496
+ * Instantiated with relevent context data for more in depth debugging.
497
+ *
498
+ * @export
499
+ * @class FieldActionValidationError
500
+ * @typedef {FieldActionValidationError}
501
+ * @extends {Error}
502
+ */
503
+ export class FieldActionValidationError extends Error {
504
+ /**
505
+ * The function input arguments being validated against
506
+ *
507
+ * @type {decodedArgs}
508
+ */
509
+ decodedArgs?: readonly (string | bigint)[];
510
+ /**
511
+ * The viem log being validated against
512
+ *
513
+ * @type {Log}
514
+ */
515
+ log?: EventLogs[0];
516
+ /**
517
+ * The value pulled off the log being validated against
518
+ *
519
+ * @type {*}
520
+ * biome-ignore lint/suspicious/noExplicitAny: this can be a few different types based on what the log emits
521
+ */
522
+ fieldValue: any;
523
+ /**
524
+ * The criteria being used to compare during validation
525
+ *
526
+ * @type {Criteria}
527
+ */
528
+ criteria: Criteria;
529
+ /**
530
+ * Creates an instance of FieldActionValidationError.
531
+ *
532
+ * @constructor
533
+ * @param {string} message
534
+ * @param {EventActionValidationMeta} param0
535
+ * @param {*} param0.fieldValue
536
+ * @param {Criteria} param0.criteria
537
+ * @param {Log} param0.log
538
+ */
539
+ constructor(
540
+ message: string,
541
+ {
542
+ fieldValue,
543
+ criteria,
544
+ ...args
545
+ }: EventActionValidationMeta | FunctionActionValidationMeta,
546
+ ) {
547
+ super(message);
548
+ this.fieldValue = fieldValue;
549
+ this.criteria = criteria;
550
+
551
+ switch (true) {
552
+ case 'log' in args:
553
+ this.log = args.log;
554
+ break;
555
+ case 'decodedArgs' in args:
556
+ this.decodedArgs = args.decodedArgs;
557
+ }
558
+ }
559
+ }
560
+
561
+ /**
562
+ * Thrown when abi-decoded args on log is undefined
563
+ *
564
+ * @export
565
+ * @class FieldValueUndefinedError
566
+ * @typedef {FieldValueUndefinedError}
567
+ * @extends {FieldActionValidationError}
568
+ */
569
+ export class DecodedArgsMalformedError extends FieldActionValidationError {
570
+ /**
571
+ * Creates an instance of DecodedArgsUndefinedError.
572
+ *
573
+ * @constructor
574
+ * @param {DecodedArgsMalformedError} metadata
575
+ */
576
+ constructor(
577
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
578
+ ) {
579
+ super(
580
+ 'Decoded Args are malformed; Check which params are indexed',
581
+ metadata,
582
+ );
583
+ }
584
+ }
585
+
586
+ /**
587
+ * Thrown when field value on log is undefined
588
+ *
589
+ * @export
590
+ * @class FieldValueUndefinedError
591
+ * @typedef {FieldValueUndefinedError}
592
+ * @extends {FieldActionValidationError}
593
+ */
594
+ export class FieldValueUndefinedError extends FieldActionValidationError {
595
+ /**
596
+ * Creates an instance of FieldValueUndefinedError.
597
+ *
598
+ * @constructor
599
+ * @param {EventActionValidationMeta} metadata
600
+ */
601
+ constructor(
602
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
603
+ ) {
604
+ super('Field value is undefined', metadata);
605
+ }
606
+ }
607
+
608
+ /**
609
+ * Thrown when a filter type is using a numerical operator but field type is not numerical
610
+ *
611
+ * @export
612
+ * @class InvalidNumericalCriteriaError
613
+ * @typedef {InvalidNumericalCriteriaError}
614
+ * @extends {FieldActionValidationError}
615
+ */
616
+ export class InvalidNumericalCriteriaError extends FieldActionValidationError {
617
+ /**
618
+ * Creates an instance of InvalidNumericalCriteria.
619
+ *
620
+ * @constructor
621
+ * @param {EventActionValidationMeta} metadata
622
+ */
623
+ constructor(
624
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
625
+ ) {
626
+ super(
627
+ 'Numerical comparisons cannot be used with non-numerical criteria',
628
+ metadata,
629
+ );
630
+ }
631
+ }
632
+
633
+ /**
634
+ * Thrown when decoding function data fails.
635
+ *
636
+ * @export
637
+ * @class FunctionDataDecodeError
638
+ * @typedef {FunctionDataDecodeError}
639
+ * @extends {Error}
640
+ */
641
+ export class FunctionDataDecodeError extends Error {
642
+ public abi: AbiFunction[];
643
+ public originalError: Error;
644
+
645
+ /**
646
+ * Creates an instance of FunctionDataDecodeError.
647
+ *
648
+ * @constructor
649
+ * @param {AbiFunction[]} abi - The ABI of the function.
650
+ * @param {Error} originalError - The original error that was thrown.
651
+ */
652
+ constructor(abi: AbiFunction[], originalError: Error) {
653
+ super(`Failed to decode function data: ${originalError.message}`);
654
+ this.name = 'FunctionDataDecodeError';
655
+ this.abi = abi;
656
+ this.originalError = originalError;
657
+ }
658
+ }
659
+
660
+ /**
661
+ * Thrown when an the log's field value is being compared a field type that isn't bytes or string during event action validation
662
+ *
663
+ * @export
664
+ * @class FieldValueNotComparableError
665
+ * @typedef {FieldValueNotComparableError}
666
+ * @extends {FieldActionValidationError}
667
+ */
668
+ export class FieldValueNotComparableError extends FieldActionValidationError {
669
+ /**
670
+ * Creates an instance of FieldValueNotComparableError.
671
+ *
672
+ * @constructor
673
+ * @param {EventActionValidationMeta} metadata
674
+ */
675
+ constructor(
676
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
677
+ ) {
678
+ super('Filter can only be used with bytes or string field type', metadata);
679
+ }
680
+ }
681
+
682
+ /**
683
+ * Thrown when an invalid filter type enum was provided event action validation.
684
+ *
685
+ * @export
686
+ * @class UnrecognizedFilterTypeError
687
+ * @typedef {UnrecognizedFilterTypeError}
688
+ * @extends {FieldActionValidationError}
689
+ */
690
+ export class UnrecognizedFilterTypeError extends FieldActionValidationError {
691
+ /**
692
+ * Creates an instance of UnrecognizedFilterTypeError.
693
+ *
694
+ * @constructor
695
+ * @param {EventActionValidationMeta} metadata
696
+ */
697
+ constructor(
698
+ metadata: EventActionValidationMeta | FunctionActionValidationMeta,
699
+ ) {
700
+ super('Invalid FilterType provided', metadata);
701
+ }
702
+ }
703
+
704
+ /**
705
+ * Thrown when no chain ID is provided in the Wagmi configuration.
706
+ *
707
+ * @export
708
+ * @class NoConnectedChainIdError
709
+ * @typedef {NoConnectedChainIdError}
710
+ * @extends {Error}
711
+ */
712
+ export class NoConnectedChainIdError extends Error {
713
+ /**
714
+ * Creates an instance of NoConnectedChainIdError.
715
+ *
716
+ * @constructor
717
+ */
718
+ constructor() {
719
+ super(
720
+ 'Provided Wagmi configuration does not define `chainId` property with which to target protocol contracts',
721
+ );
722
+ this.name = 'NoConnectedChainIdError';
723
+ }
724
+ }
725
+
726
+ /**
727
+ * Thrown when an invalid chain ID is provided that doesn't match any deployed protocol.
728
+ *
729
+ * @export
730
+ * @class InvalidProtocolChainIdError
731
+ * @typedef {InvalidProtocolChainIdError}
732
+ * @extends {Error}
733
+ */
734
+ export class InvalidProtocolChainIdError extends Error {
735
+ /**
736
+ * Creates an instance of InvalidProtocolChainIdError.
737
+ *
738
+ * @constructor
739
+ * @param {number} chainId - The chain ID provided in the configuration.
740
+ * @param {number[]} validChainIds - A list of valid chain IDs where the protocol is deployed.
741
+ */
742
+ constructor(chainId: number, validChainIds: number[]) {
743
+ super(
744
+ `Provided Wagmi configuration supplied a "chainId" where protocol is not deployed, provided: ${chainId}, but valid chains are: ${validChainIds}`,
745
+ );
746
+ this.name = 'InvalidProtocolChainIdError';
747
+ }
748
+ }
749
+
750
+ /**
751
+ * Thrown when the incentive criteria cannot be fetched from the contract.
752
+ *
753
+ * @export
754
+ * @class IncentiveCriteriaNotFoundError
755
+ * @typedef {IncentiveCriteriaNotFoundError}
756
+ * @extends {Error}
757
+ */
758
+ export class IncentiveCriteriaNotFoundError extends Error {
759
+ /**
760
+ * Creates an instance of IncentiveCriteriaNotFoundError.
761
+ *
762
+ * @constructor
763
+ * @param {Error} [e] - Optional error object for further context.
764
+ * @param {string} [message='Unable to fetch Incentive Criteria from contract'] - Custom error message.
765
+ */
766
+ constructor(
767
+ e?: Error,
768
+ message = 'Unable to fetch Incentive Criteria from contract',
769
+ ) {
770
+ super(message + (e ? `: ${e.message}` : ''));
771
+ this.name = 'IncentiveCriteriaNotFoundError';
772
+ }
773
+ }
774
+
775
+ /**
776
+ * Thrown when no matching logs are found for a given event signature.
777
+ *
778
+ * @export
779
+ * @class NoMatchingLogsError
780
+ * @typedef {NoMatchingLogsError}
781
+ * @extends {Error}
782
+ */
783
+ export class NoMatchingLogsError extends Error {
784
+ /**
785
+ * Creates an instance of NoMatchingLogsError.
786
+ *
787
+ * @constructor
788
+ * @param {string} signature - The event signature for which logs are being searched.
789
+ * @param {string} [message] - Optional custom error message.
790
+ */
791
+ constructor(
792
+ signature: string,
793
+ message = `No logs found for event signature ${signature}`,
794
+ ) {
795
+ super(message);
796
+ this.name = 'NoMatchingLogsError';
797
+ }
798
+ }
799
+
800
+ /**
801
+ * Thrown when an invalid criteria type is provided.
802
+ *
803
+ * @export
804
+ * @class InvalidCriteriaTypeError
805
+ * @typedef {InvalidCriteriaTypeError}
806
+ * @extends {Error}
807
+ */
808
+ export class InvalidCriteriaTypeError extends Error {
809
+ /**
810
+ * Creates an instance of InvalidCriteriaTypeError.
811
+ *
812
+ * @constructor
813
+ * @param {string} [criteriaType='unknown'] - The invalid criteria type that was provided.
814
+ * @param {string} [message] - Optional custom error message.
815
+ */
816
+ constructor(
817
+ criteriaType = 'unknown',
818
+ message = `Invalid criteria type ${criteriaType}`,
819
+ ) {
820
+ super(message);
821
+ this.name = 'InvalidCriteriaTypeError';
822
+ }
823
+ }
824
+
825
+ /**
826
+ * Thrown when decoding function arguments fails.
827
+ *
828
+ * @export
829
+ * @class DecodedArgsError
830
+ * @typedef {DecodedArgsError}
831
+ * @extends {Error}
832
+ */
833
+ export class DecodedArgsError extends Error {
834
+ /**
835
+ * Creates an instance of DecodedArgsError.
836
+ *
837
+ * @constructor
838
+ * @param {string} [message='Issue decoding args'] - Custom error message.
839
+ */
840
+ constructor(message = 'Issue decoding args') {
841
+ super(message);
842
+ this.name = 'DecodedArgsError';
843
+ }
844
+ }