@boostxyz/sdk 0.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +7 -0
  3. package/dist/Actions/Action.cjs +2 -0
  4. package/dist/Actions/Action.cjs.map +1 -0
  5. package/dist/Actions/Action.d.ts +31 -0
  6. package/dist/Actions/Action.d.ts.map +1 -0
  7. package/dist/Actions/Action.js +29 -0
  8. package/dist/Actions/Action.js.map +1 -0
  9. package/dist/Actions/ContractAction.d.ts +370 -0
  10. package/dist/Actions/ContractAction.d.ts.map +1 -0
  11. package/dist/Actions/ERC721MintAction.d.ts +513 -0
  12. package/dist/Actions/ERC721MintAction.d.ts.map +1 -0
  13. package/dist/Actions/EventAction.cjs +2 -0
  14. package/dist/Actions/EventAction.cjs.map +1 -0
  15. package/dist/Actions/EventAction.d.ts +694 -0
  16. package/dist/Actions/EventAction.d.ts.map +1 -0
  17. package/dist/Actions/EventAction.js +491 -0
  18. package/dist/Actions/EventAction.js.map +1 -0
  19. package/dist/AllowLists/AllowList.cjs +2 -0
  20. package/dist/AllowLists/AllowList.cjs.map +1 -0
  21. package/dist/AllowLists/AllowList.d.ts +32 -0
  22. package/dist/AllowLists/AllowList.d.ts.map +1 -0
  23. package/dist/AllowLists/AllowList.js +30 -0
  24. package/dist/AllowLists/AllowList.js.map +1 -0
  25. package/dist/AllowLists/SimpleAllowList.cjs +2 -0
  26. package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
  27. package/dist/AllowLists/SimpleAllowList.d.ts +481 -0
  28. package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -0
  29. package/dist/AllowLists/SimpleAllowList.js +154 -0
  30. package/dist/AllowLists/SimpleAllowList.js.map +1 -0
  31. package/dist/AllowLists/SimpleDenyList.cjs +2 -0
  32. package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
  33. package/dist/AllowLists/SimpleDenyList.d.ts +335 -0
  34. package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -0
  35. package/dist/AllowLists/SimpleDenyList.js +115 -0
  36. package/dist/AllowLists/SimpleDenyList.js.map +1 -0
  37. package/dist/Auth/Auth.cjs +2 -0
  38. package/dist/Auth/Auth.cjs.map +1 -0
  39. package/dist/Auth/Auth.d.ts +10 -0
  40. package/dist/Auth/Auth.d.ts.map +1 -0
  41. package/dist/Auth/Auth.js +5 -0
  42. package/dist/Auth/Auth.js.map +1 -0
  43. package/dist/Auth/PassthroughAuth.cjs +2 -0
  44. package/dist/Auth/PassthroughAuth.cjs.map +1 -0
  45. package/dist/Auth/PassthroughAuth.d.ts +51 -0
  46. package/dist/Auth/PassthroughAuth.d.ts.map +1 -0
  47. package/dist/Auth/PassthroughAuth.js +39 -0
  48. package/dist/Auth/PassthroughAuth.js.map +1 -0
  49. package/dist/Boost.cjs +2 -0
  50. package/dist/Boost.cjs.map +1 -0
  51. package/dist/Boost.d.ts +234 -0
  52. package/dist/Boost.d.ts.map +1 -0
  53. package/dist/Boost.js +162 -0
  54. package/dist/Boost.js.map +1 -0
  55. package/dist/BoostCore.cjs +3 -0
  56. package/dist/BoostCore.cjs.map +1 -0
  57. package/dist/BoostCore.d.ts +498 -0
  58. package/dist/BoostCore.d.ts.map +1 -0
  59. package/dist/BoostCore.js +1153 -0
  60. package/dist/BoostCore.js.map +1 -0
  61. package/dist/BoostRegistry.cjs +2 -0
  62. package/dist/BoostRegistry.cjs.map +1 -0
  63. package/dist/BoostRegistry.d.ts +243 -0
  64. package/dist/BoostRegistry.d.ts.map +1 -0
  65. package/dist/BoostRegistry.js +262 -0
  66. package/dist/BoostRegistry.js.map +1 -0
  67. package/dist/Budgets/Budget.cjs +2 -0
  68. package/dist/Budgets/Budget.cjs.map +1 -0
  69. package/dist/Budgets/Budget.d.ts +31 -0
  70. package/dist/Budgets/Budget.d.ts.map +1 -0
  71. package/dist/Budgets/Budget.js +29 -0
  72. package/dist/Budgets/Budget.js.map +1 -0
  73. package/dist/Budgets/ManagedBudget.cjs +2 -0
  74. package/dist/Budgets/ManagedBudget.cjs.map +1 -0
  75. package/dist/Budgets/ManagedBudget.d.ts +1103 -0
  76. package/dist/Budgets/ManagedBudget.d.ts.map +1 -0
  77. package/dist/Budgets/ManagedBudget.js +516 -0
  78. package/dist/Budgets/ManagedBudget.js.map +1 -0
  79. package/dist/Budgets/SimpleBudget.d.ts +824 -0
  80. package/dist/Budgets/SimpleBudget.d.ts.map +1 -0
  81. package/dist/Budgets/VestingBudget.d.ts +778 -0
  82. package/dist/Budgets/VestingBudget.d.ts.map +1 -0
  83. package/dist/Deployable/Contract.cjs +2 -0
  84. package/dist/Deployable/Contract.cjs.map +1 -0
  85. package/dist/Deployable/Contract.d.ts +125 -0
  86. package/dist/Deployable/Contract.d.ts.map +1 -0
  87. package/dist/Deployable/Contract.js +150 -0
  88. package/dist/Deployable/Contract.js.map +1 -0
  89. package/dist/Deployable/Deployable.cjs +2 -0
  90. package/dist/Deployable/Deployable.cjs.map +1 -0
  91. package/dist/Deployable/Deployable.d.ts +161 -0
  92. package/dist/Deployable/Deployable.d.ts.map +1 -0
  93. package/dist/Deployable/Deployable.js +131 -0
  94. package/dist/Deployable/Deployable.js.map +1 -0
  95. package/dist/Deployable/DeployableTarget.cjs +2 -0
  96. package/dist/Deployable/DeployableTarget.cjs.map +1 -0
  97. package/dist/Deployable/DeployableTarget.d.ts +116 -0
  98. package/dist/Deployable/DeployableTarget.d.ts.map +1 -0
  99. package/dist/Deployable/DeployableTarget.js +132 -0
  100. package/dist/Deployable/DeployableTarget.js.map +1 -0
  101. package/dist/Incentives/AllowListIncentive.cjs +2 -0
  102. package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
  103. package/dist/Incentives/AllowListIncentive.d.ts +513 -0
  104. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -0
  105. package/dist/Incentives/AllowListIncentive.js +201 -0
  106. package/dist/Incentives/AllowListIncentive.js.map +1 -0
  107. package/dist/Incentives/CGDAIncentive.cjs +2 -0
  108. package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
  109. package/dist/Incentives/CGDAIncentive.d.ts +644 -0
  110. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -0
  111. package/dist/Incentives/CGDAIncentive.js +271 -0
  112. package/dist/Incentives/CGDAIncentive.js.map +1 -0
  113. package/dist/Incentives/ERC1155Incentive.d.ts +713 -0
  114. package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -0
  115. package/dist/Incentives/ERC20Incentive.cjs +2 -0
  116. package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
  117. package/dist/Incentives/ERC20Incentive.d.ts +666 -0
  118. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -0
  119. package/dist/Incentives/ERC20Incentive.js +312 -0
  120. package/dist/Incentives/ERC20Incentive.js.map +1 -0
  121. package/dist/Incentives/ERC20VariableIncentive.d.ts +582 -0
  122. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -0
  123. package/dist/Incentives/Incentive.cjs +2 -0
  124. package/dist/Incentives/Incentive.cjs.map +1 -0
  125. package/dist/Incentives/Incentive.d.ts +36 -0
  126. package/dist/Incentives/Incentive.d.ts.map +1 -0
  127. package/dist/Incentives/Incentive.js +299 -0
  128. package/dist/Incentives/Incentive.js.map +1 -0
  129. package/dist/Incentives/PointsIncentive.cjs +2 -0
  130. package/dist/Incentives/PointsIncentive.cjs.map +1 -0
  131. package/dist/Incentives/PointsIncentive.d.ts +659 -0
  132. package/dist/Incentives/PointsIncentive.d.ts.map +1 -0
  133. package/dist/Incentives/PointsIncentive.js +215 -0
  134. package/dist/Incentives/PointsIncentive.js.map +1 -0
  135. package/dist/Validators/SignerValidator.cjs +2 -0
  136. package/dist/Validators/SignerValidator.cjs.map +1 -0
  137. package/dist/Validators/SignerValidator.d.ts +745 -0
  138. package/dist/Validators/SignerValidator.d.ts.map +1 -0
  139. package/dist/Validators/SignerValidator.js +293 -0
  140. package/dist/Validators/SignerValidator.js.map +1 -0
  141. package/dist/Validators/Validator.cjs +2 -0
  142. package/dist/Validators/Validator.cjs.map +1 -0
  143. package/dist/Validators/Validator.d.ts +31 -0
  144. package/dist/Validators/Validator.d.ts.map +1 -0
  145. package/dist/Validators/Validator.js +27 -0
  146. package/dist/Validators/Validator.js.map +1 -0
  147. package/dist/claiming.cjs +2 -0
  148. package/dist/claiming.cjs.map +1 -0
  149. package/dist/claiming.d.ts +43 -0
  150. package/dist/claiming.d.ts.map +1 -0
  151. package/dist/claiming.js +17 -0
  152. package/dist/claiming.js.map +1 -0
  153. package/dist/componentInterfaces-CKCBwG16.cjs +2 -0
  154. package/dist/componentInterfaces-CKCBwG16.cjs.map +1 -0
  155. package/dist/componentInterfaces-DYkaxBda.js +13 -0
  156. package/dist/componentInterfaces-DYkaxBda.js.map +1 -0
  157. package/dist/errors.cjs +2 -0
  158. package/dist/errors.cjs.map +1 -0
  159. package/dist/errors.d.ts +441 -0
  160. package/dist/errors.d.ts.map +1 -0
  161. package/dist/errors.js +262 -0
  162. package/dist/errors.js.map +1 -0
  163. package/dist/generated-BDeDiaCK.js +4625 -0
  164. package/dist/generated-BDeDiaCK.js.map +1 -0
  165. package/dist/generated-wKBNvm48.cjs +3 -0
  166. package/dist/generated-wKBNvm48.cjs.map +1 -0
  167. package/dist/index.cjs +2 -0
  168. package/dist/index.cjs.map +1 -0
  169. package/dist/index.d.ts +25 -0
  170. package/dist/index.d.ts.map +1 -0
  171. package/dist/index.js +113 -0
  172. package/dist/index.js.map +1 -0
  173. package/dist/transfers.cjs +2 -0
  174. package/dist/transfers.cjs.map +1 -0
  175. package/dist/transfers.d.ts +198 -0
  176. package/dist/transfers.d.ts.map +1 -0
  177. package/dist/transfers.js +84 -0
  178. package/dist/transfers.js.map +1 -0
  179. package/dist/utils.cjs +2 -0
  180. package/dist/utils.cjs.map +1 -0
  181. package/dist/utils.d.ts +116 -0
  182. package/dist/utils.d.ts.map +1 -0
  183. package/dist/utils.js +30 -0
  184. package/dist/utils.js.map +1 -0
  185. package/package.json +211 -0
  186. package/src/Actions/Action.test.ts +75 -0
  187. package/src/Actions/Action.ts +61 -0
  188. package/src/Actions/ContractAction.test.ts +197 -0
  189. package/src/Actions/ContractAction.ts +301 -0
  190. package/src/Actions/ERC721MintAction.test.ts +112 -0
  191. package/src/Actions/ERC721MintAction.ts +292 -0
  192. package/src/Actions/EventAction.test.ts +205 -0
  193. package/src/Actions/EventAction.ts +811 -0
  194. package/src/AllowLists/AllowList.test.ts +64 -0
  195. package/src/AllowLists/AllowList.ts +60 -0
  196. package/src/AllowLists/SimpleAllowList.test.ts +52 -0
  197. package/src/AllowLists/SimpleAllowList.ts +284 -0
  198. package/src/AllowLists/SimpleDenyList.test.ts +52 -0
  199. package/src/AllowLists/SimpleDenyList.ts +227 -0
  200. package/src/Auth/Auth.ts +11 -0
  201. package/src/Auth/PassthroughAuth.test.ts +12 -0
  202. package/src/Auth/PassthroughAuth.ts +80 -0
  203. package/src/Boost.ts +290 -0
  204. package/src/BoostCore.test.ts +773 -0
  205. package/src/BoostCore.ts +1261 -0
  206. package/src/BoostRegistry.ts +467 -0
  207. package/src/Budgets/Budget.test.ts +27 -0
  208. package/src/Budgets/Budget.ts +61 -0
  209. package/src/Budgets/ManagedBudget.test.ts +154 -0
  210. package/src/Budgets/ManagedBudget.ts +796 -0
  211. package/src/Budgets/SimpleBudget.test.ts +152 -0
  212. package/src/Budgets/SimpleBudget.ts +564 -0
  213. package/src/Budgets/VestingBudget.test.ts +123 -0
  214. package/src/Budgets/VestingBudget.ts +602 -0
  215. package/src/Deployable/Contract.ts +229 -0
  216. package/src/Deployable/Deployable.ts +250 -0
  217. package/src/Deployable/DeployableTarget.ts +223 -0
  218. package/src/Incentives/AllowListIncentive.test.ts +143 -0
  219. package/src/Incentives/AllowListIncentive.ts +334 -0
  220. package/src/Incentives/CGDAIncentive.test.ts +132 -0
  221. package/src/Incentives/CGDAIncentive.ts +468 -0
  222. package/src/Incentives/ERC1155Incentive.test.ts +87 -0
  223. package/src/Incentives/ERC1155Incentive.ts +466 -0
  224. package/src/Incentives/ERC20Incentive.test.ts +130 -0
  225. package/src/Incentives/ERC20Incentive.ts +482 -0
  226. package/src/Incentives/ERC20VariableIncentive.test.ts +136 -0
  227. package/src/Incentives/ERC20VariableIncentive.ts +420 -0
  228. package/src/Incentives/Incentive.test.ts +92 -0
  229. package/src/Incentives/Incentive.ts +85 -0
  230. package/src/Incentives/PointsIncentive.test.ts +139 -0
  231. package/src/Incentives/PointsIncentive.ts +365 -0
  232. package/src/Validators/SignerValidator.test.ts +159 -0
  233. package/src/Validators/SignerValidator.ts +681 -0
  234. package/src/Validators/Validator.test.ts +21 -0
  235. package/src/Validators/Validator.ts +55 -0
  236. package/src/claiming.ts +56 -0
  237. package/src/errors.ts +542 -0
  238. package/src/index.test.ts +40 -0
  239. package/src/index.ts +53 -0
  240. package/src/transfers.ts +284 -0
  241. package/src/utils.test.ts +44 -0
  242. package/src/utils.ts +198 -0
@@ -0,0 +1,30 @@
1
+ import { o as i } from "../generated-BDeDiaCK.js";
2
+ import { a as m, b as a } from "../componentInterfaces-DYkaxBda.js";
3
+ import { readContract as f } from "@wagmi/core";
4
+ import { InvalidComponentInterfaceError as c } from "../errors.js";
5
+ import { SimpleAllowList as l } from "./SimpleAllowList.js";
6
+ import { SimpleDenyList as p } from "./SimpleDenyList.js";
7
+ const n = {
8
+ [m]: l,
9
+ [a]: p
10
+ };
11
+ async function I(o, t) {
12
+ const e = await f(o.config, {
13
+ abi: i,
14
+ functionName: "getComponentInterface",
15
+ address: t
16
+ }), r = n[e];
17
+ if (!r)
18
+ throw new c(
19
+ Object.keys(n),
20
+ e
21
+ );
22
+ return new r(o, t);
23
+ }
24
+ export {
25
+ n as AllowListByComponentInterface,
26
+ l as SimpleAllowList,
27
+ p as SimpleDenyList,
28
+ I as allowListFromAddress
29
+ };
30
+ //# sourceMappingURL=AllowList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AllowList.js","sources":["../../src/AllowLists/AllowList.ts"],"sourcesContent":["import { aAllowListAbi } from '@boostxyz/evm';\nimport {\n ASimpleAllowList,\n ASimpleDenyList,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport type { Address, Hex } from 'viem';\nimport type { DeployableOptions } from '../Deployable/Deployable';\nimport { InvalidComponentInterfaceError } from '../errors';\nimport { SimpleAllowList } from './SimpleAllowList';\nimport { SimpleDenyList } from './SimpleDenyList';\n\nexport { SimpleAllowList, SimpleDenyList };\n\n/**\n * A union type representing all valid protocol AllowList implementations\n *\n * @export\n * @typedef {AllowList}\n */\nexport type AllowList = SimpleAllowList | SimpleDenyList;\n\n/**\n * A map of AllowList component interfaces to their constructors.\n *\n * @type {{ \"0x2bc9016b\": SimpleAllowList; \"0x9d585f63\": SimpleDenyList; }}\n */\nexport const AllowListByComponentInterface = {\n [ASimpleAllowList as Hex]: SimpleAllowList,\n [ASimpleDenyList as Hex]: SimpleDenyList,\n};\n\n/**\n * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.\n *\n * @export\n * @async\n * @param {DeployableOptions} options\n * @param {Address} address\n * @returns {Promise<SimpleAllowList | SimpleDenyList>}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function allowListFromAddress(\n options: DeployableOptions,\n address: Address,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aAllowListAbi,\n functionName: 'getComponentInterface',\n address,\n })) as keyof typeof AllowListByComponentInterface;\n const Ctor = AllowListByComponentInterface[interfaceId];\n if (!Ctor) {\n throw new InvalidComponentInterfaceError(\n Object.keys(AllowListByComponentInterface) as Hex[],\n interfaceId as Hex,\n );\n }\n return new Ctor(options, address);\n}\n"],"names":["AllowListByComponentInterface","ASimpleAllowList","SimpleAllowList","ASimpleDenyList","SimpleDenyList","allowListFromAddress","options","address","interfaceId","readContract","aAllowListAbi","Ctor","InvalidComponentInterfaceError"],"mappings":";;;;;;AA2BO,MAAMA,IAAgC;AAAA,EAC3C,CAACC,CAAuB,GAAGC;AAAA,EAC3B,CAACC,CAAsB,GAAGC;AAC5B;AAYsB,eAAAC,EACpBC,GACAC,GACA;AACA,QAAMC,IAAe,MAAMC,EAAaH,EAAQ,QAAQ;AAAA,IACtD,KAAKI;AAAAA,IACL,cAAc;AAAA,IACd,SAAAH;AAAA,EAAA,CACD,GACKI,IAAOX,EAA8BQ,CAAW;AACtD,MAAI,CAACG;AACH,UAAM,IAAIC;AAAA,MACR,OAAO,KAAKZ,CAA6B;AAAA,MACzCQ;AAAA,IAAA;AAGG,SAAA,IAAIG,EAAKL,GAASC,CAAO;AAClC;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../generated-wKBNvm48.cjs"),l=require("@wagmi/core"),r=require("viem"),h=require("../Deployable/DeployableTarget.cjs"),u=require("../errors.cjs"),w=require("../utils.cjs"),A="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b61140e806100bd5f395ff3fe608060405260043610610113575f3560e01c80634a4ee7b11161009f57806398332bbc1161006357806398332bbc1461031d578063e3f756de14610347578063f04e283e14610383578063f2fde38b1461039f578063fee81cf4146103bb57610113565b80634a4ee7b114610287578063514e62fc146102a357806354d1f13d146102df578063715018a6146102e95780638da5cb5b146102f357610113565b806325692962116100e657806325692962146101c757806328d6183b146101d15780632de94807146101fb5780633abb060414610237578063439fab911461025f57610113565b806301ffc9a714610117578063183a4f6e146101535780631c10893f1461016f5780631cd64df41461018b575b5f80fd5b348015610122575f80fd5b5061013d60048036038101906101389190610d51565b6103f7565b60405161014a9190610d96565b60405180910390f35b61016d60048036038101906101689190610de2565b610470565b005b61018960048036038101906101849190610e67565b61047d565b005b348015610196575f80fd5b506101b160048036038101906101ac9190610e67565b610493565b6040516101be9190610d96565b60405180910390f35b6101cf6104a9565b005b3480156101dc575f80fd5b506101e56104fa565b6040516101f29190610eb4565b60405180910390f35b348015610206575f80fd5b50610221600480360381019061021c9190610ecd565b610521565b60405161022e9190610f07565b60405180910390f35b348015610242575f80fd5b5061025d60048036038101906102589190610fd6565b61053a565b005b34801561026a575f80fd5b50610285600480360381019061028091906110a9565b610647565b005b6102a1600480360381019061029c9190610e67565b61076f565b005b3480156102ae575f80fd5b506102c960048036038101906102c49190610e67565b610785565b6040516102d69190610d96565b60405180910390f35b6102e761079c565b005b6102f16107d5565b005b3480156102fe575f80fd5b506103076107e8565b6040516103149190611103565b60405180910390f35b348015610328575f80fd5b50610331610810565b60405161033e9190610f07565b60405180910390f35b348015610352575f80fd5b5061036d6004803603810190610368919061111c565b610815565b60405161037a9190610d96565b60405180910390f35b61039d60048036038101906103989190610ecd565b610868565b005b6103b960048036038101906103b49190610ecd565b6108a6565b005b3480156103c6575f80fd5b506103e160048036038101906103dc9190610ecd565b6108cf565b6040516103ee9190610f07565b60405180910390f35b5f7f8ba1fc24000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806104695750610468826108e8565b5b9050919050565b61047a3382610961565b50565b610485610970565b61048f82826109a7565b5050565b5f818261049f85610521565b1614905092915050565b5f6104b26109b7565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f8ba1fc2400000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b6002610545816109c1565b828290508585905014610584576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b8585905081101561063f578383828181106105a4576105a3611179565b5b90506020020160208101906105b991906111d0565b5f808888858181106105ce576105cd611179565b5b90506020020160208101906105e39190610ecd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610586565b505050505050565b5f6106506109e8565b905080546003825580156106825760018160011c14303b106106795763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f808484810190610694919061137e565b915091506106a182610a11565b6106ac8260026109a7565b5f5b81518110156107325760015f808484815181106106ce576106cd611179565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555080806001019150506106ae565b505050801561076a576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b610777610970565b6107818282610961565b5050565b5f808261079185610521565b161415905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6107dd610970565b6107e65f610ae7565b565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b600281565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1690509392505050565b610870610970565b63389a75e1600c52805f526020600c20805442111561089657636f5e88185f526004601cfd5b5f8155506108a381610ae7565b50565b6108ae610970565b8060601b6108c357637448fbae5f526004601cfd5b6108cc81610ae7565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fe2089f79000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061095a575061095982610bad565b5b9050919050565b61096c82825f610c26565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275433146109a5576382b429005f526004601cfd5b565b6109b382826001610c26565b5050565b5f6202a300905090565b638b78c6d8600c52335f52806020600c2054166109e5576382b429005f526004601cfd5b50565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610a19610c7e565b15610a91577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610a5357630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610ae4565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b610aef610c7e565b15610b54577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610baa565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610c1f5750610c1e82610c82565b5b9050919050565b638b78c6d8600c52825f526020600c20805483811783610c4857848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610d3081610cfc565b8114610d3a575f80fd5b50565b5f81359050610d4b81610d27565b92915050565b5f60208284031215610d6657610d65610cf4565b5b5f610d7384828501610d3d565b91505092915050565b5f8115159050919050565b610d9081610d7c565b82525050565b5f602082019050610da95f830184610d87565b92915050565b5f819050919050565b610dc181610daf565b8114610dcb575f80fd5b50565b5f81359050610ddc81610db8565b92915050565b5f60208284031215610df757610df6610cf4565b5b5f610e0484828501610dce565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610e3682610e0d565b9050919050565b610e4681610e2c565b8114610e50575f80fd5b50565b5f81359050610e6181610e3d565b92915050565b5f8060408385031215610e7d57610e7c610cf4565b5b5f610e8a85828601610e53565b9250506020610e9b85828601610dce565b9150509250929050565b610eae81610cfc565b82525050565b5f602082019050610ec75f830184610ea5565b92915050565b5f60208284031215610ee257610ee1610cf4565b5b5f610eef84828501610e53565b91505092915050565b610f0181610daf565b82525050565b5f602082019050610f1a5f830184610ef8565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112610f4157610f40610f20565b5b8235905067ffffffffffffffff811115610f5e57610f5d610f24565b5b602083019150836020820283011115610f7a57610f79610f28565b5b9250929050565b5f8083601f840112610f9657610f95610f20565b5b8235905067ffffffffffffffff811115610fb357610fb2610f24565b5b602083019150836020820283011115610fcf57610fce610f28565b5b9250929050565b5f805f8060408587031215610fee57610fed610cf4565b5b5f85013567ffffffffffffffff81111561100b5761100a610cf8565b5b61101787828801610f2c565b9450945050602085013567ffffffffffffffff81111561103a57611039610cf8565b5b61104687828801610f81565b925092505092959194509250565b5f8083601f84011261106957611068610f20565b5b8235905067ffffffffffffffff81111561108657611085610f24565b5b6020830191508360018202830111156110a2576110a1610f28565b5b9250929050565b5f80602083850312156110bf576110be610cf4565b5b5f83013567ffffffffffffffff8111156110dc576110db610cf8565b5b6110e885828601611054565b92509250509250929050565b6110fd81610e2c565b82525050565b5f6020820190506111165f8301846110f4565b92915050565b5f805f6040848603121561113357611132610cf4565b5b5f61114086828701610e53565b935050602084013567ffffffffffffffff81111561116157611160610cf8565b5b61116d86828701611054565b92509250509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b6111af81610d7c565b81146111b9575f80fd5b50565b5f813590506111ca816111a6565b92915050565b5f602082840312156111e5576111e4610cf4565b5b5f6111f2848285016111bc565b91505092915050565b5f61120582610e0d565b9050919050565b611215816111fb565b811461121f575f80fd5b50565b5f813590506112308161120c565b92915050565b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61127c82611236565b810181811067ffffffffffffffff8211171561129b5761129a611246565b5b80604052505050565b5f6112ad610ceb565b90506112b98282611273565b919050565b5f67ffffffffffffffff8211156112d8576112d7611246565b5b602082029050602081019050919050565b5f6112fb6112f6846112be565b6112a4565b9050808382526020820190506020840283018581111561131e5761131d610f28565b5b835b8181101561134757806113338882610e53565b845260208401935050602081019050611320565b5050509392505050565b5f82601f83011261136557611364610f20565b5b81356113758482602086016112e9565b91505092915050565b5f806040838503121561139457611393610cf4565b5b5f6113a185828601611222565b925050602083013567ffffffffffffffff8111156113c2576113c1610cf8565b5b6113ce85828601611351565b915050925092905056fea264697066735822122094368c65f566939d0b9827de55e44a26c567f89bc0bf24103275890d9278dc0164736f6c634300081a0033",y=2n,s=class s extends h.DeployableTarget{constructor(){super(...arguments),this.abi=c.T}async isAllowed(f,e){return await c.JN(this._config,{address:this.assertValidAddress(),args:[f,r.zeroHash],...this.optionallyAttachAccount(),...e})}async setAllowed(f,e,b){return await this.awaitResult(this.setAllowedRaw(f,e,b))}async setAllowedRaw(f,e,b){const{request:a,result:d}=await c.Ah(this._config,{address:this.assertValidAddress(),args:[f,e],...this.optionallyAttachAccount(),...b});return{hash:await c.lh(this._config,a),result:d}}async grantRoles(f,e,b){return await this.awaitResult(this.grantRolesRaw(f,e,b))}async grantRolesRaw(f,e,b){const{request:a,result:d}=await c.bh(this._config,{address:this.assertValidAddress(),args:[f,e],...this.optionallyAttachAccount(),...b});return{hash:await c.ih(this._config,a),result:d}}buildParameters(f,e){var d;const[b,a]=this.validateDeploymentConfig(f,e);if(!b.owner||b.owner===r.zeroAddress){const t=a.account?a.account.address:a.config?l.getAccount(a.config).address:(d=this._account)==null?void 0:d.address;if(t)b.owner=t;else throw new u.DeployableUnknownOwnerProvidedError}return{abi:c.T,bytecode:A,args:[i(b)],...this.optionallyAttachAccount(a.account)}}};s.base="0x9A3848B6B35d406d758892C6b4b00042cCbc96AD",s.registryType=w.RegistryType.ALLOW_LIST;let o=s;function i({owner:n,allowed:f}){return r.encodeAbiParameters([{type:"address",name:"owner"},{type:"address[]",name:"allowed"}],[n,f])}exports.simpleAllowListAbi=c.T;exports.LIST_MANAGER_ROLE=y;exports.SimpleAllowList=o;exports.prepareSimpleAllowListPayload=i;
2
+ //# sourceMappingURL=SimpleAllowList.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleAllowList.cjs","sources":["../../src/AllowLists/SimpleAllowList.ts"],"sourcesContent":["import {\n readSimpleAllowListIsAllowed,\n simpleAllowListAbi,\n simulateSimpleAllowListGrantRoles,\n simulateSimpleAllowListSetAllowed,\n writeSimpleAllowListGrantRoles,\n writeSimpleAllowListSetAllowed,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/allowlists/SimpleAllowList.sol/SimpleAllowList.json';\nimport { getAccount } from '@wagmi/core';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { DeployableUnknownOwnerProvidedError } from '../errors';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { simpleAllowListAbi };\n\n/**\n * Object representation of a {@link SimpleAllowList} initialization payload.\n *\n * @export\n * @interface SimpleAllowListPayload\n * @typedef {SimpleAllowListPayload}\n */\nexport interface SimpleAllowListPayload {\n /**\n * The allow list's owner, given the {@link LIST_MANAGER_ROLE} role.\n *\n * @type {Address}\n */\n owner: Address;\n /**\n * List of allowed addresses.\n *\n * @type {Address[]}\n */\n allowed: Address[];\n}\n\n/**\n * A generic `viem.Log` event with support for `SimpleAllowList` event types.\n *\n * @export\n * @typedef {SimpleAllowListLog}\n * @template {ContractEventName<\n * typeof simpleAllowListAbi\n * >} [event=ContractEventName<typeof simpleAllowListAbi>]\n */\nexport type SimpleAllowListLog<\n event extends ContractEventName<\n typeof simpleAllowListAbi\n > = ContractEventName<typeof simpleAllowListAbi>,\n> = GenericLog<typeof simpleAllowListAbi, event>;\n\n/**\n * A constant representing the list manager's role\n *\n * @type {2n}\n */\nexport const LIST_MANAGER_ROLE = 2n;\n/**\n * A simple implementation of an AllowList that checks if a user is authorized based on a list of allowed addresses\n *\n * @export\n * @class SimpleAllowList\n * @typedef {SimpleAllowList}\n * @extends {DeployableTarget<SimpleAllowListPayload>}\n */\nexport class SimpleAllowList extends DeployableTarget<\n SimpleAllowListPayload,\n typeof simpleAllowListAbi\n> {\n public override readonly abi = simpleAllowListAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_SIMPLE_ALLOWLIST_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.ALLOW_LIST;\n\n /**\n * Check if a user is authorized.\n *\n * @public\n * @async\n * @param {Address} address - The address of the user\n * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]\n * @returns {Promise<boolean>} - True if the user is authorized\n */\n public async isAllowed(\n address: Address,\n params?: ReadParams<typeof simpleAllowListAbi, 'setAllowed'>,\n ): Promise<boolean> {\n return await readSimpleAllowListIsAllowed(this._config, {\n address: this.assertValidAddress(),\n args: [address, zeroHash],\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 * Set the allowed status of a user. The length of the `users_` and `allowed_` arrays must be the same.\n * This function can only be called by the owner\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of users to update\n * @param {boolean[]} allowed - The allowed status of each user\n * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]\n * @returns {Promise<void>}\n */\n public async setAllowed(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof simpleAllowListAbi, 'setAllowed'>,\n ) {\n return await this.awaitResult(\n this.setAllowedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the allowed status of a user. The length of the `users_` and `allowed_` arrays must be the same.\n * This function can only be called by the owner\n *\n * @public\n * @async\n * @param {Address[]} addresses - The list of users to update\n * @param {boolean[]} allowed - The allowed status of each user\n * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]\n * @returns {Promise<void>}\n */\n public async setAllowedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: ReadParams<typeof simpleAllowListAbi, 'setAllowed'>,\n ) {\n const { request, result } = await simulateSimpleAllowListSetAllowed(\n this._config,\n {\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 );\n const hash = await writeSimpleAllowListSetAllowed(this._config, request);\n return { hash, result };\n }\n\n /**\n * Allows the owner to grant `user` `roles`.\n *\n * @public\n * @async\n * @param {Address} address\n * @param {bigint} role\n * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]\n * @returns {Promise<void>}\n */\n public async grantRoles(\n address: Address,\n role: bigint,\n params?: WriteParams<typeof simpleAllowListAbi, 'grantRoles'>,\n ) {\n return await this.awaitResult(this.grantRolesRaw(address, role, params));\n }\n\n /**\n * Allows the owner to grant `user` `roles`.\n *\n * @public\n * @async\n * @param {Address} address\n * @param {bigint} role\n * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]\n * @returns {Promise<void>}\n */\n public async grantRolesRaw(\n address: Address,\n role: bigint,\n params?: ReadParams<typeof simpleAllowListAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateSimpleAllowListGrantRoles(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [address, role],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeSimpleAllowListGrantRoles(this._config, request);\n return { hash, result };\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?SimpleAllowListPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: SimpleAllowListPayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n if (!payload.owner || payload.owner === zeroAddress) {\n const owner = options.account\n ? options.account.address\n : options.config\n ? getAccount(options.config).address\n : this._account?.address;\n if (owner) {\n payload.owner = owner;\n } else {\n throw new DeployableUnknownOwnerProvidedError();\n }\n }\n return {\n abi: simpleAllowListAbi,\n bytecode: bytecode as Hex,\n args: [prepareSimpleAllowListPayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Given a {@link SimpleAllowListPayload}, properly encode the initialization payload.\n *\n * @param {SimpleAllowListPayload} param0\n * @param {Address} param0.owner - The allow list's owner, given the {@link LIST_MANAGER_ROLE} role.\n * @param {Address[]} param0.allowed - List of allowed addresses.\n * @returns {Hex}\n */\nexport function prepareSimpleAllowListPayload({\n owner,\n allowed,\n}: SimpleAllowListPayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'owner' },\n { type: 'address[]', name: 'allowed' },\n ],\n [owner, allowed],\n );\n}\n"],"names":["LIST_MANAGER_ROLE","_SimpleAllowList","DeployableTarget","simpleAllowListAbi","address","params","readSimpleAllowListIsAllowed","zeroHash","addresses","allowed","request","result","simulateSimpleAllowListSetAllowed","writeSimpleAllowListSetAllowed","role","simulateSimpleAllowListGrantRoles","writeSimpleAllowListGrantRoles","_payload","_options","payload","options","zeroAddress","owner","getAccount","_a","DeployableUnknownOwnerProvidedError","bytecode","prepareSimpleAllowListPayload","RegistryType","SimpleAllowList","encodeAbiParameters"],"mappings":"0qVA2EaA,EAAoB,GASpBC,EAAN,MAAMA,UAAwBC,EAAAA,gBAGnC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA4B/B,MAAa,UACXC,EACAC,EACkB,CACX,OAAA,MAAMC,EAAAA,GAA6B,KAAK,QAAS,CACtD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACF,EAASG,UAAQ,EACxB,GAAG,KAAK,wBAAwB,EAEhC,GAAIF,CAAA,CACL,CACH,CAaA,MAAa,WACXG,EACAC,EACAJ,EACA,CACA,OAAO,MAAM,KAAK,YAChB,KAAK,cAAcG,EAAWC,EAASJ,CAAM,CAAA,CAEjD,CAaA,MAAa,cACXG,EACAC,EACAJ,EACA,CACA,KAAM,CAAE,QAAAK,EAAS,OAAAC,CAAO,EAAI,MAAMC,EAAA,GAChC,KAAK,QACL,CACE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACJ,EAAWC,CAAO,EACzB,GAAG,KAAK,wBAAwB,EAEhC,GAAIJ,CACN,CAAA,EAGK,MAAA,CAAE,KADI,MAAMQ,EAA+B,GAAA,KAAK,QAASH,CAAO,EACxD,OAAAC,EACjB,CAYA,MAAa,WACXP,EACAU,EACAT,EACA,CACO,OAAA,MAAM,KAAK,YAAY,KAAK,cAAcD,EAASU,EAAMT,CAAM,CAAC,CACzE,CAYA,MAAa,cACXD,EACAU,EACAT,EACA,CACA,KAAM,CAAE,QAAAK,EAAS,OAAAC,CAAO,EAAI,MAAMI,EAAA,GAChC,KAAK,QACL,CACE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACX,EAASU,CAAI,EACpB,GAAG,KAAK,wBAAwB,EAEhC,GAAIT,CACN,CAAA,EAGK,MAAA,CAAE,KADI,MAAMW,EAA+B,GAAA,KAAK,QAASN,CAAO,EACxD,OAAAC,EACjB,CAUgB,gBACdM,EACAC,EACyB,OACzB,KAAM,CAACC,EAASC,CAAO,EAAI,KAAK,yBAC9BH,EACAC,CAAA,EAEF,GAAI,CAACC,EAAQ,OAASA,EAAQ,QAAUE,EAAAA,YAAa,CACnD,MAAMC,EAAQF,EAAQ,QAClBA,EAAQ,QAAQ,QAChBA,EAAQ,OACNG,EAAA,WAAWH,EAAQ,MAAM,EAAE,SAC3BI,EAAA,KAAK,WAAL,YAAAA,EAAe,QACrB,GAAIF,EACFH,EAAQ,MAAQG,MAEhB,OAAM,IAAIG,EAAoC,mCAElD,CACO,MAAA,CACL,IAAKtB,EAAA,EACL,SAAAuB,EACA,KAAM,CAACC,EAA8BR,CAAO,CAAC,EAC7C,GAAG,KAAK,wBAAwBC,EAAQ,OAAO,CAAA,CAEnD,CACF,EAtKyBnB,EAAA,KAAgB,6CASvCA,EAAuB,aAA6B2B,EAAa,aAAA,WArB5D,IAAMC,EAAN5B,EA4LA,SAAS0B,EAA8B,CAC5C,MAAAL,EACA,QAAAb,CACF,EAA2B,CAClB,OAAAqB,EAAA,oBACL,CACE,CAAE,KAAM,UAAW,KAAM,OAAQ,EACjC,CAAE,KAAM,YAAa,KAAM,SAAU,CACvC,EACA,CAACR,EAAOb,CAAO,CAAA,CAEnB"}
@@ -0,0 +1,481 @@
1
+ import { simpleAllowListAbi } from '@boostxyz/evm';
2
+ import { type Address, type ContractEventName } from 'viem';
3
+ import type { DeployableOptions, GenericDeployableParams } from '../Deployable/Deployable';
4
+ import { DeployableTarget } from '../Deployable/DeployableTarget';
5
+ import { type GenericLog, type ReadParams, RegistryType, type WriteParams } from '../utils';
6
+ export { simpleAllowListAbi };
7
+ /**
8
+ * Object representation of a {@link SimpleAllowList} initialization payload.
9
+ *
10
+ * @export
11
+ * @interface SimpleAllowListPayload
12
+ * @typedef {SimpleAllowListPayload}
13
+ */
14
+ export interface SimpleAllowListPayload {
15
+ /**
16
+ * The allow list's owner, given the {@link LIST_MANAGER_ROLE} role.
17
+ *
18
+ * @type {Address}
19
+ */
20
+ owner: Address;
21
+ /**
22
+ * List of allowed addresses.
23
+ *
24
+ * @type {Address[]}
25
+ */
26
+ allowed: Address[];
27
+ }
28
+ /**
29
+ * A generic `viem.Log` event with support for `SimpleAllowList` event types.
30
+ *
31
+ * @export
32
+ * @typedef {SimpleAllowListLog}
33
+ * @template {ContractEventName<
34
+ * typeof simpleAllowListAbi
35
+ * >} [event=ContractEventName<typeof simpleAllowListAbi>]
36
+ */
37
+ export type SimpleAllowListLog<event extends ContractEventName<typeof simpleAllowListAbi> = ContractEventName<typeof simpleAllowListAbi>> = GenericLog<typeof simpleAllowListAbi, event>;
38
+ /**
39
+ * A constant representing the list manager's role
40
+ *
41
+ * @type {2n}
42
+ */
43
+ export declare const LIST_MANAGER_ROLE = 2n;
44
+ /**
45
+ * A simple implementation of an AllowList that checks if a user is authorized based on a list of allowed addresses
46
+ *
47
+ * @export
48
+ * @class SimpleAllowList
49
+ * @typedef {SimpleAllowList}
50
+ * @extends {DeployableTarget<SimpleAllowListPayload>}
51
+ */
52
+ export declare class SimpleAllowList extends DeployableTarget<SimpleAllowListPayload, typeof simpleAllowListAbi> {
53
+ readonly abi: readonly [{
54
+ readonly type: "constructor";
55
+ readonly inputs: readonly [];
56
+ readonly stateMutability: "nonpayable";
57
+ }, {
58
+ readonly type: "error";
59
+ readonly inputs: readonly [];
60
+ readonly name: "AlreadyInitialized";
61
+ }, {
62
+ readonly type: "error";
63
+ readonly inputs: readonly [];
64
+ readonly name: "CloneAlreadyInitialized";
65
+ }, {
66
+ readonly type: "error";
67
+ readonly inputs: readonly [];
68
+ readonly name: "InitializerNotImplemented";
69
+ }, {
70
+ readonly type: "error";
71
+ readonly inputs: readonly [];
72
+ readonly name: "InvalidInitialization";
73
+ }, {
74
+ readonly type: "error";
75
+ readonly inputs: readonly [];
76
+ readonly name: "InvalidInitializationData";
77
+ }, {
78
+ readonly type: "error";
79
+ readonly inputs: readonly [];
80
+ readonly name: "LengthMismatch";
81
+ }, {
82
+ readonly type: "error";
83
+ readonly inputs: readonly [];
84
+ readonly name: "NewOwnerIsZeroAddress";
85
+ }, {
86
+ readonly type: "error";
87
+ readonly inputs: readonly [];
88
+ readonly name: "NoHandoverRequest";
89
+ }, {
90
+ readonly type: "error";
91
+ readonly inputs: readonly [];
92
+ readonly name: "NotInitializing";
93
+ }, {
94
+ readonly type: "error";
95
+ readonly inputs: readonly [];
96
+ readonly name: "Unauthorized";
97
+ }, {
98
+ readonly type: "event";
99
+ readonly anonymous: false;
100
+ readonly inputs: readonly [{
101
+ readonly name: "version";
102
+ readonly internalType: "uint64";
103
+ readonly type: "uint64";
104
+ readonly indexed: false;
105
+ }];
106
+ readonly name: "Initialized";
107
+ }, {
108
+ readonly type: "event";
109
+ readonly anonymous: false;
110
+ readonly inputs: readonly [{
111
+ readonly name: "pendingOwner";
112
+ readonly internalType: "address";
113
+ readonly type: "address";
114
+ readonly indexed: true;
115
+ }];
116
+ readonly name: "OwnershipHandoverCanceled";
117
+ }, {
118
+ readonly type: "event";
119
+ readonly anonymous: false;
120
+ readonly inputs: readonly [{
121
+ readonly name: "pendingOwner";
122
+ readonly internalType: "address";
123
+ readonly type: "address";
124
+ readonly indexed: true;
125
+ }];
126
+ readonly name: "OwnershipHandoverRequested";
127
+ }, {
128
+ readonly type: "event";
129
+ readonly anonymous: false;
130
+ readonly inputs: readonly [{
131
+ readonly name: "oldOwner";
132
+ readonly internalType: "address";
133
+ readonly type: "address";
134
+ readonly indexed: true;
135
+ }, {
136
+ readonly name: "newOwner";
137
+ readonly internalType: "address";
138
+ readonly type: "address";
139
+ readonly indexed: true;
140
+ }];
141
+ readonly name: "OwnershipTransferred";
142
+ }, {
143
+ readonly type: "event";
144
+ readonly anonymous: false;
145
+ readonly inputs: readonly [{
146
+ readonly name: "user";
147
+ readonly internalType: "address";
148
+ readonly type: "address";
149
+ readonly indexed: true;
150
+ }, {
151
+ readonly name: "roles";
152
+ readonly internalType: "uint256";
153
+ readonly type: "uint256";
154
+ readonly indexed: true;
155
+ }];
156
+ readonly name: "RolesUpdated";
157
+ }, {
158
+ readonly type: "function";
159
+ readonly inputs: readonly [];
160
+ readonly name: "LIST_MANAGER_ROLE";
161
+ readonly outputs: readonly [{
162
+ readonly name: "";
163
+ readonly internalType: "uint256";
164
+ readonly type: "uint256";
165
+ }];
166
+ readonly stateMutability: "view";
167
+ }, {
168
+ readonly type: "function";
169
+ readonly inputs: readonly [];
170
+ readonly name: "cancelOwnershipHandover";
171
+ readonly outputs: readonly [];
172
+ readonly stateMutability: "payable";
173
+ }, {
174
+ readonly type: "function";
175
+ readonly inputs: readonly [{
176
+ readonly name: "pendingOwner";
177
+ readonly internalType: "address";
178
+ readonly type: "address";
179
+ }];
180
+ readonly name: "completeOwnershipHandover";
181
+ readonly outputs: readonly [];
182
+ readonly stateMutability: "payable";
183
+ }, {
184
+ readonly type: "function";
185
+ readonly inputs: readonly [];
186
+ readonly name: "getComponentInterface";
187
+ readonly outputs: readonly [{
188
+ readonly name: "";
189
+ readonly internalType: "bytes4";
190
+ readonly type: "bytes4";
191
+ }];
192
+ readonly stateMutability: "pure";
193
+ }, {
194
+ readonly type: "function";
195
+ readonly inputs: readonly [{
196
+ readonly name: "user";
197
+ readonly internalType: "address";
198
+ readonly type: "address";
199
+ }, {
200
+ readonly name: "roles";
201
+ readonly internalType: "uint256";
202
+ readonly type: "uint256";
203
+ }];
204
+ readonly name: "grantRoles";
205
+ readonly outputs: readonly [];
206
+ readonly stateMutability: "payable";
207
+ }, {
208
+ readonly type: "function";
209
+ readonly inputs: readonly [{
210
+ readonly name: "user";
211
+ readonly internalType: "address";
212
+ readonly type: "address";
213
+ }, {
214
+ readonly name: "roles";
215
+ readonly internalType: "uint256";
216
+ readonly type: "uint256";
217
+ }];
218
+ readonly name: "hasAllRoles";
219
+ readonly outputs: readonly [{
220
+ readonly name: "";
221
+ readonly internalType: "bool";
222
+ readonly type: "bool";
223
+ }];
224
+ readonly stateMutability: "view";
225
+ }, {
226
+ readonly type: "function";
227
+ readonly inputs: readonly [{
228
+ readonly name: "user";
229
+ readonly internalType: "address";
230
+ readonly type: "address";
231
+ }, {
232
+ readonly name: "roles";
233
+ readonly internalType: "uint256";
234
+ readonly type: "uint256";
235
+ }];
236
+ readonly name: "hasAnyRole";
237
+ readonly outputs: readonly [{
238
+ readonly name: "";
239
+ readonly internalType: "bool";
240
+ readonly type: "bool";
241
+ }];
242
+ readonly stateMutability: "view";
243
+ }, {
244
+ readonly type: "function";
245
+ readonly inputs: readonly [{
246
+ readonly name: "data_";
247
+ readonly internalType: "bytes";
248
+ readonly type: "bytes";
249
+ }];
250
+ readonly name: "initialize";
251
+ readonly outputs: readonly [];
252
+ readonly stateMutability: "nonpayable";
253
+ }, {
254
+ readonly type: "function";
255
+ readonly inputs: readonly [{
256
+ readonly name: "user_";
257
+ readonly internalType: "address";
258
+ readonly type: "address";
259
+ }, {
260
+ readonly name: "";
261
+ readonly internalType: "bytes";
262
+ readonly type: "bytes";
263
+ }];
264
+ readonly name: "isAllowed";
265
+ readonly outputs: readonly [{
266
+ readonly name: "";
267
+ readonly internalType: "bool";
268
+ readonly type: "bool";
269
+ }];
270
+ readonly stateMutability: "view";
271
+ }, {
272
+ readonly type: "function";
273
+ readonly inputs: readonly [];
274
+ readonly name: "owner";
275
+ readonly outputs: readonly [{
276
+ readonly name: "result";
277
+ readonly internalType: "address";
278
+ readonly type: "address";
279
+ }];
280
+ readonly stateMutability: "view";
281
+ }, {
282
+ readonly type: "function";
283
+ readonly inputs: readonly [{
284
+ readonly name: "pendingOwner";
285
+ readonly internalType: "address";
286
+ readonly type: "address";
287
+ }];
288
+ readonly name: "ownershipHandoverExpiresAt";
289
+ readonly outputs: readonly [{
290
+ readonly name: "result";
291
+ readonly internalType: "uint256";
292
+ readonly type: "uint256";
293
+ }];
294
+ readonly stateMutability: "view";
295
+ }, {
296
+ readonly type: "function";
297
+ readonly inputs: readonly [];
298
+ readonly name: "renounceOwnership";
299
+ readonly outputs: readonly [];
300
+ readonly stateMutability: "payable";
301
+ }, {
302
+ readonly type: "function";
303
+ readonly inputs: readonly [{
304
+ readonly name: "roles";
305
+ readonly internalType: "uint256";
306
+ readonly type: "uint256";
307
+ }];
308
+ readonly name: "renounceRoles";
309
+ readonly outputs: readonly [];
310
+ readonly stateMutability: "payable";
311
+ }, {
312
+ readonly type: "function";
313
+ readonly inputs: readonly [];
314
+ readonly name: "requestOwnershipHandover";
315
+ readonly outputs: readonly [];
316
+ readonly stateMutability: "payable";
317
+ }, {
318
+ readonly type: "function";
319
+ readonly inputs: readonly [{
320
+ readonly name: "user";
321
+ readonly internalType: "address";
322
+ readonly type: "address";
323
+ }, {
324
+ readonly name: "roles";
325
+ readonly internalType: "uint256";
326
+ readonly type: "uint256";
327
+ }];
328
+ readonly name: "revokeRoles";
329
+ readonly outputs: readonly [];
330
+ readonly stateMutability: "payable";
331
+ }, {
332
+ readonly type: "function";
333
+ readonly inputs: readonly [{
334
+ readonly name: "user";
335
+ readonly internalType: "address";
336
+ readonly type: "address";
337
+ }];
338
+ readonly name: "rolesOf";
339
+ readonly outputs: readonly [{
340
+ readonly name: "roles";
341
+ readonly internalType: "uint256";
342
+ readonly type: "uint256";
343
+ }];
344
+ readonly stateMutability: "view";
345
+ }, {
346
+ readonly type: "function";
347
+ readonly inputs: readonly [{
348
+ readonly name: "users_";
349
+ readonly internalType: "address[]";
350
+ readonly type: "address[]";
351
+ }, {
352
+ readonly name: "allowed_";
353
+ readonly internalType: "bool[]";
354
+ readonly type: "bool[]";
355
+ }];
356
+ readonly name: "setAllowed";
357
+ readonly outputs: readonly [];
358
+ readonly stateMutability: "nonpayable";
359
+ }, {
360
+ readonly type: "function";
361
+ readonly inputs: readonly [{
362
+ readonly name: "interfaceId";
363
+ readonly internalType: "bytes4";
364
+ readonly type: "bytes4";
365
+ }];
366
+ readonly name: "supportsInterface";
367
+ readonly outputs: readonly [{
368
+ readonly name: "";
369
+ readonly internalType: "bool";
370
+ readonly type: "bool";
371
+ }];
372
+ readonly stateMutability: "view";
373
+ }, {
374
+ readonly type: "function";
375
+ readonly inputs: readonly [{
376
+ readonly name: "newOwner";
377
+ readonly internalType: "address";
378
+ readonly type: "address";
379
+ }];
380
+ readonly name: "transferOwnership";
381
+ readonly outputs: readonly [];
382
+ readonly stateMutability: "payable";
383
+ }];
384
+ /**
385
+ * @inheritdoc
386
+ *
387
+ * @public
388
+ * @static
389
+ * @type {Address}
390
+ */
391
+ static base: Address;
392
+ /**
393
+ * @inheritdoc
394
+ *
395
+ * @public
396
+ * @static
397
+ * @type {RegistryType}
398
+ */
399
+ static registryType: RegistryType;
400
+ /**
401
+ * Check if a user is authorized.
402
+ *
403
+ * @public
404
+ * @async
405
+ * @param {Address} address - The address of the user
406
+ * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
407
+ * @returns {Promise<boolean>} - True if the user is authorized
408
+ */
409
+ isAllowed(address: Address, params?: ReadParams<typeof simpleAllowListAbi, 'setAllowed'>): Promise<boolean>;
410
+ /**
411
+ * Set the allowed status of a user. The length of the `users_` and `allowed_` arrays must be the same.
412
+ * This function can only be called by the owner
413
+ *
414
+ * @public
415
+ * @async
416
+ * @param {Address[]} addresses - The list of users to update
417
+ * @param {boolean[]} allowed - The allowed status of each user
418
+ * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
419
+ * @returns {Promise<void>}
420
+ */
421
+ setAllowed(addresses: Address[], allowed: boolean[], params?: WriteParams<typeof simpleAllowListAbi, 'setAllowed'>): Promise<void>;
422
+ /**
423
+ * Set the allowed status of a user. The length of the `users_` and `allowed_` arrays must be the same.
424
+ * This function can only be called by the owner
425
+ *
426
+ * @public
427
+ * @async
428
+ * @param {Address[]} addresses - The list of users to update
429
+ * @param {boolean[]} allowed - The allowed status of each user
430
+ * @param {?ReadParams<typeof simpleAllowListAbi, 'setAllowed'>} [params]
431
+ * @returns {Promise<void>}
432
+ */
433
+ setAllowedRaw(addresses: Address[], allowed: boolean[], params?: ReadParams<typeof simpleAllowListAbi, 'setAllowed'>): Promise<{
434
+ hash: `0x${string}`;
435
+ result: void;
436
+ }>;
437
+ /**
438
+ * Allows the owner to grant `user` `roles`.
439
+ *
440
+ * @public
441
+ * @async
442
+ * @param {Address} address
443
+ * @param {bigint} role
444
+ * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]
445
+ * @returns {Promise<void>}
446
+ */
447
+ grantRoles(address: Address, role: bigint, params?: WriteParams<typeof simpleAllowListAbi, 'grantRoles'>): Promise<void>;
448
+ /**
449
+ * Allows the owner to grant `user` `roles`.
450
+ *
451
+ * @public
452
+ * @async
453
+ * @param {Address} address
454
+ * @param {bigint} role
455
+ * @param {?ReadParams<typeof simpleAllowListAbi, 'grantRoles'>} [params]
456
+ * @returns {Promise<void>}
457
+ */
458
+ grantRolesRaw(address: Address, role: bigint, params?: ReadParams<typeof simpleAllowListAbi, 'grantRoles'>): Promise<{
459
+ hash: `0x${string}`;
460
+ result: void;
461
+ }>;
462
+ /**
463
+ * @inheritdoc
464
+ *
465
+ * @public
466
+ * @param {?SimpleAllowListPayload} [_payload]
467
+ * @param {?DeployableOptions} [_options]
468
+ * @returns {GenericDeployableParams}
469
+ */
470
+ buildParameters(_payload?: SimpleAllowListPayload, _options?: DeployableOptions): GenericDeployableParams;
471
+ }
472
+ /**
473
+ * Given a {@link SimpleAllowListPayload}, properly encode the initialization payload.
474
+ *
475
+ * @param {SimpleAllowListPayload} param0
476
+ * @param {Address} param0.owner - The allow list's owner, given the {@link LIST_MANAGER_ROLE} role.
477
+ * @param {Address[]} param0.allowed - List of allowed addresses.
478
+ * @returns {Hex}
479
+ */
480
+ export declare function prepareSimpleAllowListPayload({ owner, allowed, }: SimpleAllowListPayload): `0x${string}`;
481
+ //# sourceMappingURL=SimpleAllowList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleAllowList.d.ts","sourceRoot":"","sources":["../../src/AllowLists/SimpleAllowList.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAKnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,EAKvB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,YAAY,EACZ,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,CAC5B,KAAK,SAAS,iBAAiB,CAC7B,OAAO,kBAAkB,CAC1B,GAAG,iBAAiB,CAAC,OAAO,kBAAkB,CAAC,IAC9C,UAAU,CAAC,OAAO,kBAAkB,EAAE,KAAK,CAAC,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,gBAAgB,CACnD,sBAAsB,EACtB,OAAO,kBAAkB,CAC1B;IACC,SAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAsB;IAClD;;;;;;OAMG;IACH,OAAuB,IAAI,EAAE,OAAO,CACN;IAC9B;;;;;;OAMG;IACH,OAAuB,YAAY,EAAE,YAAY,CAA2B;IAE5E;;;;;;;;OAQG;IACU,SAAS,CACpB,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,kBAAkB,EAAE,YAAY,CAAC,GAC3D,OAAO,CAAC,OAAO,CAAC;IAUnB;;;;;;;;;;OAUG;IACU,UAAU,CACrB,SAAS,EAAE,OAAO,EAAE,EACpB,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,kBAAkB,EAAE,YAAY,CAAC;IAO/D;;;;;;;;;;OAUG;IACU,aAAa,CACxB,SAAS,EAAE,OAAO,EAAE,EACpB,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,kBAAkB,EAAE,YAAY,CAAC;;;;IAgB9D;;;;;;;;;OASG;IACU,UAAU,CACrB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,kBAAkB,EAAE,YAAY,CAAC;IAK/D;;;;;;;;;OASG;IACU,aAAa,CACxB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,kBAAkB,EAAE,YAAY,CAAC;;;;IAgB9D;;;;;;;OAOG;IACa,eAAe,CAC7B,QAAQ,CAAC,EAAE,sBAAsB,EACjC,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,uBAAuB;CAwB3B;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,KAAK,EACL,OAAO,GACR,EAAE,sBAAsB,iBAQxB"}