@seedprotocol/publish 0.5.2 → 0.5.3

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 (107) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +7 -1
  3. package/dist/config-BBL0ILr9.js +945 -0
  4. package/dist/config-BBL0ILr9.js.map +1 -0
  5. package/dist/config-DLoMtwmG.js +945 -0
  6. package/dist/config-DLoMtwmG.js.map +1 -0
  7. package/dist/ensureAutomationSessionKey-BuM0gQfL.js +84 -0
  8. package/dist/ensureAutomationSessionKey-BuM0gQfL.js.map +1 -0
  9. package/dist/ensureAutomationSessionKey-BwIqDrG9.js +84 -0
  10. package/dist/ensureAutomationSessionKey-BwIqDrG9.js.map +1 -0
  11. package/dist/ensureManagedAccountEasConfigured-CLB69z0D.js +1206 -0
  12. package/dist/ensureManagedAccountEasConfigured-CLB69z0D.js.map +1 -0
  13. package/dist/ensureManagedAccountEasConfigured-DkRwHXL2.js +1204 -0
  14. package/dist/ensureManagedAccountEasConfigured-DkRwHXL2.js.map +1 -0
  15. package/dist/ensureModularPublishBootstrap-B_w6G5EL.js +125 -0
  16. package/dist/ensureModularPublishBootstrap-B_w6G5EL.js.map +1 -0
  17. package/dist/ensureModularPublishBootstrap-BafX1eks.js +124 -0
  18. package/dist/ensureModularPublishBootstrap-BafX1eks.js.map +1 -0
  19. package/dist/ensureModularPublishBootstrap-CPEwnTCw.js +127 -0
  20. package/dist/ensureModularPublishBootstrap-CPEwnTCw.js.map +1 -0
  21. package/dist/ensureModularPublishBootstrap-CqKKjChn.js +127 -0
  22. package/dist/ensureModularPublishBootstrap-CqKKjChn.js.map +1 -0
  23. package/dist/ensureSmartWalletThenPublish-BDX7FxdV.js +47 -0
  24. package/dist/ensureSmartWalletThenPublish-BDX7FxdV.js.map +1 -0
  25. package/dist/ensureSmartWalletThenPublish-CgCb9kZy.js +47 -0
  26. package/dist/ensureSmartWalletThenPublish-CgCb9kZy.js.map +1 -0
  27. package/dist/ensureSmartWalletThenPublish-Ch7BST2M.js +48 -0
  28. package/dist/ensureSmartWalletThenPublish-Ch7BST2M.js.map +1 -0
  29. package/dist/ensureSmartWalletThenPublish-s7MBAeky.js +48 -0
  30. package/dist/ensureSmartWalletThenPublish-s7MBAeky.js.map +1 -0
  31. package/dist/errors-Du3LNbJN.js +70 -0
  32. package/dist/errors-Du3LNbJN.js.map +1 -0
  33. package/dist/helpers/approvedTargetsForAutomationPublish.d.ts +9 -0
  34. package/dist/helpers/approvedTargetsForAutomationPublish.d.ts.map +1 -0
  35. package/dist/helpers/assertStorageBoundToIdentity.d.ts +31 -0
  36. package/dist/helpers/assertStorageBoundToIdentity.d.ts.map +1 -0
  37. package/dist/helpers/automationSessionKeyPermissions.d.ts +26 -0
  38. package/dist/helpers/automationSessionKeyPermissions.d.ts.map +1 -0
  39. package/dist/helpers/easDirect.d.ts +7 -0
  40. package/dist/helpers/easDirect.d.ts.map +1 -1
  41. package/dist/helpers/enrollPublishAutomation.d.ts +36 -0
  42. package/dist/helpers/enrollPublishAutomation.d.ts.map +1 -0
  43. package/dist/helpers/ensureAutomationSessionKey.d.ts +20 -0
  44. package/dist/helpers/ensureAutomationSessionKey.d.ts.map +1 -0
  45. package/dist/helpers/ensureManagedAccountEasConfigured.d.ts +5 -0
  46. package/dist/helpers/ensureManagedAccountEasConfigured.d.ts.map +1 -1
  47. package/dist/helpers/resolveRevokeAccount.d.ts +3 -6
  48. package/dist/helpers/resolveRevokeAccount.d.ts.map +1 -1
  49. package/dist/helpers/seedSigner.d.ts +3 -0
  50. package/dist/helpers/seedSigner.d.ts.map +1 -1
  51. package/dist/index.d.ts +3 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +573 -198
  54. package/dist/index.js.map +1 -1
  55. package/dist/publishAuthorization-9WO-Zbcj.js +3426 -0
  56. package/dist/publishAuthorization-9WO-Zbcj.js.map +1 -0
  57. package/dist/publishAuthorization-CSyAV8Hf.js +3403 -0
  58. package/dist/publishAuthorization-CSyAV8Hf.js.map +1 -0
  59. package/dist/publishManager-B7zTF25-.js +3018 -0
  60. package/dist/publishManager-B7zTF25-.js.map +1 -0
  61. package/dist/publishManager-luSstTr_.js +3008 -0
  62. package/dist/publishManager-luSstTr_.js.map +1 -0
  63. package/dist/resolveRevokeAccount-B4J_Jo76.js +38 -0
  64. package/dist/resolveRevokeAccount-B4J_Jo76.js.map +1 -0
  65. package/dist/resolveRevokeAccount-Bo1IMYOj.js +38 -0
  66. package/dist/resolveRevokeAccount-Bo1IMYOj.js.map +1 -0
  67. package/dist/resolveRevokeAccount-FYMP0Qz6.js +30 -0
  68. package/dist/resolveRevokeAccount-FYMP0Qz6.js.map +1 -0
  69. package/dist/resolveRevokeAccount-mMTFtVDR.js +30 -0
  70. package/dist/resolveRevokeAccount-mMTFtVDR.js.map +1 -0
  71. package/dist/services/PublishManager/index.d.ts +2 -2
  72. package/dist/services/PublishManager/index.d.ts.map +1 -1
  73. package/dist/services/domainOwnership/challenge.d.ts +34 -0
  74. package/dist/services/domainOwnership/challenge.d.ts.map +1 -0
  75. package/dist/services/domainOwnership/dnsVerify.d.ts +23 -0
  76. package/dist/services/domainOwnership/dnsVerify.d.ts.map +1 -0
  77. package/dist/services/domainOwnership/index.d.ts +121 -0
  78. package/dist/services/domainOwnership/index.d.ts.map +1 -0
  79. package/dist/services/domainOwnership/public.d.ts +2 -0
  80. package/dist/services/domainOwnership/public.d.ts.map +1 -0
  81. package/dist/services/domainOwnership/registry.d.ts +18 -0
  82. package/dist/services/domainOwnership/registry.d.ts.map +1 -0
  83. package/dist/services/publish/actors/createAttestations.d.ts +6 -0
  84. package/dist/services/publish/actors/createAttestations.d.ts.map +1 -1
  85. package/dist/services/publish/index.d.ts +17 -17
  86. package/dist/services/publish/index.d.ts.map +1 -1
  87. package/dist/services/publishAuthorization/index.d.ts +68 -0
  88. package/dist/services/publishAuthorization/index.d.ts.map +1 -0
  89. package/dist/services/publishAuthorization/public.d.ts +2 -0
  90. package/dist/services/publishAuthorization/public.d.ts.map +1 -0
  91. package/dist/services/revoke/revokeAttestations.d.ts +3 -0
  92. package/dist/services/revoke/revokeAttestations.d.ts.map +1 -1
  93. package/dist/services/upload/uploadMachine.d.ts +2 -2
  94. package/dist/services/upload/uploadMachine.d.ts.map +1 -1
  95. package/dist/thirdweb.d.ts +5 -0
  96. package/dist/thirdweb.d.ts.map +1 -1
  97. package/dist/thirdweb.js +202 -83
  98. package/dist/thirdweb.js.map +1 -1
  99. package/dist/worker-BaZK7VaR.js +69 -0
  100. package/dist/worker-BaZK7VaR.js.map +1 -0
  101. package/dist/worker-ChGaz4Bg.js +69 -0
  102. package/dist/worker-ChGaz4Bg.js.map +1 -0
  103. package/dist/worker-Nx2FsrmM.js +69 -0
  104. package/dist/worker-Nx2FsrmM.js.map +1 -0
  105. package/dist/worker-eQpROLst.js +69 -0
  106. package/dist/worker-eQpROLst.js.map +1 -0
  107. package/package.json +7 -4
@@ -0,0 +1,127 @@
1
+ import { H as e, J as t, R as n, U as r, W as i, nt as a, r as o } from "./config-DLoMtwmG.js";
2
+ import { a as s, n as c, r as l } from "./errors-Du3LNbJN.js";
3
+ import { A as u, E as d, _ as f, j as p } from "./publishAuthorization-CSyAV8Hf.js";
4
+ import { deploySmartAccount as m, getContract as h, sendTransaction as g } from "thirdweb";
5
+ import { optimismSepolia as _ } from "thirdweb/chains";
6
+ import { addSessionKey as v, shouldUpdateSessionKey as y } from "thirdweb/extensions/erc4337";
7
+ //#region src/helpers/ensureEip7702ModularAccountReady.ts
8
+ var b = "Modular (EIP-7702) wallet is not connected. Sign in with the same method and try again.", x = "Your modular account is not upgraded to an EIP-7702 smart account on Optimism Sepolia yet. Enable autoDeployEip7702ModularAccount in publish config or complete wallet setup, then retry.", S = "Automatic EIP-7702 smart account setup failed on Optimism Sepolia. Retry or reconnect your wallet.", C = "EIP-7702 upgrade was sent but on-chain bytecode was not detected yet. Wait a moment and retry.", w = 5;
9
+ async function T() {
10
+ let { autoDeployEip7702ModularAccount: t } = o(), n = p();
11
+ await n.autoConnect({
12
+ client: d(),
13
+ chain: _
14
+ });
15
+ let i = n.getAccount();
16
+ if (!i) throw new c(b, "EIP7702_MODULAR_ACCOUNT_UNAVAILABLE");
17
+ let a = d(), s = h({
18
+ client: a,
19
+ chain: _,
20
+ address: i.address
21
+ });
22
+ if (!await e(i.address)) {
23
+ if (!t) throw new c(x, "EIP7702_MODULAR_NOT_UPGRADED", i.address);
24
+ try {
25
+ await m({
26
+ smartAccount: i,
27
+ chain: _,
28
+ client: a,
29
+ accountContract: s
30
+ });
31
+ } catch (e) {
32
+ if (await r(i.address, w)) return;
33
+ throw new c(S, "EIP7702_MODULAR_DEPLOY_FAILED", i.address, e);
34
+ }
35
+ if (!await r(i.address, w)) throw new c(C, "EIP7702_MODULAR_NOT_CONFIRMED", i.address);
36
+ }
37
+ }
38
+ //#endregion
39
+ //#region src/helpers/defaultApprovedTargetsForModularPublish.ts
40
+ function E(e) {
41
+ let t = /* @__PURE__ */ new Set();
42
+ for (let n of e) {
43
+ let e = n.trim().toLowerCase();
44
+ e.startsWith("0x") && e.length === 42 && t.add(e);
45
+ }
46
+ return [...t].sort().map((e) => e);
47
+ }
48
+ function D(e) {
49
+ let n = o(), r = [e, t];
50
+ return n.modularAccountModuleContract?.trim() && r.push(n.modularAccountModuleContract.trim()), E(r);
51
+ }
52
+ //#endregion
53
+ //#region src/helpers/ensureManagedSignerSessionKey.ts
54
+ var O = "Could not connect the managed publishing account to authorize the modular signer on Optimism Sepolia. Reconnect and try again.", k = "Could not authorize the modular wallet as a session signer on your publishing account on Optimism Sepolia.";
55
+ async function A(e) {
56
+ let { managedAddress: t, signerAddress: r } = e, a = u();
57
+ await a.autoConnect({
58
+ client: d(),
59
+ chain: _
60
+ });
61
+ let o = a.getAccount();
62
+ if (!o) throw new l(O, "MODULAR_SIGNER_ACTIVATION_FAILED", t);
63
+ let s = h({
64
+ client: d(),
65
+ chain: _,
66
+ address: t
67
+ }), c = {
68
+ approvedTargets: D(t),
69
+ nativeTokenLimitPerTransaction: 0
70
+ }, f = !1;
71
+ try {
72
+ f = await y({
73
+ accountContract: s,
74
+ sessionKeyAddress: r,
75
+ newPermissions: c
76
+ });
77
+ } catch (e) {
78
+ throw new l(k, "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
79
+ }
80
+ if (f) try {
81
+ let e = v({
82
+ contract: s,
83
+ account: o,
84
+ sessionKeyAddress: r,
85
+ permissions: c
86
+ }), t = await g({
87
+ account: o,
88
+ transaction: e
89
+ });
90
+ await i(t.transactionHash);
91
+ } catch (e) {
92
+ throw new l(k, "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
93
+ }
94
+ let p = !1;
95
+ try {
96
+ p = await n(t, r);
97
+ } catch (e) {
98
+ throw new l(k, "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
99
+ }
100
+ if (!p) throw new l(k, "MODULAR_SIGNER_ACTIVATION_FAILED", t);
101
+ }
102
+ //#endregion
103
+ //#region src/helpers/ensureModularPublishBootstrap.ts
104
+ var j = /* @__PURE__ */ a({ ensureModularPublishBootstrap: () => M });
105
+ async function M(e) {
106
+ let t = p();
107
+ await t.autoConnect({
108
+ client: d(),
109
+ chain: _
110
+ });
111
+ let n = t.getAccount();
112
+ if (!n) throw Error("Failed to get modular account");
113
+ try {
114
+ await A({
115
+ managedAddress: e,
116
+ signerAddress: n.address
117
+ });
118
+ } catch (e) {
119
+ if (!o().autoDeployEip7702ModularAccount || !s(e)) throw e;
120
+ await T();
121
+ }
122
+ return await f(e, (await import("./config-DLoMtwmG.js").then((e) => e.c)).fromThirdwebAccount(n)), n;
123
+ }
124
+ //#endregion
125
+ export { T as a, D as i, j as n, A as r, M as t };
126
+
127
+ //# sourceMappingURL=ensureModularPublishBootstrap-CPEwnTCw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureModularPublishBootstrap-CPEwnTCw.js","names":[],"sources":["../src/helpers/ensureEip7702ModularAccountReady.ts","../src/helpers/defaultApprovedTargetsForModularPublish.ts","../src/helpers/ensureManagedSignerSessionKey.ts","../src/helpers/ensureModularPublishBootstrap.ts"],"sourcesContent":["import { deploySmartAccount, getContract } from 'thirdweb'\nimport { optimismSepolia } from 'thirdweb/chains'\nimport { getPublishConfig } from '../config'\nimport { Eip7702ModularAccountPublishError } from '../errors'\nimport { isContractDeployed, pollSmartWalletDeployed } from './chainClient'\nimport { getClient, getModularAccountWallet } from './thirdweb'\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 Optimism Sepolia 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 Optimism Sepolia. 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 Optimism Sepolia. 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: optimismSepolia })\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: optimismSepolia,\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: optimismSepolia,\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 { getPublishConfig } from '../config'\nimport { EAS_CONTRACT_ADDRESS } from './constants'\n\nfunction uniqueAddressesLower(addresses: string[]): `0x${string}`[] {\n const set = new Set<string>()\n for (const a of addresses) {\n const t = a.trim().toLowerCase()\n if (t.startsWith('0x') && t.length === 42) set.add(t)\n }\n return [...set].sort().map((x) => x as `0x${string}`)\n}\n\n/** Allowlisted call targets for modular session signers: managed account, EAS, optional executor module. */\nexport function defaultApprovedTargetsForModularPublish(managedAddress: string): `0x${string}`[] {\n const cfg = getPublishConfig()\n const extra: string[] = [managedAddress, EAS_CONTRACT_ADDRESS]\n if (cfg.modularAccountModuleContract?.trim()) {\n extra.push(cfg.modularAccountModuleContract.trim())\n }\n return uniqueAddressesLower(extra)\n}\n","import { getContract, sendTransaction } from 'thirdweb'\nimport { addSessionKey, shouldUpdateSessionKey } from 'thirdweb/extensions/erc4337'\nimport { optimismSepolia } from 'thirdweb/chains'\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'\n\nconst MSG_UNAVAILABLE =\n 'Could not connect the managed publishing account to authorize the modular signer on Optimism Sepolia. Reconnect and try again.'\nconst MSG_ACTIVATION_FAILED =\n 'Could not authorize the modular wallet as a session signer on your publishing account on Optimism Sepolia.'\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 */\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: optimismSepolia })\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: optimismSepolia,\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 { optimismSepolia } from 'thirdweb/chains'\nimport { getPublishConfig } from '../config'\nimport { isManagedAccountPublishError } from '../errors'\nimport { ensureEip7702ModularAccountReady } from './ensureEip7702ModularAccountReady'\nimport { ensureManagedAccountEasConfigured } from './ensureManagedAccountEasConfigured'\nimport { ensureManagedSignerSessionKey } from './ensureManagedSignerSessionKey'\nimport { getClient, getModularAccountWallet } from './thirdweb'\n\n/**\n * One-time modular publish bootstrap before `multiPublish`:\n * session signer on managed account → EAS pointer → optional EIP-7702 fallback.\n */\nexport async function ensureModularPublishBootstrap(managedAddress: string): Promise<Account> {\n const modularAccountWallet = getModularAccountWallet()\n await modularAccountWallet.autoConnect({ client: getClient(), chain: optimismSepolia })\n const modularAccount = modularAccountWallet.getAccount()\n if (!modularAccount) {\n throw new Error('Failed to get modular account')\n }\n\n try {\n await ensureManagedSignerSessionKey({\n managedAddress,\n signerAddress: modularAccount.address,\n })\n } catch (cause) {\n if (!getPublishConfig().autoDeployEip7702ModularAccount) {\n throw cause\n }\n if (!isManagedAccountPublishError(cause)) {\n throw cause\n }\n await ensureEip7702ModularAccountReady()\n }\n\n await ensureManagedAccountEasConfigured(managedAddress, (await import('./adapters/thirdwebAccount')).fromThirdwebAccount(modularAccount))\n return modularAccount\n}\n"],"mappings":";;;;;;;AAOA,IAAM,IACJ,2FACI,IACJ,6LACI,IACJ,sGACI,IACJ,kGAEI,IAAuB;AAM7B,eAAsB,IAAkD;CACtE,IAAM,EAAE,uCAAoC,EAAiB,GACvD,IAAuB,EAAwB;CACrD,MAAM,EAAqB,YAAY;E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CAAC,mCAGpB,CAAC,EAA6B,CAAK,GACrC,MAAM;EAER,MAAM,EAAiC;CACzC;CAGA,OADA,MAAM,EAAkC,IAAiB,MAAM,OAAO,uBAAA,CAAA,MAAA,MAAA,EAAA,CAAA,EAAA,CAA+B,oBAAoB,CAAc,CAAC,GACjI;AACT"}
@@ -0,0 +1,127 @@
1
+ import { H as e, J as t, R as n, U as r, W as i, nt as a, r as o } from "./config-BBL0ILr9.js";
2
+ import { a as s, n as c, r as l } from "./errors-Du3LNbJN.js";
3
+ import { D as u, M as d, j as f, v as p } from "./publishAuthorization-9WO-Zbcj.js";
4
+ import { deploySmartAccount as m, getContract as h, sendTransaction as g } from "thirdweb";
5
+ import { optimismSepolia as _ } from "thirdweb/chains";
6
+ import { addSessionKey as v, shouldUpdateSessionKey as y } from "thirdweb/extensions/erc4337";
7
+ //#region src/helpers/ensureEip7702ModularAccountReady.ts
8
+ var b = "Modular (EIP-7702) wallet is not connected. Sign in with the same method and try again.", x = "Your modular account is not upgraded to an EIP-7702 smart account on Optimism Sepolia yet. Enable autoDeployEip7702ModularAccount in publish config or complete wallet setup, then retry.", S = "Automatic EIP-7702 smart account setup failed on Optimism Sepolia. Retry or reconnect your wallet.", C = "EIP-7702 upgrade was sent but on-chain bytecode was not detected yet. Wait a moment and retry.", w = 5;
9
+ async function T() {
10
+ let { autoDeployEip7702ModularAccount: t } = o(), n = d();
11
+ await n.autoConnect({
12
+ client: u(),
13
+ chain: _
14
+ });
15
+ let i = n.getAccount();
16
+ if (!i) throw new c(b, "EIP7702_MODULAR_ACCOUNT_UNAVAILABLE");
17
+ let a = u(), s = h({
18
+ client: a,
19
+ chain: _,
20
+ address: i.address
21
+ });
22
+ if (!await e(i.address)) {
23
+ if (!t) throw new c(x, "EIP7702_MODULAR_NOT_UPGRADED", i.address);
24
+ try {
25
+ await m({
26
+ smartAccount: i,
27
+ chain: _,
28
+ client: a,
29
+ accountContract: s
30
+ });
31
+ } catch (e) {
32
+ if (await r(i.address, w)) return;
33
+ throw new c(S, "EIP7702_MODULAR_DEPLOY_FAILED", i.address, e);
34
+ }
35
+ if (!await r(i.address, w)) throw new c(C, "EIP7702_MODULAR_NOT_CONFIRMED", i.address);
36
+ }
37
+ }
38
+ //#endregion
39
+ //#region src/helpers/defaultApprovedTargetsForModularPublish.ts
40
+ function E(e) {
41
+ let t = /* @__PURE__ */ new Set();
42
+ for (let n of e) {
43
+ let e = n.trim().toLowerCase();
44
+ e.startsWith("0x") && e.length === 42 && t.add(e);
45
+ }
46
+ return [...t].sort().map((e) => e);
47
+ }
48
+ function D(e) {
49
+ let n = o(), r = [e, t];
50
+ return n.modularAccountModuleContract?.trim() && r.push(n.modularAccountModuleContract.trim()), E(r);
51
+ }
52
+ //#endregion
53
+ //#region src/helpers/ensureManagedSignerSessionKey.ts
54
+ var O = "Could not connect the managed publishing account to authorize the modular signer on Optimism Sepolia. Reconnect and try again.", k = "Could not authorize the modular wallet as a session signer on your publishing account on Optimism Sepolia.";
55
+ async function A(e) {
56
+ let { managedAddress: t, signerAddress: r } = e, a = f();
57
+ await a.autoConnect({
58
+ client: u(),
59
+ chain: _
60
+ });
61
+ let o = a.getAccount();
62
+ if (!o) throw new l(O, "MODULAR_SIGNER_ACTIVATION_FAILED", t);
63
+ let s = h({
64
+ client: u(),
65
+ chain: _,
66
+ address: t
67
+ }), c = {
68
+ approvedTargets: D(t),
69
+ nativeTokenLimitPerTransaction: 0
70
+ }, d = !1;
71
+ try {
72
+ d = await y({
73
+ accountContract: s,
74
+ sessionKeyAddress: r,
75
+ newPermissions: c
76
+ });
77
+ } catch (e) {
78
+ throw new l(k, "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
79
+ }
80
+ if (d) try {
81
+ let e = v({
82
+ contract: s,
83
+ account: o,
84
+ sessionKeyAddress: r,
85
+ permissions: c
86
+ }), t = await g({
87
+ account: o,
88
+ transaction: e
89
+ });
90
+ await i(t.transactionHash);
91
+ } catch (e) {
92
+ throw new l(k, "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
93
+ }
94
+ let p = !1;
95
+ try {
96
+ p = await n(t, r);
97
+ } catch (e) {
98
+ throw new l(k, "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
99
+ }
100
+ if (!p) throw new l(k, "MODULAR_SIGNER_ACTIVATION_FAILED", t);
101
+ }
102
+ //#endregion
103
+ //#region src/helpers/ensureModularPublishBootstrap.ts
104
+ var j = /* @__PURE__ */ a({ ensureModularPublishBootstrap: () => M });
105
+ async function M(e) {
106
+ let t = d();
107
+ await t.autoConnect({
108
+ client: u(),
109
+ chain: _
110
+ });
111
+ let n = t.getAccount();
112
+ if (!n) throw Error("Failed to get modular account");
113
+ try {
114
+ await A({
115
+ managedAddress: e,
116
+ signerAddress: n.address
117
+ });
118
+ } catch (e) {
119
+ if (!o().autoDeployEip7702ModularAccount || !s(e)) throw e;
120
+ await T();
121
+ }
122
+ return await p(e, (await import("./config-BBL0ILr9.js").then((e) => e.c)).fromThirdwebAccount(n)), n;
123
+ }
124
+ //#endregion
125
+ export { T as a, D as i, j as n, A as r, M as t };
126
+
127
+ //# sourceMappingURL=ensureModularPublishBootstrap-CqKKjChn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureModularPublishBootstrap-CqKKjChn.js","names":[],"sources":["../src/helpers/ensureEip7702ModularAccountReady.ts","../src/helpers/defaultApprovedTargetsForModularPublish.ts","../src/helpers/ensureManagedSignerSessionKey.ts","../src/helpers/ensureModularPublishBootstrap.ts"],"sourcesContent":["import { deploySmartAccount, getContract } from 'thirdweb'\nimport { optimismSepolia } from 'thirdweb/chains'\nimport { getPublishConfig } from '../config'\nimport { Eip7702ModularAccountPublishError } from '../errors'\nimport { isContractDeployed, pollSmartWalletDeployed } from './chainClient'\nimport { getClient, getModularAccountWallet } from './thirdweb'\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 Optimism Sepolia 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 Optimism Sepolia. 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 Optimism Sepolia. 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: optimismSepolia })\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: optimismSepolia,\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: optimismSepolia,\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 { getPublishConfig } from '../config'\nimport { EAS_CONTRACT_ADDRESS } from './constants'\n\nfunction uniqueAddressesLower(addresses: string[]): `0x${string}`[] {\n const set = new Set<string>()\n for (const a of addresses) {\n const t = a.trim().toLowerCase()\n if (t.startsWith('0x') && t.length === 42) set.add(t)\n }\n return [...set].sort().map((x) => x as `0x${string}`)\n}\n\n/** Allowlisted call targets for modular session signers: managed account, EAS, optional executor module. */\nexport function defaultApprovedTargetsForModularPublish(managedAddress: string): `0x${string}`[] {\n const cfg = getPublishConfig()\n const extra: string[] = [managedAddress, EAS_CONTRACT_ADDRESS]\n if (cfg.modularAccountModuleContract?.trim()) {\n extra.push(cfg.modularAccountModuleContract.trim())\n }\n return uniqueAddressesLower(extra)\n}\n","import { getContract, sendTransaction } from 'thirdweb'\nimport { addSessionKey, shouldUpdateSessionKey } from 'thirdweb/extensions/erc4337'\nimport { optimismSepolia } from 'thirdweb/chains'\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'\n\nconst MSG_UNAVAILABLE =\n 'Could not connect the managed publishing account to authorize the modular signer on Optimism Sepolia. Reconnect and try again.'\nconst MSG_ACTIVATION_FAILED =\n 'Could not authorize the modular wallet as a session signer on your publishing account on Optimism Sepolia.'\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 */\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: optimismSepolia })\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: optimismSepolia,\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 { optimismSepolia } from 'thirdweb/chains'\nimport { getPublishConfig } from '../config'\nimport { isManagedAccountPublishError } from '../errors'\nimport { ensureEip7702ModularAccountReady } from './ensureEip7702ModularAccountReady'\nimport { ensureManagedAccountEasConfigured } from './ensureManagedAccountEasConfigured'\nimport { ensureManagedSignerSessionKey } from './ensureManagedSignerSessionKey'\nimport { getClient, getModularAccountWallet } from './thirdweb'\n\n/**\n * One-time modular publish bootstrap before `multiPublish`:\n * session signer on managed account → EAS pointer → optional EIP-7702 fallback.\n */\nexport async function ensureModularPublishBootstrap(managedAddress: string): Promise<Account> {\n const modularAccountWallet = getModularAccountWallet()\n await modularAccountWallet.autoConnect({ client: getClient(), chain: optimismSepolia })\n const modularAccount = modularAccountWallet.getAccount()\n if (!modularAccount) {\n throw new Error('Failed to get modular account')\n }\n\n try {\n await ensureManagedSignerSessionKey({\n managedAddress,\n signerAddress: modularAccount.address,\n })\n } catch (cause) {\n if (!getPublishConfig().autoDeployEip7702ModularAccount) {\n throw cause\n }\n if (!isManagedAccountPublishError(cause)) {\n throw cause\n }\n await ensureEip7702ModularAccountReady()\n }\n\n await ensureManagedAccountEasConfigured(managedAddress, (await import('./adapters/thirdwebAccount')).fromThirdwebAccount(modularAccount))\n return modularAccount\n}\n"],"mappings":";;;;;;;AAOA,IAAM,IACJ,2FACI,IACJ,6LACI,IACJ,sGACI,IACJ,kGAEI,IAAuB;AAM7B,eAAsB,IAAkD;CACtE,IAAM,EAAE,uCAAoC,EAAiB,GACvD,IAAuB,EAAwB;CACrD,MAAM,EAAqB,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO;CAAgB,CAAC;CACtF,IAAM,IAAiB,EAAqB,WAAW;CACvD,IAAI,CAAC,GACH,MAAM,IAAI,EAAkC,GAAgB,qCAAqC;CAGnG,IAAM,IAAS,EAAU,GACnB,IAAkB,EAAY;EAClC;EACA,OAAO;EACP,SAAS,EAAe;CAC1B,CAAC;CAEG,WAAM,EAAmB,EAAe,OAAO,GAInD;MAAI,CAAC,GACH,MAAM,IAAI,EACR,GACA,gCACA,EAAe,OACjB;EAGF,IAAI;GACF,MAAM,EAAmB;IACvB,cAAc;IACd,OAAO;IACP;IACA;GACF,CAAC;EACH,SAAS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SAAS,GAAO;EACd,MAAM,IAAI,EACR,GACA,oCACA,GACA,CACF;CACF;CAEA,IAAI,GACF,IAAI;EACF,IAAM,IAAK,EAAc;GACvB,UAAU;GACV,SAAS;GACT,mBAAmB;GACnB;EACF,CAAC,GACK,IAAS,MAAM,EAAgB;GAAE,SAAS;GAAgB,aAAa;EAAG,CAAC;EACjF,MAAM,EAAsB,EAAO,eAAgC;CACrE,SAAS,GAAO;EACd,MAAM,IAAI,EACR,GACA,oCACA,GACA,CACF;CACF;CAGF,IAAI,IAAS;CACb,IAAI;EACF,IAAS,MAAM,EAAmB,GAA2B,CAAwB;CACvF,SAAS,GAAO;EACd,MAAM,IAAI,EACR,GACA,oCACA,GACA,CACF;CACF;CAEA,IAAI,CAAC,GACH,MAAM,IAAI,EACR,GACA,oCACA,CACF;AAEJ;;;;ACxFA,eAAsB,EAA8B,GAA0C;CAC5F,IAAM,IAAuB,EAAwB;CACrD,MAAM,EAAqB,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO;CAAgB,CAAC;CACtF,IAAM,IAAiB,EAAqB,WAAW;CACvD,IAAI,CAAC,GACH,MAAU,MAAM,+BAA+B;CAGjD,IAAI;EACF,MAAM,EAA8B;GAClC;GACA,eAAe,EAAe;EAChC,CAAC;CACH,SAAS,GAAO;EAId,IAHI,CAAC,EAAiB,CAAC,CAAC,mCAGpB,CAAC,EAA6B,CAAK,GACrC,MAAM;EAER,MAAM,EAAiC;CACzC;CAGA,OADA,MAAM,EAAkC,IAAiB,MAAM,OAAO,uBAAA,CAAA,MAAA,MAAA,EAAA,CAAA,EAAA,CAA+B,oBAAoB,CAAc,CAAC,GACjI;AACT"}
@@ -0,0 +1,47 @@
1
+ import { E as e, G as t, K as n, L as r, N as i, _ as a, c as o, kt as s, l as c } from "./ensureManagedAccountEasConfigured-CLB69z0D.js";
2
+ import { t as l } from "./publishManager-B7zTF25-.js";
3
+ import { optimismSepolia as u } from "thirdweb/chains";
4
+ import { ethers as d } from "ethers";
5
+ //#region src/helpers/ensureSmartWalletThenPublish.ts
6
+ var f = /* @__PURE__ */ s({ ensureSmartWalletThenPublish: () => g }), p = "A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.", m = "Could not connect the managed publishing account on Optimism Sepolia. Reconnect with the same sign-in method and try again.";
7
+ function h(e) {
8
+ if (e) return e instanceof d.Wallet ? e : t(e) ? e.signer : n(e) ? e : r(e).signer;
9
+ }
10
+ async function g(t, n, s, d) {
11
+ let f = i(), g = await s();
12
+ if (!g || !g.trim()) return { outcome: "no_address" };
13
+ if (f.useModularExecutor) {
14
+ let n = await c();
15
+ if (!n) return {
16
+ outcome: "managed_not_ready",
17
+ error: new e(p, "MANAGED_ACCOUNT_UNAVAILABLE")
18
+ };
19
+ let i;
20
+ try {
21
+ i = await o(u);
22
+ } catch (t) {
23
+ return {
24
+ outcome: "managed_not_ready",
25
+ error: new e(m, "MANAGED_ACCOUNT_UNAVAILABLE", void 0, t)
26
+ };
27
+ }
28
+ let a = r(n);
29
+ return l.createPublish(t, i, a, {
30
+ ...d,
31
+ dataItemSigner: h(d?.dataItemSigner) ?? a.signer
32
+ }), { outcome: "started" };
33
+ }
34
+ let _ = await a(n ?? null);
35
+ if ("address" in _) {
36
+ let e = r(_.account);
37
+ return l.createPublish(t, _.address, e, {
38
+ ...d,
39
+ dataItemSigner: h(d?.dataItemSigner) ?? e.signer
40
+ }), { outcome: "started" };
41
+ }
42
+ return { outcome: "needs_deploy" };
43
+ }
44
+ //#endregion
45
+ export { f as n, g as t };
46
+
47
+ //# sourceMappingURL=ensureSmartWalletThenPublish-BDX7FxdV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSmartWalletThenPublish-BDX7FxdV.js","names":[],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\nimport { optimismSepolia } from 'thirdweb/chains'\nimport {\n getConnectedManagedAccountAddress,\n getConnectedModularAccount,\n resolveSmartWalletForPublish,\n} from './thirdweb'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { isPublishWallet, isSeedSigner, type PublishWallet, type SeedSigner } from './seedSigner'\nimport { ethers } from 'ethers'\nimport { PublishManager } from '../services/publishManager'\nimport type { CreatePublishOptions } from '../config'\nimport { getPublishConfig } from '../config'\nimport { ManagedAccountPublishError } from '../errors'\n\nexport type EnsureSmartWalletResult =\n | { outcome: 'started' }\n | { outcome: 'no_address' }\n | { outcome: 'needs_deploy' }\n | { outcome: 'managed_not_ready'; error: ManagedAccountPublishError }\n\nconst MSG_NO_ACCOUNT_MODULAR =\n 'A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.'\n\nconst MSG_MANAGED_UNAVAILABLE =\n 'Could not connect the managed publishing account on Optimism Sepolia. Reconnect with the same sign-in method and try again.'\n\nfunction coerceDataItemSigner(\n signer: CreatePublishOptions['dataItemSigner'] | Account | SeedSigner | PublishWallet | undefined,\n): CreatePublishOptions['dataItemSigner'] {\n if (!signer) return undefined\n if (signer instanceof ethers.Wallet) return signer\n if (isPublishWallet(signer)) return signer.signer\n if (isSeedSigner(signer)) return signer\n return fromThirdwebAccount(signer as Account).signer\n}\n\n/**\n * Thirdweb path: resolves the smart wallet for the current account; if deployed, starts publish.\n * Prefer {@link ensureWalletThenPublish} for vendor-neutral entry.\n */\nexport async function ensureSmartWalletThenPublish(\n item: Item<any>,\n activeAccount: Account | null | undefined,\n getAddress: () => Promise<string | null>,\n options?: CreatePublishOptions,\n): Promise<EnsureSmartWalletResult> {\n const config = getPublishConfig()\n const address = await getAddress()\n if (!address || !address.trim()) {\n return { outcome: 'no_address' }\n }\n\n if (config.useModularExecutor) {\n const modularAccount = await getConnectedModularAccount()\n if (!modularAccount) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(MSG_NO_ACCOUNT_MODULAR, 'MANAGED_ACCOUNT_UNAVAILABLE'),\n }\n }\n\n let managedAddress: string\n try {\n managedAddress = await getConnectedManagedAccountAddress(optimismSepolia)\n } catch (cause) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(\n MSG_MANAGED_UNAVAILABLE,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n undefined,\n cause,\n ),\n }\n }\n\n const wallet = fromThirdwebAccount(modularAccount)\n PublishManager.createPublish(item, managedAddress, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n return { outcome: 'started' }\n }\n\n const resolved = await resolveSmartWalletForPublish(activeAccount ?? null)\n if ('address' in resolved) {\n const wallet = fromThirdwebAccount(resolved.account)\n PublishManager.createPublish(item, resolved.address, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n return { outcome: 'started' }\n }\n return { outcome: 'needs_deploy' }\n}\n"],"mappings":";;;;;sEAsBM,IACJ,+GAEI,IACJ;AAEF,SAAS,EACP,GACwC;CACnC,OAIL,OAHI,aAAkB,EAAO,SAAe,IACxC,EAAgB,CAAM,IAAU,EAAO,SACvC,EAAa,CAAM,IAAU,IAC1B,EAAoB,CAAiB,CAAC,CAAC;AAChD;AAMA,eAAsB,EACpB,GACA,GACA,GACA,GACkC;CAClC,IAAM,IAAS,EAAiB,GAC1B,IAAU,MAAM,EAAW;CACjC,IAAI,CAAC,KAAW,CAAC,EAAQ,KAAK,GAC5B,OAAO,EAAE,SAAS,aAAa;CAGjC,IAAI,EAAO,oBAAoB;EAC7B,IAAM,IAAiB,MAAM,EAA2B;EACxD,IAAI,CAAC,GACH,OAAO;GACL,SAAS;GACT,OAAO,IAAI,EAA2B,GAAwB,6BAA6B;EAC7F;EAGF,IAAI;EACJ,IAAI;GACF,IAAiB,MAAM,EAAkC,CAAe;EAC1E,SAAS,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAI,EACT,GACA,+BACA,KAAA,GACA,CACF;GACF;EACF;EAEA,IAAM,IAAS,EAAoB,CAAc;EAKjD,OAJA,EAAe,cAAc,GAAM,GAAgB,GAAQ;GACzD,GAAG;GACH,gBAAgB,EAAqB,GAAS,cAAc,KAAK,EAAO;EAC1E,CAAC,GACM,EAAE,SAAS,UAAU;CAC9B;CAEA,IAAM,IAAW,MAAM,EAA6B,KAAiB,IAAI;CACzE,IAAI,aAAa,GAAU;EACzB,IAAM,IAAS,EAAoB,EAAS,OAAO;EAKnD,OAJA,EAAe,cAAc,GAAM,EAAS,SAAS,GAAQ;GAC3D,GAAG;GACH,gBAAgB,EAAqB,GAAS,cAAc,KAAK,EAAO;EAC1E,CAAC,GACM,EAAE,SAAS,UAAU;CAC9B;CACA,OAAO,EAAE,SAAS,eAAe;AACnC"}
@@ -0,0 +1,47 @@
1
+ import { E as e, G as t, K as n, L as r, N as i, _ as a, c as o, kt as s, l as c } from "./ensureManagedAccountEasConfigured-DkRwHXL2.js";
2
+ import { t as l } from "./publishManager-luSstTr_.js";
3
+ import { optimismSepolia as u } from "thirdweb/chains";
4
+ import { ethers as d } from "ethers";
5
+ //#region src/helpers/ensureSmartWalletThenPublish.ts
6
+ var f = /* @__PURE__ */ s({ ensureSmartWalletThenPublish: () => g }), p = "A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.", m = "Could not connect the managed publishing account on Optimism Sepolia. Reconnect with the same sign-in method and try again.";
7
+ function h(e) {
8
+ if (e) return e instanceof d.Wallet ? e : t(e) ? e.signer : n(e) ? e : r(e).signer;
9
+ }
10
+ async function g(t, n, s, d) {
11
+ let f = i(), g = await s();
12
+ if (!g || !g.trim()) return { outcome: "no_address" };
13
+ if (f.useModularExecutor) {
14
+ let n = await c();
15
+ if (!n) return {
16
+ outcome: "managed_not_ready",
17
+ error: new e(p, "MANAGED_ACCOUNT_UNAVAILABLE")
18
+ };
19
+ let i;
20
+ try {
21
+ i = await o(u);
22
+ } catch (t) {
23
+ return {
24
+ outcome: "managed_not_ready",
25
+ error: new e(m, "MANAGED_ACCOUNT_UNAVAILABLE", void 0, t)
26
+ };
27
+ }
28
+ let a = r(n);
29
+ return l.createPublish(t, i, a, {
30
+ ...d,
31
+ dataItemSigner: h(d?.dataItemSigner) ?? a.signer
32
+ }), { outcome: "started" };
33
+ }
34
+ let _ = await a(n ?? null);
35
+ if ("address" in _) {
36
+ let e = r(_.account);
37
+ return l.createPublish(t, _.address, e, {
38
+ ...d,
39
+ dataItemSigner: h(d?.dataItemSigner) ?? e.signer
40
+ }), { outcome: "started" };
41
+ }
42
+ return { outcome: "needs_deploy" };
43
+ }
44
+ //#endregion
45
+ export { f as n, g as t };
46
+
47
+ //# sourceMappingURL=ensureSmartWalletThenPublish-CgCb9kZy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSmartWalletThenPublish-CgCb9kZy.js","names":[],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\nimport { optimismSepolia } from 'thirdweb/chains'\nimport {\n getConnectedManagedAccountAddress,\n getConnectedModularAccount,\n resolveSmartWalletForPublish,\n} from './thirdweb'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { isPublishWallet, isSeedSigner, type PublishWallet, type SeedSigner } from './seedSigner'\nimport { ethers } from 'ethers'\nimport { PublishManager } from '../services/publishManager'\nimport type { CreatePublishOptions } from '../config'\nimport { getPublishConfig } from '../config'\nimport { ManagedAccountPublishError } from '../errors'\n\nexport type EnsureSmartWalletResult =\n | { outcome: 'started' }\n | { outcome: 'no_address' }\n | { outcome: 'needs_deploy' }\n | { outcome: 'managed_not_ready'; error: ManagedAccountPublishError }\n\nconst MSG_NO_ACCOUNT_MODULAR =\n 'A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.'\n\nconst MSG_MANAGED_UNAVAILABLE =\n 'Could not connect the managed publishing account on Optimism Sepolia. Reconnect with the same sign-in method and try again.'\n\nfunction coerceDataItemSigner(\n signer: CreatePublishOptions['dataItemSigner'] | Account | SeedSigner | PublishWallet | undefined,\n): CreatePublishOptions['dataItemSigner'] {\n if (!signer) return undefined\n if (signer instanceof ethers.Wallet) return signer\n if (isPublishWallet(signer)) return signer.signer\n if (isSeedSigner(signer)) return signer\n return fromThirdwebAccount(signer as Account).signer\n}\n\n/**\n * Thirdweb path: resolves the smart wallet for the current account; if deployed, starts publish.\n * Prefer {@link ensureWalletThenPublish} for vendor-neutral entry.\n */\nexport async function ensureSmartWalletThenPublish(\n item: Item<any>,\n activeAccount: Account | null | undefined,\n getAddress: () => Promise<string | null>,\n options?: CreatePublishOptions,\n): Promise<EnsureSmartWalletResult> {\n const config = getPublishConfig()\n const address = await getAddress()\n if (!address || !address.trim()) {\n return { outcome: 'no_address' }\n }\n\n if (config.useModularExecutor) {\n const modularAccount = await getConnectedModularAccount()\n if (!modularAccount) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(MSG_NO_ACCOUNT_MODULAR, 'MANAGED_ACCOUNT_UNAVAILABLE'),\n }\n }\n\n let managedAddress: string\n try {\n managedAddress = await getConnectedManagedAccountAddress(optimismSepolia)\n } catch (cause) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(\n MSG_MANAGED_UNAVAILABLE,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n undefined,\n cause,\n ),\n }\n }\n\n const wallet = fromThirdwebAccount(modularAccount)\n PublishManager.createPublish(item, managedAddress, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n return { outcome: 'started' }\n }\n\n const resolved = await resolveSmartWalletForPublish(activeAccount ?? null)\n if ('address' in resolved) {\n const wallet = fromThirdwebAccount(resolved.account)\n PublishManager.createPublish(item, resolved.address, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n return { outcome: 'started' }\n }\n return { outcome: 'needs_deploy' }\n}\n"],"mappings":";;;;;sEAsBM,IACJ,+GAEI,IACJ;AAEF,SAAS,EACP,GACwC;CACnC,OAIL,OAHI,aAAkB,EAAO,SAAe,IACxC,EAAgB,CAAM,IAAU,EAAO,SACvC,EAAa,CAAM,IAAU,IAC1B,EAAoB,CAAiB,EAAE;AAChD;AAMA,eAAsB,EACpB,GACA,GACA,GACA,GACkC;CAClC,IAAM,IAAS,EAAiB,GAC1B,IAAU,MAAM,EAAW;CACjC,IAAI,CAAC,KAAW,CAAC,EAAQ,KAAK,GAC5B,OAAO,EAAE,SAAS,aAAa;CAGjC,IAAI,EAAO,oBAAoB;EAC7B,IAAM,IAAiB,MAAM,EAA2B;EACxD,IAAI,CAAC,GACH,OAAO;GACL,SAAS;GACT,OAAO,IAAI,EAA2B,GAAwB,6BAA6B;EAC7F;EAGF,IAAI;EACJ,IAAI;GACF,IAAiB,MAAM,EAAkC,CAAe;EAC1E,SAAS,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAI,EACT,GACA,+BACA,KAAA,GACA,CACF;GACF;EACF;EAEA,IAAM,IAAS,EAAoB,CAAc;EAKjD,OAJA,EAAe,cAAc,GAAM,GAAgB,GAAQ;GACzD,GAAG;GACH,gBAAgB,EAAqB,GAAS,cAAc,KAAK,EAAO;EAC1E,CAAC,GACM,EAAE,SAAS,UAAU;CAC9B;CAEA,IAAM,IAAW,MAAM,EAA6B,KAAiB,IAAI;CACzE,IAAI,aAAa,GAAU;EACzB,IAAM,IAAS,EAAoB,EAAS,OAAO;EAKnD,OAJA,EAAe,cAAc,GAAM,EAAS,SAAS,GAAQ;GAC3D,GAAG;GACH,gBAAgB,EAAqB,GAAS,cAAc,KAAK,EAAO;EAC1E,CAAC,GACM,EAAE,SAAS,UAAU;CAC9B;CACA,OAAO,EAAE,SAAS,eAAe;AACnC"}
@@ -0,0 +1,48 @@
1
+ import { g as e, h as t, nt as n, r, s as i } from "./config-DLoMtwmG.js";
2
+ import { r as a } from "./errors-Du3LNbJN.js";
3
+ import { L as o, O as s, h as c, k as l } from "./publishAuthorization-CSyAV8Hf.js";
4
+ import { optimismSepolia as u } from "thirdweb/chains";
5
+ import { ethers as d } from "ethers";
6
+ //#region src/helpers/ensureSmartWalletThenPublish.ts
7
+ var f = /* @__PURE__ */ n({ ensureSmartWalletThenPublish: () => g }), p = "A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.", m = "Could not connect the managed publishing account on Optimism Sepolia. Reconnect with the same sign-in method and try again.";
8
+ function h(n) {
9
+ if (n) return n instanceof d.Wallet ? n : t(n) ? n.signer : e(n) ? n : i(n).signer;
10
+ }
11
+ async function g(e, t, n, d) {
12
+ let f = r(), g = await n();
13
+ if (!g || !g.trim()) return { outcome: "no_address" };
14
+ if (f.useModularExecutor) {
15
+ let t = await l();
16
+ if (!t) return {
17
+ outcome: "managed_not_ready",
18
+ error: new a(p, "MANAGED_ACCOUNT_UNAVAILABLE")
19
+ };
20
+ let n;
21
+ try {
22
+ n = await s(u);
23
+ } catch (e) {
24
+ return {
25
+ outcome: "managed_not_ready",
26
+ error: new a(m, "MANAGED_ACCOUNT_UNAVAILABLE", void 0, e)
27
+ };
28
+ }
29
+ let r = i(t);
30
+ return c.createPublish(e, n, r, {
31
+ ...d,
32
+ dataItemSigner: h(d?.dataItemSigner) ?? r.signer
33
+ }), { outcome: "started" };
34
+ }
35
+ let _ = await o(t ?? null);
36
+ if ("address" in _) {
37
+ let t = i(_.account);
38
+ return c.createPublish(e, _.address, t, {
39
+ ...d,
40
+ dataItemSigner: h(d?.dataItemSigner) ?? t.signer
41
+ }), { outcome: "started" };
42
+ }
43
+ return { outcome: "needs_deploy" };
44
+ }
45
+ //#endregion
46
+ export { f as n, g as t };
47
+
48
+ //# sourceMappingURL=ensureSmartWalletThenPublish-Ch7BST2M.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSmartWalletThenPublish-Ch7BST2M.js","names":[],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\nimport { optimismSepolia } from 'thirdweb/chains'\nimport {\n getConnectedManagedAccountAddress,\n getConnectedModularAccount,\n resolveSmartWalletForPublish,\n} from './thirdweb'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { isPublishWallet, isSeedSigner, type PublishWallet, type SeedSigner } from './seedSigner'\nimport { ethers } from 'ethers'\nimport { PublishManager } from '../services/publishManager'\nimport type { CreatePublishOptions } from '../config'\nimport { getPublishConfig } from '../config'\nimport { ManagedAccountPublishError } from '../errors'\n\nexport type EnsureSmartWalletResult =\n | { outcome: 'started' }\n | { outcome: 'no_address' }\n | { outcome: 'needs_deploy' }\n | { outcome: 'managed_not_ready'; error: ManagedAccountPublishError }\n\nconst MSG_NO_ACCOUNT_MODULAR =\n 'A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.'\n\nconst MSG_MANAGED_UNAVAILABLE =\n 'Could not connect the managed publishing account on Optimism Sepolia. Reconnect with the same sign-in method and try again.'\n\nfunction coerceDataItemSigner(\n signer: CreatePublishOptions['dataItemSigner'] | Account | SeedSigner | PublishWallet | undefined,\n): CreatePublishOptions['dataItemSigner'] {\n if (!signer) return undefined\n if (signer instanceof ethers.Wallet) return signer\n if (isPublishWallet(signer)) return signer.signer\n if (isSeedSigner(signer)) return signer\n return fromThirdwebAccount(signer as Account).signer\n}\n\n/**\n * Thirdweb path: resolves the smart wallet for the current account; if deployed, starts publish.\n * Prefer {@link ensureWalletThenPublish} for vendor-neutral entry.\n */\nexport async function ensureSmartWalletThenPublish(\n item: Item<any>,\n activeAccount: Account | null | undefined,\n getAddress: () => Promise<string | null>,\n options?: CreatePublishOptions,\n): Promise<EnsureSmartWalletResult> {\n const config = getPublishConfig()\n const address = await getAddress()\n if (!address || !address.trim()) {\n return { outcome: 'no_address' }\n }\n\n if (config.useModularExecutor) {\n const modularAccount = await getConnectedModularAccount()\n if (!modularAccount) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(MSG_NO_ACCOUNT_MODULAR, 'MANAGED_ACCOUNT_UNAVAILABLE'),\n }\n }\n\n let managedAddress: string\n try {\n managedAddress = await getConnectedManagedAccountAddress(optimismSepolia)\n } catch (cause) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(\n MSG_MANAGED_UNAVAILABLE,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n undefined,\n cause,\n ),\n }\n }\n\n const wallet = fromThirdwebAccount(modularAccount)\n PublishManager.createPublish(item, managedAddress, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n return { outcome: 'started' }\n }\n\n const resolved = await resolveSmartWalletForPublish(activeAccount ?? null)\n if ('address' in resolved) {\n const wallet = fromThirdwebAccount(resolved.account)\n PublishManager.createPublish(item, resolved.address, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n return { outcome: 'started' }\n }\n return { outcome: 'needs_deploy' }\n}\n"],"mappings":";;;;;;sEAsBM,IACJ,+GAEI,IACJ;AAEF,SAAS,EACP,GACwC;CACnC,OAIL,OAHI,aAAkB,EAAO,SAAe,IACxC,EAAgB,CAAM,IAAU,EAAO,SACvC,EAAa,CAAM,IAAU,IAC1B,EAAoB,CAAiB,CAAC,CAAC;AAChD;AAMA,eAAsB,EACpB,GACA,GACA,GACA,GACkC;CAClC,IAAM,IAAS,EAAiB,GAC1B,IAAU,MAAM,EAAW;CACjC,IAAI,CAAC,KAAW,CAAC,EAAQ,KAAK,GAC5B,OAAO,EAAE,SAAS,aAAa;CAGjC,IAAI,EAAO,oBAAoB;EAC7B,IAAM,IAAiB,MAAM,EAA2B;EACxD,IAAI,CAAC,GACH,OAAO;GACL,SAAS;GACT,OAAO,IAAI,EAA2B,GAAwB,6BAA6B;EAC7F;EAGF,IAAI;EACJ,IAAI;GACF,IAAiB,MAAM,EAAkC,CAAe;EAC1E,SAAS,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAI,EACT,GACA,+BACA,KAAA,GACA,CACF;GACF;EACF;EAEA,IAAM,IAAS,EAAoB,CAAc;EAKjD,OAJA,EAAe,cAAc,GAAM,GAAgB,GAAQ;GACzD,GAAG;GACH,gBAAgB,EAAqB,GAAS,cAAc,KAAK,EAAO;EAC1E,CAAC,GACM,EAAE,SAAS,UAAU;CAC9B;CAEA,IAAM,IAAW,MAAM,EAA6B,KAAiB,IAAI;CACzE,IAAI,aAAa,GAAU;EACzB,IAAM,IAAS,EAAoB,EAAS,OAAO;EAKnD,OAJA,EAAe,cAAc,GAAM,EAAS,SAAS,GAAQ;GAC3D,GAAG;GACH,gBAAgB,EAAqB,GAAS,cAAc,KAAK,EAAO;EAC1E,CAAC,GACM,EAAE,SAAS,UAAU;CAC9B;CACA,OAAO,EAAE,SAAS,eAAe;AACnC"}
@@ -0,0 +1,48 @@
1
+ import { g as e, h as t, nt as n, r, s as i } from "./config-BBL0ILr9.js";
2
+ import { r as a } from "./errors-Du3LNbJN.js";
3
+ import { A as o, R as s, h as c, k as l } from "./publishAuthorization-9WO-Zbcj.js";
4
+ import { optimismSepolia as u } from "thirdweb/chains";
5
+ import { ethers as d } from "ethers";
6
+ //#region src/helpers/ensureSmartWalletThenPublish.ts
7
+ var f = /* @__PURE__ */ n({ ensureSmartWalletThenPublish: () => g }), p = "A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.", m = "Could not connect the managed publishing account on Optimism Sepolia. Reconnect with the same sign-in method and try again.";
8
+ function h(n) {
9
+ if (n) return n instanceof d.Wallet ? n : t(n) ? n.signer : e(n) ? n : i(n).signer;
10
+ }
11
+ async function g(e, t, n, d) {
12
+ let f = r(), g = await n();
13
+ if (!g || !g.trim()) return { outcome: "no_address" };
14
+ if (f.useModularExecutor) {
15
+ let t = await o();
16
+ if (!t) return {
17
+ outcome: "managed_not_ready",
18
+ error: new a(p, "MANAGED_ACCOUNT_UNAVAILABLE")
19
+ };
20
+ let n;
21
+ try {
22
+ n = await l(u);
23
+ } catch (e) {
24
+ return {
25
+ outcome: "managed_not_ready",
26
+ error: new a(m, "MANAGED_ACCOUNT_UNAVAILABLE", void 0, e)
27
+ };
28
+ }
29
+ let r = i(t);
30
+ return c.createPublish(e, n, r, {
31
+ ...d,
32
+ dataItemSigner: h(d?.dataItemSigner) ?? r.signer
33
+ }), { outcome: "started" };
34
+ }
35
+ let _ = await s(t ?? null);
36
+ if ("address" in _) {
37
+ let t = i(_.account);
38
+ return c.createPublish(e, _.address, t, {
39
+ ...d,
40
+ dataItemSigner: h(d?.dataItemSigner) ?? t.signer
41
+ }), { outcome: "started" };
42
+ }
43
+ return { outcome: "needs_deploy" };
44
+ }
45
+ //#endregion
46
+ export { f as n, g as t };
47
+
48
+ //# sourceMappingURL=ensureSmartWalletThenPublish-s7MBAeky.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSmartWalletThenPublish-s7MBAeky.js","names":[],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\nimport { optimismSepolia } from 'thirdweb/chains'\nimport {\n getConnectedManagedAccountAddress,\n getConnectedModularAccount,\n resolveSmartWalletForPublish,\n} from './thirdweb'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { isPublishWallet, isSeedSigner, type PublishWallet, type SeedSigner } from './seedSigner'\nimport { ethers } from 'ethers'\nimport { PublishManager } from '../services/publishManager'\nimport type { CreatePublishOptions } from '../config'\nimport { getPublishConfig } from '../config'\nimport { ManagedAccountPublishError } from '../errors'\n\nexport type EnsureSmartWalletResult =\n | { outcome: 'started' }\n | { outcome: 'no_address' }\n | { outcome: 'needs_deploy' }\n | { outcome: 'managed_not_ready'; error: ManagedAccountPublishError }\n\nconst MSG_NO_ACCOUNT_MODULAR =\n 'A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.'\n\nconst MSG_MANAGED_UNAVAILABLE =\n 'Could not connect the managed publishing account on Optimism Sepolia. Reconnect with the same sign-in method and try again.'\n\nfunction coerceDataItemSigner(\n signer: CreatePublishOptions['dataItemSigner'] | Account | SeedSigner | PublishWallet | undefined,\n): CreatePublishOptions['dataItemSigner'] {\n if (!signer) return undefined\n if (signer instanceof ethers.Wallet) return signer\n if (isPublishWallet(signer)) return signer.signer\n if (isSeedSigner(signer)) return signer\n return fromThirdwebAccount(signer as Account).signer\n}\n\n/**\n * Thirdweb path: resolves the smart wallet for the current account; if deployed, starts publish.\n * Prefer {@link ensureWalletThenPublish} for vendor-neutral entry.\n */\nexport async function ensureSmartWalletThenPublish(\n item: Item<any>,\n activeAccount: Account | null | undefined,\n getAddress: () => Promise<string | null>,\n options?: CreatePublishOptions,\n): Promise<EnsureSmartWalletResult> {\n const config = getPublishConfig()\n const address = await getAddress()\n if (!address || !address.trim()) {\n return { outcome: 'no_address' }\n }\n\n if (config.useModularExecutor) {\n const modularAccount = await getConnectedModularAccount()\n if (!modularAccount) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(MSG_NO_ACCOUNT_MODULAR, 'MANAGED_ACCOUNT_UNAVAILABLE'),\n }\n }\n\n let managedAddress: string\n try {\n managedAddress = await getConnectedManagedAccountAddress(optimismSepolia)\n } catch (cause) {\n return {\n outcome: 'managed_not_ready',\n error: new ManagedAccountPublishError(\n MSG_MANAGED_UNAVAILABLE,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n undefined,\n cause,\n ),\n }\n }\n\n const wallet = fromThirdwebAccount(modularAccount)\n PublishManager.createPublish(item, managedAddress, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n return { outcome: 'started' }\n }\n\n const resolved = await resolveSmartWalletForPublish(activeAccount ?? null)\n if ('address' in resolved) {\n const wallet = fromThirdwebAccount(resolved.account)\n PublishManager.createPublish(item, resolved.address, wallet, {\n ...options,\n dataItemSigner: coerceDataItemSigner(options?.dataItemSigner) ?? wallet.signer,\n })\n return { outcome: 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seedLocalId;
4
+ expectedSchemas;
5
+ foundSchemas;
6
+ code;
7
+ constructor(e, t, n, r, i = "METADATA_PROPERTIES_MISSING") {
8
+ super(e), this.seedLocalId = t, this.expectedSchemas = n, this.foundSchemas = r, this.code = i, this.name = "AttestationVerificationError";
9
+ }
10
+ };
11
+ function t(e, t = 700) {
12
+ if (e == null) return "";
13
+ if (e instanceof Error) {
14
+ let n = e.cause instanceof Error ? ` | cause: ${e.cause.message}` : "";
15
+ return (e.message + n).slice(0, t);
16
+ }
17
+ if (typeof e == "object") {
18
+ let n = e, r = [];
19
+ if (typeof n.message == "string" && r.push(n.message), typeof n.shortMessage == "string" && r.push(n.shortMessage), typeof n.details == "string" && r.push(n.details), typeof n.reason == "string" && r.push(n.reason), r.length) return r.join(" | ").slice(0, t);
20
+ try {
21
+ return JSON.stringify(e).slice(0, t);
22
+ } catch {
23
+ return String(e).slice(0, t);
24
+ }
25
+ }
26
+ return String(e).slice(0, t);
27
+ }
28
+ var n = class extends Error {
29
+ code;
30
+ managedAddress;
31
+ underlyingCause;
32
+ constructor(e, n, r, i) {
33
+ let a = i != null && i !== "" ? ` (${t(i)})` : "";
34
+ super(e + a), this.code = n, this.managedAddress = r, this.name = "ManagedAccountPublishError", this.underlyingCause = i;
35
+ }
36
+ };
37
+ function r(e) {
38
+ if (e instanceof n) return !0;
39
+ if (typeof e != "object" || !e) return !1;
40
+ let t = e;
41
+ return t.name === "ManagedAccountPublishError" && typeof t.code == "string";
42
+ }
43
+ var i = class extends Error {
44
+ code;
45
+ modularAddress;
46
+ underlyingCause;
47
+ constructor(e, n, r, i) {
48
+ let a = i != null && i !== "" ? ` (${t(i)})` : "";
49
+ super(e + a), this.code = n, this.modularAddress = r, this.name = "Eip7702ModularAccountPublishError", this.underlyingCause = i;
50
+ }
51
+ }, a = [
52
+ "EIP7702_MODULAR_ACCOUNT_UNAVAILABLE",
53
+ "EIP7702_MODULAR_NOT_UPGRADED",
54
+ "EIP7702_MODULAR_DEPLOY_FAILED",
55
+ "EIP7702_MODULAR_NOT_CONFIRMED"
56
+ ];
57
+ function o(e) {
58
+ if (e instanceof i) return !0;
59
+ if (typeof e != "object" || !e) return !1;
60
+ let t = e;
61
+ return t.name === "Eip7702ModularAccountPublishError" && typeof t.code == "string" && a.includes(t.code);
62
+ }
63
+ function s(e) {
64
+ let n = t(e);
65
+ return !!(/Router:\s*function does not exist/i.test(n) || /Cannot decode zero data\s*\(\s*["']0x["']\s*\)/i.test(n));
66
+ }
67
+ //#endregion
68
+ export { r as a, o as i, i as n, s as o, n as r, t as s, e as t };
69
+
70
+ //# sourceMappingURL=errors-Du3LNbJN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-Du3LNbJN.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["export class AttestationVerificationError extends Error {\n constructor(\n message: string,\n public readonly seedLocalId: string,\n public readonly expectedSchemas: string[],\n public readonly foundSchemas: string[],\n public readonly code: 'METADATA_PROPERTIES_MISSING' = 'METADATA_PROPERTIES_MISSING',\n ) {\n super(message)\n this.name = 'AttestationVerificationError'\n }\n}\n\nexport type ManagedAccountPublishErrorCode =\n | 'MANAGED_ACCOUNT_NOT_DEPLOYED'\n | 'MANAGED_ACCOUNT_UNAVAILABLE'\n | 'EXECUTOR_MODULE_NOT_INSTALLED'\n | 'MANAGED_ACCOUNT_SET_EAS_FAILED'\n | 'MODULAR_SIGNER_ACTIVATION_FAILED'\n\n/**\n * Best-effort string for RPC / thirdweb / viem failures that are not plain `Error`\n * (so logs and UIs can show the real revert or RPC reason).\n */\nexport function stringifyUnderlyingCause(u: unknown, maxLen = 700): string {\n if (u == null) return ''\n if (u instanceof Error) {\n const nested = u.cause instanceof Error ? ` | cause: ${u.cause.message}` : ''\n return (u.message + nested).slice(0, maxLen)\n }\n if (typeof u === 'object') {\n const o = u as Record<string, unknown>\n const parts: string[] = []\n if (typeof o.message === 'string') parts.push(o.message)\n if (typeof o.shortMessage === 'string') parts.push(o.shortMessage)\n if (typeof o.details === 'string') parts.push(o.details)\n if (typeof o.reason === 'string') parts.push(o.reason)\n if (parts.length) return parts.join(' | ').slice(0, maxLen)\n try {\n return JSON.stringify(u).slice(0, maxLen)\n } catch {\n return String(u).slice(0, maxLen)\n }\n }\n return String(u).slice(0, maxLen)\n}\n\n/**\n * Thrown or returned when the managed publishing account (Optimism Sepolia) is missing,\n * unreachable, missing the executor module for the modular executor path, or EAS\n * pointer setup (`getEas` / `setEas`) fails, or modular session-signer activation fails.\n */\nexport class ManagedAccountPublishError extends Error {\n /** Original error when connection or deployment failed (avoids shadowing `Error.cause`). */\n public readonly underlyingCause?: unknown\n\n constructor(\n message: string,\n public readonly code: ManagedAccountPublishErrorCode,\n public readonly managedAddress?: string,\n underlyingCause?: unknown,\n ) {\n const extra =\n underlyingCause != null && underlyingCause !== ''\n ? ` (${stringifyUnderlyingCause(underlyingCause)})`\n : ''\n super(message + extra)\n this.name = 'ManagedAccountPublishError'\n this.underlyingCause = underlyingCause\n }\n}\n\n/**\n * True when `e` is a managed-account publish error. Uses `name` + `code` as a fallback\n * when `instanceof` fails across duplicate bundled class identities.\n */\nexport function isManagedAccountPublishError(e: unknown): e is ManagedAccountPublishError {\n if (e instanceof ManagedAccountPublishError) return true\n if (typeof e !== 'object' || e === null) return false\n const o = e as { name?: string; code?: unknown }\n return o.name === 'ManagedAccountPublishError' && typeof o.code === 'string'\n}\n\nexport type Eip7702ModularAccountPublishErrorCode =\n | 'EIP7702_MODULAR_ACCOUNT_UNAVAILABLE'\n | 'EIP7702_MODULAR_NOT_UPGRADED'\n | 'EIP7702_MODULAR_DEPLOY_FAILED'\n | 'EIP7702_MODULAR_NOT_CONFIRMED'\n\n/**\n * Thrown when the in-app modular (EIP-7702) wallet is missing, not upgraded on-chain, or deploy/bootstrap failed.\n */\nexport class Eip7702ModularAccountPublishError extends Error {\n public readonly underlyingCause?: unknown\n\n constructor(\n message: string,\n public readonly code: Eip7702ModularAccountPublishErrorCode,\n public readonly modularAddress?: string,\n underlyingCause?: unknown,\n ) {\n const extra =\n underlyingCause != null && underlyingCause !== ''\n ? ` (${stringifyUnderlyingCause(underlyingCause)})`\n : ''\n super(message + extra)\n this.name = 'Eip7702ModularAccountPublishError'\n this.underlyingCause = underlyingCause\n }\n}\n\nconst eip7702ModularCodes: Eip7702ModularAccountPublishErrorCode[] = [\n 'EIP7702_MODULAR_ACCOUNT_UNAVAILABLE',\n 'EIP7702_MODULAR_NOT_UPGRADED',\n 'EIP7702_MODULAR_DEPLOY_FAILED',\n 'EIP7702_MODULAR_NOT_CONFIRMED',\n]\n\nexport function isEip7702ModularAccountPublishError(e: unknown): e is Eip7702ModularAccountPublishError {\n if (e instanceof Eip7702ModularAccountPublishError) return true\n if (typeof e !== 'object' || e === null) return false\n const o = e as { name?: string; code?: unknown }\n return (\n o.name === 'Eip7702ModularAccountPublishError' &&\n typeof o.code === 'string' &&\n (eip7702ModularCodes as string[]).includes(o.code)\n )\n}\n\n/**\n * True when the RPC/contract error indicates the account is **not** Thirdweb ModularCore\n * (no Router / `getInstalledModules`), e.g. default EIP-4337 smart accounts.\n * Includes viem \"Cannot decode zero data\" when `eth_call` returns `0x` for a missing Router view.\n */\nexport function isRouterNonModularCoreAccountError(cause: unknown): boolean {\n const msg = stringifyUnderlyingCause(cause)\n if (/Router:\\s*function does not exist/i.test(msg)) return true\n if (/Cannot decode zero data\\s*\\(\\s*[\"']0x[\"']\\s*\\)/i.test(msg)) return true\n return false\n}\n"],"mappings":";AAAA,IAAa,IAAb,cAAkD,MAAM;CAGpC;CACA;CACA;CACA;CALlB,YACE,GACA,GACA,GACA,GACA,IAAsD,+BACtD;EAEA,AADA,MAAM,CAAO,GALG,KAAA,cAAA,GACA,KAAA,kBAAA,GACA,KAAA,eAAA,GACA,KAAA,OAAA,GAGhB,KAAK,OAAO;CACd;AACF;AAaA,SAAgB,EAAyB,GAAY,IAAS,KAAa;CACzE,IAAI,KAAK,MAAM,OAAO;CACtB,IAAI,aAAa,OAAO;EACtB,IAAM,IA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