@boostxyz/sdk 0.0.0-alpha.17 → 0.0.0-alpha.18

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 (203) 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 +13 -13
  4. package/dist/Actions/ContractAction.d.ts +9 -9
  5. package/dist/Actions/ContractAction.d.ts.map +1 -1
  6. package/dist/Actions/ERC721MintAction.d.ts +12 -12
  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 +32 -49
  11. package/dist/Actions/EventAction.d.ts.map +1 -1
  12. package/dist/Actions/EventAction.js +13 -962
  13. package/dist/Actions/EventAction.js.map +1 -1
  14. package/dist/AllowLists/AllowList.cjs +1 -1
  15. package/dist/AllowLists/AllowList.js +3 -3
  16. package/dist/AllowLists/SimpleAllowList.cjs +1 -1
  17. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
  18. package/dist/AllowLists/SimpleAllowList.d.ts +5 -5
  19. package/dist/AllowLists/SimpleAllowList.js +24 -24
  20. package/dist/AllowLists/SimpleAllowList.js.map +1 -1
  21. package/dist/AllowLists/SimpleDenyList.cjs +1 -1
  22. package/dist/AllowLists/SimpleDenyList.d.ts +6 -6
  23. package/dist/AllowLists/SimpleDenyList.js +3 -3
  24. package/dist/Auth/PassthroughAuth.cjs +1 -1
  25. package/dist/Auth/PassthroughAuth.js +1 -1
  26. package/dist/Boost.cjs.map +1 -1
  27. package/dist/Boost.d.ts +18 -0
  28. package/dist/Boost.d.ts.map +1 -1
  29. package/dist/Boost.js.map +1 -1
  30. package/dist/BoostCore-BiPwp6SR.cjs +3 -0
  31. package/dist/BoostCore-BiPwp6SR.cjs.map +1 -0
  32. package/dist/BoostCore-C00iqvks.js +1477 -0
  33. package/dist/BoostCore-C00iqvks.js.map +1 -0
  34. package/dist/BoostCore.cjs +1 -2
  35. package/dist/BoostCore.cjs.map +1 -1
  36. package/dist/BoostCore.d.ts +80 -35
  37. package/dist/BoostCore.d.ts.map +1 -1
  38. package/dist/BoostCore.js +29 -1273
  39. package/dist/BoostCore.js.map +1 -1
  40. package/dist/BoostRegistry.cjs +1 -1
  41. package/dist/BoostRegistry.cjs.map +1 -1
  42. package/dist/BoostRegistry.d.ts +18 -18
  43. package/dist/BoostRegistry.js +28 -28
  44. package/dist/BoostRegistry.js.map +1 -1
  45. package/dist/Budgets/Budget.cjs +1 -1
  46. package/dist/Budgets/Budget.js +2 -2
  47. package/dist/Budgets/ManagedBudget.cjs +1 -1
  48. package/dist/Budgets/ManagedBudget.cjs.map +1 -1
  49. package/dist/Budgets/ManagedBudget.d.ts +18 -18
  50. package/dist/Budgets/ManagedBudget.js +48 -48
  51. package/dist/Budgets/ManagedBudget.js.map +1 -1
  52. package/dist/Budgets/VestingBudget.d.ts +23 -23
  53. package/dist/Deployable/Contract.cjs +1 -1
  54. package/dist/Deployable/Contract.cjs.map +1 -1
  55. package/dist/Deployable/Contract.d.ts +4 -5
  56. package/dist/Deployable/Contract.d.ts.map +1 -1
  57. package/dist/Deployable/Contract.js +4 -5
  58. package/dist/Deployable/Contract.js.map +1 -1
  59. package/dist/Deployable/Deployable.cjs.map +1 -1
  60. package/dist/Deployable/Deployable.d.ts +1 -1
  61. package/dist/Deployable/Deployable.js +1 -1
  62. package/dist/Deployable/Deployable.js.map +1 -1
  63. package/dist/Deployable/DeployableTarget.cjs +1 -1
  64. package/dist/Deployable/DeployableTarget.cjs.map +1 -1
  65. package/dist/Deployable/DeployableTarget.d.ts +5 -5
  66. package/dist/Deployable/DeployableTarget.js +10 -10
  67. package/dist/Deployable/DeployableTarget.js.map +1 -1
  68. package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
  69. package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -1
  70. package/dist/Deployable/DeployableTargetWithRBAC.d.ts +15 -15
  71. package/dist/Deployable/DeployableTargetWithRBAC.js +32 -32
  72. package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -1
  73. package/dist/EventAction-BO5WI_5s.js +1355 -0
  74. package/dist/EventAction-BO5WI_5s.js.map +1 -0
  75. package/dist/EventAction-DBDRaG4A.cjs +2 -0
  76. package/dist/EventAction-DBDRaG4A.cjs.map +1 -0
  77. package/dist/{Incentive-DJf-vdyL.js → Incentive-CF7kaz_9.js} +61 -62
  78. package/dist/Incentive-CF7kaz_9.js.map +1 -0
  79. package/dist/{Incentive-DNwROd1r.cjs → Incentive-Djnzseoj.cjs} +2 -2
  80. package/dist/Incentive-Djnzseoj.cjs.map +1 -0
  81. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  82. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  83. package/dist/Incentives/AllowListIncentive.d.ts +12 -12
  84. package/dist/Incentives/AllowListIncentive.js +19 -19
  85. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  86. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  87. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  88. package/dist/Incentives/CGDAIncentive.d.ts +15 -15
  89. package/dist/Incentives/CGDAIncentive.js +18 -18
  90. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  91. package/dist/Incentives/ERC1155Incentive.d.ts +30 -30
  92. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  93. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  94. package/dist/Incentives/ERC20Incentive.d.ts +23 -23
  95. package/dist/Incentives/ERC20Incentive.js +25 -25
  96. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  97. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +523 -0
  98. package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
  99. package/dist/Incentives/ERC20VariableIncentive.d.ts +19 -19
  100. package/dist/Incentives/Incentive.cjs +1 -1
  101. package/dist/Incentives/Incentive.d.ts +3 -3
  102. package/dist/Incentives/Incentive.d.ts.map +1 -1
  103. package/dist/Incentives/Incentive.js +3 -3
  104. package/dist/Incentives/PointsIncentive.cjs +1 -1
  105. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  106. package/dist/Incentives/PointsIncentive.d.ts +14 -14
  107. package/dist/Incentives/PointsIncentive.js +21 -21
  108. package/dist/Incentives/PointsIncentive.js.map +1 -1
  109. package/dist/{SimpleDenyList-DMlUkmAn.cjs → SimpleDenyList-BwfNjRsg.cjs} +2 -2
  110. package/dist/SimpleDenyList-BwfNjRsg.cjs.map +1 -0
  111. package/dist/{SimpleDenyList-DvUvmOeE.js → SimpleDenyList-D9i4rw_F.js} +9 -9
  112. package/dist/SimpleDenyList-D9i4rw_F.js.map +1 -0
  113. package/dist/Validators/SignerValidator.cjs +1 -1
  114. package/dist/Validators/SignerValidator.cjs.map +1 -1
  115. package/dist/Validators/SignerValidator.d.ts +14 -14
  116. package/dist/Validators/SignerValidator.js +19 -19
  117. package/dist/Validators/SignerValidator.js.map +1 -1
  118. package/dist/Validators/Validator.cjs +1 -1
  119. package/dist/Validators/Validator.cjs.map +1 -1
  120. package/dist/Validators/Validator.d.ts +1 -1
  121. package/dist/Validators/Validator.js +6 -6
  122. package/dist/Validators/Validator.js.map +1 -1
  123. package/dist/claiming.cjs.map +1 -1
  124. package/dist/claiming.d.ts +1 -1
  125. package/dist/claiming.js.map +1 -1
  126. package/dist/componentInterfaces-D09mhzxO.cjs +2 -0
  127. package/dist/componentInterfaces-D09mhzxO.cjs.map +1 -0
  128. package/dist/componentInterfaces-RXBMI5yH.js +14 -0
  129. package/dist/componentInterfaces-RXBMI5yH.js.map +1 -0
  130. package/dist/deployments-BM42vImE.js +43 -0
  131. package/dist/deployments-BM42vImE.js.map +1 -0
  132. package/dist/deployments-CMdF5uEC.cjs +2 -0
  133. package/dist/deployments-CMdF5uEC.cjs.map +1 -0
  134. package/dist/deployments.json +15 -12
  135. package/dist/errors.cjs +1 -1
  136. package/dist/errors.cjs.map +1 -1
  137. package/dist/errors.d.ts +132 -0
  138. package/dist/errors.d.ts.map +1 -1
  139. package/dist/errors.js +122 -36
  140. package/dist/errors.js.map +1 -1
  141. package/dist/generated-B0tk-c9b.cjs +3 -0
  142. package/dist/generated-B0tk-c9b.cjs.map +1 -0
  143. package/dist/{generated-C_7Jx3YG.js → generated-B8VWObPa.js} +631 -343
  144. package/dist/generated-B8VWObPa.js.map +1 -0
  145. package/dist/index.cjs +1 -1
  146. package/dist/index.d.ts +1 -0
  147. package/dist/index.d.ts.map +1 -1
  148. package/dist/index.js +133 -125
  149. package/dist/transfers.cjs.map +1 -1
  150. package/dist/transfers.d.ts +1 -1
  151. package/dist/transfers.js.map +1 -1
  152. package/dist/utils.cjs.map +1 -1
  153. package/dist/utils.d.ts +1 -1
  154. package/dist/utils.js.map +1 -1
  155. package/package.json +5 -5
  156. package/src/Actions/ContractAction.ts +9 -10
  157. package/src/Actions/ERC721MintAction.ts +12 -13
  158. package/src/Actions/EventAction.test.ts +45 -54
  159. package/src/Actions/EventAction.ts +100 -100
  160. package/src/AllowLists/SimpleAllowList.ts +5 -5
  161. package/src/AllowLists/SimpleDenyList.ts +6 -6
  162. package/src/Boost.ts +19 -0
  163. package/src/BoostCore.test.ts +117 -1
  164. package/src/BoostCore.ts +113 -54
  165. package/src/BoostRegistry.ts +18 -18
  166. package/src/Budgets/ManagedBudget.ts +18 -18
  167. package/src/Budgets/VestingBudget.ts +23 -23
  168. package/src/Deployable/Contract.ts +4 -5
  169. package/src/Deployable/Deployable.ts +1 -1
  170. package/src/Deployable/DeployableTarget.ts +5 -5
  171. package/src/Deployable/DeployableTargetWithRBAC.ts +15 -15
  172. package/src/Incentives/AllowListIncentive.ts +12 -12
  173. package/src/Incentives/CGDAIncentive.ts +15 -15
  174. package/src/Incentives/ERC1155Incentive.ts +26 -26
  175. package/src/Incentives/ERC20Incentive.ts +23 -23
  176. package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
  177. package/src/Incentives/ERC20VariableCriteriaIncentive.ts +309 -0
  178. package/src/Incentives/ERC20VariableIncentive.ts +19 -19
  179. package/src/Incentives/Incentive.ts +6 -5
  180. package/src/Incentives/PointsIncentive.test.ts +21 -21
  181. package/src/Incentives/PointsIncentive.ts +14 -14
  182. package/src/Validators/SignerValidator.ts +14 -14
  183. package/src/Validators/Validator.ts +1 -1
  184. package/src/claiming.ts +1 -1
  185. package/src/errors.ts +165 -0
  186. package/src/index.ts +1 -0
  187. package/src/transfers.ts +1 -1
  188. package/src/utils.ts +1 -1
  189. package/dist/Incentive-DJf-vdyL.js.map +0 -1
  190. package/dist/Incentive-DNwROd1r.cjs.map +0 -1
  191. package/dist/SimpleDenyList-DMlUkmAn.cjs.map +0 -1
  192. package/dist/SimpleDenyList-DvUvmOeE.js.map +0 -1
  193. package/dist/componentInterfaces-BPVR_Ykd.js +0 -13
  194. package/dist/componentInterfaces-BPVR_Ykd.js.map +0 -1
  195. package/dist/componentInterfaces-BfppSIl4.cjs +0 -2
  196. package/dist/componentInterfaces-BfppSIl4.cjs.map +0 -1
  197. package/dist/deployments-BvFcK_eR.js +0 -40
  198. package/dist/deployments-BvFcK_eR.js.map +0 -1
  199. package/dist/deployments-Ho4PnGCS.cjs +0 -2
  200. package/dist/deployments-Ho4PnGCS.cjs.map +0 -1
  201. package/dist/generated-CMQ6ZC2_.cjs +0 -3
  202. package/dist/generated-CMQ6ZC2_.cjs.map +0 -1
  203. package/dist/generated-C_7Jx3YG.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DeployableTarget.cjs","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing a map of stringified chain ID's to the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Record<string, Address>}\n */\n static readonly bases: Record<number, Address> = {};\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n readonly _isBase: boolean = true;\n public get isBase() {\n if (\n !!this.address &&\n Object.values(this.bases).some((base) =>\n // biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above\n isAddressEqual(this.address!, base),\n )\n )\n return true;\n return this._isBase;\n }\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n // if supplying a custom address, safe enough to assume it is not a base address which makes reusing contracts like budgets easier\n if (\n typeof payload === 'string' &&\n isAddress(payload) &&\n payload !== zeroAddress &&\n !Object.values(this.bases).some((base) => {\n if (!payload || !base) return false;\n return isAddressEqual(payload, base);\n })\n )\n isBase = false;\n if (isBase !== undefined) this._isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static addresses by numerical chain ID\n *\n * @public\n * @readonly\n * @type {Record<number, Address>}\n */\n public get bases(): Record<number, Address> {\n return (this.constructor as typeof DeployableTarget).bases;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {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","base","isAddressEqual","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","RegistryType","DeployableTarget"],"mappings":"2PAoCaA,EAAN,MAAMA,UAGHC,EAAAA,UAAiC,CA4CzC,YACEC,EACAC,EACAC,EACA,CACA,MAAMF,EAASC,CAAO,EA1BxB,KAAS,QAAmB,GA6BxB,OAAOA,GAAY,UACnBE,EAAU,UAAAF,CAAO,GACjBA,IAAYG,EAAAA,aACZ,CAAC,OAAO,OAAO,KAAK,KAAK,EAAE,KAAMC,GAC3B,CAACJ,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UO,GAAY,KAAK,SACjC,GAAI,CAACP,EAAe,MAAA,IAAIkB,EAAAA,8BACjB,OAAA,MAAM,yBAAyBlB,EAASQ,CAAQ,CAIzD,CACF,EA1LEX,EAAgB,MAAiC,GAQjDA,EAAgB,aAA6BsB,EAAa,aAAA,OAnBrD,IAAMC,EAANvB"}
1
+ {"version":3,"file":"DeployableTarget.cjs","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing a map of stringified chain ID's to the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Record<string, Address>}\n */\n static readonly bases: Record<number, Address> = {};\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n readonly _isBase: boolean = true;\n public get isBase() {\n if (\n !!this.address &&\n Object.values(this.bases).some((base) =>\n // biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above\n isAddressEqual(this.address!, base),\n )\n )\n return true;\n return this._isBase;\n }\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n // if supplying a custom address, safe enough to assume it is not a base address which makes reusing contracts like budgets easier\n if (\n typeof payload === 'string' &&\n isAddress(payload) &&\n payload !== zeroAddress &&\n !Object.values(this.bases).some((base) => {\n if (!payload || !base) return false;\n return isAddressEqual(payload, base);\n })\n )\n isBase = false;\n if (isBase !== undefined) this._isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static addresses by numerical chain ID\n *\n * @public\n * @readonly\n * @type {Record<number, Address>}\n */\n public get bases(): Record<number, Address> {\n return (this.constructor as typeof DeployableTarget).bases;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<this>}\n */\n protected override async deploy(\n payload?: Payload,\n options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n await super.deploy(payload, options, waitParams);\n this.assertValidAddress();\n return this;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n */\n protected override async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const payload = _payload || this._payload;\n const config = _options?.config || this._config;\n const { args, ...deployment } = this.buildParameters(payload);\n return await deployContract(config, {\n ...deployment,\n ...this.optionallyAttachAccount(_options?.account),\n // Deployable targets don't construct with arguments, they initialize with encoded payloads\n args: [],\n });\n }\n\n /**\n * Check if the contract supports the given interface\n *\n * @public\n * @async\n * @param {Hex} interfaceId - The interface identifier\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the contract supports the interface\n */\n public async supportsInterface(\n interfaceId: Hex,\n params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,\n ) {\n return await readACloneableSupportsInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [interfaceId],\n });\n }\n\n /**\n * Return a cloneable's unique identifier for downstream consumers to differentiate various targets\n * All implementations must override this function\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Hex>}\n */\n public async getComponentInterface(\n params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,\n ) {\n return await readACloneableGetComponentInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [],\n });\n }\n\n /**\n * @inheritdoc\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n */\n protected override validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const payload = _payload || this._payload;\n if (!payload) throw new DeployableMissingPayloadError();\n return super.validateDeploymentConfig(payload, _options) as [\n P,\n DeployableOptions,\n ];\n }\n}\n"],"names":["_DeployableTarget","Deployable","options","payload","isBase","isAddress","zeroAddress","base","isAddressEqual","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","RegistryType","DeployableTarget"],"mappings":"2PAoCaA,EAAN,MAAMA,UAGHC,EAAAA,UAAiC,CA4CzC,YACEC,EACAC,EACAC,EACA,CACA,MAAMF,EAASC,CAAO,EA1BxB,KAAS,QAAmB,GA6BxB,OAAOA,GAAY,UACnBE,EAAU,UAAAF,CAAO,GACjBA,IAAYG,EAAAA,aACZ,CAAC,OAAO,OAAO,KAAK,KAAK,EAAE,KAAMC,GAC3B,CAACJ,GAAW,CAACI,EAAa,GACvBC,EAAA,eAAeL,EAASI,CAAI,CACpC,IAEQH,EAAA,IACPA,IAAW,SAAW,KAAK,QAAUA,EAC3C,CAtCA,IAAW,QAAS,CAEhB,OAAE,KAAK,SACP,OAAO,OAAO,KAAK,KAAK,EAAE,KAAMG,GAE9BC,iBAAe,KAAK,QAAUD,CAAI,CACpC,EAEO,GACF,KAAK,OACd,CAqCA,IAAW,OAAiC,CAC1C,OAAQ,KAAK,YAAwC,KACvD,CASA,IAAW,cAA6B,CACtC,OAAQ,KAAK,YAAwC,YACvD,CAYA,MAAyB,OACvBJ,EACAD,EACAO,EACA,CACA,aAAM,MAAM,OAAON,EAASD,EAASO,CAAU,EAC/C,KAAK,mBAAmB,EACjB,IACT,CAWA,MAAyB,UACvBC,EACAC,EACe,CACf,GAAI,KAAK,QAAS,MAAM,IAAIC,EAAAA,+BAA+B,KAAK,OAAO,EACjE,MAAAT,EAAUO,GAAY,KAAK,SAC3BG,GAASF,GAAA,YAAAA,EAAU,SAAU,KAAK,QAClC,CAAE,KAAAG,EAAM,GAAGC,GAAe,KAAK,gBAAgBZ,CAAO,EACrD,OAAA,MAAMa,iBAAeH,EAAQ,CAClC,GAAGE,EACH,GAAG,KAAK,wBAAwBJ,GAAA,YAAAA,EAAU,OAAO,EAEjD,KAAM,CAAC,CAAA,CACR,CACH,CAWA,MAAa,kBACXM,EACAC,EACA,CACO,OAAA,MAAMC,EAAAA,GAAgC,KAAK,QAAS,CACzD,QAAS,KAAK,mBAAmB,EACjC,GAAG,KAAK,wBAAwB,EAEhC,GAAID,EACJ,KAAM,CAACD,CAAW,CAAA,CACnB,CACH,CAWA,MAAa,sBACXC,EACA,CACO,OAAA,MAAME,EAAAA,GAAoC,KAAK,QAAS,CAC7D,QAAS,KAAK,mBAAmB,EACjC,GAAG,KAAK,wBAAwB,EAEhC,GAAIF,EACJ,KAAM,CAAC,CAAA,CACR,CACH,CAWmB,yBACjBR,EACAC,EACA,CACM,MAAAR,EAAUO,GAAY,KAAK,SACjC,GAAI,CAACP,EAAe,MAAA,IAAIkB,EAAAA,8BACjB,OAAA,MAAM,yBAAyBlB,EAASQ,CAAQ,CAIzD,CACF,EA1LEX,EAAgB,MAAiC,GAQjDA,EAAgB,aAA6BsB,EAAa,aAAA,OAnBrD,IAAMC,EAANvB"}
@@ -69,7 +69,7 @@ export declare class DeployableTarget<Payload, ContractAbi extends Abi> extends
69
69
  * @param {?Payload} [payload]
70
70
  * @param {?DeployableOptions} [options]
71
71
  * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
72
- * @returns {unknown}
72
+ * @returns {Promise<this>}
73
73
  */
74
74
  protected deploy(payload?: Payload, options?: DeployableOptions, waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>): Promise<this>;
75
75
  /**
@@ -88,8 +88,8 @@ export declare class DeployableTarget<Payload, ContractAbi extends Abi> extends
88
88
  * @public
89
89
  * @async
90
90
  * @param {Hex} interfaceId - The interface identifier
91
- * @param {?ReadParams<typeof contractActionAbi, 'supportsInterface'>} [params]
92
- * @returns {unknown} - True if the contract supports the interface
91
+ * @param {?ReadParams} [params]
92
+ * @returns {Promise<boolean>} - True if the contract supports the interface
93
93
  */
94
94
  supportsInterface(interfaceId: Hex, params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>): Promise<boolean>;
95
95
  /**
@@ -98,8 +98,8 @@ export declare class DeployableTarget<Payload, ContractAbi extends Abi> extends
98
98
  *
99
99
  * @public
100
100
  * @async
101
- * @param {?ReadParams<typeof contractActionAbi, 'getComponentInterface'>} [params]
102
- * @returns {unknown}
101
+ * @param {?ReadParams} [params]
102
+ * @returns {Promise<Hex>}
103
103
  */
104
104
  getComponentInterface(params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>): Promise<`0x${string}`>;
105
105
  /**
@@ -1,10 +1,10 @@
1
- import { j as d, Y as c } from "../generated-C_7Jx3YG.js";
1
+ import { p as d, q as c } from "../generated-B8VWObPa.js";
2
2
  import { deployContract as h } from "@wagmi/core";
3
3
  import { isAddress as u, zeroAddress as l, isAddressEqual as a } from "viem";
4
4
  import { DeployableAlreadyDeployedError as y, DeployableMissingPayloadError as f } from "../errors.js";
5
- import { RegistryType as m } from "../utils.js";
6
- import { Deployable as p } from "./Deployable.js";
7
- const i = class i extends p {
5
+ import { RegistryType as p } from "../utils.js";
6
+ import { Deployable as m } from "./Deployable.js";
7
+ const i = class i extends m {
8
8
  /**
9
9
  * Creates an instance of DeployableTarget.
10
10
  *
@@ -52,7 +52,7 @@ const i = class i extends p {
52
52
  * @param {?Payload} [payload]
53
53
  * @param {?DeployableOptions} [options]
54
54
  * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]
55
- * @returns {unknown}
55
+ * @returns {Promise<this>}
56
56
  */
57
57
  async deploy(t, s, r) {
58
58
  return await super.deploy(t, s, r), this.assertValidAddress(), this;
@@ -82,8 +82,8 @@ const i = class i extends p {
82
82
  * @public
83
83
  * @async
84
84
  * @param {Hex} interfaceId - The interface identifier
85
- * @param {?ReadParams<typeof contractActionAbi, 'supportsInterface'>} [params]
86
- * @returns {unknown} - True if the contract supports the interface
85
+ * @param {?ReadParams} [params]
86
+ * @returns {Promise<boolean>} - True if the contract supports the interface
87
87
  */
88
88
  async supportsInterface(t, s) {
89
89
  return await d(this._config, {
@@ -100,8 +100,8 @@ const i = class i extends p {
100
100
  *
101
101
  * @public
102
102
  * @async
103
- * @param {?ReadParams<typeof contractActionAbi, 'getComponentInterface'>} [params]
104
- * @returns {unknown}
103
+ * @param {?ReadParams} [params]
104
+ * @returns {Promise<Hex>}
105
105
  */
106
106
  async getComponentInterface(t) {
107
107
  return await c(this._config, {
@@ -127,7 +127,7 @@ const i = class i extends p {
127
127
  return super.validateDeploymentConfig(r, s);
128
128
  }
129
129
  };
130
- i.bases = {}, i.registryType = m.ACTION;
130
+ i.bases = {}, i.registryType = p.ACTION;
131
131
  let o = i;
132
132
  export {
133
133
  o as DeployableTarget
@@ -1 +1 @@
1
- {"version":3,"file":"DeployableTarget.js","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing a map of stringified chain ID's to the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Record<string, Address>}\n */\n static readonly bases: Record<number, Address> = {};\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n readonly _isBase: boolean = true;\n public get isBase() {\n if (\n !!this.address &&\n Object.values(this.bases).some((base) =>\n // biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above\n isAddressEqual(this.address!, base),\n )\n )\n return true;\n return this._isBase;\n }\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n // if supplying a custom address, safe enough to assume it is not a base address which makes reusing contracts like budgets easier\n if (\n typeof payload === 'string' &&\n isAddress(payload) &&\n payload !== zeroAddress &&\n !Object.values(this.bases).some((base) => {\n if (!payload || !base) return false;\n return isAddressEqual(payload, base);\n })\n )\n isBase = false;\n if (isBase !== undefined) this._isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static addresses by numerical chain ID\n *\n * @public\n * @readonly\n * @type {Record<number, Address>}\n */\n public get bases(): Record<number, Address> {\n return (this.constructor as typeof DeployableTarget).bases;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {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","base","isAddressEqual","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","RegistryType","DeployableTarget"],"mappings":";;;;;;AAoCO,MAAMA,IAAN,MAAMA,UAGHC,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4CzC,YACEC,GACAC,GACAC,GACA;AACA,UAAMF,GAASC,CAAO,GA1BxB,KAAS,UAAmB,IA6BxB,OAAOA,KAAY,YACnBE,EAAUF,CAAO,KACjBA,MAAYG,KACZ,CAAC,OAAO,OAAO,KAAK,KAAK,EAAE,KAAK,CAACC,MAC3B,CAACJ,KAAW,CAACI,IAAa,KACvBC,EAAeL,GAASI,CAAI,CACpC,MAEQH,IAAA,KACPA,MAAW,WAAW,KAAK,UAAUA;AAAA,EAC3C;AAAA,EAtCA,IAAW,SAAS;AAEhB,WAAE,KAAK,WACP,OAAO,OAAO,KAAK,KAAK,EAAE;AAAA,MAAK,CAACG;AAAA;AAAA,QAE9BC,EAAe,KAAK,SAAUD,CAAI;AAAA;AAAA,IACpC,IAEO,KACF,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqCA,IAAW,QAAiC;AAC1C,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;AA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,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;"}
1
+ {"version":3,"file":"DeployableTarget.js","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n isAddress,\n isAddressEqual,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing a map of stringified chain ID's to the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Record<string, Address>}\n */\n static readonly bases: Record<number, Address> = {};\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n readonly _isBase: boolean = true;\n public get isBase() {\n if (\n !!this.address &&\n Object.values(this.bases).some((base) =>\n // biome-ignore lint/style/noNonNullAssertion: won't evaluate this if address checked and defined above\n isAddressEqual(this.address!, base),\n )\n )\n return true;\n return this._isBase;\n }\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n // if supplying a custom address, safe enough to assume it is not a base address which makes reusing contracts like budgets easier\n if (\n typeof payload === 'string' &&\n isAddress(payload) &&\n payload !== zeroAddress &&\n !Object.values(this.bases).some((base) => {\n if (!payload || !base) return false;\n return isAddressEqual(payload, base);\n })\n )\n isBase = false;\n if (isBase !== undefined) this._isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static addresses by numerical chain ID\n *\n * @public\n * @readonly\n * @type {Record<number, Address>}\n */\n public get bases(): Record<number, Address> {\n return (this.constructor as typeof DeployableTarget).bases;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {Promise<this>}\n */\n protected override async deploy(\n payload?: Payload,\n options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n await super.deploy(payload, options, waitParams);\n this.assertValidAddress();\n return this;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n */\n protected override async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const payload = _payload || this._payload;\n const config = _options?.config || this._config;\n const { args, ...deployment } = this.buildParameters(payload);\n return await deployContract(config, {\n ...deployment,\n ...this.optionallyAttachAccount(_options?.account),\n // Deployable targets don't construct with arguments, they initialize with encoded payloads\n args: [],\n });\n }\n\n /**\n * Check if the contract supports the given interface\n *\n * @public\n * @async\n * @param {Hex} interfaceId - The interface identifier\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the contract supports the interface\n */\n public async supportsInterface(\n interfaceId: Hex,\n params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,\n ) {\n return await readACloneableSupportsInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [interfaceId],\n });\n }\n\n /**\n * Return a cloneable's unique identifier for downstream consumers to differentiate various targets\n * All implementations must override this function\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Hex>}\n */\n public async getComponentInterface(\n params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,\n ) {\n return await readACloneableGetComponentInterface(this._config, {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n args: [],\n });\n }\n\n /**\n * @inheritdoc\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n */\n protected override validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const payload = _payload || this._payload;\n if (!payload) throw new DeployableMissingPayloadError();\n return super.validateDeploymentConfig(payload, _options) as [\n P,\n DeployableOptions,\n ];\n }\n}\n"],"names":["_DeployableTarget","Deployable","options","payload","isBase","isAddress","zeroAddress","base","isAddressEqual","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","RegistryType","DeployableTarget"],"mappings":";;;;;;AAoCO,MAAMA,IAAN,MAAMA,UAGHC,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4CzC,YACEC,GACAC,GACAC,GACA;AACA,UAAMF,GAASC,CAAO,GA1BxB,KAAS,UAAmB,IA6BxB,OAAOA,KAAY,YACnBE,EAAUF,CAAO,KACjBA,MAAYG,KACZ,CAAC,OAAO,OAAO,KAAK,KAAK,EAAE,KAAK,CAACC,MAC3B,CAACJ,KAAW,CAACI,IAAa,KACvBC,EAAeL,GAASI,CAAI,CACpC,MAEQH,IAAA,KACPA,MAAW,WAAW,KAAK,UAAUA;AAAA,EAC3C;AAAA,EAtCA,IAAW,SAAS;AAEhB,WAAE,KAAK,WACP,OAAO,OAAO,KAAK,KAAK,EAAE;AAAA,MAAK,CAACG;AAAA;AAAA,QAE9BC,EAAe,KAAK,SAAUD,CAAI;AAAA;AAAA,IACpC,IAEO,KACF,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqCA,IAAW,QAAiC;AAC1C,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,OACvBJ,GACAD,GACAO,GACA;AACA,iBAAM,MAAM,OAAON,GAASD,GAASO,CAAU,GAC/C,KAAK,mBAAmB,GACjB;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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C,IAANvB;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-CMQ6ZC2_.cjs"),c=require("./DeployableTarget.cjs");var n=(i=>(i[i.MANAGER=1n]="MANAGER",i[i.ADMIN=2n]="ADMIN",i))(n||{});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:r,result:o}=await e.F2(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.z2(this._config,r),result:o}}async grantRoles(t,s,a){return await this.awaitResult(this.grantRolesRaw(t,s,a))}async grantRolesRaw(t,s,a){const{request:r,result:o}=await e.L2(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.M2(this._config,r),result:o}}async revokeRoles(t,s,a){return await this.awaitResult(this.revokeRolesRaw(t,s,a))}async revokeRolesRaw(t,s,a){const{request:r,result:o}=await e.D2(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.C2(this._config,r),result:o}}async rolesOf(t,s){const a=await e.h2(this._config,{address:this.assertValidAddress(),args:[t],...this.optionallyAttachAccount(),...s});return[n.MANAGER,n.ADMIN].filter(r=>(a&r)===r)}hasAnyRole(t,s,a){return e.w2(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a})}hasAllRoles(t,s,a){return e.f2(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a})}isAuthorized(t,s){return e.v2(this._config,{address:this.assertValidAddress(),args:[t],...this.optionallyAttachAccount(),...s})}}exports.rbacAbi=e.C;exports.DeployableTargetWithRBAC=l;exports.Roles=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-B0tk-c9b.cjs"),c=require("./DeployableTarget.cjs");var n=(i=>(i[i.MANAGER=1n]="MANAGER",i[i.ADMIN=2n]="ADMIN",i))(n||{});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:r,result:o}=await e.Mg(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.fg(this._config,r),result:o}}async grantRoles(t,s,a){return await this.awaitResult(this.grantRolesRaw(t,s,a))}async grantRolesRaw(t,s,a){const{request:r,result:o}=await e.Ig(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.yg(this._config,r),result:o}}async revokeRoles(t,s,a){return await this.awaitResult(this.revokeRolesRaw(t,s,a))}async revokeRolesRaw(t,s,a){const{request:r,result:o}=await e.Og(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a});return{hash:await e.bg(this._config,r),result:o}}async rolesOf(t,s){const a=await e.og(this._config,{address:this.assertValidAddress(),args:[t],...this.optionallyAttachAccount(),...s});return[n.MANAGER,n.ADMIN].filter(r=>(a&r)===r)}hasAnyRole(t,s,a){return e.ag(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a})}hasAllRoles(t,s,a){return e.ng(this._config,{address:this.assertValidAddress(),args:[t,s],...this.optionallyAttachAccount(),...a})}isAuthorized(t,s){return e.ig(this._config,{address:this.assertValidAddress(),args:[t],...this.optionallyAttachAccount(),...s})}}exports.rbacAbi=e.z;exports.DeployableTargetWithRBAC=l;exports.Roles=n;
2
2
  //# sourceMappingURL=DeployableTargetWithRBAC.cjs.map
@@ -1 +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 simulateRbacGrantRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeRbacGrantRoles,\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<typeof rbacAbi, 'setAuthorized'>} [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<typeof rbacAbi, 'setAuthorized'>} [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 many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]\n * @returns {unknown}\n */\n public async grantRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]\n * @returns {unknown}\n */\n public async grantRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantRoles(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 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 many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams<typeof rbacAbi, 'revokeRoles'>} [params]\n * @returns {unknown}\n */\n public async revokeRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n return await this.awaitResult(\n this.revokeRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams<typeof rbacAbi, 'revokeRoles'>} [params]\n * @returns {unknown}\n */\n public async revokeRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(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 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 * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)\n * @public\n * @param {Address} account\n * @param {?ReadParams<typeof rbacAbi, 'rolesOf'>} [params]\n * @returns {Promise<Array<RbacRoles>>}\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, RbacRoles.ADMIN | RbacRoles.MANAGER)\n * @public\n * @param {Address} account\n * @param {RbacRoles} roles\n * @param {?ReadParams<typeof rbacAbi, 'hasAnyRole'>} [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, RbacRoles.ADMIN & RbacRoles.MANAGER)\n *\n * @public\n * @param {Address} account\n * @param {RbacRoles} roles\n * @param {?ReadParams<typeof rbacAbi, 'hasAllRoles'>} [params]\n * @returns {*}\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<typeof rbacAbi, 'isAuthorized'>} [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","roles","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writeRbacRevokeRoles","account","readRbacRolesOf","role","readRbacHasAnyRole","readRbacHasAllRoles","readRbacIsAuthorized"],"mappings":"iKA2BY,IAAAA,GAAAA,IAEVA,EAAAA,EAAA,QAAU,EAAV,EAAA,UAEAA,EAAAA,EAAA,MAAQ,EAAR,EAAA,QAJUA,IAAAA,GAAA,CAAA,CAAA,EA+BL,MAAMC,UAGHC,EAAAA,gBAA+B,CAYvC,MAAa,cACXC,EACAC,EACAC,EACA,CACA,OAAO,MAAM,KAAK,YAChB,KAAK,iBAAiBF,EAAWC,EAASC,CAAM,CAAA,CAEpD,CAaA,MAAa,iBACXF,EACAC,EACAC,EACA,CACA,KAAM,CAAE,QAAAC,EAAS,OAAAC,CAAA,EAAW,MAAMC,EAAA,GAA0B,KAAK,QAAS,CACxE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACL,EAAWC,CAAO,EACzB,GAAG,KAAK,wBAAwB,EAEhC,GAAIC,CAAA,CACL,EAEM,MAAA,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KAAK,QAAS,CACtC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACH,EAASL,CAAK,EACrB,GAAG,KAAK,wBAAwB,EAEhC,GAAIL,CAAA,CACL,CACH,CAeO,YACLU,EACAL,EACAL,EACA,CACO,OAAAc,EAAA,GAAoB,KAAK,QAAS,CACvC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACJ,EAASL,CAAK,EACrB,GAAG,KAAK,wBAAwB,EAEhC,GAAIL,CAAA,CACL,CACH,CAUO,aACLU,EACAV,EACA,CACO,OAAAe,EAAA,GAAqB,KAAK,QAAS,CACxC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACL,CAAO,EACd,GAAG,KAAK,wBAAwB,EAEhC,GAAIV,CAAA,CACL,CACH,CACF"}
1
+ {"version":3,"file":"DeployableTargetWithRBAC.cjs","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"sourcesContent":["import {\n rbacAbi,\n readRbacHasAllRoles,\n readRbacHasAnyRole,\n readRbacIsAuthorized,\n readRbacRolesOf,\n simulateRbacGrantRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeRbacGrantRoles,\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 many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantRoles(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 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 many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n return await this.awaitResult(\n this.revokeRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(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 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 * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<Array<RbacRoles>>}\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, RbacRoles.ADMIN | RbacRoles.MANAGER)\n * @public\n * @param {Address} account\n * @param {RbacRoles} 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, RbacRoles.ADMIN & RbacRoles.MANAGER)\n *\n * @public\n * @param {Address} account\n * @param {RbacRoles} 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","roles","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writeRbacRevokeRoles","account","readRbacRolesOf","role","readRbacHasAnyRole","readRbacHasAllRoles","readRbacIsAuthorized"],"mappings":"iKA2BY,IAAAA,GAAAA,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AAK,mBAAmB,EACjC,KAAM,CAACV,EAAWO,CAAK,EACvB,GAAG,KAAK,wBAAwB,EAEhC,GAAIL,CAAA,CACL,EAMM,MAAA,CAAE,KALI,MAAMS,EAAA,GACjB,KAAK,QAELR,CAAA,EAEa,OAAAC,EACjB,CAYA,MAAa,QACXQ,EACAV,EACA,CACA,MAAMK,EAAQ,MAAMM,KAAgB,KAAK,QAAS,CAChD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACD,CAAO,EACd,GAAG,KAAK,wBAAwB,EAEhC,GAAIV,CAAA,CACL,EACD,MAAQ,CAACL,EAAM,QAASA,EAAM,KAAK,EAA+B,OAC/DiB,IAAUP,EAAQO,KAAUA,CAAA,CAEjC,CAcO,WACLF,EACAL,EACAL,EACA,CACO,OAAAa,EAAA,GAAmB,KAAK,QAAS,CACtC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACH,EAASL,CAAK,EACrB,GAAG,KAAK,wBAAwB,EAEhC,GAAIL,CAAA,CACL,CACH,CAeO,YACLU,EACAL,EACAL,EACA,CACO,OAAAc,EAAA,GAAoB,KAAK,QAAS,CACvC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACJ,EAASL,CAAK,EACrB,GAAG,KAAK,wBAAwB,EAEhC,GAAIL,CAAA,CACL,CACH,CAUO,aACLU,EACAV,EACA,CACO,OAAAe,EAAA,GAAqB,KAAK,QAAS,CACxC,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACL,CAAO,EACd,GAAG,KAAK,wBAAwB,EAEhC,GAAIV,CAAA,CACL,CACH,CACF"}
@@ -44,7 +44,7 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
44
44
  * @async
45
45
  * @param {Address[]} addresses - The accounts to authorize or deauthorize
46
46
  * @param {boolean[]} allowed - The authorization status for the given accounts
47
- * @param {?WriteParams<typeof rbacAbi, 'setAuthorized'>} [params]
47
+ * @param {?WriteParams} [params]
48
48
  * @returns {Promise<void>}
49
49
  */
50
50
  setAuthorized(addresses: Address[], allowed: boolean[], params?: WriteParams<typeof rbacAbi, 'setAuthorized'>): Promise<void>;
@@ -56,7 +56,7 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
56
56
  * @async
57
57
  * @param {Address[]} addresses - The accounts to authorize or deauthorize
58
58
  * @param {boolean[]} allowed - The authorization status for the given accounts
59
- * @param {?WriteParams<typeof rbacAbi, 'setAuthorized'>} [params]
59
+ * @param {?WriteParams} [params]
60
60
  * @returns {Promise<void>}
61
61
  */
62
62
  setAuthorizedRaw(addresses: Address[], allowed: boolean[], params?: WriteParams<typeof rbacAbi, 'setAuthorized'>): Promise<{
@@ -74,8 +74,8 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
74
74
  * @async
75
75
  * @param {Address[]} addresses
76
76
  * @param {RbacRoles[]} roles
77
- * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]
78
- * @returns {unknown}
77
+ * @param {?WriteParams} [params]
78
+ * @returns {Promise<void>}
79
79
  */
80
80
  grantRoles(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'grantRoles'>): Promise<never>;
81
81
  /**
@@ -89,8 +89,8 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
89
89
  * @async
90
90
  * @param {Address[]} addresses
91
91
  * @param {RbacRoles[]} roles
92
- * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]
93
- * @returns {unknown}
92
+ * @param {?WriteParams} [params]
93
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
94
94
  */
95
95
  grantRolesRaw(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'grantRoles'>): Promise<{
96
96
  hash: `0x${string}`;
@@ -107,8 +107,8 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
107
107
  * @async
108
108
  * @param {Address[]} addresses
109
109
  * @param {RbacRoles[]} roles
110
- * @param {?WriteParams<typeof rbacAbi, 'revokeRoles'>} [params]
111
- * @returns {unknown}
110
+ * @param {?WriteParams} [params]
111
+ * @returns {Promise<void>}
112
112
  */
113
113
  revokeRoles(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'revokeRoles'>): Promise<never>;
114
114
  /**
@@ -121,8 +121,8 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
121
121
  * @async
122
122
  * @param {Address[]} addresses
123
123
  * @param {RbacRoles[]} roles
124
- * @param {?WriteParams<typeof rbacAbi, 'revokeRoles'>} [params]
125
- * @returns {unknown}
124
+ * @param {?WriteParams} [params]
125
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
126
126
  */
127
127
  revokeRolesRaw(addresses: Address[], roles: Roles[], params?: WriteParams<typeof rbacAbi, 'revokeRoles'>): Promise<{
128
128
  hash: `0x${string}`;
@@ -135,7 +135,7 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
135
135
  * (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)
136
136
  * @public
137
137
  * @param {Address} account
138
- * @param {?ReadParams<typeof rbacAbi, 'rolesOf'>} [params]
138
+ * @param {?ReadParams} [params]
139
139
  * @returns {Promise<Array<RbacRoles>>}
140
140
  */
141
141
  rolesOf(account: Address, params?: ReadParams<typeof rbacAbi, 'rolesOf'>): Promise<Roles[]>;
@@ -148,7 +148,7 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
148
148
  * @public
149
149
  * @param {Address} account
150
150
  * @param {RbacRoles} roles
151
- * @param {?ReadParams<typeof rbacAbi, 'hasAnyRole'>} [params]
151
+ * @param {?ReadParams} [params]
152
152
  * @returns {Promise<boolean>}
153
153
  */
154
154
  hasAnyRole(account: Address, roles: Roles, params?: ReadParams<typeof rbacAbi, 'hasAnyRole'>): Promise<boolean>;
@@ -162,8 +162,8 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
162
162
  * @public
163
163
  * @param {Address} account
164
164
  * @param {RbacRoles} roles
165
- * @param {?ReadParams<typeof rbacAbi, 'hasAllRoles'>} [params]
166
- * @returns {*}
165
+ * @param {?ReadParams} [params]
166
+ * @returns {Promise<boolean>}
167
167
  */
168
168
  hasAllRoles(account: Address, roles: Roles, params?: ReadParams<typeof rbacAbi, 'hasAllRoles'>): Promise<boolean>;
169
169
  /**
@@ -171,7 +171,7 @@ export declare class DeployableTargetWithRBAC<Payload, ABI extends Abi> extends
171
171
  *
172
172
  * @public
173
173
  * @param {Address} account
174
- * @param {?ReadParams<typeof rbacAbi, 'isAuthorized'>} [params]
174
+ * @param {?ReadParams} [params]
175
175
  * @returns {Promise<boolean>} - True if the account is authorized
176
176
  */
177
177
  isAuthorized(account: Address, params?: ReadParams<typeof rbacAbi, 'isAuthorized'>): Promise<boolean>;
@@ -1,8 +1,8 @@
1
- import { F as n, z as c, L as d, M as l, D as A, d as u, f as g, w, i as R, v as f } from "../generated-C_7Jx3YG.js";
2
- import { C as v } from "../generated-C_7Jx3YG.js";
3
- import { DeployableTarget as y } from "./DeployableTarget.js";
4
- var o = /* @__PURE__ */ ((i) => (i[i.MANAGER = 1n] = "MANAGER", i[i.ADMIN = 2n] = "ADMIN", i))(o || {});
5
- class M extends y {
1
+ import { M as h, f as c, d, e as l, h as A, i as g, o as u, j as w, n as y, k as R } from "../generated-B8VWObPa.js";
2
+ import { z as b } from "../generated-B8VWObPa.js";
3
+ import { DeployableTarget as f } from "./DeployableTarget.js";
4
+ var o = /* @__PURE__ */ ((r) => (r[r.MANAGER = 1n] = "MANAGER", r[r.ADMIN = 2n] = "ADMIN", r))(o || {});
5
+ class M extends f {
6
6
  /**
7
7
  * Set the authorized status of the given accounts
8
8
  * The mechanism for managing authorization is left to the implementing contract
@@ -11,7 +11,7 @@ class M extends y {
11
11
  * @async
12
12
  * @param {Address[]} addresses - The accounts to authorize or deauthorize
13
13
  * @param {boolean[]} allowed - The authorization status for the given accounts
14
- * @param {?WriteParams<typeof rbacAbi, 'setAuthorized'>} [params]
14
+ * @param {?WriteParams} [params]
15
15
  * @returns {Promise<void>}
16
16
  */
17
17
  async setAuthorized(s, t, a) {
@@ -27,18 +27,18 @@ class M extends y {
27
27
  * @async
28
28
  * @param {Address[]} addresses - The accounts to authorize or deauthorize
29
29
  * @param {boolean[]} allowed - The authorization status for the given accounts
30
- * @param {?WriteParams<typeof rbacAbi, 'setAuthorized'>} [params]
30
+ * @param {?WriteParams} [params]
31
31
  * @returns {Promise<void>}
32
32
  */
33
33
  async setAuthorizedRaw(s, t, a) {
34
- const { request: r, result: e } = await n(this._config, {
34
+ const { request: i, result: e } = await h(this._config, {
35
35
  address: this.assertValidAddress(),
36
36
  args: [s, t],
37
37
  ...this.optionallyAttachAccount(),
38
38
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
39
39
  ...a
40
40
  });
41
- return { hash: await c(this._config, r), result: e };
41
+ return { hash: await c(this._config, i), result: e };
42
42
  }
43
43
  /**
44
44
  * Grant many accounts permissions on the rbac.
@@ -51,8 +51,8 @@ class M extends y {
51
51
  * @async
52
52
  * @param {Address[]} addresses
53
53
  * @param {RbacRoles[]} roles
54
- * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]
55
- * @returns {unknown}
54
+ * @param {?WriteParams} [params]
55
+ * @returns {Promise<void>}
56
56
  */
57
57
  async grantRoles(s, t, a) {
58
58
  return await this.awaitResult(this.grantRolesRaw(s, t, a));
@@ -68,11 +68,11 @@ class M extends y {
68
68
  * @async
69
69
  * @param {Address[]} addresses
70
70
  * @param {RbacRoles[]} roles
71
- * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]
72
- * @returns {unknown}
71
+ * @param {?WriteParams} [params]
72
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
73
73
  */
74
74
  async grantRolesRaw(s, t, a) {
75
- const { request: r, result: e } = await d(this._config, {
75
+ const { request: i, result: e } = await d(this._config, {
76
76
  address: this.assertValidAddress(),
77
77
  args: [s, t],
78
78
  ...this.optionallyAttachAccount(),
@@ -82,7 +82,7 @@ class M extends y {
82
82
  return { hash: await l(
83
83
  this._config,
84
84
  // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
85
- r
85
+ i
86
86
  ), result: e };
87
87
  }
88
88
  /**
@@ -96,8 +96,8 @@ class M extends y {
96
96
  * @async
97
97
  * @param {Address[]} addresses
98
98
  * @param {RbacRoles[]} roles
99
- * @param {?WriteParams<typeof rbacAbi, 'revokeRoles'>} [params]
100
- * @returns {unknown}
99
+ * @param {?WriteParams} [params]
100
+ * @returns {Promise<void>}
101
101
  */
102
102
  async revokeRoles(s, t, a) {
103
103
  return await this.awaitResult(
@@ -114,21 +114,21 @@ class M extends y {
114
114
  * @async
115
115
  * @param {Address[]} addresses
116
116
  * @param {RbacRoles[]} roles
117
- * @param {?WriteParams<typeof rbacAbi, 'revokeRoles'>} [params]
118
- * @returns {unknown}
117
+ * @param {?WriteParams} [params]
118
+ * @returns {Promise<{ hash: `0x${string}`; result: void; }>}
119
119
  */
120
120
  async revokeRolesRaw(s, t, a) {
121
- const { request: r, result: e } = await A(this._config, {
121
+ const { request: i, result: e } = await A(this._config, {
122
122
  address: this.assertValidAddress(),
123
123
  args: [s, t],
124
124
  ...this.optionallyAttachAccount(),
125
125
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
126
126
  ...a
127
127
  });
128
- return { hash: await u(
128
+ return { hash: await g(
129
129
  this._config,
130
130
  // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
131
- r
131
+ i
132
132
  ), result: e };
133
133
  }
134
134
  /**
@@ -138,11 +138,11 @@ class M extends y {
138
138
  * (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)
139
139
  * @public
140
140
  * @param {Address} account
141
- * @param {?ReadParams<typeof rbacAbi, 'rolesOf'>} [params]
141
+ * @param {?ReadParams} [params]
142
142
  * @returns {Promise<Array<RbacRoles>>}
143
143
  */
144
144
  async rolesOf(s, t) {
145
- const a = await g(this._config, {
145
+ const a = await u(this._config, {
146
146
  address: this.assertValidAddress(),
147
147
  args: [s],
148
148
  ...this.optionallyAttachAccount(),
@@ -150,7 +150,7 @@ class M extends y {
150
150
  ...t
151
151
  });
152
152
  return [o.MANAGER, o.ADMIN].filter(
153
- (r) => (a & r) === r
153
+ (i) => (a & i) === i
154
154
  );
155
155
  }
156
156
  /**
@@ -162,7 +162,7 @@ class M extends y {
162
162
  * @public
163
163
  * @param {Address} account
164
164
  * @param {RbacRoles} roles
165
- * @param {?ReadParams<typeof rbacAbi, 'hasAnyRole'>} [params]
165
+ * @param {?ReadParams} [params]
166
166
  * @returns {Promise<boolean>}
167
167
  */
168
168
  hasAnyRole(s, t, a) {
@@ -184,11 +184,11 @@ class M extends y {
184
184
  * @public
185
185
  * @param {Address} account
186
186
  * @param {RbacRoles} roles
187
- * @param {?ReadParams<typeof rbacAbi, 'hasAllRoles'>} [params]
188
- * @returns {*}
187
+ * @param {?ReadParams} [params]
188
+ * @returns {Promise<boolean>}
189
189
  */
190
190
  hasAllRoles(s, t, a) {
191
- return R(this._config, {
191
+ return y(this._config, {
192
192
  address: this.assertValidAddress(),
193
193
  args: [s, t],
194
194
  ...this.optionallyAttachAccount(),
@@ -201,11 +201,11 @@ class M extends y {
201
201
  *
202
202
  * @public
203
203
  * @param {Address} account
204
- * @param {?ReadParams<typeof rbacAbi, 'isAuthorized'>} [params]
204
+ * @param {?ReadParams} [params]
205
205
  * @returns {Promise<boolean>} - True if the account is authorized
206
206
  */
207
207
  isAuthorized(s, t) {
208
- return f(this._config, {
208
+ return R(this._config, {
209
209
  address: this.assertValidAddress(),
210
210
  args: [s],
211
211
  ...this.optionallyAttachAccount(),
@@ -217,6 +217,6 @@ class M extends y {
217
217
  export {
218
218
  M as DeployableTargetWithRBAC,
219
219
  o as Roles,
220
- v as rbacAbi
220
+ b as rbacAbi
221
221
  };
222
222
  //# sourceMappingURL=DeployableTargetWithRBAC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeployableTargetWithRBAC.js","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"sourcesContent":["import {\n rbacAbi,\n readRbacHasAllRoles,\n readRbacHasAnyRole,\n readRbacIsAuthorized,\n readRbacRolesOf,\n simulateRbacGrantRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeRbacGrantRoles,\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<typeof rbacAbi, 'setAuthorized'>} [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<typeof rbacAbi, 'setAuthorized'>} [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 many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]\n * @returns {unknown}\n */\n public async grantRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]\n * @returns {unknown}\n */\n public async grantRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantRoles(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 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 many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams<typeof rbacAbi, 'revokeRoles'>} [params]\n * @returns {unknown}\n */\n public async revokeRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n return await this.awaitResult(\n this.revokeRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams<typeof rbacAbi, 'revokeRoles'>} [params]\n * @returns {unknown}\n */\n public async revokeRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(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 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 * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)\n * @public\n * @param {Address} account\n * @param {?ReadParams<typeof rbacAbi, 'rolesOf'>} [params]\n * @returns {Promise<Array<RbacRoles>>}\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, RbacRoles.ADMIN | RbacRoles.MANAGER)\n * @public\n * @param {Address} account\n * @param {RbacRoles} roles\n * @param {?ReadParams<typeof rbacAbi, 'hasAnyRole'>} [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, RbacRoles.ADMIN & RbacRoles.MANAGER)\n *\n * @public\n * @param {Address} account\n * @param {RbacRoles} roles\n * @param {?ReadParams<typeof rbacAbi, 'hasAllRoles'>} [params]\n * @returns {*}\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<typeof rbacAbi, 'isAuthorized'>} [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","roles","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writeRbacRevokeRoles","account","readRbacRolesOf","role","readRbacHasAnyRole","readRbacHasAllRoles","readRbacIsAuthorized"],"mappings":";;;AA2BY,IAAAA,sBAAAA,OAEVA,EAAAA,EAAA,UAAU,EAAV,IAAA,WAEAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SAJUA,IAAAA,KAAA,CAAA,CAAA;AA+BL,MAAMC,UAGHC,EAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYvC,MAAa,cACXC,GACAC,GACAC,GACA;AACA,WAAO,MAAM,K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IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeO,YACLU,GACAL,GACAL,GACA;AACO,WAAAc,EAAoB,KAAK,SAAS;AAAA,MACvC,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACJ,GAASL,CAAK;AAAA,MACrB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIL;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUO,aACLU,GACAV,GACA;AACO,WAAAe,EAAqB,KAAK,SAAS;AAAA,MACxC,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACL,CAAO;AAAA,MACd,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIV;AAAA,IAAA,CACL;AAAA,EACH;AACF;"}
1
+ {"version":3,"file":"DeployableTargetWithRBAC.js","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"sourcesContent":["import {\n rbacAbi,\n readRbacHasAllRoles,\n readRbacHasAnyRole,\n readRbacIsAuthorized,\n readRbacRolesOf,\n simulateRbacGrantRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeRbacGrantRoles,\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 many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n return await this.awaitResult(this.grantRolesRaw(addresses, roles, params));\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantRoles(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 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 many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n return await this.awaitResult(\n this.revokeRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles(['0xfoo', '0xbar], [RbacRoles.MANAGER, RbacRoles.ADMIN])\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {RbacRoles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(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 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 * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(RbacRoles.ADMIN)\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<Array<RbacRoles>>}\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, RbacRoles.ADMIN | RbacRoles.MANAGER)\n * @public\n * @param {Address} account\n * @param {RbacRoles} 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, RbacRoles.ADMIN & RbacRoles.MANAGER)\n *\n * @public\n * @param {Address} account\n * @param {RbacRoles} 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","roles","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writ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