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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/dist/Actions/Action.cjs +1 -1
  2. package/dist/Actions/Action.cjs.map +1 -1
  3. package/dist/Actions/Action.js +2 -2
  4. package/dist/Actions/ContractAction.d.ts +11 -11
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +14 -14
  7. package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
  8. package/dist/Actions/EventAction.cjs +1 -1
  9. package/dist/Actions/EventAction.cjs.map +1 -1
  10. package/dist/Actions/EventAction.d.ts +174 -41
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +557 -129
  13. package/dist/Actions/EventAction.js.map +1 -1
  14. package/dist/AllowLists/AllowList.cjs +1 -1
  15. package/dist/AllowLists/AllowList.cjs.map +1 -1
  16. package/dist/AllowLists/AllowList.d.ts +6 -4
  17. package/dist/AllowLists/AllowList.d.ts.map +1 -1
  18. package/dist/AllowLists/AllowList.js +45 -23
  19. package/dist/AllowLists/AllowList.js.map +1 -1
  20. package/dist/AllowLists/OpenAllowList.d.ts +423 -0
  21. package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
  22. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  23. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  24. package/dist/AllowLists/SimpleAllowList.d.ts +92 -37
  25. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
  26. package/dist/AllowLists/SimpleAllowList.js +60 -75
  27. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  28. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  29. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
  30. package/dist/AllowLists/SimpleDenyList.d.ts +203 -11
  31. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
  32. package/dist/AllowLists/SimpleDenyList.js +11 -112
  33. package/dist/AllowLists/SimpleDenyList.js.map +1 -1
  34. package/dist/Auth/PassthroughAuth.cjs +1 -1
  35. package/dist/Auth/PassthroughAuth.js +1 -1
  36. package/dist/Boost.cjs +1 -1
  37. package/dist/Boost.cjs.map +1 -1
  38. package/dist/Boost.d.ts +20 -21
  39. package/dist/Boost.d.ts.map +1 -1
  40. package/dist/Boost.js +43 -57
  41. package/dist/Boost.js.map +1 -1
  42. package/dist/BoostCore-Btl5BdAs.cjs +3 -0
  43. package/dist/BoostCore-Btl5BdAs.cjs.map +1 -0
  44. package/dist/BoostCore-CD56zbYX.js +2641 -0
  45. package/dist/BoostCore-CD56zbYX.js.map +1 -0
  46. package/dist/BoostCore.cjs +1 -2
  47. package/dist/BoostCore.cjs.map +1 -1
  48. package/dist/BoostCore.d.ts +749 -78
  49. package/dist/BoostCore.d.ts.map +1 -1
  50. package/dist/BoostCore.js +29 -1150
  51. package/dist/BoostCore.js.map +1 -1
  52. package/dist/BoostRegistry.cjs +1 -1
  53. package/dist/BoostRegistry.cjs.map +1 -1
  54. package/dist/BoostRegistry.d.ts +80 -25
  55. package/dist/BoostRegistry.d.ts.map +1 -1
  56. package/dist/BoostRegistry.js +164 -82
  57. package/dist/BoostRegistry.js.map +1 -1
  58. package/dist/Budgets/Budget.cjs +1 -1
  59. package/dist/Budgets/Budget.cjs.map +1 -1
  60. package/dist/Budgets/Budget.d.ts.map +1 -1
  61. package/dist/Budgets/Budget.js +2 -2
  62. package/dist/Budgets/Budget.js.map +1 -1
  63. package/dist/Budgets/ManagedBudget.cjs +1 -1
  64. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  65. package/dist/Budgets/ManagedBudget.d.ts +103 -221
  66. package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
  67. package/dist/Budgets/ManagedBudget.js +81 -298
  68. package/dist/Budgets/ManagedBudget.js.map +1 -1
  69. package/dist/Budgets/VestingBudget.d.ts +223 -89
  70. package/dist/Budgets/VestingBudget.d.ts.map +1 -1
  71. package/dist/Deployable/Contract.cjs +1 -1
  72. package/dist/Deployable/Contract.cjs.map +1 -1
  73. package/dist/Deployable/Contract.d.ts +4 -5
  74. package/dist/Deployable/Contract.d.ts.map +1 -1
  75. package/dist/Deployable/Contract.js +5 -7
  76. package/dist/Deployable/Contract.js.map +1 -1
  77. package/dist/Deployable/Deployable.cjs.map +1 -1
  78. package/dist/Deployable/Deployable.d.ts +1 -1
  79. package/dist/Deployable/Deployable.d.ts.map +1 -1
  80. package/dist/Deployable/Deployable.js +3 -5
  81. package/dist/Deployable/Deployable.js.map +1 -1
  82. package/dist/Deployable/DeployableTarget.cjs +1 -1
  83. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  84. package/dist/Deployable/DeployableTarget.d.ts +13 -13
  85. package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
  86. package/dist/Deployable/DeployableTarget.js +28 -25
  87. package/dist/Deployable/DeployableTarget.js.map +1 -1
  88. package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
  89. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
  90. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +248 -0
  91. package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
  92. package/dist/Deployable/DeployableTargetWithRBAC.js +320 -0
  93. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
  94. package/dist/Incentive-CcnOIc8L.cjs +2 -0
  95. package/dist/Incentive-CcnOIc8L.cjs.map +1 -0
  96. package/dist/Incentive-rM5nKznp.js +313 -0
  97. package/dist/Incentive-rM5nKznp.js.map +1 -0
  98. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  99. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  100. package/dist/Incentives/AllowListIncentive.d.ts +38 -16
  101. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  102. package/dist/Incentives/AllowListIncentive.js +43 -29
  103. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  104. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  105. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  106. package/dist/Incentives/CGDAIncentive.d.ts +234 -21
  107. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  108. package/dist/Incentives/CGDAIncentive.js +46 -32
  109. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  110. package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
  111. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
  112. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  113. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  114. package/dist/Incentives/ERC20Incentive.d.ts +234 -30
  115. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  116. package/dist/Incentives/ERC20Incentive.js +62 -46
  117. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  118. package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +333 -438
  119. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  120. package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
  121. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  122. package/dist/Incentives/Incentive.cjs +1 -1
  123. package/dist/Incentives/Incentive.cjs.map +1 -1
  124. package/dist/Incentives/Incentive.d.ts +4 -4
  125. package/dist/Incentives/Incentive.d.ts.map +1 -1
  126. package/dist/Incentives/Incentive.js +16 -296
  127. package/dist/Incentives/Incentive.js.map +1 -1
  128. package/dist/Incentives/PointsIncentive.cjs +1 -1
  129. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  130. package/dist/Incentives/PointsIncentive.d.ts +40 -18
  131. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  132. package/dist/Incentives/PointsIncentive.js +38 -24
  133. package/dist/Incentives/PointsIncentive.js.map +1 -1
  134. package/dist/SimpleDenyList-BDXpY74P.js +133 -0
  135. package/dist/SimpleDenyList-BDXpY74P.js.map +1 -0
  136. package/dist/SimpleDenyList-DNj5qDWM.cjs +2 -0
  137. package/dist/SimpleDenyList-DNj5qDWM.cjs.map +1 -0
  138. package/dist/Validators/SignerValidator.cjs +1 -1
  139. package/dist/Validators/SignerValidator.cjs.map +1 -1
  140. package/dist/Validators/SignerValidator.d.ts +16 -16
  141. package/dist/Validators/SignerValidator.d.ts.map +1 -1
  142. package/dist/Validators/SignerValidator.js +32 -28
  143. package/dist/Validators/SignerValidator.js.map +1 -1
  144. package/dist/Validators/Validator.cjs +1 -1
  145. package/dist/Validators/Validator.cjs.map +1 -1
  146. package/dist/Validators/Validator.d.ts +1 -1
  147. package/dist/Validators/Validator.js +2 -2
  148. package/dist/Validators/Validator.js.map +1 -1
  149. package/dist/claiming.cjs.map +1 -1
  150. package/dist/claiming.d.ts +1 -1
  151. package/dist/claiming.js.map +1 -1
  152. package/dist/componentInterfaces-BBCFkrZv.js +14 -0
  153. package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
  154. package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
  155. package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
  156. package/dist/deployments-DF_6-7hH.cjs +2 -0
  157. package/dist/deployments-DF_6-7hH.cjs.map +1 -0
  158. package/dist/deployments-fJsWblwS.js +56 -0
  159. package/dist/deployments-fJsWblwS.js.map +1 -0
  160. package/dist/deployments.json +58 -0
  161. package/dist/errors.cjs +1 -1
  162. package/dist/errors.cjs.map +1 -1
  163. package/dist/errors.d.ts +256 -20
  164. package/dist/errors.d.ts.map +1 -1
  165. package/dist/errors.js +183 -26
  166. package/dist/errors.js.map +1 -1
  167. package/dist/{generated-57_Kffpz.js → generated-CsNyWPKA.js} +3843 -2084
  168. package/dist/generated-CsNyWPKA.js.map +1 -0
  169. package/dist/generated-DHerxf1y.cjs +3 -0
  170. package/dist/generated-DHerxf1y.cjs.map +1 -0
  171. package/dist/index.cjs +1 -1
  172. package/dist/index.d.ts +5 -0
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +142 -108
  175. package/dist/index.js.map +1 -1
  176. package/dist/transfers.cjs.map +1 -1
  177. package/dist/transfers.d.ts +1 -1
  178. package/dist/transfers.js.map +1 -1
  179. package/dist/utils.cjs +1 -1
  180. package/dist/utils.cjs.map +1 -1
  181. package/dist/utils.d.ts +26 -12
  182. package/dist/utils.d.ts.map +1 -1
  183. package/dist/utils.js +38 -23
  184. package/dist/utils.js.map +1 -1
  185. package/package.json +20 -10
  186. package/src/Actions/Action.test.ts +14 -13
  187. package/src/Actions/ContractAction.test.ts +10 -10
  188. package/src/Actions/ContractAction.ts +11 -12
  189. package/src/Actions/ERC721MintAction.test.ts +6 -6
  190. package/src/Actions/ERC721MintAction.ts +14 -15
  191. package/src/Actions/EventAction.test.ts +735 -109
  192. package/src/Actions/EventAction.ts +527 -88
  193. package/src/AllowLists/AllowList.test.ts +7 -7
  194. package/src/AllowLists/AllowList.ts +5 -3
  195. package/src/AllowLists/OpenAllowList.test.ts +40 -0
  196. package/src/AllowLists/OpenAllowList.ts +45 -0
  197. package/src/AllowLists/SimpleAllowList.test.ts +4 -4
  198. package/src/AllowLists/SimpleAllowList.ts +40 -61
  199. package/src/AllowLists/SimpleDenyList.test.ts +4 -4
  200. package/src/AllowLists/SimpleDenyList.ts +41 -17
  201. package/src/Auth/PassthroughAuth.test.ts +1 -1
  202. package/src/Boost.ts +21 -24
  203. package/src/BoostCore.test.ts +361 -306
  204. package/src/BoostCore.ts +403 -220
  205. package/src/BoostRegistry.test.ts +53 -0
  206. package/src/BoostRegistry.ts +161 -40
  207. package/src/Budgets/Budget.test.ts +2 -2
  208. package/src/Budgets/Budget.ts +1 -2
  209. package/src/Budgets/ManagedBudget.test.ts +106 -19
  210. package/src/Budgets/ManagedBudget.ts +49 -321
  211. package/src/Budgets/VestingBudget.test.ts +7 -7
  212. package/src/Budgets/VestingBudget.ts +36 -106
  213. package/src/Deployable/Contract.ts +4 -5
  214. package/src/Deployable/Deployable.ts +1 -1
  215. package/src/Deployable/DeployableTarget.ts +30 -19
  216. package/src/Deployable/DeployableTargetWithRBAC.test.ts +103 -0
  217. package/src/Deployable/DeployableTargetWithRBAC.ts +447 -0
  218. package/src/Incentives/AllowListIncentive.test.ts +12 -12
  219. package/src/Incentives/AllowListIncentive.ts +30 -15
  220. package/src/Incentives/CGDAIncentive.test.ts +9 -6
  221. package/src/Incentives/CGDAIncentive.ts +39 -18
  222. package/src/Incentives/ERC1155Incentive.test.ts +3 -3
  223. package/src/Incentives/ERC1155Incentive.ts +30 -29
  224. package/src/Incentives/ERC20Incentive.test.ts +9 -6
  225. package/src/Incentives/ERC20Incentive.ts +54 -27
  226. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  227. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +325 -0
  228. package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
  229. package/src/Incentives/ERC20VariableIncentive.ts +50 -26
  230. package/src/Incentives/Incentive.test.ts +4 -1
  231. package/src/Incentives/Incentive.ts +7 -6
  232. package/src/Incentives/PointsIncentive.test.ts +24 -25
  233. package/src/Incentives/PointsIncentive.ts +32 -17
  234. package/src/Validators/SignerValidator.test.ts +6 -6
  235. package/src/Validators/SignerValidator.ts +20 -17
  236. package/src/Validators/Validator.test.ts +2 -2
  237. package/src/Validators/Validator.ts +1 -1
  238. package/src/claiming.ts +1 -1
  239. package/src/errors.ts +345 -21
  240. package/src/index.test.ts +118 -36
  241. package/src/index.ts +5 -0
  242. package/src/transfers.ts +1 -1
  243. package/src/utils.test.ts +2 -2
  244. package/src/utils.ts +61 -12
  245. package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
  246. package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
  247. package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
  248. package/dist/componentInterfaces-DYkaxBda.js +0 -13
  249. package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
  250. package/dist/generated-57_Kffpz.js.map +0 -1
  251. package/dist/generated-wKBNvm48.cjs +0 -3
  252. package/dist/generated-wKBNvm48.cjs.map +0 -1
  253. package/src/Budgets/SimpleBudget.test.ts +0 -152
  254. package/src/Budgets/SimpleBudget.ts +0 -564
@@ -1,10 +1,10 @@
1
- import { b as d, K as c } from "../generated-57_Kffpz.js";
1
+ import { z as d, C as c } from "../generated-CsNyWPKA.js";
2
2
  import { deployContract as h } from "@wagmi/core";
3
- import { isAddress as y, zeroAddress as i } from "viem";
4
- import { DeployableAlreadyDeployedError as l, DeployableMissingPayloadError as f } from "../errors.js";
5
- import { RegistryType as u } from "../utils.js";
3
+ import { isAddress as u, zeroAddress as l, isAddressEqual as a } from "viem";
4
+ import { DeployableAlreadyDeployedError as y, DeployableMissingPayloadError as f } from "../errors.js";
5
+ import { RegistryType as m } from "../utils.js";
6
6
  import { Deployable as p } from "./Deployable.js";
7
- const e = class e extends p {
7
+ const i = class i extends p {
8
8
  /**
9
9
  * Creates an instance of DeployableTarget.
10
10
  *
@@ -14,20 +14,25 @@ const e = class e extends p {
14
14
  * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.
15
15
  */
16
16
  constructor(t, s, r) {
17
- super(t, s), this._isBase = !0, typeof s == "string" && y(s) && s !== this.base && s !== i && (r = !1), r !== void 0 && (this._isBase = r);
17
+ super(t, s), this._isBase = !0, typeof s == "string" && u(s) && s !== l && !Object.values(this.bases).some((e) => !s || !e ? !1 : a(s, e)) && (r = !1), r !== void 0 && (this._isBase = r);
18
18
  }
19
19
  get isBase() {
20
- return this.address && this.address !== this.base ? !1 : this._isBase;
20
+ return this.address && Object.values(this.bases).some(
21
+ (t) => (
22
+ // biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above
23
+ a(this.address, t)
24
+ )
25
+ ) ? !0 : this._isBase;
21
26
  }
22
27
  /**
23
- * A getter that will return the base implementation's static address
28
+ * A getter that will return the base implementation's static addresses by numerical chain ID
24
29
  *
25
30
  * @public
26
31
  * @readonly
27
- * @type {Address}
32
+ * @type {Record<number, Address>}
28
33
  */
29
- get base() {
30
- return this.constructor.base;
34
+ get bases() {
35
+ return this.constructor.bases;
31
36
  }
32
37
  /**
33
38
  * A getter that returns the registry type of the base implementation
@@ -47,7 +52,7 @@ const e = class e extends p {
47
52
  * @param {?Payload} [payload]
48
53
  * @param {?DeployableOptions} [options]
49
54
  * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
50
- * @returns {unknown}
55
+ * @returns {Promise<this>}
51
56
  */
52
57
  async deploy(t, s, r) {
53
58
  return await super.deploy(t, s, r), this.assertValidAddress(), this;
@@ -62,10 +67,9 @@ const e = class e extends p {
62
67
  * @returns {Promise<Hash>}
63
68
  */
64
69
  async deployRaw(t, s) {
65
- if (this.address)
66
- throw new l(this.address);
67
- const r = t || this._payload, o = (s == null ? void 0 : s.config) || this._config, { args: g, ...n } = this.buildParameters(r);
68
- return await h(o, {
70
+ if (this.address) throw new y(this.address);
71
+ const r = t || this._payload, e = (s == null ? void 0 : s.config) || this._config, { args: g, ...n } = this.buildParameters(r);
72
+ return await h(e, {
69
73
  ...n,
70
74
  ...this.optionallyAttachAccount(s == null ? void 0 : s.account),
71
75
  // Deployable targets don't construct with arguments, they initialize with encoded payloads
@@ -78,8 +82,8 @@ const e = class e extends p {
78
82
  * @public
79
83
  * @async
80
84
  * @param {Hex} interfaceId - The interface identifier
81
- * @param {?ReadParams<typeof contractActionAbi, 'supportsInterface'>} [params]
82
- * @returns {unknown} - True if the contract supports the interface
85
+ * @param {?ReadParams} [params]
86
+ * @returns {Promise<boolean>} - True if the contract supports the interface
83
87
  */
84
88
  async supportsInterface(t, s) {
85
89
  return await d(this._config, {
@@ -96,8 +100,8 @@ const e = class e extends p {
96
100
  *
97
101
  * @public
98
102
  * @async
99
- * @param {?ReadParams<typeof contractActionAbi, 'getComponentInterface'>} [params]
100
- * @returns {unknown}
103
+ * @param {?ReadParams} [params]
104
+ * @returns {Promise<Hex>}
101
105
  */
102
106
  async getComponentInterface(t) {
103
107
  return await c(this._config, {
@@ -119,14 +123,13 @@ const e = class e extends p {
119
123
  */
120
124
  validateDeploymentConfig(t, s) {
121
125
  const r = t || this._payload;
122
- if (!r)
123
- throw new f();
126
+ if (!r) throw new f();
124
127
  return super.validateDeploymentConfig(r, s);
125
128
  }
126
129
  };
127
- e.base = i, e.registryType = u.ACTION;
128
- let a = e;
130
+ i.bases = {}, i.registryType = m.ACTION;
131
+ let o = i;
129
132
  export {
130
- a as DeployableTarget
133
+ o as DeployableTarget
131
134
  };
132
135
  //# sourceMappingURL=DeployableTarget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeployableTarget.js","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface as readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n isAddress,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Address}\n */\n static readonly base: Address = zeroAddress;\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n protected _isBase = true;\n get isBase() {\n if (!!this.address && this.address !== this.base) return false;\n return this._isBase;\n }\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n // if supplying a custom address, safe enough to assume it is not a base address which makes reusing contracts like budgets easier\n if (\n typeof payload === 'string' &&\n isAddress(payload) &&\n payload !== this.base &&\n payload !== zeroAddress\n )\n isBase = false;\n if (isBase !== undefined) this._isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static address\n *\n * @public\n * @readonly\n * @type {Address}\n */\n public get base(): Address {\n return (this.constructor as typeof DeployableTarget).base;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {unknown}\n */\n protected override async deploy(\n payload?: Payload,\n options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n await super.deploy(payload, options, waitParams);\n this.assertValidAddress();\n return this;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n */\n protected override async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const payload = _payload || this._payload;\n const config = _options?.config || this._config;\n const { args, ...deployment } = this.buildParameters(payload);\n return await deployContract(config, {\n ...deployment,\n ...this.optionallyAttachAccount(_options?.account),\n // Deployable targets don't construct with arguments, they initialize with encoded payloads\n args: [],\n });\n }\n\n /**\n * Check if the contract supports the given interface\n *\n * @public\n * @async\n * @param {Hex} interfaceId - The interface identifier\n * @param {?ReadParams<typeof contractActionAbi, 'supportsInterface'>} [params]\n * @returns {unknown} - True if the contract supports the interface\n */\n public async supportsInterface(\n interfaceId: Hex,\n params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,\n ) {\n return await readACloneableSupportsInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [interfaceId],\n });\n }\n\n /**\n * Return a cloneable's unique identifier for downstream consumers to differentiate various targets\n * All implementations must override this function\n *\n * @public\n * @async\n * @param {?ReadParams<typeof contractActionAbi, 'getComponentInterface'>} [params]\n * @returns {unknown}\n */\n public async getComponentInterface(\n params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,\n ) {\n return await readACloneableGetComponentInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [],\n });\n }\n\n /**\n * @inheritdoc\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n */\n protected override validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const payload = _payload || this._payload;\n if (!payload) throw new DeployableMissingPayloadError();\n return super.validateDeploymentConfig(payload, _options) as [\n P,\n DeployableOptions,\n ];\n }\n}\n"],"names":["_DeployableTarget","Deployable","options","payload","isBase","isAddress","zeroAddress","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","RegistryType","DeployableTarget"],"mappings":";;;;;;AAmCO,MAAMA,IAAN,MAAMA,UAGHC,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqCzC,YACEC,GACAC,GACAC,GACA;AACA,UAAMF,GAASC,CAAO,GAnBxB,KAAU,UAAU,IAsBhB,OAAOA,KAAY,YACnBE,EAAUF,CAAO,KACjBA,MAAY,KAAK,QACjBA,MAAYG,MAEHF,IAAA,KACPA,MAAW,WAAW,KAAK,UAAUA;AAAA,EAC3C;AAAA,EA5BA,IAAI,SAAS;AACX,WAAM,KAAK,WAAW,KAAK,YAAY,KAAK,OAAa,KAClD,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkCA,IAAW,OAAgB;AACzB,WAAQ,KAAK,YAAwC;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAW,eAA6B;AACtC,WAAQ,KAAK,YAAwC;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAyB,OACvBD,GACAD,GACAK,GACA;AACA,iBAAM,MAAM,OAAOJ,GAASD,GAASK,CAAU,GAC/C,KAAK,mBAAmB,GACjB;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAyB,UACvBC,GACAC,GACe;AACf,QAAI,KAAK;AAAe,YAAA,IAAIC,EAA+B,KAAK,OAAO;AACjE,UAAAP,IAAUK,KAAY,KAAK,UAC3BG,KAASF,KAAA,gBAAAA,EAAU,WAAU,KAAK,SAClC,EAAE,MAAAG,GAAM,GAAGC,MAAe,KAAK,gBAAgBV,CAAO;AACrD,WAAA,MAAMW,EAAeH,GAAQ;AAAA,MAClC,GAAGE;AAAA,MACH,GAAG,KAAK,wBAAwBJ,KAAA,gBAAAA,EAAU,OAAO;AAAA;AAAA,MAEjD,MAAM,CAAC;AAAA,IAAA,CACR;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,kBACXM,GACAC,GACA;AACO,WAAA,MAAMC,EAAgC,KAAK,SAAS;AAAA,MACzD,SAAS,KAAK,mBAAmB;AAAA,MACjC,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAID;AAAA,MACJ,MAAM,CAACD,CAAW;AAAA,IAAA,CACnB;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,sBACXC,GACA;AACO,WAAA,MAAME,EAAoC,KAAK,SAAS;AAAA,MAC7D,SAAS,KAAK,mBAAmB;AAAA,MACjC,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIF;AAAA,MACJ,MAAM,CAAC;AAAA,IAAA,CACR;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWmB,yBACjBR,GACAC,GACA;AACM,UAAAN,IAAUK,KAAY,KAAK;AACjC,QAAI,CAACL;AAAS,YAAM,IAAIgB,EAA8B;AAC/C,WAAA,MAAM,yBAAyBhB,GAASM,CAAQ;AAAA,EAIzD;AACF;AAhLET,EAAgB,OAAgBM,GAQhCN,EAAgB,eAA6BoB,EAAa;AAnBrD,IAAMC,IAANrB;"}
1
+ {"version":3,"file":"DeployableTarget.js","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing a map of stringified chain ID's to the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Record<string, Address>}\n */\n static readonly bases: Record<number, Address> = {};\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n readonly _isBase: boolean = true;\n public get isBase() {\n if (\n !!this.address &&\n Object.values(this.bases).some((base) =>\n // biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above\n isAddressEqual(this.address!, base),\n )\n )\n return true;\n return this._isBase;\n }\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n // if supplying a custom address, safe enough to assume it is not a base address which makes reusing contracts like budgets easier\n if (\n typeof payload === 'string' &&\n isAddress(payload) &&\n payload !== zeroAddress &&\n !Object.values(this.bases).some((base) => {\n if (!payload || !base) return false;\n return isAddressEqual(payload, base);\n })\n )\n isBase = false;\n if (isBase !== undefined) this._isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static addresses by numerical chain ID\n *\n * @public\n * @readonly\n * @type {Record<number, Address>}\n */\n public get bases(): Record<number, Address> {\n return (this.constructor as typeof DeployableTarget).bases;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<this>}\n */\n protected override async deploy(\n payload?: Payload,\n options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n await super.deploy(payload, options, waitParams);\n this.assertValidAddress();\n return this;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n */\n protected override async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const payload = _payload || this._payload;\n const config = _options?.config || this._config;\n const { args, ...deployment } = this.buildParameters(payload);\n return await deployContract(config, {\n ...deployment,\n ...this.optionallyAttachAccount(_options?.account),\n // Deployable targets don't construct with arguments, they initialize with encoded payloads\n args: [],\n });\n }\n\n /**\n * Check if the contract supports the given interface\n *\n * @public\n * @async\n * @param {Hex} interfaceId - The interface identifier\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the contract supports the interface\n */\n public async supportsInterface(\n interfaceId: Hex,\n params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,\n ) {\n return await readACloneableSupportsInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [interfaceId],\n });\n }\n\n /**\n * Return a cloneable's unique identifier for downstream consumers to differentiate various targets\n * All implementations must override this function\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Hex>}\n */\n public async getComponentInterface(\n params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,\n ) {\n return await readACloneableGetComponentInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [],\n });\n }\n\n /**\n * @inheritdoc\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n */\n protected override validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const payload = _payload || this._payload;\n if (!payload) throw new DeployableMissingPayloadError();\n return super.validateDeploymentConfig(payload, _options) as [\n P,\n DeployableOptions,\n ];\n }\n}\n"],"names":["_DeployableTarget","Deployable","options","payload","isBase","isAddress","zeroAddress","base","isAddressEqual","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","RegistryType","DeployableTarget"],"mappings":";;;;;;AAoCO,MAAMA,IAAN,MAAMA,UAGHC,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4CzC,YACEC,GACAC,GACAC,GACA;AACA,UAAMF,GAASC,CAAO,GA1BxB,KAAS,UAAmB,IA6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EjD,MAAM,CAAC;AAAA,IAAA,CACR;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,kBACXM,GACAC,GACA;AACO,WAAA,MAAMC,EAAgC,KAAK,SAAS;AAAA,MACzD,SAAS,KAAK,mBAAmB;AAAA,MACjC,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAID;AAAA,MACJ,MAAM,CAACD,CAAW;AAAA,IAAA,CACnB;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,sBACXC,GACA;AACO,WAAA,MAAME,EAAoC,KAAK,SAAS;AAAA,MAC7D,SAAS,KAAK,mBAAmB;AAAA,MACjC,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIF;AAAA,MACJ,MAAM,CAAC;AAAA,IAAA,CACR;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWmB,yBACjBR,GACAC,GACA;AACM,UAAAR,IAAUO,KAAY,KAAK;AACjC,QAAI,CAACP,EAAe,OAAA,IAAIkB;AACjB,WAAA,MAAM,yBAAyBlB,GAASQ,CAAQ;AAAA,EAIzD;AACF;AA1LEX,EAAgB,QAAiC,IAQjDA,EAAgB,eAA6BsB,EAAa;AAnBrD,IAAMC,IAANvB;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-DHerxf1y.cjs"),c=require("./DeployableTarget.cjs");var h=(n=>(n[n.MANAGER=1n]="MANAGER",n[n.ADMIN=2n]="ADMIN",n))(h||{});class l extends c.DeployableTarget{async setAuthorized(t,s,a){return await this.awaitResult(this.setAuthorizedRaw(t,s,a))}async setAuthorizedRaw(t,s,a){const{request:i,result:r}=await e.O6(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.b6(this._config,i),result:r}}async grantRoles(t,s,a){return await this.awaitResult(this.grantRolesRaw(t,s,a))}async grantRolesRaw(t,s,a){const{request:i,result:r}=await e.I6(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.u6(this._config,i),result:r}}async revokeRoles(t,s,a){return await this.awaitResult(this.revokeRolesRaw(t,s,a))}async revokeRolesRaw(t,s,a){const{request:i,result:r}=await e.R6(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.m6(this._config,i),result:r}}async grantManyRoles(t,s,a){return await this.awaitResult(this.grantManyRolesRaw(t,s,a))}async grantManyRolesRaw(t,s,a){const{request:i,result:r}=await e.A6(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.p6(this._config,i),result:r}}async revokeManyRoles(t,s,a){return await this.awaitResult(this.revokeManyRolesRaw(t,s,a))}async revokeManyRolesRaw(t,s,a){const{request:i,result:r}=await e.M6(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.c6(this._config,i),result:r}}async rolesOf(t,s){const a=await e.i6(this._config,{address:this.assertValidAddress(),args:[t],...this.optionallyAttachAccount(),...s});return[h.MANAGER,h.ADMIN].filter(i=>(a&i)===i)}hasAnyRole(t,s,a){return e.e6(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a})}hasAllRoles(t,s,a){return e.YR(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a})}isAuthorized(t,s){return e.t6(this._config,{address:this.assertValidAddress(),args:[t],...this.optionallyAttachAccount(),...s})}}exports.rbacAbi=e.R;exports.DeployableTargetWithRBAC=l;exports.Roles=h;
2
+ //# sourceMappingURL=DeployableTargetWithRBAC.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeployableTargetWithRBAC.cjs","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"sourcesContent":["import {\n rbacAbi,\n readRbacHasAllRoles,\n readRbacHasAnyRole,\n readRbacIsAuthorized,\n readRbacRolesOf,\n simulateRbacGrantManyRoles,\n simulateRbacGrantRoles,\n simulateRbacRevokeManyRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeRbacGrantManyRoles,\n writeRbacGrantRoles,\n writeRbacRevokeManyRoles,\n writeRbacRevokeRoles,\n writeRbacSetAuthorized,\n} from '@boostxyz/evm';\nimport type { Abi, Address, ContractEventName } from 'viem';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport type { GenericLog, ReadParams, WriteParams } from '../utils';\nexport { rbacAbi };\n\n/**\n * Enum representing available roles for use with the `RBAC` authorization scheme.\n * `MANAGER` has lowest level of write permissions, for specific implementations, see Budgets and ALlowLists\n * `ADMIN` can additionally manage authorized users on the contract.\n *\n * @export\n * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}\n * @enum {bigint}\n */\nexport enum Roles {\n //@ts-expect-error ts doesn't like bigint enum values\n MANAGER = 1n,\n //@ts-expect-error ts doesn't like bigint enum values\n ADMIN = 2n,\n}\n\n/**\n * A generic `viem.Log` event with support for `Rbac` event types.\n *\n * @export\n * @typedef {RBACLog}\n * @template {ContractEventName<typeof rbacAbi>} [event=ContractEventName<\n * typeof rbacAbi\n * >]\n */\nexport type RBACLog<\n event extends ContractEventName<typeof rbacAbi> = ContractEventName<\n typeof rbacAbi\n >,\n> = GenericLog<typeof rbacAbi, event>;\n\n/**\n * A minimal RBAC implementation that offers MANAGER and ADMIN roles, and\n * Budgets and allowlists support this auth scheme\n *\n * @export\n * @class DeployableTargetWithRBAC\n * @typedef {DeployableTargetWithRBAC}\n * @extends {DeployableTarget<RbacPayload>}\n */\nexport class DeployableTargetWithRBAC<\n Payload,\n ABI extends Abi,\n> extends DeployableTarget<Payload, ABI> {\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof rbacAbi, 'setAuthorized'>,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof rbacAbi, 'setAuthorized'>,\n ) {\n const { request, result } = await simulateRbacSetAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeRbacSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Grant permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]\n * @returns {Promise<void>}\n */\n public async grantRoles(\n address: Address,\n role: Roles,\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n return await this.awaitResult(this.grantRolesRaw(address, role, params));\n }\n\n /**\n * Grant permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantRolesRaw(\n address: Address,\n role: Roles,\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantRoles(this._config, {\n address: this.assertValidAddress(),\n args: [address, role],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeRbacGrantRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeRoles(\n address: Address,\n role: Roles,\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n return await this.awaitResult(this.revokeRolesRaw(address, role, params));\n }\n\n /**\n * Revoke permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeRolesRaw(\n address: Address,\n role: Roles,\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(this._config, {\n address: this.assertValidAddress(),\n args: [address, role],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeRbacRevokeRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantManyRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantManyRoles'>,\n ) {\n return await this.awaitResult(\n this.grantManyRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantManyRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantManyRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantManyRoles(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, roles],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeRbacGrantManyRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeManyRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeManyRoles'>,\n ) {\n return await this.awaitResult(\n this.revokeManyRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeManyRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeManyRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeManyRoles(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, roles],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeRbacRevokeManyRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(Roles.ADMIN)\n * ```\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<Array<Roles>>}\n */\n public async rolesOf(\n account: Address,\n params?: ReadParams<typeof rbacAbi, 'rolesOf'>,\n ) {\n const roles = await readRbacRolesOf(this._config, {\n address: this.assertValidAddress(),\n args: [account],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return ([Roles.MANAGER, Roles.ADMIN] as unknown as Array<bigint>).filter(\n (role) => (roles & role) === role,\n ) as unknown as Roles[];\n }\n\n /**\n * Returns whether given account has any of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAnyRole(0xfoo, Roles.ADMIN | Roles.MANAGER)\n * ```\n * @public\n * @param {Address} account\n * @param {Roles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAnyRole(\n account: Address,\n roles: Roles,\n params?: ReadParams<typeof rbacAbi, 'hasAnyRole'>,\n ) {\n return readRbacHasAnyRole(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Returns whether given account has all of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAllRoles(0xfoo, Roles.ADMIN | Roles.MANAGER)\n * ```\n * @public\n * @param {Address} account\n * @param {Roles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAllRoles(\n account: Address,\n roles: Roles,\n params?: ReadParams<typeof rbacAbi, 'hasAllRoles'>,\n ) {\n return readRbacHasAllRoles(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if the given account is authorized to use the rbac\n *\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the account is authorized\n */\n public isAuthorized(\n account: Address,\n params?: ReadParams<typeof rbacAbi, 'isAuthorized'>,\n ) {\n return readRbacIsAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [account],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n}\n"],"names":["Roles","DeployableTargetWithRBAC","DeployableTarget","addresses","allowed","params","request","result","simulateRbacSetAuthorized","writeRbacSetAuthorized","address","role","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writeRbacRevokeRoles","roles","simulateRbacGrantManyRoles","writeRbacGrantManyRoles","simulateRbacRevokeManyRoles","writeRbacRevokeManyRoles","account","readRbacRolesOf","readRbacHasAnyRole","readRbacHasAllRoles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CAAA,CACL,EACD,MAAQ,CAACL,EAAM,QAASA,EAAM,KAAK,EAA+B,OAC/DW,IAAUK,EAAQL,KAAUA,CAAA,CAEjC,CAeO,WACLU,EACAL,EACAX,EACA,CACO,OAAAkB,EAAA,GAAmB,KAAK,QAAS,CACtC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACF,EAASL,CAAK,EACrB,GAAG,KAAK,wBAAwB,EAEhC,GAAIX,CAAA,CACL,CACH,CAeO,YACLgB,EACAL,EACAX,EACA,CACO,OAAAmB,EAAA,GAAoB,KAAK,QAAS,CACvC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACH,EAASL,CAAK,EACrB,GAAG,KAAK,wBAAwB,EAEhC,GAAIX,CAAA,CACL,CACH,CAUO,aACLgB,EACAhB,EACA,CACO,OAAAoB,EAAA,GAAqB,KAAK,QAAS,CACxC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACJ,CAAO,EACd,GAAG,KAAK,wBAAwB,EAEhC,GAAIhB,CAAA,CACL,CACH,CACF"}
@@ -0,0 +1,248 @@
1
+ import { rbacAbi } from '@boostxyz/evm';
2
+ import type { Abi, Address, ContractEventName } from 'viem';
3
+ import { DeployableTarget } from '../Deployable/DeployableTarget';
4
+ import type { GenericLog, ReadParams, WriteParams } from '../utils';
5
+ export { rbacAbi };
6
+ /**
7
+ * Enum representing available roles for use with the `RBAC` authorization scheme.
8
+ * `MANAGER` has lowest level of write permissions, for specific implementations, see Budgets and ALlowLists
9
+ * `ADMIN` can additionally manage authorized users on the contract.
10
+ *
11
+ * @export
12
+ * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}
13
+ * @enum {bigint}
14
+ */
15
+ export declare enum Roles {
16
+ MANAGER,
17
+ ADMIN
18
+ }
19
+ /**
20
+ * A generic `viem.Log` event with support for `Rbac` event types.
21
+ *
22
+ * @export
23
+ * @typedef {RBACLog}
24
+ * @template {ContractEventName<typeof rbacAbi>} [event=ContractEventName<
25
+ * typeof rbacAbi
26
+ * >]
27
+ */
28
+ export type RBACLog<event extends ContractEventName<typeof rbacAbi> = ContractEventName<typeof rbacAbi>> = GenericLog<typeof rbacAbi, event>;
29
+ /**
30
+ * A minimal RBAC implementation that offers MANAGER and ADMIN roles, and
31
+ * Budgets and allowlists support this auth scheme
32
+ *
33
+ * @export
34
+ * @class DeployableTargetWithRBAC
35
+ * @typedef {DeployableTargetWithRBAC}
36
+ * @extends {DeployableTarget<RbacPayload>}
37
+ */
38
+ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends DeployableTarget<Payload, ABI> {
39
+ /**
40
+ * Set the authorized status of the given accounts
41
+ * The mechanism for managing authorization is left to the implementing contract
42
+ *
43
+ * @public
44
+ * @async
45
+ * @param {Address[]} addresses - The accounts to authorize or deauthorize
46
+ * @param {boolean[]} allowed - The authorization status for the given accounts
47
+ * @param {?WriteParams} [params]
48
+ * @returns {Promise<void>}
49
+ */
50
+ setAuthorized(addresses: Address[], allowed: boolean[], params?: WriteParams<typeof rbacAbi, 'setAuthorized'>): Promise<void>;
51
+ /**
52
+ * Set the authorized status of the given accounts
53
+ * The mechanism for managing authorization is left to the implementing contract
54
+ *
55
+ * @public
56
+ * @async
57
+ * @param {Address[]} addresses - The accounts to authorize or deauthorize
58
+ * @param {boolean[]} allowed - The authorization status for the given accounts
59
+ * @param {?WriteParams} [params]
60
+ * @returns {Promise<void>}
61
+ */
62
+ setAuthorizedRaw(addresses: Address[], allowed: boolean[], params?: WriteParams<typeof rbacAbi, 'setAuthorized'>): Promise<{
63
+ hash: `0x${string}`;
64
+ result: void;
65
+ }>;
66
+ /**
67
+ * Grant permissions for a user on the rbac.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * await rbac.grantRoles('0xfoo', Roles.MANAGER)
72
+ * ```
73
+ * @public
74
+ * @async
75
+ * @param {Address} address
76
+ * @param {Roles} role
77
+ * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]
78
+ * @returns {Promise<void>}
79
+ */
80
+ grantRoles(address: Address, role: Roles, params?: WriteParams<typeof rbacAbi, 'grantRoles'>): Promise<void>;
81
+ /**
82
+ * Grant permissions for a user on the rbac.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * await rbac.grantRoles('0xfoo', Roles.MANAGER)
87
+ * ```
88
+ * @public
89
+ * @async
90
+ * @param {Address} address
91
+ * @param {Roles} role
92
+ * @param {?WriteParams} [params]
93
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
94
+ */
95
+ grantRolesRaw(address: Address, role: Roles, params?: WriteParams<typeof rbacAbi, 'grantRoles'>): Promise<{
96
+ hash: `0x${string}`;
97
+ result: void;
98
+ }>;
99
+ /**
100
+ * Revoke permissions for a user on the rbac.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * await rbac.revokeRoles('0xfoo', Roles.MANAGER)
105
+ * ```
106
+ * @public
107
+ * @async
108
+ * @param {Address} address
109
+ * @param {Roles} role
110
+ * @param {?WriteParams} [params]
111
+ * @returns {Promise<void>}
112
+ */
113
+ revokeRoles(address: Address, role: Roles, params?: WriteParams<typeof rbacAbi, 'revokeRoles'>): Promise<void>;
114
+ /**
115
+ * Revoke permissions for a user on the rbac.
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * await rbac.revokeRoles('0xfoo', Roles.MANAGER)
120
+ * ```
121
+ * @public
122
+ * @async
123
+ * @param {Address} address
124
+ * @param {Roles} role
125
+ * @param {?WriteParams} [params]
126
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
127
+ */
128
+ revokeRolesRaw(address: Address, role: Roles, params?: WriteParams<typeof rbacAbi, 'revokeRoles'>): Promise<{
129
+ hash: `0x${string}`;
130
+ result: void;
131
+ }>;
132
+ /**
133
+ * Grant many accounts permissions on the rbac.
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
138
+ * ```
139
+ * @public
140
+ * @async
141
+ * @param {Address[]} addresses
142
+ * @param {Roles[]} roles
143
+ * @param {?WriteParams} [params]
144
+ * @returns {Promise<void>}
145
+ */
146
+ grantManyRoles(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'grantManyRoles'>): Promise<void>;
147
+ /**
148
+ * Grant many accounts permissions on the rbac.
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
153
+ * ```
154
+ * @public
155
+ * @async
156
+ * @param {Address[]} addresses
157
+ * @param {Roles[]} roles
158
+ * @param {?WriteParams} [params]
159
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
160
+ */
161
+ grantManyRolesRaw(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'grantManyRoles'>): Promise<{
162
+ hash: `0x${string}`;
163
+ result: void;
164
+ }>;
165
+ /**
166
+ * Revoke many accounts' permissions on the rbac.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
171
+ * ```
172
+ * @public
173
+ * @async
174
+ * @param {Address[]} addresses
175
+ * @param {Roles[]} roles
176
+ * @param {?WriteParams} [params]
177
+ * @returns {Promise<void>}
178
+ */
179
+ revokeManyRoles(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'revokeManyRoles'>): Promise<void>;
180
+ /**
181
+ * Revoke many accounts' permissions on the rbac.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
186
+ * ```
187
+ * @public
188
+ * @async
189
+ * @param {Address[]} addresses
190
+ * @param {Roles[]} roles
191
+ * @param {?WriteParams} [params]
192
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
193
+ */
194
+ revokeManyRolesRaw(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'revokeManyRoles'>): Promise<{
195
+ hash: `0x${string}`;
196
+ result: void;
197
+ }>;
198
+ /**
199
+ * Return an array of the roles assigned to the given account.
200
+ * @example
201
+ * ```ts
202
+ * (await rbac.rolesOf(0xfoo)).includes(Roles.ADMIN)
203
+ * ```
204
+ * @public
205
+ * @param {Address} account
206
+ * @param {?ReadParams} [params]
207
+ * @returns {Promise<Array<Roles>>}
208
+ */
209
+ rolesOf(account: Address, params?: ReadParams<typeof rbacAbi, 'rolesOf'>): Promise<Roles[]>;
210
+ /**
211
+ * Returns whether given account has any of the provided roles bitmap.
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * await rbac.hasAnyRole(0xfoo, Roles.ADMIN | Roles.MANAGER)
216
+ * ```
217
+ * @public
218
+ * @param {Address} account
219
+ * @param {Roles} roles
220
+ * @param {?ReadParams} [params]
221
+ * @returns {Promise<boolean>}
222
+ */
223
+ hasAnyRole(account: Address, roles: Roles, params?: ReadParams<typeof rbacAbi, 'hasAnyRole'>): Promise<boolean>;
224
+ /**
225
+ * Returns whether given account has all of the provided roles bitmap.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * await rbac.hasAllRoles(0xfoo, Roles.ADMIN | Roles.MANAGER)
230
+ * ```
231
+ * @public
232
+ * @param {Address} account
233
+ * @param {Roles} roles
234
+ * @param {?ReadParams} [params]
235
+ * @returns {Promise<boolean>}
236
+ */
237
+ hasAllRoles(account: Address, roles: Roles, params?: ReadParams<typeof rbacAbi, 'hasAllRoles'>): Promise<boolean>;
238
+ /**
239
+ * Check if the given account is authorized to use the rbac
240
+ *
241
+ * @public
242
+ * @param {Address} account
243
+ * @param {?ReadParams} [params]
244
+ * @returns {Promise<boolean>} - True if the account is authorized
245
+ */
246
+ isAuthorized(account: Address, params?: ReadParams<typeof rbacAbi, 'isAuthorized'>): Promise<boolean>;
247
+ }
248
+ //# sourceMappingURL=DeployableTargetWithRBAC.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeployableTargetWithRBAC.d.ts","sourceRoot":"","s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