@seedprotocol/publish 0.6.1 → 0.6.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 (41) hide show
  1. package/dist/config-BCCU2gwH.js +947 -0
  2. package/dist/config-BCCU2gwH.js.map +1 -0
  3. package/dist/config.d.ts +8 -0
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/ensureAutomationSessionKey-DITBy2BP.js +84 -0
  6. package/dist/ensureAutomationSessionKey-DITBy2BP.js.map +1 -0
  7. package/dist/ensureModularPublishBootstrap-Cybk4i1Y.js +127 -0
  8. package/dist/ensureModularPublishBootstrap-Cybk4i1Y.js.map +1 -0
  9. package/dist/ensureSmartWalletThenPublish-BY9SiutA.js +48 -0
  10. package/dist/ensureSmartWalletThenPublish-BY9SiutA.js.map +1 -0
  11. package/dist/helpers/publishWalletRegistry.d.ts.map +1 -1
  12. package/dist/hooks/index.d.ts +2 -0
  13. package/dist/hooks/index.d.ts.map +1 -1
  14. package/dist/hooks/usePublishCostEstimate.d.ts +12 -0
  15. package/dist/hooks/usePublishCostEstimate.d.ts.map +1 -0
  16. package/dist/index.d.ts +4 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +469 -210
  19. package/dist/index.js.map +1 -1
  20. package/dist/publishAuthorization-ctIWvkYC.js +3479 -0
  21. package/dist/publishAuthorization-ctIWvkYC.js.map +1 -0
  22. package/dist/resolveRevokeAccount-CUr0F1ua.js +38 -0
  23. package/dist/resolveRevokeAccount-CUr0F1ua.js.map +1 -0
  24. package/dist/services/publishCost/estimatePublishCost.d.ts +9 -0
  25. package/dist/services/publishCost/estimatePublishCost.d.ts.map +1 -0
  26. package/dist/services/publishCost/gasHeuristics.d.ts +16 -0
  27. package/dist/services/publishCost/gasHeuristics.d.ts.map +1 -0
  28. package/dist/services/publishCost/index.d.ts +7 -0
  29. package/dist/services/publishCost/index.d.ts.map +1 -0
  30. package/dist/services/publishCost/marketRates.d.ts +13 -0
  31. package/dist/services/publishCost/marketRates.d.ts.map +1 -0
  32. package/dist/services/publishCost/tokenPrices.d.ts +12 -0
  33. package/dist/services/publishCost/tokenPrices.d.ts.map +1 -0
  34. package/dist/services/publishCost/types.d.ts +48 -0
  35. package/dist/services/publishCost/types.d.ts.map +1 -0
  36. package/dist/services/publishCost/watchPublishCost.d.ts +29 -0
  37. package/dist/services/publishCost/watchPublishCost.d.ts.map +1 -0
  38. package/dist/thirdweb.js +5 -5
  39. package/dist/worker-BI_q7Nkk.js +69 -0
  40. package/dist/worker-BI_q7Nkk.js.map +1 -0
  41. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,25 +1,25 @@
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
- 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-BzmqxKCT.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";
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 y, f as ee, g as te, h as b, i as ne, j as re, k as ie, l as ae, m as oe, n as se, p as ce, r as x, t as le, u as ue, v as de, y as S } from "./config-BCCU2gwH.js";
2
+ import { a as fe, i as pe, n as me, o as he, r as ge, s as _e, t as ve } from "./errors-Du3LNbJN.js";
3
+ import { G as ye, J as be, K as xe, Q as Se, W as Ce, X as we, Y as Te, Z as Ee, _ as De, a as Oe, c as ke, g as Ae, h as C, i as je, l as Me, n as Ne, o as Pe, q as Fe, r as Ie, s as Le, t as Re, v as ze } from "./publishAuthorization-ctIWvkYC.js";
4
+ import { BaseDb as w, arweaveL1FinalizeJobs as T, isItemOwned as Be, publishProcesses as E, uploadProcesses as Ve } from "@seedprotocol/sdk";
5
+ import { createPublicClient as He, createWalletClient as Ue, custom as We, http as D } from "viem";
6
+ import { ethers as Ge } from "ethers";
7
+ import { useCallback as O, useEffect as k, useMemo as A, useRef as Ke, useState as j } from "react";
8
+ import { jsx as M, jsxs as qe } from "react/jsx-runtime";
9
+ import { SeedProvider as Je, SeedProvider as Ye, useLiveQuery as N } from "@seedprotocol/react";
10
+ import { entryPoint08Address as Xe } from "viem/account-abstraction";
11
+ import { createSmartAccountClient as Ze } from "permissionless";
12
+ import { to7702SimpleSmartAccount as Qe } from "permissionless/accounts";
13
+ import { createPimlicoClient as $e } from "permissionless/clients/pimlico";
14
+ import { SchemaEncoder as et, SchemaRegistry as tt, ZERO_BYTES32 as nt } from "@ethereum-attestation-service/eas-sdk";
15
+ import { and as rt, desc as P, eq as F, inArray as it, notInArray as at } from "drizzle-orm";
16
+ import { useSelector as ot } from "@xstate/react";
17
+ import { DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS as st, DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS as ct, DOMAIN_OWNERSHIP_METHOD as lt, DOMAIN_OWNERSHIP_METHOD as ut, DOMAIN_OWNERSHIP_SCHEMA_DEF as dt, DOMAIN_OWNERSHIP_SCHEMA_DEF as I, DOMAIN_OWNERSHIP_SCHEMA_NAME as ft, DOMAIN_OWNERSHIP_SCHEMA_NAME as pt, DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE as mt, assessDomainOwnership as ht, buildDomainOwnershipTxtValue as gt, decodeDomainOwnershipData as _t, domainOwnershipTxtName as vt, getDomainOwnershipFromEas as yt, hashDomainOwnershipChallenge as bt, hashDomainRegistryFingerprint as xt, isValidEasAttestationUid as St, normalizeBytes32Hex as L, parseDomainOwnershipTxtValue as Ct } from "@seedprotocol/eas";
18
+ import { randomBytes as wt } from "node:crypto";
19
+ import { lookup as Tt, toRegistrableDomain as Et } from "rdapper";
20
+ import { promises as Dt } from "node:dns";
21
21
  //#region src/react/PublishModeButtons.tsx
22
- var bt = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish mode" }) => {
22
+ var Ot = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish mode" }) => {
23
23
  let i = {
24
24
  display: "inline-flex",
25
25
  gap: 8,
@@ -34,17 +34,17 @@ var bt = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish
34
34
  cursor: n ? "not-allowed" : "pointer",
35
35
  opacity: n ? .6 : 1
36
36
  });
37
- return /* @__PURE__ */ We("div", {
37
+ return /* @__PURE__ */ qe("div", {
38
38
  role: "group",
39
39
  "aria-label": r,
40
40
  style: i,
41
- children: [/* @__PURE__ */ F("button", {
41
+ children: [/* @__PURE__ */ M("button", {
42
42
  type: "button",
43
43
  disabled: n,
44
44
  style: a(e === "patch"),
45
45
  onClick: () => t("patch"),
46
46
  children: "Publish updates"
47
- }), /* @__PURE__ */ F("button", {
47
+ }), /* @__PURE__ */ M("button", {
48
48
  type: "button",
49
49
  disabled: n,
50
50
  style: a(e === "new_version"),
@@ -52,11 +52,11 @@ var bt = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish
52
52
  children: "New version"
53
53
  })]
54
54
  });
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, {
55
+ }, kt = ({ children: e, config: t, queryClient: n, queryClientRef: r }) => (k(() => {
56
+ t && ne(t);
57
+ }, [t]), /* @__PURE__ */ M(Ee.Provider, {
58
+ value: t ?? se(),
59
+ children: /* @__PURE__ */ M(Ye, {
60
60
  queryClient: n,
61
61
  queryClientRef: r,
62
62
  children: e
@@ -64,27 +64,27 @@ var bt = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish
64
64
  }));
65
65
  //#endregion
66
66
  //#region src/helpers/adapters/eip1193.ts
67
- async function K(e, t = {}) {
67
+ async function R(e, t = {}) {
68
68
  let n = t.chain ?? s(), r = t.address;
69
69
  if (!r) {
70
70
  let t = await e.request({ method: "eth_requestAccounts" });
71
71
  if (!t?.[0]) throw Error("@seedprotocol/publish: EIP-1193 provider returned no accounts");
72
72
  r = t[0];
73
73
  }
74
- let i = Be({
74
+ let i = Ue({
75
75
  account: r,
76
76
  chain: n,
77
- transport: Ve(e)
77
+ transport: We(e)
78
78
  });
79
79
  return {
80
- signer: te({
80
+ signer: ee({
81
81
  address: r,
82
82
  signMessage: async ({ message: e }) => i.signMessage({
83
83
  account: r,
84
84
  message: typeof e == "string" ? e : { raw: e.raw }
85
85
  })
86
86
  }),
87
- txSender: S({
87
+ txSender: ce({
88
88
  address: r,
89
89
  sendTransaction: async (e) => ({ transactionHash: await i.sendTransaction({
90
90
  account: r,
@@ -97,14 +97,14 @@ async function K(e, t = {}) {
97
97
  })
98
98
  };
99
99
  }
100
- async function St(e = {}) {
100
+ async function At(e = {}) {
101
101
  let t = globalThis.ethereum;
102
102
  if (!t) throw Error("@seedprotocol/publish: window.ethereum is not available");
103
- return K(t, e);
103
+ return R(t, e);
104
104
  }
105
105
  //#endregion
106
106
  //#region src/helpers/adapters/permissionlessTxSender.ts
107
- function Ct(e) {
107
+ function jt(e) {
108
108
  return {
109
109
  address: e.address,
110
110
  type: "local",
@@ -119,31 +119,31 @@ function Ct(e) {
119
119
  }
120
120
  };
121
121
  }
122
- async function q(e) {
123
- let { signer: t, bundlerUrl: n, paymasterUrl: r } = e, i = s(), o = a(), c = t.address, l = ze({
122
+ async function z(e) {
123
+ let { signer: t, bundlerUrl: n, paymasterUrl: r } = e, i = s(), o = a(), c = t.address, l = He({
124
124
  chain: i,
125
- transport: A(o)
126
- }), u = Ct(t), d = await Je({
125
+ transport: D(o)
126
+ }), u = jt(t), d = await Qe({
127
127
  client: l,
128
128
  owner: u,
129
129
  entryPoint: {
130
- address: L,
130
+ address: Xe,
131
131
  version: "0.8"
132
132
  }
133
- }), f = Ye({
134
- transport: A(r ?? n),
133
+ }), f = $e({
134
+ transport: D(r ?? n),
135
135
  entryPoint: {
136
- address: L,
136
+ address: Xe,
137
137
  version: "0.8"
138
138
  }
139
- }), p = qe({
139
+ }), p = Ze({
140
140
  account: d,
141
141
  chain: i,
142
- bundlerTransport: A(n),
142
+ bundlerTransport: D(n),
143
143
  paymaster: f,
144
144
  userOperation: { estimateFeesPerGas: async () => (await f.getUserOperationGasPrice()).fast }
145
145
  });
146
- return S({
146
+ return ce({
147
147
  address: d.address ?? c,
148
148
  sendTransaction: async (e) => {
149
149
  try {
@@ -162,18 +162,18 @@ async function q(e) {
162
162
  }
163
163
  //#endregion
164
164
  //#region src/react/useSeedWallet.ts
165
- function wt() {
166
- let [e, t] = P(() => T()), [n, r] = P(() => T() ? "connected" : "disconnected");
167
- M(() => {
168
- t(T());
165
+ function Mt() {
166
+ let [e, t] = j(() => S()), [n, r] = j(() => S() ? "connected" : "disconnected");
167
+ k(() => {
168
+ t(S());
169
169
  }, []);
170
- let i = j(async (e) => {
170
+ let i = O(async (e) => {
171
171
  r("connecting");
172
172
  try {
173
173
  let n;
174
- n = b(e) ? e : await K(e);
175
- let i = C(), a = n.txSender;
176
- i.accountMode === "eip7702" && i.bundlerUrl && (a = await q({
174
+ n = b(e) ? e : await R(e);
175
+ let i = x(), a = n.txSender;
176
+ i.accountMode === "eip7702" && i.bundlerUrl && (a = await z({
177
177
  signer: n.signer,
178
178
  bundlerUrl: i.bundlerUrl,
179
179
  paymasterUrl: i.paymasterUrl
@@ -188,8 +188,8 @@ function wt() {
188
188
  } catch (e) {
189
189
  throw r("disconnected"), e;
190
190
  }
191
- }, []), a = j(() => {
192
- w(), t(null), r("disconnected");
191
+ }, []), a = O(() => {
192
+ de(), t(null), r("disconnected");
193
193
  }, []);
194
194
  return {
195
195
  address: e?.signer.address,
@@ -201,17 +201,245 @@ function wt() {
201
201
  };
202
202
  }
203
203
  //#endregion
204
+ //#region src/services/publishCost/gasHeuristics.ts
205
+ var B = {
206
+ BASE: 80000n,
207
+ NEW_SEED: 120000n,
208
+ NEW_VERSION: 80000n,
209
+ ATTESTATION: 55000n
210
+ };
211
+ function Nt(e) {
212
+ return B.BASE + B.NEW_SEED * BigInt(e.newSeedCount) + B.NEW_VERSION * BigInt(e.newVersionCount) + B.ATTESTATION * BigInt(e.attestationCount);
213
+ }
214
+ //#endregion
215
+ //#region src/services/publishCost/tokenPrices.ts
216
+ var Pt = 6e4, V = null, H = null;
217
+ function Ft() {
218
+ try {
219
+ return x().getTokenPrices;
220
+ } catch {
221
+ return;
222
+ }
223
+ }
224
+ async function It(e) {
225
+ let t = await fetch(`https://api.coinbase.com/v2/prices/${e}-USD/spot`);
226
+ if (!t.ok) throw Error(`Coinbase ${e}-USD spot failed: ${t.status}`);
227
+ let n = await t.json(), r = Number(n.data?.amount);
228
+ if (!Number.isFinite(r) || r <= 0) throw Error(`Invalid ${e} USD price`);
229
+ return r;
230
+ }
231
+ async function Lt() {
232
+ let [e, t] = await Promise.all([It("ETH"), It("AR")]);
233
+ return {
234
+ ethUsd: e,
235
+ arUsd: t
236
+ };
237
+ }
238
+ async function Rt(e) {
239
+ let t = Date.now();
240
+ return !e?.forceRefresh && V && t - V.fetchedAt < Pt ? V : (H && !e?.forceRefresh || (H = (async () => {
241
+ try {
242
+ let e = Ft(), t = e ? await e() : await Lt(), n = {
243
+ ethUsd: t.ethUsd,
244
+ arUsd: t.arUsd,
245
+ fetchedAt: Date.now()
246
+ };
247
+ return V = n, n;
248
+ } catch (e) {
249
+ if (V) return V;
250
+ throw e;
251
+ } finally {
252
+ H = null;
253
+ }
254
+ })()), H);
255
+ }
256
+ function zt() {
257
+ V = null, H = null;
258
+ }
259
+ //#endregion
260
+ //#region src/services/publishCost/marketRates.ts
261
+ var Bt = 6e4, Vt = 1e6, U = null, W = null;
262
+ async function Ht() {
263
+ return p().getGasPrice();
264
+ }
265
+ async function Ut() {
266
+ let e = BigInt(await we().transactions.getPrice(Vt));
267
+ return Number(e) / Vt;
268
+ }
269
+ async function G(e) {
270
+ let t = Date.now();
271
+ return !e?.forceRefresh && U && t - U.fetchedAt < Bt ? U : (W && !e?.forceRefresh || (W = (async () => {
272
+ try {
273
+ let [t, n, r] = await Promise.all([
274
+ Rt({ forceRefresh: e?.forceRefresh }),
275
+ Ht(),
276
+ Ut()
277
+ ]), i = {
278
+ ...t,
279
+ gasPriceWei: n,
280
+ winstonPerByte: r,
281
+ fetchedAt: Date.now()
282
+ };
283
+ return U = i, i;
284
+ } catch (e) {
285
+ if (U) return U;
286
+ throw e;
287
+ } finally {
288
+ W = null;
289
+ }
290
+ })()), W);
291
+ }
292
+ function Wt() {
293
+ U = null, W = null, zt();
294
+ }
295
+ //#endregion
296
+ //#region src/services/publishCost/estimatePublishCost.ts
297
+ var Gt = 0xe8d4a51000, Kt = 0xde0b6b3a7640000;
298
+ function qt() {
299
+ try {
300
+ let e = x();
301
+ return {
302
+ evmUserPays: !e.paymasterUrl,
303
+ arweavePath: e.useArweaveBundler ? "bundler" : "l1"
304
+ };
305
+ } catch {
306
+ return {
307
+ evmUserPays: !0,
308
+ arweavePath: "l1"
309
+ };
310
+ }
311
+ }
312
+ function K(e) {
313
+ return Math.round(e * 100) / 100;
314
+ }
315
+ function q(e, t, n) {
316
+ let r = n?.evmUserPays ?? !0, i = n?.arweavePath ?? "l1", a = Nt(e), o = a * t.gasPriceWei, s = Number(o) / Kt, c = s * t.ethUsd, l = Math.max(0, Math.round(e.uploadBytes * t.winstonPerByte)) / Gt, u = l * t.arUsd;
317
+ return {
318
+ totalUsd: K(c + u),
319
+ evm: {
320
+ eth: s.toPrecision(6),
321
+ usd: K(c),
322
+ gas: a,
323
+ userPays: r
324
+ },
325
+ arweave: {
326
+ ar: l.toPrecision(6),
327
+ usd: K(u),
328
+ bytes: e.uploadBytes,
329
+ uploadCount: e.uploadCount,
330
+ path: i,
331
+ userPays: !0
332
+ },
333
+ prices: {
334
+ ethUsd: t.ethUsd,
335
+ arUsd: t.arUsd,
336
+ fetchedAt: t.fetchedAt
337
+ },
338
+ work: e,
339
+ estimatedAt: Date.now()
340
+ };
341
+ }
342
+ async function Jt(e, t) {
343
+ let n = qt(), r = t?.work;
344
+ if (!r) {
345
+ let { summarizePublishWork: n } = await import("@seedprotocol/sdk");
346
+ r = await n(e, { publishMode: t?.publishMode });
347
+ }
348
+ let i = t?.rates ?? await G();
349
+ return q(r, i, n);
350
+ }
351
+ //#endregion
352
+ //#region src/services/publishCost/watchPublishCost.ts
353
+ var Yt = 6e4, Xt = 15e3;
354
+ function Zt(e) {
355
+ let t = e.getService().getSnapshot(), n = (t && typeof t == "object" && "context" in t ? t.context : void 0)?.propertyValue ?? e.value;
356
+ return `${e.propertyName}:${e.uid ?? ""}:${String(n ?? "")}`;
357
+ }
358
+ function J(e) {
359
+ let t = e.properties ?? [];
360
+ return [
361
+ e.seedLocalId,
362
+ e.seedUid ?? "",
363
+ e.latestVersionLocalId ?? "",
364
+ ...t.map(Zt)
365
+ ].join("|");
366
+ }
367
+ function Qt(e) {
368
+ return e instanceof Error ? e : Error(String(e));
369
+ }
370
+ function $t(e, t, n) {
371
+ let r = n?.priceRefreshMs ?? Yt, i = n?.itemIdleMs ?? Xt, a = n?.estimate ?? ((e) => Jt(e, n)), o = n?.reprice ?? (async (e) => {
372
+ let t = await G({ forceRefresh: !0 });
373
+ return q(e.work, t, {
374
+ evmUserPays: e.evm.userPays,
375
+ arweavePath: e.arweave.path
376
+ });
377
+ }), s = !1, c = J(e), l = null, u = !1, d = !1, f = null, p = 0, m = null, h = null, g = () => {
378
+ s || t({
379
+ estimate: l,
380
+ isEstimating: u,
381
+ isStale: d,
382
+ error: f,
383
+ refresh: y
384
+ });
385
+ }, _ = async () => {
386
+ let t = ++p;
387
+ u = !0, f = null, g();
388
+ try {
389
+ let n = await a(e);
390
+ if (s || t !== p) return;
391
+ l = n, c = J(e), d = !1, u = !1, f = null, g();
392
+ } catch (e) {
393
+ if (s || t !== p) return;
394
+ u = !1, f = Qt(e), g();
395
+ }
396
+ }, v = () => {
397
+ if (l && (d = !0), i <= 0) {
398
+ _();
399
+ return;
400
+ }
401
+ m && clearTimeout(m), m = setTimeout(() => {
402
+ m = null, _();
403
+ }, i), g();
404
+ }, y = () => {
405
+ m &&= (clearTimeout(m), null), _();
406
+ };
407
+ _();
408
+ let ee = e.subscribe(() => {
409
+ if (s) return;
410
+ let t = J(e);
411
+ t !== c && (c = t, v());
412
+ });
413
+ return r > 0 && (h = setInterval(() => {
414
+ s || !l || u || (async () => {
415
+ try {
416
+ let e = await o(l);
417
+ if (s) return;
418
+ l = e, g();
419
+ } catch (e) {
420
+ if (s) return;
421
+ f = Qt(e), g();
422
+ }
423
+ })();
424
+ }, r)), {
425
+ refresh: y,
426
+ dispose: () => {
427
+ s = !0, ee.unsubscribe(), m && clearTimeout(m), h && clearInterval(h);
428
+ }
429
+ };
430
+ }
431
+ //#endregion
204
432
  //#region src/helpers/publishDisplayHelpers.ts
205
- function Tt(e) {
433
+ function en(e) {
206
434
  return e === "creatingAttestationsDirectToEas" ? "creatingAttestations" : e;
207
435
  }
208
- function Et(t, n, r) {
436
+ function tn(t, n, r) {
209
437
  if (t != null) return r;
210
438
  if (n?.status === "completed") return e.SUCCESS;
211
439
  if (n?.status === "failed") return e.FAILURE;
212
440
  if (n?.status !== "interrupted") return r;
213
441
  }
214
- function Dt(t) {
442
+ function nn(t) {
215
443
  if (t) {
216
444
  if (t.status === "failed") return e.FAILURE;
217
445
  if (t.status === "completed") return e.SUCCESS;
@@ -238,19 +466,19 @@ function Dt(t) {
238
466
  }
239
467
  //#endregion
240
468
  //#region src/hooks/usePublishProcess.ts
241
- function Ot(t) {
469
+ function rn(t) {
242
470
  return !t || t.status !== "done" ? !1 : t.value === e.SUCCESS || t.value === e.FAILURE;
243
471
  }
244
- function kt(t) {
245
- let n = E.getService(), r = et(n, (e) => e?.context?.publishProcesses?.get(t) ?? null), i = Ue(null);
246
- M(() => {
472
+ function an(t) {
473
+ let n = C.getService(), r = ot(n, (e) => e?.context?.publishProcesses?.get(t) ?? null), i = Ke(null);
474
+ k(() => {
247
475
  i.current = null;
248
476
  }, [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(() => {
477
+ let [a, o] = j(void 0), [s, c] = j(null), l = w.getAppDb(), u = A(() => t && l ? l.select().from(E).where(F(E.seedLocalId, t)).orderBy(P(E.startedAt)).limit(1) : null, [l, t]), d = N(u)?.[0], f = d?.status, p = A(() => {
250
478
  if (r != null) return a;
251
479
  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);
480
+ let t = nn(d);
481
+ return t === e.SUCCESS || t === e.FAILURE ? t : tn(r, f == null ? void 0 : { status: f }, a);
254
482
  }, [
255
483
  r,
256
484
  f,
@@ -258,16 +486,16 @@ function kt(t) {
258
486
  s,
259
487
  d
260
488
  ]);
261
- return M(() => {
489
+ return k(() => {
262
490
  c(null);
263
- }, [t]), M(() => {
491
+ }, [t]), k(() => {
264
492
  r ?? (f === "completed" ? c("success") : f === "failed" && c("failure"));
265
- }, [f, r]), M(() => {
493
+ }, [f, r]), k(() => {
266
494
  r != null && c(null);
267
- }, [r]), M(() => {
495
+ }, [r]), k(() => {
268
496
  if (!r) {
269
497
  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);
498
+ rn(t) ? (o(t.value), t.value === e.SUCCESS ? c("success") : t.value === e.FAILURE && c("failure")) : o(void 0);
271
499
  return;
272
500
  }
273
501
  let t = r.getSnapshot();
@@ -291,21 +519,21 @@ function kt(t) {
291
519
  }
292
520
  //#endregion
293
521
  //#region src/hooks/useCanPublishItem.ts
294
- function At(e) {
295
- let [t, n] = P(!0);
296
- return M(() => {
522
+ function on(e) {
523
+ let [t, n] = j(!0);
524
+ return k(() => {
297
525
  if (!e) {
298
526
  n(!1);
299
527
  return;
300
528
  }
301
- Le(e).then(n).catch(() => n(!1));
529
+ Be(e).then(n).catch(() => n(!1));
302
530
  }, [e?.seedLocalId]), t;
303
531
  }
304
532
  //#endregion
305
533
  //#region src/hooks/useArweaveL1Finalize.ts
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(() => {
534
+ function sn(e) {
535
+ let t = w.getAppDb(), n = A(() => e && t ? t.select().from(T).where(F(T.seedLocalId, e)).orderBy(P(T.updatedAt)) : null, [t, e]), r = N(n) ?? [];
536
+ return A(() => {
309
537
  let e = r.filter((e) => e.phase === "pending_l1").length, t = r.filter((e) => e.phase === "confirmed").length;
310
538
  return {
311
539
  hasPendingL1: e > 0,
@@ -317,8 +545,8 @@ function jt(e) {
317
545
  }
318
546
  //#endregion
319
547
  //#region src/hooks/useItemPublishStatus.ts
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];
548
+ function cn(e) {
549
+ let { publishProcess: t, value: n } = an(e ?? ""), r = sn(e), i = w.getAppDb(), a = A(() => e && i ? i.select().from(E).where(F(E.seedLocalId, e)).orderBy(P(E.startedAt)).limit(1) : null, [i, e]), o = N(a)?.[0];
322
550
  return {
323
551
  latestRecord: o,
324
552
  publishProcess: t,
@@ -331,44 +559,44 @@ function Mt(e) {
331
559
  }
332
560
  //#endregion
333
561
  //#region src/hooks/usePublishProcesses.ts
334
- function Nt() {
335
- let e = D.getAppDb();
336
- return N(() => e ? e.select().from(k).orderBy(z(k.startedAt)) : null, [e]);
562
+ function ln() {
563
+ let e = w.getAppDb();
564
+ return A(() => e ? e.select().from(E).orderBy(P(E.startedAt)) : null, [e]);
337
565
  }
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]);
566
+ function un(e) {
567
+ let t = w.getAppDb();
568
+ return A(() => t && e ? t.select().from(E).where(F(E.seedLocalId, e)).orderBy(P(E.startedAt)) : null, [t, e]);
341
569
  }
342
- function Ft() {
343
- let e = Nt(), t = I(e);
570
+ function dn() {
571
+ let e = ln(), t = N(e);
344
572
  return {
345
573
  records: t,
346
- nonActiveCount: N(() => t === void 0 ? void 0 : t.filter((e) => e.status !== "in_progress").length, [t])
574
+ nonActiveCount: A(() => t === void 0 ? void 0 : t.filter((e) => e.status !== "in_progress").length, [t])
347
575
  };
348
576
  }
349
- function It() {
350
- let e = Nt();
351
- return I(e);
577
+ function fn() {
578
+ let e = ln();
579
+ return N(e);
352
580
  }
353
- function Lt() {
354
- return Ft().nonActiveCount;
581
+ function pn() {
582
+ return dn().nonActiveCount;
355
583
  }
356
- function Rt(e) {
357
- let t = Pt(e);
358
- return I(t);
584
+ function mn(e) {
585
+ let t = un(e);
586
+ return N(t);
359
587
  }
360
- function zt(e) {
361
- let t = Pt(e), n = I(t);
588
+ function hn(e) {
589
+ let t = un(e), n = N(t);
362
590
  return {
363
591
  records: n,
364
- nonActiveCount: N(() => n === void 0 ? void 0 : n.filter((e) => e.status !== "in_progress").length, [n])
592
+ nonActiveCount: A(() => n === void 0 ? void 0 : n.filter((e) => e.status !== "in_progress").length, [n])
365
593
  };
366
594
  }
367
- function Bt(e) {
368
- return zt(e).nonActiveCount;
595
+ function gn(e) {
596
+ return hn(e).nonActiveCount;
369
597
  }
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;
598
+ function _n(e) {
599
+ let t = w.getAppDb(), n = A(() => e != null && t ? t.select().from(E).where(F(E.id, e)).limit(1) : null, [t, e]), r = N(n), i = r === void 0;
372
600
  return {
373
601
  record: r && r.length > 0 ? r[0] : null,
374
602
  isLoading: i
@@ -376,45 +604,45 @@ function Vt(e) {
376
604
  }
377
605
  //#endregion
378
606
  //#region src/hooks/clearCompletedPublishProcesses.ts
379
- async function Ht() {
380
- let e = D.getAppDb();
381
- e && await e.delete(k).where(V(k.status, ["in_progress"]));
607
+ async function vn() {
608
+ let e = w.getAppDb();
609
+ e && await e.delete(E).where(at(E.status, ["in_progress"]));
382
610
  }
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"])));
611
+ async function yn(e) {
612
+ let t = w.getAppDb();
613
+ t && await t.delete(E).where(rt(F(E.seedLocalId, e), at(E.status, ["in_progress"])));
386
614
  }
387
- async function Wt() {
388
- let e = D.getAppDb();
389
- e && await e.delete(k);
615
+ async function bn() {
616
+ let e = w.getAppDb();
617
+ e && await e.delete(E);
390
618
  }
391
- async function Gt() {
392
- let e = D.getAppDb();
393
- e && await e.delete(Re);
619
+ async function xn() {
620
+ let e = w.getAppDb();
621
+ e && await e.delete(Ve);
394
622
  }
395
- async function Kt(e) {
396
- let t = D.getAppDb();
397
- t && await t.delete(k).where(B(k.seedLocalId, e));
623
+ async function Sn(e) {
624
+ let t = w.getAppDb();
625
+ t && await t.delete(E).where(F(E.seedLocalId, e));
398
626
  }
399
- async function qt(e) {
400
- let t = D.getAppDb();
401
- t && await t.delete(k).where(B(k.id, e));
627
+ async function Cn(e) {
628
+ let t = w.getAppDb();
629
+ t && await t.delete(E).where(F(E.id, e));
402
630
  }
403
- async function Jt(e) {
631
+ async function wn(e) {
404
632
  if (e.length === 0) return;
405
- let t = D.getAppDb();
406
- t && await t.delete(k).where($e(k.id, e));
633
+ let t = w.getAppDb();
634
+ t && await t.delete(E).where(it(E.id, e));
407
635
  }
408
636
  //#endregion
409
637
  //#region src/hooks/publishProcessHelpers.ts
410
- function Yt(e) {
638
+ function Tn(e) {
411
639
  try {
412
640
  return (JSON.parse(e.persistedSnapshot).context?.arweaveTransactions ?? []).map((e) => e.transaction?.id).filter((e) => typeof e == "string");
413
641
  } catch {
414
642
  return [];
415
643
  }
416
644
  }
417
- function Xt(e) {
645
+ function En(e) {
418
646
  try {
419
647
  return JSON.parse(e.persistedSnapshot).context?.easPayload ?? void 0;
420
648
  } catch {
@@ -422,8 +650,39 @@ function Xt(e) {
422
650
  }
423
651
  }
424
652
  //#endregion
653
+ //#region src/hooks/usePublishCostEstimate.ts
654
+ function Dn(e, t) {
655
+ let [n, r] = j(null), [i, a] = j(!1), [o, s] = j(!1), [c, l] = j(null), u = Ke(() => {}), d = t?.publishMode, f = t?.priceRefreshMs, p = t?.itemIdleMs;
656
+ return k(() => {
657
+ if (!e) {
658
+ r(null), a(!1), s(!1), l(null), u.current = () => {};
659
+ return;
660
+ }
661
+ let n = $t(e, (e) => {
662
+ r(e.estimate), a(e.isEstimating), s(e.isStale), l(e.error), u.current = e.refresh;
663
+ }, t);
664
+ return () => {
665
+ n.dispose();
666
+ };
667
+ }, [
668
+ e,
669
+ e?.seedLocalId,
670
+ d,
671
+ f,
672
+ p
673
+ ]), {
674
+ estimate: n,
675
+ isEstimating: i,
676
+ isStale: o,
677
+ error: c,
678
+ refresh: O(() => {
679
+ u.current();
680
+ }, [])
681
+ };
682
+ }
683
+ //#endregion
425
684
  //#region src/helpers/transformPayloadToIntegerIds.ts
426
- function Zt(e) {
685
+ function On(e) {
427
686
  let t = /* @__PURE__ */ new Map();
428
687
  for (let n = 0; n < e.length; n++) {
429
688
  let r = e[n]?.localId;
@@ -448,26 +707,26 @@ function Zt(e) {
448
707
  }
449
708
  //#endregion
450
709
  //#region src/helpers/ensureWalletThenPublish.ts
451
- function Qt(e) {
710
+ function kn(e) {
452
711
  if (e) {
453
- if (e instanceof He.Wallet) return e;
712
+ if (e instanceof Ge.Wallet) return e;
454
713
  if (b(e)) return e.signer;
455
- if (y(e)) return e;
714
+ if (te(e)) return e;
456
715
  }
457
716
  }
458
- async function $t(e, t) {
459
- let n = C();
717
+ async function An(e, t) {
718
+ let n = x();
460
719
  if (n.useModularExecutor) {
461
- let { ensureSmartWalletThenPublish: n } = await import("./ensureSmartWalletThenPublish-iPHk38a4.js").then((e) => e.n);
720
+ let { ensureSmartWalletThenPublish: n } = await import("./ensureSmartWalletThenPublish-BY9SiutA.js").then((e) => e.n);
462
721
  return n(e, null, async () => {
463
- let e = T();
722
+ let e = S();
464
723
  return e?.publisherAddress ?? e?.signer.address ?? null;
465
724
  }, t);
466
725
  }
467
- let r = T();
726
+ let r = S();
468
727
  if (!r) return { outcome: "no_wallet" };
469
728
  if (n.accountMode === "eip7702" && n.bundlerUrl) {
470
- let e = await q({
729
+ let e = await z({
471
730
  signer: r.signer,
472
731
  bundlerUrl: n.bundlerUrl,
473
732
  paymasterUrl: n.paymasterUrl
@@ -479,20 +738,20 @@ async function $t(e, t) {
479
738
  };
480
739
  }
481
740
  let i = r.publisherAddress ?? r.txSender.address ?? r.signer.address;
482
- return i?.trim() ? (E.createPublish(e, i, r, {
741
+ return i?.trim() ? (C.createPublish(e, i, r, {
483
742
  ...t,
484
- dataItemSigner: Qt(t?.dataItemSigner) ?? r.signer
743
+ dataItemSigner: kn(t?.dataItemSigner) ?? r.signer
485
744
  }), { outcome: "started" }) : { outcome: "no_address" };
486
745
  }
487
746
  //#endregion
488
747
  //#region src/services/domainOwnership/registry.ts
489
- function J(e) {
490
- let t = vt(e);
748
+ function Y(e) {
749
+ let t = Et(e);
491
750
  if (!t) throw Error(`@seedprotocol/publish: unable to resolve registrable domain for "${e}"`);
492
751
  return t.toLowerCase();
493
752
  }
494
- async function Y(e) {
495
- let t = J(e), n = await _t(t);
753
+ async function X(e) {
754
+ let t = Y(e), n = await Tt(t);
496
755
  if (!n.ok || !n.record) return null;
497
756
  let r = n.record;
498
757
  return {
@@ -506,8 +765,8 @@ async function Y(e) {
506
765
  isRegistered: r.isRegistered
507
766
  };
508
767
  }
509
- function en(e) {
510
- return pt({
768
+ function jn(e) {
769
+ return xt({
511
770
  domain: e.domain,
512
771
  creationDate: e.creationDate ?? "",
513
772
  registrarIanaId: e.registrarIanaId ?? ""
@@ -515,30 +774,30 @@ function en(e) {
515
774
  }
516
775
  //#endregion
517
776
  //#region src/services/domainOwnership/challenge.ts
518
- function tn(e) {
777
+ function Mn(e) {
519
778
  return Buffer.from(e).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
520
779
  }
521
- function nn(e) {
522
- let t = e.normalizeRegistrable === !1 ? e.domain.trim().toLowerCase().replace(/\.$/, "") : J(e.domain);
780
+ function Nn(e) {
781
+ let t = e.normalizeRegistrable === !1 ? e.domain.trim().toLowerCase().replace(/\.$/, "") : Y(e.domain);
523
782
  if (!t || t.includes(" ")) throw Error("@seedprotocol/publish: createDomainOwnershipChallenge requires a valid domain");
524
783
  let n = e.claimer.trim();
525
784
  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({
785
+ let r = e.scope ?? mt, i = e.ttlMs ?? st, a = e.now ?? Date.now(), o = new Date(a + i).toISOString(), s = Mn(wt(32)), c = bt({
527
786
  domain: t,
528
787
  claimer: n,
529
788
  token: s,
530
789
  scope: r
531
- }), l = ut(t), u = ct({
790
+ }), l = vt(t), u = gt({
532
791
  token: s,
533
792
  claimer: n,
534
793
  expiry: o
535
794
  });
536
795
  return {
537
- challengeId: tn(gt(16)),
796
+ challengeId: Mn(wt(16)),
538
797
  domain: t,
539
798
  claimer: n,
540
799
  scope: r,
541
- method: H,
800
+ method: ut,
542
801
  token: s,
543
802
  txtName: l,
544
803
  txtValue: u,
@@ -549,13 +808,13 @@ function nn(e) {
549
808
  }
550
809
  //#endregion
551
810
  //#region src/services/domainOwnership/dnsVerify.ts
552
- async function rn(e) {
811
+ async function Pn(e) {
553
812
  return {
554
813
  source: "node:dns",
555
- values: (await yt.resolveTxt(e)).map((e) => e.join(""))
814
+ values: (await Dt.resolveTxt(e)).map((e) => e.join(""))
556
815
  };
557
816
  }
558
- async function X(e, t, n) {
817
+ async function Fn(e, t, n) {
559
818
  let r = `${n}?name=${encodeURIComponent(e)}&type=TXT`, i = await fetch(r, { headers: { accept: "application/dns-json" } });
560
819
  if (!i.ok) throw Error(`DoH ${t} HTTP ${i.status}`);
561
820
  let a = await i.json();
@@ -565,21 +824,21 @@ async function X(e, t, n) {
565
824
  dnssecAuthenticated: !!a.AD
566
825
  };
567
826
  }
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")
827
+ var In = [
828
+ (e) => Pn(e),
829
+ (e) => Fn(e, "cloudflare-doh", "https://cloudflare-dns.com/dns-query"),
830
+ (e) => Fn(e, "google-doh", "https://dns.google/resolve")
572
831
  ];
573
- function on(e, t) {
574
- let n = ht(t);
832
+ function Ln(e, t) {
833
+ let n = Ct(t);
575
834
  for (let r of e) {
576
835
  if (r === t || r.replace(/^"|"$/g, "") === t) return !0;
577
- let e = ht(r);
836
+ let e = Ct(r);
578
837
  if (n && e && e.token === n.token && e.claimer === n.claimer) return !0;
579
838
  }
580
839
  return !1;
581
840
  }
582
- async function sn(e, t) {
841
+ async function Rn(e, t) {
583
842
  let n = t?.now ?? Date.now();
584
843
  if (Date.parse(e.expiresAt) <= n) return {
585
844
  ok: !1,
@@ -587,7 +846,7 @@ async function sn(e, t) {
587
846
  lookups: [],
588
847
  error: "Challenge expired"
589
848
  };
590
- let r = ct({
849
+ let r = gt({
591
850
  token: e.token,
592
851
  claimer: e.claimer,
593
852
  expiry: e.expiresAt
@@ -598,11 +857,11 @@ async function sn(e, t) {
598
857
  lookups: [],
599
858
  error: "Challenge txtValue does not match token/claimer/expiry"
600
859
  };
601
- let i = t?.lookups ?? an, a = t?.quorum ?? 2, o = [], s = [], c = !1;
860
+ let i = t?.lookups ?? In, a = t?.quorum ?? 2, o = [], s = [], c = !1;
602
861
  await Promise.all(i.map(async (t) => {
603
862
  try {
604
863
  let n = await t(e.txtName);
605
- o.push(n), on(n.values, r) && (s.push(n.source), n.dnssecAuthenticated && (c = !0));
864
+ o.push(n), Ln(n.values, r) && (s.push(n.source), n.dnssecAuthenticated && (c = !0));
606
865
  } catch {
607
866
  o.push({
608
867
  source: "error",
@@ -620,7 +879,7 @@ async function sn(e, t) {
620
879
  }
621
880
  //#endregion
622
881
  //#region src/services/domainOwnership/index.ts
623
- var cn = "0x0000000000000000000000000000000000000000", ln = !0;
882
+ var zn = "0x0000000000000000000000000000000000000000", Bn = !0;
624
883
  function Z(e) {
625
884
  if (b(e)) return e.txSender;
626
885
  if (g(e)) return e;
@@ -631,21 +890,21 @@ async function Q(e, t) {
631
890
  return m(n.transactionHash);
632
891
  }
633
892
  function $() {
634
- return Ze.getSchemaUID(U, cn, ln);
893
+ return tt.getSchemaUID(I, zn, Bn);
635
894
  }
636
- async function un(e) {
895
+ async function Vn(e) {
637
896
  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({
897
+ return await be(n) || (await Q(t, Te({
898
+ schema: I,
899
+ resolverAddress: zn,
900
+ revocable: Bn
901
+ })), await Q(t, Fe({
643
902
  schemaUid: n,
644
- schemaName: ot
903
+ schemaName: pt
645
904
  }))), n;
646
905
  }
647
- function dn(e) {
648
- return new Xe(U).encodeData([
906
+ function Hn(e) {
907
+ return new et(I).encodeData([
649
908
  {
650
909
  name: "domain",
651
910
  value: e.domain,
@@ -663,7 +922,7 @@ function dn(e) {
663
922
  },
664
923
  {
665
924
  name: "challengeHash",
666
- value: G(e.challengeHash),
925
+ value: L(e.challengeHash),
667
926
  type: "bytes32"
668
927
  },
669
928
  {
@@ -683,7 +942,7 @@ function dn(e) {
683
942
  },
684
943
  {
685
944
  name: "registryFingerprint",
686
- value: G(e.registryFingerprint),
945
+ value: L(e.registryFingerprint),
687
946
  type: "bytes32"
688
947
  },
689
948
  {
@@ -693,28 +952,28 @@ function dn(e) {
693
952
  }
694
953
  ]);
695
954
  }
696
- function fn(e) {
955
+ function Un(e) {
697
956
  if (typeof e.override == "number" && e.override > 0) return e.override;
698
957
  if (e.registryExpirationDate) {
699
958
  let t = Date.parse(e.registryExpirationDate);
700
959
  if (Number.isFinite(t) && t > 0) return Math.floor(t / 1e3);
701
960
  }
702
- return e.verifiedAt + nt;
961
+ return e.verifiedAt + ct;
703
962
  }
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();
963
+ async function Wn(e) {
964
+ let t = Z(e.wallet), r = e.ensureSchema === !1 ? $() : await Vn(e.wallet), i = Y(e.domain), a = e.claimer.trim();
706
965
  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({
966
+ let o = L(e.challengeHash);
967
+ if (o === nt) throw Error("@seedprotocol/publish: attestDomainOwnership requires a non-zero challengeHash");
968
+ let s = e.verifiedAt ?? Math.floor(Date.now() / 1e3), c = jn({
710
969
  domain: i,
711
970
  creationDate: e.registrySnapshot.creationDate ?? "",
712
971
  registrarIanaId: e.registrySnapshot.registrarIanaId ?? ""
713
- }), l = e.registrySnapshot.creationDate ?? "", u = e.registrySnapshot.expirationDate ?? "", d = e.scope ?? W, p = e.method ?? H, m = fn({
972
+ }), l = e.registrySnapshot.creationDate ?? "", u = e.registrySnapshot.expirationDate ?? "", d = e.scope ?? mt, p = e.method ?? ut, m = Un({
714
973
  verifiedAt: s,
715
974
  registryExpirationDate: u,
716
975
  override: e.expirationTime
717
- }), h = dn({
976
+ }), h = Hn({
718
977
  domain: i,
719
978
  claimer: a,
720
979
  method: p,
@@ -730,14 +989,14 @@ async function pn(e) {
730
989
  recipient: a,
731
990
  expirationTime: BigInt(m),
732
991
  revocable: !0,
733
- refUID: R,
992
+ refUID: nt,
734
993
  data: h,
735
994
  value: 0n
736
995
  }
737
996
  }));
738
997
  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");
998
+ let { easContractAddress: _ } = x(), v = n(g, _);
999
+ if (!v || !St(v)) throw Error("@seedprotocol/publish: attestDomainOwnership failed — could not parse attestation UID");
741
1000
  return {
742
1001
  uid: v,
743
1002
  schemaUid: r,
@@ -747,22 +1006,22 @@ async function pn(e) {
747
1006
  expirationTime: m
748
1007
  };
749
1008
  }
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");
1009
+ async function Gn(e) {
1010
+ let t = Z(e.wallet), n = e.schemaUid ?? $(), i = L(e.uid);
1011
+ if (!St(i)) throw Error("@seedprotocol/publish: revokeDomainOwnership requires a valid attestation uid");
753
1012
  if (!await Q(t, r([{
754
1013
  schema: n,
755
1014
  data: [{ uid: i }]
756
1015
  }]))) throw Error("@seedprotocol/publish: revokeDomainOwnership failed — no receipt");
757
1016
  }
758
- async function hn(e) {
759
- let { challenge: t } = e, n = ft({
1017
+ async function Kn(e) {
1018
+ let { challenge: t } = e, n = bt({
760
1019
  domain: t.domain,
761
1020
  claimer: t.claimer,
762
1021
  token: t.token,
763
1022
  scope: t.scope
764
1023
  });
765
- if (G(n) !== G(t.challengeHash)) return {
1024
+ if (L(n) !== L(t.challengeHash)) return {
766
1025
  ok: !1,
767
1026
  dns: {
768
1027
  ok: !1,
@@ -774,7 +1033,7 @@ async function hn(e) {
774
1033
  challengeHash: n,
775
1034
  error: "Challenge hash does not match domain/claimer/token/scope"
776
1035
  };
777
- let r = await sn(t, {
1036
+ let r = await Rn(t, {
778
1037
  lookups: e.dnsLookups,
779
1038
  now: e.now
780
1039
  });
@@ -785,7 +1044,7 @@ async function hn(e) {
785
1044
  challengeHash: n,
786
1045
  error: r.error ?? "DNS verification failed"
787
1046
  };
788
- let i = e.registryLookup ?? Y, a;
1047
+ let i = e.registryLookup ?? X, a;
789
1048
  try {
790
1049
  a = await i(t.domain);
791
1050
  } catch {
@@ -804,8 +1063,8 @@ async function hn(e) {
804
1063
  error: "Registry lookup failed"
805
1064
  };
806
1065
  }
807
- async function gn(e) {
808
- let t = await hn({
1066
+ async function qn(e) {
1067
+ let t = await Kn({
809
1068
  challenge: e.challenge,
810
1069
  dnsLookups: e.dnsLookups,
811
1070
  registryLookup: e.registryLookup,
@@ -813,7 +1072,7 @@ async function gn(e) {
813
1072
  });
814
1073
  if (!t.ok || !t.registrySnapshot) throw Error(`@seedprotocol/publish: verifyAndAttestDomainOwnership failed — ${t.error ?? "verification failed"}`);
815
1074
  return {
816
- ...await pn({
1075
+ ...await Wn({
817
1076
  wallet: e.wallet,
818
1077
  domain: e.challenge.domain,
819
1078
  claimer: e.challenge.claimer,
@@ -827,21 +1086,21 @@ async function gn(e) {
827
1086
  dns: t.dns
828
1087
  };
829
1088
  }
830
- async function _n(e) {
831
- let t = (await dt({
1089
+ async function Jn(e) {
1090
+ let t = (await yt({
832
1091
  toolAddresses: e.toolAddresses,
833
1092
  schemaUid: e.schemaUid,
834
1093
  excludeRevoked: !0
835
- })).find((t) => G(t.id) === G(e.uid));
1094
+ })).find((t) => L(t.id) === L(e.uid));
836
1095
  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;
1096
+ let n = _t(t.decodedDataJson ?? "[]"), r = e.registryLookup ?? X, i;
838
1097
  try {
839
1098
  i = await r(n.domain);
840
1099
  } catch {
841
1100
  i = null;
842
1101
  }
843
1102
  return {
844
- ...st({
1103
+ ...ht({
845
1104
  decoded: n,
846
1105
  registrySnapshot: i,
847
1106
  now: e.now
@@ -852,6 +1111,6 @@ async function _n(e) {
852
1111
  };
853
1112
  }
854
1113
  //#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 };
1114
+ export { ve as AttestationVerificationError, lt as DOMAIN_OWNERSHIP_METHOD, dt as DOMAIN_OWNERSHIP_SCHEMA_DEF, ft as DOMAIN_OWNERSHIP_SCHEMA_NAME, me as Eip7702ModularAccountPublishError, h as MULTI_PUBLISH_ABI_REFERENCE_ADDRESS_OP_SEPOLIA, ge as ManagedAccountPublishError, Re as PUBLISH_AUTHORIZATION_SCHEMA_DEF, Ne as PUBLISH_AUTHORIZATION_SCHEMA_NAME, Ie as PUBLISH_AUTHORIZATION_SCOPES, B as PUBLISH_GAS_HEURISTICS, C as PublishManager, Ot as PublishModeButtons, kt as PublishProvider, y as SEED_PROTOCOL_CONTRACT_ADDRESS_OP_SEPOLIA, Je as SeedProvider, ae as asPublishWallet, ue as asSeedSigner, v as asSeedTxSender, De as assertManagedAccountEasMatchesConfig, Jn as assessDomainOwnershipLive, je as assessPublishAuthorizationLive, Wn as attestDomainOwnership, Oe as attestPublishAuthorization, Ce as buildPublishAnchorBytes, bn as clearAllPublishProcesses, xn as clearAllUploadProcesses, vn as clearCompletedPublishProcesses, yn as clearCompletedPublishProcessesForSeed, de as clearPublishWallet, q as combinePublishCostEstimate, le as configurePublish, Nn as createDomainOwnershipChallenge, z as createPermissionlessTxSender, Cn as deletePublishProcessById, wn as deletePublishProcessesByIds, Sn as deletePublishProcessesForSeed, Hn as encodeDomainOwnershipAttestationData, ie as encodeEasAttest, t as encodeEasMultiAttest, re as encodeEasMultiRevoke, l as encodeMultiPublish, u as encodeMultiPublishInteger, Pe as encodePublishAuthorizationAttestationData, i as encodeSetEas, Vn as ensureDomainOwnershipSchema, xe as ensureEasSchemasForItem, ze as ensureManagedAccountEasConfigured, Le as ensurePublishAuthorizationSchema, An as ensureWalletThenPublish, Jt as estimatePublishCost, jn as fingerprintFromRegistrySnapshot, R as fromEip1193Provider, oe as fromEthersWallet, At as fromWindowEthereum, we as getArweave, Tn as getArweaveTransactionIds, G as getCachedMarketRates, Rt as getCachedTokenPrices, en as getDisplayStepId, $ as getDomainOwnershipSchemaUid, En as getEasPayload, ke as getPublishAuthorizationSchemaUid, x as getPublishConfig, nn as getPublishMachineValueForUi, p as getPublishPublicClient, S as getPublishWallet, Nt as heuristicPublishGas, ne as initPublish, o as isContractDeployed, pe as isEip7702ModularAccountPublishError, fe as isManagedAccountPublishError, b as isPublishWallet, he as isRouterNonModularCoreAccountError, te as isSeedSigner, g as isSeedTxSender, X as lookupDomainRegistry, Y as normalizeRegistrableDomain, Ae as publishMachine, c as readGetEas, d as readIsActiveSigner, Wt as resetMarketRateCache, zt as resetTokenPriceCache, tn as resolvePublishDisplayValue, Gn as revokeDomainOwnership, Me as revokePublishAuthorization, _ as setPublishWallet, _e as stringifyUnderlyingCause, On as transformPayloadToIntegerIds, sn as useArweaveL1Finalize, on as useCanPublishItem, cn as useItemPublishStatus, Se as usePublishConfig, Dn as usePublishCostEstimate, an as usePublishProcess, _n as usePublishProcessById, fn as usePublishProcesses, mn as usePublishProcessesForSeed, pn as usePublishProcessesNonActiveCount, gn as usePublishProcessesNonActiveCountForSeed, dn as usePublishProcessesState, hn as usePublishProcessesStateForSeed, Mt as useSeedWallet, qn as verifyAndAttestDomainOwnership, ye as verifyDataItem, Kn as verifyDomainOwnershipChallenge, Rn as verifyDomainOwnershipDns, m as waitForPublishReceipt, $t as watchPublishCost };
856
1115
 
857
1116
  //# sourceMappingURL=index.js.map