@seedprotocol/publish 0.6.0 → 0.6.1

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.
Files changed (62) hide show
  1. package/dist/config-CU8Ui1p-.js +945 -0
  2. package/dist/config-CU8Ui1p-.js.map +1 -0
  3. package/dist/config-DEgHQlfX.js +945 -0
  4. package/dist/config-DEgHQlfX.js.map +1 -0
  5. package/dist/config-DXz248cO.js +945 -0
  6. package/dist/config-DXz248cO.js.map +1 -0
  7. package/dist/config-gmiloACE.js +945 -0
  8. package/dist/config-gmiloACE.js.map +1 -0
  9. package/dist/ensureAutomationSessionKey-C_RJobXU.js +84 -0
  10. package/dist/ensureAutomationSessionKey-C_RJobXU.js.map +1 -0
  11. package/dist/ensureAutomationSessionKey-Dpd21O0I.js +84 -0
  12. package/dist/ensureAutomationSessionKey-Dpd21O0I.js.map +1 -0
  13. package/dist/ensureAutomationSessionKey-N4wpdxAg.js +84 -0
  14. package/dist/ensureAutomationSessionKey-N4wpdxAg.js.map +1 -0
  15. package/dist/ensureAutomationSessionKey-xX_D3EcO.js +84 -0
  16. package/dist/ensureAutomationSessionKey-xX_D3EcO.js.map +1 -0
  17. package/dist/ensureModularPublishBootstrap-AQdNHeLj.js +127 -0
  18. package/dist/ensureModularPublishBootstrap-AQdNHeLj.js.map +1 -0
  19. package/dist/ensureModularPublishBootstrap-BRf-eJeB.js +128 -0
  20. package/dist/ensureModularPublishBootstrap-BRf-eJeB.js.map +1 -0
  21. package/dist/ensureModularPublishBootstrap-CTcJlDea.js +127 -0
  22. package/dist/ensureModularPublishBootstrap-CTcJlDea.js.map +1 -0
  23. package/dist/ensureModularPublishBootstrap-DVvZtMli.js +127 -0
  24. package/dist/ensureModularPublishBootstrap-DVvZtMli.js.map +1 -0
  25. package/dist/ensureSmartWalletThenPublish-BmLs5Nwn.js +48 -0
  26. package/dist/ensureSmartWalletThenPublish-BmLs5Nwn.js.map +1 -0
  27. package/dist/ensureSmartWalletThenPublish-CbF_YdTA.js +48 -0
  28. package/dist/ensureSmartWalletThenPublish-CbF_YdTA.js.map +1 -0
  29. package/dist/ensureSmartWalletThenPublish-iPHk38a4.js +48 -0
  30. package/dist/ensureSmartWalletThenPublish-iPHk38a4.js.map +1 -0
  31. package/dist/ensureSmartWalletThenPublish-uRUfZJzA.js +48 -0
  32. package/dist/ensureSmartWalletThenPublish-uRUfZJzA.js.map +1 -0
  33. package/dist/index.js +3 -3
  34. package/dist/publishAuthorization-BQKmcmLY.js +3426 -0
  35. package/dist/publishAuthorization-BQKmcmLY.js.map +1 -0
  36. package/dist/publishAuthorization-BzmqxKCT.js +3476 -0
  37. package/dist/publishAuthorization-BzmqxKCT.js.map +1 -0
  38. package/dist/publishAuthorization-CXSmL-iP.js +3428 -0
  39. package/dist/publishAuthorization-CXSmL-iP.js.map +1 -0
  40. package/dist/publishAuthorization-uCvEyJ0U.js +3427 -0
  41. package/dist/publishAuthorization-uCvEyJ0U.js.map +1 -0
  42. package/dist/resolveRevokeAccount-BE9G5QA8.js +38 -0
  43. package/dist/resolveRevokeAccount-BE9G5QA8.js.map +1 -0
  44. package/dist/resolveRevokeAccount-CBT8xptI.js +38 -0
  45. package/dist/resolveRevokeAccount-CBT8xptI.js.map +1 -0
  46. package/dist/resolveRevokeAccount-D-LndUHw.js +38 -0
  47. package/dist/resolveRevokeAccount-D-LndUHw.js.map +1 -0
  48. package/dist/resolveRevokeAccount-hwtpdojw.js +38 -0
  49. package/dist/resolveRevokeAccount-hwtpdojw.js.map +1 -0
  50. package/dist/services/publish/actors/createAttestations.d.ts.map +1 -1
  51. package/dist/services/publish/actors/seedUidHelpers.d.ts +22 -0
  52. package/dist/services/publish/actors/seedUidHelpers.d.ts.map +1 -1
  53. package/dist/thirdweb.js +5 -5
  54. package/dist/worker-B5XVaUgJ.js +69 -0
  55. package/dist/worker-B5XVaUgJ.js.map +1 -0
  56. package/dist/worker-Ct1D1BAK.js +69 -0
  57. package/dist/worker-Ct1D1BAK.js.map +1 -0
  58. package/dist/worker-DHNyIpf-.js +69 -0
  59. package/dist/worker-DHNyIpf-.js.map +1 -0
  60. package/dist/worker-Exgca_h6.js +69 -0
  61. package/dist/worker-Exgca_h6.js.map +1 -0
  62. package/package.json +6 -6
@@ -0,0 +1,945 @@
1
+ import { DEFAULT_ARWEAVE_GRAPHQL_URL as e, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as t, client as n, getAttesterForSeed as r, getGetAdditionalSyncAddresses as i, getMetadataAttestationUidsForSeedUid as a, getVersionsForSeedUid as o, isValidEasAttestationUid as s, setAdditionalSyncAddresses as c, setGetPublisherForNewSeeds as l, setRevokeExecutor as u, updateSeedRevokedAt as ee } from "@seedprotocol/sdk";
2
+ import { createPublicClient as te, encodeAbiParameters as d, encodeFunctionData as f, http as p, parseEventLogs as m } from "viem";
3
+ import { optimismSepolia as h } from "viem/chains";
4
+ import { defineChain as ne, prepareTransaction as re, sendTransaction as ie } from "thirdweb";
5
+ import { optimismSepolia as ae } from "thirdweb/chains";
6
+ import { ethers as oe } from "ethers";
7
+ //#region \0rolldown/runtime.js
8
+ var g = Object.defineProperty, _ = (e, t) => {
9
+ let n = {};
10
+ for (var r in e) g(n, r, {
11
+ get: e[r],
12
+ enumerable: !0
13
+ });
14
+ return t || g(n, Symbol.toStringTag, { value: "Module" }), n;
15
+ }, v = "0x4200000000000000000000000000000000000020", se = "0x44d562ac1d7cd77e232978687fea027ace48f719cf1d58c7888e509663bb87fc", y = "0x76f47d88bfaf670f5208911181fcdc0e160cb16d", b = "0x4200000000000000000000000000000000000021", x = "0xcd8c945872df8e664e55cf8885c85ea3ea8f2148", ce = x, le = {
16
+ SUCCESS: "success",
17
+ FAILURE: "failure"
18
+ }, ue = [
19
+ "pollingForConfirmation",
20
+ "uploadingData",
21
+ "uploadingViaBundler",
22
+ "uploadingViaBundlerPhase2"
23
+ ], de = 3e4, fe = [
24
+ {
25
+ type: "error",
26
+ name: "AccessDenied",
27
+ inputs: []
28
+ },
29
+ {
30
+ type: "error",
31
+ name: "AlreadyRevoked",
32
+ inputs: []
33
+ },
34
+ {
35
+ type: "error",
36
+ name: "InvalidRevocation",
37
+ inputs: []
38
+ },
39
+ {
40
+ type: "error",
41
+ name: "InvalidRevocations",
42
+ inputs: []
43
+ },
44
+ {
45
+ type: "error",
46
+ name: "InvalidSchema",
47
+ inputs: []
48
+ },
49
+ {
50
+ type: "error",
51
+ name: "Irrevocable",
52
+ inputs: []
53
+ },
54
+ {
55
+ type: "error",
56
+ name: "NotFound",
57
+ inputs: []
58
+ },
59
+ {
60
+ type: "error",
61
+ name: "NotPayable",
62
+ inputs: []
63
+ },
64
+ {
65
+ type: "error",
66
+ name: "InsufficientValue",
67
+ inputs: []
68
+ },
69
+ {
70
+ type: "error",
71
+ name: "InvalidLength",
72
+ inputs: []
73
+ }
74
+ ], S = [
75
+ {
76
+ name: "recipient",
77
+ type: "address"
78
+ },
79
+ {
80
+ name: "expirationTime",
81
+ type: "uint64"
82
+ },
83
+ {
84
+ name: "revocable",
85
+ type: "bool"
86
+ },
87
+ {
88
+ name: "refUID",
89
+ type: "bytes32"
90
+ },
91
+ {
92
+ name: "data",
93
+ type: "bytes"
94
+ },
95
+ {
96
+ name: "value",
97
+ type: "uint256"
98
+ }
99
+ ], C = [
100
+ {
101
+ type: "function",
102
+ name: "attest",
103
+ stateMutability: "payable",
104
+ inputs: [{
105
+ name: "request",
106
+ type: "tuple",
107
+ components: [{
108
+ name: "schema",
109
+ type: "bytes32"
110
+ }, {
111
+ name: "data",
112
+ type: "tuple",
113
+ components: S
114
+ }]
115
+ }],
116
+ outputs: [{ type: "bytes32" }]
117
+ },
118
+ {
119
+ type: "function",
120
+ name: "multiAttest",
121
+ stateMutability: "payable",
122
+ inputs: [{
123
+ name: "requests",
124
+ type: "tuple[]",
125
+ components: [{
126
+ name: "schema",
127
+ type: "bytes32"
128
+ }, {
129
+ name: "data",
130
+ type: "tuple[]",
131
+ components: S
132
+ }]
133
+ }],
134
+ outputs: [{ type: "bytes32[]" }]
135
+ },
136
+ {
137
+ type: "function",
138
+ name: "multiRevoke",
139
+ stateMutability: "payable",
140
+ inputs: [{
141
+ name: "multiRequests",
142
+ type: "tuple[]",
143
+ components: [{
144
+ name: "schema",
145
+ type: "bytes32"
146
+ }, {
147
+ name: "data",
148
+ type: "tuple[]",
149
+ components: [{
150
+ name: "uid",
151
+ type: "bytes32"
152
+ }, {
153
+ name: "value",
154
+ type: "uint256"
155
+ }]
156
+ }]
157
+ }],
158
+ outputs: []
159
+ },
160
+ {
161
+ type: "event",
162
+ name: "Attested",
163
+ inputs: [
164
+ {
165
+ name: "recipient",
166
+ type: "address",
167
+ indexed: !0
168
+ },
169
+ {
170
+ name: "attester",
171
+ type: "address",
172
+ indexed: !0
173
+ },
174
+ {
175
+ name: "uid",
176
+ type: "bytes32",
177
+ indexed: !1
178
+ },
179
+ {
180
+ name: "schemaUID",
181
+ type: "bytes32",
182
+ indexed: !0
183
+ }
184
+ ]
185
+ },
186
+ ...fe
187
+ ], w = [{
188
+ name: "schema",
189
+ type: "bytes32"
190
+ }, {
191
+ name: "data",
192
+ type: "tuple[]",
193
+ components: [
194
+ {
195
+ name: "recipient",
196
+ type: "address"
197
+ },
198
+ {
199
+ name: "expirationTime",
200
+ type: "uint64"
201
+ },
202
+ {
203
+ name: "revocable",
204
+ type: "bool"
205
+ },
206
+ {
207
+ name: "refUID",
208
+ type: "bytes32"
209
+ },
210
+ {
211
+ name: "data",
212
+ type: "bytes"
213
+ },
214
+ {
215
+ name: "value",
216
+ type: "uint256"
217
+ }
218
+ ]
219
+ }], pe = [{
220
+ type: "function",
221
+ name: "multiPublish",
222
+ stateMutability: "nonpayable",
223
+ inputs: [{
224
+ name: "requests",
225
+ type: "tuple[]",
226
+ components: [
227
+ {
228
+ name: "localId",
229
+ type: "string"
230
+ },
231
+ {
232
+ name: "seedUid",
233
+ type: "bytes32"
234
+ },
235
+ {
236
+ name: "seedSchemaUid",
237
+ type: "bytes32"
238
+ },
239
+ {
240
+ name: "versionUid",
241
+ type: "bytes32"
242
+ },
243
+ {
244
+ name: "versionSchemaUid",
245
+ type: "bytes32"
246
+ },
247
+ {
248
+ name: "seedIsRevocable",
249
+ type: "bool"
250
+ },
251
+ {
252
+ name: "listOfAttestations",
253
+ type: "tuple[]",
254
+ components: w
255
+ },
256
+ {
257
+ name: "propertiesToUpdate",
258
+ type: "tuple[]",
259
+ components: [{
260
+ name: "publishLocalId",
261
+ type: "string"
262
+ }, {
263
+ name: "propertySchemaUid",
264
+ type: "bytes32"
265
+ }]
266
+ }
267
+ ]
268
+ }],
269
+ outputs: [{ type: "bytes32[]" }]
270
+ }], me = [{
271
+ type: "function",
272
+ name: "multiPublish",
273
+ stateMutability: "nonpayable",
274
+ inputs: [{
275
+ name: "requests",
276
+ type: "tuple[]",
277
+ components: [
278
+ {
279
+ name: "localIdIndex",
280
+ type: "uint256"
281
+ },
282
+ {
283
+ name: "seedUid",
284
+ type: "bytes32"
285
+ },
286
+ {
287
+ name: "seedSchemaUid",
288
+ type: "bytes32"
289
+ },
290
+ {
291
+ name: "versionUid",
292
+ type: "bytes32"
293
+ },
294
+ {
295
+ name: "versionSchemaUid",
296
+ type: "bytes32"
297
+ },
298
+ {
299
+ name: "seedIsRevocable",
300
+ type: "bool"
301
+ },
302
+ {
303
+ name: "listOfAttestations",
304
+ type: "tuple[]",
305
+ components: w
306
+ },
307
+ {
308
+ name: "propertiesToUpdate",
309
+ type: "tuple[]",
310
+ components: [{
311
+ name: "publishLocalIdIndex",
312
+ type: "uint256"
313
+ }, {
314
+ name: "propertySchemaUid",
315
+ type: "bytes32"
316
+ }]
317
+ }
318
+ ]
319
+ }],
320
+ outputs: [{ type: "bytes32[]" }]
321
+ }], T = [
322
+ {
323
+ type: "function",
324
+ name: "getEas",
325
+ stateMutability: "view",
326
+ inputs: [],
327
+ outputs: [{ type: "address" }]
328
+ },
329
+ {
330
+ type: "function",
331
+ name: "setEas",
332
+ stateMutability: "nonpayable",
333
+ inputs: [{
334
+ name: "_eas",
335
+ type: "address"
336
+ }],
337
+ outputs: [{ type: "string" }]
338
+ },
339
+ {
340
+ type: "function",
341
+ name: "isActiveSigner",
342
+ stateMutability: "view",
343
+ inputs: [{
344
+ name: "signer",
345
+ type: "address"
346
+ }],
347
+ outputs: [{ type: "bool" }]
348
+ }
349
+ ], he = [{
350
+ type: "event",
351
+ name: "CreatedAttestation",
352
+ inputs: [{
353
+ name: "result",
354
+ type: "tuple",
355
+ indexed: !1,
356
+ components: [{
357
+ name: "schemaUid",
358
+ type: "bytes32"
359
+ }, {
360
+ name: "attestationUid",
361
+ type: "bytes32"
362
+ }]
363
+ }]
364
+ }, {
365
+ type: "event",
366
+ name: "SeedPublished",
367
+ inputs: [{
368
+ name: "returnedDataFromEAS",
369
+ type: "bytes",
370
+ indexed: !1
371
+ }]
372
+ }], E = [{
373
+ type: "function",
374
+ name: "getAddress",
375
+ stateMutability: "view",
376
+ inputs: [{
377
+ name: "_adminSigner",
378
+ type: "address"
379
+ }, {
380
+ name: "_data",
381
+ type: "bytes"
382
+ }],
383
+ outputs: [{ type: "address" }]
384
+ }, {
385
+ type: "function",
386
+ name: "createAccount",
387
+ stateMutability: "nonpayable",
388
+ inputs: [{
389
+ name: "_admin",
390
+ type: "address"
391
+ }, {
392
+ name: "_data",
393
+ type: "bytes"
394
+ }],
395
+ outputs: [{ type: "address" }]
396
+ }], D = [{
397
+ type: "function",
398
+ name: "getSchema",
399
+ stateMutability: "view",
400
+ inputs: [{
401
+ name: "uid",
402
+ type: "bytes32"
403
+ }],
404
+ outputs: [{
405
+ name: "",
406
+ type: "tuple",
407
+ components: [
408
+ {
409
+ name: "uid",
410
+ type: "bytes32"
411
+ },
412
+ {
413
+ name: "resolver",
414
+ type: "address"
415
+ },
416
+ {
417
+ name: "revocable",
418
+ type: "bool"
419
+ },
420
+ {
421
+ name: "schema",
422
+ type: "string"
423
+ }
424
+ ]
425
+ }]
426
+ }, {
427
+ type: "function",
428
+ name: "register",
429
+ stateMutability: "nonpayable",
430
+ inputs: [
431
+ {
432
+ name: "schema",
433
+ type: "string"
434
+ },
435
+ {
436
+ name: "resolver",
437
+ type: "address"
438
+ },
439
+ {
440
+ name: "revocable",
441
+ type: "bool"
442
+ }
443
+ ],
444
+ outputs: [{ type: "bytes32" }]
445
+ }], O = h;
446
+ //#endregion
447
+ //#region src/helpers/chainConfig.ts
448
+ function k() {
449
+ try {
450
+ return $().chain ?? O;
451
+ } catch {
452
+ return O;
453
+ }
454
+ }
455
+ function A() {
456
+ let e = $();
457
+ if (e.rpcUrl) return e.rpcUrl;
458
+ if (e.thirdwebClientId) return `https://${(e.chain ?? O).id}.rpc.thirdweb.com/${e.thirdwebClientId}`;
459
+ throw Error("@seedprotocol/publish: rpcUrl is required when thirdwebClientId is not set. Pass rpcUrl in initPublish / PublishProvider config.");
460
+ }
461
+ //#endregion
462
+ //#region src/helpers/chainClient.ts
463
+ var j = null, M = null;
464
+ function ge() {
465
+ let e = k(), t = A();
466
+ return te({
467
+ chain: e,
468
+ transport: p(t)
469
+ });
470
+ }
471
+ function N() {
472
+ let e = k(), t = A(), n = `${e.id}:${t}`;
473
+ return (!j || M !== n) && (M = n, j = ge()), j;
474
+ }
475
+ async function P(e) {
476
+ return N().waitForTransactionReceipt({ hash: e });
477
+ }
478
+ async function F(e) {
479
+ let t = await N().getBytecode({ address: e });
480
+ return !!t && t !== "0x";
481
+ }
482
+ async function _e(e) {
483
+ try {
484
+ let t = await N().getBlock({ blockNumber: e });
485
+ if (t?.timestamp != null) return Number(t.timestamp) * 1e3;
486
+ } catch {}
487
+ return null;
488
+ }
489
+ var ve = 5, ye = 6e3;
490
+ async function be(e, t = ve, n = ye) {
491
+ for (let r = 0; r < t; r++) {
492
+ if (await F(e)) return !0;
493
+ r < t - 1 && await new Promise((e) => {
494
+ setTimeout(e, n);
495
+ });
496
+ }
497
+ return !1;
498
+ }
499
+ //#endregion
500
+ //#region src/helpers/contracts/index.ts
501
+ function xe(e, t, n) {
502
+ return {
503
+ to: e,
504
+ data: f({
505
+ abi: pe,
506
+ functionName: "multiPublish",
507
+ args: [t]
508
+ }),
509
+ gas: n
510
+ };
511
+ }
512
+ function Se(e, t, n) {
513
+ return {
514
+ to: e,
515
+ data: f({
516
+ abi: me,
517
+ functionName: "multiPublish",
518
+ args: [t]
519
+ }),
520
+ gas: n
521
+ };
522
+ }
523
+ function Ce(e, t) {
524
+ return {
525
+ to: e,
526
+ data: f({
527
+ abi: T,
528
+ functionName: "setEas",
529
+ args: [t]
530
+ })
531
+ };
532
+ }
533
+ async function we(e) {
534
+ return N().readContract({
535
+ address: e,
536
+ abi: T,
537
+ functionName: "getEas"
538
+ });
539
+ }
540
+ async function Te(e, t) {
541
+ return N().readContract({
542
+ address: e,
543
+ abi: T,
544
+ functionName: "isActiveSigner",
545
+ args: [t]
546
+ });
547
+ }
548
+ async function Ee(e, t = "0x") {
549
+ let { thirdwebAccountFactoryAddress: n } = $();
550
+ return N().readContract({
551
+ address: n || "0x76f47d88bfaf670f5208911181fcdc0e160cb16d",
552
+ abi: E,
553
+ functionName: "getAddress",
554
+ args: [e, t]
555
+ });
556
+ }
557
+ function De(e, t = "0x") {
558
+ let { thirdwebAccountFactoryAddress: n } = $();
559
+ return {
560
+ to: n || "0x76f47d88bfaf670f5208911181fcdc0e160cb16d",
561
+ data: f({
562
+ abi: E,
563
+ functionName: "createAccount",
564
+ args: [e, t]
565
+ })
566
+ };
567
+ }
568
+ var Oe = "0x0000000000000000000000000000000000000000";
569
+ function I(e) {
570
+ let { easContractAddress: t } = $();
571
+ return {
572
+ to: t,
573
+ data: f({
574
+ abi: C,
575
+ functionName: "attest",
576
+ args: [{
577
+ schema: e.schema,
578
+ data: {
579
+ recipient: e.data.recipient ?? Oe,
580
+ expirationTime: e.data.expirationTime ?? 0n,
581
+ revocable: e.data.revocable ?? !0,
582
+ refUID: e.data.refUID,
583
+ data: e.data.data,
584
+ value: e.data.value ?? 0n
585
+ }
586
+ }]
587
+ })
588
+ };
589
+ }
590
+ function L(e) {
591
+ let { easContractAddress: t } = $();
592
+ return {
593
+ to: t,
594
+ data: f({
595
+ abi: C,
596
+ functionName: "multiAttest",
597
+ args: [e]
598
+ })
599
+ };
600
+ }
601
+ function R(e) {
602
+ let { easContractAddress: t } = $();
603
+ return {
604
+ to: t,
605
+ data: f({
606
+ abi: C,
607
+ functionName: "multiRevoke",
608
+ args: [e.map((e) => ({
609
+ schema: e.schema,
610
+ data: e.data.map((e) => ({
611
+ uid: e.uid,
612
+ value: e.value ?? 0n
613
+ }))
614
+ }))]
615
+ })
616
+ };
617
+ }
618
+ var ke = "0x" + "0".repeat(64);
619
+ async function Ae(e) {
620
+ let t = await N().readContract({
621
+ address: v,
622
+ abi: D,
623
+ functionName: "getSchema",
624
+ args: [e]
625
+ });
626
+ return !t || t.uid === ke ? null : {
627
+ uid: t.uid,
628
+ resolver: t.resolver,
629
+ revocable: t.revocable,
630
+ schema: t.schema
631
+ };
632
+ }
633
+ function je(e) {
634
+ return {
635
+ to: v,
636
+ data: f({
637
+ abi: D,
638
+ functionName: "register",
639
+ args: [
640
+ e.schema,
641
+ e.resolverAddress,
642
+ e.revocable
643
+ ]
644
+ })
645
+ };
646
+ }
647
+ //#endregion
648
+ //#region src/helpers/easDirect.ts
649
+ var z = "0x" + "0".repeat(64);
650
+ function Me(e) {
651
+ return I(e);
652
+ }
653
+ function Ne(e) {
654
+ return L(e);
655
+ }
656
+ function Pe(e) {
657
+ return d([{ type: "bytes32" }], [e]);
658
+ }
659
+ function Fe(e, t) {
660
+ return B(e, t)[0]?.uid;
661
+ }
662
+ function B(e, t) {
663
+ if (!e.logs?.length) return [];
664
+ let n = t.toLowerCase(), r = e.logs.filter((e) => e.address && e.address.toLowerCase() === n);
665
+ if (!r.length) return [];
666
+ try {
667
+ let e = m({
668
+ abi: C,
669
+ eventName: "Attested",
670
+ logs: r,
671
+ strict: !1
672
+ }), t = [];
673
+ for (let n of e) {
674
+ let e = n.args?.uid, r = n.args?.schemaUID;
675
+ e && e !== z && r && t.push({
676
+ schemaUid: r,
677
+ uid: e
678
+ });
679
+ }
680
+ return t;
681
+ } catch {
682
+ return [];
683
+ }
684
+ }
685
+ function V(e) {
686
+ let { modularAccountModuleContract: t } = $(), n = t?.trim();
687
+ return n && /^0x[0-9a-fA-F]{40}$/.test(n) ? Ie(n, e) : R(e);
688
+ }
689
+ function Ie(e, t) {
690
+ return {
691
+ to: e,
692
+ data: f({
693
+ abi: C,
694
+ functionName: "multiRevoke",
695
+ args: [t.map((e) => ({
696
+ schema: e.schema,
697
+ data: e.data.map((e) => ({
698
+ uid: e.uid,
699
+ value: e.value ?? 0n
700
+ }))
701
+ }))]
702
+ })
703
+ };
704
+ }
705
+ //#endregion
706
+ //#region src/helpers/publishWalletRegistry.ts
707
+ var H = null;
708
+ function Le() {
709
+ return n.isInitialized() ? Promise.resolve() : new Promise((e) => {
710
+ n.onReady(() => e());
711
+ });
712
+ }
713
+ async function Re(e) {
714
+ if (H = e, !e) return;
715
+ await Le();
716
+ let t = /* @__PURE__ */ new Set();
717
+ for (let n of e.ownedAddresses ?? []) n && t.add(n.toLowerCase());
718
+ t.add(e.signer.address.toLowerCase()), t.add(e.txSender.address.toLowerCase()), e.publisherAddress && t.add(e.publisherAddress.toLowerCase());
719
+ try {
720
+ await n.setAddresses({ owned: [...t] });
721
+ } catch (e) {
722
+ console.warn("[publishWalletRegistry] Failed to set seed client addresses:", e);
723
+ }
724
+ }
725
+ function U() {
726
+ return H;
727
+ }
728
+ function ze() {
729
+ H = null;
730
+ }
731
+ //#endregion
732
+ //#region src/helpers/seedSigner.ts
733
+ var W = Symbol.for("seedprotocol.SeedSigner"), G = Symbol.for("seedprotocol.SeedTxSender");
734
+ function K(e) {
735
+ return Object.assign(e, { [W]: !0 });
736
+ }
737
+ function q(e) {
738
+ return Object.assign(e, { [G]: !0 });
739
+ }
740
+ function J(e) {
741
+ return !!e && typeof e == "object" && W in e;
742
+ }
743
+ function Y(e) {
744
+ return !!e && typeof e == "object" && G in e;
745
+ }
746
+ function X(e) {
747
+ return !!e && typeof e == "object" && "signer" in e && "txSender" in e && J(e.signer) && Y(e.txSender);
748
+ }
749
+ function Be(e) {
750
+ let t = e.address;
751
+ return {
752
+ signer: K({
753
+ address: t,
754
+ signMessage: async ({ message: t }) => {
755
+ if (typeof t == "string") return await e.signMessage(t);
756
+ let n = t.raw, r = typeof n == "string" ? oe.getBytes(n) : n instanceof Uint8Array ? n : new Uint8Array(n);
757
+ return await e.signMessage(r);
758
+ }
759
+ }),
760
+ txSender: q({
761
+ address: t,
762
+ sendTransaction: async (t) => ({ transactionHash: (await e.sendTransaction({
763
+ to: t.to,
764
+ data: t.data,
765
+ value: t.value,
766
+ gasLimit: t.gas
767
+ })).hash })
768
+ })
769
+ };
770
+ }
771
+ function Ve(e) {
772
+ if (X(e)) return e.signer;
773
+ if (J(e)) return e;
774
+ throw Error("@seedprotocol/publish: expected a SeedSigner or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
775
+ }
776
+ function He(e) {
777
+ if (X(e)) return e.txSender;
778
+ if (Y(e)) return e;
779
+ throw Error("@seedprotocol/publish: expected a SeedTxSender or PublishWallet. Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
780
+ }
781
+ function Ue(e) {
782
+ if (X(e)) return e;
783
+ throw Error("@seedprotocol/publish: expected a PublishWallet (signer + txSender). Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
784
+ }
785
+ //#endregion
786
+ //#region src/helpers/adapters/thirdwebAccount.ts
787
+ var We = /* @__PURE__ */ _({
788
+ asSeedSignerFromThirdweb: () => qe,
789
+ asThirdwebPublishWallet: () => Ke,
790
+ fromThirdwebAccount: () => Z
791
+ });
792
+ function Ge() {
793
+ let e = k();
794
+ return e.id === ae.id ? ae : ne({
795
+ id: e.id,
796
+ name: e.name,
797
+ nativeCurrency: e.nativeCurrency,
798
+ rpc: e.rpcUrls.default.http[0] ?? ""
799
+ });
800
+ }
801
+ function Z(e) {
802
+ let t = e.address;
803
+ return {
804
+ signer: K({
805
+ address: t,
806
+ signMessage: async ({ message: t }) => await e.signMessage({ message: t })
807
+ }),
808
+ txSender: q({
809
+ address: t,
810
+ sendTransaction: async (t) => {
811
+ let { getClient: n } = await import("./publishAuthorization-BzmqxKCT.js").then((e) => e.B), r = Ge(), i = re({
812
+ client: n(),
813
+ chain: r,
814
+ to: t.to,
815
+ data: t.data,
816
+ value: t.value,
817
+ gas: t.gas
818
+ });
819
+ return { transactionHash: (await ie({
820
+ account: e,
821
+ transaction: i
822
+ })).transactionHash };
823
+ }
824
+ })
825
+ };
826
+ }
827
+ function Ke(e) {
828
+ if (X(e)) return e;
829
+ if (J(e)) throw Error("@seedprotocol/publish/thirdweb: SeedSigner alone cannot send sponsored txs. Pass fromThirdwebAccount(account) or a PublishWallet.");
830
+ return Z(e);
831
+ }
832
+ function qe(e) {
833
+ return X(e) ? e.signer : J(e) ? e : Z(e).signer;
834
+ }
835
+ //#endregion
836
+ //#region src/services/revoke/revokeAttestations.ts
837
+ async function Je(e) {
838
+ if (!e) return !1;
839
+ let t = i();
840
+ if (!t) return !1;
841
+ let n = await t(), r = e.toLowerCase();
842
+ return !!n?.some((e) => e?.toLowerCase() === r);
843
+ }
844
+ async function Ye(e) {
845
+ let { seedLocalId: n, seedUid: i, seedSchemaUid: c } = e, l = await r({
846
+ seedLocalId: n,
847
+ seedUid: i
848
+ }), u = U();
849
+ if (!u) try {
850
+ let { getConnectedAccount: e } = await import("./publishAuthorization-BzmqxKCT.js").then((e) => e.B), { resolveRevokeAccount: t } = await import("./resolveRevokeAccount-hwtpdojw.js"), n = await e();
851
+ if (!n) throw Error("No wallet connected. Connect a wallet to revoke attestations.");
852
+ u = Z(await t({
853
+ account: n,
854
+ attester: l
855
+ }));
856
+ } catch (e) {
857
+ throw e instanceof Error && e.message.includes("No wallet connected") || e instanceof Error && e.message.includes("Revocation not supported") ? e : Error("No wallet connected. Use useSeedWallet / setPublishWallet, or @seedprotocol/publish/thirdweb ConnectButton.", { cause: e });
858
+ }
859
+ else if (await Je(l)) {
860
+ let { modularAccountModuleContract: e } = $();
861
+ if (!e?.trim()) throw Error("Revocation not supported for items published via the modular executor.");
862
+ }
863
+ let te = u.txSender, [d, f] = await Promise.all([o(i), a(i)]), p = d.map((e) => e.uid).filter((e) => s(e)), m = /* @__PURE__ */ new Map();
864
+ for (let { uid: e, schemaUid: t } of f) {
865
+ if (!s(e)) continue;
866
+ let n = m.get(t) ?? [];
867
+ n.push(e), m.set(t, n);
868
+ }
869
+ let h = [];
870
+ for (let [e, t] of m) t.length > 0 && h.push({
871
+ schema: e,
872
+ data: t.map((e) => ({ uid: e }))
873
+ });
874
+ p.length > 0 && h.push({
875
+ schema: t,
876
+ data: p.map((e) => ({ uid: e }))
877
+ }), h.push({
878
+ schema: c,
879
+ data: [{ uid: i }]
880
+ });
881
+ for (let e of h) {
882
+ if (e.data.length === 0) continue;
883
+ let t = V([e]);
884
+ try {
885
+ await P((await te.sendTransaction(t)).transactionHash);
886
+ } catch (e) {
887
+ let t = e instanceof Error ? e.message : String(e);
888
+ if (t.includes("AccessDenied") || t.includes("0x4ca88867")) throw Error("Only the original attester can revoke attestations. Connect the wallet that published this item.");
889
+ if (t.includes("AlreadyRevoked")) continue;
890
+ throw e;
891
+ }
892
+ }
893
+ let ne = Math.floor(Date.now() / 1e3);
894
+ await ee({
895
+ seedLocalId: n,
896
+ revokedAt: ne
897
+ });
898
+ }
899
+ //#endregion
900
+ //#region src/config.ts
901
+ var Q = null;
902
+ function Xe(e) {
903
+ Q = e;
904
+ }
905
+ function Ze() {
906
+ return Q;
907
+ }
908
+ function Qe(e) {
909
+ Xe(e), l(async () => {
910
+ let e = U();
911
+ if (e?.publisherAddress) return e.publisherAddress;
912
+ if (e?.signer?.address) return e.signer.address;
913
+ }), u(Ye), import("./worker-Exgca_h6.js").then((e) => {
914
+ e.startArweaveL1FinalizeWorker();
915
+ }), c(async () => e.useModularExecutor && e.modularAccountModuleContract ? [e.modularAccountModuleContract] : []);
916
+ }
917
+ var $e = Qe;
918
+ function $() {
919
+ let t = Q;
920
+ if (!t) throw Error("@seedprotocol/publish: Call initPublish() or ensure PublishProvider is mounted with config before using the publish package");
921
+ let n = t.useArweaveBundler ?? !1, r = t.arweaveUploadVerificationBaseUrl ?? t.uploadApiBaseUrl, i = t.arweaveGraphqlUrl ?? e, a = t.useModularExecutor ?? !1, o = t.chain ?? O, s = t.accountMode ?? (t.bundlerUrl ? "eip7702" : "eoa");
922
+ return {
923
+ ...t,
924
+ thirdwebAccountFactoryAddress: y,
925
+ easContractAddress: b,
926
+ useIntegerLocalIds: t.useIntegerLocalIds ?? !1,
927
+ useDirectEas: t.useDirectEas ?? !1,
928
+ modularAccountModuleData: t.modularAccountModuleData ?? "0x",
929
+ useModularExecutor: a,
930
+ useArweaveBundler: n,
931
+ arweaveUploadVerificationBaseUrl: r,
932
+ arweaveGraphqlUrl: i,
933
+ autoDeployManagedAccount: t.autoDeployManagedAccount ?? !1,
934
+ autoDeployEip7702ModularAccount: et(t, a),
935
+ chain: o,
936
+ accountMode: s
937
+ };
938
+ }
939
+ function et(e, t) {
940
+ return e.autoDeployEip7702ModularAccount === !0 || e.autoDeployEip7702ModularAccount !== !1 && t;
941
+ }
942
+ //#endregion
943
+ export { le as $, L as A, _e as B, Fe as C, V as D, Ne as E, Ce as F, A as G, F as H, Ee as I, b as J, k as K, we as L, xe as M, Se as N, De as O, je as P, de as Q, Te as R, Pe as S, Me as T, be as U, N as V, P as W, ue as X, se as Y, x as Z, Y as _, qe as a, Re as b, We as c, He as d, ce as et, K as f, J as g, X as h, Qe as i, R as j, I as k, Ue as l, Be as m, Ze as n, _ as nt, Ke as o, q as p, he as q, $ as r, Z as s, $e as t, y as tt, Ve as u, ze as v, B as w, z as x, U as y, Ae as z };
944
+
945
+ //# sourceMappingURL=config-gmiloACE.js.map