@seedprotocol/publish 0.5.3 → 0.6.1

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 (62) hide show
  1. package/dist/config-CU8Ui1p-.js +945 -0
  2. package/dist/config-CU8Ui1p-.js.map +1 -0
  3. package/dist/config-DEgHQlfX.js +945 -0
  4. package/dist/config-DEgHQlfX.js.map +1 -0
  5. package/dist/config-DXz248cO.js +945 -0
  6. package/dist/config-DXz248cO.js.map +1 -0
  7. package/dist/config-gmiloACE.js +945 -0
  8. package/dist/config-gmiloACE.js.map +1 -0
  9. package/dist/ensureAutomationSessionKey-C_RJobXU.js +84 -0
  10. package/dist/ensureAutomationSessionKey-C_RJobXU.js.map +1 -0
  11. package/dist/ensureAutomationSessionKey-Dpd21O0I.js +84 -0
  12. package/dist/ensureAutomationSessionKey-Dpd21O0I.js.map +1 -0
  13. package/dist/ensureAutomationSessionKey-N4wpdxAg.js +84 -0
  14. package/dist/ensureAutomationSessionKey-N4wpdxAg.js.map +1 -0
  15. package/dist/ensureAutomationSessionKey-xX_D3EcO.js +84 -0
  16. package/dist/ensureAutomationSessionKey-xX_D3EcO.js.map +1 -0
  17. package/dist/ensureModularPublishBootstrap-AQdNHeLj.js +127 -0
  18. package/dist/ensureModularPublishBootstrap-AQdNHeLj.js.map +1 -0
  19. package/dist/ensureModularPublishBootstrap-BRf-eJeB.js +128 -0
  20. package/dist/ensureModularPublishBootstrap-BRf-eJeB.js.map +1 -0
  21. package/dist/ensureModularPublishBootstrap-CTcJlDea.js +127 -0
  22. package/dist/ensureModularPublishBootstrap-CTcJlDea.js.map +1 -0
  23. package/dist/ensureModularPublishBootstrap-DVvZtMli.js +127 -0
  24. package/dist/ensureModularPublishBootstrap-DVvZtMli.js.map +1 -0
  25. package/dist/ensureSmartWalletThenPublish-BmLs5Nwn.js +48 -0
  26. package/dist/ensureSmartWalletThenPublish-BmLs5Nwn.js.map +1 -0
  27. package/dist/ensureSmartWalletThenPublish-CbF_YdTA.js +48 -0
  28. package/dist/ensureSmartWalletThenPublish-CbF_YdTA.js.map +1 -0
  29. package/dist/ensureSmartWalletThenPublish-iPHk38a4.js +48 -0
  30. package/dist/ensureSmartWalletThenPublish-iPHk38a4.js.map +1 -0
  31. package/dist/ensureSmartWalletThenPublish-uRUfZJzA.js +48 -0
  32. package/dist/ensureSmartWalletThenPublish-uRUfZJzA.js.map +1 -0
  33. package/dist/index.js +3 -3
  34. package/dist/publishAuthorization-BQKmcmLY.js +3426 -0
  35. package/dist/publishAuthorization-BQKmcmLY.js.map +1 -0
  36. package/dist/publishAuthorization-BzmqxKCT.js +3476 -0
  37. package/dist/publishAuthorization-BzmqxKCT.js.map +1 -0
  38. package/dist/publishAuthorization-CXSmL-iP.js +3428 -0
  39. package/dist/publishAuthorization-CXSmL-iP.js.map +1 -0
  40. package/dist/publishAuthorization-uCvEyJ0U.js +3427 -0
  41. package/dist/publishAuthorization-uCvEyJ0U.js.map +1 -0
  42. package/dist/resolveRevokeAccount-BE9G5QA8.js +38 -0
  43. package/dist/resolveRevokeAccount-BE9G5QA8.js.map +1 -0
  44. package/dist/resolveRevokeAccount-CBT8xptI.js +38 -0
  45. package/dist/resolveRevokeAccount-CBT8xptI.js.map +1 -0
  46. package/dist/resolveRevokeAccount-D-LndUHw.js +38 -0
  47. package/dist/resolveRevokeAccount-D-LndUHw.js.map +1 -0
  48. package/dist/resolveRevokeAccount-hwtpdojw.js +38 -0
  49. package/dist/resolveRevokeAccount-hwtpdojw.js.map +1 -0
  50. package/dist/services/publish/actors/createAttestations.d.ts.map +1 -1
  51. package/dist/services/publish/actors/seedUidHelpers.d.ts +22 -0
  52. package/dist/services/publish/actors/seedUidHelpers.d.ts.map +1 -1
  53. package/dist/thirdweb.js +5 -5
  54. package/dist/worker-B5XVaUgJ.js +69 -0
  55. package/dist/worker-B5XVaUgJ.js.map +1 -0
  56. package/dist/worker-Ct1D1BAK.js +69 -0
  57. package/dist/worker-Ct1D1BAK.js.map +1 -0
  58. package/dist/worker-DHNyIpf-.js +69 -0
  59. package/dist/worker-DHNyIpf-.js.map +1 -0
  60. package/dist/worker-Exgca_h6.js +69 -0
  61. package/dist/worker-Exgca_h6.js.map +1 -0
  62. package/package.json +6 -6
@@ -0,0 +1,48 @@
1
+ import { g as e, h as t, nt as n, r, s as i } from "./config-CU8Ui1p-.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-uCvEyJ0U.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-BmLs5Nwn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSmartWalletThenPublish-BmLs5Nwn.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-DXz248cO.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-BQKmcmLY.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-CbF_YdTA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSmartWalletThenPublish-CbF_YdTA.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-gmiloACE.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-BzmqxKCT.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-iPHk38a4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSmartWalletThenPublish-iPHk38a4.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-DEgHQlfX.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-CXSmL-iP.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-uRUfZJzA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureSmartWalletThenPublish-uRUfZJzA.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"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as e, A as t, C as n, D as r, F as i, G as a, H as o, K as s, L as c, M as l, N as u, R as d, T as f, V as p, W as m, Z as h, _ as g, b as _, d as v, et as ee, f as te, g as y, h as b, i as x, j as ne, k as re, l as ie, m as ae, n as oe, p as S, r as C, t as se, u as ce, v as w, y as T } from "./config-BBL0ILr9.js";
1
+ import { $ as e, A as t, C as n, D as r, F as i, G as a, H as o, K as s, L as c, M as l, N as u, R as d, T as f, V as p, W as m, Z as h, _ as g, b as _, d as v, et as ee, f as te, g as y, h as b, i as x, j as ne, k as re, l as ie, m as ae, n as oe, p as S, r as C, t as se, u as ce, v as w, y as T } from "./config-gmiloACE.js";
2
2
  import { a as le, i as ue, n as de, o as fe, r as pe, s as me, t as he } from "./errors-Du3LNbJN.js";
3
- import { G as ge, J as _e, K as ve, Q as ye, W as be, X as xe, Y as Se, Z as Ce, _ as we, a as Te, c as Ee, g as De, h as E, i as Oe, l as ke, n as Ae, o as je, q as Me, r as Ne, s as Pe, t as Fe, v as Ie } from "./publishAuthorization-9WO-Zbcj.js";
3
+ import { G as ge, J as _e, K as ve, Q as ye, W as be, X as xe, Y as Se, Z as Ce, _ as we, a as Te, c as Ee, g as De, h as E, i as Oe, l as ke, n as Ae, o as je, q as Me, r as Ne, s as Pe, t as Fe, v as Ie } from "./publishAuthorization-BzmqxKCT.js";
4
4
  import { BaseDb as D, arweaveL1FinalizeJobs as O, isItemOwned as Le, publishProcesses as k, uploadProcesses as Re } from "@seedprotocol/sdk";
5
5
  import { createPublicClient as ze, createWalletClient as Be, custom as Ve, http as A } from "viem";
6
6
  import { ethers as He } from "ethers";
@@ -458,7 +458,7 @@ function Qt(e) {
458
458
  async function $t(e, t) {
459
459
  let n = C();
460
460
  if (n.useModularExecutor) {
461
- let { ensureSmartWalletThenPublish: n } = await import("./ensureSmartWalletThenPublish-s7MBAeky.js").then((e) => e.n);
461
+ let { ensureSmartWalletThenPublish: n } = await import("./ensureSmartWalletThenPublish-iPHk38a4.js").then((e) => e.n);
462
462
  return n(e, null, async () => {
463
463
  let e = T();
464
464
  return e?.publisherAddress ?? e?.signer.address ?? null;