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