@seedprotocol/publish 0.6.7 → 0.6.9

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 (291) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +64 -24
  3. package/dist/chainConfig-3sSqEVQh.js +1433 -0
  4. package/dist/chainConfig-3sSqEVQh.js.map +1 -0
  5. package/dist/chainConfig-3wlYarAG.js +1433 -0
  6. package/dist/chainConfig-3wlYarAG.js.map +1 -0
  7. package/dist/chainConfig-BRcsMopd.js +1442 -0
  8. package/dist/chainConfig-BRcsMopd.js.map +1 -0
  9. package/dist/chainConfig-BYm5OXpk.js +1433 -0
  10. package/dist/chainConfig-BYm5OXpk.js.map +1 -0
  11. package/dist/chainConfig-CA1Hrrjg.js +1387 -0
  12. package/dist/chainConfig-CA1Hrrjg.js.map +1 -0
  13. package/dist/chainConfig-CYy0XJ0M.js +1283 -0
  14. package/dist/chainConfig-CYy0XJ0M.js.map +1 -0
  15. package/dist/chainConfig-CfVGYAsY.js +1311 -0
  16. package/dist/chainConfig-CfVGYAsY.js.map +1 -0
  17. package/dist/chainConfig-DDA4YmAB.js +1424 -0
  18. package/dist/chainConfig-DDA4YmAB.js.map +1 -0
  19. package/dist/config-CPBd5C_b.js +1201 -0
  20. package/dist/config-CPBd5C_b.js.map +1 -0
  21. package/dist/config-DkIapO94.js +955 -0
  22. package/dist/config-DkIapO94.js.map +1 -0
  23. package/dist/config-EQZZNH9H.js +955 -0
  24. package/dist/config-EQZZNH9H.js.map +1 -0
  25. package/dist/config.d.ts +85 -13
  26. package/dist/config.d.ts.map +1 -1
  27. package/dist/ensureAutomationSessionKey-BMHLKfjj.js +85 -0
  28. package/dist/ensureAutomationSessionKey-BMHLKfjj.js.map +1 -0
  29. package/dist/ensureAutomationSessionKey-BZ9_3FMW.js +86 -0
  30. package/dist/ensureAutomationSessionKey-BZ9_3FMW.js.map +1 -0
  31. package/dist/ensureAutomationSessionKey-Bw74ZSGI.js +85 -0
  32. package/dist/ensureAutomationSessionKey-Bw74ZSGI.js.map +1 -0
  33. package/dist/ensureAutomationSessionKey-C8D7BFjU.js +85 -0
  34. package/dist/ensureAutomationSessionKey-C8D7BFjU.js.map +1 -0
  35. package/dist/ensureAutomationSessionKey-CClLVX2w.js +85 -0
  36. package/dist/ensureAutomationSessionKey-CClLVX2w.js.map +1 -0
  37. package/dist/ensureAutomationSessionKey-CNNN1jBQ.js +85 -0
  38. package/dist/ensureAutomationSessionKey-CNNN1jBQ.js.map +1 -0
  39. package/dist/ensureAutomationSessionKey-CeUbjcCl.js +85 -0
  40. package/dist/ensureAutomationSessionKey-CeUbjcCl.js.map +1 -0
  41. package/dist/ensureAutomationSessionKey-D8Gki6U6.js +85 -0
  42. package/dist/ensureAutomationSessionKey-D8Gki6U6.js.map +1 -0
  43. package/dist/ensureAutomationSessionKey-DEH7nwUc.js +86 -0
  44. package/dist/ensureAutomationSessionKey-DEH7nwUc.js.map +1 -0
  45. package/dist/ensureAutomationSessionKey-Dhvbii2M.js +86 -0
  46. package/dist/ensureAutomationSessionKey-Dhvbii2M.js.map +1 -0
  47. package/dist/ensureAutomationSessionKey-Dyfk8qVp.js +85 -0
  48. package/dist/ensureAutomationSessionKey-Dyfk8qVp.js.map +1 -0
  49. package/dist/ensureModularPublishBootstrap-5HJDqJJM.js +24 -0
  50. package/dist/ensureModularPublishBootstrap-5HJDqJJM.js.map +1 -0
  51. package/dist/ensureModularPublishBootstrap-BW8jKN_A.js +24 -0
  52. package/dist/ensureModularPublishBootstrap-BW8jKN_A.js.map +1 -0
  53. package/dist/ensureModularPublishBootstrap-BhYNmLzT.js +24 -0
  54. package/dist/ensureModularPublishBootstrap-BhYNmLzT.js.map +1 -0
  55. package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js +24 -0
  56. package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js.map +1 -0
  57. package/dist/ensureModularPublishBootstrap-Btih5xbB.js +129 -0
  58. package/dist/ensureModularPublishBootstrap-Btih5xbB.js.map +1 -0
  59. package/dist/ensureModularPublishBootstrap-CI4U08Gc.js +129 -0
  60. package/dist/ensureModularPublishBootstrap-CI4U08Gc.js.map +1 -0
  61. package/dist/ensureModularPublishBootstrap-CcU-hXll.js +128 -0
  62. package/dist/ensureModularPublishBootstrap-CcU-hXll.js.map +1 -0
  63. package/dist/ensureModularPublishBootstrap-CdrykHAi.js +24 -0
  64. package/dist/ensureModularPublishBootstrap-CdrykHAi.js.map +1 -0
  65. package/dist/ensureModularPublishBootstrap-DGBKVGg5.js +24 -0
  66. package/dist/ensureModularPublishBootstrap-DGBKVGg5.js.map +1 -0
  67. package/dist/ensureModularPublishBootstrap-DaREOqSc.js +129 -0
  68. package/dist/ensureModularPublishBootstrap-DaREOqSc.js.map +1 -0
  69. package/dist/ensureModularPublishBootstrap-DxIG-LUP.js +24 -0
  70. package/dist/ensureModularPublishBootstrap-DxIG-LUP.js.map +1 -0
  71. package/dist/ensureSmartWalletThenPublish-BSYzckyS.js +49 -0
  72. package/dist/ensureSmartWalletThenPublish-BSYzckyS.js.map +1 -0
  73. package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js +49 -0
  74. package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js.map +1 -0
  75. package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js +48 -0
  76. package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js.map +1 -0
  77. package/dist/ensureSmartWalletThenPublish-Bm58tc-b.js +48 -0
  78. package/dist/ensureSmartWalletThenPublish-Bm58tc-b.js.map +1 -0
  79. package/dist/ensureSmartWalletThenPublish-CE7acryB.js +49 -0
  80. package/dist/ensureSmartWalletThenPublish-CE7acryB.js.map +1 -0
  81. package/dist/ensureSmartWalletThenPublish-D5GSZRyZ.js +48 -0
  82. package/dist/ensureSmartWalletThenPublish-D5GSZRyZ.js.map +1 -0
  83. package/dist/ensureSmartWalletThenPublish-DAomriGc.js +48 -0
  84. package/dist/ensureSmartWalletThenPublish-DAomriGc.js.map +1 -0
  85. package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js +48 -0
  86. package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js.map +1 -0
  87. package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js +48 -0
  88. package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js.map +1 -0
  89. package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js +48 -0
  90. package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js.map +1 -0
  91. package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js +48 -0
  92. package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js.map +1 -0
  93. package/dist/errors-Du3LNbJN.js.map +1 -1
  94. package/dist/errors.d.ts +2 -2
  95. package/dist/errors.d.ts.map +1 -1
  96. package/dist/helpers/abi/executor.d.ts +125 -0
  97. package/dist/helpers/abi/executor.d.ts.map +1 -1
  98. package/dist/helpers/abi/factory.d.ts +1 -1
  99. package/dist/helpers/abi/factory.d.ts.map +1 -1
  100. package/dist/helpers/abi/publisher.d.ts +18 -74
  101. package/dist/helpers/abi/publisher.d.ts.map +1 -1
  102. package/dist/helpers/abi/seedErrors.d.ts +141 -0
  103. package/dist/helpers/abi/seedErrors.d.ts.map +1 -0
  104. package/dist/helpers/abi/seedExecutorRouter.d.ts +60 -0
  105. package/dist/helpers/abi/seedExecutorRouter.d.ts.map +1 -0
  106. package/dist/helpers/adapters/permissionlessTxSender.d.ts +26 -0
  107. package/dist/helpers/adapters/permissionlessTxSender.d.ts.map +1 -1
  108. package/dist/helpers/adapters/thirdwebAccount.d.ts +10 -2
  109. package/dist/helpers/adapters/thirdwebAccount.d.ts.map +1 -1
  110. package/dist/helpers/approvedTargetsForAutomationPublish.d.ts +1 -1
  111. package/dist/helpers/blockchain.d.ts +4 -0
  112. package/dist/helpers/blockchain.d.ts.map +1 -1
  113. package/dist/helpers/chainClient.d.ts.map +1 -1
  114. package/dist/helpers/chainConfig.d.ts +2 -0
  115. package/dist/helpers/chainConfig.d.ts.map +1 -1
  116. package/dist/helpers/constants.d.ts +14 -3
  117. package/dist/helpers/constants.d.ts.map +1 -1
  118. package/dist/helpers/contracts/index.d.ts +27 -14
  119. package/dist/helpers/contracts/index.d.ts.map +1 -1
  120. package/dist/helpers/defaultApprovedTargetsForModularPublish.d.ts +12 -2
  121. package/dist/helpers/defaultApprovedTargetsForModularPublish.d.ts.map +1 -1
  122. package/dist/helpers/describeRevert.d.ts +33 -0
  123. package/dist/helpers/describeRevert.d.ts.map +1 -0
  124. package/dist/helpers/easDirect.d.ts +3 -8
  125. package/dist/helpers/easDirect.d.ts.map +1 -1
  126. package/dist/helpers/enrollPublishAutomation.d.ts +6 -2
  127. package/dist/helpers/enrollPublishAutomation.d.ts.map +1 -1
  128. package/dist/helpers/ensureAutomationSessionKey.d.ts.map +1 -1
  129. package/dist/helpers/ensureEip7702ModularAccountReady.d.ts +1 -1
  130. package/dist/helpers/ensureEip7702ModularAccountReady.d.ts.map +1 -1
  131. package/dist/helpers/ensureExecutorModule.d.ts +6 -3
  132. package/dist/helpers/ensureExecutorModule.d.ts.map +1 -1
  133. package/dist/helpers/ensureManagedAccountEasConfigured.d.ts +8 -3
  134. package/dist/helpers/ensureManagedAccountEasConfigured.d.ts.map +1 -1
  135. package/dist/helpers/ensureManagedAccountReady.d.ts.map +1 -1
  136. package/dist/helpers/ensureManagedSignerSessionKey.d.ts +5 -0
  137. package/dist/helpers/ensureManagedSignerSessionKey.d.ts.map +1 -1
  138. package/dist/helpers/ensureModularPublishBootstrap.d.ts +6 -2
  139. package/dist/helpers/ensureModularPublishBootstrap.d.ts.map +1 -1
  140. package/dist/helpers/ensureSmartWalletThenPublish.d.ts.map +1 -1
  141. package/dist/helpers/executorModuleReadiness.d.ts +28 -0
  142. package/dist/helpers/executorModuleReadiness.d.ts.map +1 -0
  143. package/dist/helpers/managedAccountAdmin.d.ts +12 -0
  144. package/dist/helpers/managedAccountAdmin.d.ts.map +1 -0
  145. package/dist/helpers/publishThirdwebClient.d.ts +10 -0
  146. package/dist/helpers/publishThirdwebClient.d.ts.map +1 -0
  147. package/dist/helpers/retryNonceTooLow.d.ts +12 -0
  148. package/dist/helpers/retryNonceTooLow.d.ts.map +1 -0
  149. package/dist/helpers/seedSigner.d.ts.map +1 -1
  150. package/dist/helpers/seedTwin.d.ts +47 -0
  151. package/dist/helpers/seedTwin.d.ts.map +1 -0
  152. package/dist/helpers/thirdweb.d.ts +21 -6
  153. package/dist/helpers/thirdweb.d.ts.map +1 -1
  154. package/dist/helpers/thirdwebChain.d.ts +21 -0
  155. package/dist/helpers/thirdwebChain.d.ts.map +1 -0
  156. package/dist/helpers/verifyPublishChain.d.ts +21 -0
  157. package/dist/helpers/verifyPublishChain.d.ts.map +1 -0
  158. package/dist/hooks/useItemPublishStatus.d.ts +2 -0
  159. package/dist/hooks/useItemPublishStatus.d.ts.map +1 -1
  160. package/dist/index.d.ts +10 -4
  161. package/dist/index.d.ts.map +1 -1
  162. package/dist/index.js +463 -408
  163. package/dist/index.js.map +1 -1
  164. package/dist/managedAccountAdmin-B64V1rlU.js +29 -0
  165. package/dist/managedAccountAdmin-B64V1rlU.js.map +1 -0
  166. package/dist/managedAccountAdmin-BVLGWpEb.js +29 -0
  167. package/dist/managedAccountAdmin-BVLGWpEb.js.map +1 -0
  168. package/dist/managedAccountAdmin-Bje6X8Ds.js +29 -0
  169. package/dist/managedAccountAdmin-Bje6X8Ds.js.map +1 -0
  170. package/dist/managedAccountAdmin-C84-IlQ9.js +29 -0
  171. package/dist/managedAccountAdmin-C84-IlQ9.js.map +1 -0
  172. package/dist/managedAccountAdmin-DJMw6UH6.js +29 -0
  173. package/dist/managedAccountAdmin-DJMw6UH6.js.map +1 -0
  174. package/dist/managedAccountAdmin-DhCRBoPX.js +29 -0
  175. package/dist/managedAccountAdmin-DhCRBoPX.js.map +1 -0
  176. package/dist/managedAccountAdmin-NXD66lP5.js +29 -0
  177. package/dist/managedAccountAdmin-NXD66lP5.js.map +1 -0
  178. package/dist/publishAuthorization-B0G1em4a.js +3695 -0
  179. package/dist/publishAuthorization-B0G1em4a.js.map +1 -0
  180. package/dist/publishAuthorization-B1BVVfp0.js +3604 -0
  181. package/dist/publishAuthorization-B1BVVfp0.js.map +1 -0
  182. package/dist/publishAuthorization-BEqRnP2h.js +3925 -0
  183. package/dist/publishAuthorization-BEqRnP2h.js.map +1 -0
  184. package/dist/publishAuthorization-Bltn3y_K.js +3599 -0
  185. package/dist/publishAuthorization-Bltn3y_K.js.map +1 -0
  186. package/dist/publishAuthorization-By2Tt9kW.js +3912 -0
  187. package/dist/publishAuthorization-By2Tt9kW.js.map +1 -0
  188. package/dist/publishAuthorization-CxBkijU6.js +3925 -0
  189. package/dist/publishAuthorization-CxBkijU6.js.map +1 -0
  190. package/dist/publishAuthorization-CxWY7lAQ.js +3706 -0
  191. package/dist/publishAuthorization-CxWY7lAQ.js.map +1 -0
  192. package/dist/publishAuthorization-DEriY_jm.js +3687 -0
  193. package/dist/publishAuthorization-DEriY_jm.js.map +1 -0
  194. package/dist/publishAuthorization-DfAQs1sN.js +3707 -0
  195. package/dist/publishAuthorization-DfAQs1sN.js.map +1 -0
  196. package/dist/publishAuthorization-DjVrnMC0.js +3925 -0
  197. package/dist/publishAuthorization-DjVrnMC0.js.map +1 -0
  198. package/dist/publishAuthorization-DqhhCAhd.js +3652 -0
  199. package/dist/publishAuthorization-DqhhCAhd.js.map +1 -0
  200. package/dist/publishThirdwebClient-BdgkcqM7.js +18 -0
  201. package/dist/publishThirdwebClient-BdgkcqM7.js.map +1 -0
  202. package/dist/publishThirdwebClient-BkmDN480.js +18 -0
  203. package/dist/publishThirdwebClient-BkmDN480.js.map +1 -0
  204. package/dist/publishThirdwebClient-BnDhP3N-.js +18 -0
  205. package/dist/publishThirdwebClient-BnDhP3N-.js.map +1 -0
  206. package/dist/publishThirdwebClient-CBD9sKJR.js +18 -0
  207. package/dist/publishThirdwebClient-CBD9sKJR.js.map +1 -0
  208. package/dist/publishThirdwebClient-CQ29pzG2.js +18 -0
  209. package/dist/publishThirdwebClient-CQ29pzG2.js.map +1 -0
  210. package/dist/publishThirdwebClient-CZIVmr9Z.js +18 -0
  211. package/dist/publishThirdwebClient-CZIVmr9Z.js.map +1 -0
  212. package/dist/publishThirdwebClient-Ce7iBIsj.js +18 -0
  213. package/dist/publishThirdwebClient-Ce7iBIsj.js.map +1 -0
  214. package/dist/publishThirdwebClient-DroRrOFQ.js +18 -0
  215. package/dist/publishThirdwebClient-DroRrOFQ.js.map +1 -0
  216. package/dist/publishThirdwebClient-DzXFjQ7L.js +18 -0
  217. package/dist/publishThirdwebClient-DzXFjQ7L.js.map +1 -0
  218. package/dist/publishThirdwebClient-Dzb2vcEs.js +18 -0
  219. package/dist/publishThirdwebClient-Dzb2vcEs.js.map +1 -0
  220. package/dist/publishThirdwebClient-i8P7fivi.js +18 -0
  221. package/dist/publishThirdwebClient-i8P7fivi.js.map +1 -0
  222. package/dist/react/ConnectButton.d.ts.map +1 -1
  223. package/dist/resolveRevokeAccount-B5iXpuRT.js +38 -0
  224. package/dist/resolveRevokeAccount-B5iXpuRT.js.map +1 -0
  225. package/dist/resolveRevokeAccount-B7ImSb4Y.js +38 -0
  226. package/dist/resolveRevokeAccount-B7ImSb4Y.js.map +1 -0
  227. package/dist/resolveRevokeAccount-BM1j2l5Q.js +38 -0
  228. package/dist/resolveRevokeAccount-BM1j2l5Q.js.map +1 -0
  229. package/dist/resolveRevokeAccount-BtVG0xxc.js +38 -0
  230. package/dist/resolveRevokeAccount-BtVG0xxc.js.map +1 -0
  231. package/dist/resolveRevokeAccount-CJZZdBcQ.js +39 -0
  232. package/dist/resolveRevokeAccount-CJZZdBcQ.js.map +1 -0
  233. package/dist/resolveRevokeAccount-CaIMuCee.js +39 -0
  234. package/dist/resolveRevokeAccount-CaIMuCee.js.map +1 -0
  235. package/dist/resolveRevokeAccount-Cg4TQgnd.js +38 -0
  236. package/dist/resolveRevokeAccount-Cg4TQgnd.js.map +1 -0
  237. package/dist/resolveRevokeAccount-DHnxtEIj.js +39 -0
  238. package/dist/resolveRevokeAccount-DHnxtEIj.js.map +1 -0
  239. package/dist/resolveRevokeAccount-DJKfLlyK.js +38 -0
  240. package/dist/resolveRevokeAccount-DJKfLlyK.js.map +1 -0
  241. package/dist/resolveRevokeAccount-S-2WXkNh.js +38 -0
  242. package/dist/resolveRevokeAccount-S-2WXkNh.js.map +1 -0
  243. package/dist/resolveRevokeAccount-mzR11KJ4.js +38 -0
  244. package/dist/resolveRevokeAccount-mzR11KJ4.js.map +1 -0
  245. package/dist/services/publish/actors/checking.d.ts.map +1 -1
  246. package/dist/services/publish/actors/createAttestations.d.ts.map +1 -1
  247. package/dist/services/publish/helpers/ensureEasSchemas.d.ts +12 -1
  248. package/dist/services/publish/helpers/ensureEasSchemas.d.ts.map +1 -1
  249. package/dist/services/publish/helpers/getPublishUploadData.d.ts.map +1 -1
  250. package/dist/services/publishManager/actions/createPublish.d.ts.map +1 -1
  251. package/dist/services/publishManager/actions/drainPendingCreates.d.ts +3 -0
  252. package/dist/services/publishManager/actions/drainPendingCreates.d.ts.map +1 -0
  253. package/dist/services/publishManager/actions/publishDone.d.ts.map +1 -1
  254. package/dist/services/publishManager/actions/queueCreatePublish.d.ts +2 -0
  255. package/dist/services/publishManager/actions/queueCreatePublish.d.ts.map +1 -0
  256. package/dist/services/publishManager/actors/restoreFromDb.d.ts.map +1 -1
  257. package/dist/services/publishManager/actors/savePublish.d.ts +11 -0
  258. package/dist/services/publishManager/actors/savePublish.d.ts.map +1 -1
  259. package/dist/services/publishManager/createPublishResult.d.ts +6 -0
  260. package/dist/services/publishManager/createPublishResult.d.ts.map +1 -0
  261. package/dist/services/publishManager/index.d.ts +61 -1
  262. package/dist/services/publishManager/index.d.ts.map +1 -1
  263. package/dist/services/revoke/revokeAttestations.d.ts +3 -2
  264. package/dist/services/revoke/revokeAttestations.d.ts.map +1 -1
  265. package/dist/thirdweb.d.ts +1 -0
  266. package/dist/thirdweb.d.ts.map +1 -1
  267. package/dist/thirdweb.js +204 -128
  268. package/dist/thirdweb.js.map +1 -1
  269. package/dist/worker-2dUZSapK.js +69 -0
  270. package/dist/worker-2dUZSapK.js.map +1 -0
  271. package/dist/worker-B8gN5WTx.js +69 -0
  272. package/dist/worker-B8gN5WTx.js.map +1 -0
  273. package/dist/worker-BgErCNTb.js +69 -0
  274. package/dist/worker-BgErCNTb.js.map +1 -0
  275. package/dist/worker-C07rPV2G.js +69 -0
  276. package/dist/worker-C07rPV2G.js.map +1 -0
  277. package/dist/worker-C9Za_dlQ.js +69 -0
  278. package/dist/worker-C9Za_dlQ.js.map +1 -0
  279. package/dist/worker-CEgulQnm.js +69 -0
  280. package/dist/worker-CEgulQnm.js.map +1 -0
  281. package/dist/worker-C_TL94He.js +69 -0
  282. package/dist/worker-C_TL94He.js.map +1 -0
  283. package/dist/worker-CbtzcKG6.js +69 -0
  284. package/dist/worker-CbtzcKG6.js.map +1 -0
  285. package/dist/worker-DHUm-TeQ.js +69 -0
  286. package/dist/worker-DHUm-TeQ.js.map +1 -0
  287. package/dist/worker-DypHzXgH.js +69 -0
  288. package/dist/worker-DypHzXgH.js.map +1 -0
  289. package/dist/worker-ZL4Wg19t.js +69 -0
  290. package/dist/worker-ZL4Wg19t.js.map +1 -0
  291. package/package.json +6 -6
@@ -0,0 +1,85 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { Q as t, _ as n, at as r, st as i, t as a } from "./chainConfig-CA1Hrrjg.js";
3
+ import { r as o } from "./errors-Du3LNbJN.js";
4
+ import { M as s, d as c, p as l } from "./publishAuthorization-BEqRnP2h.js";
5
+ import { t as u } from "./publishThirdwebClient-CBD9sKJR.js";
6
+ import { getContract as d, sendTransaction as f } from "thirdweb";
7
+ import { addSessionKey as p, removeSessionKey as m, shouldUpdateSessionKey as h } from "thirdweb/extensions/erc4337";
8
+ //#region src/helpers/ensureAutomationSessionKey.ts
9
+ var g = /* @__PURE__ */ e({
10
+ ensureAutomationSessionKey: () => x,
11
+ isAutomationSessionActive: () => C,
12
+ removeAutomationSessionKey: () => S
13
+ }), _ = () => `Could not connect the managed publishing account to authorize an automation session key on ${a()}. Reconnect and try again.`, v = () => `Could not authorize the automation session key on your publishing account on ${a()}.`, y = () => `Could not remove the automation session key from your publishing account on ${a()}.`;
14
+ async function b(e) {
15
+ let t = s();
16
+ await t.autoConnect({
17
+ client: u(),
18
+ chain: n()
19
+ });
20
+ let r = t.getAccount();
21
+ if (!r) throw new o(_(), "MODULAR_SIGNER_ACTIVATION_FAILED", e);
22
+ return r;
23
+ }
24
+ async function x(e) {
25
+ let { managedAddress: t, sessionKeyAddress: r, expiresAt: a } = e, s = await b(t), m = d({
26
+ client: u(),
27
+ chain: n(),
28
+ address: t
29
+ }), g = l(c({ expiresAt: a })), _ = !1;
30
+ try {
31
+ _ = await h({
32
+ accountContract: m,
33
+ sessionKeyAddress: r,
34
+ newPermissions: g
35
+ });
36
+ } catch (e) {
37
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
38
+ }
39
+ if (_) try {
40
+ let e = p({
41
+ contract: m,
42
+ account: s,
43
+ sessionKeyAddress: r,
44
+ permissions: g
45
+ }), t = await f({
46
+ account: s,
47
+ transaction: e
48
+ });
49
+ await i(t.transactionHash);
50
+ } catch (e) {
51
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
52
+ }
53
+ if (!await C(t, r)) throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
54
+ }
55
+ async function S(e) {
56
+ let { managedAddress: t, sessionKeyAddress: r } = e, a = await b(t), s = d({
57
+ client: u(),
58
+ chain: n(),
59
+ address: t
60
+ });
61
+ try {
62
+ let e = m({
63
+ contract: s,
64
+ account: a,
65
+ sessionKeyAddress: r
66
+ }), t = await f({
67
+ account: a,
68
+ transaction: e
69
+ });
70
+ await i(t.transactionHash);
71
+ } catch (e) {
72
+ throw new o(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
73
+ }
74
+ }
75
+ async function C(e, n) {
76
+ try {
77
+ return await r(e) ? await t(e, n) : !1;
78
+ } catch (t) {
79
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", e, t);
80
+ }
81
+ }
82
+ //#endregion
83
+ export { S as i, g as n, C as r, x as t };
84
+
85
+ //# sourceMappingURL=ensureAutomationSessionKey-Bw74ZSGI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureAutomationSessionKey-Bw74ZSGI.js","names":[],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n const active = await isAutomationSessionActive(managedAddress, sessionKeyAddress)\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;IAkBM,UACJ,8FAA8F,EAAoB,EAAE,6BAChH,UACJ,gFAAgF,EAAoB,EAAE,IAClG,UACJ,+EAA+E,EAAoB,EAAE;AAEvG,eAAe,EAAoC,GAAwB;CACzE,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,EAAgB,GAChB,oCACA,CACF;CAEF,OAAO;AACT;AAMA,eAAsB,EAA2B,GAK/B;CAChB,IAAM,EAAE,mBAAgB,sBAAmB,iBAAc,GACnD,IAAiB,MAAM,EAAoC,CAAc,GAE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GACA,CACF;CACF;AACF"}
@@ -0,0 +1,85 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { Q as t, _ as n, at as r, st as i, t as a } from "./chainConfig-DDA4YmAB.js";
3
+ import { r as o } from "./errors-Du3LNbJN.js";
4
+ import { M as s, d as c, p as l } from "./publishAuthorization-B0G1em4a.js";
5
+ import { t as u } from "./publishThirdwebClient-CQ29pzG2.js";
6
+ import { getContract as d, sendTransaction as f } from "thirdweb";
7
+ import { addSessionKey as p, removeSessionKey as m, shouldUpdateSessionKey as h } from "thirdweb/extensions/erc4337";
8
+ //#region src/helpers/ensureAutomationSessionKey.ts
9
+ var g = /* @__PURE__ */ e({
10
+ ensureAutomationSessionKey: () => x,
11
+ isAutomationSessionActive: () => C,
12
+ removeAutomationSessionKey: () => S
13
+ }), _ = () => `Could not connect the managed publishing account to authorize an automation session key on ${a()}. Reconnect and try again.`, v = () => `Could not authorize the automation session key on your publishing account on ${a()}.`, y = () => `Could not remove the automation session key from your publishing account on ${a()}.`;
14
+ async function b(e) {
15
+ let t = s();
16
+ await t.autoConnect({
17
+ client: u(),
18
+ chain: n()
19
+ });
20
+ let r = t.getAccount();
21
+ if (!r) throw new o(_(), "MODULAR_SIGNER_ACTIVATION_FAILED", e);
22
+ return r;
23
+ }
24
+ async function x(e) {
25
+ let { managedAddress: t, sessionKeyAddress: r, expiresAt: a } = e, s = await b(t), m = d({
26
+ client: u(),
27
+ chain: n(),
28
+ address: t
29
+ }), g = l(c({ expiresAt: a })), _ = !1;
30
+ try {
31
+ _ = await h({
32
+ accountContract: m,
33
+ sessionKeyAddress: r,
34
+ newPermissions: g
35
+ });
36
+ } catch (e) {
37
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
38
+ }
39
+ if (_) try {
40
+ let e = p({
41
+ contract: m,
42
+ account: s,
43
+ sessionKeyAddress: r,
44
+ permissions: g
45
+ }), t = await f({
46
+ account: s,
47
+ transaction: e
48
+ });
49
+ await i(t.transactionHash);
50
+ } catch (e) {
51
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
52
+ }
53
+ if (!await C(t, r)) throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
54
+ }
55
+ async function S(e) {
56
+ let { managedAddress: t, sessionKeyAddress: r } = e, a = await b(t), s = d({
57
+ client: u(),
58
+ chain: n(),
59
+ address: t
60
+ });
61
+ try {
62
+ let e = m({
63
+ contract: s,
64
+ account: a,
65
+ sessionKeyAddress: r
66
+ }), t = await f({
67
+ account: a,
68
+ transaction: e
69
+ });
70
+ await i(t.transactionHash);
71
+ } catch (e) {
72
+ throw new o(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
73
+ }
74
+ }
75
+ async function C(e, n) {
76
+ try {
77
+ return await r(e) ? await t(e, n) : !1;
78
+ } catch (t) {
79
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", e, t);
80
+ }
81
+ }
82
+ //#endregion
83
+ export { S as i, g as n, C as r, x as t };
84
+
85
+ //# sourceMappingURL=ensureAutomationSessionKey-C8D7BFjU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureAutomationSessionKey-C8D7BFjU.js","names":[],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n const active = await isAutomationSessionActive(managedAddress, sessionKeyAddress)\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;IAkBM,UACJ,8FAA8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/B,SAAS;CACX,CAAC;CAED,IAAI;EACF,IAAM,IAAK,EAAiB;GAC1B,UAAU;GACV,SAAS;GACT;EACF,CAAC,GACK,IAAS,MAAM,EAAgB;GAAE,SAAS;GAAgB,aAAa;EAAG,CAAC;EACjF,MAAM,EAAsB,EAAO,eAAgC;CACrE,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAmB,GACnB,oCACA,GACA,CACF;CACF;AACF;AAQA,eAAsB,EACpB,GACA,GACkB;CAClB,IAAI;EAIF,OAHM,MAAM,EAAmB,CAAc,IAGtC,MAAM,EACX,GACA,CACF,IALS;CAMX,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;AACF"}
@@ -0,0 +1,85 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { $ as t, _ as n, ct as r, ot as i, t as a } from "./chainConfig-BYm5OXpk.js";
3
+ import { r as o } from "./errors-Du3LNbJN.js";
4
+ import { M as s, d as c, p as l } from "./publishAuthorization-CxBkijU6.js";
5
+ import { t as u } from "./publishThirdwebClient-BnDhP3N-.js";
6
+ import { getContract as d, sendTransaction as f } from "thirdweb";
7
+ import { addSessionKey as p, removeSessionKey as m, shouldUpdateSessionKey as h } from "thirdweb/extensions/erc4337";
8
+ //#region src/helpers/ensureAutomationSessionKey.ts
9
+ var g = /* @__PURE__ */ e({
10
+ ensureAutomationSessionKey: () => x,
11
+ isAutomationSessionActive: () => C,
12
+ removeAutomationSessionKey: () => S
13
+ }), _ = () => `Could not connect the managed publishing account to authorize an automation session key on ${a()}. Reconnect and try again.`, v = () => `Could not authorize the automation session key on your publishing account on ${a()}.`, y = () => `Could not remove the automation session key from your publishing account on ${a()}.`;
14
+ async function b(e) {
15
+ let t = s();
16
+ await t.autoConnect({
17
+ client: u(),
18
+ chain: n()
19
+ });
20
+ let r = t.getAccount();
21
+ if (!r) throw new o(_(), "MODULAR_SIGNER_ACTIVATION_FAILED", e);
22
+ return r;
23
+ }
24
+ async function x(e) {
25
+ let { managedAddress: t, sessionKeyAddress: i, expiresAt: a } = e, s = await b(t), m = d({
26
+ client: u(),
27
+ chain: n(),
28
+ address: t
29
+ }), g = l(c({ expiresAt: a })), _ = !1;
30
+ try {
31
+ _ = await h({
32
+ accountContract: m,
33
+ sessionKeyAddress: i,
34
+ newPermissions: g
35
+ });
36
+ } catch (e) {
37
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
38
+ }
39
+ if (_) try {
40
+ let e = p({
41
+ contract: m,
42
+ account: s,
43
+ sessionKeyAddress: i,
44
+ permissions: g
45
+ }), t = await f({
46
+ account: s,
47
+ transaction: e
48
+ });
49
+ await r(t.transactionHash);
50
+ } catch (e) {
51
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
52
+ }
53
+ if (!await C(t, i)) throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
54
+ }
55
+ async function S(e) {
56
+ let { managedAddress: t, sessionKeyAddress: i } = e, a = await b(t), s = d({
57
+ client: u(),
58
+ chain: n(),
59
+ address: t
60
+ });
61
+ try {
62
+ let e = m({
63
+ contract: s,
64
+ account: a,
65
+ sessionKeyAddress: i
66
+ }), t = await f({
67
+ account: a,
68
+ transaction: e
69
+ });
70
+ await r(t.transactionHash);
71
+ } catch (e) {
72
+ throw new o(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
73
+ }
74
+ }
75
+ async function C(e, n) {
76
+ try {
77
+ return await i(e) ? await t(e, n) : !1;
78
+ } catch (t) {
79
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", e, t);
80
+ }
81
+ }
82
+ //#endregion
83
+ export { S as i, g as n, C as r, x as t };
84
+
85
+ //# sourceMappingURL=ensureAutomationSessionKey-CClLVX2w.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureAutomationSessionKey-CClLVX2w.js","names":[],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n const active = await isAutomationSessionActive(managedAddress, sessionKeyAddress)\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;IAkBM,UACJ,8FAA8F,EAAoB,EAAE,6BAChH,UACJ,gFAAgF,EAAoB,EAAE,IAClG,UACJ,+EAA+E,EAAoB,EAAE;AAEvG,eAAe,EAAoC,GAAwB;CACzE,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,EAAgB,GAChB,oCACA,CACF;CAEF,OAAO;AACT;AAMA,eAAsB,EAA2B,GAK/B;CAChB,IAAM,EAAE,mBAAgB,sBAAmB,iBAAc,GACnD,IAAiB,MAAM,EAAoC,CAAc,GAEzE,IAAkB,EAAY;EAClC,QAAQ,EAAU;EAClB,OAAO,EAAwB;EAC/B,SAAS;CACX,CAAC,GACK,IAAc,EAClB,EAAqC,EAAE,aAAU,CAAC,CACpD,GAEI,IAAe;CACnB,IAAI;EACF,IAAe,MAAM,EAAuB;GAC1C;GACA;GACA,gBAAgB;EAClB,CAAC;CACH,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;CAEA,IAAI,GACF,IAAI;EACF,IAAM,IAAK,EAAc;GACvB,UAAU;GACV,SAAS;GACT;GACA;EACF,CAAC,GACK,IAAS,MAAM,EAAgB;GAAE,SAAS;GAAgB,aAAa;EAAG,CAAC;EACjF,MAAM,EAAsB,EAAO,eAAgC;CACrE,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;CAIF,IAAI,CAAC,MADgB,EAA0B,GAAgB,CAAiB,GAE9E,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,CACF;AAEJ;AAKA,eAAsB,EAA2B,GAG/B;CAChB,IAAM,EAAE,mBAAgB,yBAAsB,GACxC,IAAiB,MAAM,EAAoC,CAAc,GAEzE,IAAkB,EAAY;EAClC,QAAQ,EAAU;EAClB,OAAO,EAAwB;EAC/B,SAAS;CACX,CAAC;CAED,IAAI;EACF,IAAM,IAAK,EAAiB;GAC1B,UAAU;GACV,SAAS;GACT;EACF,CAAC,GACK,IAAS,MAAM,EAAgB;GAAE,SAAS;GAAgB,aAAa;EAAG,CAAC;EACjF,MAAM,EAAsB,EAAO,eAAgC;CACrE,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAmB,GACnB,oCACA,GACA,CACF;CACF;AACF;AAQA,eAAsB,EACpB,GACA,GACkB;CAClB,IAAI;EAIF,OAHM,MAAM,EAAmB,CAAc,IAGtC,MAAM,EACX,GACA,CACF,IALS;CAMX,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;AACF"}
@@ -0,0 +1,85 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { Q as t, _ as n, at as r, st as i, t as a } from "./chainConfig-BRcsMopd.js";
3
+ import { r as o } from "./errors-Du3LNbJN.js";
4
+ import { M as s, d as c, p as l } from "./publishAuthorization-CxWY7lAQ.js";
5
+ import { t as u } from "./publishThirdwebClient-Dzb2vcEs.js";
6
+ import { getContract as d, sendTransaction as f } from "thirdweb";
7
+ import { addSessionKey as p, removeSessionKey as m, shouldUpdateSessionKey as h } from "thirdweb/extensions/erc4337";
8
+ //#region src/helpers/ensureAutomationSessionKey.ts
9
+ var g = /* @__PURE__ */ e({
10
+ ensureAutomationSessionKey: () => x,
11
+ isAutomationSessionActive: () => C,
12
+ removeAutomationSessionKey: () => S
13
+ }), _ = () => `Could not connect the managed publishing account to authorize an automation session key on ${a()}. Reconnect and try again.`, v = () => `Could not authorize the automation session key on your publishing account on ${a()}.`, y = () => `Could not remove the automation session key from your publishing account on ${a()}.`;
14
+ async function b(e) {
15
+ let t = s();
16
+ await t.autoConnect({
17
+ client: u(),
18
+ chain: n()
19
+ });
20
+ let r = t.getAccount();
21
+ if (!r) throw new o(_(), "MODULAR_SIGNER_ACTIVATION_FAILED", e);
22
+ return r;
23
+ }
24
+ async function x(e) {
25
+ let { managedAddress: t, sessionKeyAddress: r, expiresAt: a } = e, s = await b(t), m = d({
26
+ client: u(),
27
+ chain: n(),
28
+ address: t
29
+ }), g = l(c({ expiresAt: a })), _ = !1;
30
+ try {
31
+ _ = await h({
32
+ accountContract: m,
33
+ sessionKeyAddress: r,
34
+ newPermissions: g
35
+ });
36
+ } catch (e) {
37
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
38
+ }
39
+ if (_) try {
40
+ let e = p({
41
+ contract: m,
42
+ account: s,
43
+ sessionKeyAddress: r,
44
+ permissions: g
45
+ }), t = await f({
46
+ account: s,
47
+ transaction: e
48
+ });
49
+ await i(t.transactionHash);
50
+ } catch (e) {
51
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
52
+ }
53
+ if (!await C(t, r)) throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
54
+ }
55
+ async function S(e) {
56
+ let { managedAddress: t, sessionKeyAddress: r } = e, a = await b(t), s = d({
57
+ client: u(),
58
+ chain: n(),
59
+ address: t
60
+ });
61
+ try {
62
+ let e = m({
63
+ contract: s,
64
+ account: a,
65
+ sessionKeyAddress: r
66
+ }), t = await f({
67
+ account: a,
68
+ transaction: e
69
+ });
70
+ await i(t.transactionHash);
71
+ } catch (e) {
72
+ throw new o(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
73
+ }
74
+ }
75
+ async function C(e, n) {
76
+ try {
77
+ return await r(e) ? await t(e, n) : !1;
78
+ } catch (t) {
79
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", e, t);
80
+ }
81
+ }
82
+ //#endregion
83
+ export { S as i, g as n, C as r, x as t };
84
+
85
+ //# sourceMappingURL=ensureAutomationSessionKey-CNNN1jBQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureAutomationSessionKey-CNNN1jBQ.js","names":[],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n const active = await isAutomationSessionActive(managedAddress, sessionKeyAddress)\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;IAkBM,UACJ,8FAA8F,EAAoB,EAAE,6BAChH,UACJ,gFAAgF,EAAoB,EAAE,IAClG,UACJ,+EAA+E,EAAoB,EAAE;AAEvG,eAAe,EAAoC,GAAwB;CACzE,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,EAAgB,GAChB,oCACA,CACF;CAEF,OAAO;AACT;AAMA,eAAsB,EAA2B,GAK/B;CAChB,IAA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CACF,IALS;CAMX,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;AACF"}
@@ -0,0 +1,85 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { Q as t, _ as n, at as r, st as i, t as a } from "./chainConfig-CYy0XJ0M.js";
3
+ import { r as o } from "./errors-Du3LNbJN.js";
4
+ import { M as s, d as c, p as l } from "./publishAuthorization-DjVrnMC0.js";
5
+ import { t as u } from "./publishThirdwebClient-Ce7iBIsj.js";
6
+ import { getContract as d, sendTransaction as f } from "thirdweb";
7
+ import { addSessionKey as p, removeSessionKey as m, shouldUpdateSessionKey as h } from "thirdweb/extensions/erc4337";
8
+ //#region src/helpers/ensureAutomationSessionKey.ts
9
+ var g = /* @__PURE__ */ e({
10
+ ensureAutomationSessionKey: () => x,
11
+ isAutomationSessionActive: () => C,
12
+ removeAutomationSessionKey: () => S
13
+ }), _ = () => `Could not connect the managed publishing account to authorize an automation session key on ${a()}. Reconnect and try again.`, v = () => `Could not authorize the automation session key on your publishing account on ${a()}.`, y = () => `Could not remove the automation session key from your publishing account on ${a()}.`;
14
+ async function b(e) {
15
+ let t = s();
16
+ await t.autoConnect({
17
+ client: u(),
18
+ chain: n()
19
+ });
20
+ let r = t.getAccount();
21
+ if (!r) throw new o(_(), "MODULAR_SIGNER_ACTIVATION_FAILED", e);
22
+ return r;
23
+ }
24
+ async function x(e) {
25
+ let { managedAddress: t, sessionKeyAddress: r, expiresAt: a } = e, s = await b(t), m = d({
26
+ client: u(),
27
+ chain: n(),
28
+ address: t
29
+ }), g = l(c({ expiresAt: a })), _ = !1;
30
+ try {
31
+ _ = await h({
32
+ accountContract: m,
33
+ sessionKeyAddress: r,
34
+ newPermissions: g
35
+ });
36
+ } catch (e) {
37
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
38
+ }
39
+ if (_) try {
40
+ let e = p({
41
+ contract: m,
42
+ account: s,
43
+ sessionKeyAddress: r,
44
+ permissions: g
45
+ }), t = await f({
46
+ account: s,
47
+ transaction: e
48
+ });
49
+ await i(t.transactionHash);
50
+ } catch (e) {
51
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
52
+ }
53
+ if (!await C(t, r)) throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
54
+ }
55
+ async function S(e) {
56
+ let { managedAddress: t, sessionKeyAddress: r } = e, a = await b(t), s = d({
57
+ client: u(),
58
+ chain: n(),
59
+ address: t
60
+ });
61
+ try {
62
+ let e = m({
63
+ contract: s,
64
+ account: a,
65
+ sessionKeyAddress: r
66
+ }), t = await f({
67
+ account: a,
68
+ transaction: e
69
+ });
70
+ await i(t.transactionHash);
71
+ } catch (e) {
72
+ throw new o(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
73
+ }
74
+ }
75
+ async function C(e, n) {
76
+ try {
77
+ return await r(e) ? await t(e, n) : !1;
78
+ } catch (t) {
79
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", e, t);
80
+ }
81
+ }
82
+ //#endregion
83
+ export { S as i, g as n, C as r, x as t };
84
+
85
+ //# sourceMappingURL=ensureAutomationSessionKey-CeUbjcCl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureAutomationSessionKey-CeUbjcCl.js","names":[],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n const active = await isAutomationSessionActive(managedAddress, sessionKeyAddress)\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED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oC,CAAc,GAEzE,IAAkB,EAAY;EAClC,QAAQ,EAAU;EAClB,OAAO,EAAwB;EAC/B,SAAS;CACX,CAAC;CAED,IAAI;EACF,IAAM,IAAK,EAAiB;GAC1B,UAAU;GACV,SAAS;GACT;EACF,CAAC,GACK,IAAS,MAAM,EAAgB;GAAE,SAAS;GAAgB,aAAa;EAAG,CAAC;EACjF,MAAM,EAAsB,EAAO,eAAgC;CACrE,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAmB,GACnB,oCACA,GACA,CACF;CACF;AACF;AAQA,eAAsB,EACpB,GACA,GACkB;CAClB,IAAI;EAIF,OAHM,MAAM,EAAmB,CAAc,IAGtC,MAAM,EACX,GACA,CACF,IALS;CAMX,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;AACF"}
@@ -0,0 +1,85 @@
1
+ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
+ import { $ as t, _ as n, ct as r, ot as i, t as a } from "./chainConfig-3wlYarAG.js";
3
+ import { r as o } from "./errors-Du3LNbJN.js";
4
+ import { M as s, d as c, p as l } from "./publishAuthorization-DfAQs1sN.js";
5
+ import { t as u } from "./publishThirdwebClient-i8P7fivi.js";
6
+ import { getContract as d, sendTransaction as f } from "thirdweb";
7
+ import { addSessionKey as p, removeSessionKey as m, shouldUpdateSessionKey as h } from "thirdweb/extensions/erc4337";
8
+ //#region src/helpers/ensureAutomationSessionKey.ts
9
+ var g = /* @__PURE__ */ e({
10
+ ensureAutomationSessionKey: () => x,
11
+ isAutomationSessionActive: () => C,
12
+ removeAutomationSessionKey: () => S
13
+ }), _ = () => `Could not connect the managed publishing account to authorize an automation session key on ${a()}. Reconnect and try again.`, v = () => `Could not authorize the automation session key on your publishing account on ${a()}.`, y = () => `Could not remove the automation session key from your publishing account on ${a()}.`;
14
+ async function b(e) {
15
+ let t = s();
16
+ await t.autoConnect({
17
+ client: u(),
18
+ chain: n()
19
+ });
20
+ let r = t.getAccount();
21
+ if (!r) throw new o(_(), "MODULAR_SIGNER_ACTIVATION_FAILED", e);
22
+ return r;
23
+ }
24
+ async function x(e) {
25
+ let { managedAddress: t, sessionKeyAddress: i, expiresAt: a } = e, s = await b(t), m = d({
26
+ client: u(),
27
+ chain: n(),
28
+ address: t
29
+ }), g = l(c({ expiresAt: a })), _ = !1;
30
+ try {
31
+ _ = await h({
32
+ accountContract: m,
33
+ sessionKeyAddress: i,
34
+ newPermissions: g
35
+ });
36
+ } catch (e) {
37
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
38
+ }
39
+ if (_) try {
40
+ let e = p({
41
+ contract: m,
42
+ account: s,
43
+ sessionKeyAddress: i,
44
+ permissions: g
45
+ }), t = await f({
46
+ account: s,
47
+ transaction: e
48
+ });
49
+ await r(t.transactionHash);
50
+ } catch (e) {
51
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
52
+ }
53
+ if (!await C(t, i)) throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
54
+ }
55
+ async function S(e) {
56
+ let { managedAddress: t, sessionKeyAddress: i } = e, a = await b(t), s = d({
57
+ client: u(),
58
+ chain: n(),
59
+ address: t
60
+ });
61
+ try {
62
+ let e = m({
63
+ contract: s,
64
+ account: a,
65
+ sessionKeyAddress: i
66
+ }), t = await f({
67
+ account: a,
68
+ transaction: e
69
+ });
70
+ await r(t.transactionHash);
71
+ } catch (e) {
72
+ throw new o(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
73
+ }
74
+ }
75
+ async function C(e, n) {
76
+ try {
77
+ return await i(e) ? await t(e, n) : !1;
78
+ } catch (t) {
79
+ throw new o(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", e, t);
80
+ }
81
+ }
82
+ //#endregion
83
+ export { S as i, g as n, C as r, x as t };
84
+
85
+ //# sourceMappingURL=ensureAutomationSessionKey-D8Gki6U6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureAutomationSessionKey-D8Gki6U6.js","names":[],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n const active = await isAutomationSessionActive(managedAddress, sessionKeyAddress)\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;IAkBM,UACJ,8FAA8F,EAAoB,EAAE,6BAChH,UACJ,gFAAgF,EAAoB,EAAE,IAClG,UACJ,+EAA+E,EAAoB,EAAE;AAEvG,eAAe,EAAoC,GAAwB;CACzE,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,EAAgB,GAChB,oCACA,CACF;CAEF,OAAO;AACT;AAMA,eAAsB,EAA2B,GAK/B;CAChB,IAAM,EAAE,mBAAgB,sBAAmB,iBAAc,GACnD,IAAiB,MAAM,EAAoC,CAAc,GAEzE,IAAkB,EAAY;EAClC,QAAQ,EAAU;EAClB,OAAO,EAAwB;EAC/B,SAAS;CACX,CAAC,GACK,IAAc,EAClB,EAAqC,EAAE,aAAU,CAAC,CACpD,GAEI,IAAe;CACnB,IAAI;EACF,IAAe,MAAM,EAAuB;GAC1C;GACA;GACA,gBAAgB;EAClB,CAAC;CACH,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;CAEA,IAA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