@seedprotocol/publish 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +7 -1
  3. package/dist/config-BBL0ILr9.js +945 -0
  4. package/dist/config-BBL0ILr9.js.map +1 -0
  5. package/dist/config-DLoMtwmG.js +945 -0
  6. package/dist/config-DLoMtwmG.js.map +1 -0
  7. package/dist/ensureAutomationSessionKey-BuM0gQfL.js +84 -0
  8. package/dist/ensureAutomationSessionKey-BuM0gQfL.js.map +1 -0
  9. package/dist/ensureAutomationSessionKey-BwIqDrG9.js +84 -0
  10. package/dist/ensureAutomationSessionKey-BwIqDrG9.js.map +1 -0
  11. package/dist/ensureManagedAccountEasConfigured-CLB69z0D.js +1206 -0
  12. package/dist/ensureManagedAccountEasConfigured-CLB69z0D.js.map +1 -0
  13. package/dist/ensureManagedAccountEasConfigured-DkRwHXL2.js +1204 -0
  14. package/dist/ensureManagedAccountEasConfigured-DkRwHXL2.js.map +1 -0
  15. package/dist/ensureModularPublishBootstrap-B_w6G5EL.js +125 -0
  16. package/dist/ensureModularPublishBootstrap-B_w6G5EL.js.map +1 -0
  17. package/dist/ensureModularPublishBootstrap-BafX1eks.js +124 -0
  18. package/dist/ensureModularPublishBootstrap-BafX1eks.js.map +1 -0
  19. package/dist/ensureModularPublishBootstrap-CPEwnTCw.js +127 -0
  20. package/dist/ensureModularPublishBootstrap-CPEwnTCw.js.map +1 -0
  21. package/dist/ensureModularPublishBootstrap-CqKKjChn.js +127 -0
  22. package/dist/ensureModularPublishBootstrap-CqKKjChn.js.map +1 -0
  23. package/dist/ensureSmartWalletThenPublish-BDX7FxdV.js +47 -0
  24. package/dist/ensureSmartWalletThenPublish-BDX7FxdV.js.map +1 -0
  25. package/dist/ensureSmartWalletThenPublish-CgCb9kZy.js +47 -0
  26. package/dist/ensureSmartWalletThenPublish-CgCb9kZy.js.map +1 -0
  27. package/dist/ensureSmartWalletThenPublish-Ch7BST2M.js +48 -0
  28. package/dist/ensureSmartWalletThenPublish-Ch7BST2M.js.map +1 -0
  29. package/dist/ensureSmartWalletThenPublish-s7MBAeky.js +48 -0
  30. package/dist/ensureSmartWalletThenPublish-s7MBAeky.js.map +1 -0
  31. package/dist/errors-Du3LNbJN.js +70 -0
  32. package/dist/errors-Du3LNbJN.js.map +1 -0
  33. package/dist/helpers/approvedTargetsForAutomationPublish.d.ts +9 -0
  34. package/dist/helpers/approvedTargetsForAutomationPublish.d.ts.map +1 -0
  35. package/dist/helpers/assertStorageBoundToIdentity.d.ts +31 -0
  36. package/dist/helpers/assertStorageBoundToIdentity.d.ts.map +1 -0
  37. package/dist/helpers/automationSessionKeyPermissions.d.ts +26 -0
  38. package/dist/helpers/automationSessionKeyPermissions.d.ts.map +1 -0
  39. package/dist/helpers/easDirect.d.ts +7 -0
  40. package/dist/helpers/easDirect.d.ts.map +1 -1
  41. package/dist/helpers/enrollPublishAutomation.d.ts +36 -0
  42. package/dist/helpers/enrollPublishAutomation.d.ts.map +1 -0
  43. package/dist/helpers/ensureAutomationSessionKey.d.ts +20 -0
  44. package/dist/helpers/ensureAutomationSessionKey.d.ts.map +1 -0
  45. package/dist/helpers/ensureManagedAccountEasConfigured.d.ts +5 -0
  46. package/dist/helpers/ensureManagedAccountEasConfigured.d.ts.map +1 -1
  47. package/dist/helpers/resolveRevokeAccount.d.ts +3 -6
  48. package/dist/helpers/resolveRevokeAccount.d.ts.map +1 -1
  49. package/dist/helpers/seedSigner.d.ts +3 -0
  50. package/dist/helpers/seedSigner.d.ts.map +1 -1
  51. package/dist/index.d.ts +3 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +573 -198
  54. package/dist/index.js.map +1 -1
  55. package/dist/publishAuthorization-9WO-Zbcj.js +3426 -0
  56. package/dist/publishAuthorization-9WO-Zbcj.js.map +1 -0
  57. package/dist/publishAuthorization-CSyAV8Hf.js +3403 -0
  58. package/dist/publishAuthorization-CSyAV8Hf.js.map +1 -0
  59. package/dist/publishManager-B7zTF25-.js +3018 -0
  60. package/dist/publishManager-B7zTF25-.js.map +1 -0
  61. package/dist/publishManager-luSstTr_.js +3008 -0
  62. package/dist/publishManager-luSstTr_.js.map +1 -0
  63. package/dist/resolveRevokeAccount-B4J_Jo76.js +38 -0
  64. package/dist/resolveRevokeAccount-B4J_Jo76.js.map +1 -0
  65. package/dist/resolveRevokeAccount-Bo1IMYOj.js +38 -0
  66. package/dist/resolveRevokeAccount-Bo1IMYOj.js.map +1 -0
  67. package/dist/resolveRevokeAccount-FYMP0Qz6.js +30 -0
  68. package/dist/resolveRevokeAccount-FYMP0Qz6.js.map +1 -0
  69. package/dist/resolveRevokeAccount-mMTFtVDR.js +30 -0
  70. package/dist/resolveRevokeAccount-mMTFtVDR.js.map +1 -0
  71. package/dist/services/PublishManager/index.d.ts +2 -2
  72. package/dist/services/PublishManager/index.d.ts.map +1 -1
  73. package/dist/services/domainOwnership/challenge.d.ts +34 -0
  74. package/dist/services/domainOwnership/challenge.d.ts.map +1 -0
  75. package/dist/services/domainOwnership/dnsVerify.d.ts +23 -0
  76. package/dist/services/domainOwnership/dnsVerify.d.ts.map +1 -0
  77. package/dist/services/domainOwnership/index.d.ts +121 -0
  78. package/dist/services/domainOwnership/index.d.ts.map +1 -0
  79. package/dist/services/domainOwnership/public.d.ts +2 -0
  80. package/dist/services/domainOwnership/public.d.ts.map +1 -0
  81. package/dist/services/domainOwnership/registry.d.ts +18 -0
  82. package/dist/services/domainOwnership/registry.d.ts.map +1 -0
  83. package/dist/services/publish/actors/createAttestations.d.ts +6 -0
  84. package/dist/services/publish/actors/createAttestations.d.ts.map +1 -1
  85. package/dist/services/publish/index.d.ts +17 -17
  86. package/dist/services/publish/index.d.ts.map +1 -1
  87. package/dist/services/publishAuthorization/index.d.ts +68 -0
  88. package/dist/services/publishAuthorization/index.d.ts.map +1 -0
  89. package/dist/services/publishAuthorization/public.d.ts +2 -0
  90. package/dist/services/publishAuthorization/public.d.ts.map +1 -0
  91. package/dist/services/revoke/revokeAttestations.d.ts +3 -0
  92. package/dist/services/revoke/revokeAttestations.d.ts.map +1 -1
  93. package/dist/services/upload/uploadMachine.d.ts +2 -2
  94. package/dist/services/upload/uploadMachine.d.ts.map +1 -1
  95. package/dist/thirdweb.d.ts +5 -0
  96. package/dist/thirdweb.d.ts.map +1 -1
  97. package/dist/thirdweb.js +202 -83
  98. package/dist/thirdweb.js.map +1 -1
  99. package/dist/worker-BaZK7VaR.js +69 -0
  100. package/dist/worker-BaZK7VaR.js.map +1 -0
  101. package/dist/worker-ChGaz4Bg.js +69 -0
  102. package/dist/worker-ChGaz4Bg.js.map +1 -0
  103. package/dist/worker-Nx2FsrmM.js +69 -0
  104. package/dist/worker-Nx2FsrmM.js.map +1 -0
  105. package/dist/worker-eQpROLst.js +69 -0
  106. package/dist/worker-eQpROLst.js.map +1 -0
  107. package/package.json +7 -4
package/dist/index.js CHANGED
@@ -1,19 +1,25 @@
1
- import { A as e, B as t, C as n, D as r, Dt as i, E as a, Et as o, G as s, H as c, J as l, K as u, M as d, N as f, O as p, P as m, S as ee, T as te, U as h, V as ne, W as re, X as g, Y as _, _t as ie, at as ae, dt as v, ht as y, it as b, j as oe, k as se, lt as ce, mt as le, ot as ue, q as de, rt as fe, st as pe, t as me, ut as he, vt as ge, w as _e, wt as ve, yt as x, z as ye } from "./ensureManagedAccountEasConfigured-BxdK_Vhf.js";
2
- import { c as be, l as xe, n as Se, s as S, t as C, u as w } from "./publishManager-Ccot_poQ.js";
3
- import { BaseDb as T, arweaveL1FinalizeJobs as E, isItemOwned as D, publishProcesses as O, uploadProcesses as k } from "@seedprotocol/sdk";
4
- import { createPublicClient as A, createWalletClient as j, custom as Ce, http as M } from "viem";
5
- import { ethers as we } from "ethers";
6
- import { useCallback as N, useEffect as P, useMemo as F, useRef as Te, useState as I } from "react";
7
- import { jsx as L, jsxs as Ee } from "react/jsx-runtime";
8
- import { SeedProvider as De, SeedProvider as Oe, useLiveQuery as R } from "@seedprotocol/react";
9
- import { entryPoint08Address as z } from "viem/account-abstraction";
10
- import { createSmartAccountClient as B } from "permissionless";
11
- import { to7702SimpleSmartAccount as ke } from "permissionless/accounts";
12
- import { createPimlicoClient as Ae } from "permissionless/clients/pimlico";
13
- import { and as je, desc as V, eq as H, inArray as Me, notInArray as U } from "drizzle-orm";
14
- import { useSelector as Ne } from "@xstate/react";
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";
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";
4
+ import { BaseDb as D, arweaveL1FinalizeJobs as O, isItemOwned as Le, publishProcesses as k, uploadProcesses as Re } from "@seedprotocol/sdk";
5
+ import { createPublicClient as ze, createWalletClient as Be, custom as Ve, http as A } from "viem";
6
+ import { ethers as He } from "ethers";
7
+ import { useCallback as j, useEffect as M, useMemo as N, useRef as Ue, useState as P } from "react";
8
+ import { jsx as F, jsxs as We } from "react/jsx-runtime";
9
+ import { SeedProvider as Ge, SeedProvider as Ke, useLiveQuery as I } from "@seedprotocol/react";
10
+ import { entryPoint08Address as L } from "viem/account-abstraction";
11
+ import { createSmartAccountClient as qe } from "permissionless";
12
+ import { to7702SimpleSmartAccount as Je } from "permissionless/accounts";
13
+ import { createPimlicoClient as Ye } from "permissionless/clients/pimlico";
14
+ import { SchemaEncoder as Xe, SchemaRegistry as Ze, ZERO_BYTES32 as R } from "@ethereum-attestation-service/eas-sdk";
15
+ import { and as Qe, desc as z, eq as B, inArray as $e, notInArray as V } from "drizzle-orm";
16
+ import { useSelector as et } from "@xstate/react";
17
+ import { DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS as tt, DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS as nt, DOMAIN_OWNERSHIP_METHOD as rt, DOMAIN_OWNERSHIP_METHOD as H, DOMAIN_OWNERSHIP_SCHEMA_DEF as it, DOMAIN_OWNERSHIP_SCHEMA_DEF as U, DOMAIN_OWNERSHIP_SCHEMA_NAME as at, DOMAIN_OWNERSHIP_SCHEMA_NAME as ot, DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE as W, assessDomainOwnership as st, buildDomainOwnershipTxtValue as ct, decodeDomainOwnershipData as lt, domainOwnershipTxtName as ut, getDomainOwnershipFromEas as dt, hashDomainOwnershipChallenge as ft, hashDomainRegistryFingerprint as pt, isValidEasAttestationUid as mt, normalizeBytes32Hex as G, parseDomainOwnershipTxtValue as ht } from "@seedprotocol/eas";
18
+ import { randomBytes as gt } from "node:crypto";
19
+ import { lookup as _t, toRegistrableDomain as vt } from "rdapper";
20
+ import { promises as yt } from "node:dns";
15
21
  //#region src/react/PublishModeButtons.tsx
16
- var Pe = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish mode" }) => {
22
+ var bt = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish mode" }) => {
17
23
  let i = {
18
24
  display: "inline-flex",
19
25
  gap: 8,
@@ -28,17 +34,17 @@ var Pe = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish
28
34
  cursor: n ? "not-allowed" : "pointer",
29
35
  opacity: n ? .6 : 1
30
36
  });
31
- return /* @__PURE__ */ Ee("div", {
37
+ return /* @__PURE__ */ We("div", {
32
38
  role: "group",
33
39
  "aria-label": r,
34
40
  style: i,
35
- children: [/* @__PURE__ */ L("button", {
41
+ children: [/* @__PURE__ */ F("button", {
36
42
  type: "button",
37
43
  disabled: n,
38
44
  style: a(e === "patch"),
39
45
  onClick: () => t("patch"),
40
46
  children: "Publish updates"
41
- }), /* @__PURE__ */ L("button", {
47
+ }), /* @__PURE__ */ F("button", {
42
48
  type: "button",
43
49
  disabled: n,
44
50
  style: a(e === "new_version"),
@@ -46,11 +52,11 @@ var Pe = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish
46
52
  children: "New version"
47
53
  })]
48
54
  });
49
- }, Fe = ({ children: e, config: t, queryClient: n, queryClientRef: r }) => (P(() => {
50
- t && m(t);
51
- }, [t]), /* @__PURE__ */ L(ee.Provider, {
52
- value: t ?? d(),
53
- children: /* @__PURE__ */ L(Oe, {
55
+ }, xt = ({ children: e, config: t, queryClient: n, queryClientRef: r }) => (M(() => {
56
+ t && x(t);
57
+ }, [t]), /* @__PURE__ */ F(Ce.Provider, {
58
+ value: t ?? oe(),
59
+ children: /* @__PURE__ */ F(Ke, {
54
60
  queryClient: n,
55
61
  queryClientRef: r,
56
62
  children: e
@@ -58,27 +64,27 @@ var Pe = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish
58
64
  }));
59
65
  //#endregion
60
66
  //#region src/helpers/adapters/eip1193.ts
61
- async function W(e, t = {}) {
62
- let n = t.chain ?? x(), r = t.address;
67
+ async function K(e, t = {}) {
68
+ let n = t.chain ?? s(), r = t.address;
63
69
  if (!r) {
64
70
  let t = await e.request({ method: "eth_requestAccounts" });
65
71
  if (!t?.[0]) throw Error("@seedprotocol/publish: EIP-1193 provider returned no accounts");
66
72
  r = t[0];
67
73
  }
68
- let i = j({
74
+ let i = Be({
69
75
  account: r,
70
76
  chain: n,
71
- transport: Ce(e)
77
+ transport: Ve(e)
72
78
  });
73
79
  return {
74
- signer: c({
80
+ signer: te({
75
81
  address: r,
76
82
  signMessage: async ({ message: e }) => i.signMessage({
77
83
  account: r,
78
84
  message: typeof e == "string" ? e : { raw: e.raw }
79
85
  })
80
86
  }),
81
- txSender: h({
87
+ txSender: S({
82
88
  address: r,
83
89
  sendTransaction: async (e) => ({ transactionHash: await i.sendTransaction({
84
90
  account: r,
@@ -91,14 +97,14 @@ async function W(e, t = {}) {
91
97
  })
92
98
  };
93
99
  }
94
- async function Ie(e = {}) {
100
+ async function St(e = {}) {
95
101
  let t = globalThis.ethereum;
96
102
  if (!t) throw Error("@seedprotocol/publish: window.ethereum is not available");
97
- return W(t, e);
103
+ return K(t, e);
98
104
  }
99
105
  //#endregion
100
106
  //#region src/helpers/adapters/permissionlessTxSender.ts
101
- function Le(e) {
107
+ function Ct(e) {
102
108
  return {
103
109
  address: e.address,
104
110
  type: "local",
@@ -113,35 +119,35 @@ function Le(e) {
113
119
  }
114
120
  };
115
121
  }
116
- async function G(e) {
117
- let { signer: t, bundlerUrl: n, paymasterUrl: r } = e, i = x(), a = ge(), o = t.address, s = await ke({
118
- client: A({
119
- chain: i,
120
- transport: M(a)
121
- }),
122
- owner: Le(t),
122
+ async function q(e) {
123
+ let { signer: t, bundlerUrl: n, paymasterUrl: r } = e, i = s(), o = a(), c = t.address, l = ze({
124
+ chain: i,
125
+ transport: A(o)
126
+ }), u = Ct(t), d = await Je({
127
+ client: l,
128
+ owner: u,
123
129
  entryPoint: {
124
- address: z,
130
+ address: L,
125
131
  version: "0.8"
126
132
  }
127
- }), c = Ae({
128
- transport: M(r ?? n),
133
+ }), f = Ye({
134
+ transport: A(r ?? n),
129
135
  entryPoint: {
130
- address: z,
136
+ address: L,
131
137
  version: "0.8"
132
138
  }
133
- }), l = B({
134
- account: s,
139
+ }), p = qe({
140
+ account: d,
135
141
  chain: i,
136
- bundlerTransport: M(n),
137
- paymaster: c,
138
- userOperation: { estimateFeesPerGas: async () => (await c.getUserOperationGasPrice()).fast }
142
+ bundlerTransport: A(n),
143
+ paymaster: f,
144
+ userOperation: { estimateFeesPerGas: async () => (await f.getUserOperationGasPrice()).fast }
139
145
  });
140
- return h({
141
- address: s.address ?? o,
146
+ return S({
147
+ address: d.address ?? c,
142
148
  sendTransaction: async (e) => {
143
149
  try {
144
- return { transactionHash: await l.sendTransaction({
150
+ return { transactionHash: await p.sendTransaction({
145
151
  to: e.to,
146
152
  data: e.data,
147
153
  value: e.value ?? 0n,
@@ -156,18 +162,18 @@ async function G(e) {
156
162
  }
157
163
  //#endregion
158
164
  //#region src/react/useSeedWallet.ts
159
- function Re() {
160
- let [e, t] = I(() => _()), [n, r] = I(() => _() ? "connected" : "disconnected");
161
- P(() => {
162
- t(_());
165
+ function wt() {
166
+ let [e, t] = P(() => T()), [n, r] = P(() => T() ? "connected" : "disconnected");
167
+ M(() => {
168
+ t(T());
163
169
  }, []);
164
- let i = N(async (e) => {
170
+ let i = j(async (e) => {
165
171
  r("connecting");
166
172
  try {
167
173
  let n;
168
- n = s(e) ? e : await W(e);
169
- let i = f(), a = n.txSender;
170
- i.accountMode === "eip7702" && i.bundlerUrl && (a = await G({
174
+ n = b(e) ? e : await K(e);
175
+ let i = C(), a = n.txSender;
176
+ i.accountMode === "eip7702" && i.bundlerUrl && (a = await q({
171
177
  signer: n.signer,
172
178
  bundlerUrl: i.bundlerUrl,
173
179
  paymasterUrl: i.paymasterUrl
@@ -178,12 +184,12 @@ function Re() {
178
184
  ownedAddresses: [n.signer.address, a.address],
179
185
  publisherAddress: n.signer.address
180
186
  };
181
- return await g(o), t(o), r("connected"), o;
187
+ return await _(o), t(o), r("connected"), o;
182
188
  } catch (e) {
183
189
  throw r("disconnected"), e;
184
190
  }
185
- }, []), a = N(() => {
186
- l(), t(null), r("disconnected");
191
+ }, []), a = j(() => {
192
+ w(), t(null), r("disconnected");
187
193
  }, []);
188
194
  return {
189
195
  address: e?.signer.address,
@@ -196,34 +202,34 @@ function Re() {
196
202
  }
197
203
  //#endregion
198
204
  //#region src/helpers/publishDisplayHelpers.ts
199
- function ze(e) {
205
+ function Tt(e) {
200
206
  return e === "creatingAttestationsDirectToEas" ? "creatingAttestations" : e;
201
207
  }
202
- function K(e, t, n) {
203
- if (e != null) return n;
204
- if (t?.status === "completed") return o.SUCCESS;
205
- if (t?.status === "failed") return o.FAILURE;
206
- if (t?.status !== "interrupted") return n;
207
- }
208
- function q(e) {
209
- if (e) {
210
- if (e.status === "failed") return o.FAILURE;
211
- if (e.status === "completed") return o.SUCCESS;
212
- if (e.status !== "interrupted") {
213
- if (e.completedAt != null) {
208
+ function Et(t, n, r) {
209
+ if (t != null) return r;
210
+ if (n?.status === "completed") return e.SUCCESS;
211
+ if (n?.status === "failed") return e.FAILURE;
212
+ if (n?.status !== "interrupted") return r;
213
+ }
214
+ function Dt(t) {
215
+ if (t) {
216
+ if (t.status === "failed") return e.FAILURE;
217
+ if (t.status === "completed") return e.SUCCESS;
218
+ if (t.status !== "interrupted") {
219
+ if (t.completedAt != null) {
214
220
  try {
215
- let t = JSON.parse(e.persistedSnapshot);
216
- if (t.status === "done" && t.value === o.FAILURE) return o.FAILURE;
221
+ let n = JSON.parse(t.persistedSnapshot);
222
+ if (n.status === "done" && n.value === e.FAILURE) return e.FAILURE;
217
223
  } catch {}
218
- return o.SUCCESS;
224
+ return e.SUCCESS;
219
225
  }
220
226
  try {
221
- let t = JSON.parse(e.persistedSnapshot);
222
- if (t.status === "done") {
223
- if (t.value === o.SUCCESS) return o.SUCCESS;
224
- if (t.value === o.FAILURE) return o.FAILURE;
227
+ let n = JSON.parse(t.persistedSnapshot);
228
+ if (n.status === "done") {
229
+ if (n.value === e.SUCCESS) return e.SUCCESS;
230
+ if (n.value === e.FAILURE) return e.FAILURE;
225
231
  }
226
- if (typeof t.value == "string") return t.value;
232
+ if (typeof n.value == "string") return n.value;
227
233
  } catch {
228
234
  return;
229
235
  }
@@ -232,91 +238,91 @@ function q(e) {
232
238
  }
233
239
  //#endregion
234
240
  //#region src/hooks/usePublishProcess.ts
235
- function Be(e) {
236
- return !e || e.status !== "done" ? !1 : e.value === o.SUCCESS || e.value === o.FAILURE;
237
- }
238
- function J(e) {
239
- let t = Ne(C.getService(), (t) => t?.context?.publishProcesses?.get(e) ?? null), n = Te(null);
240
- P(() => {
241
- n.current = null;
242
- }, [e]);
243
- let [r, i] = I(void 0), [a, s] = I(null), c = T.getAppDb(), l = R(F(() => e && c ? c.select().from(O).where(H(O.seedLocalId, e)).orderBy(V(O.startedAt)).limit(1) : null, [c, e]))?.[0], u = l?.status, d = F(() => {
244
- if (t != null) return r;
245
- if (a === "success" || a === "failure") return a;
246
- let e = q(l);
247
- return e === o.SUCCESS || e === o.FAILURE ? e : K(t, u == null ? void 0 : { status: u }, r);
241
+ function Ot(t) {
242
+ return !t || t.status !== "done" ? !1 : t.value === e.SUCCESS || t.value === e.FAILURE;
243
+ }
244
+ function kt(t) {
245
+ let n = E.getService(), r = et(n, (e) => e?.context?.publishProcesses?.get(t) ?? null), i = Ue(null);
246
+ M(() => {
247
+ i.current = null;
248
+ }, [t]);
249
+ let [a, o] = P(void 0), [s, c] = P(null), l = D.getAppDb(), u = N(() => t && l ? l.select().from(k).where(B(k.seedLocalId, t)).orderBy(z(k.startedAt)).limit(1) : null, [l, t]), d = I(u)?.[0], f = d?.status, p = N(() => {
250
+ if (r != null) return a;
251
+ if (s === "success" || s === "failure") return s;
252
+ let t = Dt(d);
253
+ return t === e.SUCCESS || t === e.FAILURE ? t : Et(r, f == null ? void 0 : { status: f }, a);
248
254
  }, [
249
- t,
250
- u,
251
255
  r,
256
+ f,
252
257
  a,
253
- l
258
+ s,
259
+ d
254
260
  ]);
255
- return P(() => {
256
- s(null);
257
- }, [e]), P(() => {
258
- t ?? (u === "completed" ? s("success") : u === "failed" && s("failure"));
259
- }, [u, t]), P(() => {
260
- t != null && s(null);
261
- }, [t]), P(() => {
262
- if (!t) {
263
- let e = n.current;
264
- Be(e) ? (i(e.value), e.value === o.SUCCESS ? s("success") : e.value === o.FAILURE && s("failure")) : i(void 0);
261
+ return M(() => {
262
+ c(null);
263
+ }, [t]), M(() => {
264
+ r ?? (f === "completed" ? c("success") : f === "failed" && c("failure"));
265
+ }, [f, r]), M(() => {
266
+ r != null && c(null);
267
+ }, [r]), M(() => {
268
+ if (!r) {
269
+ let t = i.current;
270
+ Ot(t) ? (o(t.value), t.value === e.SUCCESS ? c("success") : t.value === e.FAILURE && c("failure")) : o(void 0);
265
271
  return;
266
272
  }
267
- let e = t.getSnapshot();
268
- n.current = {
269
- value: e?.value,
270
- status: e.status
271
- }, i(e?.value);
272
- let r = t.subscribe((e) => {
273
- n.current = {
273
+ let t = r.getSnapshot();
274
+ i.current = {
275
+ value: t?.value,
276
+ status: t.status
277
+ }, o(t?.value);
278
+ let n = r.subscribe((e) => {
279
+ i.current = {
274
280
  value: e?.value,
275
281
  status: e?.status
276
- }, i(e?.value);
282
+ }, o(e?.value);
277
283
  });
278
284
  return () => {
279
- r.unsubscribe();
285
+ n.unsubscribe();
280
286
  };
281
- }, [t, e]), {
282
- publishProcess: t ?? null,
283
- value: d
287
+ }, [r, t]), {
288
+ publishProcess: r ?? null,
289
+ value: p
284
290
  };
285
291
  }
286
292
  //#endregion
287
293
  //#region src/hooks/useCanPublishItem.ts
288
- function Ve(e) {
289
- let [t, n] = I(!0);
290
- return P(() => {
294
+ function At(e) {
295
+ let [t, n] = P(!0);
296
+ return M(() => {
291
297
  if (!e) {
292
298
  n(!1);
293
299
  return;
294
300
  }
295
- D(e).then(n).catch(() => n(!1));
301
+ Le(e).then(n).catch(() => n(!1));
296
302
  }, [e?.seedLocalId]), t;
297
303
  }
298
304
  //#endregion
299
305
  //#region src/hooks/useArweaveL1Finalize.ts
300
- function Y(e) {
301
- let t = T.getAppDb(), n = R(F(() => e && t ? t.select().from(E).where(H(E.seedLocalId, e)).orderBy(V(E.updatedAt)) : null, [t, e])) ?? [];
302
- return F(() => {
303
- let e = n.filter((e) => e.phase === "pending_l1").length, t = n.filter((e) => e.phase === "confirmed").length;
306
+ function jt(e) {
307
+ let t = D.getAppDb(), n = N(() => e && t ? t.select().from(O).where(B(O.seedLocalId, e)).orderBy(z(O.updatedAt)) : null, [t, e]), r = I(n) ?? [];
308
+ return N(() => {
309
+ let e = r.filter((e) => e.phase === "pending_l1").length, t = r.filter((e) => e.phase === "confirmed").length;
304
310
  return {
305
311
  hasPendingL1: e > 0,
306
312
  pendingCount: e,
307
313
  confirmedCount: t,
308
- jobs: n
314
+ jobs: r
309
315
  };
310
- }, [n]);
316
+ }, [r]);
311
317
  }
312
318
  //#endregion
313
319
  //#region src/hooks/useItemPublishStatus.ts
314
- function He(e) {
315
- let { publishProcess: t, value: n } = J(e ?? ""), r = Y(e), i = T.getAppDb(), a = R(F(() => e && i ? i.select().from(O).where(H(O.seedLocalId, e)).orderBy(V(O.startedAt)).limit(1) : null, [i, e]))?.[0];
320
+ function Mt(e) {
321
+ let { publishProcess: t, value: n } = kt(e ?? ""), r = jt(e), i = D.getAppDb(), a = N(() => e && i ? i.select().from(k).where(B(k.seedLocalId, e)).orderBy(z(k.startedAt)).limit(1) : null, [i, e]), o = I(a)?.[0];
316
322
  return {
317
- latestRecord: a,
323
+ latestRecord: o,
318
324
  publishProcess: t,
319
- isActive: !!t || a?.status === "in_progress",
325
+ isActive: !!t || o?.status === "in_progress",
320
326
  publishValue: n,
321
327
  arweaveL1Pending: r.hasPendingL1,
322
328
  arweaveL1Jobs: r.jobs,
@@ -325,88 +331,90 @@ function He(e) {
325
331
  }
326
332
  //#endregion
327
333
  //#region src/hooks/usePublishProcesses.ts
328
- function X() {
329
- let e = T.getAppDb();
330
- return F(() => e ? e.select().from(O).orderBy(V(O.startedAt)) : null, [e]);
334
+ function Nt() {
335
+ let e = D.getAppDb();
336
+ return N(() => e ? e.select().from(k).orderBy(z(k.startedAt)) : null, [e]);
331
337
  }
332
- function Z(e) {
333
- let t = T.getAppDb();
334
- return F(() => t && e ? t.select().from(O).where(H(O.seedLocalId, e)).orderBy(V(O.startedAt)) : null, [t, e]);
338
+ function Pt(e) {
339
+ let t = D.getAppDb();
340
+ return N(() => t && e ? t.select().from(k).where(B(k.seedLocalId, e)).orderBy(z(k.startedAt)) : null, [t, e]);
335
341
  }
336
- function Q() {
337
- let e = R(X());
342
+ function Ft() {
343
+ let e = Nt(), t = I(e);
338
344
  return {
339
- records: e,
340
- nonActiveCount: F(() => e === void 0 ? void 0 : e.filter((e) => e.status !== "in_progress").length, [e])
345
+ records: t,
346
+ nonActiveCount: N(() => t === void 0 ? void 0 : t.filter((e) => e.status !== "in_progress").length, [t])
341
347
  };
342
348
  }
343
- function Ue() {
344
- return R(X());
349
+ function It() {
350
+ let e = Nt();
351
+ return I(e);
345
352
  }
346
- function We() {
347
- return Q().nonActiveCount;
353
+ function Lt() {
354
+ return Ft().nonActiveCount;
348
355
  }
349
- function Ge(e) {
350
- return R(Z(e));
356
+ function Rt(e) {
357
+ let t = Pt(e);
358
+ return I(t);
351
359
  }
352
- function $(e) {
353
- let t = R(Z(e));
360
+ function zt(e) {
361
+ let t = Pt(e), n = I(t);
354
362
  return {
355
- records: t,
356
- nonActiveCount: F(() => t === void 0 ? void 0 : t.filter((e) => e.status !== "in_progress").length, [t])
363
+ records: n,
364
+ nonActiveCount: N(() => n === void 0 ? void 0 : n.filter((e) => e.status !== "in_progress").length, [n])
357
365
  };
358
366
  }
359
- function Ke(e) {
360
- return $(e).nonActiveCount;
367
+ function Bt(e) {
368
+ return zt(e).nonActiveCount;
361
369
  }
362
- function qe(e) {
363
- let t = T.getAppDb(), n = R(F(() => e != null && t ? t.select().from(O).where(H(O.id, e)).limit(1) : null, [t, e])), r = n === void 0;
370
+ function Vt(e) {
371
+ let t = D.getAppDb(), n = N(() => e != null && t ? t.select().from(k).where(B(k.id, e)).limit(1) : null, [t, e]), r = I(n), i = r === void 0;
364
372
  return {
365
- record: n && n.length > 0 ? n[0] : null,
366
- isLoading: r
373
+ record: r && r.length > 0 ? r[0] : null,
374
+ isLoading: i
367
375
  };
368
376
  }
369
377
  //#endregion
370
378
  //#region src/hooks/clearCompletedPublishProcesses.ts
371
- async function Je() {
372
- let e = T.getAppDb();
373
- e && await e.delete(O).where(U(O.status, ["in_progress"]));
374
- }
375
- async function Ye(e) {
376
- let t = T.getAppDb();
377
- t && await t.delete(O).where(je(H(O.seedLocalId, e), U(O.status, ["in_progress"])));
379
+ async function Ht() {
380
+ let e = D.getAppDb();
381
+ e && await e.delete(k).where(V(k.status, ["in_progress"]));
378
382
  }
379
- async function Xe() {
380
- let e = T.getAppDb();
381
- e && await e.delete(O);
383
+ async function Ut(e) {
384
+ let t = D.getAppDb();
385
+ t && await t.delete(k).where(Qe(B(k.seedLocalId, e), V(k.status, ["in_progress"])));
382
386
  }
383
- async function Ze() {
384
- let e = T.getAppDb();
387
+ async function Wt() {
388
+ let e = D.getAppDb();
385
389
  e && await e.delete(k);
386
390
  }
387
- async function Qe(e) {
388
- let t = T.getAppDb();
389
- t && await t.delete(O).where(H(O.seedLocalId, e));
391
+ async function Gt() {
392
+ let e = D.getAppDb();
393
+ e && await e.delete(Re);
390
394
  }
391
- async function $e(e) {
392
- let t = T.getAppDb();
393
- t && await t.delete(O).where(H(O.id, e));
395
+ async function Kt(e) {
396
+ let t = D.getAppDb();
397
+ t && await t.delete(k).where(B(k.seedLocalId, e));
394
398
  }
395
- async function et(e) {
399
+ async function qt(e) {
400
+ let t = D.getAppDb();
401
+ t && await t.delete(k).where(B(k.id, e));
402
+ }
403
+ async function Jt(e) {
396
404
  if (e.length === 0) return;
397
- let t = T.getAppDb();
398
- t && await t.delete(O).where(Me(O.id, e));
405
+ let t = D.getAppDb();
406
+ t && await t.delete(k).where($e(k.id, e));
399
407
  }
400
408
  //#endregion
401
409
  //#region src/hooks/publishProcessHelpers.ts
402
- function tt(e) {
410
+ function Yt(e) {
403
411
  try {
404
412
  return (JSON.parse(e.persistedSnapshot).context?.arweaveTransactions ?? []).map((e) => e.transaction?.id).filter((e) => typeof e == "string");
405
413
  } catch {
406
414
  return [];
407
415
  }
408
416
  }
409
- function nt(e) {
417
+ function Xt(e) {
410
418
  try {
411
419
  return JSON.parse(e.persistedSnapshot).context?.easPayload ?? void 0;
412
420
  } catch {
@@ -415,7 +423,7 @@ function nt(e) {
415
423
  }
416
424
  //#endregion
417
425
  //#region src/helpers/transformPayloadToIntegerIds.ts
418
- function rt(e) {
426
+ function Zt(e) {
419
427
  let t = /* @__PURE__ */ new Map();
420
428
  for (let n = 0; n < e.length; n++) {
421
429
  let r = e[n]?.localId;
@@ -440,26 +448,26 @@ function rt(e) {
440
448
  }
441
449
  //#endregion
442
450
  //#region src/helpers/ensureWalletThenPublish.ts
443
- function it(e) {
451
+ function Qt(e) {
444
452
  if (e) {
445
- if (e instanceof we.Wallet) return e;
446
- if (s(e)) return e.signer;
447
- if (u(e)) return e;
453
+ if (e instanceof He.Wallet) return e;
454
+ if (b(e)) return e.signer;
455
+ if (y(e)) return e;
448
456
  }
449
457
  }
450
- async function at(e, t) {
451
- let n = f();
458
+ async function $t(e, t) {
459
+ let n = C();
452
460
  if (n.useModularExecutor) {
453
- let { ensureSmartWalletThenPublish: n } = await import("./ensureSmartWalletThenPublish-DzOnwM-9.js").then((e) => e.n);
461
+ let { ensureSmartWalletThenPublish: n } = await import("./ensureSmartWalletThenPublish-s7MBAeky.js").then((e) => e.n);
454
462
  return n(e, null, async () => {
455
- let e = _();
463
+ let e = T();
456
464
  return e?.publisherAddress ?? e?.signer.address ?? null;
457
465
  }, t);
458
466
  }
459
- let r = _();
467
+ let r = T();
460
468
  if (!r) return { outcome: "no_wallet" };
461
469
  if (n.accountMode === "eip7702" && n.bundlerUrl) {
462
- let e = await G({
470
+ let e = await q({
463
471
  signer: r.signer,
464
472
  bundlerUrl: n.bundlerUrl,
465
473
  paymasterUrl: n.paymasterUrl
@@ -471,12 +479,379 @@ async function at(e, t) {
471
479
  };
472
480
  }
473
481
  let i = r.publisherAddress ?? r.txSender.address ?? r.signer.address;
474
- return i?.trim() ? (C.createPublish(e, i, r, {
482
+ return i?.trim() ? (E.createPublish(e, i, r, {
475
483
  ...t,
476
- dataItemSigner: it(t?.dataItemSigner) ?? r.signer
484
+ dataItemSigner: Qt(t?.dataItemSigner) ?? r.signer
477
485
  }), { outcome: "started" }) : { outcome: "no_address" };
478
486
  }
479
487
  //#endregion
480
- export { _e as AttestationVerificationError, te as Eip7702ModularAccountPublishError, ve as MULTI_PUBLISH_ABI_REFERENCE_ADDRESS_OP_SEPOLIA, a as ManagedAccountPublishError, C as PublishManager, Pe as PublishModeButtons, Fe as PublishProvider, i as SEED_PROTOCOL_CONTRACT_ADDRESS_OP_SEPOLIA, De as SeedProvider, ye as asPublishWallet, t as asSeedSigner, ne as asSeedTxSender, S as buildPublishAnchorBytes, Xe as clearAllPublishProcesses, Ze as clearAllUploadProcesses, Je as clearCompletedPublishProcesses, Ye as clearCompletedPublishProcessesForSeed, l as clearPublishWallet, oe as configurePublish, G as createPermissionlessTxSender, $e as deletePublishProcessById, et as deletePublishProcessesByIds, Qe as deletePublishProcessesForSeed, fe as encodeEasAttest, b as encodeEasMultiAttest, ae as encodeEasMultiRevoke, ue as encodeMultiPublish, pe as encodeMultiPublishInteger, ce as encodeSetEas, w as ensureEasSchemasForItem, me as ensureManagedAccountEasConfigured, at as ensureWalletThenPublish, W as fromEip1193Provider, re as fromEthersWallet, Ie as fromWindowEthereum, xe as getArweave, tt as getArweaveTransactionIds, ze as getDisplayStepId, nt as getEasPayload, f as getPublishConfig, q as getPublishMachineValueForUi, le as getPublishPublicClient, _ as getPublishWallet, m as initPublish, y as isContractDeployed, r as isEip7702ModularAccountPublishError, p as isManagedAccountPublishError, s as isPublishWallet, se as isRouterNonModularCoreAccountError, u as isSeedSigner, de as isSeedTxSender, Se as publishMachine, he as readGetEas, v as readIsActiveSigner, K as resolvePublishDisplayValue, g as setPublishWallet, e as stringifyUnderlyingCause, rt as transformPayloadToIntegerIds, Y as useArweaveL1Finalize, Ve as useCanPublishItem, He as useItemPublishStatus, n as usePublishConfig, J as usePublishProcess, qe as usePublishProcessById, Ue as usePublishProcesses, Ge as usePublishProcessesForSeed, We as usePublishProcessesNonActiveCount, Ke as usePublishProcessesNonActiveCountForSeed, Q as usePublishProcessesState, $ as usePublishProcessesStateForSeed, Re as useSeedWallet, be as verifyDataItem, ie as waitForPublishReceipt };
488
+ //#region src/services/domainOwnership/registry.ts
489
+ function J(e) {
490
+ let t = vt(e);
491
+ if (!t) throw Error(`@seedprotocol/publish: unable to resolve registrable domain for "${e}"`);
492
+ return t.toLowerCase();
493
+ }
494
+ async function Y(e) {
495
+ let t = J(e), n = await _t(t);
496
+ if (!n.ok || !n.record) return null;
497
+ let r = n.record;
498
+ return {
499
+ domain: t,
500
+ creationDate: r.creationDate ?? "",
501
+ registrarIanaId: r.registrar?.ianaId ?? "",
502
+ expirationDate: r.expirationDate,
503
+ updatedDate: r.updatedDate,
504
+ registrarName: r.registrar?.name,
505
+ source: r.source,
506
+ isRegistered: r.isRegistered
507
+ };
508
+ }
509
+ function en(e) {
510
+ return pt({
511
+ domain: e.domain,
512
+ creationDate: e.creationDate ?? "",
513
+ registrarIanaId: e.registrarIanaId ?? ""
514
+ });
515
+ }
516
+ //#endregion
517
+ //#region src/services/domainOwnership/challenge.ts
518
+ function tn(e) {
519
+ return Buffer.from(e).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
520
+ }
521
+ function nn(e) {
522
+ let t = e.normalizeRegistrable === !1 ? e.domain.trim().toLowerCase().replace(/\.$/, "") : J(e.domain);
523
+ if (!t || t.includes(" ")) throw Error("@seedprotocol/publish: createDomainOwnershipChallenge requires a valid domain");
524
+ let n = e.claimer.trim();
525
+ if (!/^0x[0-9a-fA-F]{40}$/.test(n)) throw Error("@seedprotocol/publish: createDomainOwnershipChallenge requires a 20-byte hex claimer address");
526
+ let r = e.scope ?? W, i = e.ttlMs ?? tt, a = e.now ?? Date.now(), o = new Date(a + i).toISOString(), s = tn(gt(32)), c = ft({
527
+ domain: t,
528
+ claimer: n,
529
+ token: s,
530
+ scope: r
531
+ }), l = ut(t), u = ct({
532
+ token: s,
533
+ claimer: n,
534
+ expiry: o
535
+ });
536
+ return {
537
+ challengeId: tn(gt(16)),
538
+ domain: t,
539
+ claimer: n,
540
+ scope: r,
541
+ method: H,
542
+ token: s,
543
+ txtName: l,
544
+ txtValue: u,
545
+ challengeHash: c,
546
+ expiresAt: o,
547
+ digHint: `dig TXT ${l}`
548
+ };
549
+ }
550
+ //#endregion
551
+ //#region src/services/domainOwnership/dnsVerify.ts
552
+ async function rn(e) {
553
+ return {
554
+ source: "node:dns",
555
+ values: (await yt.resolveTxt(e)).map((e) => e.join(""))
556
+ };
557
+ }
558
+ async function X(e, t, n) {
559
+ let r = `${n}?name=${encodeURIComponent(e)}&type=TXT`, i = await fetch(r, { headers: { accept: "application/dns-json" } });
560
+ if (!i.ok) throw Error(`DoH ${t} HTTP ${i.status}`);
561
+ let a = await i.json();
562
+ return {
563
+ source: t,
564
+ values: (a.Answer ?? []).filter((e) => e.type === 16 && typeof e.data == "string").map((e) => e.data.replace(/^"|"$/g, "")),
565
+ dnssecAuthenticated: !!a.AD
566
+ };
567
+ }
568
+ var an = [
569
+ (e) => rn(e),
570
+ (e) => X(e, "cloudflare-doh", "https://cloudflare-dns.com/dns-query"),
571
+ (e) => X(e, "google-doh", "https://dns.google/resolve")
572
+ ];
573
+ function on(e, t) {
574
+ let n = ht(t);
575
+ for (let r of e) {
576
+ if (r === t || r.replace(/^"|"$/g, "") === t) return !0;
577
+ let e = ht(r);
578
+ if (n && e && e.token === n.token && e.claimer === n.claimer) return !0;
579
+ }
580
+ return !1;
581
+ }
582
+ async function sn(e, t) {
583
+ let n = t?.now ?? Date.now();
584
+ if (Date.parse(e.expiresAt) <= n) return {
585
+ ok: !1,
586
+ matchedSources: [],
587
+ lookups: [],
588
+ error: "Challenge expired"
589
+ };
590
+ let r = ct({
591
+ token: e.token,
592
+ claimer: e.claimer,
593
+ expiry: e.expiresAt
594
+ });
595
+ if (r !== e.txtValue) return {
596
+ ok: !1,
597
+ matchedSources: [],
598
+ lookups: [],
599
+ error: "Challenge txtValue does not match token/claimer/expiry"
600
+ };
601
+ let i = t?.lookups ?? an, a = t?.quorum ?? 2, o = [], s = [], c = !1;
602
+ await Promise.all(i.map(async (t) => {
603
+ try {
604
+ let n = await t(e.txtName);
605
+ o.push(n), on(n.values, r) && (s.push(n.source), n.dnssecAuthenticated && (c = !0));
606
+ } catch {
607
+ o.push({
608
+ source: "error",
609
+ values: []
610
+ });
611
+ }
612
+ }));
613
+ let l = c || s.length >= a;
614
+ return {
615
+ ok: l,
616
+ matchedSources: s,
617
+ lookups: o,
618
+ error: l ? void 0 : `DNS TXT not confirmed (matched ${s.length}/${a} sources)`
619
+ };
620
+ }
621
+ //#endregion
622
+ //#region src/services/domainOwnership/index.ts
623
+ var cn = "0x0000000000000000000000000000000000000000", ln = !0;
624
+ function Z(e) {
625
+ if (b(e)) return e.txSender;
626
+ if (g(e)) return e;
627
+ throw Error("@seedprotocol/publish: domain ownership write APIs require a PublishWallet or SeedTxSender");
628
+ }
629
+ async function Q(e, t) {
630
+ let n = await e.sendTransaction(t);
631
+ return m(n.transactionHash);
632
+ }
633
+ function $() {
634
+ return Ze.getSchemaUID(U, cn, ln);
635
+ }
636
+ async function un(e) {
637
+ let t = Z(e), n = $();
638
+ return await Se(n) || (await Q(t, xe({
639
+ schema: U,
640
+ resolverAddress: cn,
641
+ revocable: ln
642
+ })), await Q(t, _e({
643
+ schemaUid: n,
644
+ schemaName: ot
645
+ }))), n;
646
+ }
647
+ function dn(e) {
648
+ return new Xe(U).encodeData([
649
+ {
650
+ name: "domain",
651
+ value: e.domain,
652
+ type: "string"
653
+ },
654
+ {
655
+ name: "claimer",
656
+ value: e.claimer,
657
+ type: "address"
658
+ },
659
+ {
660
+ name: "method",
661
+ value: e.method,
662
+ type: "string"
663
+ },
664
+ {
665
+ name: "challengeHash",
666
+ value: G(e.challengeHash),
667
+ type: "bytes32"
668
+ },
669
+ {
670
+ name: "verifiedAt",
671
+ value: e.verifiedAt,
672
+ type: "uint64"
673
+ },
674
+ {
675
+ name: "registryCreationDate",
676
+ value: e.registryCreationDate,
677
+ type: "string"
678
+ },
679
+ {
680
+ name: "registryExpirationDate",
681
+ value: e.registryExpirationDate,
682
+ type: "string"
683
+ },
684
+ {
685
+ name: "registryFingerprint",
686
+ value: G(e.registryFingerprint),
687
+ type: "bytes32"
688
+ },
689
+ {
690
+ name: "scope",
691
+ value: e.scope,
692
+ type: "string"
693
+ }
694
+ ]);
695
+ }
696
+ function fn(e) {
697
+ if (typeof e.override == "number" && e.override > 0) return e.override;
698
+ if (e.registryExpirationDate) {
699
+ let t = Date.parse(e.registryExpirationDate);
700
+ if (Number.isFinite(t) && t > 0) return Math.floor(t / 1e3);
701
+ }
702
+ return e.verifiedAt + nt;
703
+ }
704
+ async function pn(e) {
705
+ let t = Z(e.wallet), r = e.ensureSchema === !1 ? $() : await un(e.wallet), i = J(e.domain), a = e.claimer.trim();
706
+ if (!/^0x[0-9a-fA-F]{40}$/.test(a)) throw Error("@seedprotocol/publish: attestDomainOwnership requires a valid claimer address");
707
+ let o = G(e.challengeHash);
708
+ if (o === R) throw Error("@seedprotocol/publish: attestDomainOwnership requires a non-zero challengeHash");
709
+ let s = e.verifiedAt ?? Math.floor(Date.now() / 1e3), c = en({
710
+ domain: i,
711
+ creationDate: e.registrySnapshot.creationDate ?? "",
712
+ registrarIanaId: e.registrySnapshot.registrarIanaId ?? ""
713
+ }), l = e.registrySnapshot.creationDate ?? "", u = e.registrySnapshot.expirationDate ?? "", d = e.scope ?? W, p = e.method ?? H, m = fn({
714
+ verifiedAt: s,
715
+ registryExpirationDate: u,
716
+ override: e.expirationTime
717
+ }), h = dn({
718
+ domain: i,
719
+ claimer: a,
720
+ method: p,
721
+ challengeHash: o,
722
+ verifiedAt: s,
723
+ registryCreationDate: l,
724
+ registryExpirationDate: u,
725
+ registryFingerprint: c,
726
+ scope: d
727
+ }), g = await Q(t, f({
728
+ schema: r,
729
+ data: {
730
+ recipient: a,
731
+ expirationTime: BigInt(m),
732
+ revocable: !0,
733
+ refUID: R,
734
+ data: h,
735
+ value: 0n
736
+ }
737
+ }));
738
+ if (!g) throw Error("@seedprotocol/publish: attestDomainOwnership failed — no receipt");
739
+ let { easContractAddress: _ } = C(), v = n(g, _);
740
+ if (!v || !mt(v)) throw Error("@seedprotocol/publish: attestDomainOwnership failed — could not parse attestation UID");
741
+ return {
742
+ uid: v,
743
+ schemaUid: r,
744
+ challengeHash: o,
745
+ registryFingerprint: c,
746
+ verifiedAt: s,
747
+ expirationTime: m
748
+ };
749
+ }
750
+ async function mn(e) {
751
+ let t = Z(e.wallet), n = e.schemaUid ?? $(), i = G(e.uid);
752
+ if (!mt(i)) throw Error("@seedprotocol/publish: revokeDomainOwnership requires a valid attestation uid");
753
+ if (!await Q(t, r([{
754
+ schema: n,
755
+ data: [{ uid: i }]
756
+ }]))) throw Error("@seedprotocol/publish: revokeDomainOwnership failed — no receipt");
757
+ }
758
+ async function hn(e) {
759
+ let { challenge: t } = e, n = ft({
760
+ domain: t.domain,
761
+ claimer: t.claimer,
762
+ token: t.token,
763
+ scope: t.scope
764
+ });
765
+ if (G(n) !== G(t.challengeHash)) return {
766
+ ok: !1,
767
+ dns: {
768
+ ok: !1,
769
+ matchedSources: [],
770
+ lookups: [],
771
+ error: "challengeHash mismatch"
772
+ },
773
+ registrySnapshot: null,
774
+ challengeHash: n,
775
+ error: "Challenge hash does not match domain/claimer/token/scope"
776
+ };
777
+ let r = await sn(t, {
778
+ lookups: e.dnsLookups,
779
+ now: e.now
780
+ });
781
+ if (!r.ok) return {
782
+ ok: !1,
783
+ dns: r,
784
+ registrySnapshot: null,
785
+ challengeHash: n,
786
+ error: r.error ?? "DNS verification failed"
787
+ };
788
+ let i = e.registryLookup ?? Y, a;
789
+ try {
790
+ a = await i(t.domain);
791
+ } catch {
792
+ a = null;
793
+ }
794
+ return a ? {
795
+ ok: !0,
796
+ dns: r,
797
+ registrySnapshot: a,
798
+ challengeHash: n
799
+ } : {
800
+ ok: !1,
801
+ dns: r,
802
+ registrySnapshot: null,
803
+ challengeHash: n,
804
+ error: "Registry lookup failed"
805
+ };
806
+ }
807
+ async function gn(e) {
808
+ let t = await hn({
809
+ challenge: e.challenge,
810
+ dnsLookups: e.dnsLookups,
811
+ registryLookup: e.registryLookup,
812
+ now: e.now
813
+ });
814
+ if (!t.ok || !t.registrySnapshot) throw Error(`@seedprotocol/publish: verifyAndAttestDomainOwnership failed — ${t.error ?? "verification failed"}`);
815
+ return {
816
+ ...await pn({
817
+ wallet: e.wallet,
818
+ domain: e.challenge.domain,
819
+ claimer: e.challenge.claimer,
820
+ challengeHash: t.challengeHash,
821
+ registrySnapshot: t.registrySnapshot,
822
+ scope: e.challenge.scope,
823
+ method: e.challenge.method,
824
+ ensureSchema: e.ensureSchema
825
+ }),
826
+ registrySnapshot: t.registrySnapshot,
827
+ dns: t.dns
828
+ };
829
+ }
830
+ async function _n(e) {
831
+ let t = (await dt({
832
+ toolAddresses: e.toolAddresses,
833
+ schemaUid: e.schemaUid,
834
+ excludeRevoked: !0
835
+ })).find((t) => G(t.id) === G(e.uid));
836
+ if (!t) throw Error("@seedprotocol/publish: assessDomainOwnershipLive could not find attestation for uid/toolAddresses");
837
+ let n = lt(t.decodedDataJson ?? "[]"), r = e.registryLookup ?? Y, i;
838
+ try {
839
+ i = await r(n.domain);
840
+ } catch {
841
+ i = null;
842
+ }
843
+ return {
844
+ ...st({
845
+ decoded: n,
846
+ registrySnapshot: i,
847
+ now: e.now
848
+ }),
849
+ decoded: n,
850
+ uid: t.id,
851
+ registrySnapshot: i
852
+ };
853
+ }
854
+ //#endregion
855
+ export { he as AttestationVerificationError, rt as DOMAIN_OWNERSHIP_METHOD, it as DOMAIN_OWNERSHIP_SCHEMA_DEF, at as DOMAIN_OWNERSHIP_SCHEMA_NAME, de as Eip7702ModularAccountPublishError, h as MULTI_PUBLISH_ABI_REFERENCE_ADDRESS_OP_SEPOLIA, pe as ManagedAccountPublishError, Fe as PUBLISH_AUTHORIZATION_SCHEMA_DEF, Ae as PUBLISH_AUTHORIZATION_SCHEMA_NAME, Ne as PUBLISH_AUTHORIZATION_SCOPES, E as PublishManager, bt as PublishModeButtons, xt as PublishProvider, ee as SEED_PROTOCOL_CONTRACT_ADDRESS_OP_SEPOLIA, Ge as SeedProvider, ie as asPublishWallet, ce as asSeedSigner, v as asSeedTxSender, we as assertManagedAccountEasMatchesConfig, _n as assessDomainOwnershipLive, Oe as assessPublishAuthorizationLive, pn as attestDomainOwnership, Te as attestPublishAuthorization, be as buildPublishAnchorBytes, Wt as clearAllPublishProcesses, Gt as clearAllUploadProcesses, Ht as clearCompletedPublishProcesses, Ut as clearCompletedPublishProcessesForSeed, w as clearPublishWallet, se as configurePublish, nn as createDomainOwnershipChallenge, q as createPermissionlessTxSender, qt as deletePublishProcessById, Jt as deletePublishProcessesByIds, Kt as deletePublishProcessesForSeed, dn as encodeDomainOwnershipAttestationData, re as encodeEasAttest, t as encodeEasMultiAttest, ne as encodeEasMultiRevoke, l as encodeMultiPublish, u as encodeMultiPublishInteger, je as encodePublishAuthorizationAttestationData, i as encodeSetEas, un as ensureDomainOwnershipSchema, Me as ensureEasSchemasForItem, Ie as ensureManagedAccountEasConfigured, Pe as ensurePublishAuthorizationSchema, $t as ensureWalletThenPublish, en as fingerprintFromRegistrySnapshot, K as fromEip1193Provider, ae as fromEthersWallet, St as fromWindowEthereum, ve as getArweave, Yt as getArweaveTransactionIds, Tt as getDisplayStepId, $ as getDomainOwnershipSchemaUid, Xt as getEasPayload, Ee as getPublishAuthorizationSchemaUid, C as getPublishConfig, Dt as getPublishMachineValueForUi, p as getPublishPublicClient, T as getPublishWallet, x as initPublish, o as isContractDeployed, ue as isEip7702ModularAccountPublishError, le as isManagedAccountPublishError, b as isPublishWallet, fe as isRouterNonModularCoreAccountError, y as isSeedSigner, g as isSeedTxSender, Y as lookupDomainRegistry, J as normalizeRegistrableDomain, De as publishMachine, c as readGetEas, d as readIsActiveSigner, Et as resolvePublishDisplayValue, mn as revokeDomainOwnership, ke as revokePublishAuthorization, _ as setPublishWallet, me as stringifyUnderlyingCause, Zt as transformPayloadToIntegerIds, jt as useArweaveL1Finalize, At as useCanPublishItem, Mt as useItemPublishStatus, ye as usePublishConfig, kt as usePublishProcess, Vt as usePublishProcessById, It as usePublishProcesses, Rt as usePublishProcessesForSeed, Lt as usePublishProcessesNonActiveCount, Bt as usePublishProcessesNonActiveCountForSeed, Ft as usePublishProcessesState, zt as usePublishProcessesStateForSeed, wt as useSeedWallet, gn as verifyAndAttestDomainOwnership, ge as verifyDataItem, hn as verifyDomainOwnershipChallenge, sn as verifyDomainOwnershipDns, m as waitForPublishReceipt };
481
856
 
482
857
  //# sourceMappingURL=index.js.map