@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.
- package/CHANGELOG.md +8 -0
- package/README.md +64 -24
- package/dist/chainConfig-3sSqEVQh.js +1433 -0
- package/dist/chainConfig-3sSqEVQh.js.map +1 -0
- package/dist/chainConfig-3wlYarAG.js +1433 -0
- package/dist/chainConfig-3wlYarAG.js.map +1 -0
- package/dist/chainConfig-BRcsMopd.js +1442 -0
- package/dist/chainConfig-BRcsMopd.js.map +1 -0
- package/dist/chainConfig-BYm5OXpk.js +1433 -0
- package/dist/chainConfig-BYm5OXpk.js.map +1 -0
- package/dist/chainConfig-CA1Hrrjg.js +1387 -0
- package/dist/chainConfig-CA1Hrrjg.js.map +1 -0
- package/dist/chainConfig-CYy0XJ0M.js +1283 -0
- package/dist/chainConfig-CYy0XJ0M.js.map +1 -0
- package/dist/chainConfig-CfVGYAsY.js +1311 -0
- package/dist/chainConfig-CfVGYAsY.js.map +1 -0
- package/dist/chainConfig-DDA4YmAB.js +1424 -0
- package/dist/chainConfig-DDA4YmAB.js.map +1 -0
- package/dist/config-CPBd5C_b.js +1201 -0
- package/dist/config-CPBd5C_b.js.map +1 -0
- package/dist/config-DkIapO94.js +955 -0
- package/dist/config-DkIapO94.js.map +1 -0
- package/dist/config-EQZZNH9H.js +955 -0
- package/dist/config-EQZZNH9H.js.map +1 -0
- package/dist/config.d.ts +85 -13
- package/dist/config.d.ts.map +1 -1
- package/dist/ensureAutomationSessionKey-BMHLKfjj.js +85 -0
- package/dist/ensureAutomationSessionKey-BMHLKfjj.js.map +1 -0
- package/dist/ensureAutomationSessionKey-BZ9_3FMW.js +86 -0
- package/dist/ensureAutomationSessionKey-BZ9_3FMW.js.map +1 -0
- package/dist/ensureAutomationSessionKey-Bw74ZSGI.js +85 -0
- package/dist/ensureAutomationSessionKey-Bw74ZSGI.js.map +1 -0
- package/dist/ensureAutomationSessionKey-C8D7BFjU.js +85 -0
- package/dist/ensureAutomationSessionKey-C8D7BFjU.js.map +1 -0
- package/dist/ensureAutomationSessionKey-CClLVX2w.js +85 -0
- package/dist/ensureAutomationSessionKey-CClLVX2w.js.map +1 -0
- package/dist/ensureAutomationSessionKey-CNNN1jBQ.js +85 -0
- package/dist/ensureAutomationSessionKey-CNNN1jBQ.js.map +1 -0
- package/dist/ensureAutomationSessionKey-CeUbjcCl.js +85 -0
- package/dist/ensureAutomationSessionKey-CeUbjcCl.js.map +1 -0
- package/dist/ensureAutomationSessionKey-D8Gki6U6.js +85 -0
- package/dist/ensureAutomationSessionKey-D8Gki6U6.js.map +1 -0
- package/dist/ensureAutomationSessionKey-DEH7nwUc.js +86 -0
- package/dist/ensureAutomationSessionKey-DEH7nwUc.js.map +1 -0
- package/dist/ensureAutomationSessionKey-Dhvbii2M.js +86 -0
- package/dist/ensureAutomationSessionKey-Dhvbii2M.js.map +1 -0
- package/dist/ensureAutomationSessionKey-Dyfk8qVp.js +85 -0
- package/dist/ensureAutomationSessionKey-Dyfk8qVp.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-5HJDqJJM.js +24 -0
- package/dist/ensureModularPublishBootstrap-5HJDqJJM.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-BW8jKN_A.js +24 -0
- package/dist/ensureModularPublishBootstrap-BW8jKN_A.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-BhYNmLzT.js +24 -0
- package/dist/ensureModularPublishBootstrap-BhYNmLzT.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js +24 -0
- package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-Btih5xbB.js +129 -0
- package/dist/ensureModularPublishBootstrap-Btih5xbB.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-CI4U08Gc.js +129 -0
- package/dist/ensureModularPublishBootstrap-CI4U08Gc.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-CcU-hXll.js +128 -0
- package/dist/ensureModularPublishBootstrap-CcU-hXll.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-CdrykHAi.js +24 -0
- package/dist/ensureModularPublishBootstrap-CdrykHAi.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-DGBKVGg5.js +24 -0
- package/dist/ensureModularPublishBootstrap-DGBKVGg5.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-DaREOqSc.js +129 -0
- package/dist/ensureModularPublishBootstrap-DaREOqSc.js.map +1 -0
- package/dist/ensureModularPublishBootstrap-DxIG-LUP.js +24 -0
- package/dist/ensureModularPublishBootstrap-DxIG-LUP.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-BSYzckyS.js +49 -0
- package/dist/ensureSmartWalletThenPublish-BSYzckyS.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js +49 -0
- package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js +48 -0
- package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-Bm58tc-b.js +48 -0
- package/dist/ensureSmartWalletThenPublish-Bm58tc-b.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-CE7acryB.js +49 -0
- package/dist/ensureSmartWalletThenPublish-CE7acryB.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-D5GSZRyZ.js +48 -0
- package/dist/ensureSmartWalletThenPublish-D5GSZRyZ.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-DAomriGc.js +48 -0
- package/dist/ensureSmartWalletThenPublish-DAomriGc.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js +48 -0
- package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js +48 -0
- package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js +48 -0
- package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js.map +1 -0
- package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js +48 -0
- package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js.map +1 -0
- package/dist/errors-Du3LNbJN.js.map +1 -1
- package/dist/errors.d.ts +2 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/helpers/abi/executor.d.ts +125 -0
- package/dist/helpers/abi/executor.d.ts.map +1 -1
- package/dist/helpers/abi/factory.d.ts +1 -1
- package/dist/helpers/abi/factory.d.ts.map +1 -1
- package/dist/helpers/abi/publisher.d.ts +18 -74
- package/dist/helpers/abi/publisher.d.ts.map +1 -1
- package/dist/helpers/abi/seedErrors.d.ts +141 -0
- package/dist/helpers/abi/seedErrors.d.ts.map +1 -0
- package/dist/helpers/abi/seedExecutorRouter.d.ts +60 -0
- package/dist/helpers/abi/seedExecutorRouter.d.ts.map +1 -0
- package/dist/helpers/adapters/permissionlessTxSender.d.ts +26 -0
- package/dist/helpers/adapters/permissionlessTxSender.d.ts.map +1 -1
- package/dist/helpers/adapters/thirdwebAccount.d.ts +10 -2
- package/dist/helpers/adapters/thirdwebAccount.d.ts.map +1 -1
- package/dist/helpers/approvedTargetsForAutomationPublish.d.ts +1 -1
- package/dist/helpers/blockchain.d.ts +4 -0
- package/dist/helpers/blockchain.d.ts.map +1 -1
- package/dist/helpers/chainClient.d.ts.map +1 -1
- package/dist/helpers/chainConfig.d.ts +2 -0
- package/dist/helpers/chainConfig.d.ts.map +1 -1
- package/dist/helpers/constants.d.ts +14 -3
- package/dist/helpers/constants.d.ts.map +1 -1
- package/dist/helpers/contracts/index.d.ts +27 -14
- package/dist/helpers/contracts/index.d.ts.map +1 -1
- package/dist/helpers/defaultApprovedTargetsForModularPublish.d.ts +12 -2
- package/dist/helpers/defaultApprovedTargetsForModularPublish.d.ts.map +1 -1
- package/dist/helpers/describeRevert.d.ts +33 -0
- package/dist/helpers/describeRevert.d.ts.map +1 -0
- package/dist/helpers/easDirect.d.ts +3 -8
- package/dist/helpers/easDirect.d.ts.map +1 -1
- package/dist/helpers/enrollPublishAutomation.d.ts +6 -2
- package/dist/helpers/enrollPublishAutomation.d.ts.map +1 -1
- package/dist/helpers/ensureAutomationSessionKey.d.ts.map +1 -1
- package/dist/helpers/ensureEip7702ModularAccountReady.d.ts +1 -1
- package/dist/helpers/ensureEip7702ModularAccountReady.d.ts.map +1 -1
- package/dist/helpers/ensureExecutorModule.d.ts +6 -3
- package/dist/helpers/ensureExecutorModule.d.ts.map +1 -1
- package/dist/helpers/ensureManagedAccountEasConfigured.d.ts +8 -3
- package/dist/helpers/ensureManagedAccountEasConfigured.d.ts.map +1 -1
- package/dist/helpers/ensureManagedAccountReady.d.ts.map +1 -1
- package/dist/helpers/ensureManagedSignerSessionKey.d.ts +5 -0
- package/dist/helpers/ensureManagedSignerSessionKey.d.ts.map +1 -1
- package/dist/helpers/ensureModularPublishBootstrap.d.ts +6 -2
- package/dist/helpers/ensureModularPublishBootstrap.d.ts.map +1 -1
- package/dist/helpers/ensureSmartWalletThenPublish.d.ts.map +1 -1
- package/dist/helpers/executorModuleReadiness.d.ts +28 -0
- package/dist/helpers/executorModuleReadiness.d.ts.map +1 -0
- package/dist/helpers/managedAccountAdmin.d.ts +12 -0
- package/dist/helpers/managedAccountAdmin.d.ts.map +1 -0
- package/dist/helpers/publishThirdwebClient.d.ts +10 -0
- package/dist/helpers/publishThirdwebClient.d.ts.map +1 -0
- package/dist/helpers/retryNonceTooLow.d.ts +12 -0
- package/dist/helpers/retryNonceTooLow.d.ts.map +1 -0
- package/dist/helpers/seedSigner.d.ts.map +1 -1
- package/dist/helpers/seedTwin.d.ts +47 -0
- package/dist/helpers/seedTwin.d.ts.map +1 -0
- package/dist/helpers/thirdweb.d.ts +21 -6
- package/dist/helpers/thirdweb.d.ts.map +1 -1
- package/dist/helpers/thirdwebChain.d.ts +21 -0
- package/dist/helpers/thirdwebChain.d.ts.map +1 -0
- package/dist/helpers/verifyPublishChain.d.ts +21 -0
- package/dist/helpers/verifyPublishChain.d.ts.map +1 -0
- package/dist/hooks/useItemPublishStatus.d.ts +2 -0
- package/dist/hooks/useItemPublishStatus.d.ts.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +463 -408
- package/dist/index.js.map +1 -1
- package/dist/managedAccountAdmin-B64V1rlU.js +29 -0
- package/dist/managedAccountAdmin-B64V1rlU.js.map +1 -0
- package/dist/managedAccountAdmin-BVLGWpEb.js +29 -0
- package/dist/managedAccountAdmin-BVLGWpEb.js.map +1 -0
- package/dist/managedAccountAdmin-Bje6X8Ds.js +29 -0
- package/dist/managedAccountAdmin-Bje6X8Ds.js.map +1 -0
- package/dist/managedAccountAdmin-C84-IlQ9.js +29 -0
- package/dist/managedAccountAdmin-C84-IlQ9.js.map +1 -0
- package/dist/managedAccountAdmin-DJMw6UH6.js +29 -0
- package/dist/managedAccountAdmin-DJMw6UH6.js.map +1 -0
- package/dist/managedAccountAdmin-DhCRBoPX.js +29 -0
- package/dist/managedAccountAdmin-DhCRBoPX.js.map +1 -0
- package/dist/managedAccountAdmin-NXD66lP5.js +29 -0
- package/dist/managedAccountAdmin-NXD66lP5.js.map +1 -0
- package/dist/publishAuthorization-B0G1em4a.js +3695 -0
- package/dist/publishAuthorization-B0G1em4a.js.map +1 -0
- package/dist/publishAuthorization-B1BVVfp0.js +3604 -0
- package/dist/publishAuthorization-B1BVVfp0.js.map +1 -0
- package/dist/publishAuthorization-BEqRnP2h.js +3925 -0
- package/dist/publishAuthorization-BEqRnP2h.js.map +1 -0
- package/dist/publishAuthorization-Bltn3y_K.js +3599 -0
- package/dist/publishAuthorization-Bltn3y_K.js.map +1 -0
- package/dist/publishAuthorization-By2Tt9kW.js +3912 -0
- package/dist/publishAuthorization-By2Tt9kW.js.map +1 -0
- package/dist/publishAuthorization-CxBkijU6.js +3925 -0
- package/dist/publishAuthorization-CxBkijU6.js.map +1 -0
- package/dist/publishAuthorization-CxWY7lAQ.js +3706 -0
- package/dist/publishAuthorization-CxWY7lAQ.js.map +1 -0
- package/dist/publishAuthorization-DEriY_jm.js +3687 -0
- package/dist/publishAuthorization-DEriY_jm.js.map +1 -0
- package/dist/publishAuthorization-DfAQs1sN.js +3707 -0
- package/dist/publishAuthorization-DfAQs1sN.js.map +1 -0
- package/dist/publishAuthorization-DjVrnMC0.js +3925 -0
- package/dist/publishAuthorization-DjVrnMC0.js.map +1 -0
- package/dist/publishAuthorization-DqhhCAhd.js +3652 -0
- package/dist/publishAuthorization-DqhhCAhd.js.map +1 -0
- package/dist/publishThirdwebClient-BdgkcqM7.js +18 -0
- package/dist/publishThirdwebClient-BdgkcqM7.js.map +1 -0
- package/dist/publishThirdwebClient-BkmDN480.js +18 -0
- package/dist/publishThirdwebClient-BkmDN480.js.map +1 -0
- package/dist/publishThirdwebClient-BnDhP3N-.js +18 -0
- package/dist/publishThirdwebClient-BnDhP3N-.js.map +1 -0
- package/dist/publishThirdwebClient-CBD9sKJR.js +18 -0
- package/dist/publishThirdwebClient-CBD9sKJR.js.map +1 -0
- package/dist/publishThirdwebClient-CQ29pzG2.js +18 -0
- package/dist/publishThirdwebClient-CQ29pzG2.js.map +1 -0
- package/dist/publishThirdwebClient-CZIVmr9Z.js +18 -0
- package/dist/publishThirdwebClient-CZIVmr9Z.js.map +1 -0
- package/dist/publishThirdwebClient-Ce7iBIsj.js +18 -0
- package/dist/publishThirdwebClient-Ce7iBIsj.js.map +1 -0
- package/dist/publishThirdwebClient-DroRrOFQ.js +18 -0
- package/dist/publishThirdwebClient-DroRrOFQ.js.map +1 -0
- package/dist/publishThirdwebClient-DzXFjQ7L.js +18 -0
- package/dist/publishThirdwebClient-DzXFjQ7L.js.map +1 -0
- package/dist/publishThirdwebClient-Dzb2vcEs.js +18 -0
- package/dist/publishThirdwebClient-Dzb2vcEs.js.map +1 -0
- package/dist/publishThirdwebClient-i8P7fivi.js +18 -0
- package/dist/publishThirdwebClient-i8P7fivi.js.map +1 -0
- package/dist/react/ConnectButton.d.ts.map +1 -1
- package/dist/resolveRevokeAccount-B5iXpuRT.js +38 -0
- package/dist/resolveRevokeAccount-B5iXpuRT.js.map +1 -0
- package/dist/resolveRevokeAccount-B7ImSb4Y.js +38 -0
- package/dist/resolveRevokeAccount-B7ImSb4Y.js.map +1 -0
- package/dist/resolveRevokeAccount-BM1j2l5Q.js +38 -0
- package/dist/resolveRevokeAccount-BM1j2l5Q.js.map +1 -0
- package/dist/resolveRevokeAccount-BtVG0xxc.js +38 -0
- package/dist/resolveRevokeAccount-BtVG0xxc.js.map +1 -0
- package/dist/resolveRevokeAccount-CJZZdBcQ.js +39 -0
- package/dist/resolveRevokeAccount-CJZZdBcQ.js.map +1 -0
- package/dist/resolveRevokeAccount-CaIMuCee.js +39 -0
- package/dist/resolveRevokeAccount-CaIMuCee.js.map +1 -0
- package/dist/resolveRevokeAccount-Cg4TQgnd.js +38 -0
- package/dist/resolveRevokeAccount-Cg4TQgnd.js.map +1 -0
- package/dist/resolveRevokeAccount-DHnxtEIj.js +39 -0
- package/dist/resolveRevokeAccount-DHnxtEIj.js.map +1 -0
- package/dist/resolveRevokeAccount-DJKfLlyK.js +38 -0
- package/dist/resolveRevokeAccount-DJKfLlyK.js.map +1 -0
- package/dist/resolveRevokeAccount-S-2WXkNh.js +38 -0
- package/dist/resolveRevokeAccount-S-2WXkNh.js.map +1 -0
- package/dist/resolveRevokeAccount-mzR11KJ4.js +38 -0
- package/dist/resolveRevokeAccount-mzR11KJ4.js.map +1 -0
- package/dist/services/publish/actors/checking.d.ts.map +1 -1
- package/dist/services/publish/actors/createAttestations.d.ts.map +1 -1
- package/dist/services/publish/helpers/ensureEasSchemas.d.ts +12 -1
- package/dist/services/publish/helpers/ensureEasSchemas.d.ts.map +1 -1
- package/dist/services/publish/helpers/getPublishUploadData.d.ts.map +1 -1
- package/dist/services/publishManager/actions/createPublish.d.ts.map +1 -1
- package/dist/services/publishManager/actions/drainPendingCreates.d.ts +3 -0
- package/dist/services/publishManager/actions/drainPendingCreates.d.ts.map +1 -0
- package/dist/services/publishManager/actions/publishDone.d.ts.map +1 -1
- package/dist/services/publishManager/actions/queueCreatePublish.d.ts +2 -0
- package/dist/services/publishManager/actions/queueCreatePublish.d.ts.map +1 -0
- package/dist/services/publishManager/actors/restoreFromDb.d.ts.map +1 -1
- package/dist/services/publishManager/actors/savePublish.d.ts +11 -0
- package/dist/services/publishManager/actors/savePublish.d.ts.map +1 -1
- package/dist/services/publishManager/createPublishResult.d.ts +6 -0
- package/dist/services/publishManager/createPublishResult.d.ts.map +1 -0
- package/dist/services/publishManager/index.d.ts +61 -1
- package/dist/services/publishManager/index.d.ts.map +1 -1
- package/dist/services/revoke/revokeAttestations.d.ts +3 -2
- package/dist/services/revoke/revokeAttestations.d.ts.map +1 -1
- package/dist/thirdweb.d.ts +1 -0
- package/dist/thirdweb.d.ts.map +1 -1
- package/dist/thirdweb.js +204 -128
- package/dist/thirdweb.js.map +1 -1
- package/dist/worker-2dUZSapK.js +69 -0
- package/dist/worker-2dUZSapK.js.map +1 -0
- package/dist/worker-B8gN5WTx.js +69 -0
- package/dist/worker-B8gN5WTx.js.map +1 -0
- package/dist/worker-BgErCNTb.js +69 -0
- package/dist/worker-BgErCNTb.js.map +1 -0
- package/dist/worker-C07rPV2G.js +69 -0
- package/dist/worker-C07rPV2G.js.map +1 -0
- package/dist/worker-C9Za_dlQ.js +69 -0
- package/dist/worker-C9Za_dlQ.js.map +1 -0
- package/dist/worker-CEgulQnm.js +69 -0
- package/dist/worker-CEgulQnm.js.map +1 -0
- package/dist/worker-C_TL94He.js +69 -0
- package/dist/worker-C_TL94He.js.map +1 -0
- package/dist/worker-CbtzcKG6.js +69 -0
- package/dist/worker-CbtzcKG6.js.map +1 -0
- package/dist/worker-DHUm-TeQ.js +69 -0
- package/dist/worker-DHUm-TeQ.js.map +1 -0
- package/dist/worker-DypHzXgH.js +69 -0
- package/dist/worker-DypHzXgH.js.map +1 -0
- package/dist/worker-ZL4Wg19t.js +69 -0
- package/dist/worker-ZL4Wg19t.js.map +1 -0
- package/package.json +6 -6
package/dist/thirdweb.js
CHANGED
|
@@ -1,163 +1,164 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { A as
|
|
4
|
-
import { t as I } from "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
1
|
+
import { A as e, O as t, Q as n, _ as r, a as i, at as a, h as o, m as s, o as c, ot as l, p as u, s as d, st as f, t as p } from "./chainConfig-CYy0XJ0M.js";
|
|
2
|
+
import { n as m, r as h } from "./errors-Du3LNbJN.js";
|
|
3
|
+
import { $ as ee, A as g, B as _, C as v, D as y, E as b, F as x, H as te, I as S, L as C, M as w, N as T, O as E, P as ne, R as re, S as ie, T as ae, U as oe, W as se, a as ce, d as le, et as D, f as ue, h as O, j as de, k as fe, l as pe, m as k, p as A, u as j, w as M, x as N, y as P, z as F } from "./publishAuthorization-DjVrnMC0.js";
|
|
4
|
+
import { t as I } from "./publishThirdwebClient-Ce7iBIsj.js";
|
|
5
|
+
import { t as L } from "./ensureSmartWalletThenPublish-Dta2AOyJ.js";
|
|
6
|
+
import { t as R } from "./ensureModularPublishBootstrap-BhYNmLzT.js";
|
|
7
|
+
import { i as z, r as B, t as V } from "./ensureAutomationSessionKey-CeUbjcCl.js";
|
|
8
|
+
import { client as H } from "@seedprotocol/sdk";
|
|
9
|
+
import { deploySmartAccount as me, getContract as U, sendTransaction as he } from "thirdweb";
|
|
10
|
+
import { assessPublishAuthorization as ge, decodePublishAuthorizationData as _e, getPublishAuthorizationFromEas as ve } from "@seedprotocol/eas";
|
|
11
|
+
import { useCallback as ye, useEffect as W, useRef as G } from "react";
|
|
12
|
+
import { jsx as K } from "react/jsx-runtime";
|
|
13
|
+
import { SeedProvider as be } from "@seedprotocol/react";
|
|
14
|
+
import { ConnectButton as xe, ThirdwebProvider as Se, darkTheme as Ce, useActiveAccount as we, useActiveWallet as Te, useActiveWalletConnectionStatus as Ee, useIsAutoConnecting as De } from "thirdweb/react";
|
|
15
|
+
import { addSessionKey as Oe, shouldUpdateSessionKey as ke } from "thirdweb/extensions/erc4337";
|
|
16
16
|
//#region src/react/ConnectButton.tsx
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
console.warn("[ConnectButton] Wallet setup / module install skipped:", e),
|
|
17
|
+
var q = "seedProtocol:publish:userChoseWalletDisconnect";
|
|
18
|
+
function Ae(e) {
|
|
19
|
+
console.warn("[ConnectButton] Wallet setup / module install skipped:", e), c().onWalletSetupWarning?.(e);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
-
|
|
21
|
+
function je() {
|
|
22
|
+
return H.isInitialized() ? Promise.resolve() : new Promise((e) => {
|
|
23
|
+
H.onReady(() => e());
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
async function
|
|
26
|
+
async function Me(e, t, n) {
|
|
27
27
|
if (n.modularAccountModuleContract) {
|
|
28
28
|
if (n.useModularExecutor) {
|
|
29
29
|
if (!t) return;
|
|
30
30
|
try {
|
|
31
|
-
|
|
32
|
-
let e =
|
|
31
|
+
_();
|
|
32
|
+
let e = w();
|
|
33
33
|
await e.autoConnect({
|
|
34
|
-
client:
|
|
35
|
-
chain:
|
|
34
|
+
client: I(),
|
|
35
|
+
chain: r(n)
|
|
36
36
|
});
|
|
37
|
-
let
|
|
38
|
-
if (!
|
|
39
|
-
await
|
|
37
|
+
let i = e.getAccount();
|
|
38
|
+
if (!i) return;
|
|
39
|
+
await M(t, i, n);
|
|
40
40
|
} catch {}
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
try {
|
|
44
|
-
await
|
|
44
|
+
await M(e.address, e, n);
|
|
45
45
|
} catch (e) {
|
|
46
|
-
|
|
46
|
+
Ae(e);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
var
|
|
51
|
-
let
|
|
52
|
-
|
|
50
|
+
var Ne = () => {
|
|
51
|
+
let n = D(), i = r(n), a = Te(), s = we(), c = Ee(), l = De(), u = G(null), d = G(!1), f = G(!1);
|
|
52
|
+
W(() => {
|
|
53
53
|
if (typeof window > "u") return;
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
let
|
|
54
|
+
let e = d.current;
|
|
55
|
+
d.current = l;
|
|
56
|
+
let t;
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
t = performance.getEntriesByType("navigation")[0]?.type;
|
|
59
59
|
} catch {
|
|
60
|
-
|
|
60
|
+
t = void 0;
|
|
61
61
|
}
|
|
62
|
-
if (
|
|
62
|
+
if (t !== "reload") return;
|
|
63
63
|
let r = !1;
|
|
64
64
|
try {
|
|
65
|
-
r = sessionStorage.getItem(
|
|
65
|
+
r = sessionStorage.getItem(q) === "1";
|
|
66
66
|
} catch {
|
|
67
67
|
r = !1;
|
|
68
68
|
}
|
|
69
|
-
r ||
|
|
70
|
-
client:
|
|
71
|
-
chain:
|
|
69
|
+
r || e && !l && c === "disconnected" && (f.current || (f.current = !0, (n.useModularExecutor ? T() : w()).autoConnect({
|
|
70
|
+
client: I(),
|
|
71
|
+
chain: i
|
|
72
72
|
}).catch(() => {})));
|
|
73
73
|
}, [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
c,
|
|
75
|
+
l,
|
|
76
|
+
n.useModularExecutor,
|
|
77
|
+
i
|
|
77
78
|
]);
|
|
78
|
-
let
|
|
79
|
-
let r =
|
|
79
|
+
let p = ye(async (t) => {
|
|
80
|
+
let r = t.getAccount();
|
|
80
81
|
if (!r) return;
|
|
81
|
-
await
|
|
82
|
-
let
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
let e =
|
|
82
|
+
await je(), O.stopAll();
|
|
83
|
+
let a = /* @__PURE__ */ new Set([r.address.toLowerCase()]), s;
|
|
84
|
+
if (n.useModularExecutor) {
|
|
85
|
+
_();
|
|
86
|
+
let e = t.getAdminAccount?.()?.address ?? r.address, n = async () => {
|
|
86
87
|
try {
|
|
87
|
-
return await
|
|
88
|
+
return await g(i);
|
|
88
89
|
} catch {
|
|
89
90
|
try {
|
|
90
|
-
return await
|
|
91
|
+
return await x(e);
|
|
91
92
|
} catch {
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
|
-
|
|
97
|
+
s = await n(), s ||= (await new Promise((e) => queueMicrotask(() => e())), await n()), s && a.add(s.toLowerCase());
|
|
97
98
|
}
|
|
98
|
-
let
|
|
99
|
-
if (
|
|
100
|
-
|
|
99
|
+
let c = [...a].sort().join(",");
|
|
100
|
+
if (u.current !== c) {
|
|
101
|
+
u.current = c;
|
|
101
102
|
try {
|
|
102
|
-
let
|
|
103
|
-
await
|
|
104
|
-
...
|
|
105
|
-
ownedAddresses: [...
|
|
106
|
-
publisherAddress:
|
|
103
|
+
let t = o(r);
|
|
104
|
+
await e({
|
|
105
|
+
...t,
|
|
106
|
+
ownedAddresses: [...a],
|
|
107
|
+
publisherAddress: s ?? r.address
|
|
107
108
|
});
|
|
108
109
|
} catch (e) {
|
|
109
|
-
throw
|
|
110
|
+
throw u.current = null, console.warn("[ConnectButton] Failed to set seed client addresses:", e), e;
|
|
110
111
|
}
|
|
111
|
-
await
|
|
112
|
+
await Me(r, s, n);
|
|
112
113
|
}
|
|
113
|
-
}, [
|
|
114
|
-
return
|
|
115
|
-
if (
|
|
116
|
-
if (
|
|
117
|
-
|
|
114
|
+
}, [n]);
|
|
115
|
+
return W(() => {
|
|
116
|
+
if (l) return;
|
|
117
|
+
if (c !== "connected") {
|
|
118
|
+
u.current = null;
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
|
-
if (!
|
|
121
|
+
if (!a) return;
|
|
121
122
|
let e = !1;
|
|
122
123
|
return (async () => {
|
|
123
124
|
try {
|
|
124
125
|
if (e) return;
|
|
125
|
-
await
|
|
126
|
+
await p(a);
|
|
126
127
|
} catch {}
|
|
127
128
|
})(), () => {
|
|
128
129
|
e = !0;
|
|
129
130
|
};
|
|
130
131
|
}, [
|
|
131
|
-
n,
|
|
132
|
-
r?.address,
|
|
133
|
-
i,
|
|
134
132
|
a,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
s?.address,
|
|
134
|
+
c,
|
|
135
|
+
l,
|
|
136
|
+
p
|
|
137
|
+
]), /* @__PURE__ */ K(xe, {
|
|
138
|
+
client: I(),
|
|
139
|
+
wallets: S(n),
|
|
139
140
|
autoConnect: !0,
|
|
140
|
-
chain:
|
|
141
|
-
chains: [
|
|
141
|
+
chain: i,
|
|
142
|
+
chains: [i],
|
|
142
143
|
onConnect: async (e, t) => {
|
|
143
144
|
let n = e.getAccount();
|
|
144
145
|
if (n) {
|
|
145
146
|
try {
|
|
146
|
-
sessionStorage.removeItem(
|
|
147
|
+
sessionStorage.removeItem(q);
|
|
147
148
|
} catch {}
|
|
148
149
|
console.log("[ConnectButton] Connected", n.address);
|
|
149
150
|
try {
|
|
150
|
-
await
|
|
151
|
+
await p(e);
|
|
151
152
|
} catch {}
|
|
152
153
|
}
|
|
153
154
|
},
|
|
154
155
|
onDisconnect: () => {
|
|
155
156
|
try {
|
|
156
|
-
sessionStorage.setItem(
|
|
157
|
+
sessionStorage.setItem(q, "1");
|
|
157
158
|
} catch {}
|
|
158
|
-
|
|
159
|
+
t(), O.stopAll();
|
|
159
160
|
},
|
|
160
|
-
theme:
|
|
161
|
+
theme: Ce({ colors: {
|
|
161
162
|
primaryButtonBg: "#1D2939",
|
|
162
163
|
primaryButtonText: "#FFFFFF",
|
|
163
164
|
secondaryButtonHoverBg: "#1D2939",
|
|
@@ -166,54 +167,129 @@ var Ce = () => {
|
|
|
166
167
|
borderColor: "#344054"
|
|
167
168
|
} })
|
|
168
169
|
});
|
|
169
|
-
},
|
|
170
|
-
t &&
|
|
171
|
-
}, [t]), /* @__PURE__ */
|
|
172
|
-
value: t ??
|
|
173
|
-
children: /* @__PURE__ */
|
|
174
|
-
queryClient:
|
|
175
|
-
queryClientRef:
|
|
170
|
+
}, Pe = ({ children: e, config: t, queryClient: n, queryClientRef: r }) => (W(() => {
|
|
171
|
+
t && d(t);
|
|
172
|
+
}, [t]), /* @__PURE__ */ K(ee.Provider, {
|
|
173
|
+
value: t ?? i(),
|
|
174
|
+
children: /* @__PURE__ */ K(Se, { children: /* @__PURE__ */ K(be, {
|
|
175
|
+
queryClient: n,
|
|
176
|
+
queryClientRef: r,
|
|
176
177
|
children: e
|
|
177
178
|
}) })
|
|
178
|
-
}));
|
|
179
|
+
})), Fe = "Modular (EIP-7702) wallet is not connected. Sign in with the same method and try again.", Ie = () => `Your modular account is not upgraded to an EIP-7702 smart account on ${p()} yet. Enable autoDeployEip7702ModularAccount in publish config or complete wallet setup, then retry.`, Le = () => `Automatic EIP-7702 smart account setup failed on ${p()}. Retry or reconnect your wallet.`, Re = "EIP-7702 upgrade was sent but on-chain bytecode was not detected yet. Wait a moment and retry.", J = 5;
|
|
180
|
+
async function Y() {
|
|
181
|
+
let { autoDeployEip7702ModularAccount: e } = c(), t = T();
|
|
182
|
+
await t.autoConnect({
|
|
183
|
+
client: I(),
|
|
184
|
+
chain: r()
|
|
185
|
+
});
|
|
186
|
+
let n = t.getAccount();
|
|
187
|
+
if (!n) throw new m(Fe, "EIP7702_MODULAR_ACCOUNT_UNAVAILABLE");
|
|
188
|
+
let i = I(), o = U({
|
|
189
|
+
client: i,
|
|
190
|
+
chain: r(),
|
|
191
|
+
address: n.address
|
|
192
|
+
});
|
|
193
|
+
if (!await a(n.address)) {
|
|
194
|
+
if (!e) throw new m(Ie(), "EIP7702_MODULAR_NOT_UPGRADED", n.address);
|
|
195
|
+
try {
|
|
196
|
+
await me({
|
|
197
|
+
smartAccount: n,
|
|
198
|
+
chain: r(),
|
|
199
|
+
client: i,
|
|
200
|
+
accountContract: o
|
|
201
|
+
});
|
|
202
|
+
} catch (e) {
|
|
203
|
+
if (await l(n.address, J)) return;
|
|
204
|
+
throw new m(Le(), "EIP7702_MODULAR_DEPLOY_FAILED", n.address, e);
|
|
205
|
+
}
|
|
206
|
+
if (!await l(n.address, J)) throw new m(Re, "EIP7702_MODULAR_NOT_CONFIRMED", n.address);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/helpers/defaultApprovedTargetsForModularPublish.ts
|
|
211
|
+
function X(e) {
|
|
212
|
+
return k();
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/helpers/ensureManagedSignerSessionKey.ts
|
|
216
|
+
var ze = () => `Could not connect the managed publishing account to authorize the modular signer on ${p()}. Reconnect and try again.`, Z = () => `Could not authorize the modular wallet as a session signer on your publishing account on ${p()}.`;
|
|
217
|
+
async function Be(e) {
|
|
218
|
+
let { managedAddress: t, signerAddress: i } = e, a = w();
|
|
219
|
+
await a.autoConnect({
|
|
220
|
+
client: I(),
|
|
221
|
+
chain: r()
|
|
222
|
+
});
|
|
223
|
+
let o = a.getAccount();
|
|
224
|
+
if (!o) throw new h(ze(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
|
|
225
|
+
let s = U({
|
|
226
|
+
client: I(),
|
|
227
|
+
chain: r(),
|
|
228
|
+
address: t
|
|
229
|
+
}), c = {
|
|
230
|
+
approvedTargets: X(t),
|
|
231
|
+
nativeTokenLimitPerTransaction: 0
|
|
232
|
+
}, l = !1;
|
|
233
|
+
try {
|
|
234
|
+
l = await ke({
|
|
235
|
+
accountContract: s,
|
|
236
|
+
sessionKeyAddress: i,
|
|
237
|
+
newPermissions: c
|
|
238
|
+
});
|
|
239
|
+
} catch (e) {
|
|
240
|
+
throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
|
|
241
|
+
}
|
|
242
|
+
if (l) try {
|
|
243
|
+
let e = Oe({
|
|
244
|
+
contract: s,
|
|
245
|
+
account: o,
|
|
246
|
+
sessionKeyAddress: i,
|
|
247
|
+
permissions: c
|
|
248
|
+
}), t = await he({
|
|
249
|
+
account: o,
|
|
250
|
+
transaction: e
|
|
251
|
+
});
|
|
252
|
+
await f(t.transactionHash);
|
|
253
|
+
} catch (e) {
|
|
254
|
+
throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
|
|
255
|
+
}
|
|
256
|
+
let u = !1;
|
|
257
|
+
try {
|
|
258
|
+
u = await n(t, i);
|
|
259
|
+
} catch (e) {
|
|
260
|
+
throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
|
|
261
|
+
}
|
|
262
|
+
if (!u) throw new h(Z(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
|
|
263
|
+
}
|
|
179
264
|
//#endregion
|
|
180
265
|
//#region src/helpers/enrollPublishAutomation.ts
|
|
181
266
|
async function Q(e) {
|
|
182
|
-
let t =
|
|
267
|
+
let t = w();
|
|
183
268
|
await t.autoConnect({
|
|
184
|
-
client:
|
|
185
|
-
chain:
|
|
269
|
+
client: I(),
|
|
270
|
+
chain: r()
|
|
186
271
|
});
|
|
187
272
|
let n = t.getAccount();
|
|
188
|
-
if (!n) throw new
|
|
273
|
+
if (!n) throw new h("Could not connect the managed publishing account to enroll or revoke publish automation.", "MANAGED_ACCOUNT_UNAVAILABLE", e);
|
|
189
274
|
return n;
|
|
190
275
|
}
|
|
191
276
|
async function $(e, t) {
|
|
192
277
|
return t || o(await Q(e));
|
|
193
278
|
}
|
|
194
|
-
async function
|
|
195
|
-
let t =
|
|
196
|
-
if (!
|
|
197
|
-
let
|
|
198
|
-
try {
|
|
199
|
-
await S(e, r, t);
|
|
200
|
-
} catch (t) {
|
|
201
|
-
throw t instanceof l ? t : new l("Executor module setup failed for publish automation.", "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
|
|
202
|
-
}
|
|
279
|
+
async function Ve(e) {
|
|
280
|
+
let t = c();
|
|
281
|
+
if (!t.modularAccountModuleContract?.trim()) throw Error("@seedprotocol/publish: enrollPublishAutomation requires PublishConfig.modularAccountModuleContract");
|
|
282
|
+
let n = await Q(e);
|
|
203
283
|
try {
|
|
204
|
-
|
|
205
|
-
client: f(),
|
|
206
|
-
chain: K,
|
|
207
|
-
address: e
|
|
208
|
-
}), r = await _e({ contract: t }), i = n.toLowerCase();
|
|
209
|
-
if (!r.some((e) => e.implementation?.toLowerCase() === i)) throw new l("Executor module is not installed on the ManagedAccount (ModularCore required for automation grants).", "EXECUTOR_MODULE_NOT_INSTALLED", e);
|
|
284
|
+
await M(e, n, t);
|
|
210
285
|
} catch (t) {
|
|
211
|
-
throw t instanceof
|
|
286
|
+
throw t instanceof h ? t : new h("Executor module setup failed for publish automation.", "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
|
|
212
287
|
}
|
|
288
|
+
await P(e);
|
|
213
289
|
}
|
|
214
|
-
async function
|
|
290
|
+
async function He(e) {
|
|
215
291
|
let { managedAddress: t, sessionKeyAddress: n, appAddress: r, expiresAt: i } = e;
|
|
216
|
-
await
|
|
292
|
+
await Ve(t), await V({
|
|
217
293
|
managedAddress: t,
|
|
218
294
|
sessionKeyAddress: n,
|
|
219
295
|
expiresAt: i
|
|
@@ -222,7 +298,7 @@ async function Ee(e) {
|
|
|
222
298
|
return {
|
|
223
299
|
managedAddress: t,
|
|
224
300
|
sessionKeyAddress: n,
|
|
225
|
-
authorization: await
|
|
301
|
+
authorization: await ce({
|
|
226
302
|
wallet: a,
|
|
227
303
|
identity: t,
|
|
228
304
|
sessionKey: n,
|
|
@@ -231,19 +307,19 @@ async function Ee(e) {
|
|
|
231
307
|
})
|
|
232
308
|
};
|
|
233
309
|
}
|
|
234
|
-
async function
|
|
310
|
+
async function Ue(e) {
|
|
235
311
|
let { managedAddress: t, sessionKeyAddress: n, authorizationUid: r } = e, i = await $(t, e.userWallet);
|
|
236
|
-
await
|
|
312
|
+
await z({
|
|
237
313
|
managedAddress: t,
|
|
238
314
|
sessionKeyAddress: n
|
|
239
|
-
}), await
|
|
315
|
+
}), await pe({
|
|
240
316
|
wallet: i,
|
|
241
317
|
uid: r
|
|
242
318
|
});
|
|
243
319
|
}
|
|
244
320
|
//#endregion
|
|
245
321
|
//#region src/helpers/assertStorageBoundToIdentity.ts
|
|
246
|
-
async function
|
|
322
|
+
async function We(e) {
|
|
247
323
|
let { managedAddress: t, dataItemOwner: n, atTime: r, allowActiveSessionKey: i = !0, allowSidecar: a = !0 } = e, o = [], s = n.trim().toLowerCase(), c = t.trim().toLowerCase();
|
|
248
324
|
if (!/^0x[0-9a-fA-F]{40}$/.test(s) || !/^0x[0-9a-fA-F]{40}$/.test(c)) return {
|
|
249
325
|
bound: !1,
|
|
@@ -251,7 +327,7 @@ async function Oe(e) {
|
|
|
251
327
|
warnings: ["Invalid managedAddress or dataItemOwner"]
|
|
252
328
|
};
|
|
253
329
|
if (i) try {
|
|
254
|
-
if (await
|
|
330
|
+
if (await B(t, n)) return {
|
|
255
331
|
bound: !0,
|
|
256
332
|
via: "active_session_key",
|
|
257
333
|
warnings: o
|
|
@@ -260,15 +336,15 @@ async function Oe(e) {
|
|
|
260
336
|
o.push(e instanceof Error ? e.message : "isActiveSigner check failed");
|
|
261
337
|
}
|
|
262
338
|
if (a) try {
|
|
263
|
-
let e = await
|
|
339
|
+
let e = await ve({
|
|
264
340
|
identities: [t],
|
|
265
341
|
sessionKeys: [n],
|
|
266
342
|
excludeRevoked: !0
|
|
267
343
|
}), i = r == null ? Date.now() : r * 1e3;
|
|
268
344
|
for (let t of e) try {
|
|
269
|
-
let e =
|
|
345
|
+
let e = _e(t.decodedDataJson ?? "[]");
|
|
270
346
|
if (e.identity.toLowerCase() !== c || e.sessionKey.toLowerCase() !== s) continue;
|
|
271
|
-
let n = typeof t.expirationTime == "number" ? t.expirationTime : null, r =
|
|
347
|
+
let n = typeof t.expirationTime == "number" ? t.expirationTime : null, r = ge({
|
|
272
348
|
decoded: e,
|
|
273
349
|
expirationTime: n,
|
|
274
350
|
now: i
|
|
@@ -290,6 +366,6 @@ async function Oe(e) {
|
|
|
290
366
|
};
|
|
291
367
|
}
|
|
292
368
|
//#endregion
|
|
293
|
-
export {
|
|
369
|
+
export { Ne as ConnectButton, ae as ExternalWalletsForDeploy, j as PUBLISH_AUTOMATION_SCOPES, Pe as PublishProvider, b as appMetadata, k as approvedTargetsForAutomationPublish, u as asSeedSignerFromThirdweb, s as asThirdwebPublishWallet, We as assertStorageBoundToIdentity, le as buildAutomationSessionKeyPermissions, X as defaultApprovedTargetsForModularPublish, y as deployManagedAccountViaFactory, E as deploySmartWalletContract, He as enrollPublishAutomation, V as ensureAutomationSessionKey, Y as ensureEip7702ModularAccountReady, M as ensureExecutorModuleInstalled, N as ensureManagedAccountReady, Be as ensureManagedSignerSessionKey, R as ensureModularPublishBootstrap, L as ensureSmartWalletThenPublish, o as fromThirdwebAccount, I as getClient, fe as getConnectedAccount, g as getConnectedManagedAccountAddress, de as getConnectedModularAccount, w as getManagedAccountWallet, T as getModularAccountWallet, r as getPublishThirdwebChain, ne as getSharedPublishInAppWalletStorage, x as getSmartWalletAddressForAdmin, S as getWalletsForConnectButton, ue as hashAutomationSessionKeyPermissions, B as isAutomationSessionActive, C as isSmartWalletDeployed, re as pollSmartWalletDeployed, z as removeAutomationSessionKey, F as resolveSmartWalletForPublish, Ue as revokePublishAutomation, ie as runModularExecutorPublishPrep, A as toThirdwebSessionKeyPermissions, v as tryDeployManagedAccount, te as useActiveSmartWalletContract, oe as useLocalWalletAccount, D as usePublishConfig, se as wallets };
|
|
294
370
|
|
|
295
371
|
//# sourceMappingURL=thirdweb.js.map
|
package/dist/thirdweb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdweb.js","names":[],"sources":["../src/react/ConnectButton.tsx","../src/react/PublishProvider.thirdweb.tsx","../src/helpers/enrollPublishAutomation.ts","../src/helpers/assertStorageBoundToIdentity.ts"],"sourcesContent":["import React, { FC, useCallback, useEffect, useRef } from \"react\"\nimport {\n ConnectButton as ConnectButtonThirdweb,\n darkTheme,\n useActiveAccount,\n useActiveWallet,\n useActiveWalletConnectionStatus,\n useIsAutoConnecting,\n} from \"thirdweb/react\"\nimport { client as seedClient } from \"@seedprotocol/sdk\"\nimport {\n getClient,\n getConnectedManagedAccountAddress,\n getManagedAccountWallet,\n getModularAccountWallet,\n getSmartWalletAddressForAdmin,\n getWalletsForConnectButton,\n syncPublishInAppAuthToken,\n} from \"../helpers/thirdweb\"\nimport { fromThirdwebAccount } from \"../helpers/adapters/thirdwebAccount\"\nimport { setPublishWallet, clearPublishWallet } from \"../helpers/publishWalletRegistry\"\nimport { usePublishConfig } from \"./PublishConfigContext\"\nimport { getPublishConfig } from \"../config\"\nimport { optimismSepolia } from \"thirdweb/chains\"\nimport type { Account, Wallet } from \"thirdweb/wallets\"\nimport type { PublishConfig } from \"../config\"\nimport { ensureExecutorModuleInstalled } from \"../helpers/ensureExecutorModule\"\nimport { PublishManager } from \"../services/publishManager\"\n\n/** Session flag so we do not force autoConnect after an explicit UI disconnect (survives reload). */\nconst USER_DISCONNECTED_SESSION_KEY = \"seedProtocol:publish:userChoseWalletDisconnect\"\n\nfunction reportWalletSetupWarning(err: unknown) {\n // Expected when managed-wallet autoConnect is still catching up; publish prep retries.\n console.warn(\"[ConnectButton] Wallet setup / module install skipped:\", err)\n getPublishConfig().onWalletSetupWarning?.(err)\n}\n\n/** Resolves after `ClientManager.init()` has finished; `setAddresses` requires this. */\nfunction waitUntilSeedInitialized(): Promise<void> {\n if (seedClient.isInitialized()) return Promise.resolve()\n return new Promise((resolve) => {\n seedClient.onReady(() => resolve())\n })\n}\n\n/**\n * Executor module (ModularCore) must be installed on the **ManagedAccount** (EIP-4337) contract.\n * The EIP-7702 modular wallet contract does not expose Thirdweb's installModule / Router API;\n * calling it there reverts with \"Router: function does not exist.\"\n */\nasync function ensureExecutorModulesForConnect(\n modularAccount: Account,\n managedAddress: string | undefined,\n config: PublishConfig,\n): Promise<void> {\n if (!config.modularAccountModuleContract) {\n return\n }\n\n if (config.useModularExecutor) {\n if (!managedAddress) {\n return\n }\n try {\n syncPublishInAppAuthToken()\n const mw = getManagedAccountWallet()\n await mw.autoConnect({ client: getClient(), chain: optimismSepolia })\n const ma = mw.getAccount()\n if (!ma) {\n return\n }\n await ensureExecutorModuleInstalled(managedAddress, ma, config)\n } catch {\n /* managed wallet session may lag modular connect; publish prep retries module install */\n }\n return\n }\n\n try {\n await ensureExecutorModuleInstalled(modularAccount.address, modularAccount, config)\n } catch (err) {\n reportWalletSetupWarning(err)\n }\n}\n\nconst ConnectButton: FC = () => {\n const config = usePublishConfig()\n const wallet = useActiveWallet()\n const activeAccount = useActiveAccount()\n const connectionStatus = useActiveWalletConnectionStatus()\n const isAutoConnecting = useIsAutoConnecting()\n /** Avoid duplicate setAddresses when onConnect and the reconcile effect both run. */\n const lastSyncedOwnedKey = useRef<string | null>(null)\n const prevIsAutoConnecting = useRef(false)\n const reloadAutoConnectRetried = useRef(false)\n\n /**\n * Thirdweb sometimes finishes autoConnect on full reload with `disconnected` and no wallet\n * (see debug: isAutoConnecting true→false then disconnected). One explicit in-app autoConnect\n * retry recovers without affecting users who chose Disconnect (sessionStorage gate).\n */\n useEffect(() => {\n if (typeof window === \"undefined\") return\n const prev = prevIsAutoConnecting.current\n prevIsAutoConnecting.current = isAutoConnecting\n\n let navType: string | undefined\n try {\n navType = (\n performance.getEntriesByType(\"navigation\")[0] as\n | PerformanceNavigationTiming\n | undefined\n )?.type\n } catch {\n navType = undefined\n }\n if (navType !== \"reload\") return\n\n let userChoseDisconnect = false\n try {\n userChoseDisconnect =\n sessionStorage.getItem(USER_DISCONNECTED_SESSION_KEY) === \"1\"\n } catch {\n userChoseDisconnect = false\n }\n if (userChoseDisconnect) return\n\n if (!prev || isAutoConnecting || connectionStatus !== \"disconnected\") return\n if (reloadAutoConnectRetried.current) return\n reloadAutoConnectRetried.current = true\n\n void (config.useModularExecutor ? getModularAccountWallet() : getManagedAccountWallet())\n .autoConnect({ client: getClient(), chain: optimismSepolia })\n .catch(() => {\n /* no session or iframe not ready; Connect UI can still sign in */\n })\n }, [connectionStatus, isAutoConnecting, config.useModularExecutor])\n\n const syncActiveWalletToSeed = useCallback(\n async (activeWallet: Wallet) => {\n const account = activeWallet.getAccount()\n if (!account) {\n return\n }\n await waitUntilSeedInitialized()\n PublishManager.stopAll()\n const owned = new Set<string>([account.address.toLowerCase()])\n let managedAddress: string | undefined\n if (config.useModularExecutor) {\n syncPublishInAppAuthToken()\n const adminAddress =\n activeWallet.getAdminAccount?.()?.address ?? account.address\n const tryManaged = async () => {\n try {\n return await getConnectedManagedAccountAddress(optimismSepolia)\n } catch {\n try {\n return await getSmartWalletAddressForAdmin(adminAddress)\n } catch {\n return undefined\n }\n }\n }\n managedAddress = await tryManaged()\n if (!managedAddress) {\n await new Promise<void>((r) => queueMicrotask(() => r()))\n managedAddress = await tryManaged()\n }\n if (managedAddress) {\n owned.add(managedAddress.toLowerCase())\n }\n }\n const ownedKey = [...owned].sort().join(\",\")\n if (lastSyncedOwnedKey.current === ownedKey) {\n return\n }\n lastSyncedOwnedKey.current = ownedKey\n try {\n const publishWallet = fromThirdwebAccount(account)\n await setPublishWallet({\n ...publishWallet,\n ownedAddresses: [...owned],\n publisherAddress: managedAddress ?? account.address,\n })\n } catch (err) {\n lastSyncedOwnedKey.current = null\n console.warn(\"[ConnectButton] Failed to set seed client addresses:\", err)\n throw err\n }\n await ensureExecutorModulesForConnect(account, managedAddress, config)\n },\n [config],\n )\n\n /**\n * Thirdweb autoConnect restores the wallet without calling onConnect. Seed addresses live in\n * SQLite (OPFS); after a wipe there is no app_state row until setAddresses runs again.\n */\n useEffect(() => {\n if (isAutoConnecting) {\n return\n }\n if (connectionStatus !== \"connected\") {\n lastSyncedOwnedKey.current = null\n return\n }\n if (!wallet) {\n return\n }\n let cancelled = false\n void (async () => {\n try {\n if (cancelled) return\n await syncActiveWalletToSeed(wallet)\n } catch {\n /* logged in syncActiveWalletToSeed */\n }\n })()\n return () => {\n cancelled = true\n }\n }, [\n wallet,\n activeAccount?.address,\n connectionStatus,\n isAutoConnecting,\n syncActiveWalletToSeed,\n ])\n\n const handleDisconnect = () => {\n try {\n sessionStorage.setItem(USER_DISCONNECTED_SESSION_KEY, \"1\")\n } catch {\n /* private mode / SSR */\n }\n clearPublishWallet()\n PublishManager.stopAll()\n }\n\n const handleConnect = async (activeWallet: Wallet, _allConnectedWallets: Wallet[]) => {\n const account = activeWallet.getAccount()\n if (!account) return\n try {\n sessionStorage.removeItem(USER_DISCONNECTED_SESSION_KEY)\n } catch {\n /* ignore */\n }\n console.log('[ConnectButton] Connected', account.address)\n try {\n await syncActiveWalletToSeed(activeWallet)\n } catch {\n /* syncActiveWalletToSeed logs */\n }\n }\n\n return (\n <ConnectButtonThirdweb\n client={getClient()}\n wallets={getWalletsForConnectButton()}\n autoConnect={true}\n chain={optimismSepolia}\n chains={[ optimismSepolia, ]}\n onConnect={handleConnect}\n onDisconnect={handleDisconnect}\n theme={darkTheme({\n colors: {\n primaryButtonBg: '#1D2939',\n primaryButtonText: '#FFFFFF',\n secondaryButtonHoverBg: '#1D2939',\n connectedButtonBg: '#101828',\n connectedButtonBgHover: '#1D2939',\n borderColor: '#344054',\n },\n })}\n />\n )\n}\n\nexport default ConnectButton\n","import React, { FC, useEffect } from \"react\"\nimport type { MutableRefObject } from \"react\"\nimport type { QueryClient } from \"@tanstack/react-query\"\nimport { ThirdwebProvider } from \"thirdweb/react\"\nimport { SeedProvider } from '@seedprotocol/react'\nimport { initPublish, getConfigRef, type PublishConfig } from \"../config\"\nimport { PublishConfigContext, usePublishConfig } from \"./PublishConfigContext\"\nimport type { PublishProviderProps } from \"./PublishProvider\"\n\nexport { usePublishConfig }\nexport type { PublishProviderProps }\n\n/**\n * Thirdweb-backed PublishProvider (includes ThirdwebProvider).\n */\nconst PublishProviderThirdweb: FC<PublishProviderProps> = ({\n children,\n config,\n queryClient,\n queryClientRef,\n}) => {\n useEffect(() => {\n if (config) {\n initPublish(config)\n }\n }, [config])\n\n return (\n <PublishConfigContext.Provider value={config ?? getConfigRef()}>\n <ThirdwebProvider>\n <SeedProvider queryClient={queryClient} queryClientRef={queryClientRef}>\n {children}\n </SeedProvider>\n </ThirdwebProvider>\n </PublishConfigContext.Provider>\n )\n}\n\nexport default PublishProviderThirdweb\n","import type { Account } from 'thirdweb/wallets'\nimport { getContract } from 'thirdweb'\nimport { getInstalledModules } from 'thirdweb/modules'\nimport { optimismSepolia } from 'thirdweb/chains'\nimport type { PublishWallet } from './seedSigner'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishConfig } from '../config'\nimport { isRouterNonModularCoreAccountError, ManagedAccountPublishError } from '../errors'\nimport { ensureExecutorModuleInstalled } from './ensureExecutorModule'\nimport {\n ensureAutomationSessionKey,\n removeAutomationSessionKey,\n} from './ensureAutomationSessionKey'\nimport {\n attestPublishAuthorization,\n revokePublishAuthorization,\n type AttestPublishAuthorizationResult,\n} from '../services/publishAuthorization'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\n\nexport type EnrollPublishAutomationParams = {\n managedAddress: string\n sessionKeyAddress: string\n /** Optional app label stored in the sidecar (defaults to zero address). */\n appAddress?: string\n /** Unix seconds session / grant end (optional). */\n expiresAt?: number\n /**\n * User-controlled ManagedAccount wallet used to add the session key and attest the sidecar.\n * When omitted, uses the connected managed in-app wallet.\n */\n userWallet?: PublishWallet\n}\n\nexport type EnrollPublishAutomationResult = {\n managedAddress: string\n sessionKeyAddress: string\n authorization: AttestPublishAuthorizationResult\n}\n\nexport type RevokePublishAutomationParams = {\n managedAddress: string\n sessionKeyAddress: string\n authorizationUid: string\n userWallet?: PublishWallet\n}\n\nasync function connectManagedAccount(managedAddress: string): Promise<Account> {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: optimismSepolia })\n const account = managedWallet.getAccount()\n if (!account) {\n throw new ManagedAccountPublishError(\n 'Could not connect the managed publishing account to enroll or revoke publish automation.',\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n return account\n}\n\nasync function resolveUserWallet(\n managedAddress: string,\n userWallet?: PublishWallet,\n): Promise<PublishWallet> {\n if (userWallet) return userWallet\n return fromThirdwebAccount(await connectManagedAccount(managedAddress))\n}\n\nasync function assertExecutorModuleInstalled(managedAddress: string): Promise<void> {\n const config = getPublishConfig()\n const moduleAddr = config.modularAccountModuleContract?.trim()\n if (!moduleAddr) {\n throw new Error(\n '@seedprotocol/publish: enrollPublishAutomation requires PublishConfig.modularAccountModuleContract',\n )\n }\n\n const twAccount = await connectManagedAccount(managedAddress)\n try {\n await ensureExecutorModuleInstalled(managedAddress, twAccount, config)\n } catch (cause) {\n if (cause instanceof ManagedAccountPublishError) throw cause\n throw new ManagedAccountPublishError(\n 'Executor module setup failed for publish automation.',\n 'EXECUTOR_MODULE_NOT_INSTALLED',\n managedAddress,\n cause,\n )\n }\n\n try {\n const accountContract = getContract({\n client: getClient(),\n chain: optimismSepolia,\n address: managedAddress,\n })\n const installed = await getInstalledModules({ contract: accountContract })\n const want = moduleAddr.toLowerCase()\n const ok = installed.some(\n (m: { implementation: string }) => m.implementation?.toLowerCase() === want,\n )\n if (!ok) {\n throw new ManagedAccountPublishError(\n 'Executor module is not installed on the ManagedAccount (ModularCore required for automation grants).',\n 'EXECUTOR_MODULE_NOT_INSTALLED',\n managedAddress,\n )\n }\n } catch (cause) {\n if (cause instanceof ManagedAccountPublishError) throw cause\n if (isRouterNonModularCoreAccountError(cause)) {\n throw new ManagedAccountPublishError(\n 'ManagedAccount is not ModularCore; cannot install the executor module required for automation grants.',\n 'EXECUTOR_MODULE_NOT_INSTALLED',\n managedAddress,\n cause,\n )\n }\n throw new ManagedAccountPublishError(\n 'Could not verify executor module installation for publish automation.',\n 'EXECUTOR_MODULE_NOT_INSTALLED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * Enroll an app automation key: install executor module → add module-only session key →\n * attest PublishAuthorization sidecar (ManagedAccount attester).\n */\nexport async function enrollPublishAutomation(\n params: EnrollPublishAutomationParams,\n): Promise<EnrollPublishAutomationResult> {\n const { managedAddress, sessionKeyAddress, appAddress, expiresAt } = params\n\n await assertExecutorModuleInstalled(managedAddress)\n await ensureAutomationSessionKey({\n managedAddress,\n sessionKeyAddress,\n expiresAt,\n })\n\n const userWallet = await resolveUserWallet(managedAddress, params.userWallet)\n const authorization = await attestPublishAuthorization({\n wallet: userWallet,\n identity: managedAddress,\n sessionKey: sessionKeyAddress,\n app: appAddress,\n expiresAt,\n })\n\n return {\n managedAddress,\n sessionKeyAddress,\n authorization,\n }\n}\n\n/**\n * Disconnect automation: remove session key, then revoke PublishAuthorization sidecar.\n */\nexport async function revokePublishAutomation(\n params: RevokePublishAutomationParams,\n): Promise<void> {\n const { managedAddress, sessionKeyAddress, authorizationUid } = params\n const userWallet = await resolveUserWallet(managedAddress, params.userWallet)\n\n await removeAutomationSessionKey({\n managedAddress,\n sessionKeyAddress,\n })\n\n await revokePublishAuthorization({\n wallet: userWallet,\n uid: authorizationUid,\n })\n}\n","import {\n assessPublishAuthorization,\n decodePublishAuthorizationData,\n getPublishAuthorizationFromEas,\n} from '@seedprotocol/eas'\nimport { isAutomationSessionActive } from './ensureAutomationSessionKey'\n\nexport type AssertStorageBoundToIdentityParams = {\n managedAddress: string\n /** Recovered ANS-104 DataItem owner (Ethereum address). */\n dataItemOwner: string\n /**\n * Unix seconds for historical binding checks against PublishAuthorization expiry.\n * Defaults to now. Session-key live check always uses current `isActiveSigner`.\n */\n atTime?: number\n /**\n * When true (default), accept a live active session key on the ManagedAccount.\n */\n allowActiveSessionKey?: boolean\n /**\n * When true (default), accept a non-revoked PublishAuthorization sidecar valid at `atTime`.\n */\n allowSidecar?: boolean\n}\n\nexport type AssertStorageBoundToIdentityResult = {\n bound: boolean\n via: 'active_session_key' | 'publish_authorization' | null\n warnings: string[]\n}\n\n/**\n * Whether an Arweave DataItem owner is bound to a ManagedAccount identity for authorship.\n * Prefer live `isActiveSigner` for current publishes; use the PublishAuthorization sidecar\n * for discoverability / historical grants (revoking the session key stops new binds via\n * active check; sidecar validity is assessed at `atTime`).\n */\nexport async function assertStorageBoundToIdentity(\n params: AssertStorageBoundToIdentityParams,\n): Promise<AssertStorageBoundToIdentityResult> {\n const {\n managedAddress,\n dataItemOwner,\n atTime,\n allowActiveSessionKey = true,\n allowSidecar = true,\n } = params\n const warnings: string[] = []\n const owner = dataItemOwner.trim().toLowerCase()\n const identity = managedAddress.trim().toLowerCase()\n\n if (!/^0x[0-9a-fA-F]{40}$/.test(owner) || !/^0x[0-9a-fA-F]{40}$/.test(identity)) {\n return { bound: false, via: null, warnings: ['Invalid managedAddress or dataItemOwner'] }\n }\n\n if (allowActiveSessionKey) {\n try {\n const active = await isAutomationSessionActive(managedAddress, dataItemOwner)\n if (active) {\n return { bound: true, via: 'active_session_key', warnings }\n }\n } catch (e) {\n warnings.push(\n e instanceof Error ? e.message : 'isActiveSigner check failed',\n )\n }\n }\n\n if (allowSidecar) {\n try {\n const rows = await getPublishAuthorizationFromEas({\n identities: [managedAddress],\n sessionKeys: [dataItemOwner],\n excludeRevoked: true,\n })\n const nowMs = atTime != null ? atTime * 1000 : Date.now()\n for (const row of rows) {\n try {\n const decoded = decodePublishAuthorizationData(row.decodedDataJson ?? '[]')\n if (decoded.identity.toLowerCase() !== identity) continue\n if (decoded.sessionKey.toLowerCase() !== owner) continue\n const expirationTime =\n typeof row.expirationTime === 'number' ? row.expirationTime : null\n const assess = assessPublishAuthorization({\n decoded,\n expirationTime,\n now: nowMs,\n })\n if (assess.status === 'valid') {\n return {\n bound: true,\n via: 'publish_authorization',\n warnings: [...warnings, ...assess.warnings],\n }\n }\n warnings.push(...assess.warnings)\n } catch {\n // skip undecodable row\n }\n }\n } catch (e) {\n warnings.push(\n e instanceof Error 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AM,IAAU,GAA+B,EAAI,mBAAmB,IAAI;GAE1E,IADI,EAAQ,SAAS,YAAY,MAAM,KACnC,EAAQ,WAAW,YAAY,MAAM,GAAO;GAChD,IAAM,IACJ,OAAO,EAAI,kBAAmB,WAAW,EAAI,iBAAiB,MAC1D,IAAS,GAA2B;IACxC;IACA;IACA,KAAK;GACP,CAAC;GACD,IAAI,EAAO,WAAW,SACpB,OAAO;IACL,OAAO;IACP,KAAK;IACL,UAAU,CAAC,GAAG,GAAU,GAAG,EAAO,QAAQ;GAC5C;GAEF,EAAS,KAAK,GAAG,EAAO,QAAQ;EAClC,QAAQ,CAER;CAEJ,SAAS,GAAG;EACV,EAAS,KACP,aAAa,QAAQ,EAAE,UAAU,mCACnC;CACF;CAGF,OAAO;EAAE,OAAO;EAAO,KAAK;EAAM;CAAS;AAC7C"}
|
|
1
|
+
{"version":3,"file":"thirdweb.js","names":[],"sources":["../src/react/ConnectButton.tsx","../src/react/PublishProvider.thirdweb.tsx","../src/helpers/ensureEip7702ModularAccountReady.ts","../src/helpers/defaultApprovedTargetsForModularPublish.ts","../src/helpers/ensureManagedSignerSessionKey.ts","../src/helpers/enrollPublishAutomation.ts","../src/helpers/assertStorageBoundToIdentity.ts"],"sourcesContent":["import React, { FC, useCallback, useEffect, useRef } from \"react\"\nimport {\n ConnectButton as ConnectButtonThirdweb,\n darkTheme,\n useActiveAccount,\n useActiveWallet,\n useActiveWalletConnectionStatus,\n useIsAutoConnecting,\n} from \"thirdweb/react\"\nimport { client as seedClient } from \"@seedprotocol/sdk\"\nimport {\n getClient,\n getConnectedManagedAccountAddress,\n getManagedAccountWallet,\n getModularAccountWallet,\n getSmartWalletAddressForAdmin,\n getWalletsForConnectButton,\n syncPublishInAppAuthToken,\n} from \"../helpers/thirdweb\"\nimport { fromThirdwebAccount } from \"../helpers/adapters/thirdwebAccount\"\nimport { setPublishWallet, clearPublishWallet } from \"../helpers/publishWalletRegistry\"\nimport { usePublishConfig } from \"./PublishConfigContext\"\nimport { getPublishConfig } from \"../config\"\nimport type { Account, Wallet } from \"thirdweb/wallets\"\nimport type { PublishConfig } from \"../config\"\nimport { ensureExecutorModuleInstalled } from \"../helpers/ensureExecutorModule\"\nimport { PublishManager } from \"../services/publishManager\"\nimport { getPublishThirdwebChain } from '../helpers/thirdwebChain'\n\n/** Session flag so we do not force autoConnect after an explicit UI disconnect (survives reload). */\nconst USER_DISCONNECTED_SESSION_KEY = \"seedProtocol:publish:userChoseWalletDisconnect\"\n\nfunction reportWalletSetupWarning(err: unknown) {\n // Expected when managed-wallet autoConnect is still catching up; publish prep retries.\n console.warn(\"[ConnectButton] Wallet setup / module install skipped:\", err)\n getPublishConfig().onWalletSetupWarning?.(err)\n}\n\n/** Resolves after `ClientManager.init()` has finished; `setAddresses` requires this. */\nfunction waitUntilSeedInitialized(): Promise<void> {\n if (seedClient.isInitialized()) return Promise.resolve()\n return new Promise((resolve) => {\n seedClient.onReady(() => resolve())\n })\n}\n\n/**\n * Executor module (ModularCore) must be installed on the **ManagedAccount** (EIP-4337) contract.\n * The EIP-7702 modular wallet contract does not expose Thirdweb's installModule / Router API;\n * calling it there reverts with \"Router: function does not exist.\"\n */\nasync function ensureExecutorModulesForConnect(\n modularAccount: Account,\n managedAddress: string | undefined,\n config: PublishConfig,\n): Promise<void> {\n if (!config.modularAccountModuleContract) {\n return\n }\n\n if (config.useModularExecutor) {\n if (!managedAddress) {\n return\n }\n try {\n syncPublishInAppAuthToken()\n const mw = getManagedAccountWallet()\n await mw.autoConnect({ client: getClient(), chain: getPublishThirdwebChain(config) })\n const ma = mw.getAccount()\n if (!ma) {\n return\n }\n await ensureExecutorModuleInstalled(managedAddress, ma, config)\n } catch {\n /* managed wallet session may lag modular connect; publish prep retries module install */\n }\n return\n }\n\n try {\n await ensureExecutorModuleInstalled(modularAccount.address, modularAccount, config)\n } catch (err) {\n reportWalletSetupWarning(err)\n }\n}\n\nconst ConnectButton: FC = () => {\n const config = usePublishConfig()\n const thirdwebChain = getPublishThirdwebChain(config)\n const wallet = useActiveWallet()\n const activeAccount = useActiveAccount()\n const connectionStatus = useActiveWalletConnectionStatus()\n const isAutoConnecting = useIsAutoConnecting()\n /** Avoid duplicate setAddresses when onConnect and the reconcile effect both run. */\n const lastSyncedOwnedKey = useRef<string | null>(null)\n const prevIsAutoConnecting = useRef(false)\n const reloadAutoConnectRetried = useRef(false)\n\n /**\n * Thirdweb sometimes finishes autoConnect on full reload with `disconnected` and no wallet\n * (see debug: isAutoConnecting true→false then disconnected). One explicit in-app autoConnect\n * retry recovers without affecting users who chose Disconnect (sessionStorage gate).\n */\n useEffect(() => {\n if (typeof window === \"undefined\") return\n const prev = prevIsAutoConnecting.current\n prevIsAutoConnecting.current = isAutoConnecting\n\n let navType: string | undefined\n try {\n navType = (\n performance.getEntriesByType(\"navigation\")[0] as\n | PerformanceNavigationTiming\n | undefined\n )?.type\n } catch {\n navType = undefined\n }\n if (navType !== \"reload\") return\n\n let userChoseDisconnect = false\n try {\n userChoseDisconnect =\n sessionStorage.getItem(USER_DISCONNECTED_SESSION_KEY) === \"1\"\n } catch {\n userChoseDisconnect = false\n }\n if (userChoseDisconnect) return\n\n if (!prev || isAutoConnecting || connectionStatus !== \"disconnected\") return\n if (reloadAutoConnectRetried.current) return\n reloadAutoConnectRetried.current = true\n\n void (config.useModularExecutor ? getModularAccountWallet() : getManagedAccountWallet())\n .autoConnect({ client: getClient(), chain: thirdwebChain })\n .catch(() => {\n /* no session or iframe not ready; Connect UI can still sign in */\n })\n }, [connectionStatus, isAutoConnecting, config.useModularExecutor, thirdwebChain])\n\n const syncActiveWalletToSeed = useCallback(\n async (activeWallet: Wallet) => {\n const account = activeWallet.getAccount()\n if (!account) {\n return\n }\n await waitUntilSeedInitialized()\n PublishManager.stopAll()\n const owned = new Set<string>([account.address.toLowerCase()])\n let managedAddress: string | undefined\n if (config.useModularExecutor) {\n syncPublishInAppAuthToken()\n const adminAddress =\n activeWallet.getAdminAccount?.()?.address ?? account.address\n const tryManaged = async () => {\n try {\n return await getConnectedManagedAccountAddress(thirdwebChain)\n } catch {\n try {\n return await getSmartWalletAddressForAdmin(adminAddress)\n } catch {\n return undefined\n }\n }\n }\n managedAddress = await tryManaged()\n if (!managedAddress) {\n await new Promise<void>((r) => queueMicrotask(() => r()))\n managedAddress = await tryManaged()\n }\n if (managedAddress) {\n owned.add(managedAddress.toLowerCase())\n }\n }\n const ownedKey = [...owned].sort().join(\",\")\n if (lastSyncedOwnedKey.current === ownedKey) {\n return\n }\n lastSyncedOwnedKey.current = ownedKey\n try {\n const publishWallet = fromThirdwebAccount(account)\n await setPublishWallet({\n ...publishWallet,\n ownedAddresses: [...owned],\n publisherAddress: managedAddress ?? account.address,\n })\n } catch (err) {\n lastSyncedOwnedKey.current = null\n console.warn(\"[ConnectButton] Failed to set seed client addresses:\", err)\n throw err\n }\n await ensureExecutorModulesForConnect(account, managedAddress, config)\n },\n [config],\n )\n\n /**\n * Thirdweb autoConnect restores the wallet without calling onConnect. Seed addresses live in\n * SQLite (OPFS); after a wipe there is no app_state row until setAddresses runs again.\n */\n useEffect(() => {\n if (isAutoConnecting) {\n return\n }\n if (connectionStatus !== \"connected\") {\n lastSyncedOwnedKey.current = null\n return\n }\n if (!wallet) {\n return\n }\n let cancelled = false\n void (async () => {\n try {\n if (cancelled) return\n await syncActiveWalletToSeed(wallet)\n } catch {\n /* logged in syncActiveWalletToSeed */\n }\n })()\n return () => {\n cancelled = true\n }\n }, [\n wallet,\n activeAccount?.address,\n connectionStatus,\n isAutoConnecting,\n syncActiveWalletToSeed,\n ])\n\n const handleDisconnect = () => {\n try {\n sessionStorage.setItem(USER_DISCONNECTED_SESSION_KEY, \"1\")\n } catch {\n /* private mode / SSR */\n }\n clearPublishWallet()\n PublishManager.stopAll()\n }\n\n const handleConnect = async (activeWallet: Wallet, _allConnectedWallets: Wallet[]) => {\n const account = activeWallet.getAccount()\n if (!account) return\n try {\n sessionStorage.removeItem(USER_DISCONNECTED_SESSION_KEY)\n } catch {\n /* ignore */\n }\n console.log('[ConnectButton] Connected', account.address)\n try {\n await syncActiveWalletToSeed(activeWallet)\n } catch {\n /* syncActiveWalletToSeed logs */\n }\n }\n\n return (\n <ConnectButtonThirdweb\n client={getClient()}\n wallets={getWalletsForConnectButton(config)}\n autoConnect={true}\n chain={thirdwebChain}\n chains={[ thirdwebChain, ]}\n onConnect={handleConnect}\n onDisconnect={handleDisconnect}\n theme={darkTheme({\n colors: {\n primaryButtonBg: '#1D2939',\n primaryButtonText: '#FFFFFF',\n secondaryButtonHoverBg: '#1D2939',\n connectedButtonBg: '#101828',\n connectedButtonBgHover: '#1D2939',\n borderColor: '#344054',\n },\n })}\n />\n )\n}\n\nexport default ConnectButton\n","import React, { FC, useEffect } from \"react\"\nimport type { MutableRefObject } from \"react\"\nimport type { QueryClient } from \"@tanstack/react-query\"\nimport { ThirdwebProvider } from \"thirdweb/react\"\nimport { SeedProvider } from '@seedprotocol/react'\nimport { initPublish, getConfigRef, type PublishConfig } from \"../config\"\nimport { PublishConfigContext, usePublishConfig } from \"./PublishConfigContext\"\nimport type { PublishProviderProps } from \"./PublishProvider\"\n\nexport { usePublishConfig }\nexport type { PublishProviderProps }\n\n/**\n * Thirdweb-backed PublishProvider (includes ThirdwebProvider).\n */\nconst PublishProviderThirdweb: FC<PublishProviderProps> = ({\n children,\n config,\n queryClient,\n queryClientRef,\n}) => {\n useEffect(() => {\n if (config) {\n initPublish(config)\n }\n }, [config])\n\n return (\n <PublishConfigContext.Provider value={config ?? getConfigRef()}>\n <ThirdwebProvider>\n <SeedProvider queryClient={queryClient} queryClientRef={queryClientRef}>\n {children}\n </SeedProvider>\n </ThirdwebProvider>\n </PublishConfigContext.Provider>\n )\n}\n\nexport default PublishProviderThirdweb\n","import { deploySmartAccount, getContract } from 'thirdweb'\nimport { getPublishConfig } from '../config'\nimport { Eip7702ModularAccountPublishError } from '../errors'\nimport { isContractDeployed, pollSmartWalletDeployed } from './chainClient'\nimport { getClient, getModularAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_NO_ACCOUNT =\n 'Modular (EIP-7702) wallet is not connected. Sign in with the same method and try again.'\nconst MSG_NOT_UPGRADED = () =>\n `Your modular account is not upgraded to an EIP-7702 smart account on ${getPublishChainName()} yet. Enable autoDeployEip7702ModularAccount in publish config or complete wallet setup, then retry.`\nconst MSG_DEPLOY_FAILED = () =>\n `Automatic EIP-7702 smart account setup failed on ${getPublishChainName()}. Retry or reconnect your wallet.`\nconst MSG_NOT_CONFIRMED =\n 'EIP-7702 upgrade was sent but on-chain bytecode was not detected yet. Wait a moment and retry.'\n\nconst DEPLOY_POLL_ATTEMPTS = 5\n\n/**\n * Ensures the Thirdweb in-app modular wallet (EIP-7702) has non-empty bytecode at its address\n * on the publish chain. deploySmartAccount remains Thirdweb; bytecode checks use viem.\n */\nexport async function ensureEip7702ModularAccountReady(): Promise<void> {\n const { autoDeployEip7702ModularAccount } = getPublishConfig()\n const modularAccountWallet = getModularAccountWallet()\n await modularAccountWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const modularAccount = modularAccountWallet.getAccount()\n if (!modularAccount) {\n throw new Eip7702ModularAccountPublishError(MSG_NO_ACCOUNT, 'EIP7702_MODULAR_ACCOUNT_UNAVAILABLE')\n }\n\n const client = getClient()\n const accountContract = getContract({\n client,\n chain: getPublishThirdwebChain(),\n address: modularAccount.address,\n })\n\n if (await isContractDeployed(modularAccount.address)) {\n return\n }\n\n if (!autoDeployEip7702ModularAccount) {\n throw new Eip7702ModularAccountPublishError(\n MSG_NOT_UPGRADED(),\n 'EIP7702_MODULAR_NOT_UPGRADED',\n modularAccount.address,\n )\n }\n\n try {\n await deploySmartAccount({\n smartAccount: modularAccount,\n chain: getPublishThirdwebChain(),\n client,\n accountContract,\n })\n } catch (cause) {\n if (await pollSmartWalletDeployed(modularAccount.address, DEPLOY_POLL_ATTEMPTS)) {\n return\n }\n throw new Eip7702ModularAccountPublishError(\n MSG_DEPLOY_FAILED(),\n 'EIP7702_MODULAR_DEPLOY_FAILED',\n modularAccount.address,\n cause,\n )\n }\n\n if (!(await pollSmartWalletDeployed(modularAccount.address, DEPLOY_POLL_ATTEMPTS))) {\n throw new Eip7702ModularAccountPublishError(\n MSG_NOT_CONFIRMED,\n 'EIP7702_MODULAR_NOT_CONFIRMED',\n modularAccount.address,\n )\n }\n}\n","import { approvedTargetsForAutomationPublish } from './approvedTargetsForAutomationPublish'\n\n/**\n * Allowlisted call targets for a modular session signer: only the Seed executor module.\n *\n * Never the ManagedAccount (a key could then make any self-call, which the account trusts) and\n * never EAS (a direct EAS target bypasses the Seed extension's forced revocability).\n *\n * @deprecated Interactive publishing is a UserOp from the ManagedAccount itself and needs no\n * session key; automation keys use {@link approvedTargetsForAutomationPublish}, which this now\n * returns. `managedAddress` is ignored.\n * @throws if `modularAccountModuleContract` is unset or invalid\n */\nexport function defaultApprovedTargetsForModularPublish(_managedAddress?: string): `0x${string}`[] {\n return approvedTargetsForAutomationPublish()\n}\n","import { getContract, sendTransaction } from 'thirdweb'\nimport { addSessionKey, shouldUpdateSessionKey } from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport { defaultApprovedTargetsForModularPublish } from './defaultApprovedTargetsForModularPublish'\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 the modular signer on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the modular wallet as a session signer on your publishing account on ${getPublishChainName()}.`\n\n/**\n * Ensures the modular (EIP-7702) wallet is an active session signer on the ManagedAccount.\n * If permissions are missing or stale, sends `addSessionKey` signed by the managed EIP-4337 wallet.\n * Session-key AA extensions remain on Thirdweb; verification uses viem.\n *\n * The key may call only the Seed executor module ({@link defaultApprovedTargetsForModularPublish}).\n *\n * @deprecated Interactive publishing is a UserOp from the ManagedAccount itself and needs no\n * session key. For server-held keys use `enrollPublishAutomation`.\n */\nexport async function ensureManagedSignerSessionKey(params: {\n managedAddress: string\n signerAddress: string\n}): Promise<void> {\n const { managedAddress, signerAddress } = params\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\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = {\n approvedTargets: defaultApprovedTargetsForModularPublish(managedAddress),\n nativeTokenLimitPerTransaction: 0,\n }\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress: signerAddress,\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: signerAddress,\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 let active = false\n try {\n active = await readIsActiveSigner(managedAddress as Address, signerAddress as Address)\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 (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n","import type { Account } from 'thirdweb/wallets'\nimport type { PublishWallet } from './seedSigner'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishConfig } from '../config'\nimport { ManagedAccountPublishError } from '../errors'\nimport { ensureExecutorModuleInstalled } from './ensureExecutorModule'\nimport { assertExecutorModuleReadyForAccount } from './executorModuleReadiness'\nimport {\n ensureAutomationSessionKey,\n removeAutomationSessionKey,\n} from './ensureAutomationSessionKey'\nimport {\n attestPublishAuthorization,\n revokePublishAuthorization,\n type AttestPublishAuthorizationResult,\n} from '../services/publishAuthorization'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\nexport type EnrollPublishAutomationParams = {\n managedAddress: string\n sessionKeyAddress: string\n /** Optional app label stored in the sidecar (defaults to zero address). */\n appAddress?: string\n /** Unix seconds session / grant end (optional). */\n expiresAt?: number\n /**\n * User-controlled ManagedAccount wallet used to add the session key and attest the sidecar.\n * When omitted, uses the connected managed in-app wallet.\n */\n userWallet?: PublishWallet\n}\n\nexport type EnrollPublishAutomationResult = {\n managedAddress: string\n sessionKeyAddress: string\n authorization: AttestPublishAuthorizationResult\n}\n\nexport type RevokePublishAutomationParams = {\n managedAddress: string\n sessionKeyAddress: string\n authorizationUid: string\n userWallet?: PublishWallet\n}\n\nasync function connectManagedAccount(managedAddress: string): Promise<Account> {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const account = managedWallet.getAccount()\n if (!account) {\n throw new ManagedAccountPublishError(\n 'Could not connect the managed publishing account to enroll or revoke publish automation.',\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n return account\n}\n\nasync function resolveUserWallet(\n managedAddress: string,\n userWallet?: PublishWallet,\n): Promise<PublishWallet> {\n if (userWallet) return userWallet\n return fromThirdwebAccount(await connectManagedAccount(managedAddress))\n}\n\nasync function assertExecutorModuleInstalled(managedAddress: string): Promise<void> {\n const config = getPublishConfig()\n const moduleAddr = config.modularAccountModuleContract?.trim()\n if (!moduleAddr) {\n throw new Error(\n '@seedprotocol/publish: enrollPublishAutomation requires PublishConfig.modularAccountModuleContract',\n )\n }\n\n const twAccount = await connectManagedAccount(managedAddress)\n try {\n await ensureExecutorModuleInstalled(managedAddress, twAccount, config)\n } catch (cause) {\n if (cause instanceof ManagedAccountPublishError) throw cause\n throw new ManagedAccountPublishError(\n 'Executor module setup failed for publish automation.',\n 'EXECUTOR_MODULE_NOT_INSTALLED',\n managedAddress,\n cause,\n )\n }\n\n // The session key may only call the module, so refuse to enroll unless the module can act\n // for this account. Otherwise every automation publish would revert.\n await assertExecutorModuleReadyForAccount(managedAddress)\n}\n\n/**\n * Enroll an app automation key: install the Seed executor (`installSeedExecutor` on Router\n * accounts with the executor router extension, `installModule` on ModularCore), add an\n * executor-only session key, then attest the PublishAuthorization sidecar (ManagedAccount attester).\n *\n * @throws ManagedAccountPublishError `AUTOMATION_UNSUPPORTED_ACCOUNT` before adding the session\n * key when the executor cannot act for the account (e.g. Router accounts without the extension)\n */\nexport async function enrollPublishAutomation(\n params: EnrollPublishAutomationParams,\n): Promise<EnrollPublishAutomationResult> {\n const { managedAddress, sessionKeyAddress, appAddress, expiresAt } = params\n\n await assertExecutorModuleInstalled(managedAddress)\n await ensureAutomationSessionKey({\n managedAddress,\n sessionKeyAddress,\n expiresAt,\n })\n\n const userWallet = await resolveUserWallet(managedAddress, params.userWallet)\n const authorization = await attestPublishAuthorization({\n wallet: userWallet,\n identity: managedAddress,\n sessionKey: sessionKeyAddress,\n app: appAddress,\n expiresAt,\n })\n\n return {\n managedAddress,\n sessionKeyAddress,\n authorization,\n }\n}\n\n/**\n * Disconnect automation: remove session key, then revoke PublishAuthorization sidecar.\n */\nexport async function revokePublishAutomation(\n params: RevokePublishAutomationParams,\n): Promise<void> {\n const { managedAddress, sessionKeyAddress, authorizationUid } = params\n const userWallet = await resolveUserWallet(managedAddress, params.userWallet)\n\n await removeAutomationSessionKey({\n managedAddress,\n sessionKeyAddress,\n })\n\n await revokePublishAuthorization({\n wallet: userWallet,\n uid: authorizationUid,\n })\n}\n","import {\n assessPublishAuthorization,\n decodePublishAuthorizationData,\n getPublishAuthorizationFromEas,\n} from '@seedprotocol/eas'\nimport { isAutomationSessionActive } from './ensureAutomationSessionKey'\n\nexport type AssertStorageBoundToIdentityParams = {\n managedAddress: string\n /** Recovered ANS-104 DataItem owner (Ethereum address). */\n dataItemOwner: string\n /**\n * Unix seconds for historical binding checks against PublishAuthorization expiry.\n * Defaults to now. Session-key live check always uses current `isActiveSigner`.\n */\n atTime?: number\n /**\n * When true (default), accept a live active session key on the ManagedAccount.\n */\n allowActiveSessionKey?: boolean\n /**\n * When true (default), accept a non-revoked PublishAuthorization sidecar valid at `atTime`.\n */\n allowSidecar?: boolean\n}\n\nexport type AssertStorageBoundToIdentityResult = {\n bound: boolean\n via: 'active_session_key' | 'publish_authorization' | null\n warnings: string[]\n}\n\n/**\n * Whether an Arweave DataItem owner is bound to a ManagedAccount identity for authorship.\n * Prefer live `isActiveSigner` for current publishes; use the PublishAuthorization sidecar\n * for discoverability / historical grants (revoking the session key stops new binds via\n * active check; sidecar validity is assessed at `atTime`).\n */\nexport async function assertStorageBoundToIdentity(\n params: AssertStorageBoundToIdentityParams,\n): Promise<AssertStorageBoundToIdentityResult> {\n const {\n managedAddress,\n dataItemOwner,\n atTime,\n allowActiveSessionKey = true,\n allowSidecar = true,\n } = params\n const warnings: string[] = []\n const owner = dataItemOwner.trim().toLowerCase()\n const identity = managedAddress.trim().toLowerCase()\n\n if (!/^0x[0-9a-fA-F]{40}$/.test(owner) || !/^0x[0-9a-fA-F]{40}$/.test(identity)) {\n return { bound: false, via: null, warnings: ['Invalid managedAddress or dataItemOwner'] }\n }\n\n if (allowActiveSessionKey) {\n try {\n const active = await isAutomationSessionActive(managedAddress, dataItemOwner)\n if (active) {\n return { bound: true, via: 'active_session_key', warnings }\n }\n } catch (e) {\n warnings.push(\n e instanceof Error ? e.message : 'isActiveSigner check failed',\n )\n }\n }\n\n if (allowSidecar) {\n try {\n const rows = await getPublishAuthorizationFromEas({\n identities: [managedAddress],\n sessionKeys: [dataItemOwner],\n excludeRevoked: true,\n })\n const nowMs = atTime != null ? atTime * 1000 : Date.now()\n for (const row of rows) {\n try {\n const decoded = decodePublishAuthorizationData(row.decodedDataJson ?? '[]')\n if (decoded.identity.toLowerCase() !== identity) continue\n if (decoded.sessionKey.toLowerCase() !== owner) continue\n const expirationTime =\n typeof row.expirationTime === 'number' ? row.expirationTime : null\n const assess = assessPublishAuthorization({\n decoded,\n expirationTime,\n now: nowMs,\n })\n if (assess.status === 'valid') {\n return {\n bound: true,\n via: 'publish_authorization',\n warnings: [...warnings, ...assess.warnings],\n }\n }\n warnings.push(...assess.warnings)\n } catch {\n // skip undecodable row\n }\n }\n } catch (e) {\n warnings.push(\n e instanceof Error ? e.message : 'PublishAuthorization query failed',\n )\n }\n }\n\n return { bound: false, via: null, warnings }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,IAAM,IAAgC;AAEtC,SAAS,GAAyB,GAAc;CAG9C,AADA,QAAQ,KAAK,0DAA0D,CAAG,GAC1E,EAAiB,CAAC,CAAC,uBAAuB,CAAG;AAC/C;AAGA,SAAS,KAA0C;CAEjD,OADI,EAAW,cAAc,IAAU,QAAQ,QAAQ,IAChD,IAAI,SAAS,MAAY;EAC9B,EAAW,cAAc,EAAQ,CAAC;CACpC,CAAC;AACH;AAOA,eAAe,GACb,GACA,GACA,GACe;CACV,MAAO,8BAIZ;MAAI,EAAO,oBAAoB;GAC7B,IAAI,CAAC,GACH;GAEF,IAAI;IACF,EAA0B;IAC1B,IAAM,IAAK,EAAwB;IACnC,MAAM,EAAG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