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