@seedprotocol/publish 0.7.3-next.613.g79a8dfd → 0.7.3-next.654.g52217f6
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/dist/{chainConfig-BDMRU4m8.js → chainConfig-bc_6IgAw.js} +5 -5
- package/dist/{chainConfig-BDMRU4m8.js.map → chainConfig-bc_6IgAw.js.map} +1 -1
- package/dist/{ensureAutomationSessionKey-bw6knEyC.js → ensureAutomationSessionKey-D0bbWT8e.js} +4 -4
- package/dist/{ensureAutomationSessionKey-bw6knEyC.js.map → ensureAutomationSessionKey-D0bbWT8e.js.map} +1 -1
- package/dist/{ensureModularPublishBootstrap-Vc4Jz_B9.js → ensureModularPublishBootstrap-x1bmc__0.js} +5 -5
- package/dist/{ensureModularPublishBootstrap-Vc4Jz_B9.js.map → ensureModularPublishBootstrap-x1bmc__0.js.map} +1 -1
- package/dist/{ensureSmartWalletThenPublish-42iEhiHG.js → ensureSmartWalletThenPublish-DNkeFWvC.js} +3 -3
- package/dist/{ensureSmartWalletThenPublish-42iEhiHG.js.map → ensureSmartWalletThenPublish-DNkeFWvC.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/{managedAccountAdmin-B3DPMmhR.js → managedAccountAdmin-CdS1SCA_.js} +4 -4
- package/dist/{managedAccountAdmin-B3DPMmhR.js.map → managedAccountAdmin-CdS1SCA_.js.map} +1 -1
- package/dist/{publishAuthorization-CAFF5jQ2.js → publishAuthorization-C5kXlbOT.js} +809 -999
- package/dist/publishAuthorization-C5kXlbOT.js.map +1 -0
- package/dist/{publishThirdwebClient-CPzAjnmf.js → publishThirdwebClient-VSG2MC38.js} +2 -2
- package/dist/{publishThirdwebClient-CPzAjnmf.js.map → publishThirdwebClient-VSG2MC38.js.map} +1 -1
- package/dist/{resolveRevokeAccount-CkbTpC27.js → resolveRevokeAccount-D2RP6qcU.js} +4 -4
- package/dist/{resolveRevokeAccount-CkbTpC27.js.map → resolveRevokeAccount-D2RP6qcU.js.map} +1 -1
- package/dist/services/publish/helpers/getPublishUploadData.d.ts +12 -23
- package/dist/services/publish/helpers/getPublishUploadData.d.ts.map +1 -1
- package/dist/thirdweb.js +6 -6
- package/dist/{worker-CCQ7KBMm.js → worker-BIQLQSjk.js} +2 -2
- package/dist/{worker-CCQ7KBMm.js.map → worker-BIQLQSjk.js.map} +1 -1
- package/package.json +5 -5
- package/dist/publishAuthorization-CAFF5jQ2.js.map +0 -1
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import { At as t, B as n, Ct as r, D as i, Dt as a, Et as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, O as m, Ot as h, P as g, Q as _, R as v, St as y, V as b, X as x, Y as S, Z as ee, _ as C, _t as te, a as w, at as ne, b as re, bt as ie, c as ae, ct as oe, dt as T, et as se, f as ce, ft as le, h as ue, ht as de, it as fe, j as pe, jt as me, k as he, lt as ge, mt as E, o as D, ot as _e, q as ve, r as ye, rt as be, st as xe, t as O, u as Se, ut as Ce, v as k, wt as we, xt as Te, y as A, yt as Ee, z as De } from "./chainConfig-
|
|
3
|
-
import { t as j } from "./publishThirdwebClient-
|
|
4
|
-
import { BaseArweaveClient as Oe, BaseDb as ke,
|
|
5
|
-
import { BaseError as
|
|
6
|
-
import { deploySmartAccount as
|
|
7
|
-
import { ethers as
|
|
8
|
-
import { PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS as
|
|
9
|
-
import { createContext as
|
|
10
|
-
import
|
|
11
|
-
import { NO_EXPIRATION as
|
|
12
|
-
import { assign as
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
2
|
+
import { At as t, B as n, Ct as r, D as i, Dt as a, Et as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, O as m, Ot as h, P as g, Q as _, R as v, St as y, V as b, X as x, Y as S, Z as ee, _ as C, _t as te, a as w, at as ne, b as re, bt as ie, c as ae, ct as oe, dt as T, et as se, f as ce, ft as le, h as ue, ht as de, it as fe, j as pe, jt as me, k as he, lt as ge, mt as E, o as D, ot as _e, q as ve, r as ye, rt as be, st as xe, t as O, u as Se, ut as Ce, v as k, wt as we, xt as Te, y as A, yt as Ee, z as De } from "./chainConfig-bc_6IgAw.js";
|
|
3
|
+
import { t as j } from "./publishThirdwebClient-VSG2MC38.js";
|
|
4
|
+
import { BaseArweaveClient as Oe, BaseDb as ke, INTERNAL_DATA_TYPES as Ae, Item as M, ModelPropertyDataTypes as je, RelatedItemUnpublishedError as Me, applyPropertyAttestationUidsFromPublish as Ne, arweaveL1FinalizeJobs as Pe, assertLocalDbChain as Fe, getEasSchemaForItemProperty as Ie, getItemPropertiesFromEas as Le, getPublishUploadData as Re, getRelatedItemsForPublish as ze, getSegmentedItemProperties as Be, getUnpublishedRelatedItems as Ve, getUploadPipelineTransactionStatus as He, isItemOwned as Ue, itemHasPublishUploadCandidates as We, listRelationEasPropertyName as Ge, normalizeDataType as Ke, prepareHtmlEmbeddedImagesForPublish as qe, publishProcesses as N, resolvePublishPayloadValues as Je, rewriteHtmlEmbeddedImagesOnDisk as Ye, setSchemaUidForModel as Xe, setSchemaUidForSchemaDefinition as Ze, updateVersionUid as Qe, validateItemForPublish as $e } from "@seedprotocol/sdk";
|
|
5
|
+
import { BaseError as et, decodeAbiParameters as tt, decodeErrorResult as nt, isAddressEqual as rt, parseEther as it, parseEventLogs as at, toFunctionSelector as ot, zeroAddress as st } from "viem";
|
|
6
|
+
import { deploySmartAccount as ct, getContract as lt } from "thirdweb";
|
|
7
|
+
import { ethers as P, keccak256 as ut, toUtf8Bytes as dt } from "ethers";
|
|
8
|
+
import { PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS as ft, PUBLISH_AUTHORIZATION_SCHEMA_DEF as pt, PUBLISH_AUTHORIZATION_SCHEMA_DEF as mt, PUBLISH_AUTHORIZATION_SCHEMA_NAME as ht, PUBLISH_AUTHORIZATION_SCHEMA_NAME as gt, PUBLISH_AUTHORIZATION_SCOPES as _t, PUBLISH_AUTHORIZATION_SCOPES as vt, assessPublishAuthorization as yt, decodePublishAuthorizationData as bt, getPublishAuthorizationFromEas as xt, isValidEasAttestationUid as St, normalizeBytes32Hex as Ct } from "@seedprotocol/eas";
|
|
9
|
+
import { createContext as wt, useContext as Tt, useEffect as Et, useRef as Dt, useState as Ot } from "react";
|
|
10
|
+
import kt from "arweave";
|
|
11
|
+
import { NO_EXPIRATION as At, SchemaEncoder as jt, SchemaRegistry as Mt, ZERO_ADDRESS as Nt, ZERO_BYTES32 as Pt } from "@ethereum-attestation-service/eas-sdk";
|
|
12
|
+
import { assign as F, createActor as Ft, enqueueActions as It, fromCallback as Lt, fromPromise as I, setup as Rt } from "xstate";
|
|
13
|
+
import L from "debug";
|
|
14
|
+
import { createWallet as zt, inAppWallet as Bt } from "thirdweb/wallets";
|
|
15
|
+
import { useActiveAccount as Vt } from "thirdweb/react";
|
|
16
|
+
import { estimateUserOpGas as Ht, getPaymasterAndData as Ut } from "thirdweb/wallets/smart";
|
|
17
|
+
import { and as Wt, desc as Gt, eq as R } from "drizzle-orm";
|
|
18
18
|
//#region src/react/PublishConfigContext.tsx
|
|
19
|
-
var
|
|
20
|
-
function
|
|
21
|
-
let e =
|
|
19
|
+
var Kt = wt(null);
|
|
20
|
+
function qt() {
|
|
21
|
+
let e = Tt(Kt);
|
|
22
22
|
if (!e) throw Error("usePublishConfig: PublishConfig is missing. Pass config to PublishProvider or call initPublish() before render.");
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region src/helpers/describeRevert.ts
|
|
27
|
-
var
|
|
27
|
+
var Jt = [
|
|
28
28
|
{
|
|
29
29
|
type: "error",
|
|
30
30
|
name: "PublishIndexOutOfBounds",
|
|
@@ -183,23 +183,23 @@ var $t = [
|
|
|
183
183
|
...y,
|
|
184
184
|
...we
|
|
185
185
|
];
|
|
186
|
-
function
|
|
187
|
-
if (e instanceof
|
|
186
|
+
function Yt(e) {
|
|
187
|
+
if (e instanceof et) return e.walk((e) => {
|
|
188
188
|
let t = e.data;
|
|
189
189
|
return typeof t == "string" && t.startsWith("0x") && t.length > 2;
|
|
190
190
|
})?.data;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
if (
|
|
194
|
-
let t = e instanceof
|
|
192
|
+
function Xt(e) {
|
|
193
|
+
if (Yt(e)) return !0;
|
|
194
|
+
let t = e instanceof et ? `${e.shortMessage} ${e.details}` : String(e);
|
|
195
195
|
return /revert/i.test(t);
|
|
196
196
|
}
|
|
197
|
-
var
|
|
198
|
-
function
|
|
197
|
+
var Zt = "reverted with no data. The target likely has no matching function or the account cannot run executor calls";
|
|
198
|
+
function Qt(e, t = Zt) {
|
|
199
199
|
if (!e || e === "0x") return t;
|
|
200
200
|
try {
|
|
201
|
-
let t =
|
|
202
|
-
abi:
|
|
201
|
+
let t = nt({
|
|
202
|
+
abi: Jt,
|
|
203
203
|
data: e
|
|
204
204
|
}), n = t.args?.length ? `(${t.args.map(String).join(", ")})` : "";
|
|
205
205
|
return `reverted with ${t.errorName}${n}`;
|
|
@@ -207,33 +207,33 @@ function rn(e, t = nn) {
|
|
|
207
207
|
return `reverted with data ${e}`;
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
return t && t !== "0x" ? `The publish UserOp in transaction ${e} ${
|
|
210
|
+
function $t(e, t) {
|
|
211
|
+
return t && t !== "0x" ? `The publish UserOp in transaction ${e} ${Qt(t)}.` : `The publish UserOp in transaction ${e} failed with no revert reason. That usually means it ran out of gas (the bundler's gas estimate was too low), not that the publish data is wrong. To confirm, run \`npx hardhat seed:explain-userop --network <network> --tx ${e}\` in seed-protocol.`;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function en(e) {
|
|
214
214
|
let { txHash: t, revertData: n, sender: r, cause: i } = e, a = !!n && n !== "0x";
|
|
215
|
-
return new E(
|
|
215
|
+
return new E($t(t, n), a ? "USEROP_REVERTED" : "USEROP_FAILED_NO_REASON", r, i);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function tn(e) {
|
|
218
218
|
let t = [];
|
|
219
219
|
for (let n = e; n && t.length < 6; n = n.cause) t.push(n);
|
|
220
220
|
return t;
|
|
221
221
|
}
|
|
222
|
-
var
|
|
223
|
-
function
|
|
224
|
-
return
|
|
222
|
+
var nn;
|
|
223
|
+
function rn(e) {
|
|
224
|
+
return nn ??= new Map(Jt.filter((e) => e.type === "error").map((e) => [ot(`${e.name}(${e.inputs.map((e) => e.type).join(",")})`), e.name])), nn.get(e.toLowerCase());
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
for (let n of
|
|
226
|
+
function an(e, t) {
|
|
227
|
+
for (let n of tn(e)) {
|
|
228
228
|
let r = String(n.message ?? "").match(/UserOp failed at txHash: (0x[0-9a-f]{64})/i);
|
|
229
|
-
if (r) return
|
|
229
|
+
if (r) return en({
|
|
230
230
|
txHash: r[1],
|
|
231
231
|
sender: t,
|
|
232
232
|
cause: e
|
|
233
233
|
});
|
|
234
234
|
let i = n.signature;
|
|
235
235
|
if (n.name === "AbiErrorSignatureNotFoundError" && typeof i == "string") {
|
|
236
|
-
let n =
|
|
236
|
+
let n = rn(i);
|
|
237
237
|
if (n) return new E(`The publish transaction reverted with ${n} (its arguments were not decoded).`, "USEROP_REVERTED", t, e);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
@@ -241,23 +241,23 @@ function un(e, t) {
|
|
|
241
241
|
}
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/helpers/blockchain.ts
|
|
244
|
-
var
|
|
245
|
-
let e = Oe.getArweaveJsApiConfig(), t =
|
|
244
|
+
var z = () => {
|
|
245
|
+
let e = Oe.getArweaveJsApiConfig(), t = kt;
|
|
246
246
|
return Object.keys(t).includes("default") && t.default ? t.default.init(e) : t.init(e);
|
|
247
247
|
};
|
|
248
248
|
//#endregion
|
|
249
249
|
//#region src/helpers/schemaRegistry.ts
|
|
250
|
-
async function
|
|
250
|
+
async function B(e) {
|
|
251
251
|
return be(e);
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function on(e) {
|
|
254
254
|
return d(e);
|
|
255
255
|
}
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region src/helpers/nameSchemaAttestation.ts
|
|
258
|
-
var
|
|
259
|
-
function
|
|
260
|
-
let t = new
|
|
258
|
+
var sn = "0x0000000000000000000000000000000000000000";
|
|
259
|
+
function cn(e) {
|
|
260
|
+
let t = new jt("bytes32 schemaId,string name").encodeData([{
|
|
261
261
|
name: "schemaId",
|
|
262
262
|
value: e.schemaUid,
|
|
263
263
|
type: "bytes32"
|
|
@@ -269,10 +269,10 @@ function pn(e) {
|
|
|
269
269
|
return l({
|
|
270
270
|
schema: o,
|
|
271
271
|
data: {
|
|
272
|
-
recipient:
|
|
273
|
-
expirationTime: BigInt(
|
|
272
|
+
recipient: sn,
|
|
273
|
+
expirationTime: BigInt(At),
|
|
274
274
|
revocable: !0,
|
|
275
|
-
refUID:
|
|
275
|
+
refUID: Pt,
|
|
276
276
|
data: t,
|
|
277
277
|
value: 0n
|
|
278
278
|
}
|
|
@@ -280,19 +280,19 @@ function pn(e) {
|
|
|
280
280
|
}
|
|
281
281
|
//#endregion
|
|
282
282
|
//#region src/services/publish/helpers/ensureEasSchemas.ts
|
|
283
|
-
var
|
|
284
|
-
function
|
|
283
|
+
var V = "0x0000000000000000000000000000000000000000", H = !0, ln = "bytes32 schemaId,string name", un = "bytes32 version", dn = /* @__PURE__ */ new Set();
|
|
284
|
+
function fn(e) {
|
|
285
285
|
return e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
286
286
|
}
|
|
287
|
-
async function
|
|
288
|
-
let { itemRelationProperties: t, itemImageProperties: n, itemListProperties: r } = await
|
|
287
|
+
async function pn(e) {
|
|
288
|
+
let { itemRelationProperties: t, itemImageProperties: n, itemListProperties: r } = await Be(e), i = /* @__PURE__ */ new Set();
|
|
289
289
|
e.modelName && i.add(e.modelName);
|
|
290
290
|
for (let e of t) {
|
|
291
291
|
let t = e.propertyDef?.ref;
|
|
292
292
|
t && i.add(t);
|
|
293
293
|
}
|
|
294
294
|
for (let e of n) {
|
|
295
|
-
let t =
|
|
295
|
+
let t = Ke(e.propertyDef?.dataType);
|
|
296
296
|
t === je.File ? i.add("File") : t === je.Html ? i.add("Html") : i.add("Image");
|
|
297
297
|
}
|
|
298
298
|
for (let e of r) {
|
|
@@ -301,108 +301,108 @@ async function yn(e) {
|
|
|
301
301
|
}
|
|
302
302
|
return i;
|
|
303
303
|
}
|
|
304
|
-
async function
|
|
304
|
+
async function mn(e, t) {
|
|
305
305
|
let n = await e.sendTransaction(t);
|
|
306
306
|
await T(n.transactionHash);
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
let t =
|
|
308
|
+
function hn(e) {
|
|
309
|
+
let t = Ke(e);
|
|
310
310
|
return Ae[t]?.eas ?? "string";
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function gn(e, t) {
|
|
313
313
|
if (e) throw Error(`schema "${t}" is not registered; automation keys can't register schemas. Call ensureEasSchemasForItem with the owner wallet first.`);
|
|
314
314
|
}
|
|
315
|
-
async function
|
|
315
|
+
async function _n() {
|
|
316
316
|
let e = ye().id;
|
|
317
|
-
if (
|
|
318
|
-
let t =
|
|
319
|
-
for (let [e, t] of n) await
|
|
317
|
+
if (dn.has(e)) return;
|
|
318
|
+
let t = Mt.getSchemaUID(un, V, H), n = [[ln, o], [un, t]], r = [];
|
|
319
|
+
for (let [e, t] of n) await B(t) || r.push(`"${e}" (${t})`);
|
|
320
320
|
if (r.length > 0) throw Error(`Seed base schema${r.length > 1 ? "s" : ""} ${r.join(" and ")} not registered on chain ${e}. The protocol registers base schemas for each supported chain (seed-protocol: bun run seed:ensure-schemas).`);
|
|
321
|
-
|
|
321
|
+
dn.add(e);
|
|
322
322
|
}
|
|
323
|
-
async function
|
|
323
|
+
async function vn(e, t) {
|
|
324
324
|
if (typeof t?.blockSchemaRegistration == "boolean") return t.blockSchemaRegistration;
|
|
325
325
|
let n = t?.managedAddress?.trim();
|
|
326
326
|
if (!n || !i(e)) return !1;
|
|
327
|
-
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-
|
|
327
|
+
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-D0bbWT8e.js").then((e) => e.n);
|
|
328
328
|
return r(n, e.signer.address);
|
|
329
329
|
}
|
|
330
|
-
async function
|
|
331
|
-
await
|
|
330
|
+
async function yn(e, t, n) {
|
|
331
|
+
await bn(e, t, n);
|
|
332
332
|
}
|
|
333
|
-
async function
|
|
334
|
-
let r = await
|
|
333
|
+
async function bn(e, t, n) {
|
|
334
|
+
let r = await vn(t, n), a = i(t) ? t.txSender : he(t) ? t : (() => {
|
|
335
335
|
throw Error("@seedprotocol/publish: ensureEasSchemasForItem requires a PublishWallet or SeedTxSender");
|
|
336
336
|
})();
|
|
337
|
-
await
|
|
338
|
-
let { itemBasicProperties: o, itemRelationProperties: s, itemImageProperties: c, itemListProperties: l } = await
|
|
337
|
+
await _n();
|
|
338
|
+
let { itemBasicProperties: o, itemRelationProperties: s, itemImageProperties: c, itemListProperties: l } = await Be(e), u = [
|
|
339
339
|
...o,
|
|
340
340
|
...s,
|
|
341
341
|
...c,
|
|
342
342
|
...l
|
|
343
|
-
], d = /* @__PURE__ */ new Set(), f = await
|
|
343
|
+
], d = /* @__PURE__ */ new Set(), f = await pn(e), p = /* @__PURE__ */ new Set();
|
|
344
344
|
for (let e of f) {
|
|
345
|
-
let t = `bytes32 ${
|
|
346
|
-
if (await
|
|
345
|
+
let t = `bytes32 ${fn(e)}`, n = Mt.getSchemaUID(t, V, H);
|
|
346
|
+
if (await B(n)) Xe({
|
|
347
347
|
modelName: e,
|
|
348
348
|
schemaUid: n
|
|
349
349
|
});
|
|
350
|
-
else if (p.has(n))
|
|
350
|
+
else if (p.has(n)) Xe({
|
|
351
351
|
modelName: e,
|
|
352
352
|
schemaUid: n
|
|
353
353
|
});
|
|
354
354
|
else {
|
|
355
|
-
|
|
355
|
+
gn(r, t);
|
|
356
356
|
try {
|
|
357
|
-
await
|
|
357
|
+
await mn(a, on({
|
|
358
358
|
schema: t,
|
|
359
|
-
resolverAddress:
|
|
360
|
-
revocable:
|
|
359
|
+
resolverAddress: V,
|
|
360
|
+
revocable: H
|
|
361
361
|
}));
|
|
362
362
|
} catch (t) {
|
|
363
363
|
throw Error(`Failed to register EAS schema for model ${e}: ${t instanceof Error ? t.message : String(t)}`);
|
|
364
364
|
}
|
|
365
365
|
try {
|
|
366
|
-
await
|
|
366
|
+
await mn(a, cn({
|
|
367
367
|
schemaUid: n,
|
|
368
|
-
schemaName:
|
|
368
|
+
schemaName: fn(e)
|
|
369
369
|
}));
|
|
370
370
|
} catch (t) {
|
|
371
371
|
throw Error(`Failed to name EAS schema for model ${e}: ${t instanceof Error ? t.message : String(t)}`);
|
|
372
372
|
}
|
|
373
|
-
p.add(n),
|
|
373
|
+
p.add(n), Xe({
|
|
374
374
|
modelName: e,
|
|
375
375
|
schemaUid: n
|
|
376
376
|
});
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
let m = "string storage_transaction_id", h =
|
|
380
|
-
if (await
|
|
379
|
+
let m = "string storage_transaction_id", h = Mt.getSchemaUID(m, V, H);
|
|
380
|
+
if (await B(h)) Ze({
|
|
381
381
|
text: m,
|
|
382
382
|
schemaUid: h
|
|
383
383
|
});
|
|
384
384
|
else if (!d.has(h) && (f.has("Image") || f.has("File") || f.has("Html"))) {
|
|
385
|
-
|
|
385
|
+
gn(r, m);
|
|
386
386
|
try {
|
|
387
|
-
await
|
|
387
|
+
await mn(a, on({
|
|
388
388
|
schema: m,
|
|
389
|
-
resolverAddress:
|
|
390
|
-
revocable:
|
|
391
|
-
})), await
|
|
389
|
+
resolverAddress: V,
|
|
390
|
+
revocable: H
|
|
391
|
+
})), await mn(a, cn({
|
|
392
392
|
schemaUid: h,
|
|
393
393
|
schemaName: "storage_transaction_id"
|
|
394
394
|
}));
|
|
395
395
|
} catch (e) {
|
|
396
396
|
throw Error(`Failed to register EAS schema for storageTransactionId: ${e instanceof Error ? e.message : String(e)}`);
|
|
397
397
|
}
|
|
398
|
-
d.add(h),
|
|
398
|
+
d.add(h), Ze({
|
|
399
399
|
text: m,
|
|
400
400
|
schemaUid: h
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
for (let e of u) {
|
|
404
404
|
if (!e.propertyDef) continue;
|
|
405
|
-
let t =
|
|
405
|
+
let t = hn(e.propertyDef.dataType), n = e, i = Ge(e.propertyName, e.propertyDef), o = i ?? (n.storagePropertyName && n.storagePropertyName.length > 0 ? n.storagePropertyName : e.propertyName), s = fn(o), c = `${t} ${s}`;
|
|
406
406
|
if (i && !s.endsWith("_ids")) throw Error(`Refusing to register "${c}" for list-relation property ${e.propertyName}: list relations attest as <singular>_<ref>_ids.`);
|
|
407
407
|
let l = [
|
|
408
408
|
"string",
|
|
@@ -416,79 +416,79 @@ async function En(e, t, n) {
|
|
|
416
416
|
"uint64",
|
|
417
417
|
"uint128",
|
|
418
418
|
"uint256"
|
|
419
|
-
].includes(t) ? t : void 0, u = await
|
|
419
|
+
].includes(t) ? t : void 0, u = await Ie({
|
|
420
420
|
schemaUid: i ? void 0 : e.schemaUid,
|
|
421
421
|
propertyName: o,
|
|
422
422
|
easDataType: l
|
|
423
423
|
});
|
|
424
424
|
if (u) {
|
|
425
|
-
let e = await
|
|
425
|
+
let e = await B(u.id);
|
|
426
426
|
if (e && e.schema === c) {
|
|
427
|
-
|
|
427
|
+
Ze({
|
|
428
428
|
text: c,
|
|
429
429
|
schemaUid: u.id
|
|
430
430
|
});
|
|
431
431
|
continue;
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
let f =
|
|
435
|
-
if (await
|
|
434
|
+
let f = Mt.getSchemaUID(c, V, H);
|
|
435
|
+
if (await B(f)) Ze({
|
|
436
436
|
text: c,
|
|
437
437
|
schemaUid: f
|
|
438
438
|
});
|
|
439
|
-
else if (d.has(f))
|
|
439
|
+
else if (d.has(f)) Ze({
|
|
440
440
|
text: c,
|
|
441
441
|
schemaUid: f
|
|
442
442
|
});
|
|
443
443
|
else {
|
|
444
|
-
|
|
444
|
+
gn(r, c);
|
|
445
445
|
try {
|
|
446
|
-
await
|
|
446
|
+
await mn(a, on({
|
|
447
447
|
schema: c,
|
|
448
|
-
resolverAddress:
|
|
449
|
-
revocable:
|
|
448
|
+
resolverAddress: V,
|
|
449
|
+
revocable: H
|
|
450
450
|
}));
|
|
451
451
|
} catch (t) {
|
|
452
452
|
throw Error(`Failed to register EAS schema for property ${e.propertyName}: ${t instanceof Error ? t.message : String(t)}`);
|
|
453
453
|
}
|
|
454
454
|
try {
|
|
455
|
-
await
|
|
455
|
+
await mn(a, cn({
|
|
456
456
|
schemaUid: f,
|
|
457
457
|
schemaName: s
|
|
458
458
|
}));
|
|
459
459
|
} catch (t) {
|
|
460
460
|
throw Error(`Failed to name EAS schema for property ${e.propertyName}: ${t instanceof Error ? t.message : String(t)}`);
|
|
461
461
|
}
|
|
462
|
-
d.add(f),
|
|
462
|
+
d.add(f), Ze({
|
|
463
463
|
text: c,
|
|
464
464
|
schemaUid: f
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
let g = await
|
|
469
|
-
for (let e of g) await
|
|
468
|
+
let g = await ze(e);
|
|
469
|
+
for (let e of g) await bn(e, t, {
|
|
470
470
|
managedAddress: n?.managedAddress,
|
|
471
471
|
blockSchemaRegistration: r
|
|
472
472
|
});
|
|
473
473
|
}
|
|
474
474
|
//#endregion
|
|
475
475
|
//#region src/services/publish/actors/utils.ts
|
|
476
|
-
var U = "0x" + "0".repeat(64),
|
|
476
|
+
var U = "0x" + "0".repeat(64), xn = async (e) => {
|
|
477
477
|
let t;
|
|
478
478
|
try {
|
|
479
|
-
t = await
|
|
479
|
+
t = await M.find({ seedLocalId: e });
|
|
480
480
|
} catch {}
|
|
481
481
|
return t || new Promise((t) => {
|
|
482
482
|
let n = setInterval(() => {
|
|
483
483
|
try {
|
|
484
|
-
|
|
484
|
+
M.find({ seedLocalId: e }).then((e) => {
|
|
485
485
|
e && (clearInterval(n), t(e));
|
|
486
486
|
});
|
|
487
487
|
} catch {}
|
|
488
488
|
}, 200);
|
|
489
489
|
});
|
|
490
490
|
};
|
|
491
|
-
function
|
|
491
|
+
function Sn(e) {
|
|
492
492
|
if (!e || typeof e != "object") return;
|
|
493
493
|
let t = e;
|
|
494
494
|
if (Array.isArray(t.data_root)) return {
|
|
@@ -503,7 +503,7 @@ function On(e) {
|
|
|
503
503
|
}))
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function Cn(e) {
|
|
507
507
|
return {
|
|
508
508
|
data_root: Array.from(e.data_root),
|
|
509
509
|
chunks: e.chunks.map((e) => ({
|
|
@@ -518,9 +518,9 @@ function kn(e) {
|
|
|
518
518
|
}
|
|
519
519
|
//#endregion
|
|
520
520
|
//#region src/services/publish/actors/createArweaveTransactions.ts
|
|
521
|
-
var
|
|
521
|
+
var wn = I(async ({ input: { context: e } }) => {
|
|
522
522
|
let { item: t } = e;
|
|
523
|
-
t.getPublishUploads || (t = await
|
|
523
|
+
t.getPublishUploads || (t = await xn(t.seedLocalId));
|
|
524
524
|
let n = {};
|
|
525
525
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
526
526
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
@@ -532,7 +532,7 @@ var An = L(async ({ input: { context: e } }) => {
|
|
|
532
532
|
})), l;
|
|
533
533
|
if (o) l = await o(c);
|
|
534
534
|
else if (s) {
|
|
535
|
-
let e =
|
|
535
|
+
let e = z(), t = s;
|
|
536
536
|
l = [];
|
|
537
537
|
for (let n of c) {
|
|
538
538
|
let r = e.transactions.fromRaw(n.transactionJson);
|
|
@@ -541,17 +541,17 @@ var An = L(async ({ input: { context: e } }) => {
|
|
|
541
541
|
l.push({
|
|
542
542
|
transaction: {
|
|
543
543
|
...i,
|
|
544
|
-
chunks: r.chunks ?
|
|
544
|
+
chunks: r.chunks ? Cn(r.chunks) : void 0
|
|
545
545
|
},
|
|
546
546
|
versionId: n.versionLocalId,
|
|
547
547
|
modelName: n.itemPropertyName
|
|
548
548
|
});
|
|
549
549
|
}
|
|
550
550
|
} else throw Error("Arweave signing not configured. Provide signArweaveTransactions or arweaveJwk at createPublish or in PublishProvider config.");
|
|
551
|
-
let u =
|
|
551
|
+
let u = z();
|
|
552
552
|
return {
|
|
553
553
|
arweaveTransactions: l.map((e) => {
|
|
554
|
-
let { chunks: t, ...n } = e.transaction, r = { ...n }, i =
|
|
554
|
+
let { chunks: t, ...n } = e.transaction, r = { ...n }, i = Sn(t);
|
|
555
555
|
return i && (r.chunks = i), {
|
|
556
556
|
transaction: u.transactions.fromRaw(r),
|
|
557
557
|
versionId: e.versionId,
|
|
@@ -560,9 +560,9 @@ var An = L(async ({ input: { context: e } }) => {
|
|
|
560
560
|
}),
|
|
561
561
|
publishUploads: i
|
|
562
562
|
};
|
|
563
|
-
}),
|
|
563
|
+
}), Tn = I(async ({ input: { context: e } }) => {
|
|
564
564
|
let { item: t } = e;
|
|
565
|
-
t.getPublishUploads || (t = await
|
|
565
|
+
t.getPublishUploads || (t = await xn(t.seedLocalId));
|
|
566
566
|
let n = {};
|
|
567
567
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
568
568
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
@@ -574,7 +574,7 @@ var An = L(async ({ input: { context: e } }) => {
|
|
|
574
574
|
})), l;
|
|
575
575
|
if (o) l = await o(c);
|
|
576
576
|
else if (s) {
|
|
577
|
-
let e =
|
|
577
|
+
let e = z(), t = s;
|
|
578
578
|
l = [];
|
|
579
579
|
for (let n of c) {
|
|
580
580
|
let r = e.transactions.fromRaw(n.transactionJson);
|
|
@@ -583,17 +583,17 @@ var An = L(async ({ input: { context: e } }) => {
|
|
|
583
583
|
l.push({
|
|
584
584
|
transaction: {
|
|
585
585
|
...i,
|
|
586
|
-
chunks: r.chunks ?
|
|
586
|
+
chunks: r.chunks ? Cn(r.chunks) : void 0
|
|
587
587
|
},
|
|
588
588
|
versionId: n.versionLocalId,
|
|
589
589
|
modelName: n.itemPropertyName
|
|
590
590
|
});
|
|
591
591
|
}
|
|
592
592
|
} else throw Error("Arweave signing not configured. Provide signArweaveTransactions or arweaveJwk at createPublish or in PublishProvider config.");
|
|
593
|
-
let u =
|
|
593
|
+
let u = z();
|
|
594
594
|
return {
|
|
595
595
|
arweaveTransactions: l.map((e) => {
|
|
596
|
-
let { chunks: t, ...n } = e.transaction, r = { ...n }, i =
|
|
596
|
+
let { chunks: t, ...n } = e.transaction, r = { ...n }, i = Sn(t);
|
|
597
597
|
return i && (r.chunks = i), {
|
|
598
598
|
transaction: u.transactions.fromRaw(r),
|
|
599
599
|
versionId: e.versionId,
|
|
@@ -602,13 +602,13 @@ var An = L(async ({ input: { context: e } }) => {
|
|
|
602
602
|
}),
|
|
603
603
|
publishUploads: i
|
|
604
604
|
};
|
|
605
|
-
}),
|
|
605
|
+
}), En = I(async ({ input: { context: e } }) => {
|
|
606
606
|
let t = e.htmlEmbeddedDataUriPolicy ?? "materialize";
|
|
607
|
-
return { deferredHtmlSeedLocalIds: (await
|
|
607
|
+
return { deferredHtmlSeedLocalIds: (await qe(e.item, t)).deferredHtmlSeedLocalIds };
|
|
608
608
|
});
|
|
609
609
|
//#endregion
|
|
610
610
|
//#region src/services/publish/actors/rewritingHtmlEmbedded.ts
|
|
611
|
-
function
|
|
611
|
+
function Dn(e, t) {
|
|
612
612
|
let n = [], r = Math.min(e?.length ?? 0, t?.length ?? 0);
|
|
613
613
|
for (let i = 0; i < r; i++) {
|
|
614
614
|
let r = e[i], a = t[i], o = r.transaction?.id;
|
|
@@ -620,222 +620,32 @@ function Nn(e, t) {
|
|
|
620
620
|
}
|
|
621
621
|
return n;
|
|
622
622
|
}
|
|
623
|
-
var
|
|
624
|
-
let t =
|
|
625
|
-
await
|
|
626
|
-
}),
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
name: "Content-SHA-256",
|
|
630
|
-
value: e
|
|
631
|
-
}), t && r.push({
|
|
632
|
-
name: "Content-Type",
|
|
633
|
-
value: t
|
|
634
|
-
}), n?.length && r.push(...n), r;
|
|
635
|
-
}, In = async (e) => {
|
|
636
|
-
let t = (e instanceof Uint8Array, new Uint8Array(e)), n = await crypto.subtle.digest("SHA-256", t);
|
|
637
|
-
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
638
|
-
}, Ln = {
|
|
639
|
-
png: "image/png",
|
|
640
|
-
jpg: "image/jpeg",
|
|
641
|
-
jpeg: "image/jpeg",
|
|
642
|
-
gif: "image/gif",
|
|
643
|
-
webp: "image/webp",
|
|
644
|
-
svg: "image/svg+xml",
|
|
645
|
-
html: "text/html",
|
|
646
|
-
htm: "text/html",
|
|
647
|
-
json: "application/json",
|
|
648
|
-
txt: "text/plain"
|
|
649
|
-
}, Rn = (e) => {
|
|
650
|
-
let t = e.split(".").pop()?.toLowerCase();
|
|
651
|
-
return t ? Ln[t] : void 0;
|
|
652
|
-
}, zn = async (e) => typeof Blob < "u" && e instanceof Blob ? new Uint8Array(await e.arrayBuffer()) : new Uint8Array(e), Bn = (e) => {
|
|
653
|
-
switch (e) {
|
|
654
|
-
case "Image": return M.getFilesPath("images");
|
|
655
|
-
case "File": return M.getFilesPath("files");
|
|
656
|
-
case "Html": return M.getFilesPath("html");
|
|
657
|
-
case "Json": return M.getFilesPath("json");
|
|
658
|
-
default: return M.getFilesPath("images");
|
|
659
|
-
}
|
|
660
|
-
}, Vn = /^data:(image\/[a-zA-Z0-9.+-]+);base64,([\s\S]*)$/i;
|
|
661
|
-
function Hn(e) {
|
|
662
|
-
let t = Vn.exec((e ?? "").trim());
|
|
663
|
-
if (!t) return null;
|
|
664
|
-
try {
|
|
665
|
-
let e = t[1].toLowerCase().trim(), n = t[2].replace(/\s/g, "");
|
|
666
|
-
return {
|
|
667
|
-
mimeType: e,
|
|
668
|
-
bytes: Uint8Array.from(atob(n), (e) => e.charCodeAt(0))
|
|
669
|
-
};
|
|
670
|
-
} catch {
|
|
671
|
-
return null;
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
var Un = async (e, t, n, r) => {
|
|
675
|
-
let i = r?.arweaveUploadTags, a = e.itemProperty, o = [];
|
|
676
|
-
for (let t of e.childProperties) {
|
|
677
|
-
let e = t.localStoragePath;
|
|
678
|
-
e && !e.endsWith("undefined") && await M.pathExists(e) && o.push({
|
|
679
|
-
propertyName: t.propertyName,
|
|
680
|
-
localStoragePath: e
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
let s;
|
|
684
|
-
if ((!o || o.length === 0) && n?.localStoragePath) {
|
|
685
|
-
let e = n.localStoragePath;
|
|
686
|
-
if (e && !e.endsWith("undefined") && await M.pathExists(e)) try {
|
|
687
|
-
s = await zn(await M.readFileAsBuffer(e));
|
|
688
|
-
} catch {
|
|
689
|
-
s = await zn((await M.getFs()).readFileSync(e));
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
if (o.length > 0) {
|
|
693
|
-
let e = "===FILE_SEPARATOR===", t = "", n = await M.getFs();
|
|
694
|
-
for (let r of o) {
|
|
695
|
-
let i;
|
|
696
|
-
try {
|
|
697
|
-
i = await n.promises.readFile(r.localStoragePath);
|
|
698
|
-
} catch {
|
|
699
|
-
i = n.readFileSync(r.localStoragePath);
|
|
700
|
-
}
|
|
701
|
-
t += `${e}${r.propertyName}${e}${i}`;
|
|
702
|
-
}
|
|
703
|
-
s = typeof document < "u" ? new TextEncoder().encode(t) : new Uint8Array(Buffer.from(t));
|
|
704
|
-
}
|
|
705
|
-
if (!s) return t;
|
|
706
|
-
let c = new Uint8Array(s), l = await In(c), u;
|
|
707
|
-
o.length === 0 && n?.localStoragePath ? u = Rn(n.localStoragePath) : o.length > 0 && (u = "application/octet-stream");
|
|
708
|
-
let d = n ? n.localId : a.localId, f = n ? n.propertyName : a.propertyName;
|
|
709
|
-
return t.push({
|
|
710
|
-
data: c,
|
|
711
|
-
contentHash: l,
|
|
712
|
-
contentType: u,
|
|
713
|
-
tags: Fn(l, u, i),
|
|
714
|
-
itemPropertyName: f,
|
|
715
|
-
itemPropertyLocalId: d,
|
|
716
|
-
seedLocalId: a.seedLocalId,
|
|
717
|
-
versionLocalId: a.versionLocalId
|
|
718
|
-
}), t;
|
|
719
|
-
}, Wn = async (e, t) => {
|
|
720
|
-
let n = [], r = t?.arweaveUploadTags;
|
|
721
|
-
for (let i of e) {
|
|
722
|
-
let e = i.getService().getSnapshot(), a = "context" in e ? e.context : null;
|
|
723
|
-
if (!a) continue;
|
|
724
|
-
let o = a.propertyValue, s = a.refResolvedValue;
|
|
725
|
-
if (!s) continue;
|
|
726
|
-
let { localId: c } = Ie(o ?? "");
|
|
727
|
-
if (!c) continue;
|
|
728
|
-
let l = i.propertyDef?.refValueType ?? i.propertyDef?.dataType ?? "Image";
|
|
729
|
-
if (l === je.Html) {
|
|
730
|
-
if (t?.deferHtmlStorageSeedLocalIds?.includes(c) || t?.onlyHtmlStorageSeedLocalIds?.length && !t.onlyHtmlStorageSeedLocalIds.includes(c)) continue;
|
|
731
|
-
} else if (t?.onlyHtmlStorageSeedLocalIds?.length) continue;
|
|
732
|
-
let u = `${Bn(l)}/${s}`;
|
|
733
|
-
if (!await M.pathExists(u)) continue;
|
|
734
|
-
let d = await zn(await M.readFileAsBuffer(u)), f = await In(d), p = Rn(s);
|
|
735
|
-
n.push({
|
|
736
|
-
data: d,
|
|
737
|
-
contentHash: f,
|
|
738
|
-
contentType: p,
|
|
739
|
-
tags: Fn(f, p, r),
|
|
740
|
-
itemPropertyName: i.propertyName,
|
|
741
|
-
itemPropertyLocalId: i.localId,
|
|
742
|
-
seedLocalId: c,
|
|
743
|
-
versionLocalId: i.versionLocalId
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
return n;
|
|
747
|
-
};
|
|
748
|
-
async function Gn(e, t, n) {
|
|
749
|
-
let r = ke.getAppDb();
|
|
750
|
-
if (!r || n?.onlyHtmlStorageSeedLocalIds?.length) return t;
|
|
751
|
-
let i = await r.select().from(We).where(z(We.parentSeedLocalId, e.seedLocalId)), a = new Set(t.map((e) => e.seedLocalId));
|
|
752
|
-
for (let e of i) {
|
|
753
|
-
if (a.has(e.imageSeedLocalId)) continue;
|
|
754
|
-
let r = await N.find({
|
|
755
|
-
seedLocalId: e.imageSeedLocalId,
|
|
756
|
-
modelName: "Image"
|
|
757
|
-
});
|
|
758
|
-
if (!r) continue;
|
|
759
|
-
let i = r.internalProperties.storageTransactionId ?? r.allProperties.storageTransactionId, o = i?.getService().getSnapshot(), s = o && "context" in o ? o.context : void 0, c = Hn(typeof s?.propertyValue == "string" ? s.propertyValue ?? "" : ""), l = [];
|
|
760
|
-
if (c && i && i.localId && i.versionLocalId) {
|
|
761
|
-
let e = await In(c.bytes);
|
|
762
|
-
l = [{
|
|
763
|
-
data: c.bytes,
|
|
764
|
-
contentHash: e,
|
|
765
|
-
contentType: c.mimeType,
|
|
766
|
-
tags: Fn(e, c.mimeType, n?.arweaveUploadTags),
|
|
767
|
-
itemPropertyName: i.propertyName,
|
|
768
|
-
itemPropertyLocalId: i.localId,
|
|
769
|
-
seedLocalId: r.seedLocalId,
|
|
770
|
-
versionLocalId: i.versionLocalId
|
|
771
|
-
}];
|
|
772
|
-
}
|
|
773
|
-
for (let e of l) a.has(e.seedLocalId) || (t.push(e), a.add(e.seedLocalId));
|
|
774
|
-
}
|
|
775
|
-
return t;
|
|
776
|
-
}
|
|
777
|
-
var Kn = (e) => !e.seedUid || e.seedUid === "0x" + "0".repeat(64), qn = async (e, t, n, r) => {
|
|
778
|
-
let { itemUploadProperties: i, itemRelationProperties: a, itemImageProperties: o } = await Ve(e);
|
|
779
|
-
if (r?.onlyHtmlStorageSeedLocalIds?.length) {
|
|
780
|
-
let e = await Wn(o, r);
|
|
781
|
-
t.push(...e);
|
|
782
|
-
} else {
|
|
783
|
-
for (let e of i) t = await Un(e, t, n, r);
|
|
784
|
-
let a = await Wn(o, r);
|
|
785
|
-
t.push(...a), (!n || Kn(e)) && (t = await Gn(e, t, r));
|
|
786
|
-
}
|
|
787
|
-
if (r?.skipRelationRecursion) return t;
|
|
788
|
-
let s = new Set(o);
|
|
789
|
-
for (let e of a) {
|
|
790
|
-
if (!s.has(e)) continue;
|
|
791
|
-
let n = e.getService().getSnapshot(), i = "context" in n ? n.context : null;
|
|
792
|
-
if (!i) continue;
|
|
793
|
-
let a = i.propertyValue;
|
|
794
|
-
if (!a || e.uid) continue;
|
|
795
|
-
let { seedLocalId: o, seedUid: c } = $e(Xe(a) ?? "");
|
|
796
|
-
if (!o && !c) throw Error(`Invalid relation value for ${e.propertyName}: expected local seed id or 0x uid`);
|
|
797
|
-
let l = await N.find({
|
|
798
|
-
seedLocalId: o,
|
|
799
|
-
seedUid: c
|
|
800
|
-
});
|
|
801
|
-
if (!l) {
|
|
802
|
-
if (Ke(a)) continue;
|
|
803
|
-
throw Error(`No relatedItem found for ${e.propertyName}`);
|
|
804
|
-
}
|
|
805
|
-
t = await qn(l, t, e, {
|
|
806
|
-
...r,
|
|
807
|
-
skipRelationRecursion: !0
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
return t;
|
|
811
|
-
}, Jn = async (e, t = [], n, r) => {
|
|
812
|
-
if (t = await qn(e, t, n, r), r?.skipRelationRecursion) return t;
|
|
813
|
-
let { drafts: i } = await ze(e, { strict: !0 });
|
|
814
|
-
for (let { item: e, via: n, viaList: a } of i) t = await qn(e, t, a ? void 0 : n, r);
|
|
815
|
-
return t;
|
|
816
|
-
}, Yn = 3, Xn = new TextEncoder().encode("seed-recovery"), Zn = 32, Qn = 18446744073709551615n;
|
|
817
|
-
function $n(e, t, n) {
|
|
818
|
-
let r = F.solidityPackedKeccak256([
|
|
623
|
+
var On = I(async ({ input: { context: e } }) => {
|
|
624
|
+
let t = Dn(e.htmlEmbeddedPhase1ArweaveTransactions, e.htmlEmbeddedPhase1PublishUploads);
|
|
625
|
+
await Ye(e.item.seedLocalId, t, e.htmlEmbeddedDeferredHtmlSeedLocalIds);
|
|
626
|
+
}), kn = (...e) => Re(...e), An = 3, jn = new TextEncoder().encode("seed-recovery"), Mn = 32, Nn = 18446744073709551615n;
|
|
627
|
+
function Pn(e, t, n) {
|
|
628
|
+
let r = P.solidityPackedKeccak256([
|
|
819
629
|
"uint256",
|
|
820
630
|
"address",
|
|
821
631
|
"uint64"
|
|
822
632
|
], [
|
|
823
633
|
BigInt(t),
|
|
824
634
|
e,
|
|
825
|
-
n &
|
|
635
|
+
n & Nn
|
|
826
636
|
]);
|
|
827
|
-
return
|
|
637
|
+
return P.getBytes(r);
|
|
828
638
|
}
|
|
829
|
-
function
|
|
639
|
+
function Fn(e) {
|
|
830
640
|
if (e.length === 0) return new Uint8Array([0]);
|
|
831
|
-
if (e.length !==
|
|
641
|
+
if (e.length !== Mn) throw Error(`ANS-104 target/anchor must be empty or ${Mn} bytes, got ${e.length}`);
|
|
832
642
|
let t = /* @__PURE__ */ new Uint8Array(33);
|
|
833
643
|
return t[0] = 1, t.set(e, 1), t;
|
|
834
644
|
}
|
|
835
|
-
function
|
|
645
|
+
function In(e) {
|
|
836
646
|
return typeof e == "object" && !!e && "privateKey" in e && typeof e.privateKey == "string";
|
|
837
647
|
}
|
|
838
|
-
function
|
|
648
|
+
function Ln(e, t, n) {
|
|
839
649
|
let r = e >= 0 ? e << 1 : ~e << 1 | 1, i = n;
|
|
840
650
|
do {
|
|
841
651
|
let e = r & 127;
|
|
@@ -843,10 +653,10 @@ function nr(e, t, n) {
|
|
|
843
653
|
} while (r);
|
|
844
654
|
return i - n;
|
|
845
655
|
}
|
|
846
|
-
var
|
|
656
|
+
var Rn = (e) => {
|
|
847
657
|
if (!e?.length) return /* @__PURE__ */ new Uint8Array();
|
|
848
658
|
let t = new TextEncoder(), n = /* @__PURE__ */ new Uint8Array(16), r = [], i = (e) => {
|
|
849
|
-
let t =
|
|
659
|
+
let t = Ln(e, n, 0);
|
|
850
660
|
r.push(n.slice(0, t));
|
|
851
661
|
};
|
|
852
662
|
i(e.length);
|
|
@@ -858,35 +668,35 @@ var rr = (e) => {
|
|
|
858
668
|
let a = r.reduce((e, t) => e + t.length, 0), o = new Uint8Array(a), s = 0;
|
|
859
669
|
for (let e of r) o.set(e, s), s += e.length;
|
|
860
670
|
return o;
|
|
861
|
-
},
|
|
671
|
+
}, zn = (e) => {
|
|
862
672
|
let t = /* @__PURE__ */ new Uint8Array(8), n = new DataView(t.buffer);
|
|
863
673
|
return n.setUint32(0, e | 0, !0), n.setUint32(4, Math.floor(e / 4294967296), !0), t;
|
|
864
674
|
};
|
|
865
|
-
async function
|
|
675
|
+
async function Bn(e) {
|
|
866
676
|
return new Uint8Array(await crypto.subtle.digest("SHA-384", e));
|
|
867
677
|
}
|
|
868
|
-
function
|
|
678
|
+
function Vn(e, t) {
|
|
869
679
|
let n = new Uint8Array(e.length + t.length);
|
|
870
680
|
return n.set(e, 0), n.set(t, e.length), n;
|
|
871
681
|
}
|
|
872
|
-
async function
|
|
682
|
+
async function Hn(e) {
|
|
873
683
|
let t = new TextEncoder();
|
|
874
684
|
if (Array.isArray(e)) {
|
|
875
|
-
let n = await
|
|
685
|
+
let n = await Bn(Vn(t.encode("list"), t.encode(e.length.toString())));
|
|
876
686
|
for (let t of e) {
|
|
877
|
-
let e = await
|
|
878
|
-
n = await
|
|
687
|
+
let e = await Hn(t);
|
|
688
|
+
n = await Bn(Vn(n, e));
|
|
879
689
|
}
|
|
880
690
|
return n;
|
|
881
691
|
}
|
|
882
|
-
return
|
|
692
|
+
return Bn(Vn(await Bn(Vn(t.encode("blob"), t.encode(e.byteLength.toString()))), await Bn(e)));
|
|
883
693
|
}
|
|
884
|
-
async function
|
|
694
|
+
async function Un(e, t, n, r, i) {
|
|
885
695
|
let a = new TextEncoder();
|
|
886
|
-
return
|
|
696
|
+
return Hn([
|
|
887
697
|
a.encode("dataitem"),
|
|
888
698
|
a.encode("1"),
|
|
889
|
-
a.encode(
|
|
699
|
+
a.encode(An.toString()),
|
|
890
700
|
e,
|
|
891
701
|
t,
|
|
892
702
|
n,
|
|
@@ -894,11 +704,11 @@ async function cr(e, t, n, r, i) {
|
|
|
894
704
|
i
|
|
895
705
|
]);
|
|
896
706
|
}
|
|
897
|
-
function
|
|
898
|
-
let a =
|
|
707
|
+
function Wn(e, t, n, r, i) {
|
|
708
|
+
let a = Rn(t), o = zn(t.length), s = zn(a.length), c = [
|
|
899
709
|
e,
|
|
900
|
-
|
|
901
|
-
|
|
710
|
+
Fn(r),
|
|
711
|
+
Fn(i),
|
|
902
712
|
o,
|
|
903
713
|
s,
|
|
904
714
|
a,
|
|
@@ -907,25 +717,25 @@ function lr(e, t, n, r, i) {
|
|
|
907
717
|
for (let e of c) u.set(e, d), d += e.length;
|
|
908
718
|
return u;
|
|
909
719
|
}
|
|
910
|
-
async function
|
|
720
|
+
async function Gn(e, t) {
|
|
911
721
|
let n = /* @__PURE__ */ new Uint8Array(2);
|
|
912
|
-
new DataView(n.buffer).setUint16(0,
|
|
722
|
+
new DataView(n.buffer).setUint16(0, An, !0);
|
|
913
723
|
let r = 67 + t.length, i = new Uint8Array(r);
|
|
914
724
|
i.set(n, 0), i.set(e, 2), i.set(t, 67);
|
|
915
725
|
let a = await crypto.subtle.digest("SHA-256", new Uint8Array(e));
|
|
916
726
|
return {
|
|
917
|
-
id:
|
|
727
|
+
id: Zn(new Uint8Array(a)),
|
|
918
728
|
raw: i
|
|
919
729
|
};
|
|
920
730
|
}
|
|
921
|
-
var
|
|
922
|
-
let i =
|
|
923
|
-
return
|
|
924
|
-
},
|
|
925
|
-
let i =
|
|
926
|
-
return
|
|
731
|
+
var Kn = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
|
|
732
|
+
let i = P.SigningKey.computePublicKey(t.privateKey, !1), a = P.getBytes(i), o = Rn(n), s = /* @__PURE__ */ new Uint8Array(), c = await Un(a, s, r, o, e);
|
|
733
|
+
return Gn(P.getBytes(await t.signMessage(c)), Wn(a, n, e, s, r));
|
|
734
|
+
}, qn = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
|
|
735
|
+
let i = P.hexlify(jn), a = await t.signMessage({ message: { raw: i } }), o = P.hashMessage(jn), s = P.SigningKey.recoverPublicKey(o, a), c = P.getBytes(s), l = Rn(n), u = /* @__PURE__ */ new Uint8Array(), d = await Un(c, u, r, l, e), f = P.hexlify(d), p = await t.signMessage({ message: { raw: f } });
|
|
736
|
+
return Gn(P.getBytes(p), Wn(c, n, e, u, r));
|
|
927
737
|
};
|
|
928
|
-
function
|
|
738
|
+
function Jn(e) {
|
|
929
739
|
if (e.length < 133) return null;
|
|
930
740
|
let t = e[132];
|
|
931
741
|
if (t !== 0 && t !== 1) return null;
|
|
@@ -938,8 +748,8 @@ function pr(e) {
|
|
|
938
748
|
let a = i === 1;
|
|
939
749
|
return a && e.length < r + 33 ? null : r + (a ? 33 : 1);
|
|
940
750
|
}
|
|
941
|
-
function
|
|
942
|
-
let t =
|
|
751
|
+
function Yn(e) {
|
|
752
|
+
let t = Jn(e);
|
|
943
753
|
if (t == null) return null;
|
|
944
754
|
let n = e[132] === 1, r = n ? e.slice(133, 165) : /* @__PURE__ */ new Uint8Array(), i = 132 + (n ? 33 : 1);
|
|
945
755
|
return {
|
|
@@ -948,29 +758,29 @@ function mr(e) {
|
|
|
948
758
|
tagsStart: t
|
|
949
759
|
};
|
|
950
760
|
}
|
|
951
|
-
async function
|
|
952
|
-
let t =
|
|
761
|
+
async function Xn(e) {
|
|
762
|
+
let t = Yn(e);
|
|
953
763
|
if (t == null) return !1;
|
|
954
764
|
let { rawTarget: n, rawAnchor: r, tagsStart: i } = t, a = i + 16;
|
|
955
765
|
if (e.length < a) return !1;
|
|
956
766
|
let o = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
957
|
-
if (o.getUint16(0, !0) !==
|
|
767
|
+
if (o.getUint16(0, !0) !== An) return !1;
|
|
958
768
|
let s = e.slice(2, 67), c = e.slice(67, 132), l = Number(o.getUint32(i + 8, !0) + o.getUint32(i + 12, !0) * 4294967296), u = i + 16 + l;
|
|
959
769
|
if (e.length < u) return !1;
|
|
960
770
|
let d = e.slice(i + 16, u), f = e.slice(u);
|
|
961
771
|
try {
|
|
962
|
-
let e = await
|
|
772
|
+
let e = await Un(c, n, r, d, f), t = P.hashMessage(e), i = P.hexlify(s), a = P.SigningKey.recoverPublicKey(t, i), o = P.getBytes(a);
|
|
963
773
|
return o.length === c.length && o.every((e, t) => e === c[t]);
|
|
964
774
|
} catch {
|
|
965
775
|
return !1;
|
|
966
776
|
}
|
|
967
777
|
}
|
|
968
|
-
var
|
|
778
|
+
var Zn = (e) => {
|
|
969
779
|
let t = "";
|
|
970
780
|
for (let n of e) t += String.fromCharCode(n);
|
|
971
781
|
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
972
|
-
},
|
|
973
|
-
async function
|
|
782
|
+
}, Qn = L("seedProtocol:createArweaveDataItems");
|
|
783
|
+
async function $n(e, t, n) {
|
|
974
784
|
let r, a;
|
|
975
785
|
if (t) r = (await t(e)).map((e) => ({
|
|
976
786
|
transaction: { id: e.transaction.id },
|
|
@@ -983,14 +793,14 @@ async function vr(e, t, n) {
|
|
|
983
793
|
let a = e[r], s = a.tags, c = /* @__PURE__ */ new Uint8Array(8);
|
|
984
794
|
crypto.getRandomValues(c);
|
|
985
795
|
let l = (new DataView(c.buffer).getBigUint64(0, !1) ^ BigInt(r)) & 18446744073709551615n, u;
|
|
986
|
-
if (
|
|
987
|
-
let e =
|
|
988
|
-
u = await
|
|
796
|
+
if (In(n)) {
|
|
797
|
+
let e = Pn(n.address, o, l);
|
|
798
|
+
u = await Kn(a.data, n, s, e);
|
|
989
799
|
} else {
|
|
990
|
-
let e = i(n) ? n.signer : n, t =
|
|
991
|
-
u = await
|
|
800
|
+
let e = i(n) ? n.signer : n, t = Pn(e.address, o, l);
|
|
801
|
+
u = await qn(a.data, e, s, t);
|
|
992
802
|
}
|
|
993
|
-
if (!await
|
|
803
|
+
if (!await Xn(u.raw)) throw Qn("DataItem verification failed: id=%s modelName=%s", u.id, a.itemPropertyName), Error(`DataItem signature verification failed for ${a.itemPropertyName}. The signing key may not match the owner, or the payload may have been modified.`);
|
|
994
804
|
t.push(u);
|
|
995
805
|
}
|
|
996
806
|
a = t, r = t.map((t, n) => ({
|
|
@@ -1012,47 +822,47 @@ async function vr(e, t, n) {
|
|
|
1012
822
|
signedDataItems: a
|
|
1013
823
|
};
|
|
1014
824
|
}
|
|
1015
|
-
var
|
|
825
|
+
var er = I(async ({ input: { context: e } }) => {
|
|
1016
826
|
let { item: t } = e;
|
|
1017
|
-
t.getPublishUploads || (t = await
|
|
827
|
+
t.getPublishUploads || (t = await xn(t.seedLocalId));
|
|
1018
828
|
let n = {};
|
|
1019
829
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
1020
830
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
1021
831
|
r?.length && (n.deferHtmlStorageSeedLocalIds = r);
|
|
1022
|
-
let i = await
|
|
1023
|
-
return
|
|
832
|
+
let i = await kn(t, [], void 0, Object.keys(n).length ? n : void 0), a = D();
|
|
833
|
+
return $n(i, e.signDataItems ?? a.signDataItems, e.dataItemSigner ?? a.dataItemSigner);
|
|
1024
834
|
});
|
|
1025
835
|
//#endregion
|
|
1026
836
|
//#region src/services/publish/actors/createArweaveDataItemsPhase2.ts
|
|
1027
|
-
async function
|
|
837
|
+
async function tr(e) {
|
|
1028
838
|
let { item: t } = e;
|
|
1029
|
-
t.getPublishUploads || (t = await
|
|
839
|
+
t.getPublishUploads || (t = await xn(t.seedLocalId));
|
|
1030
840
|
let n = {};
|
|
1031
841
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
1032
842
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
1033
843
|
r?.length && (n.onlyHtmlStorageSeedLocalIds = r);
|
|
1034
|
-
let i = await
|
|
844
|
+
let i = await kn(t, [], void 0, Object.keys(n).length ? n : void 0), a = D(), o = e.signDataItems ?? a.signDataItems, s = e.dataItemSigner ?? a.dataItemSigner;
|
|
1035
845
|
return i.length === 0 ? {
|
|
1036
846
|
arweaveTransactions: [],
|
|
1037
847
|
publishUploads: [],
|
|
1038
848
|
signedDataItems: void 0
|
|
1039
|
-
} :
|
|
849
|
+
} : $n(i, o, s);
|
|
1040
850
|
}
|
|
1041
|
-
var
|
|
1042
|
-
function
|
|
851
|
+
var nr = I(async ({ input: { context: e } }) => tr(e)), rr = 8192;
|
|
852
|
+
function ir(e) {
|
|
1043
853
|
let t = new Uint8Array(e), n = "";
|
|
1044
|
-
for (let e = 0; e < t.length; e +=
|
|
1045
|
-
let r = t.subarray(e, Math.min(e +
|
|
854
|
+
for (let e = 0; e < t.length; e += rr) {
|
|
855
|
+
let r = t.subarray(e, Math.min(e + rr, t.length));
|
|
1046
856
|
n += String.fromCharCode.apply(null, r);
|
|
1047
857
|
}
|
|
1048
858
|
return btoa(n);
|
|
1049
859
|
}
|
|
1050
|
-
async function
|
|
860
|
+
async function ar(e) {
|
|
1051
861
|
let t = [];
|
|
1052
862
|
for (let [n, r] of e.entries()) {
|
|
1053
863
|
let e = r;
|
|
1054
864
|
if (typeof e == "object" && e && "arrayBuffer" in e) {
|
|
1055
|
-
let r =
|
|
865
|
+
let r = ir(await e.arrayBuffer()), i = e;
|
|
1056
866
|
t.push({
|
|
1057
867
|
name: n,
|
|
1058
868
|
value: r,
|
|
@@ -1066,19 +876,19 @@ async function wr(e) {
|
|
|
1066
876
|
}
|
|
1067
877
|
return t;
|
|
1068
878
|
}
|
|
1069
|
-
function
|
|
879
|
+
function or(e, t, n) {
|
|
1070
880
|
let r = ["Upload server returned ", String(e)], i = t && typeof t == "object" && "message" in t ? String(t.message) : t && typeof t == "object" && "error" in t ? String(t.error) : null;
|
|
1071
881
|
return i ? r.push(`: ${i}`) : n && r.push(` (${n})`), r.join("");
|
|
1072
882
|
}
|
|
1073
|
-
function
|
|
883
|
+
function sr(e) {
|
|
1074
884
|
if (!e) return "Upload server unavailable. Please try again or check your connection.";
|
|
1075
885
|
let t = e.toLowerCase();
|
|
1076
886
|
return /other side closed|econnreset|socket hang up|connection closed/i.test(t) ? "Upload server closed the connection. It may be busy or the request may be too large—try again." : /etimedout|timeout/i.test(t) ? "Upload request timed out. Please try again." : /enotfound|getaddrinfo|dns/i.test(t) ? "Upload server could not be reached. Check the upload URL and your network." : "Upload failed. Please try again or check the upload server.";
|
|
1077
887
|
}
|
|
1078
|
-
async function
|
|
888
|
+
async function cr(e, t, n) {
|
|
1079
889
|
let r = typeof window < "u" ? window.Main : void 0;
|
|
1080
890
|
if (r?.uploadArweaveStart) {
|
|
1081
|
-
let n = await
|
|
891
|
+
let n = await ar(t);
|
|
1082
892
|
return r.uploadArweaveStart(e, n);
|
|
1083
893
|
}
|
|
1084
894
|
let i = await fetch(e, {
|
|
@@ -1092,7 +902,7 @@ async function Dr(e, t, n) {
|
|
|
1092
902
|
}
|
|
1093
903
|
//#endregion
|
|
1094
904
|
//#region src/services/publish/actors/sendReimbursementRequest.ts
|
|
1095
|
-
var
|
|
905
|
+
var lr = I(async ({ input: { context: e, event: t } }) => {
|
|
1096
906
|
let { arweaveTransactions: n = [], transactionKeys: r, reimbursementTransactionId: i } = e;
|
|
1097
907
|
if (i) return { transactionId: i };
|
|
1098
908
|
let a = n.map(({ transaction: e }) => e), o = new FormData();
|
|
@@ -1104,19 +914,19 @@ var Or = L(async ({ input: { context: e, event: t } }) => {
|
|
|
1104
914
|
let s = new Blob([JSON.stringify(r)], { type: "application/json" });
|
|
1105
915
|
o.append(`${e.id}-json`, s, `${e.id}-json`);
|
|
1106
916
|
}
|
|
1107
|
-
let { uploadApiBaseUrl: s } = D(), { status: c, body: l, message: u } = await
|
|
917
|
+
let { uploadApiBaseUrl: s } = D(), { status: c, body: l, message: u } = await cr(`${s}/api/upload/arweave/start`, o, s);
|
|
1108
918
|
if (c >= 300 || c < 200) {
|
|
1109
919
|
let e = c === 0 ? u : null;
|
|
1110
920
|
e && console.error("[upload]", e);
|
|
1111
|
-
let t = c === 0 ?
|
|
921
|
+
let t = c === 0 ? sr(e) : or(c, l, r);
|
|
1112
922
|
throw Error(t);
|
|
1113
923
|
}
|
|
1114
924
|
return l;
|
|
1115
|
-
}),
|
|
925
|
+
}), ur = I(async ({ input: { context: e, event: t } }) => {
|
|
1116
926
|
let { requestResponse: n, reimbursementTransactionId: r } = e;
|
|
1117
927
|
if (!n) throw Error("No request response");
|
|
1118
928
|
if (!r) throw Error("No reimbursement transaction id");
|
|
1119
|
-
let i =
|
|
929
|
+
let i = z();
|
|
1120
930
|
await new Promise((e, t) => {
|
|
1121
931
|
let n = setInterval(async () => {
|
|
1122
932
|
let t;
|
|
@@ -1128,14 +938,14 @@ var Or = L(async ({ input: { context: e, event: t } }) => {
|
|
|
1128
938
|
t && t.confirmed && (clearInterval(n), e());
|
|
1129
939
|
}, 5e3);
|
|
1130
940
|
});
|
|
1131
|
-
}), W =
|
|
1132
|
-
function
|
|
941
|
+
}), W = L("seedProtocol:services:publish:actors");
|
|
942
|
+
function dr(e) {
|
|
1133
943
|
if (e instanceof Uint8Array) return e;
|
|
1134
944
|
if (e instanceof ArrayBuffer) return new Uint8Array(e);
|
|
1135
945
|
throw Error("Transaction data must be Uint8Array or ArrayBuffer for upload resume");
|
|
1136
946
|
}
|
|
1137
|
-
var
|
|
1138
|
-
let n = t.context, r = (n.arweaveTransactions ?? []).map(({ transaction: e }) => e), i =
|
|
947
|
+
var fr = Lt(({ sendBack: e, input: t }) => {
|
|
948
|
+
let n = t.context, r = (n.arweaveTransactions ?? []).map(({ transaction: e }) => e), i = z(), a = n.uploaderState && typeof n.currentTransactionIndex == "number", o = a ? n.currentTransactionIndex : 0;
|
|
1139
949
|
(async () => {
|
|
1140
950
|
let t = r.length;
|
|
1141
951
|
for (let s = o; s < t; s++) {
|
|
@@ -1145,7 +955,7 @@ var jr = Ht(({ sendBack: e, input: t }) => {
|
|
|
1145
955
|
if (!await i.transactions.verify(l)) throw Error("Transaction verification failed");
|
|
1146
956
|
let u, d = n.uploaderState;
|
|
1147
957
|
if (a && s === o && d) {
|
|
1148
|
-
let e = l.data, t = e instanceof Uint8Array ? e :
|
|
958
|
+
let e = l.data, t = e instanceof Uint8Array ? e : dr(e);
|
|
1149
959
|
u = await i.transactions.getUploader(d, t);
|
|
1150
960
|
} else u = await i.transactions.getUploader(l, l.data);
|
|
1151
961
|
for (; !u.isComplete;) {
|
|
@@ -1174,19 +984,19 @@ var jr = Ht(({ sendBack: e, input: t }) => {
|
|
|
1174
984
|
error: t
|
|
1175
985
|
});
|
|
1176
986
|
});
|
|
1177
|
-
}),
|
|
1178
|
-
if (
|
|
987
|
+
}), pr = 12e4, mr = Function("s", "return import(s)"), hr = null, gr = async () => {
|
|
988
|
+
if (hr) return hr;
|
|
1179
989
|
if (typeof window < "u") return null;
|
|
1180
990
|
try {
|
|
1181
|
-
let e = await
|
|
1182
|
-
return
|
|
991
|
+
let e = await mr(`node:${["fs", "promises"].join("/")}`);
|
|
992
|
+
return hr = {
|
|
1183
993
|
readFile: e.readFile,
|
|
1184
994
|
stat: e.stat
|
|
1185
|
-
},
|
|
995
|
+
}, hr;
|
|
1186
996
|
} catch {
|
|
1187
997
|
return null;
|
|
1188
998
|
}
|
|
1189
|
-
},
|
|
999
|
+
}, _r = Lt(({ sendBack: e, input: { context: t } }) => {
|
|
1190
1000
|
let { signedDataItems: n } = t, { uploadApiBaseUrl: r, useArweaveBundler: i } = D();
|
|
1191
1001
|
if (!i || !r) {
|
|
1192
1002
|
e({
|
|
@@ -1208,7 +1018,7 @@ var jr = Ht(({ sendBack: e, input: t }) => {
|
|
|
1208
1018
|
return r[t] = a, a.length;
|
|
1209
1019
|
}
|
|
1210
1020
|
if (n.filename != null) {
|
|
1211
|
-
let e = await
|
|
1021
|
+
let e = await gr();
|
|
1212
1022
|
if (!e) throw Error("DataItem.filename requires Node.js fs access. In browser runtime, provide DataItem.raw or DataItem.getRaw().");
|
|
1213
1023
|
return (await e.stat(n.filename)).size;
|
|
1214
1024
|
}
|
|
@@ -1229,13 +1039,13 @@ var jr = Ht(({ sendBack: e, input: t }) => {
|
|
|
1229
1039
|
let a = e[n];
|
|
1230
1040
|
if (a.raw != null && (a.raw instanceof Uint8Array || Buffer.isBuffer(a.raw))) c.writeUInt32BE(t, l), l += 4, c.set(a.raw, l), l += t;
|
|
1231
1041
|
else if (a.filename != null) {
|
|
1232
|
-
let e = await
|
|
1042
|
+
let e = await gr();
|
|
1233
1043
|
if (!e) throw Error("DataItem.filename requires Node.js fs access. In browser runtime, provide DataItem.raw or DataItem.getRaw().");
|
|
1234
1044
|
let t = await e.readFile(a.filename);
|
|
1235
1045
|
c.writeUInt32BE(t.length, l), l += 4, t.copy(c, l), l += t.length;
|
|
1236
1046
|
} else throw Error("Cannot get raw bytes from DataItem");
|
|
1237
1047
|
}
|
|
1238
|
-
let u = new AbortController(), d = setTimeout(() => u.abort(),
|
|
1048
|
+
let u = new AbortController(), d = setTimeout(() => u.abort(), pr), f;
|
|
1239
1049
|
try {
|
|
1240
1050
|
f = await fetch(a, {
|
|
1241
1051
|
method: "POST",
|
|
@@ -1244,7 +1054,7 @@ var jr = Ht(({ sendBack: e, input: t }) => {
|
|
|
1244
1054
|
signal: u.signal
|
|
1245
1055
|
});
|
|
1246
1056
|
} catch (e) {
|
|
1247
|
-
throw clearTimeout(d), e instanceof Error && e.name === "AbortError" ? Error(`Arweave batch upload timed out after ${
|
|
1057
|
+
throw clearTimeout(d), e instanceof Error && e.name === "AbortError" ? Error(`Arweave batch upload timed out after ${pr / 1e3}s (upload API did not respond). Check uploadApiBaseUrl and network.`) : e;
|
|
1248
1058
|
}
|
|
1249
1059
|
if (clearTimeout(d), !f.ok) throw Error(`Batch upload failed: ${f.status}`);
|
|
1250
1060
|
let p = await f.json().catch(() => ({})), m = typeof p.failed == "number" ? p.failed : 0;
|
|
@@ -1262,7 +1072,7 @@ var jr = Ht(({ sendBack: e, input: t }) => {
|
|
|
1262
1072
|
});
|
|
1263
1073
|
//#endregion
|
|
1264
1074
|
//#region src/services/publish/helpers/receiptAttestationMs.ts
|
|
1265
|
-
async function
|
|
1075
|
+
async function vr(e) {
|
|
1266
1076
|
let t = e?.blockNumber;
|
|
1267
1077
|
return t == null ? Date.now() : await _e(t) ?? Date.now();
|
|
1268
1078
|
}
|
|
@@ -1271,11 +1081,11 @@ async function Lr(e) {
|
|
|
1271
1081
|
function G(e) {
|
|
1272
1082
|
return e == null || e === "" ? U : ("0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(64, "0").slice(-64)).toLowerCase();
|
|
1273
1083
|
}
|
|
1274
|
-
function
|
|
1084
|
+
function yr(e, t) {
|
|
1275
1085
|
if (!e.logs?.length) return [];
|
|
1276
1086
|
let n = t ? Te : r;
|
|
1277
1087
|
try {
|
|
1278
|
-
let t =
|
|
1088
|
+
let t = at({
|
|
1279
1089
|
abi: n,
|
|
1280
1090
|
eventName: "CreatedAttestation",
|
|
1281
1091
|
logs: e.logs,
|
|
@@ -1299,8 +1109,8 @@ function Rr(e, t) {
|
|
|
1299
1109
|
}
|
|
1300
1110
|
//#endregion
|
|
1301
1111
|
//#region src/services/publish/actors/multiPublishReceipt.ts
|
|
1302
|
-
var K = (e) => !e || G(e) === U,
|
|
1303
|
-
function
|
|
1112
|
+
var K = (e) => !e || G(e) === U, br = (e, t) => !!e && !!t && G(e) === G(t);
|
|
1113
|
+
function xr(e) {
|
|
1304
1114
|
let t = [];
|
|
1305
1115
|
for (let n of e.listOfAttestations ?? []) {
|
|
1306
1116
|
let e = Array.isArray(n?.data) ? n.data.length : 1, r = typeof n?._propertyName == "string" && n._propertyName !== "" ? n._propertyName : void 0;
|
|
@@ -1311,11 +1121,11 @@ function Br(e) {
|
|
|
1311
1121
|
}
|
|
1312
1122
|
return t;
|
|
1313
1123
|
}
|
|
1314
|
-
function
|
|
1124
|
+
function Sr(e, t, n) {
|
|
1315
1125
|
let i = t.toLowerCase(), a = e.logs?.filter((e) => e.address && e.address.toLowerCase() === i);
|
|
1316
1126
|
if (!a?.length) return [];
|
|
1317
1127
|
try {
|
|
1318
|
-
return n ?
|
|
1128
|
+
return n ? at({
|
|
1319
1129
|
abi: Te,
|
|
1320
1130
|
eventName: "SeedPublished",
|
|
1321
1131
|
logs: a,
|
|
@@ -1326,7 +1136,7 @@ function Vr(e, t, n) {
|
|
|
1326
1136
|
seedUid: K(t?.seedUid) ? void 0 : t.seedUid,
|
|
1327
1137
|
versionUid: K(t?.versionUid) ? void 0 : t.versionUid
|
|
1328
1138
|
};
|
|
1329
|
-
}) :
|
|
1139
|
+
}) : at({
|
|
1330
1140
|
abi: r,
|
|
1331
1141
|
eventName: "SeedPublished",
|
|
1332
1142
|
logs: a,
|
|
@@ -1335,7 +1145,7 @@ function Vr(e, t, n) {
|
|
|
1335
1145
|
let t = e.args?.returnedDataFromEAS;
|
|
1336
1146
|
if (!t || t === "0x") return { uids: [] };
|
|
1337
1147
|
try {
|
|
1338
|
-
return { uids:
|
|
1148
|
+
return { uids: tt([{ type: "bytes32[]" }], t)[0] ?? [] };
|
|
1339
1149
|
} catch {
|
|
1340
1150
|
return { uids: [] };
|
|
1341
1151
|
}
|
|
@@ -1344,15 +1154,15 @@ function Vr(e, t, n) {
|
|
|
1344
1154
|
return [];
|
|
1345
1155
|
}
|
|
1346
1156
|
}
|
|
1347
|
-
function
|
|
1348
|
-
let { receipt: t, requests: n, useModularExecutor: r, easContractAddress: i, contractAddressForEvents: a } = e, o =
|
|
1157
|
+
function Cr(e) {
|
|
1158
|
+
let { receipt: t, requests: n, useModularExecutor: r, easContractAddress: i, contractAddressForEvents: a } = e, o = yr(t, r), s = new Set(o.map((e) => G(e.attestationUid))), c = /* @__PURE__ */ new Set();
|
|
1349
1159
|
for (let e of n) K(e.seedUid) && e.seedSchemaUid && c.add(G(e.seedSchemaUid)), K(e.versionUid) && e.versionSchemaUid && c.add(G(e.versionSchemaUid));
|
|
1350
1160
|
let l = p(t, i).filter((e) => !s.has(G(e.uid)) && !c.has(G(e.schemaUid))).map((e) => ({
|
|
1351
1161
|
schemaUid: e.schemaUid,
|
|
1352
1162
|
attestationUid: e.uid
|
|
1353
|
-
})), u =
|
|
1163
|
+
})), u = Sr(t, a, r), d = n.map(xr), f = n.reduce((e, t) => e + +!!K(t.seedUid) + +!!K(t.versionUid), 0), m = d.reduce((e, t) => e + t.length, 0), h = m > 0 && o.length >= f + m, g = 0, _ = 0, v = 0, y = (e) => {
|
|
1354
1164
|
let t = o[g];
|
|
1355
|
-
if (t) return g += 1,
|
|
1165
|
+
if (t) return g += 1, br(t.schemaUid, e) ? t.attestationUid : void 0;
|
|
1356
1166
|
};
|
|
1357
1167
|
return n.map((e, t) => {
|
|
1358
1168
|
let n = d[t], i = { propertyPairs: [] };
|
|
@@ -1370,7 +1180,7 @@ function Hr(e) {
|
|
|
1370
1180
|
}
|
|
1371
1181
|
return n.forEach((e, t) => {
|
|
1372
1182
|
let n = a[t];
|
|
1373
|
-
if (!n || K(n.attestationUid) || n.schemaUid && !
|
|
1183
|
+
if (!n || K(n.attestationUid) || n.schemaUid && !br(n.schemaUid, e.schema)) return;
|
|
1374
1184
|
let r = n.schemaUid ?? e.schema;
|
|
1375
1185
|
r && i.propertyPairs.push({
|
|
1376
1186
|
schemaUid: r,
|
|
@@ -1382,32 +1192,32 @@ function Hr(e) {
|
|
|
1382
1192
|
}
|
|
1383
1193
|
//#endregion
|
|
1384
1194
|
//#region src/services/publish/actors/persistSeedUid.ts
|
|
1385
|
-
var
|
|
1386
|
-
function
|
|
1195
|
+
var wr = L("seedProtocol:services:publish:actors:persistSeedUid"), Tr = "0x" + "0".repeat(64), Er = 15e3;
|
|
1196
|
+
function Dr(e, t) {
|
|
1387
1197
|
let n = e.seedLocalId, r = n ? t.find((e) => e?.localId === n) : void 0, i = r ? r.seedUid : t[0]?.seedUid;
|
|
1388
|
-
i && i !==
|
|
1198
|
+
i && i !== Tr && (e.seedUid = i);
|
|
1389
1199
|
}
|
|
1390
|
-
async function
|
|
1200
|
+
async function Or(e, t, n) {
|
|
1391
1201
|
let r = e.persistSeedUid;
|
|
1392
1202
|
if (typeof r != "function") return;
|
|
1393
|
-
let i = new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("persistSeedUid timed out")),
|
|
1203
|
+
let i = new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("persistSeedUid timed out")), Er));
|
|
1394
1204
|
try {
|
|
1395
1205
|
await Promise.race([r.call(e, t, n), i]);
|
|
1396
1206
|
} catch (e) {
|
|
1397
|
-
|
|
1207
|
+
wr("persistSeedUid failed (attestations already on-chain):", e);
|
|
1398
1208
|
}
|
|
1399
1209
|
}
|
|
1400
1210
|
//#endregion
|
|
1401
1211
|
//#region src/services/publish/actors/publishRequestNormalize.ts
|
|
1402
|
-
var
|
|
1403
|
-
if (e == null) return "0x" + "0".repeat(
|
|
1404
|
-
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(
|
|
1212
|
+
var kr = 64, q = (e) => {
|
|
1213
|
+
if (e == null) return "0x" + "0".repeat(kr);
|
|
1214
|
+
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(kr, "0").slice(-64);
|
|
1405
1215
|
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
1406
1216
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1407
|
-
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(
|
|
1217
|
+
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(kr, "0").slice(-64);
|
|
1408
1218
|
}
|
|
1409
|
-
return "0x" + "0".repeat(
|
|
1410
|
-
},
|
|
1219
|
+
return "0x" + "0".repeat(kr);
|
|
1220
|
+
}, Ar = (e) => {
|
|
1411
1221
|
if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
|
|
1412
1222
|
if (typeof e == "string") {
|
|
1413
1223
|
let t = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
|
|
@@ -1419,25 +1229,25 @@ var Jr = 64, q = (e) => {
|
|
|
1419
1229
|
}
|
|
1420
1230
|
return "0x";
|
|
1421
1231
|
};
|
|
1422
|
-
function
|
|
1232
|
+
function jr(e) {
|
|
1423
1233
|
let t = new Set(e.map((e) => e?.localId).filter((e) => !!e));
|
|
1424
1234
|
return e.some((e) => (e?.listOfAttestations ?? []).some((e) => {
|
|
1425
1235
|
let n = e;
|
|
1426
1236
|
return n._unresolvedValue && t.has(n._unresolvedValue) ? !0 : Array.isArray(n._rawListIdsForResolve) ? n._rawListIdsForResolve.some((e) => e && t.has(String(e).trim())) : !1;
|
|
1427
1237
|
}));
|
|
1428
1238
|
}
|
|
1429
|
-
function
|
|
1239
|
+
function Mr(e, t) {
|
|
1430
1240
|
return (e ?? []).filter((e) => e.publishLocalId && t.has(e.publishLocalId));
|
|
1431
1241
|
}
|
|
1432
|
-
var
|
|
1433
|
-
recipient:
|
|
1242
|
+
var Nr = {
|
|
1243
|
+
recipient: Nt,
|
|
1434
1244
|
expirationTime: BigInt(0),
|
|
1435
1245
|
revocable: !0,
|
|
1436
1246
|
refUID: U,
|
|
1437
1247
|
data: U,
|
|
1438
1248
|
value: BigInt(0)
|
|
1439
1249
|
};
|
|
1440
|
-
function
|
|
1250
|
+
function Pr(e) {
|
|
1441
1251
|
let t = (e?.listOfAttestations ?? []).map((e) => {
|
|
1442
1252
|
let t = Array.isArray(e?.data) ? e.data : [];
|
|
1443
1253
|
return {
|
|
@@ -1445,7 +1255,7 @@ function $r(e) {
|
|
|
1445
1255
|
data: t.map((e) => ({
|
|
1446
1256
|
...e,
|
|
1447
1257
|
refUID: q(e?.refUID),
|
|
1448
|
-
data:
|
|
1258
|
+
data: Ar(e?.data),
|
|
1449
1259
|
expirationTime: e?.expirationTime == null ? BigInt(0) : BigInt(e.expirationTime),
|
|
1450
1260
|
value: e?.value == null ? BigInt(0) : BigInt(e.value)
|
|
1451
1261
|
})),
|
|
@@ -1466,7 +1276,7 @@ function $r(e) {
|
|
|
1466
1276
|
propertiesToUpdate: n
|
|
1467
1277
|
};
|
|
1468
1278
|
}
|
|
1469
|
-
function
|
|
1279
|
+
function Fr(e, t) {
|
|
1470
1280
|
for (let n of e) for (let e of n?.propertiesToUpdate ?? []) {
|
|
1471
1281
|
let n = e?.publishLocalId, r = q(e?.propertySchemaUid);
|
|
1472
1282
|
if (!n || !r) continue;
|
|
@@ -1474,25 +1284,25 @@ function ei(e, t) {
|
|
|
1474
1284
|
if (!i?.listOfAttestations) continue;
|
|
1475
1285
|
let a = i.listOfAttestations.find((e) => q(e?.schema)?.toLowerCase() === r?.toLowerCase());
|
|
1476
1286
|
a && (!Array.isArray(a.data) || a.data.length === 0) && (a.data = [{
|
|
1477
|
-
...
|
|
1287
|
+
...Nr,
|
|
1478
1288
|
refUID: U
|
|
1479
1289
|
}]);
|
|
1480
1290
|
}
|
|
1481
1291
|
}
|
|
1482
1292
|
//#endregion
|
|
1483
1293
|
//#region src/services/publish/actors/recordMultiPublishReceipt.ts
|
|
1484
|
-
var
|
|
1485
|
-
async function
|
|
1486
|
-
let { receipt: t, requests: n, rootSeedLocalId: r, useModularExecutor: i, contractAddressForEvents: a, publisherAddress: o } = e, { easContractAddress: s } = D(), c =
|
|
1294
|
+
var Ir = L("seedProtocol:services:publish:actors:recordMultiPublishReceipt"), J = (e) => !e || q(e) === U, Lr = (e) => J(e) ? void 0 : q(e);
|
|
1295
|
+
async function Rr(e) {
|
|
1296
|
+
let { receipt: t, requests: n, rootSeedLocalId: r, useModularExecutor: i, contractAddressForEvents: a, publisherAddress: o } = e, { easContractAddress: s } = D(), c = Cr({
|
|
1487
1297
|
receipt: t,
|
|
1488
1298
|
requests: n,
|
|
1489
1299
|
useModularExecutor: i,
|
|
1490
1300
|
easContractAddress: s,
|
|
1491
1301
|
contractAddressForEvents: a
|
|
1492
|
-
}), l = await
|
|
1302
|
+
}), l = await vr(t);
|
|
1493
1303
|
for (let e = 0; e < n.length; e++) {
|
|
1494
1304
|
let t = n[e], r = c[e].versionUid;
|
|
1495
|
-
t.localId && J(t.versionUid) && !J(r) && await
|
|
1305
|
+
t.localId && J(t.versionUid) && !J(r) && await Qe({
|
|
1496
1306
|
seedLocalId: t.localId,
|
|
1497
1307
|
versionUid: q(r),
|
|
1498
1308
|
publisher: o,
|
|
@@ -1504,13 +1314,13 @@ async function ri(e) {
|
|
|
1504
1314
|
t.localId && r.length && await Ne({
|
|
1505
1315
|
seedLocalId: t.localId,
|
|
1506
1316
|
attestationCreatedAtMs: l ?? null,
|
|
1507
|
-
versionUid:
|
|
1317
|
+
versionUid: Lr(t.versionUid) ?? Lr(i) ?? null,
|
|
1508
1318
|
pairs: r
|
|
1509
1319
|
});
|
|
1510
1320
|
}
|
|
1511
1321
|
for (let e = 0; e < n.length; e++) {
|
|
1512
1322
|
let t = n[e], i = c[e].seedUid;
|
|
1513
|
-
t.localId && t.localId !== r && J(t.seedUid) && !J(i) && await
|
|
1323
|
+
t.localId && t.localId !== r && J(t.seedUid) && !J(i) && await zr({
|
|
1514
1324
|
seedLocalId: t.localId,
|
|
1515
1325
|
seedUid: i,
|
|
1516
1326
|
publisherAddress: o,
|
|
@@ -1529,26 +1339,26 @@ async function ri(e) {
|
|
|
1529
1339
|
})
|
|
1530
1340
|
};
|
|
1531
1341
|
}
|
|
1532
|
-
async function
|
|
1342
|
+
async function zr(e) {
|
|
1533
1343
|
let { seedLocalId: t, seedUid: n, publisherAddress: r, attestationCreatedAtMs: i } = e;
|
|
1534
1344
|
try {
|
|
1535
|
-
let e = await
|
|
1345
|
+
let e = await M.find({ seedLocalId: t });
|
|
1536
1346
|
if (!e) {
|
|
1537
|
-
|
|
1347
|
+
Ir("related item %s not found; its seed uid is not recorded", t);
|
|
1538
1348
|
return;
|
|
1539
1349
|
}
|
|
1540
|
-
e.seedUid = n, await
|
|
1350
|
+
e.seedUid = n, await Or(e, r, i);
|
|
1541
1351
|
} catch (e) {
|
|
1542
|
-
|
|
1352
|
+
Ir("recording seed uid of related item %s failed: %O", t, e);
|
|
1543
1353
|
}
|
|
1544
1354
|
}
|
|
1545
1355
|
//#endregion
|
|
1546
1356
|
//#region src/helpers/seedPaymaster.ts
|
|
1547
|
-
var
|
|
1548
|
-
function
|
|
1357
|
+
var Br = 12000n;
|
|
1358
|
+
function Vr(e) {
|
|
1549
1359
|
return "paymasterAndData" in e && e.paymasterAndData ? e.paymasterAndData : "0x";
|
|
1550
1360
|
}
|
|
1551
|
-
function
|
|
1361
|
+
function Hr(e, t, n) {
|
|
1552
1362
|
return async (r) => {
|
|
1553
1363
|
if (k("paymaster hook called (userOp from thirdweb; callGasLimit is tx.gas or 0)", {
|
|
1554
1364
|
sender: r.sender,
|
|
@@ -1557,7 +1367,7 @@ function si(e, t, n) {
|
|
|
1557
1367
|
entryPoint: "initCode" in r ? "v0.6" : "v0.7",
|
|
1558
1368
|
...C(r)
|
|
1559
1369
|
}), !("initCode" in r)) throw Error("@seedprotocol/publish: the managed account sent an EntryPoint v0.7 UserOp; its sponsored gas handling only supports EntryPoint v0.6.");
|
|
1560
|
-
let i = typeof e == "function" ? e() : e, a = await
|
|
1370
|
+
let i = typeof e == "function" ? e() : e, a = await Ut({
|
|
1561
1371
|
userOp: r,
|
|
1562
1372
|
client: i,
|
|
1563
1373
|
chain: t
|
|
@@ -1565,8 +1375,8 @@ function si(e, t, n) {
|
|
|
1565
1375
|
k("1/3 paymaster sponsored (limits here are ignored)", C(a));
|
|
1566
1376
|
let o = {
|
|
1567
1377
|
...r,
|
|
1568
|
-
paymasterAndData:
|
|
1569
|
-
}, s = await
|
|
1378
|
+
paymasterAndData: Vr(a)
|
|
1379
|
+
}, s = await Ht({
|
|
1570
1380
|
userOp: o,
|
|
1571
1381
|
options: {
|
|
1572
1382
|
client: i,
|
|
@@ -1575,14 +1385,14 @@ function si(e, t, n) {
|
|
|
1575
1385
|
}
|
|
1576
1386
|
});
|
|
1577
1387
|
k("2/3 bundler estimate (callGasLimit includes thirdweb's +50k)", C(s));
|
|
1578
|
-
let c = s.callGasLimit *
|
|
1388
|
+
let c = s.callGasLimit * Br / 10000n;
|
|
1579
1389
|
o.callGasLimit = r.callGasLimit > c ? r.callGasLimit : c, o.verificationGasLimit = s.verificationGasLimit, o.preVerificationGas = s.preVerificationGas, k("raised limits sent to the paymaster for signing", {
|
|
1580
1390
|
...C(o),
|
|
1581
|
-
headroomBps:
|
|
1391
|
+
headroomBps: Br,
|
|
1582
1392
|
raisedEstimate: c,
|
|
1583
1393
|
txGas: r.callGasLimit
|
|
1584
1394
|
});
|
|
1585
|
-
let l = await
|
|
1395
|
+
let l = await Ut({
|
|
1586
1396
|
userOp: o,
|
|
1587
1397
|
client: i,
|
|
1588
1398
|
chain: t
|
|
@@ -1592,7 +1402,7 @@ function si(e, t, n) {
|
|
|
1592
1402
|
requestedCallGasLimit: o.callGasLimit
|
|
1593
1403
|
}), l;
|
|
1594
1404
|
let u = {
|
|
1595
|
-
paymasterAndData:
|
|
1405
|
+
paymasterAndData: Vr(l),
|
|
1596
1406
|
callGasLimit: o.callGasLimit,
|
|
1597
1407
|
verificationGasLimit: o.verificationGasLimit,
|
|
1598
1408
|
preVerificationGas: o.preVerificationGas
|
|
@@ -1602,39 +1412,39 @@ function si(e, t, n) {
|
|
|
1602
1412
|
}
|
|
1603
1413
|
//#endregion
|
|
1604
1414
|
//#region src/helpers/thirdweb.ts
|
|
1605
|
-
var
|
|
1606
|
-
ExternalWalletsForDeploy: () =>
|
|
1607
|
-
appMetadata: () =>
|
|
1608
|
-
deployManagedAccountViaFactory: () =>
|
|
1609
|
-
deploySmartWalletContract: () =>
|
|
1610
|
-
getConnectedAccount: () =>
|
|
1611
|
-
getConnectedManagedAccountAddress: () =>
|
|
1612
|
-
getConnectedModularAccount: () =>
|
|
1613
|
-
getManagedAccountWallet: () =>
|
|
1614
|
-
getModularAccountWallet: () =>
|
|
1615
|
-
getSharedPublishInAppWalletStorage: () =>
|
|
1616
|
-
getSmartWalletAddressForAdmin: () =>
|
|
1617
|
-
getWalletsForConnectButton: () =>
|
|
1618
|
-
isSmartWalletDeployed: () =>
|
|
1619
|
-
pollSmartWalletDeployed: () =>
|
|
1620
|
-
resolveSmartWalletForPublish: () =>
|
|
1621
|
-
syncPublishInAppAuthToken: () =>
|
|
1622
|
-
useActiveSmartWalletContract: () =>
|
|
1623
|
-
useLocalWalletAccount: () =>
|
|
1624
|
-
wallets: () =>
|
|
1625
|
-
}),
|
|
1626
|
-
function
|
|
1627
|
-
return
|
|
1628
|
-
getItem: async (e) => typeof window > "u" ? null : localStorage.getItem(
|
|
1415
|
+
var Ur = /* @__PURE__ */ e({
|
|
1416
|
+
ExternalWalletsForDeploy: () => ri,
|
|
1417
|
+
appMetadata: () => oi,
|
|
1418
|
+
deployManagedAccountViaFactory: () => ai,
|
|
1419
|
+
deploySmartWalletContract: () => ii,
|
|
1420
|
+
getConnectedAccount: () => ci,
|
|
1421
|
+
getConnectedManagedAccountAddress: () => si,
|
|
1422
|
+
getConnectedModularAccount: () => li,
|
|
1423
|
+
getManagedAccountWallet: () => pi,
|
|
1424
|
+
getModularAccountWallet: () => hi,
|
|
1425
|
+
getSharedPublishInAppWalletStorage: () => qr,
|
|
1426
|
+
getSmartWalletAddressForAdmin: () => $r,
|
|
1427
|
+
getWalletsForConnectButton: () => gi,
|
|
1428
|
+
isSmartWalletDeployed: () => ei,
|
|
1429
|
+
pollSmartWalletDeployed: () => ti,
|
|
1430
|
+
resolveSmartWalletForPublish: () => ni,
|
|
1431
|
+
syncPublishInAppAuthToken: () => Jr,
|
|
1432
|
+
useActiveSmartWalletContract: () => Qr,
|
|
1433
|
+
useLocalWalletAccount: () => Zr,
|
|
1434
|
+
wallets: () => Xr
|
|
1435
|
+
}), Wr = L("permaPress:helpers:thirdweb"), Gr = "seedProtocol:inAppPublish:", Kr = null;
|
|
1436
|
+
function qr() {
|
|
1437
|
+
return Kr ||= {
|
|
1438
|
+
getItem: async (e) => typeof window > "u" ? null : localStorage.getItem(Gr + e),
|
|
1629
1439
|
setItem: async (e, t) => {
|
|
1630
|
-
typeof window < "u" && localStorage.setItem(
|
|
1440
|
+
typeof window < "u" && localStorage.setItem(Gr + e, t);
|
|
1631
1441
|
},
|
|
1632
1442
|
removeItem: async (e) => {
|
|
1633
|
-
typeof window < "u" && localStorage.removeItem(
|
|
1443
|
+
typeof window < "u" && localStorage.removeItem(Gr + e);
|
|
1634
1444
|
}
|
|
1635
|
-
},
|
|
1445
|
+
}, Kr;
|
|
1636
1446
|
}
|
|
1637
|
-
function
|
|
1447
|
+
function Jr() {
|
|
1638
1448
|
if (typeof window > "u") return {
|
|
1639
1449
|
syncedBareToPrefixed: !1,
|
|
1640
1450
|
syncedPrefixedToBare: !1
|
|
@@ -1645,7 +1455,7 @@ function pi() {
|
|
|
1645
1455
|
syncedPrefixedToBare: !1
|
|
1646
1456
|
};
|
|
1647
1457
|
try {
|
|
1648
|
-
let t = `walletToken-${e}`, n = `${
|
|
1458
|
+
let t = `walletToken-${e}`, n = `${Gr}${t}`, r = localStorage.getItem(t), i = localStorage.getItem(n), a = !1, o = !1;
|
|
1649
1459
|
return r && !i && (localStorage.setItem(n, r), a = !0), i && !r && (localStorage.setItem(t, i), o = !0), i && r && r !== i && (localStorage.setItem(t, i), o = !0), {
|
|
1650
1460
|
syncedBareToPrefixed: a,
|
|
1651
1461
|
syncedPrefixedToBare: o
|
|
@@ -1657,78 +1467,78 @@ function pi() {
|
|
|
1657
1467
|
};
|
|
1658
1468
|
}
|
|
1659
1469
|
}
|
|
1660
|
-
async function
|
|
1661
|
-
|
|
1662
|
-
let t =
|
|
1470
|
+
async function Yr(e = A()) {
|
|
1471
|
+
Jr();
|
|
1472
|
+
let t = pi();
|
|
1663
1473
|
return await t.autoConnect({
|
|
1664
1474
|
client: j(),
|
|
1665
1475
|
chain: e
|
|
1666
1476
|
}), t;
|
|
1667
1477
|
}
|
|
1668
|
-
var
|
|
1669
|
-
let [e, t] =
|
|
1670
|
-
return
|
|
1671
|
-
},
|
|
1672
|
-
let e =
|
|
1673
|
-
return
|
|
1674
|
-
e && e.address && n(
|
|
1478
|
+
var Xr = [zt("io.metamask")], Zr = () => {
|
|
1479
|
+
let [e, t] = Ot(null);
|
|
1480
|
+
return zt("io.metamask"), Dt(!1), Et(() => {}, []), e;
|
|
1481
|
+
}, Qr = () => {
|
|
1482
|
+
let e = Vt(), [t, n] = Ot(null);
|
|
1483
|
+
return Et(() => {
|
|
1484
|
+
e && e.address && n(lt({
|
|
1675
1485
|
client: j(),
|
|
1676
1486
|
chain: A(),
|
|
1677
1487
|
address: e.address
|
|
1678
1488
|
}));
|
|
1679
1489
|
}, [e]), t;
|
|
1680
1490
|
};
|
|
1681
|
-
async function
|
|
1491
|
+
async function $r(e, t = "0x") {
|
|
1682
1492
|
return _(e, t);
|
|
1683
1493
|
}
|
|
1684
|
-
async function
|
|
1494
|
+
async function ei(e) {
|
|
1685
1495
|
return oe(e);
|
|
1686
1496
|
}
|
|
1687
|
-
async function
|
|
1497
|
+
async function ti(e, t, n) {
|
|
1688
1498
|
return ge(e, t, n);
|
|
1689
1499
|
}
|
|
1690
|
-
async function
|
|
1500
|
+
async function ni(e) {
|
|
1691
1501
|
if (!e) return { needsDeploy: !0 };
|
|
1692
|
-
if (await
|
|
1502
|
+
if (await ei(e.address)) return {
|
|
1693
1503
|
address: e.address,
|
|
1694
1504
|
account: e
|
|
1695
1505
|
};
|
|
1696
|
-
let t = await
|
|
1697
|
-
return await
|
|
1506
|
+
let t = await $r(e.address);
|
|
1507
|
+
return await ei(t) ? {
|
|
1698
1508
|
address: t,
|
|
1699
1509
|
account: e
|
|
1700
1510
|
} : { needsDeploy: !0 };
|
|
1701
1511
|
}
|
|
1702
|
-
var
|
|
1703
|
-
let t =
|
|
1512
|
+
var ri = [zt("io.metamask"), zt("me.rainbow")], ii = async (e) => {
|
|
1513
|
+
let t = lt({
|
|
1704
1514
|
client: j(),
|
|
1705
1515
|
chain: A(),
|
|
1706
1516
|
address: e.address
|
|
1707
|
-
}), n = await
|
|
1517
|
+
}), n = await ct({
|
|
1708
1518
|
smartAccount: e,
|
|
1709
1519
|
chain: A(),
|
|
1710
1520
|
client: j(),
|
|
1711
1521
|
accountContract: t
|
|
1712
1522
|
});
|
|
1713
|
-
return
|
|
1523
|
+
return Wr("deploySmartAccount result:", n), n;
|
|
1714
1524
|
};
|
|
1715
|
-
async function
|
|
1716
|
-
let { asThirdwebPublishWallet: t } = await import("./chainConfig-
|
|
1525
|
+
async function ai(e) {
|
|
1526
|
+
let { asThirdwebPublishWallet: t } = await import("./chainConfig-bc_6IgAw.js").then((e) => e.g), n = t(e.signingAccount), r = b(e.adminAddress, e.data ?? "0x");
|
|
1717
1527
|
await n.txSender.sendTransaction(r);
|
|
1718
1528
|
}
|
|
1719
|
-
var
|
|
1529
|
+
var oi = {
|
|
1720
1530
|
name: "Seed Protocol",
|
|
1721
1531
|
description: "Seed Protocol",
|
|
1722
1532
|
url: "https://seedprotocol.io"
|
|
1723
1533
|
};
|
|
1724
|
-
async function
|
|
1725
|
-
let t = (await
|
|
1534
|
+
async function si(e = A()) {
|
|
1535
|
+
let t = (await Yr(e)).getAccount();
|
|
1726
1536
|
if (!t) throw Error("Failed to get managed account");
|
|
1727
1537
|
return t.address;
|
|
1728
1538
|
}
|
|
1729
|
-
async function
|
|
1539
|
+
async function ci() {
|
|
1730
1540
|
try {
|
|
1731
|
-
let e =
|
|
1541
|
+
let e = hi();
|
|
1732
1542
|
return await e.autoConnect({
|
|
1733
1543
|
client: j(),
|
|
1734
1544
|
chain: A()
|
|
@@ -1737,21 +1547,21 @@ async function Di() {
|
|
|
1737
1547
|
return null;
|
|
1738
1548
|
}
|
|
1739
1549
|
}
|
|
1740
|
-
async function
|
|
1741
|
-
return
|
|
1550
|
+
async function li() {
|
|
1551
|
+
return ci();
|
|
1742
1552
|
}
|
|
1743
|
-
function
|
|
1553
|
+
function ui(e) {
|
|
1744
1554
|
let t = A(e).id, n = e.managedAccountFactoryAddress ?? h[t];
|
|
1745
1555
|
if (!n) throw Error(`@seedprotocol/publish: no ManagedAccount factory is known for chain ${t}. Pass managedAccountFactoryAddress in publish config, or use the EOA / direct EAS path.`);
|
|
1746
1556
|
return n;
|
|
1747
1557
|
}
|
|
1748
|
-
var
|
|
1558
|
+
var di = [
|
|
1749
1559
|
"farcaster",
|
|
1750
1560
|
"email",
|
|
1751
1561
|
"passkey",
|
|
1752
1562
|
"phone"
|
|
1753
|
-
],
|
|
1754
|
-
let t = e ?? w(), n = A(t ?? void 0), r = t ?
|
|
1563
|
+
], fi = null, pi = (e) => {
|
|
1564
|
+
let t = e ?? w(), n = A(t ?? void 0), r = t ? ui(t) : ae(), { bundlerUrl: i, sponsorGas: a } = Se(t);
|
|
1755
1565
|
if (!i && re(n)) throw Error(`@seedprotocol/publish: chain ${n.id} is local, so Thirdweb's hosted bundler cannot reach it. Set PublishConfig.thirdweb.bundlerUrl to the chain's bundler (seedTwinConfig does this for the twin).`);
|
|
1756
1566
|
let o = [
|
|
1757
1567
|
n.id,
|
|
@@ -1760,16 +1570,16 @@ var Ai = [
|
|
|
1760
1570
|
i ?? "",
|
|
1761
1571
|
a
|
|
1762
1572
|
].join("|").toLowerCase();
|
|
1763
|
-
return
|
|
1573
|
+
return fi?.key !== o && (k("managed wallet built", {
|
|
1764
1574
|
chainId: n.id,
|
|
1765
1575
|
sponsorGas: a,
|
|
1766
1576
|
bundlerUrl: i ?? "(thirdweb default)",
|
|
1767
1577
|
paymasterHook: a ? "installed" : "none (thirdweb estimates callGasLimit itself)"
|
|
1768
|
-
}),
|
|
1578
|
+
}), fi = {
|
|
1769
1579
|
key: o,
|
|
1770
|
-
wallet:
|
|
1771
|
-
storage:
|
|
1772
|
-
auth: { options: [...
|
|
1580
|
+
wallet: Bt({
|
|
1581
|
+
storage: qr(),
|
|
1582
|
+
auth: { options: [...di] },
|
|
1773
1583
|
executionMode: {
|
|
1774
1584
|
mode: "EIP4337",
|
|
1775
1585
|
smartAccount: {
|
|
@@ -1778,62 +1588,62 @@ var Ai = [
|
|
|
1778
1588
|
sponsorGas: a,
|
|
1779
1589
|
...i || a ? { overrides: {
|
|
1780
1590
|
...i ? { bundlerUrl: i } : {},
|
|
1781
|
-
...a ? { paymaster:
|
|
1591
|
+
...a ? { paymaster: Hr(j, n, i) } : {}
|
|
1782
1592
|
} } : {}
|
|
1783
1593
|
}
|
|
1784
1594
|
}
|
|
1785
1595
|
})
|
|
1786
|
-
}),
|
|
1787
|
-
},
|
|
1596
|
+
}), fi.wallet;
|
|
1597
|
+
}, mi = null, hi = (e) => {
|
|
1788
1598
|
let t = e ?? w(), { modularWalletMode: n, sponsorGas: r } = Se(t);
|
|
1789
1599
|
if (n === "EIP7702") {
|
|
1790
1600
|
let e = A(t ?? void 0);
|
|
1791
1601
|
if (re(e)) throw Error(`@seedprotocol/publish: chain ${e.id} is local, and Thirdweb's EIP-7702 mode needs its hosted bundler, which cannot reach it. Set PublishConfig.thirdweb.modularWalletMode to 'EOA' and fund the in-app EOA (seedTwinConfig does this for the twin).`);
|
|
1792
1602
|
}
|
|
1793
1603
|
let i = `${n}|${r}`;
|
|
1794
|
-
return
|
|
1604
|
+
return mi?.key !== i && (mi = {
|
|
1795
1605
|
key: i,
|
|
1796
|
-
wallet:
|
|
1797
|
-
storage:
|
|
1798
|
-
auth: { options: [...
|
|
1606
|
+
wallet: Bt({
|
|
1607
|
+
storage: qr(),
|
|
1608
|
+
auth: { options: [...di] },
|
|
1799
1609
|
executionMode: n === "EOA" ? { mode: "EOA" } : {
|
|
1800
1610
|
mode: "EIP7702",
|
|
1801
1611
|
sponsorGas: r
|
|
1802
1612
|
}
|
|
1803
1613
|
})
|
|
1804
|
-
}),
|
|
1805
|
-
},
|
|
1614
|
+
}), mi.wallet;
|
|
1615
|
+
}, gi = (e) => {
|
|
1806
1616
|
let t = e ?? w() ?? void 0;
|
|
1807
|
-
return t?.useModularExecutor ? [
|
|
1808
|
-
},
|
|
1809
|
-
function
|
|
1617
|
+
return t?.useModularExecutor ? [hi(t)] : [pi(t)];
|
|
1618
|
+
}, _i = "This ManagedAccount predates the Seed executor router extension, so the Seed executor cannot act for it and publish automation is not available for this account.", vi = "The Seed executor is not installed for this ManagedAccount, so automation session keys cannot publish through it. The account admin installs it (installSeedExecutor), which enrollPublishAutomation does.", yi = "The Seed executor module is configured with a different EAS contract for this ManagedAccount than publish config. Automation session keys cannot change it.", bi = "Could not read the Seed executor module state for this ManagedAccount.";
|
|
1619
|
+
function xi() {
|
|
1810
1620
|
let e = D().modularAccountModuleContract?.trim();
|
|
1811
1621
|
if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: publish automation requires PublishConfig.modularAccountModuleContract (executor module).");
|
|
1812
1622
|
return e;
|
|
1813
1623
|
}
|
|
1814
|
-
async function
|
|
1624
|
+
async function Si(e) {
|
|
1815
1625
|
return await ne(e) === null;
|
|
1816
1626
|
}
|
|
1817
|
-
async function
|
|
1818
|
-
let n =
|
|
1627
|
+
async function Ci(e, t = {}) {
|
|
1628
|
+
let n = xi(), r = e, i, a;
|
|
1819
1629
|
if (t.installedEas) i = !0, a = t.installedEas;
|
|
1820
1630
|
else try {
|
|
1821
|
-
i = await Ce(() => ee(n, r), Boolean, { attempts: t.readAttempts ?? 1 }), a = i ? await x(n, r) :
|
|
1631
|
+
i = await Ce(() => ee(n, r), Boolean, { attempts: t.readAttempts ?? 1 }), a = i ? await x(n, r) : st;
|
|
1822
1632
|
} catch (t) {
|
|
1823
|
-
throw new E(
|
|
1633
|
+
throw new E(bi, "AUTOMATION_UNSUPPORTED_ACCOUNT", e, t);
|
|
1824
1634
|
}
|
|
1825
1635
|
if (!i) {
|
|
1826
|
-
let t = await
|
|
1636
|
+
let t = await Si(r) ? _i : vi;
|
|
1827
1637
|
throw new E(t, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
|
|
1828
1638
|
}
|
|
1829
1639
|
let o = D().easContractAddress?.toLowerCase();
|
|
1830
|
-
if (o && a.toLowerCase() !== o) throw new E(
|
|
1640
|
+
if (o && a.toLowerCase() !== o) throw new E(yi, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
|
|
1831
1641
|
}
|
|
1832
|
-
function
|
|
1833
|
-
let t = e instanceof
|
|
1642
|
+
function wi(e) {
|
|
1643
|
+
let t = e instanceof et ? `${e.shortMessage} ${e.details} ${e.message}` : String(e);
|
|
1834
1644
|
return /insufficient funds|insufficient balance/i.test(t);
|
|
1835
1645
|
}
|
|
1836
|
-
async function
|
|
1646
|
+
async function Ti(e) {
|
|
1837
1647
|
let { managedAddress: t, tx: n, action: r, code: i = "AUTOMATION_PREFLIGHT_FAILED", requireSimulation: a = !0 } = e, o = (e) => xe().call({
|
|
1838
1648
|
account: t,
|
|
1839
1649
|
to: n.to,
|
|
@@ -1841,38 +1651,38 @@ async function Wi(e) {
|
|
|
1841
1651
|
value: n.value,
|
|
1842
1652
|
...e ? { stateOverride: [{
|
|
1843
1653
|
address: t,
|
|
1844
|
-
balance:
|
|
1654
|
+
balance: it("1000")
|
|
1845
1655
|
}] } : {}
|
|
1846
1656
|
});
|
|
1847
1657
|
try {
|
|
1848
1658
|
try {
|
|
1849
1659
|
await o(!1);
|
|
1850
1660
|
} catch (e) {
|
|
1851
|
-
if (!
|
|
1661
|
+
if (!wi(e)) throw e;
|
|
1852
1662
|
await o(!0);
|
|
1853
1663
|
}
|
|
1854
1664
|
} catch (e) {
|
|
1855
|
-
let n =
|
|
1665
|
+
let n = Xt(e);
|
|
1856
1666
|
if (!n && !a) return;
|
|
1857
|
-
let o = n ?
|
|
1667
|
+
let o = n ? Qt(Yt(e)) : "could not be simulated";
|
|
1858
1668
|
throw new E(`Simulated ${r} from ${t} ${o}; nothing was sent.`, i, t, e);
|
|
1859
1669
|
}
|
|
1860
1670
|
}
|
|
1861
1671
|
//#endregion
|
|
1862
1672
|
//#region src/helpers/ensureExecutorModule.ts
|
|
1863
|
-
var
|
|
1864
|
-
async function
|
|
1673
|
+
var Ei = () => `The executor module could not be installed on your publishing account on ${O()}. Reconnect and try again, or contact support if this persists.`;
|
|
1674
|
+
async function Di(e, t, n) {
|
|
1865
1675
|
let { modularAccountModuleContract: r } = n;
|
|
1866
1676
|
if (!r || !await oe(e)) return { status: "skipped" };
|
|
1867
1677
|
let i = await ne(e);
|
|
1868
|
-
return i ?
|
|
1678
|
+
return i ? Oi(e, i.executor, r) : { status: "skipped" };
|
|
1869
1679
|
}
|
|
1870
|
-
async function
|
|
1680
|
+
async function Oi(e, t, n) {
|
|
1871
1681
|
if (t.toLowerCase() !== n.trim().toLowerCase()) throw new E(`Your publishing account's Seed executor is ${t}, but publish config sets modularAccountModuleContract to ${n}. Point modularAccountModuleContract at the account's executor.`, "EXECUTOR_MODULE_NOT_INSTALLED", e);
|
|
1872
1682
|
let r = e, i, a, o;
|
|
1873
1683
|
try {
|
|
1874
1684
|
if (await fe(r, t)) return { status: "already-installed" };
|
|
1875
|
-
let { getManagedAccountAdmin: n } = await import("./managedAccountAdmin-
|
|
1685
|
+
let { getManagedAccountAdmin: n } = await import("./managedAccountAdmin-CdS1SCA_.js").then((e) => e.n), s = ue(await n(e));
|
|
1876
1686
|
i = s.txSender.address;
|
|
1877
1687
|
let c = await s.txSender.sendTransaction(f(r));
|
|
1878
1688
|
o = c.transactionHash;
|
|
@@ -1882,34 +1692,34 @@ async function qi(e, t, n) {
|
|
|
1882
1692
|
if (!(e instanceof de)) throw e;
|
|
1883
1693
|
}
|
|
1884
1694
|
} catch (t) {
|
|
1885
|
-
throw t instanceof E ? t : new E(
|
|
1695
|
+
throw t instanceof E ? t : new E(Ei(), "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
|
|
1886
1696
|
}
|
|
1887
|
-
let s = a &&
|
|
1697
|
+
let s = a && ki(a, r, t);
|
|
1888
1698
|
if (s) return {
|
|
1889
1699
|
status: "installed",
|
|
1890
1700
|
eas: s,
|
|
1891
1701
|
transactionHash: o
|
|
1892
1702
|
};
|
|
1893
|
-
let c = await
|
|
1703
|
+
let c = await Ai(r, i);
|
|
1894
1704
|
if (c === "already-installed") return { status: "already-installed" };
|
|
1895
1705
|
throw new E(`installSeedExecutor in transaction ${o} did not install the Seed executor on ${e}${c ? `: ${c}` : ""}.`, "EXECUTOR_MODULE_NOT_INSTALLED", e);
|
|
1896
1706
|
}
|
|
1897
|
-
function
|
|
1898
|
-
if (
|
|
1707
|
+
function ki(e, t, n) {
|
|
1708
|
+
if (at({
|
|
1899
1709
|
abi: ie,
|
|
1900
1710
|
eventName: "SeedExecutorInstalled",
|
|
1901
1711
|
logs: e.logs,
|
|
1902
1712
|
strict: !1
|
|
1903
|
-
}).some((e) =>
|
|
1713
|
+
}).some((e) => rt(e.address, t) && e.args.executor && rt(e.args.executor, n))) return at({
|
|
1904
1714
|
abi: y,
|
|
1905
1715
|
eventName: "ModuleInitialized",
|
|
1906
1716
|
logs: e.logs,
|
|
1907
1717
|
strict: !1
|
|
1908
|
-
}).find((e) =>
|
|
1718
|
+
}).find((e) => rt(e.address, n) && e.args.account && rt(e.args.account, t))?.args.eas;
|
|
1909
1719
|
}
|
|
1910
|
-
async function
|
|
1720
|
+
async function Ai(e, t) {
|
|
1911
1721
|
try {
|
|
1912
|
-
await
|
|
1722
|
+
await Ti({
|
|
1913
1723
|
managedAddress: t,
|
|
1914
1724
|
tx: f(e),
|
|
1915
1725
|
action: "installSeedExecutor",
|
|
@@ -1917,26 +1727,26 @@ async function Yi(e, t) {
|
|
|
1917
1727
|
});
|
|
1918
1728
|
return;
|
|
1919
1729
|
} catch (e) {
|
|
1920
|
-
let t =
|
|
1730
|
+
let t = Qt(Yt(e instanceof E ? e.underlyingCause : e));
|
|
1921
1731
|
return t === "reverted with SeedExecutorAlreadyInstalled" ? "already-installed" : t;
|
|
1922
1732
|
}
|
|
1923
1733
|
}
|
|
1924
1734
|
//#endregion
|
|
1925
1735
|
//#region src/helpers/ensureManagedAccountReady.ts
|
|
1926
|
-
var
|
|
1927
|
-
async function
|
|
1736
|
+
var ji = () => `Could not connect the managed publishing account on ${O()}. Reconnect with the same sign-in method and try again.`, Mi = () => `Your publishing smart account is not deployed on ${O()} yet. Complete wallet setup, enable autoDeployManagedAccount in config if appropriate, then try again.`, Ni = () => `The managed account could not be confirmed on ${O()} after deployment. Wait a moment and retry, or check your network connection.`, Pi = () => `Automatic deployment of the managed publishing account failed on ${O()}. Retry or deploy the account through your wallet provider.`;
|
|
1737
|
+
async function Fi() {
|
|
1928
1738
|
let { useModularExecutor: e } = D();
|
|
1929
1739
|
if (!e) return { kind: "skip" };
|
|
1930
1740
|
let t;
|
|
1931
1741
|
try {
|
|
1932
|
-
t = await
|
|
1742
|
+
t = await si(A());
|
|
1933
1743
|
} catch (e) {
|
|
1934
1744
|
return {
|
|
1935
1745
|
kind: "unavailable",
|
|
1936
1746
|
cause: e
|
|
1937
1747
|
};
|
|
1938
1748
|
}
|
|
1939
|
-
return await
|
|
1749
|
+
return await ei(t) ? {
|
|
1940
1750
|
kind: "ready",
|
|
1941
1751
|
managedAddress: t
|
|
1942
1752
|
} : {
|
|
@@ -1944,85 +1754,85 @@ async function ea() {
|
|
|
1944
1754
|
managedAddress: t
|
|
1945
1755
|
};
|
|
1946
1756
|
}
|
|
1947
|
-
async function
|
|
1948
|
-
|
|
1949
|
-
let e =
|
|
1757
|
+
async function Ii() {
|
|
1758
|
+
Jr();
|
|
1759
|
+
let e = pi();
|
|
1950
1760
|
await e.autoConnect({
|
|
1951
1761
|
client: j(),
|
|
1952
1762
|
chain: A()
|
|
1953
1763
|
});
|
|
1954
1764
|
let t = e.getAccount();
|
|
1955
|
-
if (!t) throw new E(
|
|
1765
|
+
if (!t) throw new E(ji(), "MANAGED_ACCOUNT_UNAVAILABLE");
|
|
1956
1766
|
return t;
|
|
1957
1767
|
}
|
|
1958
|
-
var
|
|
1959
|
-
async function
|
|
1768
|
+
var Li = 9e4;
|
|
1769
|
+
async function Ri(e) {
|
|
1960
1770
|
let t;
|
|
1961
1771
|
try {
|
|
1962
|
-
await Promise.race([
|
|
1963
|
-
t = setTimeout(() => n(/* @__PURE__ */ Error(`Managed account deploy timed out after ${
|
|
1772
|
+
await Promise.race([ii(e), new Promise((e, n) => {
|
|
1773
|
+
t = setTimeout(() => n(/* @__PURE__ */ Error(`Managed account deploy timed out after ${Li / 1e3}s`)), Li);
|
|
1964
1774
|
})]);
|
|
1965
1775
|
} finally {
|
|
1966
1776
|
t != null && clearTimeout(t);
|
|
1967
1777
|
}
|
|
1968
1778
|
}
|
|
1969
|
-
async function
|
|
1970
|
-
let t = D(), n = await
|
|
1779
|
+
async function zi(e) {
|
|
1780
|
+
let t = D(), n = await Ii(), { fromThirdwebAccount: r } = await import("./chainConfig-bc_6IgAw.js").then((e) => e.g), i = {
|
|
1971
1781
|
managedAddress: e,
|
|
1972
1782
|
managedSigningAccount: r(n)
|
|
1973
1783
|
};
|
|
1974
1784
|
try {
|
|
1975
1785
|
if (t.deployManagedAccount) await t.deployManagedAccount(i);
|
|
1976
1786
|
else {
|
|
1977
|
-
let e = await
|
|
1787
|
+
let e = await li();
|
|
1978
1788
|
if (e) {
|
|
1979
|
-
let t =
|
|
1789
|
+
let t = hi();
|
|
1980
1790
|
await t.autoConnect({
|
|
1981
1791
|
client: j(),
|
|
1982
1792
|
chain: A()
|
|
1983
|
-
}), await
|
|
1793
|
+
}), await ai({
|
|
1984
1794
|
adminAddress: t.getAdminAccount?.()?.address ?? e.address,
|
|
1985
1795
|
signingAccount: e
|
|
1986
1796
|
});
|
|
1987
|
-
} else await
|
|
1797
|
+
} else await Ri(n);
|
|
1988
1798
|
}
|
|
1989
1799
|
} catch (t) {
|
|
1990
|
-
if (await
|
|
1991
|
-
throw new E(
|
|
1800
|
+
if (await ti(e, /UserOp|user operation/i.test(Ee(t)) ? 15 : 5)) return;
|
|
1801
|
+
throw new E(Pi(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e, t);
|
|
1992
1802
|
}
|
|
1993
|
-
if (!await
|
|
1803
|
+
if (!await ti(e)) throw new E(Ni(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e);
|
|
1994
1804
|
}
|
|
1995
|
-
async function
|
|
1805
|
+
async function Bi() {
|
|
1996
1806
|
let e = D();
|
|
1997
1807
|
if (!e.useModularExecutor) throw Error("runModularExecutorPublishPrep: useModularExecutor is false");
|
|
1998
|
-
let t = await
|
|
1808
|
+
let t = await Fi();
|
|
1999
1809
|
if (t.kind === "unavailable") return {
|
|
2000
1810
|
ok: !1,
|
|
2001
|
-
error: new E(
|
|
1811
|
+
error: new E(ji(), "MANAGED_ACCOUNT_UNAVAILABLE", void 0, t.cause)
|
|
2002
1812
|
};
|
|
2003
1813
|
if (t.kind === "not_deployed") {
|
|
2004
1814
|
if (e.autoDeployManagedAccount) {
|
|
2005
1815
|
try {
|
|
2006
|
-
await
|
|
1816
|
+
await zi(t.managedAddress);
|
|
2007
1817
|
} catch (e) {
|
|
2008
1818
|
return {
|
|
2009
1819
|
ok: !1,
|
|
2010
|
-
error: te(e) ? e : new E(
|
|
1820
|
+
error: te(e) ? e : new E(Pi(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress, e)
|
|
2011
1821
|
};
|
|
2012
1822
|
}
|
|
2013
|
-
if (t = await
|
|
1823
|
+
if (t = await Fi(), t.kind !== "ready") return {
|
|
2014
1824
|
ok: !1,
|
|
2015
|
-
error: new E(
|
|
1825
|
+
error: new E(Ni(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.kind === "not_deployed" ? t.managedAddress : void 0)
|
|
2016
1826
|
};
|
|
2017
1827
|
} else return {
|
|
2018
1828
|
ok: !1,
|
|
2019
|
-
error: new E(
|
|
1829
|
+
error: new E(Mi(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress)
|
|
2020
1830
|
};
|
|
2021
1831
|
}
|
|
2022
1832
|
if (t.kind === "ready") {
|
|
2023
1833
|
if (e.modularAccountModuleContract) try {
|
|
2024
|
-
let n = await
|
|
2025
|
-
await
|
|
1834
|
+
let n = await Ii();
|
|
1835
|
+
await Di(t.managedAddress, n, e);
|
|
2026
1836
|
} catch (e) {
|
|
2027
1837
|
console.warn(`[@seedprotocol/publish] Executor module setup failed on ${O()}; publishing continues, but publish automation needs it.`, e);
|
|
2028
1838
|
}
|
|
@@ -2035,7 +1845,7 @@ async function aa() {
|
|
|
2035
1845
|
}
|
|
2036
1846
|
//#endregion
|
|
2037
1847
|
//#region src/helpers/resolvePublishWallet.ts
|
|
2038
|
-
function
|
|
1848
|
+
function Vi(e) {
|
|
2039
1849
|
if (i(e.wallet)) return e.wallet;
|
|
2040
1850
|
if (i(e.account)) return e.account;
|
|
2041
1851
|
let t = pe();
|
|
@@ -2044,9 +1854,9 @@ function oa(e) {
|
|
|
2044
1854
|
}
|
|
2045
1855
|
//#endregion
|
|
2046
1856
|
//#region src/services/publish/helpers/verifyArweaveTransactionsExist.ts
|
|
2047
|
-
async function
|
|
1857
|
+
async function Hi(e) {
|
|
2048
1858
|
if (e.length === 0) return;
|
|
2049
|
-
let { arweaveUploadVerificationBaseUrl: t } = D(), n = await Promise.all(e.map((e) =>
|
|
1859
|
+
let { arweaveUploadVerificationBaseUrl: t } = D(), n = await Promise.all(e.map((e) => He(t, e)));
|
|
2050
1860
|
for (let t = 0; t < e.length; t++) {
|
|
2051
1861
|
let r = e[t], i = n[t];
|
|
2052
1862
|
if (i) {
|
|
@@ -2060,8 +1870,8 @@ async function sa(e) {
|
|
|
2060
1870
|
}
|
|
2061
1871
|
//#endregion
|
|
2062
1872
|
//#region src/services/arweaveL1Finalize/enqueue.ts
|
|
2063
|
-
var
|
|
2064
|
-
async function
|
|
1873
|
+
var Ui = "pending_l1";
|
|
1874
|
+
async function Wi(e) {
|
|
2065
1875
|
let { useArweaveBundler: t } = D();
|
|
2066
1876
|
if (!t) return;
|
|
2067
1877
|
let n = e.arweaveTransactions ?? [], r = e.publishUploads ?? [];
|
|
@@ -2079,7 +1889,7 @@ async function la(e) {
|
|
|
2079
1889
|
dataItemId: s,
|
|
2080
1890
|
versionLocalId: o.versionLocalId ?? null,
|
|
2081
1891
|
itemPropertyName: o.itemPropertyName ?? null,
|
|
2082
|
-
phase:
|
|
1892
|
+
phase: Ui,
|
|
2083
1893
|
createdAt: a,
|
|
2084
1894
|
updatedAt: a
|
|
2085
1895
|
}).onConflictDoNothing();
|
|
@@ -2088,54 +1898,54 @@ async function la(e) {
|
|
|
2088
1898
|
}
|
|
2089
1899
|
//#endregion
|
|
2090
1900
|
//#region src/helpers/ensureManagedAccountEasConfigured.ts
|
|
2091
|
-
var
|
|
2092
|
-
function
|
|
1901
|
+
var Gi = () => `Could not verify or set the EAS contract address on your publishing account on ${O()}.`, Ki = "ManagedAccount EAS pointer does not match publish config. Configure EAS with the user’s ManagedAccount wallet before automation publish (session keys cannot call setEas).", qi = (e) => `Your publishing account's Seed extension uses EAS ${e}, but publish config sets easContractAddress to a different contract. The extension's EAS is fixed at deployment; fix easContractAddress.`;
|
|
1902
|
+
function Ji(e) {
|
|
2093
1903
|
return e.toLowerCase();
|
|
2094
1904
|
}
|
|
2095
|
-
function
|
|
2096
|
-
let { easContractAddress: t } = D(), n =
|
|
2097
|
-
if (!n || n ===
|
|
1905
|
+
function Yi(e) {
|
|
1906
|
+
let { easContractAddress: t } = D(), n = Ji(t);
|
|
1907
|
+
if (!n || n === Ji(st)) throw new E("Publish config is missing a valid easContractAddress.", "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
|
|
2098
1908
|
return n;
|
|
2099
1909
|
}
|
|
2100
|
-
async function
|
|
1910
|
+
async function Xi(e) {
|
|
2101
1911
|
try {
|
|
2102
1912
|
let t = await se(e);
|
|
2103
|
-
return
|
|
1913
|
+
return Ji(typeof t == "string" ? t : String(t));
|
|
2104
1914
|
} catch (t) {
|
|
2105
|
-
throw new E(
|
|
1915
|
+
throw new E(Gi(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
|
|
2106
1916
|
}
|
|
2107
1917
|
}
|
|
2108
|
-
async function
|
|
2109
|
-
let t =
|
|
2110
|
-
if (await
|
|
1918
|
+
async function Zi(e) {
|
|
1919
|
+
let t = Yi(e);
|
|
1920
|
+
if (await Xi(e) !== t) throw new E(Ki, "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
|
|
2111
1921
|
}
|
|
2112
|
-
async function
|
|
2113
|
-
let n =
|
|
1922
|
+
async function Qi(e, t) {
|
|
1923
|
+
let n = Yi(e), r = await Xi(e);
|
|
2114
1924
|
if (r !== n) {
|
|
2115
|
-
if (r !==
|
|
1925
|
+
if (r !== Ji(st)) throw new E(qi(r), "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
|
|
2116
1926
|
try {
|
|
2117
1927
|
let n = typeof t == "function" ? await t() : t, r = i(n) ? n.txSender : he(n) ? n : (() => {
|
|
2118
1928
|
throw Error("@seedprotocol/publish: ensureManagedAccountEasConfigured requires PublishWallet or SeedTxSender");
|
|
2119
1929
|
})(), { easContractAddress: a } = D(), o = S(e, a), s = await r.sendTransaction(o);
|
|
2120
1930
|
await T(s.transactionHash);
|
|
2121
1931
|
} catch (t) {
|
|
2122
|
-
throw new E(
|
|
1932
|
+
throw new E(Gi(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
|
|
2123
1933
|
}
|
|
2124
1934
|
}
|
|
2125
1935
|
}
|
|
2126
1936
|
//#endregion
|
|
2127
1937
|
//#region src/services/publish/actors/createAttestations.ts
|
|
2128
|
-
var
|
|
2129
|
-
function
|
|
1938
|
+
var $i = L("seedProtocol:services:publish:actors");
|
|
1939
|
+
function ea(e) {
|
|
2130
1940
|
return !!e && /^0x[0-9a-fA-F]{40}$/.test(e.trim());
|
|
2131
1941
|
}
|
|
2132
|
-
function
|
|
1942
|
+
function ta(e) {
|
|
2133
1943
|
let { useModularExecutor: t, publisherAddress: n, modularAccountModuleContract: r, managedAddress: i, routeToExecutorModule: a } = e;
|
|
2134
1944
|
if (t) {
|
|
2135
1945
|
if (!i) throw Error("resolvePublishRouting: managedAddress is required when useModularExecutor is true");
|
|
2136
1946
|
let e = r?.trim();
|
|
2137
1947
|
if (a) {
|
|
2138
|
-
if (!
|
|
1948
|
+
if (!ea(e)) throw Error("resolvePublishRouting: modularAccountModuleContract is required when routeToExecutorModule is true");
|
|
2139
1949
|
return {
|
|
2140
1950
|
txTargetAddress: e,
|
|
2141
1951
|
contractAddressForEvents: e
|
|
@@ -2151,18 +1961,18 @@ function ba(e) {
|
|
|
2151
1961
|
contractAddressForEvents: n
|
|
2152
1962
|
};
|
|
2153
1963
|
}
|
|
2154
|
-
var
|
|
1964
|
+
var na = I(async ({ input: { context: e } }) => {
|
|
2155
1965
|
let { address: t, account: n, wallet: r } = e, i = e.arweaveTransactions ?? [], a = e.publishUploads ?? [], { item: o } = e, { modularAccountModuleContract: s, useModularExecutor: l } = D();
|
|
2156
1966
|
if (!t || typeof t != "string" || !t.trim()) throw Error("No wallet address for publish. Connect a wallet and try again.");
|
|
2157
1967
|
if (!r && !n) throw Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
|
|
2158
1968
|
if (!l && !await oe(t)) throw Error("EOA publishing must use the direct EAS path (multiPublish requires a deployed publisher contract). If you see this, attestation routing is misconfigured.");
|
|
2159
1969
|
if (!o?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
|
|
2160
|
-
if (typeof o.getPublishUploads != "function" && (o = await
|
|
2161
|
-
let u =
|
|
1970
|
+
if (typeof o.getPublishUploads != "function" && (o = await xn(o.seedLocalId)), i.length !== a.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
|
|
1971
|
+
let u = ta({
|
|
2162
1972
|
useModularExecutor: !1,
|
|
2163
1973
|
publisherAddress: t
|
|
2164
|
-
}), d =
|
|
2165
|
-
await
|
|
1974
|
+
}), d = Vi(e), f = !1;
|
|
1975
|
+
await yn(o, d, { managedAddress: t });
|
|
2166
1976
|
let p = i.map((e, t) => {
|
|
2167
1977
|
let n = e.transaction?.id;
|
|
2168
1978
|
if (!n || typeof n != "string") throw Error("Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning.");
|
|
@@ -2173,40 +1983,40 @@ var xa = L(async ({ input: { context: e } }) => {
|
|
|
2173
1983
|
txId: n
|
|
2174
1984
|
};
|
|
2175
1985
|
});
|
|
2176
|
-
await
|
|
1986
|
+
await Hi(p.map((e) => e.txId));
|
|
2177
1987
|
let m = await o.getPublishPayload(p, { publishMode: e.publishMode ?? "patch" }), h = Array.isArray(m) ? m : [m];
|
|
2178
1988
|
if (l) {
|
|
2179
1989
|
let e = d?.signer?.address, n = !1;
|
|
2180
1990
|
if (t && e) {
|
|
2181
|
-
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-
|
|
1991
|
+
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-D0bbWT8e.js").then((e) => e.n);
|
|
2182
1992
|
n = await r(t, e);
|
|
2183
1993
|
}
|
|
2184
1994
|
if (n) {
|
|
2185
1995
|
let e = s?.trim();
|
|
2186
|
-
if (!
|
|
2187
|
-
u =
|
|
1996
|
+
if (!ea(e)) throw Error("@seedprotocol/publish: automation publish requires PublishConfig.modularAccountModuleContract (executor module). Session keys are module-only and cannot call the ManagedAccount directly.");
|
|
1997
|
+
u = ta({
|
|
2188
1998
|
useModularExecutor: l,
|
|
2189
1999
|
publisherAddress: t,
|
|
2190
2000
|
modularAccountModuleContract: e,
|
|
2191
2001
|
managedAddress: t,
|
|
2192
2002
|
routeToExecutorModule: !0
|
|
2193
|
-
}), f = !0, await
|
|
2003
|
+
}), f = !0, await Ci(t);
|
|
2194
2004
|
} else {
|
|
2195
|
-
let e = await
|
|
2005
|
+
let e = await Bi();
|
|
2196
2006
|
if (!e.ok) throw e.error;
|
|
2197
|
-
u =
|
|
2007
|
+
u = ta({
|
|
2198
2008
|
useModularExecutor: l,
|
|
2199
2009
|
publisherAddress: t,
|
|
2200
2010
|
modularAccountModuleContract: s,
|
|
2201
2011
|
managedAddress: e.managedAddress
|
|
2202
2012
|
});
|
|
2203
|
-
let { ensureModularPublishBootstrap: n } = await import("./ensureModularPublishBootstrap-
|
|
2013
|
+
let { ensureModularPublishBootstrap: n } = await import("./ensureModularPublishBootstrap-x1bmc__0.js").then((e) => e.n), { fromThirdwebAccount: r } = await import("./chainConfig-bc_6IgAw.js").then((e) => e.g);
|
|
2204
2014
|
d = r(await n(e.managedAddress));
|
|
2205
2015
|
}
|
|
2206
|
-
} else await
|
|
2016
|
+
} else await Qi(t, d);
|
|
2207
2017
|
let g = async (e) => {
|
|
2208
2018
|
let n = u.txTargetAddress, r = f ? c(n, e, 5000000n) : ve(n, e, 5000000n);
|
|
2209
|
-
await
|
|
2019
|
+
await Ti(f ? {
|
|
2210
2020
|
managedAddress: t,
|
|
2211
2021
|
tx: r,
|
|
2212
2022
|
action: "multiPublish via the executor module"
|
|
@@ -2220,23 +2030,23 @@ var xa = L(async ({ input: { context: e } }) => {
|
|
|
2220
2030
|
try {
|
|
2221
2031
|
return await d.txSender.sendTransaction(r);
|
|
2222
2032
|
} catch (e) {
|
|
2223
|
-
throw
|
|
2033
|
+
throw an(e, d.txSender.address);
|
|
2224
2034
|
}
|
|
2225
|
-
}, _ = h.length > 1 &&
|
|
2035
|
+
}, _ = h.length > 1 && jr(h), v, y = null, b = [];
|
|
2226
2036
|
if (_) {
|
|
2227
2037
|
let e = structuredClone(h), n = {}, r = {};
|
|
2228
2038
|
for (let i = 0; i < e.length; i++) {
|
|
2229
|
-
e = await
|
|
2230
|
-
let a = e[i], s = /* @__PURE__ */ new Set([a.localId]), c =
|
|
2039
|
+
e = await Je(e, n);
|
|
2040
|
+
let a = e[i], s = /* @__PURE__ */ new Set([a.localId]), c = Pr({
|
|
2231
2041
|
...a,
|
|
2232
|
-
propertiesToUpdate:
|
|
2042
|
+
propertiesToUpdate: Mr(a.propertiesToUpdate, s)
|
|
2233
2043
|
}), d = /* @__PURE__ */ new Map([[c.localId, c]]);
|
|
2234
|
-
|
|
2044
|
+
Fr([c], d);
|
|
2235
2045
|
let f = await g([c]), p = await T(f.transactionHash);
|
|
2236
2046
|
if (!p) throw Error("Failed to send transaction");
|
|
2237
2047
|
y = p;
|
|
2238
|
-
for (let e of
|
|
2239
|
-
let { requests: [m] } = await
|
|
2048
|
+
for (let e of yr(p, l)) e.attestationUid && b.push(e.attestationUid);
|
|
2049
|
+
let { requests: [m] } = await Rr({
|
|
2240
2050
|
receipt: p,
|
|
2241
2051
|
requests: [c],
|
|
2242
2052
|
rootSeedLocalId: o.seedLocalId,
|
|
@@ -2255,19 +2065,19 @@ var xa = L(async ({ input: { context: e } }) => {
|
|
|
2255
2065
|
let e = t?.localId, r = t?.seedUid;
|
|
2256
2066
|
e && r && q(r) !== U && (n[e] = q(r));
|
|
2257
2067
|
}
|
|
2258
|
-
v = (await
|
|
2068
|
+
v = (await Je(structuredClone(h), n)).map((e) => Pr({
|
|
2259
2069
|
...e,
|
|
2260
2070
|
seedUid: n[e.localId] ?? e.seedUid,
|
|
2261
2071
|
versionUid: r[e.localId] ?? e.versionUid
|
|
2262
2072
|
}));
|
|
2263
2073
|
} else {
|
|
2264
|
-
let e = h.map((e) =>
|
|
2265
|
-
|
|
2074
|
+
let e = h.map((e) => Pr(e));
|
|
2075
|
+
Fr(e, new Map(e.map((e) => [e?.localId, e])));
|
|
2266
2076
|
let n = Array.isArray(m) ? e : [e[0]], r = await g(n), i = await T(r.transactionHash);
|
|
2267
2077
|
if (!i) throw Error("Failed to send transaction");
|
|
2268
2078
|
y = i;
|
|
2269
|
-
for (let e of
|
|
2270
|
-
v = (await
|
|
2079
|
+
for (let e of yr(i, l)) e.attestationUid && b.push(e.attestationUid);
|
|
2080
|
+
v = (await Rr({
|
|
2271
2081
|
receipt: i,
|
|
2272
2082
|
requests: n,
|
|
2273
2083
|
rootSeedLocalId: o.seedLocalId,
|
|
@@ -2276,9 +2086,9 @@ var xa = L(async ({ input: { context: e } }) => {
|
|
|
2276
2086
|
publisherAddress: t
|
|
2277
2087
|
})).requests;
|
|
2278
2088
|
}
|
|
2279
|
-
|
|
2089
|
+
Dr(o, v);
|
|
2280
2090
|
let x = o, S = v.find((e) => e?.localId === o.seedLocalId)?.seedUid;
|
|
2281
|
-
S && S !== U && await
|
|
2091
|
+
S && S !== U && await Or(x, t, y ? await vr(y) : void 0), $i("requestData", m), Wi(e);
|
|
2282
2092
|
try {
|
|
2283
2093
|
let { clearHtmlEmbeddedImageCoPublishRows: e } = await import("@seedprotocol/sdk"), t = /* @__PURE__ */ new Set([o.seedLocalId]);
|
|
2284
2094
|
for (let e of v) e?.localId && t.add(e.localId);
|
|
@@ -2294,33 +2104,33 @@ var xa = L(async ({ input: { context: e } }) => {
|
|
|
2294
2104
|
extraUids: b
|
|
2295
2105
|
}) : null
|
|
2296
2106
|
};
|
|
2297
|
-
}),
|
|
2298
|
-
async function
|
|
2107
|
+
}), ra = L("seedProtocol:services:publish:verifyAttestations"), ia = "0x" + "0".repeat(64), aa = 64, oa = (e) => e == null ? "0x" + "0".repeat(aa) : typeof e == "string" ? "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(aa, "0").slice(-64) : "0x" + "0".repeat(aa), sa = 5e3, ca = 6;
|
|
2108
|
+
async function la({ normalizedRequests: e, item: t }) {
|
|
2299
2109
|
let n = t.seedLocalId;
|
|
2300
2110
|
for (let t of e) {
|
|
2301
|
-
if (t.listOfAttestations.length === 0 || t.versionUid ===
|
|
2302
|
-
let e = t.listOfAttestations.map((e) =>
|
|
2303
|
-
for (let e = 1; e <=
|
|
2304
|
-
e > 1 && await new Promise((e) => setTimeout(e,
|
|
2111
|
+
if (t.listOfAttestations.length === 0 || t.versionUid === ia) continue;
|
|
2112
|
+
let e = t.listOfAttestations.map((e) => oa(e.schema).toLowerCase()), r = [], i;
|
|
2113
|
+
for (let e = 1; e <= ca; e++) try {
|
|
2114
|
+
e > 1 && await new Promise((e) => setTimeout(e, sa)), r = await Le({ versionUids: [t.versionUid] });
|
|
2305
2115
|
break;
|
|
2306
2116
|
} catch (t) {
|
|
2307
|
-
if (i = t,
|
|
2117
|
+
if (i = t, ra("verifyAttestations attempt %d failed:", e, t), e === ca) throw ra("verifyAttestations: giving up after %d attempts", ca), i;
|
|
2308
2118
|
}
|
|
2309
|
-
let a = r.map((e) => e.schemaId ?
|
|
2119
|
+
let a = r.map((e) => e.schemaId ? oa(e.schemaId).toLowerCase() : "").filter(Boolean), o = new Set(a);
|
|
2310
2120
|
if (e.filter((e) => !o.has(e)).length > 0) throw new le(`Publish verification failed: Seed and Version attestations were created, but property/metadata attestations are missing or incomplete. Expected ${e.length} property attestations for schema(s) ${e.join(", ")}; found ${a.length}. Use PublishManager.retryAttestations('${n}') to retry.`, n, e, a, "METADATA_PROPERTIES_MISSING");
|
|
2311
2121
|
}
|
|
2312
2122
|
}
|
|
2313
2123
|
//#endregion
|
|
2314
2124
|
//#region src/services/publish/actors/createAttestationsDirectToEas.ts
|
|
2315
|
-
var
|
|
2316
|
-
if (e == null) return "0x" + "0".repeat(
|
|
2317
|
-
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(
|
|
2125
|
+
var ua = L("seedProtocol:services:publish:createAttestationsDirectToEas"), da = 64, Y = (e) => {
|
|
2126
|
+
if (e == null) return "0x" + "0".repeat(da);
|
|
2127
|
+
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(da, "0").slice(-64);
|
|
2318
2128
|
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
2319
2129
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2320
|
-
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(
|
|
2130
|
+
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(da, "0").slice(-64);
|
|
2321
2131
|
}
|
|
2322
|
-
return "0x" + "0".repeat(
|
|
2323
|
-
},
|
|
2132
|
+
return "0x" + "0".repeat(da);
|
|
2133
|
+
}, fa = (e) => {
|
|
2324
2134
|
if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
|
|
2325
2135
|
if (typeof e == "string") {
|
|
2326
2136
|
let t = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
|
|
@@ -2331,40 +2141,40 @@ var ka = R("seedProtocol:services:publish:createAttestationsDirectToEas"), Aa =
|
|
|
2331
2141
|
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
2332
2142
|
}
|
|
2333
2143
|
return "0x";
|
|
2334
|
-
},
|
|
2144
|
+
}, pa = async (e) => {
|
|
2335
2145
|
let t;
|
|
2336
2146
|
try {
|
|
2337
|
-
t = await
|
|
2147
|
+
t = await M.find({ seedLocalId: e });
|
|
2338
2148
|
} catch {}
|
|
2339
2149
|
return t || new Promise((t) => {
|
|
2340
2150
|
let n = setInterval(() => {
|
|
2341
2151
|
try {
|
|
2342
|
-
|
|
2152
|
+
M.find({ seedLocalId: e }).then((e) => {
|
|
2343
2153
|
e && (clearInterval(n), t(e));
|
|
2344
2154
|
});
|
|
2345
2155
|
} catch {}
|
|
2346
2156
|
}, 200);
|
|
2347
2157
|
});
|
|
2348
|
-
},
|
|
2349
|
-
async function
|
|
2158
|
+
}, ma = (e) => Array.isArray(e?._rawListIdsForResolve) || e?._easDataType === "bytes32[]" || typeof e?._schemaDef == "string" && e._schemaDef.startsWith("bytes32[]"), ha = (e) => Array.isArray(e?._rawListIdsForResolve) && e._rawListIdsForResolve.length > 0 || !!e?._unresolvedValue;
|
|
2159
|
+
async function ga(e, t, n) {
|
|
2350
2160
|
let r = e?.listOfAttestations ?? [];
|
|
2351
|
-
if (!r.some(
|
|
2352
|
-
let [i] = await
|
|
2161
|
+
if (!r.some(ha)) return;
|
|
2162
|
+
let [i] = await Je([e], n);
|
|
2353
2163
|
r.forEach((e, n) => {
|
|
2354
2164
|
let r = i?.listOfAttestations?.[n];
|
|
2355
|
-
if (!
|
|
2165
|
+
if (!ha(e) || !r || ha(r)) return;
|
|
2356
2166
|
let a = Array.isArray(r.data) ? r.data[0]?.data : r.data?.data, o = t.listOfAttestations[n]?.data?.[0];
|
|
2357
|
-
o && a != null && (o.data =
|
|
2167
|
+
o && a != null && (o.data = fa(a));
|
|
2358
2168
|
});
|
|
2359
2169
|
}
|
|
2360
|
-
var
|
|
2170
|
+
var _a = I(async ({ input: { context: e, event: t } }) => {
|
|
2361
2171
|
let { address: n, account: r, wallet: i } = e, a = e.arweaveTransactions ?? [], o = e.publishUploads ?? [], { item: c } = e;
|
|
2362
2172
|
if (!n || typeof n != "string" || !n.trim()) throw Error("No wallet address for publish. Connect a wallet and try again.");
|
|
2363
2173
|
if (!i && !r) throw Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
|
|
2364
2174
|
if (!c?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
|
|
2365
|
-
if (typeof c.getPublishUploads != "function" && (c = await
|
|
2366
|
-
let l =
|
|
2367
|
-
await
|
|
2175
|
+
if (typeof c.getPublishUploads != "function" && (c = await pa(c.seedLocalId)), a.length !== o.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
|
|
2176
|
+
let l = Vi(e), d = l.txSender;
|
|
2177
|
+
await yn(c, l, { managedAddress: n });
|
|
2368
2178
|
let f = a.map((e, t) => {
|
|
2369
2179
|
let n = e.transaction?.id;
|
|
2370
2180
|
if (!n || typeof n != "string") throw Error("Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning.");
|
|
@@ -2375,7 +2185,7 @@ var Ia = L(async ({ input: { context: e, event: t } }) => {
|
|
|
2375
2185
|
txId: n
|
|
2376
2186
|
};
|
|
2377
2187
|
});
|
|
2378
|
-
await
|
|
2188
|
+
await Hi(f.map((e) => e.txId));
|
|
2379
2189
|
let m = await c.getPublishPayload(f, { publishMode: e.publishMode ?? "patch" }), h = Array.isArray(m) ? m : [m], _ = h.map((e) => {
|
|
2380
2190
|
let t = (e?.listOfAttestations ?? []).map((e) => {
|
|
2381
2191
|
let t = Array.isArray(e?.data) ? e.data : [];
|
|
@@ -2384,11 +2194,11 @@ var Ia = L(async ({ input: { context: e, event: t } }) => {
|
|
|
2384
2194
|
data: t.map((e) => ({
|
|
2385
2195
|
...e,
|
|
2386
2196
|
refUID: Y(e?.refUID),
|
|
2387
|
-
data:
|
|
2197
|
+
data: fa(e?.data)
|
|
2388
2198
|
})),
|
|
2389
2199
|
...typeof e?._propertyName == "string" && e._propertyName !== "" ? { _propertyName: e._propertyName } : {},
|
|
2390
2200
|
...typeof e?._propertyNameForSchema == "string" && e._propertyNameForSchema !== "" ? { _propertyNameForSchema: e._propertyNameForSchema } : {},
|
|
2391
|
-
...
|
|
2201
|
+
...ma(e) ? { _isList: !0 } : {}
|
|
2392
2202
|
};
|
|
2393
2203
|
}), n = (e?.propertiesToUpdate ?? []).map((e) => ({
|
|
2394
2204
|
...e,
|
|
@@ -2404,7 +2214,7 @@ var Ia = L(async ({ input: { context: e, event: t } }) => {
|
|
|
2404
2214
|
propertiesToUpdate: n
|
|
2405
2215
|
};
|
|
2406
2216
|
}), y = new Map(_.map((e) => [e.localId, e])), b = {
|
|
2407
|
-
recipient:
|
|
2217
|
+
recipient: Nt,
|
|
2408
2218
|
expirationTime: BigInt(0),
|
|
2409
2219
|
revocable: !0,
|
|
2410
2220
|
refUID: g,
|
|
@@ -2436,13 +2246,13 @@ var Ia = L(async ({ input: { context: e, event: t } }) => {
|
|
|
2436
2246
|
}
|
|
2437
2247
|
}), n = await d.sendTransaction(e), i = await T(n.transactionHash);
|
|
2438
2248
|
if (!i) throw Error("Failed to create Seed attestation");
|
|
2439
|
-
x = await
|
|
2249
|
+
x = await vr(i);
|
|
2440
2250
|
let { easContractAddress: a } = D(), o = u(i, a);
|
|
2441
2251
|
if (!o || o === g) throw Error("Failed to get Seed UID from attestation receipt");
|
|
2442
2252
|
r = o, t.seedUid = o, t.localId && (ee.set(t.localId, {
|
|
2443
2253
|
seedUid: o,
|
|
2444
2254
|
attestationMs: x
|
|
2445
|
-
}), C[t.localId] = o), S.push(o),
|
|
2255
|
+
}), C[t.localId] = o), S.push(o), ua("created Seed attestation", r);
|
|
2446
2256
|
} else r !== g && S.push(r);
|
|
2447
2257
|
if (r !== g && i === g) {
|
|
2448
2258
|
let e = v({
|
|
@@ -2454,18 +2264,18 @@ var Ia = L(async ({ input: { context: e, event: t } }) => {
|
|
|
2454
2264
|
}
|
|
2455
2265
|
}), a = await d.sendTransaction(e), o = await T(a.transactionHash);
|
|
2456
2266
|
if (!o) throw Error("Failed to create Version attestation");
|
|
2457
|
-
x = await
|
|
2267
|
+
x = await vr(o);
|
|
2458
2268
|
let { easContractAddress: c } = D(), l = u(o, c);
|
|
2459
2269
|
if (!l || l === g) throw Error("Failed to get Version UID from attestation receipt");
|
|
2460
|
-
i = l, t.versionUid = l, S.push(l), await
|
|
2270
|
+
i = l, t.versionUid = l, S.push(l), await Qe({
|
|
2461
2271
|
seedLocalId: t.localId,
|
|
2462
2272
|
versionUid: l,
|
|
2463
2273
|
publisher: n,
|
|
2464
2274
|
attestationCreatedAt: x
|
|
2465
|
-
}),
|
|
2275
|
+
}), ua("created Version attestation", i);
|
|
2466
2276
|
} else i !== g && S.push(i);
|
|
2467
2277
|
for (let e of t.listOfAttestations) for (let t of e.data) t.refUID = i;
|
|
2468
|
-
await
|
|
2278
|
+
await ga(h[e], t, C);
|
|
2469
2279
|
for (let e of t.propertiesToUpdate ?? []) {
|
|
2470
2280
|
let t = y.get(e.publishLocalId);
|
|
2471
2281
|
if (!t?.listOfAttestations) continue;
|
|
@@ -2475,7 +2285,7 @@ var Ia = L(async ({ input: { context: e, event: t } }) => {
|
|
|
2475
2285
|
let a = t.listOfAttestations.map((e) => ({
|
|
2476
2286
|
schema: e.schema,
|
|
2477
2287
|
data: e.data.map((e) => ({
|
|
2478
|
-
recipient: e.recipient ??
|
|
2288
|
+
recipient: e.recipient ?? Nt,
|
|
2479
2289
|
expirationTime: e.expirationTime ?? 0n,
|
|
2480
2290
|
revocable: e.revocable ?? !0,
|
|
2481
2291
|
refUID: e.refUID ?? g,
|
|
@@ -2486,7 +2296,7 @@ var Ia = L(async ({ input: { context: e, event: t } }) => {
|
|
|
2486
2296
|
if (a.length > 0) {
|
|
2487
2297
|
let n = De(a), r = await d.sendTransaction(n), o = await T(r.transactionHash);
|
|
2488
2298
|
if (!o) throw Error("Failed to create property attestations");
|
|
2489
|
-
x = await
|
|
2299
|
+
x = await vr(o), ua("created property attestations for request", e);
|
|
2490
2300
|
let { easContractAddress: s } = D(), c = p(o, s);
|
|
2491
2301
|
for (let e of c) e.uid && S.push(e.uid);
|
|
2492
2302
|
let l = t.listOfAttestations, u = c.length === l.length;
|
|
@@ -2502,24 +2312,24 @@ var Ia = L(async ({ input: { context: e, event: t } }) => {
|
|
|
2502
2312
|
});
|
|
2503
2313
|
}
|
|
2504
2314
|
}
|
|
2505
|
-
|
|
2315
|
+
Dr(c, _);
|
|
2506
2316
|
let te = c, w = _.find((e) => e.localId === c.seedLocalId) ?? _[0];
|
|
2507
|
-
w?.seedUid && w.seedUid !== g && await
|
|
2508
|
-
for (let [e, { seedUid: t, attestationMs: r }] of ee) e !== w?.localId && await
|
|
2317
|
+
w?.seedUid && w.seedUid !== g && await Or(te, n, ee.get(w.localId)?.attestationMs ?? x);
|
|
2318
|
+
for (let [e, { seedUid: t, attestationMs: r }] of ee) e !== w?.localId && await zr({
|
|
2509
2319
|
seedLocalId: e,
|
|
2510
2320
|
seedUid: t,
|
|
2511
2321
|
publisherAddress: n,
|
|
2512
2322
|
attestationCreatedAtMs: r
|
|
2513
2323
|
});
|
|
2514
2324
|
try {
|
|
2515
|
-
await
|
|
2325
|
+
await la({
|
|
2516
2326
|
normalizedRequests: _,
|
|
2517
2327
|
item: c
|
|
2518
2328
|
});
|
|
2519
2329
|
} catch (e) {
|
|
2520
|
-
throw e instanceof le ||
|
|
2330
|
+
throw e instanceof le || ua("verifyAttestations failed (non-verification error):", e), e;
|
|
2521
2331
|
}
|
|
2522
|
-
|
|
2332
|
+
ua("direct EAS publish complete"), Wi(e);
|
|
2523
2333
|
try {
|
|
2524
2334
|
let { clearHtmlEmbeddedImageCoPublishRows: e } = await import("@seedprotocol/sdk"), t = /* @__PURE__ */ new Set([c.seedLocalId]);
|
|
2525
2335
|
for (let e of _) e?.localId && t.add(e.localId);
|
|
@@ -2534,40 +2344,40 @@ var Ia = L(async ({ input: { context: e, event: t } }) => {
|
|
|
2534
2344
|
extraUids: S
|
|
2535
2345
|
}) : null
|
|
2536
2346
|
};
|
|
2537
|
-
}),
|
|
2347
|
+
}), va = async (e) => {
|
|
2538
2348
|
let t;
|
|
2539
2349
|
try {
|
|
2540
|
-
t = await
|
|
2350
|
+
t = await M.find({ seedLocalId: e });
|
|
2541
2351
|
} catch {}
|
|
2542
2352
|
return t || new Promise((t) => {
|
|
2543
2353
|
let n = setInterval(() => {
|
|
2544
|
-
|
|
2354
|
+
M.find({ seedLocalId: e }).then((e) => {
|
|
2545
2355
|
e && (clearInterval(n), t(e));
|
|
2546
2356
|
}).catch(() => {});
|
|
2547
2357
|
}, 200);
|
|
2548
2358
|
});
|
|
2549
2359
|
};
|
|
2550
|
-
async function
|
|
2551
|
-
let t = typeof e.getPublishUploads == "function" ? e : await
|
|
2552
|
-
return await
|
|
2360
|
+
async function ya(e) {
|
|
2361
|
+
let t = typeof e.getPublishUploads == "function" ? e : await va(e.seedLocalId);
|
|
2362
|
+
return await We(t);
|
|
2553
2363
|
}
|
|
2554
2364
|
//#endregion
|
|
2555
2365
|
//#region src/services/publish/actors/checking.ts
|
|
2556
2366
|
var X = /* @__PURE__ */ new Set();
|
|
2557
|
-
async function
|
|
2367
|
+
async function ba(e) {
|
|
2558
2368
|
let t = D();
|
|
2559
2369
|
return t.useDirectEas ? "directEas" : t.useModularExecutor || await oe(e) ? "multiPublish" : "directEas";
|
|
2560
2370
|
}
|
|
2561
|
-
var
|
|
2371
|
+
var xa = Lt(({ sendBack: e, input: { context: t } }) => {
|
|
2562
2372
|
let { item: n, account: r, wallet: i, publishMode: a, address: o } = t;
|
|
2563
2373
|
return (async () => {
|
|
2564
|
-
if (!await
|
|
2374
|
+
if (!await Ue(n)) e({ type: "notOwner" });
|
|
2565
2375
|
else if (X.has(n.seedLocalId)) e({ type: "redundantPublishProcess" });
|
|
2566
2376
|
else {
|
|
2567
2377
|
X.add(n.seedLocalId);
|
|
2568
2378
|
try {
|
|
2569
2379
|
await Fe(), await ce();
|
|
2570
|
-
let t = await
|
|
2380
|
+
let t = await Ve(n, { publishMode: a ?? "patch" });
|
|
2571
2381
|
if (t.length > 0) {
|
|
2572
2382
|
X.delete(n.seedLocalId), e({
|
|
2573
2383
|
type: "validationFailed",
|
|
@@ -2576,8 +2386,8 @@ var Ba = Ht(({ sendBack: e, input: { context: t } }) => {
|
|
|
2576
2386
|
return;
|
|
2577
2387
|
}
|
|
2578
2388
|
let s = i ?? r;
|
|
2579
|
-
s && await
|
|
2580
|
-
let c = await
|
|
2389
|
+
s && await yn(n, s, { managedAddress: typeof o == "string" ? o : void 0 });
|
|
2390
|
+
let c = await $e(n, [], { publishMode: a ?? "patch" });
|
|
2581
2391
|
if (!c.isValid) {
|
|
2582
2392
|
X.delete(n.seedLocalId), e({
|
|
2583
2393
|
type: "validationFailed",
|
|
@@ -2594,7 +2404,7 @@ var Ba = Ht(({ sendBack: e, input: { context: t } }) => {
|
|
|
2594
2404
|
}
|
|
2595
2405
|
let l;
|
|
2596
2406
|
try {
|
|
2597
|
-
l = await
|
|
2407
|
+
l = await ba(o.trim());
|
|
2598
2408
|
} catch (t) {
|
|
2599
2409
|
X.delete(n.seedLocalId), e({
|
|
2600
2410
|
type: "checkingFailed",
|
|
@@ -2602,7 +2412,7 @@ var Ba = Ht(({ sendBack: e, input: { context: t } }) => {
|
|
|
2602
2412
|
});
|
|
2603
2413
|
return;
|
|
2604
2414
|
}
|
|
2605
|
-
let u = await
|
|
2415
|
+
let u = await ya(n), d = D().useArweaveBundler, f = { attestationStrategy: l };
|
|
2606
2416
|
e(u ? d ? {
|
|
2607
2417
|
type: "validPublishProcessBundler",
|
|
2608
2418
|
...f
|
|
@@ -2628,12 +2438,12 @@ var Ba = Ht(({ sendBack: e, input: { context: t } }) => {
|
|
|
2628
2438
|
}), () => {
|
|
2629
2439
|
X.delete(n.seedLocalId);
|
|
2630
2440
|
};
|
|
2631
|
-
}), { SUCCESS:
|
|
2632
|
-
function
|
|
2441
|
+
}), { SUCCESS: Sa, FAILURE: Z } = me;
|
|
2442
|
+
function Ca(e) {
|
|
2633
2443
|
let t = e.attestationStrategy;
|
|
2634
2444
|
return t === "directEas" || t !== "multiPublish" && D().useDirectEas;
|
|
2635
2445
|
}
|
|
2636
|
-
function
|
|
2446
|
+
function wa(e) {
|
|
2637
2447
|
let t = e.attestationStrategy;
|
|
2638
2448
|
return t === "multiPublish" || t !== "directEas" && !D().useDirectEas;
|
|
2639
2449
|
}
|
|
@@ -2641,88 +2451,88 @@ function Q(e) {
|
|
|
2641
2451
|
let t = e;
|
|
2642
2452
|
return t.error ?? t.data;
|
|
2643
2453
|
}
|
|
2644
|
-
var
|
|
2454
|
+
var Ta = Rt({
|
|
2645
2455
|
types: {
|
|
2646
2456
|
context: {},
|
|
2647
2457
|
input: {}
|
|
2648
2458
|
},
|
|
2649
2459
|
actors: {
|
|
2650
|
-
createArweaveTransactions:
|
|
2651
|
-
createArweaveTransactionsPhase2:
|
|
2652
|
-
createArweaveDataItems:
|
|
2653
|
-
createArweaveDataItemsPhase2:
|
|
2654
|
-
sendReimbursementRequest:
|
|
2655
|
-
pollForConfirmation:
|
|
2656
|
-
uploadData:
|
|
2657
|
-
uploadViaBundler:
|
|
2658
|
-
createAttestations:
|
|
2659
|
-
createAttestationsDirectToEas:
|
|
2660
|
-
checking:
|
|
2661
|
-
preparingHtmlEmbedded:
|
|
2662
|
-
rewritingHtmlEmbedded:
|
|
2460
|
+
createArweaveTransactions: wn,
|
|
2461
|
+
createArweaveTransactionsPhase2: Tn,
|
|
2462
|
+
createArweaveDataItems: er,
|
|
2463
|
+
createArweaveDataItemsPhase2: nr,
|
|
2464
|
+
sendReimbursementRequest: lr,
|
|
2465
|
+
pollForConfirmation: ur,
|
|
2466
|
+
uploadData: fr,
|
|
2467
|
+
uploadViaBundler: _r,
|
|
2468
|
+
createAttestations: na,
|
|
2469
|
+
createAttestationsDirectToEas: _a,
|
|
2470
|
+
checking: xa,
|
|
2471
|
+
preparingHtmlEmbedded: En,
|
|
2472
|
+
rewritingHtmlEmbedded: On
|
|
2663
2473
|
},
|
|
2664
2474
|
actions: {
|
|
2665
2475
|
handleError: ({ event: e }) => {
|
|
2666
2476
|
let t = Q(e);
|
|
2667
2477
|
t == null ? console.error("Unknown error (full event):", e) : console.error(t);
|
|
2668
2478
|
},
|
|
2669
|
-
assignErrorCreatingArweaveTransactions:
|
|
2479
|
+
assignErrorCreatingArweaveTransactions: F({
|
|
2670
2480
|
error: ({ event: e }) => Q(e),
|
|
2671
2481
|
errorStep: () => "creatingArweaveTransactions"
|
|
2672
2482
|
}),
|
|
2673
|
-
assignErrorCreatingArweaveDataItems:
|
|
2483
|
+
assignErrorCreatingArweaveDataItems: F({
|
|
2674
2484
|
error: ({ event: e }) => Q(e),
|
|
2675
2485
|
errorStep: () => "creatingArweaveDataItems"
|
|
2676
2486
|
}),
|
|
2677
|
-
assignErrorSendingReimbursementRequest:
|
|
2487
|
+
assignErrorSendingReimbursementRequest: F({
|
|
2678
2488
|
error: ({ event: e }) => Q(e),
|
|
2679
2489
|
errorStep: () => "sendingReimbursementRequest"
|
|
2680
2490
|
}),
|
|
2681
|
-
assignErrorPollingForConfirmation:
|
|
2491
|
+
assignErrorPollingForConfirmation: F({
|
|
2682
2492
|
error: ({ event: e }) => Q(e),
|
|
2683
2493
|
errorStep: () => "pollingForConfirmation"
|
|
2684
2494
|
}),
|
|
2685
|
-
assignErrorUploadingData:
|
|
2495
|
+
assignErrorUploadingData: F({
|
|
2686
2496
|
error: ({ event: e }) => Q(e),
|
|
2687
2497
|
errorStep: () => "uploadingData"
|
|
2688
2498
|
}),
|
|
2689
|
-
assignErrorPreparingHtmlEmbedded:
|
|
2499
|
+
assignErrorPreparingHtmlEmbedded: F({
|
|
2690
2500
|
error: ({ event: e }) => Q(e),
|
|
2691
2501
|
errorStep: () => "preparingHtmlEmbedded"
|
|
2692
2502
|
}),
|
|
2693
|
-
assignErrorRewritingHtmlEmbedded:
|
|
2503
|
+
assignErrorRewritingHtmlEmbedded: F({
|
|
2694
2504
|
error: ({ event: e }) => Q(e),
|
|
2695
2505
|
errorStep: () => "rewritingHtmlEmbedded"
|
|
2696
2506
|
}),
|
|
2697
|
-
assignErrorCreatingArweaveTransactionsPhase2:
|
|
2507
|
+
assignErrorCreatingArweaveTransactionsPhase2: F({
|
|
2698
2508
|
error: ({ event: e }) => Q(e),
|
|
2699
2509
|
errorStep: () => "creatingArweaveTransactionsPhase2"
|
|
2700
2510
|
}),
|
|
2701
|
-
assignErrorUploadingDataPhase2:
|
|
2511
|
+
assignErrorUploadingDataPhase2: F({
|
|
2702
2512
|
error: ({ event: e }) => Q(e),
|
|
2703
2513
|
errorStep: () => "uploadingDataPhase2"
|
|
2704
2514
|
}),
|
|
2705
|
-
assignErrorUploadingViaBundler:
|
|
2515
|
+
assignErrorUploadingViaBundler: F({
|
|
2706
2516
|
error: ({ event: e }) => Q(e),
|
|
2707
2517
|
errorStep: () => "uploadingViaBundler"
|
|
2708
2518
|
}),
|
|
2709
|
-
assignErrorCreatingArweaveDataItemsPhase2:
|
|
2519
|
+
assignErrorCreatingArweaveDataItemsPhase2: F({
|
|
2710
2520
|
error: ({ event: e }) => Q(e),
|
|
2711
2521
|
errorStep: () => "creatingArweaveDataItemsPhase2"
|
|
2712
2522
|
}),
|
|
2713
|
-
assignErrorUploadingViaBundlerPhase2:
|
|
2523
|
+
assignErrorUploadingViaBundlerPhase2: F({
|
|
2714
2524
|
error: ({ event: e }) => Q(e),
|
|
2715
2525
|
errorStep: () => "uploadingViaBundlerPhase2"
|
|
2716
2526
|
}),
|
|
2717
|
-
assignErrorCreatingAttestations:
|
|
2527
|
+
assignErrorCreatingAttestations: F({
|
|
2718
2528
|
error: ({ event: e }) => Q(e),
|
|
2719
2529
|
errorStep: () => "creatingAttestations"
|
|
2720
2530
|
}),
|
|
2721
|
-
assignErrorCreatingAttestationsDirectToEas:
|
|
2531
|
+
assignErrorCreatingAttestationsDirectToEas: F({
|
|
2722
2532
|
error: ({ event: e }) => Q(e),
|
|
2723
2533
|
errorStep: () => "creatingAttestationsDirectToEas"
|
|
2724
2534
|
}),
|
|
2725
|
-
assignAccountFromRetry:
|
|
2535
|
+
assignAccountFromRetry: F({
|
|
2726
2536
|
wallet: ({ event: e }) => {
|
|
2727
2537
|
let t = e;
|
|
2728
2538
|
return t.wallet ?? t.account;
|
|
@@ -2732,18 +2542,18 @@ var Wa = Ut({
|
|
|
2732
2542
|
return t.wallet ?? t.account;
|
|
2733
2543
|
}
|
|
2734
2544
|
}),
|
|
2735
|
-
assignErrorNotOwner:
|
|
2545
|
+
assignErrorNotOwner: F({
|
|
2736
2546
|
error: () => /* @__PURE__ */ Error("Item is read-only: you do not own this item. Only the publisher can publish."),
|
|
2737
2547
|
errorStep: () => "checking"
|
|
2738
2548
|
}),
|
|
2739
|
-
assignErrorValidationFailed:
|
|
2549
|
+
assignErrorValidationFailed: F({
|
|
2740
2550
|
error: ({ event: e }) => {
|
|
2741
2551
|
let t = e.errors ?? [], n = t.length > 0 ? `Validation failed (${t.length} error${t.length === 1 ? "" : "s"}):\n${t.map((e) => e.message).join("\n")}` : "Validation failed", r = Error(n);
|
|
2742
2552
|
return r.validationErrors = t, r;
|
|
2743
2553
|
},
|
|
2744
2554
|
errorStep: () => "checking"
|
|
2745
2555
|
}),
|
|
2746
|
-
assignErrorCheckingFailed:
|
|
2556
|
+
assignErrorCheckingFailed: F({
|
|
2747
2557
|
error: ({ event: e }) => {
|
|
2748
2558
|
let t = e.error;
|
|
2749
2559
|
return t instanceof Error ? t : Error(String(t ?? "Publish check failed"));
|
|
@@ -2773,24 +2583,24 @@ var Wa = Ut({
|
|
|
2773
2583
|
},
|
|
2774
2584
|
validPublishProcess: {
|
|
2775
2585
|
target: "preparingHtmlEmbedded",
|
|
2776
|
-
actions:
|
|
2586
|
+
actions: F({ attestationStrategy: ({ event: e }) => e.attestationStrategy })
|
|
2777
2587
|
},
|
|
2778
2588
|
validPublishProcessBundler: {
|
|
2779
2589
|
target: "preparingHtmlEmbedded",
|
|
2780
|
-
actions:
|
|
2590
|
+
actions: F({ attestationStrategy: ({ event: e }) => e.attestationStrategy })
|
|
2781
2591
|
},
|
|
2782
2592
|
skipArweave: [{
|
|
2783
|
-
guard: ({ context: e }) =>
|
|
2593
|
+
guard: ({ context: e }) => Ca(e),
|
|
2784
2594
|
target: "creatingAttestationsDirectToEas",
|
|
2785
|
-
actions:
|
|
2595
|
+
actions: F({
|
|
2786
2596
|
arweaveTransactions: () => [],
|
|
2787
2597
|
publishUploads: () => [],
|
|
2788
2598
|
attestationStrategy: ({ event: e }) => e.attestationStrategy
|
|
2789
2599
|
})
|
|
2790
2600
|
}, {
|
|
2791
|
-
guard: ({ context: e }) =>
|
|
2601
|
+
guard: ({ context: e }) => wa(e),
|
|
2792
2602
|
target: "creatingAttestations",
|
|
2793
|
-
actions:
|
|
2603
|
+
actions: F({
|
|
2794
2604
|
arweaveTransactions: () => [],
|
|
2795
2605
|
publishUploads: () => [],
|
|
2796
2606
|
attestationStrategy: ({ event: e }) => e.attestationStrategy
|
|
@@ -2808,10 +2618,10 @@ var Wa = Ut({
|
|
|
2808
2618
|
onDone: [{
|
|
2809
2619
|
guard: () => D().useArweaveBundler,
|
|
2810
2620
|
target: "creatingArweaveDataItems",
|
|
2811
|
-
actions:
|
|
2621
|
+
actions: F({ htmlEmbeddedDeferredHtmlSeedLocalIds: ({ event: e }) => e.output.deferredHtmlSeedLocalIds })
|
|
2812
2622
|
}, {
|
|
2813
2623
|
target: "creatingArweaveTransactions",
|
|
2814
|
-
actions:
|
|
2624
|
+
actions: F({ htmlEmbeddedDeferredHtmlSeedLocalIds: ({ event: e }) => e.output.deferredHtmlSeedLocalIds })
|
|
2815
2625
|
}],
|
|
2816
2626
|
onError: {
|
|
2817
2627
|
target: Z,
|
|
@@ -2826,7 +2636,7 @@ var Wa = Ut({
|
|
|
2826
2636
|
}),
|
|
2827
2637
|
onDone: {
|
|
2828
2638
|
target: "sendingReimbursementRequest",
|
|
2829
|
-
actions:
|
|
2639
|
+
actions: F({
|
|
2830
2640
|
arweaveTransactions: ({ event: e }) => e.output.arweaveTransactions,
|
|
2831
2641
|
publishUploads: ({ event: e }) => e.output.publishUploads
|
|
2832
2642
|
})
|
|
@@ -2844,7 +2654,7 @@ var Wa = Ut({
|
|
|
2844
2654
|
}),
|
|
2845
2655
|
onDone: {
|
|
2846
2656
|
target: "uploadingViaBundler",
|
|
2847
|
-
actions:
|
|
2657
|
+
actions: F({
|
|
2848
2658
|
arweaveTransactions: ({ event: e }) => e.output.arweaveTransactions,
|
|
2849
2659
|
publishUploads: ({ event: e }) => e.output.publishUploads,
|
|
2850
2660
|
signedDataItems: ({ event: e }) => e.output.signedDataItems
|
|
@@ -2863,7 +2673,7 @@ var Wa = Ut({
|
|
|
2863
2673
|
}),
|
|
2864
2674
|
onDone: {
|
|
2865
2675
|
target: "pollingForConfirmation",
|
|
2866
|
-
actions:
|
|
2676
|
+
actions: F({
|
|
2867
2677
|
requestResponse: ({ event: e }) => e.output,
|
|
2868
2678
|
reimbursementTransactionId: ({ event: e }) => e.output.transactionId
|
|
2869
2679
|
})
|
|
@@ -2881,7 +2691,7 @@ var Wa = Ut({
|
|
|
2881
2691
|
}),
|
|
2882
2692
|
onDone: {
|
|
2883
2693
|
target: "uploadingData",
|
|
2884
|
-
actions:
|
|
2694
|
+
actions: F({ reimbursementConfirmed: !0 })
|
|
2885
2695
|
},
|
|
2886
2696
|
onError: {
|
|
2887
2697
|
target: "failure",
|
|
@@ -2892,9 +2702,9 @@ var Wa = Ut({
|
|
|
2892
2702
|
on: {
|
|
2893
2703
|
uploadComplete: [
|
|
2894
2704
|
{
|
|
2895
|
-
guard: ({ context: e }) =>
|
|
2705
|
+
guard: ({ context: e }) => Ca(e),
|
|
2896
2706
|
target: "creatingAttestationsDirectToEas",
|
|
2897
|
-
actions:
|
|
2707
|
+
actions: F({
|
|
2898
2708
|
completionPercentage: 100,
|
|
2899
2709
|
signedDataItems: () => void 0,
|
|
2900
2710
|
arweaveUploadData: () => void 0
|
|
@@ -2903,7 +2713,7 @@ var Wa = Ut({
|
|
|
2903
2713
|
{
|
|
2904
2714
|
guard: (e) => (e.context?.htmlEmbeddedDeferredHtmlSeedLocalIds?.length ?? 0) > 0,
|
|
2905
2715
|
target: "rewritingHtmlEmbedded",
|
|
2906
|
-
actions:
|
|
2716
|
+
actions: F({
|
|
2907
2717
|
htmlEmbeddedPhase1PublishUploads: ({ context: e }) => e.publishUploads ?? [],
|
|
2908
2718
|
htmlEmbeddedPhase1ArweaveTransactions: ({ context: e }) => e.arweaveTransactions ?? [],
|
|
2909
2719
|
signedDataItems: () => void 0,
|
|
@@ -2911,9 +2721,9 @@ var Wa = Ut({
|
|
|
2911
2721
|
})
|
|
2912
2722
|
},
|
|
2913
2723
|
{
|
|
2914
|
-
guard: ({ context: e }) =>
|
|
2724
|
+
guard: ({ context: e }) => wa(e),
|
|
2915
2725
|
target: "creatingAttestations",
|
|
2916
|
-
actions:
|
|
2726
|
+
actions: F({
|
|
2917
2727
|
completionPercentage: 100,
|
|
2918
2728
|
signedDataItems: () => void 0,
|
|
2919
2729
|
arweaveUploadData: () => void 0
|
|
@@ -2938,7 +2748,7 @@ var Wa = Ut({
|
|
|
2938
2748
|
}),
|
|
2939
2749
|
onDone: {
|
|
2940
2750
|
target: "uploadingViaBundlerPhase2",
|
|
2941
|
-
actions:
|
|
2751
|
+
actions: F({
|
|
2942
2752
|
arweaveTransactions: ({ event: e }) => e.output.arweaveTransactions,
|
|
2943
2753
|
publishUploads: ({ event: e }) => e.output.publishUploads,
|
|
2944
2754
|
signedDataItems: ({ event: e }) => e.output.signedDataItems,
|
|
@@ -2954,17 +2764,17 @@ var Wa = Ut({
|
|
|
2954
2764
|
uploadingViaBundlerPhase2: {
|
|
2955
2765
|
on: {
|
|
2956
2766
|
uploadComplete: [{
|
|
2957
|
-
guard: ({ context: e }) =>
|
|
2767
|
+
guard: ({ context: e }) => Ca(e),
|
|
2958
2768
|
target: "creatingAttestationsDirectToEas",
|
|
2959
|
-
actions:
|
|
2769
|
+
actions: F({
|
|
2960
2770
|
completionPercentage: 100,
|
|
2961
2771
|
signedDataItems: () => void 0,
|
|
2962
2772
|
arweaveUploadData: () => void 0
|
|
2963
2773
|
})
|
|
2964
2774
|
}, {
|
|
2965
|
-
guard: ({ context: e }) =>
|
|
2775
|
+
guard: ({ context: e }) => wa(e),
|
|
2966
2776
|
target: "creatingAttestations",
|
|
2967
|
-
actions:
|
|
2777
|
+
actions: F({
|
|
2968
2778
|
completionPercentage: 100,
|
|
2969
2779
|
signedDataItems: () => void 0,
|
|
2970
2780
|
arweaveUploadData: () => void 0,
|
|
@@ -2984,29 +2794,29 @@ var Wa = Ut({
|
|
|
2984
2794
|
},
|
|
2985
2795
|
uploadingData: {
|
|
2986
2796
|
on: {
|
|
2987
|
-
updatePercentage: { actions:
|
|
2797
|
+
updatePercentage: { actions: F({
|
|
2988
2798
|
completionPercentage: ({ event: e }) => e.completionPercentage,
|
|
2989
2799
|
uploaderState: ({ event: e }) => e.uploaderState,
|
|
2990
2800
|
currentTransactionIndex: ({ event: e }) => e.currentTransactionIndex
|
|
2991
2801
|
}) },
|
|
2992
2802
|
uploadComplete: [
|
|
2993
2803
|
{
|
|
2994
|
-
guard: ({ context: e }) =>
|
|
2804
|
+
guard: ({ context: e }) => Ca(e),
|
|
2995
2805
|
target: "creatingAttestationsDirectToEas",
|
|
2996
|
-
actions:
|
|
2806
|
+
actions: F({ completionPercentage: 100 })
|
|
2997
2807
|
},
|
|
2998
2808
|
{
|
|
2999
2809
|
guard: (e) => (e.context?.htmlEmbeddedDeferredHtmlSeedLocalIds?.length ?? 0) > 0,
|
|
3000
2810
|
target: "rewritingHtmlEmbedded",
|
|
3001
|
-
actions:
|
|
2811
|
+
actions: F({
|
|
3002
2812
|
htmlEmbeddedPhase1PublishUploads: ({ context: e }) => e.publishUploads ?? [],
|
|
3003
2813
|
htmlEmbeddedPhase1ArweaveTransactions: ({ context: e }) => e.arweaveTransactions ?? []
|
|
3004
2814
|
})
|
|
3005
2815
|
},
|
|
3006
2816
|
{
|
|
3007
|
-
guard: ({ context: e }) =>
|
|
2817
|
+
guard: ({ context: e }) => wa(e),
|
|
3008
2818
|
target: "creatingAttestations",
|
|
3009
|
-
actions:
|
|
2819
|
+
actions: F({ completionPercentage: 100 })
|
|
3010
2820
|
}
|
|
3011
2821
|
],
|
|
3012
2822
|
uploadError: {
|
|
@@ -3042,7 +2852,7 @@ var Wa = Ut({
|
|
|
3042
2852
|
}),
|
|
3043
2853
|
onDone: {
|
|
3044
2854
|
target: "uploadingDataPhase2",
|
|
3045
|
-
actions:
|
|
2855
|
+
actions: F({
|
|
3046
2856
|
arweaveTransactions: ({ event: e }) => e.output.arweaveTransactions,
|
|
3047
2857
|
publishUploads: ({ event: e }) => e.output.publishUploads,
|
|
3048
2858
|
uploaderState: () => void 0,
|
|
@@ -3056,19 +2866,19 @@ var Wa = Ut({
|
|
|
3056
2866
|
} },
|
|
3057
2867
|
uploadingDataPhase2: {
|
|
3058
2868
|
on: {
|
|
3059
|
-
updatePercentage: { actions:
|
|
2869
|
+
updatePercentage: { actions: F({
|
|
3060
2870
|
completionPercentage: ({ event: e }) => e.completionPercentage,
|
|
3061
2871
|
uploaderState: ({ event: e }) => e.uploaderState,
|
|
3062
2872
|
currentTransactionIndex: ({ event: e }) => e.currentTransactionIndex
|
|
3063
2873
|
}) },
|
|
3064
2874
|
uploadComplete: [{
|
|
3065
|
-
guard: ({ context: e }) =>
|
|
2875
|
+
guard: ({ context: e }) => Ca(e),
|
|
3066
2876
|
target: "creatingAttestationsDirectToEas",
|
|
3067
|
-
actions:
|
|
2877
|
+
actions: F({ completionPercentage: 100 })
|
|
3068
2878
|
}, {
|
|
3069
|
-
guard: ({ context: e }) =>
|
|
2879
|
+
guard: ({ context: e }) => wa(e),
|
|
3070
2880
|
target: "creatingAttestations",
|
|
3071
|
-
actions:
|
|
2881
|
+
actions: F({
|
|
3072
2882
|
completionPercentage: 100,
|
|
3073
2883
|
publishUploads: ({ context: e }) => [...e.htmlEmbeddedPhase1PublishUploads ?? [], ...e.publishUploads ?? []],
|
|
3074
2884
|
arweaveTransactions: ({ context: e }) => [...e.htmlEmbeddedPhase1ArweaveTransactions ?? [], ...e.arweaveTransactions ?? []]
|
|
@@ -3091,8 +2901,8 @@ var Wa = Ut({
|
|
|
3091
2901
|
event: t
|
|
3092
2902
|
}),
|
|
3093
2903
|
onDone: {
|
|
3094
|
-
target:
|
|
3095
|
-
actions:
|
|
2904
|
+
target: Sa,
|
|
2905
|
+
actions: F({
|
|
3096
2906
|
easPayload: ({ event: e }) => e.output?.easPayload,
|
|
3097
2907
|
publishedBatch: ({ event: e }) => e.output?.publishedBatch ?? null
|
|
3098
2908
|
})
|
|
@@ -3113,8 +2923,8 @@ var Wa = Ut({
|
|
|
3113
2923
|
event: t
|
|
3114
2924
|
}),
|
|
3115
2925
|
onDone: {
|
|
3116
|
-
target:
|
|
3117
|
-
actions:
|
|
2926
|
+
target: Sa,
|
|
2927
|
+
actions: F({
|
|
3118
2928
|
easPayload: ({ event: e }) => e.output?.easPayload,
|
|
3119
2929
|
publishedBatch: ({ event: e }) => e.output?.publishedBatch ?? null
|
|
3120
2930
|
})
|
|
@@ -3134,7 +2944,7 @@ var Wa = Ut({
|
|
|
3134
2944
|
},
|
|
3135
2945
|
type: "final"
|
|
3136
2946
|
},
|
|
3137
|
-
[
|
|
2947
|
+
[Sa]: {
|
|
3138
2948
|
entry: ({ context: e }) => {
|
|
3139
2949
|
let t = e.publishedBatch, n = e.onPublished;
|
|
3140
2950
|
if (!n || !t?.seedUid) return;
|
|
@@ -3155,38 +2965,38 @@ var Wa = Ut({
|
|
|
3155
2965
|
type: "final"
|
|
3156
2966
|
}
|
|
3157
2967
|
}
|
|
3158
|
-
}),
|
|
2968
|
+
}), Ea = F(({ context: e, event: t }) => {
|
|
3159
2969
|
let n = t, r = n.publishProcesses ?? /* @__PURE__ */ new Map(), i = n.subscriptions ?? /* @__PURE__ */ new Map();
|
|
3160
2970
|
return {
|
|
3161
2971
|
publishProcesses: new Map(r),
|
|
3162
2972
|
subscriptions: new Map(i)
|
|
3163
2973
|
};
|
|
3164
|
-
}),
|
|
3165
|
-
function
|
|
3166
|
-
|
|
2974
|
+
}), Da = null;
|
|
2975
|
+
function Oa(e) {
|
|
2976
|
+
Da = e;
|
|
3167
2977
|
}
|
|
3168
|
-
function
|
|
3169
|
-
return
|
|
2978
|
+
function ka() {
|
|
2979
|
+
return Da;
|
|
3170
2980
|
}
|
|
3171
2981
|
//#endregion
|
|
3172
2982
|
//#region src/services/publishManager/actors/subscribe.ts
|
|
3173
|
-
var
|
|
3174
|
-
function
|
|
2983
|
+
var Aa = L("seedProtocol:services:PublishManager:actors:subscribe");
|
|
2984
|
+
function ja(e) {
|
|
3175
2985
|
let t = e.value;
|
|
3176
2986
|
return typeof t == "string" ? t : t && typeof t == "object" ? Object.keys(t)[0] ?? "" : "";
|
|
3177
2987
|
}
|
|
3178
|
-
function
|
|
2988
|
+
function Ma(e) {
|
|
3179
2989
|
return a.includes(e);
|
|
3180
2990
|
}
|
|
3181
|
-
var
|
|
3182
|
-
let i =
|
|
2991
|
+
var Na = Lt(({ receive: e, input: { publishProcess: n, seedLocalId: r } }) => {
|
|
2992
|
+
let i = ka(), a = null, o = () => {
|
|
3183
2993
|
a != null && (clearInterval(a), a = null);
|
|
3184
2994
|
}, s = (e) => {
|
|
3185
|
-
let s =
|
|
3186
|
-
|
|
2995
|
+
let s = ja(e);
|
|
2996
|
+
Ma(s) && a == null && i ? a = setInterval(() => {
|
|
3187
2997
|
try {
|
|
3188
2998
|
let e = n.getSnapshot();
|
|
3189
|
-
if (e.status === "done" || !
|
|
2999
|
+
if (e.status === "done" || !Ma(ja(e))) {
|
|
3190
3000
|
o();
|
|
3191
3001
|
return;
|
|
3192
3002
|
}
|
|
@@ -3194,26 +3004,26 @@ var Qa = Ht(({ receive: e, input: { publishProcess: n, seedLocalId: r } }) => {
|
|
|
3194
3004
|
return;
|
|
3195
3005
|
}
|
|
3196
3006
|
i?.savePublish(r, n);
|
|
3197
|
-
}, t) :
|
|
3007
|
+
}, t) : Ma(s) || o();
|
|
3198
3008
|
}, c = n.subscribe(async (e) => {
|
|
3199
|
-
|
|
3009
|
+
Aa("Publish state:", e.value), i && (e.status === "done" ? (o(), i.savePublish(r, n, { triggerPublishDone: !0 })) : (i.savePublish(r, n), s(e)));
|
|
3200
3010
|
});
|
|
3201
3011
|
e(({ type: e }) => {
|
|
3202
|
-
e === "UNSUBSCRIBE" && (
|
|
3012
|
+
e === "UNSUBSCRIBE" && (Aa("Received UNSUBSCRIBE event"), o(), c.unsubscribe(), i?.removeSubscription(r));
|
|
3203
3013
|
});
|
|
3204
|
-
}),
|
|
3205
|
-
function
|
|
3206
|
-
let t =
|
|
3207
|
-
return
|
|
3014
|
+
}), Pa = /* @__PURE__ */ new Map(), Fa = 1;
|
|
3015
|
+
function Ia(e) {
|
|
3016
|
+
let t = Fa++;
|
|
3017
|
+
return Pa.set(t, e), t;
|
|
3208
3018
|
}
|
|
3209
|
-
function
|
|
3019
|
+
function La(e, t) {
|
|
3210
3020
|
if (e == null) return;
|
|
3211
|
-
let n =
|
|
3212
|
-
n && (
|
|
3021
|
+
let n = Pa.get(e);
|
|
3022
|
+
n && (Pa.delete(e), n(t));
|
|
3213
3023
|
}
|
|
3214
3024
|
//#endregion
|
|
3215
3025
|
//#region src/services/publishManager/actions/createPublish.ts
|
|
3216
|
-
function
|
|
3026
|
+
function Ra(e) {
|
|
3217
3027
|
if (e) {
|
|
3218
3028
|
if (i(e)) return e;
|
|
3219
3029
|
if (m(e)) {
|
|
@@ -3224,19 +3034,19 @@ function ro(e) {
|
|
|
3224
3034
|
throw Error("@seedprotocol/publish: createPublish account must be a PublishWallet. Thirdweb Account must be wrapped with fromThirdwebAccount from @seedprotocol/publish/thirdweb.");
|
|
3225
3035
|
}
|
|
3226
3036
|
}
|
|
3227
|
-
function
|
|
3037
|
+
function za(e) {
|
|
3228
3038
|
if (e) {
|
|
3229
|
-
if (e instanceof
|
|
3039
|
+
if (e instanceof P.Wallet) return e;
|
|
3230
3040
|
if (i(e)) return e.signer;
|
|
3231
3041
|
if (m(e)) return e;
|
|
3232
3042
|
}
|
|
3233
3043
|
}
|
|
3234
|
-
var
|
|
3044
|
+
var Ba = It(({ event: e, enqueue: t }) => {
|
|
3235
3045
|
let { item: n, address: r, account: i, options: a, createToken: o } = e;
|
|
3236
3046
|
r != null && typeof r == "string" && r.trim().length > 0 ? (t.assign(({ context: e, spawn: t }) => {
|
|
3237
3047
|
let { publishProcesses: s } = e;
|
|
3238
|
-
if (s && s.has(n.seedLocalId)) return console.warn(`Publish process with seedLocalId "${n.seedLocalId}" already exists.`),
|
|
3239
|
-
let c = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `run_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`, l = D(), u = [...l.arweaveUploadTags ?? [], ...a?.arweaveUploadTags ?? []], d =
|
|
3048
|
+
if (s && s.has(n.seedLocalId)) return console.warn(`Publish process with seedLocalId "${n.seedLocalId}" already exists.`), La(o, void 0), e;
|
|
3049
|
+
let c = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `run_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`, l = D(), u = [...l.arweaveUploadTags ?? [], ...a?.arweaveUploadTags ?? []], d = Ra(i) ?? pe() ?? void 0, f = t(Ta, { input: {
|
|
3240
3050
|
item: n,
|
|
3241
3051
|
address: r,
|
|
3242
3052
|
wallet: d,
|
|
@@ -3244,7 +3054,7 @@ var ao = Vt(({ event: e, enqueue: t }) => {
|
|
|
3244
3054
|
modelName: n.modelName,
|
|
3245
3055
|
schemaId: n.schemaUid,
|
|
3246
3056
|
signDataItems: a?.signDataItems,
|
|
3247
|
-
dataItemSigner:
|
|
3057
|
+
dataItemSigner: za(a?.dataItemSigner),
|
|
3248
3058
|
signArweaveTransactions: a?.signArweaveTransactions,
|
|
3249
3059
|
arweaveJwk: a?.arweaveJwk,
|
|
3250
3060
|
publishMode: a?.publishMode ?? "patch",
|
|
@@ -3255,7 +3065,7 @@ var ao = Vt(({ event: e, enqueue: t }) => {
|
|
|
3255
3065
|
} });
|
|
3256
3066
|
s.set(n.seedLocalId, f);
|
|
3257
3067
|
let p = new Map(e.settledPublishes);
|
|
3258
|
-
return p.delete(n.seedLocalId),
|
|
3068
|
+
return p.delete(n.seedLocalId), La(o, f), {
|
|
3259
3069
|
...e,
|
|
3260
3070
|
publishProcesses: s,
|
|
3261
3071
|
settledPublishes: p
|
|
@@ -3264,7 +3074,7 @@ var ao = Vt(({ event: e, enqueue: t }) => {
|
|
|
3264
3074
|
let { subscriptions: r, publishProcesses: i } = e, a = i.get(n.seedLocalId);
|
|
3265
3075
|
if (!a) return console.warn(`Publish process with seedLocalId "${n.seedLocalId}" does not exist.`), e;
|
|
3266
3076
|
if (r.has(n.seedLocalId)) return console.warn(`Subscription with seedLocalId "${n.seedLocalId}" already exists.`), e;
|
|
3267
|
-
let o = t(
|
|
3077
|
+
let o = t(Na, { input: {
|
|
3268
3078
|
publishProcess: a,
|
|
3269
3079
|
seedLocalId: n.seedLocalId
|
|
3270
3080
|
} });
|
|
@@ -3272,8 +3082,8 @@ var ao = Vt(({ event: e, enqueue: t }) => {
|
|
|
3272
3082
|
...e,
|
|
3273
3083
|
subscriptions: new Map(r)
|
|
3274
3084
|
};
|
|
3275
|
-
})) : (console.warn("[createPublish] No valid wallet address; skipping spawn."),
|
|
3276
|
-
}),
|
|
3085
|
+
})) : (console.warn("[createPublish] No valid wallet address; skipping spawn."), La(o, void 0));
|
|
3086
|
+
}), Va = ({ context: e, event: t }) => {
|
|
3277
3087
|
let { seedLocalId: n, account: r } = t, a = e.publishProcesses.get(n);
|
|
3278
3088
|
if (!a) {
|
|
3279
3089
|
console.warn(`Publish process with seedLocalId "${n}" does not exist.`);
|
|
@@ -3288,32 +3098,32 @@ var ao = Vt(({ event: e, enqueue: t }) => {
|
|
|
3288
3098
|
};
|
|
3289
3099
|
//#endregion
|
|
3290
3100
|
//#region src/services/publishManager/actions/stopScopedOrStandaloneChild.ts
|
|
3291
|
-
function
|
|
3101
|
+
function Ha(e, t, n) {
|
|
3292
3102
|
t._parent === e ? n.stopChild(t) : t.stop();
|
|
3293
3103
|
}
|
|
3294
3104
|
//#endregion
|
|
3295
3105
|
//#region src/services/publishManager/actors/savePublish.ts
|
|
3296
|
-
var
|
|
3297
|
-
function
|
|
3298
|
-
let n = (
|
|
3299
|
-
return
|
|
3106
|
+
var Ua = L("seedProtocol:services:PublishManager:actors:savePublish"), Wa = /* @__PURE__ */ new Map();
|
|
3107
|
+
function Ga(e, t) {
|
|
3108
|
+
let n = (Wa.get(e) ?? Promise.resolve()).then(t);
|
|
3109
|
+
return Wa.set(e, n.catch(() => {})), n;
|
|
3300
3110
|
}
|
|
3301
|
-
function
|
|
3111
|
+
function Ka(e) {
|
|
3302
3112
|
return e === "completed" || e === "failed" || e === "interrupted";
|
|
3303
3113
|
}
|
|
3304
|
-
function
|
|
3114
|
+
function qa(e) {
|
|
3305
3115
|
return e.status === "done" ? e.value === "success" ? "completed" : e.value === "failure" ? "failed" : "completed" : "in_progress";
|
|
3306
3116
|
}
|
|
3307
|
-
var
|
|
3308
|
-
function
|
|
3117
|
+
var Ja = 500, Ya = 2e3, Xa = 100;
|
|
3118
|
+
function Za(e) {
|
|
3309
3119
|
return JSON.stringify(e, (e, t) => typeof t == "bigint" ? t.toString() : t);
|
|
3310
3120
|
}
|
|
3311
|
-
function
|
|
3121
|
+
function Qa(e) {
|
|
3312
3122
|
if (typeof e != "object" || !e) return;
|
|
3313
3123
|
let t = e, n = t.snapshot, r = (t.context ?? n?.context)?.publishRunId;
|
|
3314
3124
|
return typeof r == "string" && r.length > 0 ? r : void 0;
|
|
3315
3125
|
}
|
|
3316
|
-
function
|
|
3126
|
+
function $a(e) {
|
|
3317
3127
|
if (e instanceof Error) return e.message;
|
|
3318
3128
|
if (typeof e == "object") {
|
|
3319
3129
|
let t = e.message;
|
|
@@ -3321,21 +3131,21 @@ function yo(e) {
|
|
|
3321
3131
|
}
|
|
3322
3132
|
return String(e);
|
|
3323
3133
|
}
|
|
3324
|
-
function
|
|
3134
|
+
function eo(e) {
|
|
3325
3135
|
if (typeof e != "object" || !e) return;
|
|
3326
3136
|
let t = e.code;
|
|
3327
|
-
return typeof t == "string" && t.length > 0 ? t.slice(0,
|
|
3137
|
+
return typeof t == "string" && t.length > 0 ? t.slice(0, Xa) : void 0;
|
|
3328
3138
|
}
|
|
3329
|
-
function
|
|
3139
|
+
function to(e, t) {
|
|
3330
3140
|
if (!e?.error || t !== "failed" && t !== "in_progress") return {};
|
|
3331
|
-
let n = e.error, r =
|
|
3332
|
-
if (n instanceof Error && n.stack) o = n.stack.slice(0,
|
|
3141
|
+
let n = e.error, r = $a(n)?.slice(0, Ja), i = e.errorStep, a = eo(n), o;
|
|
3142
|
+
if (n instanceof Error && n.stack) o = n.stack.slice(0, Ya);
|
|
3333
3143
|
else if (typeof n == "object" && n) try {
|
|
3334
|
-
o = JSON.stringify(n).slice(0,
|
|
3144
|
+
o = JSON.stringify(n).slice(0, Ya);
|
|
3335
3145
|
} catch {
|
|
3336
|
-
o = String(n).slice(0,
|
|
3146
|
+
o = String(n).slice(0, Ya);
|
|
3337
3147
|
}
|
|
3338
|
-
else n != null && (o = String(n).slice(0,
|
|
3148
|
+
else n != null && (o = String(n).slice(0, Ya));
|
|
3339
3149
|
return {
|
|
3340
3150
|
...r === void 0 ? {} : { errorMessage: r },
|
|
3341
3151
|
errorStep: i,
|
|
@@ -3343,17 +3153,17 @@ function xo(e, t) {
|
|
|
3343
3153
|
errorCode: a ?? null
|
|
3344
3154
|
};
|
|
3345
3155
|
}
|
|
3346
|
-
function
|
|
3347
|
-
return
|
|
3156
|
+
function no(e) {
|
|
3157
|
+
return Ga(e, async () => {
|
|
3348
3158
|
let t = ke.getAppDb();
|
|
3349
3159
|
if (!t) {
|
|
3350
|
-
|
|
3160
|
+
Ua("markInProgressPublishInterrupted: DB not ready, skipping");
|
|
3351
3161
|
return;
|
|
3352
3162
|
}
|
|
3353
|
-
let n = await t.select().from(
|
|
3163
|
+
let n = await t.select().from(N).where(Wt(R(N.seedLocalId, e), R(N.status, "in_progress"))).orderBy(Gt(N.updatedAt)).limit(1);
|
|
3354
3164
|
if (n.length === 0) return;
|
|
3355
3165
|
let r = Date.now();
|
|
3356
|
-
await t.update(
|
|
3166
|
+
await t.update(N).set({
|
|
3357
3167
|
status: "interrupted",
|
|
3358
3168
|
completedAt: r,
|
|
3359
3169
|
updatedAt: r,
|
|
@@ -3361,45 +3171,45 @@ function So(e) {
|
|
|
3361
3171
|
errorStep: null,
|
|
3362
3172
|
errorDetails: null,
|
|
3363
3173
|
errorCode: null
|
|
3364
|
-
}).where(
|
|
3174
|
+
}).where(R(N.id, n[0].id));
|
|
3365
3175
|
});
|
|
3366
3176
|
}
|
|
3367
|
-
var
|
|
3368
|
-
|
|
3177
|
+
var ro = Lt(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, triggerPublishDone: r } }) => {
|
|
3178
|
+
Ua("savePublish seedLocalId", n);
|
|
3369
3179
|
let i = t;
|
|
3370
|
-
|
|
3180
|
+
Ga(n, async () => {
|
|
3371
3181
|
let a = ke.getAppDb();
|
|
3372
3182
|
if (!a) {
|
|
3373
|
-
|
|
3183
|
+
Ua("savePublish: DB not ready, skipping"), e({
|
|
3374
3184
|
type: "SAVE_PUBLISH_DONE",
|
|
3375
3185
|
seedLocalId: n,
|
|
3376
3186
|
triggerPublishDone: r
|
|
3377
3187
|
});
|
|
3378
3188
|
return;
|
|
3379
3189
|
}
|
|
3380
|
-
let o = await a.select().from(
|
|
3190
|
+
let o = await a.select().from(N).where(Wt(R(N.seedLocalId, n), R(N.status, "in_progress"))).orderBy(Gt(N.updatedAt)).limit(1), s = typeof t == "string" ? t : Za(t), c = qa(i), l = Date.now(), u = to(i.context, c);
|
|
3381
3191
|
if (o.length > 0) {
|
|
3382
3192
|
let e = o[0];
|
|
3383
|
-
await a.update(
|
|
3193
|
+
await a.update(N).set({
|
|
3384
3194
|
persistedSnapshot: s,
|
|
3385
3195
|
status: c,
|
|
3386
3196
|
updatedAt: l,
|
|
3387
3197
|
...i.status === "done" && c !== "in_progress" ? { completedAt: l } : {},
|
|
3388
3198
|
...u
|
|
3389
|
-
}).where(
|
|
3199
|
+
}).where(R(N.id, e.id));
|
|
3390
3200
|
} else {
|
|
3391
|
-
let e =
|
|
3201
|
+
let e = Qa(i);
|
|
3392
3202
|
if (e != null && c === "in_progress" && i.status !== "done") {
|
|
3393
|
-
let t = (await a.select().from(
|
|
3394
|
-
if (t &&
|
|
3395
|
-
if (
|
|
3396
|
-
|
|
3203
|
+
let t = (await a.select().from(N).where(R(N.seedLocalId, n)).orderBy(Gt(N.startedAt)).limit(1))[0];
|
|
3204
|
+
if (t && Ka(t.status)) try {
|
|
3205
|
+
if (Qa(JSON.parse(t.persistedSnapshot)) === e) {
|
|
3206
|
+
Ua("savePublish: skip stale insert — same publishRunId as latest terminal row", n, e);
|
|
3397
3207
|
return;
|
|
3398
3208
|
}
|
|
3399
3209
|
} catch {}
|
|
3400
3210
|
}
|
|
3401
3211
|
let t = i.context?.item, r = i.context?.modelName ?? t?.modelName ?? "", o = i.context?.schemaId ?? t?.schemaId;
|
|
3402
|
-
await a.insert(
|
|
3212
|
+
await a.insert(N).values({
|
|
3403
3213
|
seedLocalId: n,
|
|
3404
3214
|
modelName: r,
|
|
3405
3215
|
schemaId: o ?? null,
|
|
@@ -3418,59 +3228,59 @@ var Co = Ht(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
|
|
|
3418
3228
|
triggerPublishDone: r
|
|
3419
3229
|
});
|
|
3420
3230
|
}).catch((t) => {
|
|
3421
|
-
|
|
3231
|
+
Ua("savePublish error", t), e({
|
|
3422
3232
|
type: "SAVE_PUBLISH_DONE",
|
|
3423
3233
|
seedLocalId: n,
|
|
3424
3234
|
triggerPublishDone: r
|
|
3425
3235
|
});
|
|
3426
3236
|
});
|
|
3427
|
-
}),
|
|
3428
|
-
function
|
|
3237
|
+
}), io = L("seedProtocol:PublishManager:publishLocks"), ao = () => typeof navigator < "u" ? navigator.locks : void 0, oo = /* @__PURE__ */ new Map();
|
|
3238
|
+
function so(e) {
|
|
3429
3239
|
return `seed:publish:${e}`;
|
|
3430
3240
|
}
|
|
3431
|
-
async function
|
|
3432
|
-
if (
|
|
3433
|
-
let t =
|
|
3241
|
+
async function co(e) {
|
|
3242
|
+
if (oo.has(e)) return !0;
|
|
3243
|
+
let t = ao();
|
|
3434
3244
|
return !t || new Promise((n, r) => {
|
|
3435
|
-
t.request(
|
|
3245
|
+
t.request(so(e), {
|
|
3436
3246
|
mode: "exclusive",
|
|
3437
3247
|
ifAvailable: !0
|
|
3438
3248
|
}, (t) => {
|
|
3439
3249
|
if (!t) n(!1);
|
|
3440
3250
|
else return new Promise((t) => {
|
|
3441
|
-
|
|
3442
|
-
|
|
3251
|
+
oo.set(e, () => {
|
|
3252
|
+
oo.delete(e), t();
|
|
3443
3253
|
}), n(!0);
|
|
3444
3254
|
});
|
|
3445
3255
|
}).catch((t) => {
|
|
3446
|
-
|
|
3256
|
+
io(`publish lock request for ${e} failed`, t), r(t);
|
|
3447
3257
|
});
|
|
3448
3258
|
});
|
|
3449
3259
|
}
|
|
3450
|
-
function
|
|
3451
|
-
|
|
3260
|
+
function lo(e) {
|
|
3261
|
+
oo.get(e)?.();
|
|
3452
3262
|
}
|
|
3453
|
-
function
|
|
3454
|
-
for (let e of [...
|
|
3263
|
+
function uo() {
|
|
3264
|
+
for (let e of [...oo.values()]) e();
|
|
3455
3265
|
}
|
|
3456
|
-
function
|
|
3457
|
-
return
|
|
3266
|
+
function fo(e) {
|
|
3267
|
+
return oo.has(e);
|
|
3458
3268
|
}
|
|
3459
3269
|
//#endregion
|
|
3460
3270
|
//#region src/services/publishManager/actions/stopPublish.ts
|
|
3461
|
-
var
|
|
3271
|
+
var po = It(({ context: e, event: t, enqueue: n, self: r }) => {
|
|
3462
3272
|
let { publishProcesses: i, subscriptions: a } = e, { seedLocalId: o } = t;
|
|
3463
|
-
|
|
3273
|
+
no(o).catch((e) => {
|
|
3464
3274
|
console.warn(`[stopPublish] Failed to mark publish_processes row interrupted for "${o}":`, e);
|
|
3465
|
-
}),
|
|
3275
|
+
}), lo(o);
|
|
3466
3276
|
let s = i.get(o);
|
|
3467
3277
|
if (!s) {
|
|
3468
3278
|
console.warn(`Publish process with seedLocalId "${o}" does not exist.`);
|
|
3469
3279
|
return;
|
|
3470
3280
|
}
|
|
3471
|
-
|
|
3281
|
+
Ha(r, s, n);
|
|
3472
3282
|
let c = a.get(o);
|
|
3473
|
-
c &&
|
|
3283
|
+
c && Ha(r, c, n);
|
|
3474
3284
|
let l = new Map(i);
|
|
3475
3285
|
l.delete(o);
|
|
3476
3286
|
let u = new Map(a);
|
|
@@ -3478,16 +3288,16 @@ var Mo = Vt(({ context: e, event: t, enqueue: n, self: r }) => {
|
|
|
3478
3288
|
publishProcesses: l,
|
|
3479
3289
|
subscriptions: u
|
|
3480
3290
|
});
|
|
3481
|
-
}),
|
|
3482
|
-
|
|
3483
|
-
|
|
3291
|
+
}), mo = L("seedProtocol:PublishManager:index"), ho = It(({ context: e, enqueue: t, self: n }) => {
|
|
3292
|
+
mo("Stopping all actors..."), e.publishProcesses.forEach((e) => {
|
|
3293
|
+
Ha(n, e, t);
|
|
3484
3294
|
}), e.subscriptions.forEach((e) => {
|
|
3485
|
-
|
|
3486
|
-
}),
|
|
3295
|
+
Ha(n, e, t);
|
|
3296
|
+
}), uo(), t.assign({
|
|
3487
3297
|
publishProcesses: /* @__PURE__ */ new Map(),
|
|
3488
3298
|
subscriptions: /* @__PURE__ */ new Map()
|
|
3489
3299
|
});
|
|
3490
|
-
}),
|
|
3300
|
+
}), go = It(({ context: e, event: t, enqueue: n }) => {
|
|
3491
3301
|
let { seedLocalId: r } = t, i = e.publishProcesses.get(r);
|
|
3492
3302
|
if (!i) {
|
|
3493
3303
|
console.warn(`Publish process with seedLocalId "${r}" does not exist.`);
|
|
@@ -3503,35 +3313,35 @@ var Mo = Vt(({ context: e, event: t, enqueue: n, self: r }) => {
|
|
|
3503
3313
|
publishProcesses: o,
|
|
3504
3314
|
subscriptions: s
|
|
3505
3315
|
});
|
|
3506
|
-
}),
|
|
3316
|
+
}), _o = F(({ context: e, event: t }) => {
|
|
3507
3317
|
let { subscriptions: n } = e, { seedLocalId: r, newSubscription: i } = t;
|
|
3508
3318
|
return i && n.set(r, i), { subscriptions: new Map(n) };
|
|
3509
|
-
}),
|
|
3510
|
-
function
|
|
3319
|
+
}), vo = ["signedDataItems", "arweaveUploadData"];
|
|
3320
|
+
function yo(e) {
|
|
3511
3321
|
if (typeof e != "object" || !e) return e;
|
|
3512
3322
|
let t = { ...e };
|
|
3513
|
-
for (let e of
|
|
3323
|
+
for (let e of vo) delete t[e];
|
|
3514
3324
|
return t;
|
|
3515
3325
|
}
|
|
3516
|
-
function
|
|
3326
|
+
function bo(e) {
|
|
3517
3327
|
if (typeof e != "object" || !e) return e;
|
|
3518
3328
|
let t = e, n = { ...t };
|
|
3519
|
-
t.context != null && typeof t.context == "object" && (n.context =
|
|
3329
|
+
t.context != null && typeof t.context == "object" && (n.context = yo(t.context));
|
|
3520
3330
|
let r = t.snapshot;
|
|
3521
3331
|
if (typeof r == "object" && r) {
|
|
3522
3332
|
let e = r, t = { ...e };
|
|
3523
|
-
e.context != null && typeof e.context == "object" && (t.context =
|
|
3333
|
+
e.context != null && typeof e.context == "object" && (t.context = yo(e.context)), n.snapshot = t;
|
|
3524
3334
|
}
|
|
3525
3335
|
return n;
|
|
3526
3336
|
}
|
|
3527
|
-
function
|
|
3337
|
+
function xo(e) {
|
|
3528
3338
|
try {
|
|
3529
|
-
return
|
|
3339
|
+
return bo(e.getPersistedSnapshot?.() ?? e.getSnapshot());
|
|
3530
3340
|
} catch {
|
|
3531
3341
|
let t = e.getSnapshot(), n = t.context;
|
|
3532
|
-
if (!n?.item) return
|
|
3342
|
+
if (!n?.item) return bo(t);
|
|
3533
3343
|
let r = n.item;
|
|
3534
|
-
return
|
|
3344
|
+
return bo({
|
|
3535
3345
|
...t,
|
|
3536
3346
|
context: {
|
|
3537
3347
|
...n,
|
|
@@ -3544,13 +3354,13 @@ function Bo(e) {
|
|
|
3544
3354
|
});
|
|
3545
3355
|
}
|
|
3546
3356
|
}
|
|
3547
|
-
var
|
|
3357
|
+
var So = F(({ context: e, event: t, spawn: n }) => {
|
|
3548
3358
|
let { publishProcesses: r } = e, { seedLocalId: i, publishProcess: a, triggerPublishDone: o } = t;
|
|
3549
3359
|
if (!a) return e;
|
|
3550
3360
|
let s = new Map(r);
|
|
3551
3361
|
s.set(i, a);
|
|
3552
|
-
let c =
|
|
3553
|
-
return n(
|
|
3362
|
+
let c = xo(a);
|
|
3363
|
+
return n(ro, {
|
|
3554
3364
|
id: `savePublish_${i}_${Date.now()}`,
|
|
3555
3365
|
input: {
|
|
3556
3366
|
persistedSnapshot: c,
|
|
@@ -3558,9 +3368,9 @@ var Vo = I(({ context: e, event: t, spawn: n }) => {
|
|
|
3558
3368
|
triggerPublishDone: o
|
|
3559
3369
|
}
|
|
3560
3370
|
}), { publishProcesses: s };
|
|
3561
|
-
}),
|
|
3371
|
+
}), Co = F(({ context: e, event: t }) => {
|
|
3562
3372
|
let { publishProcesses: n, subscriptions: r, settledPublishes: i } = e, a = t.seedLocalId;
|
|
3563
|
-
|
|
3373
|
+
lo(a);
|
|
3564
3374
|
let o = r.get(a);
|
|
3565
3375
|
o && o.send({ type: "UNSUBSCRIBE" });
|
|
3566
3376
|
let s = n.get(a), c = new Map(n);
|
|
@@ -3573,17 +3383,17 @@ var Vo = I(({ context: e, event: t, spawn: n }) => {
|
|
|
3573
3383
|
subscriptions: l,
|
|
3574
3384
|
settledPublishes: u
|
|
3575
3385
|
};
|
|
3576
|
-
}),
|
|
3386
|
+
}), wo = F(({ context: e, event: t }) => {
|
|
3577
3387
|
let { subscriptions: n } = e, r = t.seedLocalId, i = new Map(n);
|
|
3578
3388
|
return i.delete(r), { subscriptions: i };
|
|
3579
|
-
}),
|
|
3580
|
-
function
|
|
3389
|
+
}), To = 6e4, Eo = 2e3;
|
|
3390
|
+
function Do(e, t) {
|
|
3581
3391
|
let n = typeof process < "u" ? process.env[e] : void 0;
|
|
3582
3392
|
if (n == null || n === "") return t;
|
|
3583
3393
|
let r = Number(n);
|
|
3584
3394
|
return Number.isFinite(r) && r >= 0 ? r : t;
|
|
3585
3395
|
}
|
|
3586
|
-
async function
|
|
3396
|
+
async function Oo(e, t) {
|
|
3587
3397
|
let n = Date.now() + e;
|
|
3588
3398
|
for (; Date.now() < n;) {
|
|
3589
3399
|
try {
|
|
@@ -3593,12 +3403,12 @@ async function qo(e, t) {
|
|
|
3593
3403
|
}
|
|
3594
3404
|
return !1;
|
|
3595
3405
|
}
|
|
3596
|
-
function
|
|
3406
|
+
function ko(e) {
|
|
3597
3407
|
let t = e.value;
|
|
3598
3408
|
return typeof t == "string" ? t : t && typeof t == "object" ? Object.keys(t)[0] ?? "" : "";
|
|
3599
3409
|
}
|
|
3600
|
-
function
|
|
3601
|
-
let t =
|
|
3410
|
+
function Ao(e) {
|
|
3411
|
+
let t = ko(e);
|
|
3602
3412
|
if (t === "pollingForConfirmation" && (!e.context?.reimbursementTransactionId || !e.context?.requestResponse)) return !1;
|
|
3603
3413
|
if (t === "uploadingData") {
|
|
3604
3414
|
let t = e.context?.arweaveTransactions, n = e.context?.publishUploads;
|
|
@@ -3606,13 +3416,13 @@ function Yo(e) {
|
|
|
3606
3416
|
}
|
|
3607
3417
|
return !0;
|
|
3608
3418
|
}
|
|
3609
|
-
function
|
|
3419
|
+
function jo(e) {
|
|
3610
3420
|
return typeof e == "object" && !!e && "xstate$$type" in e && e.xstate$$type === 1 && typeof e.id == "string";
|
|
3611
3421
|
}
|
|
3612
|
-
function
|
|
3422
|
+
function Mo(e, t, n) {
|
|
3613
3423
|
e.context = e.context ?? {};
|
|
3614
3424
|
let r = e.context.item;
|
|
3615
|
-
|
|
3425
|
+
jo(r) ? e.context.item = {
|
|
3616
3426
|
seedLocalId: t,
|
|
3617
3427
|
modelName: e.context.modelName ?? n.modelName ?? "",
|
|
3618
3428
|
schemaId: e.context.schemaId ?? n.schemaId ?? void 0
|
|
@@ -3623,10 +3433,10 @@ function Zo(e, t, n) {
|
|
|
3623
3433
|
schemaId: r?.schemaId ?? e.context.schemaId ?? n.schemaId ?? void 0
|
|
3624
3434
|
};
|
|
3625
3435
|
}
|
|
3626
|
-
var
|
|
3436
|
+
var No = Lt(({ sendBack: e, input: { context: t } }) => {
|
|
3627
3437
|
let n = async () => {
|
|
3628
3438
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
|
|
3629
|
-
if (!await
|
|
3439
|
+
if (!await Oo(Do("SEED_PUBLISH_RESTORE_WAIT_MS", To), Do("SEED_PUBLISH_RESTORE_POLL_MS", Eo))) return {
|
|
3630
3440
|
newPublishProcesses: e,
|
|
3631
3441
|
newSubscriptions: t
|
|
3632
3442
|
};
|
|
@@ -3635,7 +3445,7 @@ var Qo = Ht(({ sendBack: e, input: { context: t } }) => {
|
|
|
3635
3445
|
newPublishProcesses: e,
|
|
3636
3446
|
newSubscriptions: t
|
|
3637
3447
|
};
|
|
3638
|
-
let r = await n.select().from(
|
|
3448
|
+
let r = await n.select().from(N).where(R(N.status, "in_progress")), i = /* @__PURE__ */ new Map(), a = [...r].sort((e, t) => (t.updatedAt ?? t.createdAt ?? 0) - (e.updatedAt ?? e.createdAt ?? 0));
|
|
3639
3449
|
for (let e of a) i.has(e.seedLocalId) || i.set(e.seedLocalId, e);
|
|
3640
3450
|
let o = Array.from(i.values());
|
|
3641
3451
|
for (let n of o) {
|
|
@@ -3647,12 +3457,12 @@ var Qo = Ht(({ sendBack: e, input: { context: t } }) => {
|
|
|
3647
3457
|
}
|
|
3648
3458
|
if (r.status === "done") continue;
|
|
3649
3459
|
let i = r.context?.item?.seedLocalId ?? n.seedLocalId;
|
|
3650
|
-
if (!i || !
|
|
3651
|
-
|
|
3652
|
-
let a =
|
|
3460
|
+
if (!i || !Ao(r) || !await co(i)) continue;
|
|
3461
|
+
Mo(r, i, n);
|
|
3462
|
+
let a = Ft(Ta, {
|
|
3653
3463
|
snapshot: r,
|
|
3654
3464
|
input: void 0
|
|
3655
|
-
}), o =
|
|
3465
|
+
}), o = Ft(Na, { input: {
|
|
3656
3466
|
publishProcess: a,
|
|
3657
3467
|
seedLocalId: i
|
|
3658
3468
|
} });
|
|
@@ -3681,32 +3491,32 @@ var Qo = Ht(({ sendBack: e, input: { context: t } }) => {
|
|
|
3681
3491
|
subscriptions: n
|
|
3682
3492
|
});
|
|
3683
3493
|
});
|
|
3684
|
-
}),
|
|
3494
|
+
}), Po = F(({ context: e, event: t }) => ({ pendingCreates: [...e.pendingCreates ?? [], t] })), Fo = It(({ context: e, enqueue: t }) => {
|
|
3685
3495
|
let n = e.pendingCreates ?? [];
|
|
3686
3496
|
if (n.length !== 0) {
|
|
3687
3497
|
t.assign({ pendingCreates: [] });
|
|
3688
3498
|
for (let e of n) t.raise(e);
|
|
3689
3499
|
}
|
|
3690
|
-
}),
|
|
3500
|
+
}), Io = L("seedProtocol:PublishManager:index"), Lo = Rt({
|
|
3691
3501
|
types: {
|
|
3692
3502
|
context: {},
|
|
3693
3503
|
input: {},
|
|
3694
3504
|
events: {}
|
|
3695
3505
|
},
|
|
3696
|
-
actors: { restoreFromDb:
|
|
3506
|
+
actors: { restoreFromDb: No },
|
|
3697
3507
|
actions: {
|
|
3698
|
-
assignRestoreFromDb:
|
|
3699
|
-
createPublish:
|
|
3700
|
-
queueCreatePublish:
|
|
3701
|
-
drainPendingCreates:
|
|
3702
|
-
addSubscription:
|
|
3703
|
-
requestSavePublish:
|
|
3704
|
-
publishDone:
|
|
3705
|
-
removeSubscription:
|
|
3706
|
-
retryAttestations:
|
|
3707
|
-
stopPublish:
|
|
3708
|
-
stopAll:
|
|
3709
|
-
query:
|
|
3508
|
+
assignRestoreFromDb: Ea,
|
|
3509
|
+
createPublish: Ba,
|
|
3510
|
+
queueCreatePublish: Po,
|
|
3511
|
+
drainPendingCreates: Fo,
|
|
3512
|
+
addSubscription: _o,
|
|
3513
|
+
requestSavePublish: So,
|
|
3514
|
+
publishDone: Co,
|
|
3515
|
+
removeSubscription: wo,
|
|
3516
|
+
retryAttestations: Va,
|
|
3517
|
+
stopPublish: po,
|
|
3518
|
+
stopAll: ho,
|
|
3519
|
+
query: go
|
|
3710
3520
|
}
|
|
3711
3521
|
}).createMachine({
|
|
3712
3522
|
id: "publishManager",
|
|
@@ -3750,24 +3560,24 @@ var Qo = Ht(({ sendBack: e, input: { context: t } }) => {
|
|
|
3750
3560
|
}
|
|
3751
3561
|
}
|
|
3752
3562
|
}
|
|
3753
|
-
}), $ =
|
|
3563
|
+
}), $ = Ft(Lo, { input: {
|
|
3754
3564
|
publishProcesses: /* @__PURE__ */ new Map(),
|
|
3755
3565
|
subscriptions: /* @__PURE__ */ new Map(),
|
|
3756
3566
|
pendingCreates: [],
|
|
3757
3567
|
settledPublishes: /* @__PURE__ */ new Map()
|
|
3758
|
-
} }),
|
|
3759
|
-
function
|
|
3760
|
-
if (!
|
|
3568
|
+
} }), Ro = !1;
|
|
3569
|
+
function zo() {
|
|
3570
|
+
if (!Ro) {
|
|
3761
3571
|
try {
|
|
3762
3572
|
$.start();
|
|
3763
3573
|
} catch (e) {
|
|
3764
3574
|
let t = e instanceof Error ? e.message : String(e);
|
|
3765
3575
|
if (!/already started/i.test(t)) throw e;
|
|
3766
3576
|
}
|
|
3767
|
-
|
|
3577
|
+
Ro = !0;
|
|
3768
3578
|
}
|
|
3769
3579
|
}
|
|
3770
|
-
|
|
3580
|
+
Oa({
|
|
3771
3581
|
savePublish: (e, t, n) => {
|
|
3772
3582
|
$.send({
|
|
3773
3583
|
type: "REQUEST_SAVE_PUBLISH",
|
|
@@ -3789,30 +3599,30 @@ qa({
|
|
|
3789
3599
|
});
|
|
3790
3600
|
}
|
|
3791
3601
|
});
|
|
3792
|
-
var
|
|
3793
|
-
|
|
3602
|
+
var Bo = $.subscribe((e) => {
|
|
3603
|
+
Io("PublishManager snapshot:", e);
|
|
3794
3604
|
});
|
|
3795
|
-
typeof document < "u" && (
|
|
3796
|
-
|
|
3605
|
+
typeof document < "u" && (zo(), window.addEventListener("load", () => {
|
|
3606
|
+
Io("PublishManager started");
|
|
3797
3607
|
}), window.addEventListener("beforeunload", () => {
|
|
3798
|
-
|
|
3608
|
+
Bo.unsubscribe(), $.stop();
|
|
3799
3609
|
}));
|
|
3800
|
-
var
|
|
3610
|
+
var Vo = {
|
|
3801
3611
|
getService: () => $,
|
|
3802
|
-
ready: () => (
|
|
3612
|
+
ready: () => (zo(), $.getSnapshot().value === "active" ? Promise.resolve() : new Promise((e) => {
|
|
3803
3613
|
let t = $.subscribe((n) => {
|
|
3804
3614
|
n.value === "active" && (t.unsubscribe(), e());
|
|
3805
3615
|
});
|
|
3806
3616
|
$.getSnapshot().value === "active" && (t.unsubscribe(), e());
|
|
3807
3617
|
})),
|
|
3808
3618
|
createPublish: async (e, t, n, r) => {
|
|
3809
|
-
let { seedLocalId: i } = e, a =
|
|
3810
|
-
if (!await
|
|
3619
|
+
let { seedLocalId: i } = e, a = fo(i);
|
|
3620
|
+
if (!await co(i)) {
|
|
3811
3621
|
console.warn(`[createPublish] "${i}" is already publishing in another tab; skipping.`);
|
|
3812
3622
|
return;
|
|
3813
3623
|
}
|
|
3814
3624
|
let o = await new Promise((i) => {
|
|
3815
|
-
let a =
|
|
3625
|
+
let a = Ia(i);
|
|
3816
3626
|
$.send({
|
|
3817
3627
|
type: "CREATE_PUBLISH",
|
|
3818
3628
|
item: e,
|
|
@@ -3822,7 +3632,7 @@ var os = {
|
|
|
3822
3632
|
createToken: a
|
|
3823
3633
|
});
|
|
3824
3634
|
});
|
|
3825
|
-
return !o && !a &&
|
|
3635
|
+
return !o && !a && lo(i), o;
|
|
3826
3636
|
},
|
|
3827
3637
|
retryAttestations: (e, t) => $.send({
|
|
3828
3638
|
type: "RETRY_ATTESTATIONS",
|
|
@@ -3859,26 +3669,26 @@ var os = {
|
|
|
3859
3669
|
};
|
|
3860
3670
|
//#endregion
|
|
3861
3671
|
//#region src/helpers/approvedTargetsForAutomationPublish.ts
|
|
3862
|
-
function
|
|
3672
|
+
function Ho() {
|
|
3863
3673
|
let e = D().modularAccountModuleContract?.trim();
|
|
3864
3674
|
if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: session keys require PublishConfig.modularAccountModuleContract (their only approved target is the Seed executor module).");
|
|
3865
3675
|
return [e.toLowerCase()];
|
|
3866
3676
|
}
|
|
3867
3677
|
//#endregion
|
|
3868
3678
|
//#region src/helpers/automationSessionKeyPermissions.ts
|
|
3869
|
-
var
|
|
3870
|
-
function
|
|
3679
|
+
var Uo = "publish,revoke";
|
|
3680
|
+
function Wo(e) {
|
|
3871
3681
|
let t = {
|
|
3872
|
-
approvedTargets:
|
|
3682
|
+
approvedTargets: Ho(),
|
|
3873
3683
|
nativeTokenLimitPerTransaction: 0
|
|
3874
3684
|
};
|
|
3875
3685
|
return typeof e?.expiresAt == "number" && e.expiresAt > 0 && (t.expiresAt = Math.trunc(e.expiresAt)), t;
|
|
3876
3686
|
}
|
|
3877
|
-
function
|
|
3687
|
+
function Go(e, t = Uo) {
|
|
3878
3688
|
let n = `${[...e.approvedTargets].map((e) => e.toLowerCase()).sort().join(",")}|${e.nativeTokenLimitPerTransaction}|${e.expiresAt ?? 0}|${t.trim()}`;
|
|
3879
|
-
return
|
|
3689
|
+
return ut(dt(n));
|
|
3880
3690
|
}
|
|
3881
|
-
function
|
|
3691
|
+
function Ko(e) {
|
|
3882
3692
|
let t = {
|
|
3883
3693
|
approvedTargets: e.approvedTargets,
|
|
3884
3694
|
nativeTokenLimitPerTransaction: e.nativeTokenLimitPerTransaction
|
|
@@ -3890,37 +3700,37 @@ function ds(e) {
|
|
|
3890
3700
|
}
|
|
3891
3701
|
//#endregion
|
|
3892
3702
|
//#region src/services/publishAuthorization/index.ts
|
|
3893
|
-
var
|
|
3894
|
-
function
|
|
3703
|
+
var qo = "0x0000000000000000000000000000000000000000", Jo = !0, Yo = "0x0000000000000000000000000000000000000000";
|
|
3704
|
+
function Xo(e) {
|
|
3895
3705
|
if (i(e)) return e.txSender;
|
|
3896
3706
|
if (he(e)) return e;
|
|
3897
3707
|
throw Error("@seedprotocol/publish: publish authorization write APIs require a PublishWallet or SeedTxSender");
|
|
3898
3708
|
}
|
|
3899
|
-
async function
|
|
3709
|
+
async function Zo(e, t) {
|
|
3900
3710
|
let n = await e.sendTransaction(t);
|
|
3901
3711
|
return T(n.transactionHash);
|
|
3902
3712
|
}
|
|
3903
|
-
function
|
|
3713
|
+
function Qo(e, t) {
|
|
3904
3714
|
let n = t.trim();
|
|
3905
3715
|
if (!/^0x[0-9a-fA-F]{40}$/.test(n)) throw Error(`@seedprotocol/publish: ${e} must be a valid address`);
|
|
3906
3716
|
return n;
|
|
3907
3717
|
}
|
|
3908
|
-
function
|
|
3909
|
-
return
|
|
3718
|
+
function $o() {
|
|
3719
|
+
return Mt.getSchemaUID(pt, qo, Jo);
|
|
3910
3720
|
}
|
|
3911
|
-
async function
|
|
3912
|
-
let t =
|
|
3913
|
-
return await
|
|
3914
|
-
schema:
|
|
3915
|
-
resolverAddress:
|
|
3916
|
-
revocable:
|
|
3917
|
-
})), await
|
|
3721
|
+
async function es(e) {
|
|
3722
|
+
let t = Xo(e), n = $o();
|
|
3723
|
+
return await B(n) || (await Zo(t, on({
|
|
3724
|
+
schema: pt,
|
|
3725
|
+
resolverAddress: qo,
|
|
3726
|
+
revocable: Jo
|
|
3727
|
+
})), await Zo(t, cn({
|
|
3918
3728
|
schemaUid: n,
|
|
3919
|
-
schemaName:
|
|
3729
|
+
schemaName: ht
|
|
3920
3730
|
}))), n;
|
|
3921
3731
|
}
|
|
3922
|
-
function
|
|
3923
|
-
return new
|
|
3732
|
+
function ts(e) {
|
|
3733
|
+
return new jt(pt).encodeData([
|
|
3924
3734
|
{
|
|
3925
3735
|
name: "identity",
|
|
3926
3736
|
value: e.identity,
|
|
@@ -3953,15 +3763,15 @@ function bs(e) {
|
|
|
3953
3763
|
},
|
|
3954
3764
|
{
|
|
3955
3765
|
name: "permissionsHash",
|
|
3956
|
-
value:
|
|
3766
|
+
value: Ct(e.permissionsHash),
|
|
3957
3767
|
type: "bytes32"
|
|
3958
3768
|
}
|
|
3959
3769
|
]);
|
|
3960
3770
|
}
|
|
3961
|
-
async function
|
|
3962
|
-
let t =
|
|
3963
|
-
if (l ===
|
|
3964
|
-
let d = typeof e.expirationTime == "number" && e.expirationTime > 0 ? e.expirationTime : s > 0 ? s : o +
|
|
3771
|
+
async function ns(e) {
|
|
3772
|
+
let t = Xo(e.wallet), n = e.ensureSchema === !1 ? $o() : await es(e.wallet), r = Qo("identity", e.identity), i = Qo("sessionKey", e.sessionKey), a = e.app?.trim() ? Qo("app", e.app) : Yo, o = e.grantedAt ?? Math.floor(Date.now() / 1e3), s = typeof e.expiresAt == "number" && e.expiresAt > 0 ? Math.trunc(e.expiresAt) : 0, c = e.scopes ?? _t, l = Ct(e.permissionsHash ?? Go(Wo({ expiresAt: s > 0 ? s : void 0 }), c === _t ? "publish,revoke" : c));
|
|
3773
|
+
if (l === Pt) throw Error("@seedprotocol/publish: attestPublishAuthorization requires a non-zero permissionsHash");
|
|
3774
|
+
let d = typeof e.expirationTime == "number" && e.expirationTime > 0 ? e.expirationTime : s > 0 ? s : o + ft, f = ts({
|
|
3965
3775
|
identity: r,
|
|
3966
3776
|
sessionKey: i,
|
|
3967
3777
|
app: a,
|
|
@@ -3969,20 +3779,20 @@ async function xs(e) {
|
|
|
3969
3779
|
grantedAt: o,
|
|
3970
3780
|
expiresAt: s,
|
|
3971
3781
|
permissionsHash: l
|
|
3972
|
-
}), p = await
|
|
3782
|
+
}), p = await Zo(t, v({
|
|
3973
3783
|
schema: n,
|
|
3974
3784
|
data: {
|
|
3975
3785
|
recipient: i,
|
|
3976
3786
|
expirationTime: BigInt(d),
|
|
3977
3787
|
revocable: !0,
|
|
3978
|
-
refUID:
|
|
3788
|
+
refUID: Pt,
|
|
3979
3789
|
data: f,
|
|
3980
3790
|
value: 0n
|
|
3981
3791
|
}
|
|
3982
3792
|
}));
|
|
3983
3793
|
if (!p) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — no receipt");
|
|
3984
3794
|
let { easContractAddress: m } = D(), h = u(p, m);
|
|
3985
|
-
if (!h || !
|
|
3795
|
+
if (!h || !St(h)) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — could not parse attestation UID");
|
|
3986
3796
|
return {
|
|
3987
3797
|
uid: h,
|
|
3988
3798
|
schemaUid: n,
|
|
@@ -3992,25 +3802,25 @@ async function xs(e) {
|
|
|
3992
3802
|
expirationTime: d
|
|
3993
3803
|
};
|
|
3994
3804
|
}
|
|
3995
|
-
async function
|
|
3996
|
-
let t =
|
|
3997
|
-
if (!
|
|
3998
|
-
if (!await
|
|
3805
|
+
async function rs(e) {
|
|
3806
|
+
let t = Xo(e.wallet), r = e.schemaUid ?? $o(), i = Ct(e.uid);
|
|
3807
|
+
if (!St(i)) throw Error("@seedprotocol/publish: revokePublishAuthorization requires a valid attestation uid");
|
|
3808
|
+
if (!await Zo(t, n([{
|
|
3999
3809
|
schema: r,
|
|
4000
3810
|
data: [{ uid: i }]
|
|
4001
3811
|
}]))) throw Error("@seedprotocol/publish: revokePublishAuthorization failed — no receipt");
|
|
4002
3812
|
}
|
|
4003
|
-
async function
|
|
4004
|
-
let t = (await
|
|
3813
|
+
async function is(e) {
|
|
3814
|
+
let t = (await xt({
|
|
4005
3815
|
identities: e.identities,
|
|
4006
3816
|
excludeRevoked: !1
|
|
4007
3817
|
})).find((t) => t.id?.toLowerCase() === e.uid.toLowerCase());
|
|
4008
3818
|
if (!t) return null;
|
|
4009
|
-
let n =
|
|
3819
|
+
let n = bt(t.decodedDataJson ?? "[]"), r = typeof t.expirationTime == "number" ? t.expirationTime : typeof t.expirationTime == "string" ? Number(t.expirationTime) : null;
|
|
4010
3820
|
return {
|
|
4011
3821
|
uid: t.id,
|
|
4012
3822
|
decoded: n,
|
|
4013
|
-
assess:
|
|
3823
|
+
assess: yt({
|
|
4014
3824
|
decoded: n,
|
|
4015
3825
|
expirationTime: r
|
|
4016
3826
|
}),
|
|
@@ -4018,6 +3828,6 @@ async function Cs(e) {
|
|
|
4018
3828
|
};
|
|
4019
3829
|
}
|
|
4020
3830
|
//#endregion
|
|
4021
|
-
export {
|
|
3831
|
+
export { z as $, si as A, Jr as B, Ci as C, ai as D, oi as E, $r as F, Br as G, Qr as H, gi as I, Xn as J, Hr as K, ei as L, pi as M, hi as N, ii as O, qr as P, on as Q, ti as R, Di as S, ri as T, Zr as U, Ur as V, Xr as W, cn as X, yn as Y, B as Z, Zi as _, ns as a, Bi as b, $o as c, Wo as d, en as et, Go as f, Ta as g, Vo as h, is as i, li as j, ci as k, rs as l, Ho as m, gt as n, qt as nt, ts as o, Ko as p, Pn as q, vt as r, es as s, mt as t, Kt as tt, Uo as u, Qi as v, Ti as w, zi as x, Fi as y, ni as z };
|
|
4022
3832
|
|
|
4023
|
-
//# sourceMappingURL=publishAuthorization-
|
|
3833
|
+
//# sourceMappingURL=publishAuthorization-C5kXlbOT.js.map
|