@seedprotocol/publish 0.7.1 → 0.7.2-next.593.gd5bd4ea

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 (91) hide show
  1. package/package.json +10 -5
  2. package/dist/chainConfig-BJ8C_RRz.js +0 -1455
  3. package/dist/chainConfig-BJ8C_RRz.js.map +0 -1
  4. package/dist/chainConfig-DWynbnb8.js +0 -1455
  5. package/dist/chainConfig-DWynbnb8.js.map +0 -1
  6. package/dist/chainConfig-DWzoOtkS.js +0 -1453
  7. package/dist/chainConfig-DWzoOtkS.js.map +0 -1
  8. package/dist/chainConfig-DXCcqaAs.js +0 -1455
  9. package/dist/chainConfig-DXCcqaAs.js.map +0 -1
  10. package/dist/chainConfig-DmuPBs3D.js +0 -1455
  11. package/dist/chainConfig-DmuPBs3D.js.map +0 -1
  12. package/dist/ensureAutomationSessionKey-BVmh030S.js +0 -84
  13. package/dist/ensureAutomationSessionKey-BVmh030S.js.map +0 -1
  14. package/dist/ensureAutomationSessionKey-ClCkti9-.js +0 -84
  15. package/dist/ensureAutomationSessionKey-ClCkti9-.js.map +0 -1
  16. package/dist/ensureAutomationSessionKey-CxpJY_uH.js +0 -84
  17. package/dist/ensureAutomationSessionKey-CxpJY_uH.js.map +0 -1
  18. package/dist/ensureAutomationSessionKey-DwRm4YMJ.js +0 -84
  19. package/dist/ensureAutomationSessionKey-DwRm4YMJ.js.map +0 -1
  20. package/dist/ensureAutomationSessionKey-h3zOmDr5.js +0 -84
  21. package/dist/ensureAutomationSessionKey-h3zOmDr5.js.map +0 -1
  22. package/dist/ensureModularPublishBootstrap-BImiIFJe.js +0 -23
  23. package/dist/ensureModularPublishBootstrap-BImiIFJe.js.map +0 -1
  24. package/dist/ensureModularPublishBootstrap-CmxyX_EN.js +0 -23
  25. package/dist/ensureModularPublishBootstrap-CmxyX_EN.js.map +0 -1
  26. package/dist/ensureModularPublishBootstrap-DRFhp-O2.js +0 -23
  27. package/dist/ensureModularPublishBootstrap-DRFhp-O2.js.map +0 -1
  28. package/dist/ensureModularPublishBootstrap-DegJnYKL.js +0 -23
  29. package/dist/ensureModularPublishBootstrap-DegJnYKL.js.map +0 -1
  30. package/dist/ensureModularPublishBootstrap-E4l8no0p.js +0 -23
  31. package/dist/ensureModularPublishBootstrap-E4l8no0p.js.map +0 -1
  32. package/dist/ensureSmartWalletThenPublish-0nKg13WN.js +0 -47
  33. package/dist/ensureSmartWalletThenPublish-0nKg13WN.js.map +0 -1
  34. package/dist/ensureSmartWalletThenPublish-BdqeUL6t.js +0 -47
  35. package/dist/ensureSmartWalletThenPublish-BdqeUL6t.js.map +0 -1
  36. package/dist/ensureSmartWalletThenPublish-BfEndtFo.js +0 -47
  37. package/dist/ensureSmartWalletThenPublish-BfEndtFo.js.map +0 -1
  38. package/dist/ensureSmartWalletThenPublish-DuOYPJFd.js +0 -47
  39. package/dist/ensureSmartWalletThenPublish-DuOYPJFd.js.map +0 -1
  40. package/dist/ensureSmartWalletThenPublish-UklyVBu9.js +0 -47
  41. package/dist/ensureSmartWalletThenPublish-UklyVBu9.js.map +0 -1
  42. package/dist/managedAccountAdmin-B4HkLWWE.js +0 -28
  43. package/dist/managedAccountAdmin-B4HkLWWE.js.map +0 -1
  44. package/dist/managedAccountAdmin-ByEX_Eg2.js +0 -28
  45. package/dist/managedAccountAdmin-ByEX_Eg2.js.map +0 -1
  46. package/dist/managedAccountAdmin-C5UqbkQ0.js +0 -28
  47. package/dist/managedAccountAdmin-C5UqbkQ0.js.map +0 -1
  48. package/dist/managedAccountAdmin-DS6nniiu.js +0 -28
  49. package/dist/managedAccountAdmin-DS6nniiu.js.map +0 -1
  50. package/dist/managedAccountAdmin-DwFI-ZfE.js +0 -28
  51. package/dist/managedAccountAdmin-DwFI-ZfE.js.map +0 -1
  52. package/dist/publishAuthorization-C-XYb9Ef.js +0 -4034
  53. package/dist/publishAuthorization-C-XYb9Ef.js.map +0 -1
  54. package/dist/publishAuthorization-CG23g8w2.js +0 -3987
  55. package/dist/publishAuthorization-CG23g8w2.js.map +0 -1
  56. package/dist/publishAuthorization-CvK_coYp.js +0 -4011
  57. package/dist/publishAuthorization-CvK_coYp.js.map +0 -1
  58. package/dist/publishAuthorization-DgDI4zor.js +0 -4011
  59. package/dist/publishAuthorization-DgDI4zor.js.map +0 -1
  60. package/dist/publishAuthorization-S3ofoXPN.js +0 -4059
  61. package/dist/publishAuthorization-S3ofoXPN.js.map +0 -1
  62. package/dist/publishThirdwebClient-BFx_M2Uy.js +0 -18
  63. package/dist/publishThirdwebClient-BFx_M2Uy.js.map +0 -1
  64. package/dist/publishThirdwebClient-BQ_KnMi5.js +0 -18
  65. package/dist/publishThirdwebClient-BQ_KnMi5.js.map +0 -1
  66. package/dist/publishThirdwebClient-BmqsJCjp.js +0 -18
  67. package/dist/publishThirdwebClient-BmqsJCjp.js.map +0 -1
  68. package/dist/publishThirdwebClient-CO18ST7C.js +0 -18
  69. package/dist/publishThirdwebClient-CO18ST7C.js.map +0 -1
  70. package/dist/publishThirdwebClient-D-K2WEeM.js +0 -18
  71. package/dist/publishThirdwebClient-D-K2WEeM.js.map +0 -1
  72. package/dist/resolveRevokeAccount-9-OzXVdp.js +0 -38
  73. package/dist/resolveRevokeAccount-9-OzXVdp.js.map +0 -1
  74. package/dist/resolveRevokeAccount-CXTz4-wI.js +0 -38
  75. package/dist/resolveRevokeAccount-CXTz4-wI.js.map +0 -1
  76. package/dist/resolveRevokeAccount-CXa5XlOv.js +0 -38
  77. package/dist/resolveRevokeAccount-CXa5XlOv.js.map +0 -1
  78. package/dist/resolveRevokeAccount-DsNod8ti.js +0 -38
  79. package/dist/resolveRevokeAccount-DsNod8ti.js.map +0 -1
  80. package/dist/resolveRevokeAccount-QgZ6YZuS.js +0 -38
  81. package/dist/resolveRevokeAccount-QgZ6YZuS.js.map +0 -1
  82. package/dist/worker-BQN6N0W0.js +0 -72
  83. package/dist/worker-BQN6N0W0.js.map +0 -1
  84. package/dist/worker-CJRUAOAn.js +0 -69
  85. package/dist/worker-CJRUAOAn.js.map +0 -1
  86. package/dist/worker-CN7zg73B.js +0 -69
  87. package/dist/worker-CN7zg73B.js.map +0 -1
  88. package/dist/worker-FmHZbku5.js +0 -72
  89. package/dist/worker-FmHZbku5.js.map +0 -1
  90. package/dist/worker-qoGuo876.js +0 -69
  91. package/dist/worker-qoGuo876.js.map +0 -1
@@ -1,84 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { ct as t, dt as n, mt as r, t as i, tt as a, ut as o, y as s } from "./chainConfig-BJ8C_RRz.js";
3
- import { M as c, d as l, p as u } from "./publishAuthorization-CvK_coYp.js";
4
- import { t as d } from "./publishThirdwebClient-D-K2WEeM.js";
5
- import { getContract as f, sendTransaction as p } from "thirdweb";
6
- import { addSessionKey as m, removeSessionKey as h, shouldUpdateSessionKey as g } from "thirdweb/extensions/erc4337";
7
- //#region src/helpers/ensureAutomationSessionKey.ts
8
- var _ = /* @__PURE__ */ e({
9
- ensureAutomationSessionKey: () => S,
10
- isAutomationSessionActive: () => w,
11
- removeAutomationSessionKey: () => C
12
- }), v = () => `Could not connect the managed publishing account to authorize an automation session key on ${i()}. Reconnect and try again.`, y = () => `Could not authorize the automation session key on your publishing account on ${i()}.`, b = () => `Could not remove the automation session key from your publishing account on ${i()}.`;
13
- async function x(e) {
14
- let t = c();
15
- await t.autoConnect({
16
- client: d(),
17
- chain: s()
18
- });
19
- let n = t.getAccount();
20
- if (!n) throw new r(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", e);
21
- return n;
22
- }
23
- async function S(e) {
24
- let { managedAddress: t, sessionKeyAddress: i, expiresAt: a } = e, c = await x(t), h = f({
25
- client: d(),
26
- chain: s(),
27
- address: t
28
- }), _ = u(l({ expiresAt: a })), v = !1;
29
- try {
30
- v = await g({
31
- accountContract: h,
32
- sessionKeyAddress: i,
33
- newPermissions: _
34
- });
35
- } catch (e) {
36
- throw new r(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
37
- }
38
- if (v) try {
39
- let e = m({
40
- contract: h,
41
- account: c,
42
- sessionKeyAddress: i,
43
- permissions: _
44
- }), t = await p({
45
- account: c,
46
- transaction: e
47
- });
48
- await n(t.transactionHash);
49
- } catch (e) {
50
- throw new r(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
51
- }
52
- if (!await o(() => w(t, i), Boolean, { attempts: v ? 5 : 1 })) throw new r(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
53
- }
54
- async function C(e) {
55
- let { managedAddress: t, sessionKeyAddress: i } = e, a = await x(t), o = f({
56
- client: d(),
57
- chain: s(),
58
- address: t
59
- });
60
- try {
61
- let e = h({
62
- contract: o,
63
- account: a,
64
- sessionKeyAddress: i
65
- }), t = await p({
66
- account: a,
67
- transaction: e
68
- });
69
- await n(t.transactionHash);
70
- } catch (e) {
71
- throw new r(b(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
72
- }
73
- }
74
- async function w(e, n) {
75
- try {
76
- return await t(e) ? await a(e, n) : !1;
77
- } catch (t) {
78
- throw new r(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", e, t);
79
- }
80
- }
81
- //#endregion
82
- export { C as i, _ as n, w as r, S as t };
83
-
84
- //# sourceMappingURL=ensureAutomationSessionKey-DwRm4YMJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureAutomationSessionKey-DwRm4YMJ.js","names":[],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, readUntil, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n // Right after addSessionKey, a lagging RPC node can still report the key inactive.\n const active = await readUntil(\n () => isAutomationSessionActive(managedAddress, sessionKeyAddress),\n Boolean,\n { attempts: shouldUpdate ? 5 : 1 },\n )\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;IAkBM,UACJ,8FAA8F,EAAoB,EAAE,6BAChH,UACJ,gFAAgF,EAAoB,EAAE,IAClG,UACJ,+EAA+E,EAAoB,EAAE;AAEvG,eAAe,EAAoC,GAAwB;CACzE,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,EAAgB,GAChB,oCACA,CACF;CAEF,OAAO;AACT;AAMA,eAAsB,EAA2B,GAK/B;CAChB,IAAM,EAAE,mBAAgB,sBAAmB,iBAAc,GACnD,IAAiB,MAAM,EAAoC,CAAc,GAEzE,IAAkB,EAAY;EAClC,QAAQ,EAAU;EAClB,OAAO,EAAwB;EAC/B,SAAS;CACX,CAAC,GACK,IAAc,EAClB,EAAqC,EAAE,aAAU,CAAC,CACpD,GAEI,IAAe;CACnB,IAAI;EACF,IAAe,MAAM,EAAuB;GAC1C;GACA;GACA,gBAAgB;EAClB,CAAC;CACH,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;CAEA,IAAI,GACF,IAAI;EACF,IAAM,IAAK,EAAc;GACvB,UAAU;GACV,SAAS;GACT;GACA;EACF,CAAC,GACK,IAAS,MAAM,EAAgB;GAAE,SAAS;GAAgB,aAAa;EAAG,CAAC;EACjF,MAAM,EAAsB,EAAO,eAAgC;CACrE,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;CASF,IAAI,CAAC,MALgB,QACb,EAA0B,GAAgB,CAAiB,GACjE,SACA,EAAE,UAAU,IAAe,IAAI,EAAE,CACnC,GAEE,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,CACF;AAEJ;AAKA,eAAsB,EAA2B,GAG/B;CAChB,IAAM,EAAE,mBAAgB,yBAAsB,GACxC,IAAiB,MAAM,EAAoC,CAAc,GAEzE,IAAkB,EAAY;EAClC,QAAQ,EAAU;EAClB,OAAO,EAAwB;EAC/B,SAAS;CACX,CAAC;CAED,IAAI;EACF,IAAM,IAAK,EAAiB;GAC1B,UAAU;GACV,SAAS;GACT;EACF,CAAC,GACK,IAAS,MAAM,EAAgB;GAAE,SAAS;GAAgB,aAAa;EAAG,CAAC;EACjF,MAAM,EAAsB,EAAO,eAAgC;CACrE,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAmB,GACnB,oCACA,GACA,CACF;CACF;AACF;AAQA,eAAsB,EACpB,GACA,GACkB;CAClB,IAAI;EAIF,OAHM,MAAM,EAAmB,CAAc,IAGtC,MAAM,EACX,GACA,CACF,IALS;CAMX,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;AACF"}
@@ -1,84 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { ct as t, dt as n, mt as r, t as i, tt as a, ut as o, y as s } from "./chainConfig-DWzoOtkS.js";
3
- import { M as c, d as l, p as u } from "./publishAuthorization-DgDI4zor.js";
4
- import { t as d } from "./publishThirdwebClient-CO18ST7C.js";
5
- import { getContract as f, sendTransaction as p } from "thirdweb";
6
- import { addSessionKey as m, removeSessionKey as h, shouldUpdateSessionKey as g } from "thirdweb/extensions/erc4337";
7
- //#region src/helpers/ensureAutomationSessionKey.ts
8
- var _ = /* @__PURE__ */ e({
9
- ensureAutomationSessionKey: () => S,
10
- isAutomationSessionActive: () => w,
11
- removeAutomationSessionKey: () => C
12
- }), v = () => `Could not connect the managed publishing account to authorize an automation session key on ${i()}. Reconnect and try again.`, y = () => `Could not authorize the automation session key on your publishing account on ${i()}.`, b = () => `Could not remove the automation session key from your publishing account on ${i()}.`;
13
- async function x(e) {
14
- let t = c();
15
- await t.autoConnect({
16
- client: d(),
17
- chain: s()
18
- });
19
- let n = t.getAccount();
20
- if (!n) throw new r(v(), "MODULAR_SIGNER_ACTIVATION_FAILED", e);
21
- return n;
22
- }
23
- async function S(e) {
24
- let { managedAddress: t, sessionKeyAddress: i, expiresAt: a } = e, c = await x(t), h = f({
25
- client: d(),
26
- chain: s(),
27
- address: t
28
- }), _ = u(l({ expiresAt: a })), v = !1;
29
- try {
30
- v = await g({
31
- accountContract: h,
32
- sessionKeyAddress: i,
33
- newPermissions: _
34
- });
35
- } catch (e) {
36
- throw new r(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
37
- }
38
- if (v) try {
39
- let e = m({
40
- contract: h,
41
- account: c,
42
- sessionKeyAddress: i,
43
- permissions: _
44
- }), t = await p({
45
- account: c,
46
- transaction: e
47
- });
48
- await n(t.transactionHash);
49
- } catch (e) {
50
- throw new r(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
51
- }
52
- if (!await o(() => w(t, i), Boolean, { attempts: v ? 5 : 1 })) throw new r(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", t);
53
- }
54
- async function C(e) {
55
- let { managedAddress: t, sessionKeyAddress: i } = e, a = await x(t), o = f({
56
- client: d(),
57
- chain: s(),
58
- address: t
59
- });
60
- try {
61
- let e = h({
62
- contract: o,
63
- account: a,
64
- sessionKeyAddress: i
65
- }), t = await p({
66
- account: a,
67
- transaction: e
68
- });
69
- await n(t.transactionHash);
70
- } catch (e) {
71
- throw new r(b(), "MODULAR_SIGNER_ACTIVATION_FAILED", t, e);
72
- }
73
- }
74
- async function w(e, n) {
75
- try {
76
- return await t(e) ? await a(e, n) : !1;
77
- } catch (t) {
78
- throw new r(y(), "MODULAR_SIGNER_ACTIVATION_FAILED", e, t);
79
- }
80
- }
81
- //#endregion
82
- export { C as i, _ as n, w as r, S as t };
83
-
84
- //# sourceMappingURL=ensureAutomationSessionKey-h3zOmDr5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureAutomationSessionKey-h3zOmDr5.js","names":[],"sources":["../src/helpers/ensureAutomationSessionKey.ts"],"sourcesContent":["import { getContract, sendTransaction } from 'thirdweb'\nimport {\n addSessionKey,\n removeSessionKey,\n shouldUpdateSessionKey,\n} from 'thirdweb/extensions/erc4337'\nimport type { Address } from 'viem'\nimport { ManagedAccountPublishError } from '../errors'\nimport { isContractDeployed, readUntil, waitForPublishReceipt } from './chainClient'\nimport { readIsActiveSigner } from './contracts'\nimport {\n buildAutomationSessionKeyPermissions,\n toThirdwebSessionKeyPermissions,\n} from './automationSessionKeyPermissions'\nimport { getClient, getManagedAccountWallet } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\n\nconst MSG_UNAVAILABLE = () =>\n `Could not connect the managed publishing account to authorize an automation session key on ${getPublishChainName()}. Reconnect and try again.`\nconst MSG_ACTIVATION_FAILED = () =>\n `Could not authorize the automation session key on your publishing account on ${getPublishChainName()}.`\nconst MSG_REMOVAL_FAILED = () =>\n `Could not remove the automation session key from your publishing account on ${getPublishChainName()}.`\n\nasync function getManagedAccountForSessionKeyAdmin(managedAddress: string) {\n const managedWallet = getManagedAccountWallet()\n await managedWallet.autoConnect({ client: getClient(), chain: getPublishThirdwebChain() })\n const managedAccount = managedWallet.getAccount()\n if (!managedAccount) {\n throw new ManagedAccountPublishError(\n MSG_UNAVAILABLE(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n return managedAccount\n}\n\n/**\n * Ensures `sessionKeyAddress` is an active automation session signer on the ManagedAccount\n * with **executor-module-only** approved targets. Signed by the managed EIP-4337 wallet (user).\n */\nexport async function ensureAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n /** Unix seconds end time for the session key (optional). */\n expiresAt?: number\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress, expiresAt } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n const permissions = toThirdwebSessionKeyPermissions(\n buildAutomationSessionKeyPermissions({ expiresAt }),\n )\n\n let shouldUpdate = false\n try {\n shouldUpdate = await shouldUpdateSessionKey({\n accountContract,\n sessionKeyAddress,\n newPermissions: permissions,\n })\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n\n if (shouldUpdate) {\n try {\n const tx = addSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n permissions,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n }\n\n // Right after addSessionKey, a lagging RPC node can still report the key inactive.\n const active = await readUntil(\n () => isAutomationSessionActive(managedAddress, sessionKeyAddress),\n Boolean,\n { attempts: shouldUpdate ? 5 : 1 },\n )\n if (!active) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n )\n }\n}\n\n/**\n * Removes an automation session key from the ManagedAccount (user-signed via managed wallet).\n */\nexport async function removeAutomationSessionKey(params: {\n managedAddress: string\n sessionKeyAddress: string\n}): Promise<void> {\n const { managedAddress, sessionKeyAddress } = params\n const managedAccount = await getManagedAccountForSessionKeyAdmin(managedAddress)\n\n const accountContract = getContract({\n client: getClient(),\n chain: getPublishThirdwebChain(),\n address: managedAddress,\n })\n\n try {\n const tx = removeSessionKey({\n contract: accountContract,\n account: managedAccount,\n sessionKeyAddress,\n })\n const result = await sendTransaction({ account: managedAccount, transaction: tx })\n await waitForPublishReceipt(result.transactionHash as `0x${string}`)\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_REMOVAL_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n\n/**\n * True when `sessionKeyAddress` is an active signer on the ManagedAccount.\n * Returns `false` when the ManagedAccount has no bytecode (undeployed ≠ unauthorized).\n * Throws when bytecode or `isActiveSigner` cannot be read on a live account (RPC / decode),\n * so unattended automation does not silently fall through to in-app bootstrap.\n */\nexport async function isAutomationSessionActive(\n managedAddress: string,\n sessionKeyAddress: string,\n): Promise<boolean> {\n try {\n if (!(await isContractDeployed(managedAddress))) {\n return false\n }\n return await readIsActiveSigner(\n managedAddress as Address,\n sessionKeyAddress as Address,\n )\n } catch (cause) {\n throw new ManagedAccountPublishError(\n MSG_ACTIVATION_FAILED(),\n 'MODULAR_SIGNER_ACTIVATION_FAILED',\n managedAddress,\n cause,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;IAkBM,UACJ,8FAA8F,EAAoB,EAAE,6BAChH,UACJ,gFAAgF,EAAoB,EAAE,IAClG,UACJ,+EAA+E,EAAoB,EAAE;AAEvG,eAAe,EAAoC,GAAwB;CACzE,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,EAAgB,GAChB,oCACA,CACF;CAEF,OAAO;AACT;AAMA,eAAsB,EAA2B,GAK/B;CAChB,IAAM,EAAE,mBAAgB,sBAAmB,iBAAc,GACnD,IAAiB,MAAM,EAAoC,CAAc,GAEzE,IAAkB,EAAY;EAClC,QAAQ,EAAU;EAClB,OAAO,EAAwB;EAC/B,SAAS;CACX,CAAC,GACK,IAAc,EAClB,EAAqC,EAAE,aAAU,CAAC,CACpD,GAEI,IAAe;CACnB,IAAI;EACF,IAAe,MAAM,EAAuB;GAC1C;GACA;GACA,gBAAgB;EAClB,CAAC;CACH,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;CAEA,IAAI,GACF,IAAI;EACF,IAAM,IAAK,EAAc;GACvB,UAAU;GACV,SAAS;GACT;GACA;EACF,CAAC,GACK,IAAS,MAAM,EAAgB;GAAE,SAAS;GAAgB,aAAa;EAAG,CAAC;EACjF,MAAM,EAAsB,EAAO,eAAgC;CACrE,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;CASF,IAAI,CAAC,MALgB,QACb,EAA0B,GAAgB,CAAiB,GACjE,SACA,EAAE,UAAU,IAAe,IAAI,EAAE,CACnC,GAEE,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,CACF;AAEJ;AAKA,eAAsB,EAA2B,GAG/B;CAChB,IAAM,EAAE,mBAAgB,yBAAsB,GACxC,IAAiB,MAAM,EAAoC,CAAc,GAEzE,IAAkB,EAAY;EAClC,QAAQ,EAAU;EAClB,OAAO,EAAwB;EAC/B,SAAS;CACX,CAAC;CAED,IAAI;EACF,IAAM,IAAK,EAAiB;GAC1B,UAAU;GACV,SAAS;GACT;EACF,CAAC,GACK,IAAS,MAAM,EAAgB;GAAE,SAAS;GAAgB,aAAa;EAAG,CAAC;EACjF,MAAM,EAAsB,EAAO,eAAgC;CACrE,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAmB,GACnB,oCACA,GACA,CACF;CACF;AACF;AAQA,eAAsB,EACpB,GACA,GACkB;CAClB,IAAI;EAIF,OAHM,MAAM,EAAmB,CAAc,IAGtC,MAAM,EACX,GACA,CACF,IALS;CAMX,SAAS,GAAO;EACd,MAAM,IAAI,EACR,EAAsB,GACtB,oCACA,GACA,CACF;CACF;AACF"}
@@ -1,23 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { h as t, mt as n, t as r, y as i } from "./chainConfig-DWzoOtkS.js";
3
- import { B as a, M as o, v as s } from "./publishAuthorization-DgDI4zor.js";
4
- import { t as c } from "./publishThirdwebClient-CO18ST7C.js";
5
- import { t as l } from "./managedAccountAdmin-B4HkLWWE.js";
6
- //#region src/helpers/ensureModularPublishBootstrap.ts
7
- var u = /* @__PURE__ */ e({ ensureModularPublishBootstrap: () => d });
8
- async function d(e) {
9
- a();
10
- let u = o();
11
- await u.autoConnect({
12
- client: c(),
13
- chain: i()
14
- });
15
- let d = u.getAccount();
16
- if (!d) throw new n(`Could not connect the managed publishing account on ${r()}. Reconnect with the same sign-in method and try again.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
17
- if (d.address.toLowerCase() !== e.toLowerCase()) throw new n(`The connected managed account (${d.address}) is not the publishing account ${e}. Reconnect with the sign-in method that owns it.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
18
- return await s(e, async () => t(await l(e))), d;
19
- }
20
- //#endregion
21
- export { u as n, d as t };
22
-
23
- //# sourceMappingURL=ensureModularPublishBootstrap-BImiIFJe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureModularPublishBootstrap-BImiIFJe.js","names":[],"sources":["../src/helpers/ensureModularPublishBootstrap.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { ManagedAccountPublishError } from '../errors'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishChainName } from './chainConfig'\nimport { ensureManagedAccountEasConfigured } from './ensureManagedAccountEasConfigured'\nimport { getManagedAccountAdmin } from './managedAccountAdmin'\nimport { getClient, getManagedAccountWallet, syncPublishInAppAuthToken } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Returns the account that sends interactive `multiPublish`: the user's managed (EIP-4337) smart\n * account. Its UserOps execute `multiPublish` on the account itself, a self-call the Seed\n * extension accepts; session keys and other non-admin callers are rejected with `Unauthorized`.\n *\n * Also checks the account's EAS pointer. Only pre-rollout accounts that report no EAS get\n * `setEas`, sent by the admin EOA.\n */\nexport async function ensureModularPublishBootstrap(managedAddress: string): Promise<Account> {\n syncPublishInAppAuthToken()\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 `Could not connect the managed publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n if (managedAccount.address.toLowerCase() !== managedAddress.toLowerCase()) {\n throw new ManagedAccountPublishError(\n `The connected managed account (${managedAccount.address}) is not the publishing account ${managedAddress}. Reconnect with the sign-in method that owns it.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n\n await ensureManagedAccountEasConfigured(managedAddress, async () =>\n fromThirdwebAccount(await getManagedAccountAdmin(managedAddress)),\n )\n return managedAccount\n}\n"],"mappings":";;;;;;;AAiBA,eAAsB,EAA8B,GAA0C;CAC5F,EAA0B;CAC1B,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,uDAAuD,EAAoB,EAAE,0DAC7E,+BACA,CACF;CAEF,IAAI,EAAe,QAAQ,YAAY,MAAM,EAAe,YAAY,GACtE,MAAM,IAAI,EACR,kCAAkC,EAAe,QAAQ,kCAAkC,EAAe,oDAC1G,+BACA,CACF;CAMF,OAHA,MAAM,EAAkC,GAAgB,YACtD,EAAoB,MAAM,EAAuB,CAAc,CAAC,CAClE,GACO;AACT"}
@@ -1,23 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { h as t, mt as n, t as r, y as i } from "./chainConfig-DmuPBs3D.js";
3
- import { B as a, M as o, v as s } from "./publishAuthorization-CG23g8w2.js";
4
- import { t as c } from "./publishThirdwebClient-BQ_KnMi5.js";
5
- import { t as l } from "./managedAccountAdmin-DwFI-ZfE.js";
6
- //#region src/helpers/ensureModularPublishBootstrap.ts
7
- var u = /* @__PURE__ */ e({ ensureModularPublishBootstrap: () => d });
8
- async function d(e) {
9
- a();
10
- let u = o();
11
- await u.autoConnect({
12
- client: c(),
13
- chain: i()
14
- });
15
- let d = u.getAccount();
16
- if (!d) throw new n(`Could not connect the managed publishing account on ${r()}. Reconnect with the same sign-in method and try again.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
17
- if (d.address.toLowerCase() !== e.toLowerCase()) throw new n(`The connected managed account (${d.address}) is not the publishing account ${e}. Reconnect with the sign-in method that owns it.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
18
- return await s(e, async () => t(await l(e))), d;
19
- }
20
- //#endregion
21
- export { u as n, d as t };
22
-
23
- //# sourceMappingURL=ensureModularPublishBootstrap-CmxyX_EN.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureModularPublishBootstrap-CmxyX_EN.js","names":[],"sources":["../src/helpers/ensureModularPublishBootstrap.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { ManagedAccountPublishError } from '../errors'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishChainName } from './chainConfig'\nimport { ensureManagedAccountEasConfigured } from './ensureManagedAccountEasConfigured'\nimport { getManagedAccountAdmin } from './managedAccountAdmin'\nimport { getClient, getManagedAccountWallet, syncPublishInAppAuthToken } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Returns the account that sends interactive `multiPublish`: the user's managed (EIP-4337) smart\n * account. Its UserOps execute `multiPublish` on the account itself, a self-call the Seed\n * extension accepts; session keys and other non-admin callers are rejected with `Unauthorized`.\n *\n * Also checks the account's EAS pointer. Only pre-rollout accounts that report no EAS get\n * `setEas`, sent by the admin EOA.\n */\nexport async function ensureModularPublishBootstrap(managedAddress: string): Promise<Account> {\n syncPublishInAppAuthToken()\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 `Could not connect the managed publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n if (managedAccount.address.toLowerCase() !== managedAddress.toLowerCase()) {\n throw new ManagedAccountPublishError(\n `The connected managed account (${managedAccount.address}) is not the publishing account ${managedAddress}. Reconnect with the sign-in method that owns it.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n\n await ensureManagedAccountEasConfigured(managedAddress, async () =>\n fromThirdwebAccount(await getManagedAccountAdmin(managedAddress)),\n )\n return managedAccount\n}\n"],"mappings":";;;;;;;AAiBA,eAAsB,EAA8B,GAA0C;CAC5F,EAA0B;CAC1B,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,uDAAuD,EAAoB,EAAE,0DAC7E,+BACA,CACF;CAEF,IAAI,EAAe,QAAQ,YAAY,MAAM,EAAe,YAAY,GACtE,MAAM,IAAI,EACR,kCAAkC,EAAe,QAAQ,kCAAkC,EAAe,oDAC1G,+BACA,CACF;CAMF,OAHA,MAAM,EAAkC,GAAgB,YACtD,EAAoB,MAAM,EAAuB,CAAc,CAAC,CAClE,GACO;AACT"}
@@ -1,23 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { h as t, mt as n, t as r, y as i } from "./chainConfig-BJ8C_RRz.js";
3
- import { B as a, M as o, v as s } from "./publishAuthorization-CvK_coYp.js";
4
- import { t as c } from "./publishThirdwebClient-D-K2WEeM.js";
5
- import { t as l } from "./managedAccountAdmin-DS6nniiu.js";
6
- //#region src/helpers/ensureModularPublishBootstrap.ts
7
- var u = /* @__PURE__ */ e({ ensureModularPublishBootstrap: () => d });
8
- async function d(e) {
9
- a();
10
- let u = o();
11
- await u.autoConnect({
12
- client: c(),
13
- chain: i()
14
- });
15
- let d = u.getAccount();
16
- if (!d) throw new n(`Could not connect the managed publishing account on ${r()}. Reconnect with the same sign-in method and try again.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
17
- if (d.address.toLowerCase() !== e.toLowerCase()) throw new n(`The connected managed account (${d.address}) is not the publishing account ${e}. Reconnect with the sign-in method that owns it.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
18
- return await s(e, async () => t(await l(e))), d;
19
- }
20
- //#endregion
21
- export { u as n, d as t };
22
-
23
- //# sourceMappingURL=ensureModularPublishBootstrap-DRFhp-O2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureModularPublishBootstrap-DRFhp-O2.js","names":[],"sources":["../src/helpers/ensureModularPublishBootstrap.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { ManagedAccountPublishError } from '../errors'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishChainName } from './chainConfig'\nimport { ensureManagedAccountEasConfigured } from './ensureManagedAccountEasConfigured'\nimport { getManagedAccountAdmin } from './managedAccountAdmin'\nimport { getClient, getManagedAccountWallet, syncPublishInAppAuthToken } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Returns the account that sends interactive `multiPublish`: the user's managed (EIP-4337) smart\n * account. Its UserOps execute `multiPublish` on the account itself, a self-call the Seed\n * extension accepts; session keys and other non-admin callers are rejected with `Unauthorized`.\n *\n * Also checks the account's EAS pointer. Only pre-rollout accounts that report no EAS get\n * `setEas`, sent by the admin EOA.\n */\nexport async function ensureModularPublishBootstrap(managedAddress: string): Promise<Account> {\n syncPublishInAppAuthToken()\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 `Could not connect the managed publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n if (managedAccount.address.toLowerCase() !== managedAddress.toLowerCase()) {\n throw new ManagedAccountPublishError(\n `The connected managed account (${managedAccount.address}) is not the publishing account ${managedAddress}. Reconnect with the sign-in method that owns it.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n\n await ensureManagedAccountEasConfigured(managedAddress, async () =>\n fromThirdwebAccount(await getManagedAccountAdmin(managedAddress)),\n )\n return managedAccount\n}\n"],"mappings":";;;;;;;AAiBA,eAAsB,EAA8B,GAA0C;CAC5F,EAA0B;CAC1B,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,uDAAuD,EAAoB,EAAE,0DAC7E,+BACA,CACF;CAEF,IAAI,EAAe,QAAQ,YAAY,MAAM,EAAe,YAAY,GACtE,MAAM,IAAI,EACR,kCAAkC,EAAe,QAAQ,kCAAkC,EAAe,oDAC1G,+BACA,CACF;CAMF,OAHA,MAAM,EAAkC,GAAgB,YACtD,EAAoB,MAAM,EAAuB,CAAc,CAAC,CAClE,GACO;AACT"}
@@ -1,23 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { h as t, mt as n, t as r, y as i } from "./chainConfig-DWynbnb8.js";
3
- import { B as a, M as o, v as s } from "./publishAuthorization-C-XYb9Ef.js";
4
- import { t as c } from "./publishThirdwebClient-BmqsJCjp.js";
5
- import { t as l } from "./managedAccountAdmin-ByEX_Eg2.js";
6
- //#region src/helpers/ensureModularPublishBootstrap.ts
7
- var u = /* @__PURE__ */ e({ ensureModularPublishBootstrap: () => d });
8
- async function d(e) {
9
- a();
10
- let u = o();
11
- await u.autoConnect({
12
- client: c(),
13
- chain: i()
14
- });
15
- let d = u.getAccount();
16
- if (!d) throw new n(`Could not connect the managed publishing account on ${r()}. Reconnect with the same sign-in method and try again.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
17
- if (d.address.toLowerCase() !== e.toLowerCase()) throw new n(`The connected managed account (${d.address}) is not the publishing account ${e}. Reconnect with the sign-in method that owns it.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
18
- return await s(e, async () => t(await l(e))), d;
19
- }
20
- //#endregion
21
- export { u as n, d as t };
22
-
23
- //# sourceMappingURL=ensureModularPublishBootstrap-DegJnYKL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureModularPublishBootstrap-DegJnYKL.js","names":[],"sources":["../src/helpers/ensureModularPublishBootstrap.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { ManagedAccountPublishError } from '../errors'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishChainName } from './chainConfig'\nimport { ensureManagedAccountEasConfigured } from './ensureManagedAccountEasConfigured'\nimport { getManagedAccountAdmin } from './managedAccountAdmin'\nimport { getClient, getManagedAccountWallet, syncPublishInAppAuthToken } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Returns the account that sends interactive `multiPublish`: the user's managed (EIP-4337) smart\n * account. Its UserOps execute `multiPublish` on the account itself, a self-call the Seed\n * extension accepts; session keys and other non-admin callers are rejected with `Unauthorized`.\n *\n * Also checks the account's EAS pointer. Only pre-rollout accounts that report no EAS get\n * `setEas`, sent by the admin EOA.\n */\nexport async function ensureModularPublishBootstrap(managedAddress: string): Promise<Account> {\n syncPublishInAppAuthToken()\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 `Could not connect the managed publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n if (managedAccount.address.toLowerCase() !== managedAddress.toLowerCase()) {\n throw new ManagedAccountPublishError(\n `The connected managed account (${managedAccount.address}) is not the publishing account ${managedAddress}. Reconnect with the sign-in method that owns it.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n\n await ensureManagedAccountEasConfigured(managedAddress, async () =>\n fromThirdwebAccount(await getManagedAccountAdmin(managedAddress)),\n )\n return managedAccount\n}\n"],"mappings":";;;;;;;AAiBA,eAAsB,EAA8B,GAA0C;CAC5F,EAA0B;CAC1B,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,uDAAuD,EAAoB,EAAE,0DAC7E,+BACA,CACF;CAEF,IAAI,EAAe,QAAQ,YAAY,MAAM,EAAe,YAAY,GACtE,MAAM,IAAI,EACR,kCAAkC,EAAe,QAAQ,kCAAkC,EAAe,oDAC1G,+BACA,CACF;CAMF,OAHA,MAAM,EAAkC,GAAgB,YACtD,EAAoB,MAAM,EAAuB,CAAc,CAAC,CAClE,GACO;AACT"}
@@ -1,23 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { h as t, mt as n, t as r, y as i } from "./chainConfig-DXCcqaAs.js";
3
- import { B as a, M as o, v as s } from "./publishAuthorization-S3ofoXPN.js";
4
- import { t as c } from "./publishThirdwebClient-BFx_M2Uy.js";
5
- import { t as l } from "./managedAccountAdmin-C5UqbkQ0.js";
6
- //#region src/helpers/ensureModularPublishBootstrap.ts
7
- var u = /* @__PURE__ */ e({ ensureModularPublishBootstrap: () => d });
8
- async function d(e) {
9
- a();
10
- let u = o();
11
- await u.autoConnect({
12
- client: c(),
13
- chain: i()
14
- });
15
- let d = u.getAccount();
16
- if (!d) throw new n(`Could not connect the managed publishing account on ${r()}. Reconnect with the same sign-in method and try again.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
17
- if (d.address.toLowerCase() !== e.toLowerCase()) throw new n(`The connected managed account (${d.address}) is not the publishing account ${e}. Reconnect with the sign-in method that owns it.`, "MANAGED_ACCOUNT_UNAVAILABLE", e);
18
- return await s(e, async () => t(await l(e))), d;
19
- }
20
- //#endregion
21
- export { u as n, d as t };
22
-
23
- //# sourceMappingURL=ensureModularPublishBootstrap-E4l8no0p.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureModularPublishBootstrap-E4l8no0p.js","names":[],"sources":["../src/helpers/ensureModularPublishBootstrap.ts"],"sourcesContent":["import type { Account } from 'thirdweb/wallets'\nimport { ManagedAccountPublishError } from '../errors'\nimport { fromThirdwebAccount } from './adapters/thirdwebAccount'\nimport { getPublishChainName } from './chainConfig'\nimport { ensureManagedAccountEasConfigured } from './ensureManagedAccountEasConfigured'\nimport { getManagedAccountAdmin } from './managedAccountAdmin'\nimport { getClient, getManagedAccountWallet, syncPublishInAppAuthToken } from './thirdweb'\nimport { getPublishThirdwebChain } from './thirdwebChain'\n\n/**\n * Returns the account that sends interactive `multiPublish`: the user's managed (EIP-4337) smart\n * account. Its UserOps execute `multiPublish` on the account itself, a self-call the Seed\n * extension accepts; session keys and other non-admin callers are rejected with `Unauthorized`.\n *\n * Also checks the account's EAS pointer. Only pre-rollout accounts that report no EAS get\n * `setEas`, sent by the admin EOA.\n */\nexport async function ensureModularPublishBootstrap(managedAddress: string): Promise<Account> {\n syncPublishInAppAuthToken()\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 `Could not connect the managed publishing account on ${getPublishChainName()}. Reconnect with the same sign-in method and try again.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n if (managedAccount.address.toLowerCase() !== managedAddress.toLowerCase()) {\n throw new ManagedAccountPublishError(\n `The connected managed account (${managedAccount.address}) is not the publishing account ${managedAddress}. Reconnect with the sign-in method that owns it.`,\n 'MANAGED_ACCOUNT_UNAVAILABLE',\n managedAddress,\n )\n }\n\n await ensureManagedAccountEasConfigured(managedAddress, async () =>\n fromThirdwebAccount(await getManagedAccountAdmin(managedAddress)),\n )\n return managedAccount\n}\n"],"mappings":";;;;;;;AAiBA,eAAsB,EAA8B,GAA0C;CAC5F,EAA0B;CAC1B,IAAM,IAAgB,EAAwB;CAC9C,MAAM,EAAc,YAAY;EAAE,QAAQ,EAAU;EAAG,OAAO,EAAwB;CAAE,CAAC;CACzF,IAAM,IAAiB,EAAc,WAAW;CAChD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,uDAAuD,EAAoB,EAAE,0DAC7E,+BACA,CACF;CAEF,IAAI,EAAe,QAAQ,YAAY,MAAM,EAAe,YAAY,GACtE,MAAM,IAAI,EACR,kCAAkC,EAAe,QAAQ,kCAAkC,EAAe,oDAC1G,+BACA,CACF;CAMF,OAHA,MAAM,EAAkC,GAAgB,YACtD,EAAoB,MAAM,EAAuB,CAAc,CAAC,CAClE,GACO;AACT"}
@@ -1,47 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { D as t, O as n, h as r, mt as i, o as a, t as o, y as s } from "./chainConfig-DmuPBs3D.js";
3
- import { A as c, h as l, j as u, z as d } from "./publishAuthorization-CG23g8w2.js";
4
- import { ethers as f } from "ethers";
5
- //#region src/helpers/ensureSmartWalletThenPublish.ts
6
- var p = /* @__PURE__ */ e({ ensureSmartWalletThenPublish: () => _ }), m = "A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.", h = () => `Could not connect the managed publishing account on ${o()}. Reconnect with the same sign-in method and try again.`;
7
- function g(e) {
8
- if (e) return e instanceof f.Wallet ? e : t(e) ? e.signer : n(e) ? e : r(e).signer;
9
- }
10
- async function _(e, t, n, o) {
11
- let f = a(), p = await n();
12
- if (!p || !p.trim()) return { outcome: "no_address" };
13
- if (f.useModularExecutor) {
14
- let t = await u();
15
- if (!t) return {
16
- outcome: "managed_not_ready",
17
- error: new i(m, "MANAGED_ACCOUNT_UNAVAILABLE")
18
- };
19
- let n;
20
- try {
21
- n = await c(s());
22
- } catch (e) {
23
- return {
24
- outcome: "managed_not_ready",
25
- error: new i(h(), "MANAGED_ACCOUNT_UNAVAILABLE", void 0, e)
26
- };
27
- }
28
- let a = r(t);
29
- return l.createPublish(e, n, a, {
30
- ...o,
31
- dataItemSigner: g(o?.dataItemSigner) ?? a.signer
32
- }), { outcome: "started" };
33
- }
34
- let _ = await d(t ?? null);
35
- if ("address" in _) {
36
- let t = r(_.account);
37
- return l.createPublish(e, _.address, t, {
38
- ...o,
39
- dataItemSigner: g(o?.dataItemSigner) ?? t.signer
40
- }), { outcome: "started" };
41
- }
42
- return { outcome: "needs_deploy" };
43
- }
44
- //#endregion
45
- export { p as n, _ as t };
46
-
47
- //# sourceMappingURL=ensureSmartWalletThenPublish-0nKg13WN.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureSmartWalletThenPublish-0nKg13WN.js","names":[],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\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'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\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 ${getPublishChainName()}. 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(getPublishThirdwebChain())\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":";;;;;sEAuBM,IACJ,+GAEI,UACJ,uDAAuD,EAAoB,EAAE;AAE/E,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,EAAwB,CAAC;EACpF,SAAS,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAI,EACT,EAAwB,GACxB,+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"}
@@ -1,47 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { D as t, O as n, h as r, mt as i, o as a, t as o, y as s } from "./chainConfig-BJ8C_RRz.js";
3
- import { A as c, h as l, j as u, z as d } from "./publishAuthorization-CvK_coYp.js";
4
- import { ethers as f } from "ethers";
5
- //#region src/helpers/ensureSmartWalletThenPublish.ts
6
- var p = /* @__PURE__ */ e({ ensureSmartWalletThenPublish: () => _ }), m = "A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.", h = () => `Could not connect the managed publishing account on ${o()}. Reconnect with the same sign-in method and try again.`;
7
- function g(e) {
8
- if (e) return e instanceof f.Wallet ? e : t(e) ? e.signer : n(e) ? e : r(e).signer;
9
- }
10
- async function _(e, t, n, o) {
11
- let f = a(), p = await n();
12
- if (!p || !p.trim()) return { outcome: "no_address" };
13
- if (f.useModularExecutor) {
14
- let t = await u();
15
- if (!t) return {
16
- outcome: "managed_not_ready",
17
- error: new i(m, "MANAGED_ACCOUNT_UNAVAILABLE")
18
- };
19
- let n;
20
- try {
21
- n = await c(s());
22
- } catch (e) {
23
- return {
24
- outcome: "managed_not_ready",
25
- error: new i(h(), "MANAGED_ACCOUNT_UNAVAILABLE", void 0, e)
26
- };
27
- }
28
- let a = r(t);
29
- return l.createPublish(e, n, a, {
30
- ...o,
31
- dataItemSigner: g(o?.dataItemSigner) ?? a.signer
32
- }), { outcome: "started" };
33
- }
34
- let _ = await d(t ?? null);
35
- if ("address" in _) {
36
- let t = r(_.account);
37
- return l.createPublish(e, _.address, t, {
38
- ...o,
39
- dataItemSigner: g(o?.dataItemSigner) ?? t.signer
40
- }), { outcome: "started" };
41
- }
42
- return { outcome: "needs_deploy" };
43
- }
44
- //#endregion
45
- export { p as n, _ as t };
46
-
47
- //# sourceMappingURL=ensureSmartWalletThenPublish-BdqeUL6t.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureSmartWalletThenPublish-BdqeUL6t.js","names":[],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\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'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\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 ${getPublishChainName()}. 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(getPublishThirdwebChain())\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":";;;;;sEAuBM,IACJ,+GAEI,UACJ,uDAAuD,EAAoB,EAAE;AAE/E,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,EAAwB,CAAC;EACpF,SAAS,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAI,EACT,EAAwB,GACxB,+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"}
@@ -1,47 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { D as t, O as n, h as r, mt as i, o as a, t as o, y as s } from "./chainConfig-DWynbnb8.js";
3
- import { A as c, h as l, j as u, z as d } from "./publishAuthorization-C-XYb9Ef.js";
4
- import { ethers as f } from "ethers";
5
- //#region src/helpers/ensureSmartWalletThenPublish.ts
6
- var p = /* @__PURE__ */ e({ ensureSmartWalletThenPublish: () => _ }), m = "A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.", h = () => `Could not connect the managed publishing account on ${o()}. Reconnect with the same sign-in method and try again.`;
7
- function g(e) {
8
- if (e) return e instanceof f.Wallet ? e : t(e) ? e.signer : n(e) ? e : r(e).signer;
9
- }
10
- async function _(e, t, n, o) {
11
- let f = a(), p = await n();
12
- if (!p || !p.trim()) return { outcome: "no_address" };
13
- if (f.useModularExecutor) {
14
- let t = await u();
15
- if (!t) return {
16
- outcome: "managed_not_ready",
17
- error: new i(m, "MANAGED_ACCOUNT_UNAVAILABLE")
18
- };
19
- let n;
20
- try {
21
- n = await c(s());
22
- } catch (e) {
23
- return {
24
- outcome: "managed_not_ready",
25
- error: new i(h(), "MANAGED_ACCOUNT_UNAVAILABLE", void 0, e)
26
- };
27
- }
28
- let a = r(t);
29
- return l.createPublish(e, n, a, {
30
- ...o,
31
- dataItemSigner: g(o?.dataItemSigner) ?? a.signer
32
- }), { outcome: "started" };
33
- }
34
- let _ = await d(t ?? null);
35
- if ("address" in _) {
36
- let t = r(_.account);
37
- return l.createPublish(e, _.address, t, {
38
- ...o,
39
- dataItemSigner: g(o?.dataItemSigner) ?? t.signer
40
- }), { outcome: "started" };
41
- }
42
- return { outcome: "needs_deploy" };
43
- }
44
- //#endregion
45
- export { p as n, _ as t };
46
-
47
- //# sourceMappingURL=ensureSmartWalletThenPublish-BfEndtFo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureSmartWalletThenPublish-BfEndtFo.js","names":[],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\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'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\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 ${getPublishChainName()}. 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(getPublishThirdwebChain())\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":";;;;;sEAuBM,IACJ,+GAEI,UACJ,uDAAuD,EAAoB,EAAE;AAE/E,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,EAAwB,CAAC;EACpF,SAAS,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAI,EACT,EAAwB,GACxB,+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"}
@@ -1,47 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { D as t, O as n, h as r, mt as i, o as a, t as o, y as s } from "./chainConfig-DWzoOtkS.js";
3
- import { A as c, h as l, j as u, z as d } from "./publishAuthorization-DgDI4zor.js";
4
- import { ethers as f } from "ethers";
5
- //#region src/helpers/ensureSmartWalletThenPublish.ts
6
- var p = /* @__PURE__ */ e({ ensureSmartWalletThenPublish: () => _ }), m = "A connected wallet is required for publishing with the modular executor. Connect your wallet and try again.", h = () => `Could not connect the managed publishing account on ${o()}. Reconnect with the same sign-in method and try again.`;
7
- function g(e) {
8
- if (e) return e instanceof f.Wallet ? e : t(e) ? e.signer : n(e) ? e : r(e).signer;
9
- }
10
- async function _(e, t, n, o) {
11
- let f = a(), p = await n();
12
- if (!p || !p.trim()) return { outcome: "no_address" };
13
- if (f.useModularExecutor) {
14
- let t = await u();
15
- if (!t) return {
16
- outcome: "managed_not_ready",
17
- error: new i(m, "MANAGED_ACCOUNT_UNAVAILABLE")
18
- };
19
- let n;
20
- try {
21
- n = await c(s());
22
- } catch (e) {
23
- return {
24
- outcome: "managed_not_ready",
25
- error: new i(h(), "MANAGED_ACCOUNT_UNAVAILABLE", void 0, e)
26
- };
27
- }
28
- let a = r(t);
29
- return l.createPublish(e, n, a, {
30
- ...o,
31
- dataItemSigner: g(o?.dataItemSigner) ?? a.signer
32
- }), { outcome: "started" };
33
- }
34
- let _ = await d(t ?? null);
35
- if ("address" in _) {
36
- let t = r(_.account);
37
- return l.createPublish(e, _.address, t, {
38
- ...o,
39
- dataItemSigner: g(o?.dataItemSigner) ?? t.signer
40
- }), { outcome: "started" };
41
- }
42
- return { outcome: "needs_deploy" };
43
- }
44
- //#endregion
45
- export { p as n, _ as t };
46
-
47
- //# sourceMappingURL=ensureSmartWalletThenPublish-DuOYPJFd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureSmartWalletThenPublish-DuOYPJFd.js","names":[],"sources":["../src/helpers/ensureSmartWalletThenPublish.ts"],"sourcesContent":["import type { Item } from '@seedprotocol/sdk'\nimport type { Account } from 'thirdweb/wallets'\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'\nimport { getPublishThirdwebChain } from './thirdwebChain'\nimport { getPublishChainName } from './chainConfig'\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 ${getPublishChainName()}. 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(getPublishThirdwebChain())\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":";;;;;sEAuBM,IACJ,+GAEI,UACJ,uDAAuD,EAAoB,EAAE;AAE/E,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,EAAwB,CAAC;EACpF,SAAS,GAAO;GACd,OAAO;IACL,SAAS;IACT,OAAO,IAAI,EACT,EAAwB,GACxB,+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"}