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