@seedprotocol/publish 0.7.9 → 0.7.10-next.1344.g3828e8a
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.
- package/CHANGELOG.md +8 -0
- package/dist/{chainConfig-CD-RgKkA.js → chainConfig-B8U89YJb.js} +1011 -1008
- package/dist/chainConfig-B8U89YJb.js.map +1 -0
- package/dist/{ensureAutomationSessionKey-CHXAuk8Q.js → ensureAutomationSessionKey-B19eVd1T.js} +3 -3
- package/dist/{ensureAutomationSessionKey-CHXAuk8Q.js.map → ensureAutomationSessionKey-B19eVd1T.js.map} +1 -1
- package/dist/{ensureModularPublishBootstrap-Cit8PlNN.js → ensureModularPublishBootstrap-COEV4BGz.js} +3 -3
- package/dist/{ensureModularPublishBootstrap-Cit8PlNN.js.map → ensureModularPublishBootstrap-COEV4BGz.js.map} +1 -1
- package/dist/{ensureSmartWalletThenPublish-C2FS784-.js → ensureSmartWalletThenPublish-DhWyUjt0.js} +2 -2
- package/dist/{ensureSmartWalletThenPublish-C2FS784-.js.map → ensureSmartWalletThenPublish-DhWyUjt0.js.map} +1 -1
- package/dist/helpers/publishItem.d.ts +1 -1
- package/dist/helpers/publishItem.d.ts.map +1 -1
- package/dist/hooks/usePublishCostEstimate.d.ts.map +1 -1
- package/dist/hooks/usePublishCostEstimate.test.d.ts +2 -0
- package/dist/hooks/usePublishCostEstimate.test.d.ts.map +1 -0
- package/dist/index.js +325 -293
- package/dist/index.js.map +1 -1
- package/dist/{managedAccountAdmin-BmO4USir.js → managedAccountAdmin-xZbC3bQ5.js} +2 -2
- package/dist/{managedAccountAdmin-BmO4USir.js.map → managedAccountAdmin-xZbC3bQ5.js.map} +1 -1
- package/dist/{publishAuthorization-D1HYOu23.js → publishAuthorization-CpmPRbpm.js} +2 -2
- package/dist/{publishAuthorization-D1HYOu23.js.map → publishAuthorization-CpmPRbpm.js.map} +1 -1
- package/dist/{resolveRevokeAccount-CK8SbaVn.js → resolveRevokeAccount-D08n9UTy.js} +2 -2
- package/dist/{resolveRevokeAccount-CK8SbaVn.js.map → resolveRevokeAccount-D08n9UTy.js.map} +1 -1
- package/dist/services/publish/actors/createAttestations.d.ts +4 -3
- package/dist/services/publish/actors/createAttestations.d.ts.map +1 -1
- package/dist/services/publish/actors/createAttestationsDirectToEas.d.ts.map +1 -1
- package/dist/services/publish/actors/utils.d.ts +5 -0
- package/dist/services/publish/actors/utils.d.ts.map +1 -1
- package/dist/services/publishCost/watchPublishCost.d.ts +19 -2
- package/dist/services/publishCost/watchPublishCost.d.ts.map +1 -1
- package/dist/thirdweb.js +5 -5
- package/dist/{worker-BlNDHv1o.js → worker-4DXDWw6E.js} +2 -2
- package/dist/{worker-BlNDHv1o.js.map → worker-4DXDWw6E.js.map} +1 -1
- package/package.json +9 -9
- package/dist/chainConfig-CD-RgKkA.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { $t as e, A as t, At as n, Bt as r, C as i, Ct as a, D as o, Dt as s, E as c, Et as l, F as u, Ft as d, Gt as f, I as p, It as m, Jt as h, Kt as g, Lt as _, Mt as
|
|
2
|
-
import { i as
|
|
3
|
-
import { a as
|
|
4
|
-
import { n as
|
|
5
|
-
import { BaseDb as
|
|
6
|
-
import { createWalletClient as
|
|
7
|
-
import { NO_EXPIRATION as
|
|
8
|
-
import { useCallback as
|
|
9
|
-
import { and as
|
|
10
|
-
import { DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS as
|
|
11
|
-
import { jsx as
|
|
12
|
-
import { SeedProvider as
|
|
13
|
-
import { useSelector as
|
|
14
|
-
import { lookup as
|
|
1
|
+
import { $t as e, A as t, At as n, Bt as r, C as i, Ct as a, D as o, Dt as s, E as c, Et as l, F as u, Ft as d, Gt as f, I as p, It as m, Jt as h, Kt as g, Lt as _, Mt as v, Nt as y, O as b, Ot as x, Pt as S, Qt as C, Rt as w, S as ee, St as te, T as ne, Tt as re, Vt as ie, Wt as T, Xt as ae, Yt as oe, Zt as se, _ as ce, a as E, an as le, at as ue, b as de, bt as fe, c as pe, cn as me, ct as he, d as ge, dt as _e, en as ve, ft as ye, g as be, h as xe, i as Se, in as Ce, jt as we, k as Te, kt as Ee, l as De, lt as Oe, m as ke, n as Ae, nn as je, o as Me, on as Ne, ot as Pe, p as Fe, pt as Ie, qt as Le, r as Re, rn as ze, s as Be, sn as D, st as Ve, t as He, tn as Ue, u as We, ut as Ge, v as Ke, vt as qe, w as Je, wt as O, x as Ye, xt as Xe, y as Ze, yt as Qe } from "./chainConfig-B8U89YJb.js";
|
|
2
|
+
import { i as $e, r as k, t as et } from "./publishWalletRegistry-BaQe9rIR.js";
|
|
3
|
+
import { a as tt, c as nt, g as rt, h as it, i as at, l as ot, n as st, o as ct, r as lt, s as ut, t as dt } from "./publishAuthorization-CpmPRbpm.js";
|
|
4
|
+
import { n as ft, r as pt } from "./collectBatchUids-CnIe9jUB.js";
|
|
5
|
+
import { BaseDb as A, arweaveL1FinalizeJobs as j, isItemOwned as mt, publishProcesses as M, uploadProcesses as ht } from "@seedprotocol/sdk";
|
|
6
|
+
import { createWalletClient as gt, custom as _t, defineChain as vt } from "viem";
|
|
7
|
+
import { NO_EXPIRATION as yt, SchemaEncoder as bt, SchemaRegistry as xt, ZERO_BYTES32 as N } from "@ethereum-attestation-service/eas-sdk";
|
|
8
|
+
import { useCallback as St, useEffect as P, useMemo as F, useRef as I, useState as L } from "react";
|
|
9
|
+
import { and as Ct, desc as R, eq as z, inArray as wt, notInArray as Tt } from "drizzle-orm";
|
|
10
|
+
import { DOMAIN_OWNERSHIP_CHALLENGE_TTL_MS as Et, DOMAIN_OWNERSHIP_DEFAULT_EXPIRATION_SECS as Dt, DOMAIN_OWNERSHIP_METHOD as Ot, DOMAIN_OWNERSHIP_METHOD as kt, DOMAIN_OWNERSHIP_SCHEMA_DEF as At, DOMAIN_OWNERSHIP_SCHEMA_DEF as B, DOMAIN_OWNERSHIP_SCHEMA_NAME as jt, DOMAIN_OWNERSHIP_SCHEMA_NAME as Mt, DOMAIN_OWNERSHIP_SCOPE_HOSTNAME as Nt, DOMAIN_OWNERSHIP_SCOPE_REGISTRABLE as V, EAS_CHAIN_DEPLOYMENTS as Pt, PUBLISHED_BY_SCHEMA_DEF as Ft, PUBLISHED_BY_SCHEMA_DEF as H, PUBLISHED_BY_SCHEMA_NAME as It, PUBLISHED_BY_SCHEMA_NAME as Lt, assessDomainOwnership as Rt, buildDomainOwnershipTxtValue as zt, decodeDomainOwnershipData as Bt, domainOwnershipTxtName as Vt, getDomainOwnershipFromEas as Ht, getEasChainDeployment as Ut, hashDomainOwnershipChallenge as Wt, hashDomainRegistryFingerprint as Gt, hashPublishedByBatch as Kt, hashPublishedByBatch as qt, isValidEasAttestationUid as U, normalizeBytes32Hex as W, parseDomainOwnershipTxtValue as Jt } from "@seedprotocol/eas";
|
|
11
|
+
import { jsx as G, jsxs as Yt } from "react/jsx-runtime";
|
|
12
|
+
import { SeedProvider as Xt, SeedProvider as Zt, useLiveQuery as K, useSeedAddressRevision as Qt } from "@seedprotocol/react";
|
|
13
|
+
import { useSelector as $t } from "@xstate/react";
|
|
14
|
+
import { lookup as en, toRegistrableDomain as tn } from "rdapper";
|
|
15
15
|
//#region src/helpers/seedTwin.ts
|
|
16
|
-
function
|
|
16
|
+
function nn(e) {
|
|
17
17
|
let t = [
|
|
18
18
|
["chainId", e?.chainId],
|
|
19
19
|
["rpcUrl", e?.rpcUrl],
|
|
@@ -25,7 +25,7 @@ function sn(e) {
|
|
|
25
25
|
["contracts.seedProtocolExecutor", e?.contracts?.seedProtocolExecutor]
|
|
26
26
|
].filter(([, e]) => e == null || e === "").map(([e]) => e);
|
|
27
27
|
if (t.length > 0) throw Error(`seedTwinConfig: twin.json is missing ${t.join(", ")}. Re-run twin:up.`);
|
|
28
|
-
let n = e.forkedFrom?.chain ? ` (${e.forkedFrom.chain} fork)` : "", r =
|
|
28
|
+
let n = e.forkedFrom?.chain ? ` (${e.forkedFrom.chain} fork)` : "", r = vt({
|
|
29
29
|
id: e.chainId,
|
|
30
30
|
name: `Seed twin${n}`,
|
|
31
31
|
nativeCurrency: {
|
|
@@ -59,7 +59,7 @@ function sn(e) {
|
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/react/PublishModeButtons.tsx
|
|
62
|
-
var
|
|
62
|
+
var rn = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish mode" }) => {
|
|
63
63
|
let i = {
|
|
64
64
|
display: "inline-flex",
|
|
65
65
|
gap: 8,
|
|
@@ -74,17 +74,17 @@ var cn = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish
|
|
|
74
74
|
cursor: n ? "not-allowed" : "pointer",
|
|
75
75
|
opacity: n ? .6 : 1
|
|
76
76
|
});
|
|
77
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ Yt("div", {
|
|
78
78
|
role: "group",
|
|
79
79
|
"aria-label": r,
|
|
80
80
|
style: i,
|
|
81
|
-
children: [/* @__PURE__ */
|
|
81
|
+
children: [/* @__PURE__ */ G("button", {
|
|
82
82
|
type: "button",
|
|
83
83
|
disabled: n,
|
|
84
84
|
style: a(e === "patch"),
|
|
85
85
|
onClick: () => t("patch"),
|
|
86
86
|
children: "Publish updates"
|
|
87
|
-
}), /* @__PURE__ */
|
|
87
|
+
}), /* @__PURE__ */ G("button", {
|
|
88
88
|
type: "button",
|
|
89
89
|
disabled: n,
|
|
90
90
|
style: a(e === "new_version"),
|
|
@@ -92,11 +92,11 @@ var cn = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish
|
|
|
92
92
|
children: "New version"
|
|
93
93
|
})]
|
|
94
94
|
});
|
|
95
|
-
},
|
|
96
|
-
let i =
|
|
97
|
-
return t && i.current !== t && (
|
|
98
|
-
value: t ??
|
|
99
|
-
children: /* @__PURE__ */
|
|
95
|
+
}, an = ({ children: e, config: t, queryClient: n, queryClientRef: r }) => {
|
|
96
|
+
let i = I(void 0);
|
|
97
|
+
return t && i.current !== t && (Me(t), i.current = t), /* @__PURE__ */ G(it.Provider, {
|
|
98
|
+
value: t ?? Se(),
|
|
99
|
+
children: /* @__PURE__ */ G(Zt, {
|
|
100
100
|
queryClient: n,
|
|
101
101
|
queryClientRef: r,
|
|
102
102
|
children: e
|
|
@@ -105,27 +105,27 @@ var cn = ({ value: e, onChange: t, disabled: n = !1, "aria-label": r = "Publish
|
|
|
105
105
|
};
|
|
106
106
|
//#endregion
|
|
107
107
|
//#region src/helpers/adapters/eip1193.ts
|
|
108
|
-
async function
|
|
109
|
-
let n = t.chain ??
|
|
108
|
+
async function q(e, t = {}) {
|
|
109
|
+
let n = t.chain ?? Ae(), r = t.address;
|
|
110
110
|
if (!r) {
|
|
111
111
|
let t = await e.request({ method: "eth_requestAccounts" });
|
|
112
112
|
if (!t?.[0]) throw Error("@seedprotocol/publish: EIP-1193 provider returned no accounts");
|
|
113
113
|
r = t[0];
|
|
114
114
|
}
|
|
115
|
-
let i =
|
|
115
|
+
let i = gt({
|
|
116
116
|
account: r,
|
|
117
117
|
chain: n,
|
|
118
|
-
transport:
|
|
118
|
+
transport: _t(e)
|
|
119
119
|
});
|
|
120
120
|
return {
|
|
121
|
-
signer:
|
|
121
|
+
signer: Xe({
|
|
122
122
|
address: r,
|
|
123
123
|
signMessage: async ({ message: e }) => i.signMessage({
|
|
124
124
|
account: r,
|
|
125
125
|
message: typeof e == "string" ? e : { raw: e.raw }
|
|
126
126
|
})
|
|
127
127
|
}),
|
|
128
|
-
txSender:
|
|
128
|
+
txSender: te({
|
|
129
129
|
address: r,
|
|
130
130
|
sendTransaction: async (e) => ({ transactionHash: await i.sendTransaction({
|
|
131
131
|
account: r,
|
|
@@ -139,25 +139,25 @@ async function U(e, t = {}) {
|
|
|
139
139
|
kind: "eoa"
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
async function
|
|
142
|
+
async function on(e = {}) {
|
|
143
143
|
let t = globalThis.ethereum;
|
|
144
144
|
if (!t) throw Error("@seedprotocol/publish: window.ethereum is not available");
|
|
145
|
-
return
|
|
145
|
+
return q(t, e);
|
|
146
146
|
}
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/react/useSeedWallet.ts
|
|
149
|
-
function
|
|
150
|
-
let [e, t] =
|
|
151
|
-
|
|
152
|
-
t(
|
|
149
|
+
function sn() {
|
|
150
|
+
let [e, t] = L(() => k()), [n, r] = L(() => k() ? "connected" : "disconnected");
|
|
151
|
+
P(() => {
|
|
152
|
+
t(k());
|
|
153
153
|
}, []);
|
|
154
|
-
let i =
|
|
154
|
+
let i = St(async (e) => {
|
|
155
155
|
r("connecting");
|
|
156
156
|
try {
|
|
157
157
|
let n;
|
|
158
|
-
n =
|
|
159
|
-
let i =
|
|
160
|
-
a.sender === "eip7702" && (o = await
|
|
158
|
+
n = O(e) ? e : await q(e);
|
|
159
|
+
let i = E(), a = je(i), o = n.txSender;
|
|
160
|
+
a.sender === "eip7702" && (o = await Fe({
|
|
161
161
|
signer: n.signer,
|
|
162
162
|
bundlerUrl: i.bundlerUrl,
|
|
163
163
|
paymasterUrl: i.paymasterUrl,
|
|
@@ -169,12 +169,12 @@ function dn() {
|
|
|
169
169
|
ownedAddresses: [n.signer.address, o.address],
|
|
170
170
|
publisherAddress: n.signer.address
|
|
171
171
|
};
|
|
172
|
-
return await
|
|
172
|
+
return await $e(s), t(s), r("connected"), s;
|
|
173
173
|
} catch (e) {
|
|
174
174
|
throw r("disconnected"), e;
|
|
175
175
|
}
|
|
176
|
-
}, []), a =
|
|
177
|
-
|
|
176
|
+
}, []), a = St(() => {
|
|
177
|
+
et(), t(null), r("disconnected");
|
|
178
178
|
}, []);
|
|
179
179
|
return {
|
|
180
180
|
address: e?.signer.address,
|
|
@@ -187,108 +187,133 @@ function dn() {
|
|
|
187
187
|
}
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region src/services/publishCost/watchPublishCost.ts
|
|
190
|
-
var
|
|
191
|
-
function
|
|
190
|
+
var cn = 6e4, ln = 15e3, un = 5e3;
|
|
191
|
+
function dn(e) {
|
|
192
192
|
let t = e.getService().getSnapshot(), n = (t && typeof t == "object" && "context" in t ? t.context : void 0)?.propertyValue ?? e.value;
|
|
193
193
|
return `${e.propertyName}:${e.uid ?? ""}:${String(n ?? "")}`;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function J(e) {
|
|
196
196
|
let t = e.properties ?? [];
|
|
197
197
|
return [
|
|
198
198
|
e.seedLocalId,
|
|
199
199
|
e.seedUid ?? "",
|
|
200
200
|
e.latestVersionLocalId ?? "",
|
|
201
|
-
...t.map(
|
|
201
|
+
...t.map(dn)
|
|
202
202
|
].join("|");
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
async function fn(e, t) {
|
|
205
|
+
let { isChangeFeedRunning: n, watchEntityChanges: r } = await import("@seedprotocol/sdk");
|
|
206
|
+
return n() ? r({
|
|
207
|
+
seedLocalId: e.seedLocalId,
|
|
208
|
+
seedUid: e.seedUid,
|
|
209
|
+
tables: [
|
|
210
|
+
"seeds",
|
|
211
|
+
"versions",
|
|
212
|
+
"metadata"
|
|
213
|
+
]
|
|
214
|
+
}, t) : null;
|
|
215
|
+
}
|
|
216
|
+
function pn(e) {
|
|
205
217
|
return e instanceof Error ? e : Error(String(e));
|
|
206
218
|
}
|
|
207
|
-
function
|
|
208
|
-
let r = n?.priceRefreshMs ??
|
|
209
|
-
let t = await
|
|
210
|
-
return
|
|
219
|
+
function mn(e, t, n) {
|
|
220
|
+
let r = n?.priceRefreshMs ?? cn, i = n?.itemIdleMs ?? ln, a = n?.firstEstimateRetryMs ?? un, o = n?.estimate ?? ((e) => ce(e, n)), s = n?.reprice ?? (async (e) => {
|
|
221
|
+
let t = await Ke({ forceRefresh: !0 });
|
|
222
|
+
return be(e.work, t, {
|
|
211
223
|
evmUserPays: e.evm.userPays,
|
|
212
224
|
arweavePath: e.arweave.path
|
|
213
225
|
});
|
|
214
|
-
}),
|
|
215
|
-
|
|
216
|
-
estimate:
|
|
217
|
-
isEstimating:
|
|
218
|
-
isStale:
|
|
219
|
-
error:
|
|
220
|
-
refresh:
|
|
226
|
+
}), c = !1, l = J(e), u = n?.previousEstimate ?? null, d = !1, f = u !== null, p = !1, m = !1, h = null, g = 0, _ = null, v = null, y = null, b = () => {
|
|
227
|
+
c || t({
|
|
228
|
+
estimate: u,
|
|
229
|
+
isEstimating: d,
|
|
230
|
+
isStale: f,
|
|
231
|
+
error: h,
|
|
232
|
+
refresh: C
|
|
221
233
|
});
|
|
222
|
-
},
|
|
223
|
-
let t = ++
|
|
224
|
-
|
|
234
|
+
}, x = async () => {
|
|
235
|
+
let t = ++g;
|
|
236
|
+
y &&= (clearTimeout(y), null), d = !0, h = null, b();
|
|
225
237
|
try {
|
|
226
|
-
let n = await
|
|
227
|
-
if (
|
|
228
|
-
|
|
238
|
+
let n = await o(e);
|
|
239
|
+
if (c || t !== g) return;
|
|
240
|
+
u = n, p = !0, l = J(e), f = !1, d = !1, h = null, b();
|
|
229
241
|
} catch (e) {
|
|
230
|
-
if (
|
|
231
|
-
|
|
242
|
+
if (c || t !== g) return;
|
|
243
|
+
if (!p && !m && a > 0) {
|
|
244
|
+
m = !0, y = setTimeout(() => {
|
|
245
|
+
y = null, x();
|
|
246
|
+
}, a);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
d = !1, h = pn(e), b();
|
|
232
250
|
}
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}, i),
|
|
237
|
-
},
|
|
238
|
-
|
|
251
|
+
}, S = () => {
|
|
252
|
+
u && (f = !0), i <= 0 ? x() : (_ && clearTimeout(_), _ = setTimeout(() => {
|
|
253
|
+
_ = null, x();
|
|
254
|
+
}, i), b());
|
|
255
|
+
}, C = () => {
|
|
256
|
+
_ &&= (clearTimeout(_), null), x();
|
|
239
257
|
};
|
|
240
|
-
|
|
241
|
-
let
|
|
242
|
-
if (
|
|
243
|
-
let t =
|
|
244
|
-
t !==
|
|
245
|
-
});
|
|
246
|
-
return
|
|
247
|
-
|
|
258
|
+
x();
|
|
259
|
+
let w = e.subscribe(() => {
|
|
260
|
+
if (c) return;
|
|
261
|
+
let t = J(e);
|
|
262
|
+
t !== l && (l = t, S());
|
|
263
|
+
}), ee = null;
|
|
264
|
+
return (n?.watchRows ?? fn)(e, () => {
|
|
265
|
+
c || S();
|
|
266
|
+
}).then((e) => {
|
|
267
|
+
if (e) {
|
|
268
|
+
if (c) return e();
|
|
269
|
+
ee = e, w?.unsubscribe(), w = null;
|
|
270
|
+
}
|
|
271
|
+
}, () => {}), r > 0 && (v = setInterval(() => {
|
|
272
|
+
c || !u || d || (async () => {
|
|
248
273
|
try {
|
|
249
|
-
let e = await
|
|
250
|
-
if (
|
|
251
|
-
|
|
274
|
+
let e = await s(u);
|
|
275
|
+
if (c) return;
|
|
276
|
+
u = e, b();
|
|
252
277
|
} catch (e) {
|
|
253
|
-
if (
|
|
254
|
-
|
|
278
|
+
if (c) return;
|
|
279
|
+
h = pn(e), b();
|
|
255
280
|
}
|
|
256
281
|
})();
|
|
257
282
|
}, r)), {
|
|
258
|
-
refresh:
|
|
283
|
+
refresh: C,
|
|
259
284
|
dispose: () => {
|
|
260
|
-
|
|
285
|
+
c = !0, w?.unsubscribe(), ee?.(), _ && clearTimeout(_), v && clearInterval(v), y && clearTimeout(y);
|
|
261
286
|
}
|
|
262
287
|
};
|
|
263
288
|
}
|
|
264
289
|
//#endregion
|
|
265
290
|
//#region src/helpers/publishDisplayHelpers.ts
|
|
266
|
-
function
|
|
291
|
+
function hn(e) {
|
|
267
292
|
return e === "creatingAttestationsDirectToEas" ? "creatingAttestations" : e;
|
|
268
293
|
}
|
|
269
|
-
function
|
|
294
|
+
function gn(e, t, n) {
|
|
270
295
|
if (e != null) return n;
|
|
271
|
-
if (t?.status === "completed") return
|
|
272
|
-
if (t?.status === "failed") return
|
|
296
|
+
if (t?.status === "completed") return D.SUCCESS;
|
|
297
|
+
if (t?.status === "failed") return D.FAILURE;
|
|
273
298
|
if (t?.status !== "interrupted") return n;
|
|
274
299
|
}
|
|
275
|
-
function
|
|
300
|
+
function _n(e) {
|
|
276
301
|
if (e) {
|
|
277
|
-
if (e.status === "failed") return
|
|
278
|
-
if (e.status === "completed") return
|
|
302
|
+
if (e.status === "failed") return D.FAILURE;
|
|
303
|
+
if (e.status === "completed") return D.SUCCESS;
|
|
279
304
|
if (e.status !== "interrupted") {
|
|
280
305
|
if (e.completedAt != null) {
|
|
281
306
|
try {
|
|
282
307
|
let t = JSON.parse(e.persistedSnapshot);
|
|
283
|
-
if (t.status === "done" && t.value ===
|
|
308
|
+
if (t.status === "done" && t.value === D.FAILURE) return D.FAILURE;
|
|
284
309
|
} catch {}
|
|
285
|
-
return
|
|
310
|
+
return D.SUCCESS;
|
|
286
311
|
}
|
|
287
312
|
try {
|
|
288
313
|
let t = JSON.parse(e.persistedSnapshot);
|
|
289
314
|
if (t.status === "done") {
|
|
290
|
-
if (t.value ===
|
|
291
|
-
if (t.value ===
|
|
315
|
+
if (t.value === D.SUCCESS) return D.SUCCESS;
|
|
316
|
+
if (t.value === D.FAILURE) return D.FAILURE;
|
|
292
317
|
}
|
|
293
318
|
if (typeof t.value == "string") return t.value;
|
|
294
319
|
} catch {
|
|
@@ -299,19 +324,19 @@ function yn(e) {
|
|
|
299
324
|
}
|
|
300
325
|
//#endregion
|
|
301
326
|
//#region src/hooks/usePublishProcess.ts
|
|
302
|
-
function
|
|
303
|
-
return !e || e.status !== "done" ? !1 : e.value ===
|
|
327
|
+
function vn(e) {
|
|
328
|
+
return !e || e.status !== "done" ? !1 : e.value === D.SUCCESS || e.value === D.FAILURE;
|
|
304
329
|
}
|
|
305
|
-
function
|
|
306
|
-
let t =
|
|
307
|
-
|
|
330
|
+
function yn(e) {
|
|
331
|
+
let t = ke.getService(), n = $t(t, (t) => t?.context?.publishProcesses?.get(e) ?? null), r = I(null);
|
|
332
|
+
P(() => {
|
|
308
333
|
r.current = null;
|
|
309
334
|
}, [e]);
|
|
310
|
-
let [i, a] =
|
|
335
|
+
let [i, a] = L(void 0), [o, s] = L(null), c = A.getAppDb(), l = F(() => e && c ? c.select().from(M).where(z(M.seedLocalId, e)).orderBy(R(M.startedAt)).limit(1) : null, [c, e]), u = K(l)?.[0], d = u?.status, f = F(() => {
|
|
311
336
|
if (n != null) return i;
|
|
312
337
|
if (o === "success" || o === "failure") return o;
|
|
313
|
-
let e =
|
|
314
|
-
return e ===
|
|
338
|
+
let e = _n(u);
|
|
339
|
+
return e === D.SUCCESS || e === D.FAILURE ? e : gn(n, d == null ? void 0 : { status: d }, i);
|
|
315
340
|
}, [
|
|
316
341
|
n,
|
|
317
342
|
d,
|
|
@@ -319,16 +344,16 @@ function xn(e) {
|
|
|
319
344
|
o,
|
|
320
345
|
u
|
|
321
346
|
]);
|
|
322
|
-
return
|
|
347
|
+
return P(() => {
|
|
323
348
|
s(null);
|
|
324
|
-
}, [e]),
|
|
349
|
+
}, [e]), P(() => {
|
|
325
350
|
n ?? (d === "completed" ? s("success") : d === "failed" && s("failure"));
|
|
326
|
-
}, [d, n]),
|
|
351
|
+
}, [d, n]), P(() => {
|
|
327
352
|
n != null && s(null);
|
|
328
|
-
}, [n]),
|
|
353
|
+
}, [n]), P(() => {
|
|
329
354
|
if (!n) {
|
|
330
355
|
let e = r.current;
|
|
331
|
-
|
|
356
|
+
vn(e) ? (a(e.value), e.value === D.SUCCESS ? s("success") : e.value === D.FAILURE && s("failure")) : a(void 0);
|
|
332
357
|
return;
|
|
333
358
|
}
|
|
334
359
|
let e = n.getSnapshot();
|
|
@@ -352,15 +377,15 @@ function xn(e) {
|
|
|
352
377
|
}
|
|
353
378
|
//#endregion
|
|
354
379
|
//#region src/hooks/useCanPublishItem.ts
|
|
355
|
-
function
|
|
356
|
-
let [t, n] =
|
|
357
|
-
return
|
|
380
|
+
function bn(e) {
|
|
381
|
+
let [t, n] = L(!1), r = Qt(), i = e?.seedLocalId;
|
|
382
|
+
return P(() => {
|
|
358
383
|
if (!e) {
|
|
359
384
|
n(!1);
|
|
360
385
|
return;
|
|
361
386
|
}
|
|
362
387
|
let t = !0;
|
|
363
|
-
return n(!1),
|
|
388
|
+
return n(!1), mt(e).then((e) => {
|
|
364
389
|
t && n(e);
|
|
365
390
|
}).catch(() => {
|
|
366
391
|
t && n(!1);
|
|
@@ -371,9 +396,9 @@ function Sn(e) {
|
|
|
371
396
|
}
|
|
372
397
|
//#endregion
|
|
373
398
|
//#region src/hooks/useArweaveL1Finalize.ts
|
|
374
|
-
function
|
|
375
|
-
let t =
|
|
376
|
-
return
|
|
399
|
+
function xn(e) {
|
|
400
|
+
let t = A.getAppDb(), n = F(() => e && t ? t.select().from(j).where(z(j.seedLocalId, e)).orderBy(R(j.updatedAt)) : null, [t, e]), r = K(n) ?? [];
|
|
401
|
+
return F(() => {
|
|
377
402
|
let e = r.filter((e) => e.phase === "pending_l1").length, t = r.filter((e) => e.phase === "confirmed").length;
|
|
378
403
|
return {
|
|
379
404
|
hasPendingL1: e > 0,
|
|
@@ -385,8 +410,8 @@ function Cn(e) {
|
|
|
385
410
|
}
|
|
386
411
|
//#endregion
|
|
387
412
|
//#region src/hooks/useItemPublishStatus.ts
|
|
388
|
-
function
|
|
389
|
-
let { publishProcess: t, value: n } =
|
|
413
|
+
function Sn(e) {
|
|
414
|
+
let { publishProcess: t, value: n } = yn(e ?? ""), r = xn(e), i = A.getAppDb(), a = F(() => e && i ? i.select().from(M).where(z(M.seedLocalId, e)).orderBy(R(M.startedAt)).limit(1) : null, [i, e]), o = K(a)?.[0];
|
|
390
415
|
return {
|
|
391
416
|
latestRecord: o,
|
|
392
417
|
publishProcess: t,
|
|
@@ -399,44 +424,44 @@ function wn(e) {
|
|
|
399
424
|
}
|
|
400
425
|
//#endregion
|
|
401
426
|
//#region src/hooks/usePublishProcesses.ts
|
|
402
|
-
function
|
|
403
|
-
let e =
|
|
404
|
-
return
|
|
427
|
+
function Cn() {
|
|
428
|
+
let e = A.getAppDb();
|
|
429
|
+
return F(() => e ? e.select().from(M).orderBy(R(M.startedAt)) : null, [e]);
|
|
405
430
|
}
|
|
406
|
-
function
|
|
407
|
-
let t =
|
|
408
|
-
return
|
|
431
|
+
function wn(e) {
|
|
432
|
+
let t = A.getAppDb();
|
|
433
|
+
return F(() => t && e ? t.select().from(M).where(z(M.seedLocalId, e)).orderBy(R(M.startedAt)) : null, [t, e]);
|
|
409
434
|
}
|
|
410
|
-
function
|
|
411
|
-
let e =
|
|
435
|
+
function Tn() {
|
|
436
|
+
let e = Cn(), t = K(e);
|
|
412
437
|
return {
|
|
413
438
|
records: t,
|
|
414
|
-
nonActiveCount:
|
|
439
|
+
nonActiveCount: F(() => t === void 0 ? void 0 : t.filter((e) => e.status !== "in_progress").length, [t])
|
|
415
440
|
};
|
|
416
441
|
}
|
|
417
|
-
function
|
|
418
|
-
let e =
|
|
419
|
-
return
|
|
442
|
+
function En() {
|
|
443
|
+
let e = Cn();
|
|
444
|
+
return K(e);
|
|
420
445
|
}
|
|
421
|
-
function
|
|
422
|
-
return
|
|
446
|
+
function Dn() {
|
|
447
|
+
return Tn().nonActiveCount;
|
|
423
448
|
}
|
|
424
|
-
function
|
|
425
|
-
let t =
|
|
426
|
-
return
|
|
449
|
+
function On(e) {
|
|
450
|
+
let t = wn(e);
|
|
451
|
+
return K(t);
|
|
427
452
|
}
|
|
428
|
-
function
|
|
429
|
-
let t =
|
|
453
|
+
function kn(e) {
|
|
454
|
+
let t = wn(e), n = K(t);
|
|
430
455
|
return {
|
|
431
456
|
records: n,
|
|
432
|
-
nonActiveCount:
|
|
457
|
+
nonActiveCount: F(() => n === void 0 ? void 0 : n.filter((e) => e.status !== "in_progress").length, [n])
|
|
433
458
|
};
|
|
434
459
|
}
|
|
435
|
-
function
|
|
436
|
-
return
|
|
460
|
+
function An(e) {
|
|
461
|
+
return kn(e).nonActiveCount;
|
|
437
462
|
}
|
|
438
|
-
function
|
|
439
|
-
let t =
|
|
463
|
+
function jn(e) {
|
|
464
|
+
let t = A.getAppDb(), n = F(() => e != null && t ? t.select().from(M).where(z(M.id, e)).limit(1) : null, [t, e]), r = K(n), i = r === void 0;
|
|
440
465
|
return {
|
|
441
466
|
record: r && r.length > 0 ? r[0] : null,
|
|
442
467
|
isLoading: i
|
|
@@ -444,45 +469,45 @@ function Nn(e) {
|
|
|
444
469
|
}
|
|
445
470
|
//#endregion
|
|
446
471
|
//#region src/hooks/clearCompletedPublishProcesses.ts
|
|
447
|
-
async function
|
|
448
|
-
let e =
|
|
449
|
-
e && await e.delete(
|
|
472
|
+
async function Mn() {
|
|
473
|
+
let e = A.getAppDb();
|
|
474
|
+
e && await e.delete(M).where(Tt(M.status, ["in_progress"]));
|
|
450
475
|
}
|
|
451
|
-
async function
|
|
452
|
-
let t =
|
|
453
|
-
t && await t.delete(
|
|
476
|
+
async function Nn(e) {
|
|
477
|
+
let t = A.getAppDb();
|
|
478
|
+
t && await t.delete(M).where(Ct(z(M.seedLocalId, e), Tt(M.status, ["in_progress"])));
|
|
454
479
|
}
|
|
455
|
-
async function
|
|
456
|
-
let e =
|
|
457
|
-
e && await e.delete(
|
|
480
|
+
async function Pn() {
|
|
481
|
+
let e = A.getAppDb();
|
|
482
|
+
e && await e.delete(M);
|
|
458
483
|
}
|
|
459
|
-
async function
|
|
460
|
-
let e =
|
|
461
|
-
e && await e.delete(
|
|
484
|
+
async function Fn() {
|
|
485
|
+
let e = A.getAppDb();
|
|
486
|
+
e && await e.delete(ht);
|
|
462
487
|
}
|
|
463
|
-
async function
|
|
464
|
-
let t =
|
|
465
|
-
t && await t.delete(
|
|
488
|
+
async function In(e) {
|
|
489
|
+
let t = A.getAppDb();
|
|
490
|
+
t && await t.delete(M).where(z(M.seedLocalId, e));
|
|
466
491
|
}
|
|
467
|
-
async function
|
|
468
|
-
let t =
|
|
469
|
-
t && await t.delete(
|
|
492
|
+
async function Ln(e) {
|
|
493
|
+
let t = A.getAppDb();
|
|
494
|
+
t && await t.delete(M).where(z(M.id, e));
|
|
470
495
|
}
|
|
471
|
-
async function
|
|
496
|
+
async function Rn(e) {
|
|
472
497
|
if (e.length === 0) return;
|
|
473
|
-
let t =
|
|
474
|
-
t && await t.delete(
|
|
498
|
+
let t = A.getAppDb();
|
|
499
|
+
t && await t.delete(M).where(wt(M.id, e));
|
|
475
500
|
}
|
|
476
501
|
//#endregion
|
|
477
502
|
//#region src/hooks/publishProcessHelpers.ts
|
|
478
|
-
function
|
|
503
|
+
function zn(e) {
|
|
479
504
|
try {
|
|
480
505
|
return (JSON.parse(e.persistedSnapshot).context?.arweaveTransactions ?? []).map((e) => e.transaction?.id).filter((e) => typeof e == "string");
|
|
481
506
|
} catch {
|
|
482
507
|
return [];
|
|
483
508
|
}
|
|
484
509
|
}
|
|
485
|
-
function
|
|
510
|
+
function Bn(e) {
|
|
486
511
|
try {
|
|
487
512
|
return JSON.parse(e.persistedSnapshot).context?.easPayload ?? void 0;
|
|
488
513
|
} catch {
|
|
@@ -491,47 +516,54 @@ function Hn(e) {
|
|
|
491
516
|
}
|
|
492
517
|
//#endregion
|
|
493
518
|
//#region src/hooks/usePublishCostEstimate.ts
|
|
494
|
-
function
|
|
495
|
-
let [n, r] =
|
|
496
|
-
return
|
|
519
|
+
function Vn(e, t) {
|
|
520
|
+
let [n, r] = L(null), [i, a] = L(!1), [o, s] = L(!1), [c, l] = L(null), u = I(() => {}), d = I(null), f = t?.publishMode, p = t?.priceRefreshMs, m = t?.itemIdleMs;
|
|
521
|
+
return P(() => {
|
|
497
522
|
if (!e) {
|
|
498
|
-
r(null), a(!1), s(!1), l(null), u.current = () => {};
|
|
523
|
+
r(null), a(!1), s(!1), l(null), u.current = () => {}, d.current = null;
|
|
499
524
|
return;
|
|
500
525
|
}
|
|
501
|
-
let n =
|
|
502
|
-
|
|
503
|
-
|
|
526
|
+
let n = e.seedLocalId, i = d.current, o = i && i.seedLocalId === n && i.publishMode === f ? i.estimate : null, c = mn(e, (e) => {
|
|
527
|
+
d.current = {
|
|
528
|
+
seedLocalId: n,
|
|
529
|
+
publishMode: f,
|
|
530
|
+
estimate: e.estimate
|
|
531
|
+
}, r(e.estimate), a(e.isEstimating), s(e.isStale), l(e.error), u.current = e.refresh;
|
|
532
|
+
}, {
|
|
533
|
+
...t,
|
|
534
|
+
previousEstimate: o
|
|
535
|
+
});
|
|
504
536
|
return () => {
|
|
505
|
-
|
|
537
|
+
c.dispose();
|
|
506
538
|
};
|
|
507
539
|
}, [
|
|
508
540
|
e,
|
|
509
541
|
e?.seedLocalId,
|
|
510
|
-
d,
|
|
511
542
|
f,
|
|
512
|
-
p
|
|
543
|
+
p,
|
|
544
|
+
m
|
|
513
545
|
]), {
|
|
514
546
|
estimate: n,
|
|
515
547
|
isEstimating: i,
|
|
516
548
|
isStale: o,
|
|
517
549
|
error: c,
|
|
518
|
-
refresh:
|
|
550
|
+
refresh: St(() => {
|
|
519
551
|
u.current();
|
|
520
552
|
}, [])
|
|
521
553
|
};
|
|
522
554
|
}
|
|
523
555
|
//#endregion
|
|
524
556
|
//#region src/services/domainOwnership/registry.ts
|
|
525
|
-
function
|
|
526
|
-
let t =
|
|
557
|
+
function Y(e) {
|
|
558
|
+
let t = tn(e);
|
|
527
559
|
if (!t) throw Error(`@seedprotocol/publish: unable to resolve registrable domain for "${e}"`);
|
|
528
560
|
return t.toLowerCase();
|
|
529
561
|
}
|
|
530
|
-
function
|
|
562
|
+
function Hn(e) {
|
|
531
563
|
return e.trim().toLowerCase().replace(/\.$/, "");
|
|
532
564
|
}
|
|
533
|
-
async function
|
|
534
|
-
let t =
|
|
565
|
+
async function Un(e) {
|
|
566
|
+
let t = Y(e), n = await en(t);
|
|
535
567
|
if (!n.ok || !n.record) return null;
|
|
536
568
|
let r = n.record;
|
|
537
569
|
return {
|
|
@@ -545,8 +577,8 @@ async function K(e) {
|
|
|
545
577
|
isRegistered: r.isRegistered
|
|
546
578
|
};
|
|
547
579
|
}
|
|
548
|
-
function
|
|
549
|
-
return
|
|
580
|
+
function Wn(e) {
|
|
581
|
+
return Gt({
|
|
550
582
|
domain: e.domain,
|
|
551
583
|
creationDate: e.creationDate ?? "",
|
|
552
584
|
registrarIanaId: e.registrarIanaId ?? ""
|
|
@@ -554,38 +586,38 @@ function Gn(e) {
|
|
|
554
586
|
}
|
|
555
587
|
//#endregion
|
|
556
588
|
//#region src/services/domainOwnership/challenge.ts
|
|
557
|
-
function
|
|
589
|
+
function Gn(e) {
|
|
558
590
|
let t = new Uint8Array(e);
|
|
559
591
|
return crypto.getRandomValues(t), t;
|
|
560
592
|
}
|
|
561
|
-
function
|
|
593
|
+
function Kn(e) {
|
|
562
594
|
let t = "";
|
|
563
595
|
for (let n of e) t += String.fromCharCode(n);
|
|
564
596
|
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
565
597
|
}
|
|
566
|
-
function
|
|
567
|
-
let t = e.normalizeRegistrable === !1, n = t ?
|
|
598
|
+
function qn(e) {
|
|
599
|
+
let t = e.normalizeRegistrable === !1, n = t ? Hn(e.domain) : Y(e.domain);
|
|
568
600
|
if (!n || n.includes(" ")) throw Error("@seedprotocol/publish: createDomainOwnershipChallenge requires a valid domain");
|
|
569
601
|
let r = e.claimer.trim();
|
|
570
602
|
if (!/^0x[0-9a-fA-F]{40}$/.test(r)) throw Error("@seedprotocol/publish: createDomainOwnershipChallenge requires a 20-byte hex claimer address");
|
|
571
|
-
let i = e.scope ?? (t ?
|
|
572
|
-
if (i ===
|
|
573
|
-
let a = e.ttlMs ??
|
|
603
|
+
let i = e.scope ?? (t ? Nt : V);
|
|
604
|
+
if (i === V && n !== Y(n)) throw Error(`@seedprotocol/publish: createDomainOwnershipChallenge cannot use scope "registrable" for "${n}", which is not a registrable domain. Use the hostname scope or challenge ${Y(n)}.`);
|
|
605
|
+
let a = e.ttlMs ?? Et, o = e.now ?? Date.now(), s = new Date(o + a).toISOString(), c = Kn(Gn(32)), l = Wt({
|
|
574
606
|
domain: n,
|
|
575
607
|
claimer: r,
|
|
576
608
|
token: c,
|
|
577
609
|
scope: i
|
|
578
|
-
}), u =
|
|
610
|
+
}), u = Vt(n), d = zt({
|
|
579
611
|
token: c,
|
|
580
612
|
claimer: r,
|
|
581
613
|
expiry: s
|
|
582
614
|
});
|
|
583
615
|
return {
|
|
584
|
-
challengeId:
|
|
616
|
+
challengeId: Kn(Gn(16)),
|
|
585
617
|
domain: n,
|
|
586
618
|
claimer: r,
|
|
587
619
|
scope: i,
|
|
588
|
-
method:
|
|
620
|
+
method: kt,
|
|
589
621
|
token: c,
|
|
590
622
|
txtName: u,
|
|
591
623
|
txtValue: d,
|
|
@@ -596,14 +628,14 @@ function Jn(e) {
|
|
|
596
628
|
}
|
|
597
629
|
//#endregion
|
|
598
630
|
//#region src/services/domainOwnership/dnsVerify.ts
|
|
599
|
-
async function
|
|
631
|
+
async function Jn(e) {
|
|
600
632
|
let { promises: t } = await import("node:dns");
|
|
601
633
|
return {
|
|
602
634
|
source: "node:dns",
|
|
603
635
|
values: (await t.resolveTxt(e)).map((e) => e.join(""))
|
|
604
636
|
};
|
|
605
637
|
}
|
|
606
|
-
async function
|
|
638
|
+
async function Yn(e, t, n) {
|
|
607
639
|
let r = `${n}?name=${encodeURIComponent(e)}&type=TXT`, i = await fetch(r, { headers: { accept: "application/dns-json" } });
|
|
608
640
|
if (!i.ok) throw Error(`DoH ${t} HTTP ${i.status}`);
|
|
609
641
|
let a = await i.json();
|
|
@@ -613,20 +645,20 @@ async function Xn(e, t, n) {
|
|
|
613
645
|
dnssecAuthenticated: !!a.AD
|
|
614
646
|
};
|
|
615
647
|
}
|
|
616
|
-
function
|
|
617
|
-
let e = [(e) =>
|
|
618
|
-
return typeof document > "u" && e.unshift((e) =>
|
|
648
|
+
function Xn() {
|
|
649
|
+
let e = [(e) => Yn(e, "cloudflare-doh", "https://cloudflare-dns.com/dns-query"), (e) => Yn(e, "google-doh", "https://dns.google/resolve")];
|
|
650
|
+
return typeof document > "u" && e.unshift((e) => Jn(e)), e;
|
|
619
651
|
}
|
|
620
|
-
function
|
|
621
|
-
let n =
|
|
652
|
+
function Zn(e, t) {
|
|
653
|
+
let n = Jt(t);
|
|
622
654
|
for (let r of e) {
|
|
623
655
|
if (r === t || r.replace(/^"|"$/g, "") === t) return !0;
|
|
624
|
-
let e =
|
|
656
|
+
let e = Jt(r);
|
|
625
657
|
if (n && e && e.token === n.token && e.claimer === n.claimer) return !0;
|
|
626
658
|
}
|
|
627
659
|
return !1;
|
|
628
660
|
}
|
|
629
|
-
async function
|
|
661
|
+
async function Qn(e, t) {
|
|
630
662
|
let n = t?.now ?? Date.now();
|
|
631
663
|
if (Date.parse(e.expiresAt) <= n) return {
|
|
632
664
|
ok: !1,
|
|
@@ -634,7 +666,7 @@ async function $n(e, t) {
|
|
|
634
666
|
lookups: [],
|
|
635
667
|
error: "Challenge expired"
|
|
636
668
|
};
|
|
637
|
-
let r =
|
|
669
|
+
let r = zt({
|
|
638
670
|
token: e.token,
|
|
639
671
|
claimer: e.claimer,
|
|
640
672
|
expiry: e.expiresAt
|
|
@@ -645,11 +677,11 @@ async function $n(e, t) {
|
|
|
645
677
|
lookups: [],
|
|
646
678
|
error: "Challenge txtValue does not match token/claimer/expiry"
|
|
647
679
|
};
|
|
648
|
-
let i = t?.lookups ??
|
|
680
|
+
let i = t?.lookups ?? Xn(), a = t?.quorum ?? 2, o = [], s = [], c = !1;
|
|
649
681
|
await Promise.all(i.map(async (t) => {
|
|
650
682
|
try {
|
|
651
683
|
let n = await t(e.txtName);
|
|
652
|
-
o.push(n),
|
|
684
|
+
o.push(n), Zn(n.values, r) && (s.push(n.source), n.dnssecAuthenticated && (c = !0));
|
|
653
685
|
} catch {
|
|
654
686
|
o.push({
|
|
655
687
|
source: "error",
|
|
@@ -667,32 +699,32 @@ async function $n(e, t) {
|
|
|
667
699
|
}
|
|
668
700
|
//#endregion
|
|
669
701
|
//#region src/services/domainOwnership/index.ts
|
|
670
|
-
var
|
|
671
|
-
function
|
|
672
|
-
if (
|
|
702
|
+
var $n = "0x0000000000000000000000000000000000000000", er = !0;
|
|
703
|
+
function tr(e) {
|
|
704
|
+
if (O(e)) return e.txSender;
|
|
673
705
|
if (l(e)) return e;
|
|
674
706
|
throw Error("@seedprotocol/publish: domain ownership write APIs require a PublishWallet or SeedTxSender");
|
|
675
707
|
}
|
|
676
|
-
async function
|
|
708
|
+
async function X(e, t) {
|
|
677
709
|
let n = await e.sendTransaction(t);
|
|
678
|
-
return
|
|
710
|
+
return T(n.transactionHash);
|
|
679
711
|
}
|
|
680
|
-
function
|
|
681
|
-
return
|
|
712
|
+
function Z() {
|
|
713
|
+
return xt.getSchemaUID(B, $n, er);
|
|
682
714
|
}
|
|
683
|
-
async function
|
|
684
|
-
let n =
|
|
685
|
-
return await
|
|
686
|
-
schema:
|
|
687
|
-
resolverAddress:
|
|
715
|
+
async function nr(e) {
|
|
716
|
+
let n = tr(e), r = Z();
|
|
717
|
+
return await Te(r) || (await X(n, t({
|
|
718
|
+
schema: B,
|
|
719
|
+
resolverAddress: $n,
|
|
688
720
|
revocable: er
|
|
689
|
-
})), await
|
|
721
|
+
})), await X(n, b({
|
|
690
722
|
schemaUid: r,
|
|
691
|
-
schemaName:
|
|
723
|
+
schemaName: Mt
|
|
692
724
|
}))), r;
|
|
693
725
|
}
|
|
694
|
-
function
|
|
695
|
-
return new
|
|
726
|
+
function rr(e) {
|
|
727
|
+
return new bt(B).encodeData([
|
|
696
728
|
{
|
|
697
729
|
name: "domain",
|
|
698
730
|
value: e.domain,
|
|
@@ -710,7 +742,7 @@ function nr(e) {
|
|
|
710
742
|
},
|
|
711
743
|
{
|
|
712
744
|
name: "challengeHash",
|
|
713
|
-
value:
|
|
745
|
+
value: W(e.challengeHash),
|
|
714
746
|
type: "bytes32"
|
|
715
747
|
},
|
|
716
748
|
{
|
|
@@ -730,7 +762,7 @@ function nr(e) {
|
|
|
730
762
|
},
|
|
731
763
|
{
|
|
732
764
|
name: "registryFingerprint",
|
|
733
|
-
value:
|
|
765
|
+
value: W(e.registryFingerprint),
|
|
734
766
|
type: "bytes32"
|
|
735
767
|
},
|
|
736
768
|
{
|
|
@@ -740,28 +772,28 @@ function nr(e) {
|
|
|
740
772
|
}
|
|
741
773
|
]);
|
|
742
774
|
}
|
|
743
|
-
function
|
|
775
|
+
function ir(e) {
|
|
744
776
|
if (typeof e.override == "number" && e.override > 0) return e.override;
|
|
745
777
|
if (e.registryExpirationDate) {
|
|
746
778
|
let t = Date.parse(e.registryExpirationDate);
|
|
747
779
|
if (Number.isFinite(t) && t > 0) return Math.floor(t / 1e3);
|
|
748
780
|
}
|
|
749
|
-
return e.verifiedAt +
|
|
781
|
+
return e.verifiedAt + Dt;
|
|
750
782
|
}
|
|
751
|
-
async function
|
|
752
|
-
let t =
|
|
783
|
+
async function ar(e) {
|
|
784
|
+
let t = tr(e.wallet), n = e.ensureSchema === !1 ? Z() : await nr(e.wallet), r = e.scope ?? V, i = r === V ? Y(e.domain) : Hn(e.domain), a = e.claimer.trim();
|
|
753
785
|
if (!/^0x[0-9a-fA-F]{40}$/.test(a)) throw Error("@seedprotocol/publish: attestDomainOwnership requires a valid claimer address");
|
|
754
|
-
let o =
|
|
755
|
-
if (o ===
|
|
756
|
-
let s = e.verifiedAt ?? Math.floor(Date.now() / 1e3), c =
|
|
786
|
+
let o = W(e.challengeHash);
|
|
787
|
+
if (o === N) throw Error("@seedprotocol/publish: attestDomainOwnership requires a non-zero challengeHash");
|
|
788
|
+
let s = e.verifiedAt ?? Math.floor(Date.now() / 1e3), c = Wn({
|
|
757
789
|
domain: i,
|
|
758
790
|
creationDate: e.registrySnapshot.creationDate ?? "",
|
|
759
791
|
registrarIanaId: e.registrySnapshot.registrarIanaId ?? ""
|
|
760
|
-
}), l = e.registrySnapshot.creationDate ?? "", u = e.registrySnapshot.expirationDate ?? "", d = e.method ??
|
|
792
|
+
}), l = e.registrySnapshot.creationDate ?? "", u = e.registrySnapshot.expirationDate ?? "", d = e.method ?? kt, f = ir({
|
|
761
793
|
verifiedAt: s,
|
|
762
794
|
registryExpirationDate: u,
|
|
763
795
|
override: e.expirationTime
|
|
764
|
-
}), p =
|
|
796
|
+
}), p = rr({
|
|
765
797
|
domain: i,
|
|
766
798
|
claimer: a,
|
|
767
799
|
method: d,
|
|
@@ -771,20 +803,20 @@ async function ir(e) {
|
|
|
771
803
|
registryExpirationDate: u,
|
|
772
804
|
registryFingerprint: c,
|
|
773
805
|
scope: r
|
|
774
|
-
}), m = await
|
|
806
|
+
}), m = await X(t, Ee({
|
|
775
807
|
schema: n,
|
|
776
808
|
data: {
|
|
777
809
|
recipient: a,
|
|
778
810
|
expirationTime: BigInt(f),
|
|
779
811
|
revocable: !0,
|
|
780
|
-
refUID:
|
|
812
|
+
refUID: N,
|
|
781
813
|
data: p,
|
|
782
814
|
value: 0n
|
|
783
815
|
}
|
|
784
816
|
}));
|
|
785
817
|
if (!m) throw Error("@seedprotocol/publish: attestDomainOwnership failed — no receipt");
|
|
786
|
-
let { easContractAddress: h } =
|
|
787
|
-
if (!g || !
|
|
818
|
+
let { easContractAddress: h } = E(), g = x(m, h);
|
|
819
|
+
if (!g || !U(g)) throw Error("@seedprotocol/publish: attestDomainOwnership failed — could not parse attestation UID");
|
|
788
820
|
return {
|
|
789
821
|
uid: g,
|
|
790
822
|
schemaUid: n,
|
|
@@ -794,22 +826,22 @@ async function ir(e) {
|
|
|
794
826
|
expirationTime: f
|
|
795
827
|
};
|
|
796
828
|
}
|
|
797
|
-
async function
|
|
798
|
-
let t =
|
|
799
|
-
if (!
|
|
800
|
-
if (!await
|
|
829
|
+
async function or(e) {
|
|
830
|
+
let t = tr(e.wallet), r = e.schemaUid ?? Z(), i = W(e.uid);
|
|
831
|
+
if (!U(i)) throw Error("@seedprotocol/publish: revokeDomainOwnership requires a valid attestation uid");
|
|
832
|
+
if (!await X(t, n([{
|
|
801
833
|
schema: r,
|
|
802
834
|
data: [{ uid: i }]
|
|
803
835
|
}]))) throw Error("@seedprotocol/publish: revokeDomainOwnership failed — no receipt");
|
|
804
836
|
}
|
|
805
|
-
async function
|
|
806
|
-
let { challenge: t } = e, n =
|
|
837
|
+
async function sr(e) {
|
|
838
|
+
let { challenge: t } = e, n = Wt({
|
|
807
839
|
domain: t.domain,
|
|
808
840
|
claimer: t.claimer,
|
|
809
841
|
token: t.token,
|
|
810
842
|
scope: t.scope
|
|
811
843
|
});
|
|
812
|
-
if (
|
|
844
|
+
if (W(n) !== W(t.challengeHash)) return {
|
|
813
845
|
ok: !1,
|
|
814
846
|
dns: {
|
|
815
847
|
ok: !1,
|
|
@@ -821,7 +853,7 @@ async function or(e) {
|
|
|
821
853
|
challengeHash: n,
|
|
822
854
|
error: "Challenge hash does not match domain/claimer/token/scope"
|
|
823
855
|
};
|
|
824
|
-
let r = await
|
|
856
|
+
let r = await Qn(t, {
|
|
825
857
|
lookups: e.dnsLookups,
|
|
826
858
|
now: e.now
|
|
827
859
|
});
|
|
@@ -832,7 +864,7 @@ async function or(e) {
|
|
|
832
864
|
challengeHash: n,
|
|
833
865
|
error: r.error ?? "DNS verification failed"
|
|
834
866
|
};
|
|
835
|
-
let i = e.registryLookup ??
|
|
867
|
+
let i = e.registryLookup ?? Un, a;
|
|
836
868
|
try {
|
|
837
869
|
a = await i(t.domain);
|
|
838
870
|
} catch {
|
|
@@ -851,8 +883,8 @@ async function or(e) {
|
|
|
851
883
|
error: "Registry lookup failed"
|
|
852
884
|
};
|
|
853
885
|
}
|
|
854
|
-
async function
|
|
855
|
-
let t = await
|
|
886
|
+
async function cr(e) {
|
|
887
|
+
let t = await sr({
|
|
856
888
|
challenge: e.challenge,
|
|
857
889
|
dnsLookups: e.dnsLookups,
|
|
858
890
|
registryLookup: e.registryLookup,
|
|
@@ -860,7 +892,7 @@ async function sr(e) {
|
|
|
860
892
|
});
|
|
861
893
|
if (!t.ok || !t.registrySnapshot) throw Error(`@seedprotocol/publish: verifyAndAttestDomainOwnership failed — ${t.error ?? "verification failed"}`);
|
|
862
894
|
return {
|
|
863
|
-
...await
|
|
895
|
+
...await ar({
|
|
864
896
|
wallet: e.wallet,
|
|
865
897
|
domain: e.challenge.domain,
|
|
866
898
|
claimer: e.challenge.claimer,
|
|
@@ -874,21 +906,21 @@ async function sr(e) {
|
|
|
874
906
|
dns: t.dns
|
|
875
907
|
};
|
|
876
908
|
}
|
|
877
|
-
async function
|
|
878
|
-
let t = (await
|
|
909
|
+
async function lr(e) {
|
|
910
|
+
let t = (await Ht({
|
|
879
911
|
toolAddresses: e.toolAddresses,
|
|
880
912
|
schemaUid: e.schemaUid,
|
|
881
913
|
excludeRevoked: !0
|
|
882
|
-
})).find((t) =>
|
|
914
|
+
})).find((t) => W(t.id) === W(e.uid));
|
|
883
915
|
if (!t) throw Error("@seedprotocol/publish: assessDomainOwnershipLive could not find attestation for uid/toolAddresses");
|
|
884
|
-
let n =
|
|
916
|
+
let n = Bt(t.decodedDataJson ?? "[]"), r = e.registryLookup ?? Un, i;
|
|
885
917
|
try {
|
|
886
918
|
i = await r(n.domain);
|
|
887
919
|
} catch {
|
|
888
920
|
i = null;
|
|
889
921
|
}
|
|
890
922
|
return {
|
|
891
|
-
...
|
|
923
|
+
...Rt({
|
|
892
924
|
decoded: n,
|
|
893
925
|
expirationTime: t.expirationTime,
|
|
894
926
|
registrySnapshot: i,
|
|
@@ -901,50 +933,50 @@ async function cr(e) {
|
|
|
901
933
|
}
|
|
902
934
|
//#endregion
|
|
903
935
|
//#region src/services/publishedBy/index.ts
|
|
904
|
-
var
|
|
905
|
-
function
|
|
906
|
-
if (
|
|
936
|
+
var ur = "0x0000000000000000000000000000000000000000", dr = !0;
|
|
937
|
+
function fr(e) {
|
|
938
|
+
if (O(e)) return e.txSender;
|
|
907
939
|
if (l(e)) return e;
|
|
908
940
|
throw Error("@seedprotocol/publish: attestPublishedBy / revokePublishedBy require a PublishWallet or SeedTxSender");
|
|
909
941
|
}
|
|
910
942
|
async function Q(e, t) {
|
|
911
943
|
let n = await e.sendTransaction(t);
|
|
912
|
-
return
|
|
944
|
+
return T(n.transactionHash);
|
|
913
945
|
}
|
|
914
946
|
function $() {
|
|
915
|
-
return
|
|
916
|
-
}
|
|
917
|
-
async function
|
|
918
|
-
let n =
|
|
919
|
-
return await
|
|
920
|
-
schema:
|
|
921
|
-
resolverAddress:
|
|
922
|
-
revocable:
|
|
923
|
-
})), await Q(n,
|
|
947
|
+
return xt.getSchemaUID(H, ur, dr);
|
|
948
|
+
}
|
|
949
|
+
async function pr(e) {
|
|
950
|
+
let n = fr(e), r = $();
|
|
951
|
+
return await Te(r) || (await Q(n, t({
|
|
952
|
+
schema: H,
|
|
953
|
+
resolverAddress: ur,
|
|
954
|
+
revocable: dr
|
|
955
|
+
})), await Q(n, b({
|
|
924
956
|
schemaUid: r,
|
|
925
|
-
schemaName:
|
|
957
|
+
schemaName: Lt
|
|
926
958
|
}))), r;
|
|
927
959
|
}
|
|
928
|
-
function
|
|
929
|
-
return new
|
|
960
|
+
function mr(e) {
|
|
961
|
+
return new bt(H).encodeData([
|
|
930
962
|
{
|
|
931
963
|
name: "seedUid",
|
|
932
|
-
value:
|
|
964
|
+
value: W(e.seedUid),
|
|
933
965
|
type: "bytes32"
|
|
934
966
|
},
|
|
935
967
|
{
|
|
936
968
|
name: "versionUid",
|
|
937
|
-
value:
|
|
969
|
+
value: W(e.versionUid || N),
|
|
938
970
|
type: "bytes32"
|
|
939
971
|
},
|
|
940
972
|
{
|
|
941
973
|
name: "attestationUids",
|
|
942
|
-
value: e.attestationUids.map((e) =>
|
|
974
|
+
value: e.attestationUids.map((e) => W(e)),
|
|
943
975
|
type: "bytes32[]"
|
|
944
976
|
},
|
|
945
977
|
{
|
|
946
978
|
name: "batchHash",
|
|
947
|
-
value:
|
|
979
|
+
value: W(e.batchHash),
|
|
948
980
|
type: "bytes32"
|
|
949
981
|
},
|
|
950
982
|
{
|
|
@@ -959,27 +991,27 @@ function fr(e) {
|
|
|
959
991
|
}
|
|
960
992
|
]);
|
|
961
993
|
}
|
|
962
|
-
async function
|
|
963
|
-
let t =
|
|
964
|
-
if (e.mode === "uids") r = e.attestationUids.map((e) =>
|
|
994
|
+
async function hr(e) {
|
|
995
|
+
let t = fr(e.wallet), n = e.ensureSchema === !1 ? $() : await pr(e.wallet), r = [], i;
|
|
996
|
+
if (e.mode === "uids") r = e.attestationUids.map((e) => W(e)).filter((e) => U(e)), i = e.batchHash ? W(e.batchHash) : qt(r);
|
|
965
997
|
else {
|
|
966
998
|
if (!e.batchHash) throw Error("@seedprotocol/publish: attestPublishedBy hash mode requires batchHash");
|
|
967
|
-
if (i =
|
|
999
|
+
if (i = W(e.batchHash), i === N) throw Error("@seedprotocol/publish: attestPublishedBy hash mode requires a non-zero batchHash");
|
|
968
1000
|
}
|
|
969
|
-
let a =
|
|
970
|
-
if (!
|
|
971
|
-
let o =
|
|
1001
|
+
let a = W(e.seedUid);
|
|
1002
|
+
if (!U(a)) throw Error("@seedprotocol/publish: attestPublishedBy requires a valid seedUid");
|
|
1003
|
+
let o = mr({
|
|
972
1004
|
seedUid: a,
|
|
973
|
-
versionUid:
|
|
1005
|
+
versionUid: W(e.versionUid ?? N),
|
|
974
1006
|
attestationUids: r,
|
|
975
1007
|
batchHash: i,
|
|
976
1008
|
toolName: e.toolName,
|
|
977
1009
|
toolVersion: e.toolVersion
|
|
978
|
-
}), c = await Q(t,
|
|
1010
|
+
}), c = await Q(t, Ee({
|
|
979
1011
|
schema: n,
|
|
980
1012
|
data: {
|
|
981
1013
|
recipient: s,
|
|
982
|
-
expirationTime: BigInt(
|
|
1014
|
+
expirationTime: BigInt(yt),
|
|
983
1015
|
revocable: !0,
|
|
984
1016
|
refUID: a,
|
|
985
1017
|
data: o,
|
|
@@ -987,8 +1019,8 @@ async function pr(e) {
|
|
|
987
1019
|
}
|
|
988
1020
|
}));
|
|
989
1021
|
if (!c) throw Error("@seedprotocol/publish: attestPublishedBy failed — no receipt");
|
|
990
|
-
let { easContractAddress: l } =
|
|
991
|
-
if (!u || !
|
|
1022
|
+
let { easContractAddress: l } = E(), u = x(c, l);
|
|
1023
|
+
if (!u || !U(u)) throw Error("@seedprotocol/publish: attestPublishedBy failed — could not parse attestation UID");
|
|
992
1024
|
return {
|
|
993
1025
|
uid: u,
|
|
994
1026
|
schemaUid: n,
|
|
@@ -996,15 +1028,15 @@ async function pr(e) {
|
|
|
996
1028
|
attestationUids: r
|
|
997
1029
|
};
|
|
998
1030
|
}
|
|
999
|
-
async function
|
|
1000
|
-
let t =
|
|
1001
|
-
if (!
|
|
1031
|
+
async function gr(e) {
|
|
1032
|
+
let t = fr(e.wallet), r = e.schemaUid ?? $(), i = W(e.uid);
|
|
1033
|
+
if (!U(i)) throw Error("@seedprotocol/publish: revokePublishedBy requires a valid attestation uid");
|
|
1002
1034
|
if (!await Q(t, n([{
|
|
1003
1035
|
schema: r,
|
|
1004
1036
|
data: [{ uid: i }]
|
|
1005
1037
|
}]))) throw Error("@seedprotocol/publish: revokePublishedBy failed — no receipt");
|
|
1006
1038
|
}
|
|
1007
1039
|
//#endregion
|
|
1008
|
-
export { f as AttestationVerificationError,
|
|
1040
|
+
export { f as AttestationVerificationError, Ce as DEFAULT_PUBLISH_CHAIN, e as DEFAULT_TURBO_PAYMENT_URL, ve as DEFAULT_TURBO_UPLOAD_URL, Ot as DOMAIN_OWNERSHIP_METHOD, At as DOMAIN_OWNERSHIP_SCHEMA_DEF, jt as DOMAIN_OWNERSHIP_SCHEMA_NAME, Pt as EAS_CHAIN_DEPLOYMENTS, g as Eip7702ModularAccountPublishError, Ve as InsufficientStorageCreditsError, le as MANAGED_ACCOUNT_FACTORY_ADDRESSES, Ne as MULTI_PUBLISH_ABI_REFERENCE_ADDRESS_OP_SEPOLIA, Le as ManagedAccountPublishError, Ft as PUBLISHED_BY_SCHEMA_DEF, It as PUBLISHED_BY_SCHEMA_NAME, ue as PUBLISH_AUTHORIZATION_HEADER, dt as PUBLISH_AUTHORIZATION_SCHEMA_DEF, st as PUBLISH_AUTHORIZATION_SCHEMA_NAME, lt as PUBLISH_AUTHORIZATION_SCOPES, i as PUBLISH_GAS_HEURISTICS, ye as PublishChainConfigError, ke as PublishManager, rn as PublishModeButtons, Pe as PublishNotAuthorizedError, Ue as PublishPaymentConfigError, an as PublishProvider, h as PublishTransactionRevertedError, me as SEED_PROTOCOL_CONTRACT_ADDRESS_OP_SEPOLIA, Xt as SeedProvider, qe as asPublishWallet, Qe as asSeedSigner, fe as asSeedTxSender, u as assertExecutorModuleReadyForAccount, ne as assertManagedAccountEasMatchesConfig, lr as assessDomainOwnershipLive, at as assessPublishAuthorizationLive, ar as attestDomainOwnership, tt as attestPublishAuthorization, hr as attestPublishedBy, Ge as buildPublishAnchorBytes, Pn as clearAllPublishProcesses, Fn as clearAllUploadProcesses, Mn as clearCompletedPublishProcesses, Nn as clearCompletedPublishProcessesForSeed, et as clearPublishWallet, ft as collectPublishedBatch, be as combinePublishCostEstimate, Re as configurePublish, qn as createDomainOwnershipChallenge, Fe as createPermissionlessTxSender, Ln as deletePublishProcessById, Rn as deletePublishProcessesByIds, In as deletePublishProcessesForSeed, rr as encodeDomainOwnershipAttestationData, we as encodeEasAttest, v as encodeEasMultiAttest, y as encodeEasMultiRevoke, S as encodeMultiPublish, ct as encodePublishAuthorizationAttestationData, mr as encodePublishedByAttestationData, d as encodeSetEas, nr as ensureDomainOwnershipSchema, o as ensureEasSchemasForItem, c as ensureManagedAccountEasConfigured, ut as ensurePublishAuthorizationSchema, pr as ensurePublishedBySchema, ge as ensureWalletThenPublish, ce as estimatePublishCost, Wn as fingerprintFromRegistrySnapshot, q as fromEip1193Provider, a as fromEthersWallet, on as fromWindowEthereum, ee as getArweave, zn as getArweaveTransactionIds, Ke as getCachedMarketRates, de as getCachedTokenPrices, hn as getDisplayStepId, Z as getDomainOwnershipSchemaUid, Ut as getEasChainDeployment, Bn as getEasPayload, nt as getPublishAuthorizationSchemaUid, He as getPublishChainName, E as getPublishConfig, _n as getPublishMachineValueForUi, r as getPublishPublicClient, k as getPublishWallet, $ as getPublishedBySchemaUid, he as getTurboBalanceWinc, Oe as getTurboPriceWinc, Kt as hashPublishedByBatch, Je as heuristicPublishGas, Me as initPublish, ie as isContractDeployed, oe as isEip7702ModularAccountPublishError, ae as isManagedAccountPublishError, O as isPublishWallet, se as isRouterNonModularCoreAccountError, re as isSeedSigner, l as isSeedTxSender, Un as lookupDomainRegistry, Y as normalizeRegistrableDomain, De as publishItem, xe as publishMachine, m as readFactorySeedExecutor, _ as readGetEas, w as readIsActiveSigner, Be as requireManagedAccountFactoryAddress, Ze as resetMarketRateCache, Ye as resetTokenPriceCache, gn as resolvePublishDisplayValue, pe as resolvePublishEasChain, je as resolvePublishPayment, ze as resolvePublishSender, or as revokeDomainOwnership, ot as revokePublishAuthorization, gr as revokePublishedBy, nn as seedTwinConfig, $e as setPublishWallet, p as simulateCallFromAccount, C as stringifyUnderlyingCause, pt as uidsFromAttestationPairs, xn as useArweaveL1Finalize, bn as useCanPublishItem, Sn as useItemPublishStatus, rt as usePublishConfig, Vn as usePublishCostEstimate, yn as usePublishProcess, jn as usePublishProcessById, En as usePublishProcesses, On as usePublishProcessesForSeed, Dn as usePublishProcessesNonActiveCount, An as usePublishProcessesNonActiveCountForSeed, Tn as usePublishProcessesState, kn as usePublishProcessesStateForSeed, sn as useSeedWallet, cr as verifyAndAttestDomainOwnership, _e as verifyDataItem, sr as verifyDomainOwnershipChallenge, Qn as verifyDomainOwnershipDns, Ie as verifyPublishChain, We as waitForPublishActor, T as waitForPublishReceipt, mn as watchPublishCost };
|
|
1009
1041
|
|
|
1010
1042
|
//# sourceMappingURL=index.js.map
|