@seedprotocol/arweave 0.7.11 → 0.7.12-next.1410.gda14c61

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.
@@ -1,11 +1,11 @@
1
1
  import { GraphQLClient as e } from "graphql-request";
2
2
  import t from "debug";
3
3
  //#region src/constants.ts
4
- var n = "ar.seedprotocol.io", r = "", i = "", a = "127.0.0.1", o = 1984, s = `https://${n}/graphql`, c = [
5
- "ar.seedprotocol.io",
4
+ var n = "arweave.net", r = "", i = "", a = "127.0.0.1", o = 1984, s = `https://${n}/graphql`, c = [
6
5
  "arweave.net",
7
6
  "permagate.io",
8
- "zigza.xyz"
7
+ "zigza.xyz",
8
+ "ar.seedprotocol.io"
9
9
  ], ee = ["ARWEAVE_READ_GATEWAYS", "NEXT_PUBLIC_ARWEAVE_READ_GATEWAYS"], te = [
10
10
  "NEXT_PUBLIC_ARWEAVE_HOST",
11
11
  "ARWEAVE_HOST",
@@ -15,20 +15,16 @@ function ne(e) {
15
15
  let t = e.trim();
16
16
  return t.startsWith("http://") ? t.slice(7).replace(/\/$/, "") : t.startsWith("https://") ? t.slice(8).replace(/\/$/, "") : t.replace(/\/$/, "");
17
17
  }
18
- function l() {
18
+ function re() {
19
19
  if (typeof process < "u" && process.env) for (let e of te) {
20
20
  let t = process.env[e]?.trim();
21
21
  if (t) return ne(t);
22
22
  }
23
23
  }
24
- function re(e, t) {
25
- let r = e.trim().toLowerCase().replace(/\/$/, ""), i = n.toLowerCase();
26
- return r === i ? [...t] : t.filter((e) => e.toLowerCase() !== i);
24
+ function l(e) {
25
+ return d(e, u());
27
26
  }
28
- function u(e) {
29
- return ae(e, re(e, ie()));
30
- }
31
- function ie() {
27
+ function u() {
32
28
  if (typeof process > "u" || !process.env) return [...c];
33
29
  for (let e of ee) {
34
30
  let t = process.env[e]?.trim();
@@ -36,7 +32,7 @@ function ie() {
36
32
  }
37
33
  return [...c];
38
34
  }
39
- function ae(e, t) {
35
+ function d(e, t) {
40
36
  let n = /* @__PURE__ */ new Set(), r = [], i = (e) => e.trim().toLowerCase().replace(/\/$/, ""), a = (e) => {
41
37
  let t = e.trim().replace(/\/$/, "");
42
38
  if (!t) return;
@@ -47,7 +43,7 @@ function ae(e, t) {
47
43
  for (let e of t) a(e);
48
44
  return r;
49
45
  }
50
- function oe(e) {
46
+ function ie(e) {
51
47
  let t = e.trim().toLowerCase();
52
48
  if (!t) return !1;
53
49
  if (t.endsWith("arweave.net") || t.endsWith("ar-io.net")) return !0;
@@ -59,46 +55,46 @@ function oe(e) {
59
55
  }
60
56
  //#endregion
61
57
  //#region src/content/arweaveContent.ts
62
- var d;
63
- function se(e) {
64
- d = e;
58
+ var f;
59
+ function ae(e) {
60
+ f = e;
65
61
  }
66
- function f() {
67
- return d !== void 0;
62
+ function oe() {
63
+ return f !== void 0;
68
64
  }
69
65
  async function p(e, t) {
70
- return d ? d(e, t) : e;
66
+ return f ? f(e, t) : e;
71
67
  }
72
- function m(e) {
68
+ function se(e) {
73
69
  return (e.headers?.get("content-type"))?.split(";")[0]?.trim().toLowerCase() || void 0;
74
70
  }
75
71
  async function ce(e, t) {
76
72
  return p({
77
73
  bytes: new Uint8Array(await e.arrayBuffer()),
78
- contentType: m(e)
74
+ contentType: se(e)
79
75
  }, t);
80
76
  }
81
77
  //#endregion
82
78
  //#region src/moduleOwner.ts
83
- var h = Symbol.for("@seedprotocol/arweave:clientOwner"), g = Object.freeze({ package: "@seedprotocol/arweave" });
79
+ var m = Symbol.for("@seedprotocol/arweave:clientOwner"), h = Object.freeze({ package: "@seedprotocol/arweave" });
84
80
  function le() {
85
- globalThis[h] = g;
81
+ globalThis[m] = h;
86
82
  }
87
- var _ = class extends Error {
83
+ var g = class extends Error {
88
84
  constructor() {
89
85
  super("Two copies of @seedprotocol/arweave are loaded, and the Arweave client was registered on the other copy (e.g. by SeedClient). Reads through this copy would use a different client and gateway. Make sure every @seedprotocol/* package is the same version and installed once (`npm ls @seedprotocol/arweave`). With Vite, keep @seedprotocol/* packages out of optimizeDeps.exclude so they are pre-bundled together, and dedupe them (seedVitePlugin does) when they are linked into the app."), this.name = "DuplicateArweaveModuleError";
90
86
  }
91
87
  };
92
88
  function ue() {
93
- let e = globalThis[h];
94
- if (e !== void 0 && e !== g) throw new _();
89
+ let e = globalThis[m];
90
+ if (e !== void 0 && e !== h) throw new g();
95
91
  }
96
92
  function de() {
97
- delete globalThis[h];
93
+ delete globalThis[m];
98
94
  }
99
95
  //#endregion
100
96
  //#region src/ArweaveClient/BaseArweaveClient.ts
101
- function v(e) {
97
+ function _(e) {
102
98
  let t = e.trim();
103
99
  return t.startsWith("http://") ? {
104
100
  protocol: "http",
@@ -111,7 +107,7 @@ function v(e) {
111
107
  host: t.replace(/\/$/, "")
112
108
  };
113
109
  }
114
- var y = n, b = "https", x = !1, S = !1, C = class e {
110
+ var v = n, y = "https", b = !1, x = !1, S = class e {
115
111
  static _impl = null;
116
112
  static configure(t) {
117
113
  if (!t) throw Error("Cannot configure ArweaveClient with undefined or null. Ensure the platform-specific ArweaveClient is properly created.");
@@ -125,10 +121,10 @@ var y = n, b = "https", x = !1, S = !1, C = class e {
125
121
  return e._impl;
126
122
  }
127
123
  static resolveGateway() {
128
- let e = l();
129
- return e && !x && !S ? v(e) : {
130
- protocol: b,
131
- host: y
124
+ let e = re();
125
+ return e && !b && !x ? _(e) : {
126
+ protocol: y,
127
+ host: v
132
128
  };
133
129
  }
134
130
  static getHost() {
@@ -167,22 +163,22 @@ var y = n, b = "https", x = !1, S = !1, C = class e {
167
163
  return `${e}://${t}`;
168
164
  }
169
165
  static setHost(e) {
170
- let t = v(e);
171
- y = t.host, b = t.protocol, x = !0, S = !1;
166
+ let t = _(e);
167
+ v = t.host, y = t.protocol, b = !0, x = !1;
172
168
  }
173
169
  static isReadGatewayLocked() {
174
- return x;
170
+ return b;
175
171
  }
176
172
  static resetReadGatewaySelectionStateForTests() {
177
- S = !1;
173
+ x = !1;
178
174
  }
179
175
  static setPreferredReadGateway(e) {
180
- let t = v(e);
181
- y = t.host, b = t.protocol, x = !1;
176
+ let t = _(e);
177
+ v = t.host, y = t.protocol, b = !1;
182
178
  }
183
179
  static applyProbedReadGateway(e) {
184
- let t = v(e);
185
- y = t.host, b = t.protocol, x = !1, S = !0;
180
+ let t = _(e);
181
+ v = t.host, y = t.protocol, b = !1, x = !0;
186
182
  }
187
183
  static getEndpoint() {
188
184
  return `${this.getBaseUrl()}/graphql`;
@@ -201,7 +197,7 @@ var y = n, b = "https", x = !1, S = !1, C = class e {
201
197
  }
202
198
  static async getTransactionData(t, n) {
203
199
  let r = await e.requireImpl().getTransactionData(t, n);
204
- if (n?.decode === !1 || !f()) return r;
200
+ if (n?.decode === !1 || !oe()) return r;
205
201
  let i = typeof r == "string", { bytes: a } = await p({ bytes: i ? new TextEncoder().encode(r) : r }, { transactionId: t });
206
202
  return i ? new TextDecoder().decode(a) : a;
207
203
  }
@@ -214,523 +210,164 @@ var y = n, b = "https", x = !1, S = !1, C = class e {
214
210
  static downloadFiles(t) {
215
211
  return e.requireImpl().downloadFiles(t);
216
212
  }
217
- }, fe = {
218
- "\n query GetTransactionTags($transactionId: ID!) {\n tags: transaction(id: $transactionId) {\n id\n tags {\n name\n value\n }\n }\n }\n": {
219
- kind: "Document",
220
- definitions: [{
221
- kind: "OperationDefinition",
222
- operation: "query",
223
- name: {
224
- kind: "Name",
225
- value: "GetTransactionTags"
226
- },
227
- variableDefinitions: [{
228
- kind: "VariableDefinition",
229
- variable: {
230
- kind: "Variable",
231
- name: {
232
- kind: "Name",
233
- value: "transactionId"
234
- }
235
- },
236
- type: {
237
- kind: "NonNullType",
238
- type: {
239
- kind: "NamedType",
240
- name: {
241
- kind: "Name",
242
- value: "ID"
243
- }
244
- }
245
- }
246
- }],
247
- selectionSet: {
248
- kind: "SelectionSet",
249
- selections: [{
250
- kind: "Field",
251
- alias: {
252
- kind: "Name",
253
- value: "tags"
254
- },
255
- name: {
256
- kind: "Name",
257
- value: "transaction"
258
- },
259
- arguments: [{
260
- kind: "Argument",
261
- name: {
262
- kind: "Name",
263
- value: "id"
264
- },
265
- value: {
266
- kind: "Variable",
267
- name: {
268
- kind: "Name",
269
- value: "transactionId"
270
- }
271
- }
272
- }],
273
- selectionSet: {
274
- kind: "SelectionSet",
275
- selections: [{
276
- kind: "Field",
277
- name: {
278
- kind: "Name",
279
- value: "id"
280
- }
281
- }, {
282
- kind: "Field",
283
- name: {
284
- kind: "Name",
285
- value: "tags"
286
- },
287
- selectionSet: {
288
- kind: "SelectionSet",
289
- selections: [{
290
- kind: "Field",
291
- name: {
292
- kind: "Name",
293
- value: "name"
294
- }
295
- }, {
296
- kind: "Field",
297
- name: {
298
- kind: "Name",
299
- value: "value"
300
- }
301
- }]
302
- }
303
- }]
304
- }
305
- }]
306
- }
307
- }]
308
- },
309
- "\n query GetArweaveTransactions(\n $owners: [String!]\n $first: Int\n $after: String\n ) {\n transactions(owners: $owners, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n anchor\n signature\n block {\n id\n height\n }\n data {\n size\n type\n }\n tags {\n name\n value\n }\n }\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n": {
310
- kind: "Document",
311
- definitions: [{
312
- kind: "OperationDefinition",
313
- operation: "query",
314
- name: {
315
- kind: "Name",
316
- value: "GetArweaveTransactions"
317
- },
318
- variableDefinitions: [
319
- {
320
- kind: "VariableDefinition",
321
- variable: {
322
- kind: "Variable",
323
- name: {
324
- kind: "Name",
325
- value: "owners"
326
- }
327
- },
328
- type: {
329
- kind: "ListType",
330
- type: {
331
- kind: "NonNullType",
332
- type: {
333
- kind: "NamedType",
334
- name: {
335
- kind: "Name",
336
- value: "String"
337
- }
338
- }
339
- }
340
- }
341
- },
342
- {
343
- kind: "VariableDefinition",
344
- variable: {
345
- kind: "Variable",
346
- name: {
347
- kind: "Name",
348
- value: "first"
349
- }
350
- },
351
- type: {
352
- kind: "NamedType",
353
- name: {
354
- kind: "Name",
355
- value: "Int"
356
- }
357
- }
358
- },
359
- {
360
- kind: "VariableDefinition",
361
- variable: {
362
- kind: "Variable",
363
- name: {
364
- kind: "Name",
365
- value: "after"
366
- }
367
- },
368
- type: {
369
- kind: "NamedType",
370
- name: {
371
- kind: "Name",
372
- value: "String"
373
- }
374
- }
375
- }
376
- ],
377
- selectionSet: {
378
- kind: "SelectionSet",
379
- selections: [{
380
- kind: "Field",
381
- name: {
382
- kind: "Name",
383
- value: "transactions"
384
- },
385
- arguments: [
386
- {
387
- kind: "Argument",
388
- name: {
389
- kind: "Name",
390
- value: "owners"
391
- },
392
- value: {
393
- kind: "Variable",
394
- name: {
395
- kind: "Name",
396
- value: "owners"
397
- }
398
- }
399
- },
400
- {
401
- kind: "Argument",
402
- name: {
403
- kind: "Name",
404
- value: "first"
405
- },
406
- value: {
407
- kind: "Variable",
408
- name: {
409
- kind: "Name",
410
- value: "first"
411
- }
412
- }
413
- },
414
- {
415
- kind: "Argument",
416
- name: {
417
- kind: "Name",
418
- value: "after"
419
- },
420
- value: {
421
- kind: "Variable",
422
- name: {
423
- kind: "Name",
424
- value: "after"
425
- }
426
- }
427
- }
428
- ],
429
- selectionSet: {
430
- kind: "SelectionSet",
431
- selections: [{
432
- kind: "Field",
433
- name: {
434
- kind: "Name",
435
- value: "edges"
436
- },
437
- selectionSet: {
438
- kind: "SelectionSet",
439
- selections: [{
440
- kind: "Field",
441
- name: {
442
- kind: "Name",
443
- value: "cursor"
444
- }
445
- }, {
446
- kind: "Field",
447
- name: {
448
- kind: "Name",
449
- value: "node"
450
- },
451
- selectionSet: {
452
- kind: "SelectionSet",
453
- selections: [
454
- {
455
- kind: "Field",
456
- name: {
457
- kind: "Name",
458
- value: "id"
459
- }
460
- },
461
- {
462
- kind: "Field",
463
- name: {
464
- kind: "Name",
465
- value: "anchor"
466
- }
467
- },
468
- {
469
- kind: "Field",
470
- name: {
471
- kind: "Name",
472
- value: "signature"
473
- }
474
- },
475
- {
476
- kind: "Field",
477
- name: {
478
- kind: "Name",
479
- value: "block"
480
- },
481
- selectionSet: {
482
- kind: "SelectionSet",
483
- selections: [{
484
- kind: "Field",
485
- name: {
486
- kind: "Name",
487
- value: "id"
488
- }
489
- }, {
490
- kind: "Field",
491
- name: {
492
- kind: "Name",
493
- value: "height"
494
- }
495
- }]
496
- }
497
- },
498
- {
499
- kind: "Field",
500
- name: {
501
- kind: "Name",
502
- value: "data"
503
- },
504
- selectionSet: {
505
- kind: "SelectionSet",
506
- selections: [{
507
- kind: "Field",
508
- name: {
509
- kind: "Name",
510
- value: "size"
511
- }
512
- }, {
513
- kind: "Field",
514
- name: {
515
- kind: "Name",
516
- value: "type"
517
- }
518
- }]
519
- }
520
- },
521
- {
522
- kind: "Field",
523
- name: {
524
- kind: "Name",
525
- value: "tags"
526
- },
527
- selectionSet: {
528
- kind: "SelectionSet",
529
- selections: [{
530
- kind: "Field",
531
- name: {
532
- kind: "Name",
533
- value: "name"
534
- }
535
- }, {
536
- kind: "Field",
537
- name: {
538
- kind: "Name",
539
- value: "value"
540
- }
541
- }]
542
- }
543
- }
544
- ]
545
- }
546
- }]
547
- }
548
- }, {
549
- kind: "Field",
550
- name: {
551
- kind: "Name",
552
- value: "pageInfo"
553
- },
554
- selectionSet: {
555
- kind: "SelectionSet",
556
- selections: [{
557
- kind: "Field",
558
- name: {
559
- kind: "Name",
560
- value: "hasNextPage"
561
- }
562
- }]
563
- }
564
- }]
565
- }
566
- }]
567
- }
568
- }]
569
- }
570
- };
571
- function pe(e) {
572
- return fe[e] ?? {};
573
- }
574
- //#endregion
575
- //#region src/ArweaveClient/queries.ts
576
- var me = pe("\n query GetTransactionTags($transactionId: ID!) {\n tags: transaction(id: $transactionId) {\n id\n tags {\n name\n value\n }\n }\n }\n"), he = pe("\n query GetArweaveTransactions(\n $owners: [String!]\n $first: Int\n $after: String\n ) {\n transactions(owners: $owners, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n anchor\n signature\n block {\n id\n height\n }\n data {\n size\n type\n }\n tags {\n name\n value\n }\n }\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n"), ge = 1, _e = 6e4, w = ge, T = _e, E = /* @__PURE__ */ new Map();
577
- function D(e) {
213
+ }, fe = 1, pe = 6e4, C = fe, w = pe, T = /* @__PURE__ */ new Map();
214
+ function E(e) {
578
215
  let t = e.trim();
579
216
  return t ? (t.startsWith("http://") ? t = t.slice(7) : t.startsWith("https://") && (t = t.slice(8)), t.replace(/\/$/, "").toLowerCase()) : "";
580
217
  }
581
- function O(e) {
582
- let t = E.get(e);
218
+ function me(e) {
219
+ let t = T.get(e);
583
220
  return t || (t = {
584
221
  failures: 0,
585
222
  openedAt: null,
586
223
  halfOpenProbeInFlight: !1
587
- }, E.set(e, t)), t;
224
+ }, T.set(e, t)), t;
588
225
  }
589
- function k(e, t) {
590
- return e.openedAt == null ? "closed" : t - e.openedAt >= T ? "half-open" : "open";
226
+ function D(e, t) {
227
+ return e.openedAt == null ? "closed" : t - e.openedAt >= w ? "half-open" : "open";
591
228
  }
592
- function ve(e) {
593
- e.failureThreshold != null && e.failureThreshold >= 1 && (w = e.failureThreshold), e.openDurationMs != null && e.openDurationMs >= 0 && (T = e.openDurationMs);
229
+ function he(e) {
230
+ e.failureThreshold != null && e.failureThreshold >= 1 && (C = e.failureThreshold), e.openDurationMs != null && e.openDurationMs >= 0 && (w = e.openDurationMs);
594
231
  }
595
- function A() {
596
- E.clear(), w = ge, T = _e;
232
+ function ge() {
233
+ T.clear(), C = fe, w = pe;
597
234
  }
598
- function j(e, t = Date.now()) {
599
- let n = D(e);
235
+ function O(e, t = Date.now()) {
236
+ let n = E(e);
600
237
  if (!n) return !1;
601
- let r = E.get(n);
238
+ let r = T.get(n);
602
239
  if (!r) return !1;
603
- let i = k(r, t);
240
+ let i = D(r, t);
604
241
  return !!(i === "open" || i === "half-open" && r.halfOpenProbeInFlight);
605
242
  }
606
- function ye(e, t = Date.now()) {
607
- let n = D(e);
243
+ function _e(e, t = Date.now()) {
244
+ let n = E(e);
608
245
  if (!n) return "closed";
609
- let r = E.get(n);
610
- return r ? k(r, t) : "closed";
246
+ let r = T.get(n);
247
+ return r ? D(r, t) : "closed";
611
248
  }
612
- function M(e, t = Date.now()) {
613
- let n = D(e);
249
+ function k(e, t = Date.now()) {
250
+ let n = E(e);
614
251
  if (!n) return;
615
- let r = O(n);
616
- k(r, t) === "half-open" && (r.halfOpenProbeInFlight = !0);
252
+ let r = me(n);
253
+ D(r, t) === "half-open" && (r.halfOpenProbeInFlight = !0);
617
254
  }
618
- function N(e) {
619
- let t = D(e);
620
- t && E.set(t, {
255
+ function A(e) {
256
+ let t = E(e);
257
+ t && T.set(t, {
621
258
  failures: 0,
622
259
  openedAt: null,
623
260
  halfOpenProbeInFlight: !1
624
261
  });
625
262
  }
626
- function P(e, t = Date.now()) {
627
- let n = D(e);
263
+ function j(e, t = Date.now()) {
264
+ let n = E(e);
628
265
  if (!n) return;
629
- let r = O(n);
630
- r.failures += 1, r.halfOpenProbeInFlight = !1, r.failures >= w && (r.openedAt = t);
266
+ let r = me(n);
267
+ r.failures += 1, r.halfOpenProbeInFlight = !1, r.failures >= C && (r.openedAt = t);
631
268
  }
632
- function be(e = Date.now()) {
269
+ function ve(e = Date.now()) {
633
270
  let t = [];
634
- for (let n of E.keys()) j(n, e) && t.push(n);
271
+ for (let n of T.keys()) O(n, e) && t.push(n);
635
272
  return t;
636
273
  }
637
274
  //#endregion
638
275
  //#region src/ArweaveClient/selectReadGateway.ts
639
- var F = 18e4, xe = 6e4, Se = 5e3, I = null, L = null, R = null;
640
- function z() {
641
- I = null, L = null;
276
+ var M = 18e4, ye = 6e4, be = 5e3, N = null, P = null, F = null;
277
+ function I() {
278
+ N = null, P = null;
642
279
  }
643
- function Ce() {
644
- z(), R = null, A(), C.resetReadGatewaySelectionStateForTests(), C.isReadGatewayLocked() || C.setPreferredReadGateway(n);
280
+ function xe() {
281
+ I(), F = null, ge(), S.resetReadGatewaySelectionStateForTests(), S.isReadGatewayLocked() || S.setPreferredReadGateway(n);
645
282
  }
646
- function we() {
647
- return C.isReadGatewayLocked() ? !0 : I && Date.now() < I.expiresAt ? I.healthy : R != null;
283
+ function Se() {
284
+ return S.isReadGatewayLocked() ? !0 : N && Date.now() < N.expiresAt ? N.healthy : F != null;
648
285
  }
649
- function Te() {
650
- return R;
286
+ function Ce() {
287
+ return F;
651
288
  }
652
- async function B(e, t) {
289
+ async function L(e, t) {
653
290
  let n = `${e.replace(/\/$/, "")}/info`, r = e;
654
291
  try {
655
292
  r = new URL(e.includes("://") ? e : `https://${e}`).host;
656
293
  } catch {
657
294
  r = e.replace(/^https?:\/\//, "").replace(/\/$/, "");
658
295
  }
659
- if (j(r)) return !1;
660
- M(r);
296
+ if (O(r)) return !1;
297
+ k(r);
661
298
  let i, a = new AbortController(), o = t ?? a.signal;
662
- t || (i = setTimeout(() => a.abort(), Se));
299
+ t || (i = setTimeout(() => a.abort(), be));
663
300
  try {
664
301
  let e = await fetch(n, {
665
302
  method: "GET",
666
303
  signal: o,
667
304
  headers: { Accept: "application/json" }
668
305
  });
669
- if (!e.ok) return P(r), !1;
306
+ if (!e.ok) return j(r), !1;
670
307
  let t = await e.text();
671
- if (!t.trim()) return P(r), !1;
308
+ if (!t.trim()) return j(r), !1;
672
309
  try {
673
310
  let e = JSON.parse(t), n = typeof e == "object" && !!e;
674
- return n ? N(r) : P(r), n;
311
+ return n ? A(r) : j(r), n;
675
312
  } catch {
676
- return P(r), !1;
313
+ return j(r), !1;
677
314
  }
678
315
  } catch {
679
- return P(r), !1;
316
+ return j(r), !1;
680
317
  } finally {
681
318
  i && clearTimeout(i);
682
319
  }
683
320
  }
684
- async function V(e, t = "https", n) {
321
+ async function R(e, t = "https", n) {
685
322
  for (let r of e) {
686
323
  let e = r.trim().replace(/\/$/, "");
687
- if (e && !j(e) && await B(`${t}://${e}`, n)) return e;
324
+ if (e && !O(e) && await L(`${t}://${e}`, n)) return e;
688
325
  }
689
326
  return null;
690
327
  }
691
- function Ee() {
692
- return u(C.getHost());
328
+ function we() {
329
+ return l(S.getHost());
693
330
  }
694
- async function De(e) {
695
- if (C.isReadGatewayLocked()) return C.getHost();
696
- if (I && Date.now() < I.expiresAt) return I.host;
697
- if (L) return L;
698
- L = (async () => {
699
- let t = await V(Ee(), C.getProtocol(), e);
700
- if (C.isReadGatewayLocked()) I = {
701
- host: C.getHost(),
331
+ async function z(e) {
332
+ if (S.isReadGatewayLocked()) return S.getHost();
333
+ if (N && Date.now() < N.expiresAt) return N.host;
334
+ if (P) return P;
335
+ P = (async () => {
336
+ let t = await R(we(), S.getProtocol(), e);
337
+ if (S.isReadGatewayLocked()) N = {
338
+ host: S.getHost(),
702
339
  healthy: !0,
703
- expiresAt: Date.now() + F
340
+ expiresAt: Date.now() + M
704
341
  };
705
- else if (t) C.applyProbedReadGateway(t), R = t, I = {
342
+ else if (t) S.applyProbedReadGateway(t), F = t, N = {
706
343
  host: t,
707
344
  healthy: !0,
708
- expiresAt: Date.now() + F
345
+ expiresAt: Date.now() + M
709
346
  };
710
347
  else {
711
- let e = R ?? C.getHost();
712
- R && C.getHost() !== R && C.applyProbedReadGateway(R), I = {
348
+ let e = F ?? S.getHost();
349
+ F && S.getHost() !== F && S.applyProbedReadGateway(F), N = {
713
350
  host: e,
714
351
  healthy: !1,
715
- expiresAt: Date.now() + xe
352
+ expiresAt: Date.now() + ye
716
353
  };
717
354
  }
718
- return I.host;
355
+ return N.host;
719
356
  })();
720
357
  try {
721
- return await L;
358
+ return await P;
722
359
  } finally {
723
- L = null;
360
+ P = null;
724
361
  }
725
362
  }
726
363
  //#endregion
727
364
  //#region src/gateway/resolveSeedGatewayEndpoints.ts
728
- var Oe = 18e4, H = null, U = /* @__PURE__ */ new Map();
729
- function ke() {
730
- H = null, U.clear();
365
+ var B = 18e4, V = null, H = /* @__PURE__ */ new Map();
366
+ function U() {
367
+ V = null, H.clear();
731
368
  }
732
- function Ae(e) {
733
- let t = (e ?? "ar.seedprotocol.io").trim();
369
+ function Te(e) {
370
+ let t = e?.trim() || "arweave.net";
734
371
  return t.startsWith("http://") ? {
735
372
  protocol: "http",
736
373
  host: t.slice(7).replace(/\/$/, "")
@@ -742,11 +379,11 @@ function Ae(e) {
742
379
  host: t.replace(/\/$/, "")
743
380
  };
744
381
  }
745
- function je(e) {
746
- let { host: t, protocol: n } = Ae(e.arweaveDomain);
382
+ function Ee(e) {
383
+ let { host: t, protocol: n } = Te(e.arweaveDomain);
747
384
  return `${n}://${t}`;
748
385
  }
749
- function Me(e) {
386
+ function De(e) {
750
387
  let t = e.hyper?.localSidecarHost?.trim() || "127.0.0.1", n = e.hyper?.localSidecarPort ?? 1984;
751
388
  return {
752
389
  host: n === 80 || n === 443 ? t : `${t}:${n}`,
@@ -754,7 +391,7 @@ function Me(e) {
754
391
  baseUrl: `http://${t}:${n}`
755
392
  };
756
393
  }
757
- function Ne() {
394
+ function Oe() {
758
395
  try {
759
396
  let e = globalThis.window?.location?.origin;
760
397
  return typeof e == "string" && e.length > 0 ? e.replace(/\/$/, "") : void 0;
@@ -767,7 +404,7 @@ function W(e, t) {
767
404
  if (!n) throw Error("proxyBaseUrl is empty");
768
405
  if (n.startsWith("http://") || n.startsWith("https://")) return n.replace(/\/$/, "");
769
406
  if (n.startsWith("/")) {
770
- let r = (t?.origin?.trim() || Ne() || "").replace(/\/$/, "");
407
+ let r = (t?.origin?.trim() || Oe() || "").replace(/\/$/, "");
771
408
  if (!r) throw Error(`Relative proxyBaseUrl "${e}" requires a browser origin or resolve options.origin`);
772
409
  return `${r}${n.replace(/\/$/, "")}`;
773
410
  }
@@ -776,23 +413,23 @@ function W(e, t) {
776
413
  async function G(e, t, n) {
777
414
  let r = Date.now();
778
415
  if (t === "sidecar") {
779
- if (H && r < H.expiresAt) return H.healthy;
780
- let t = await B(e, n);
781
- return H = {
416
+ if (V && r < V.expiresAt) return V.healthy;
417
+ let t = await L(e, n);
418
+ return V = {
782
419
  healthy: t,
783
- expiresAt: r + Oe
420
+ expiresAt: r + B
784
421
  }, t;
785
422
  }
786
- let i = U.get(t);
423
+ let i = H.get(t);
787
424
  if (i && r < i.expiresAt) return i.healthy;
788
- let a = await B(e, n);
789
- return U.set(t, {
425
+ let a = await L(e, n);
426
+ return H.set(t, {
790
427
  healthy: a,
791
- expiresAt: r + Oe
428
+ expiresAt: r + B
792
429
  }), a;
793
430
  }
794
- function Pe(e) {
795
- let { host: t, protocol: n } = Ae(e.arweaveDomain), r = `${n}://${t}`, i = e.uploadApiBaseUrl?.trim() || r;
431
+ function ke(e) {
432
+ let { host: t, protocol: n } = Te(e.arweaveDomain), r = `${n}://${t}`, i = e.uploadApiBaseUrl?.trim() || r;
796
433
  return {
797
434
  mode: e.transport ?? "http-gateway",
798
435
  arweaveHost: t,
@@ -805,8 +442,8 @@ function Pe(e) {
805
442
  publicArweaveBaseUrl: r
806
443
  };
807
444
  }
808
- function Fe(e) {
809
- let t = Me(e), n = e.hyper?.gatewayHyperKey?.trim();
445
+ function Ae(e) {
446
+ let t = De(e), n = e.hyper?.gatewayHyperKey?.trim();
810
447
  return {
811
448
  mode: "hyper",
812
449
  arweaveHost: t.host,
@@ -816,10 +453,10 @@ function Fe(e) {
816
453
  uploadApiBaseUrl: t.baseUrl,
817
454
  activePath: "hyper-sidecar",
818
455
  gatewayHyperKey: n || void 0,
819
- publicArweaveBaseUrl: je(e)
456
+ publicArweaveBaseUrl: Ee(e)
820
457
  };
821
458
  }
822
- function Ie(e, t) {
459
+ function je(e, t) {
823
460
  let n = new URL(t), r = n.protocol === "http:" ? "http" : "https", i = n.pathname.replace(/\/$/, ""), a = i ? `${n.host}${i}` : n.host, o = `${r}://${a}`;
824
461
  return {
825
462
  mode: e.transport ?? "http-gateway",
@@ -831,56 +468,56 @@ function Ie(e, t) {
831
468
  activePath: "http-proxy",
832
469
  gatewayHyperKey: e.hyper?.gatewayHyperKey?.trim() || void 0,
833
470
  proxyBaseUrl: t,
834
- publicArweaveBaseUrl: je(e)
471
+ publicArweaveBaseUrl: Ee(e)
835
472
  };
836
473
  }
837
- async function Le(e, t) {
474
+ async function Me(e, t) {
838
475
  let n = e.proxyBaseUrl?.trim();
839
476
  if (!n) return null;
840
477
  let r = W(n, { origin: t?.origin });
841
- return e.hyper?.probeSidecar !== !1 && !await G(r, `proxy:${r}`, t?.signal) ? null : Ie(e, r);
478
+ return e.hyper?.probeSidecar !== !1 && !await G(r, `proxy:${r}`, t?.signal) ? null : je(e, r);
842
479
  }
843
- async function Re(e, t) {
844
- t?.forceSidecarProbe && ke();
480
+ async function Ne(e, t) {
481
+ t?.forceSidecarProbe && U();
845
482
  let n = e.transport ?? "http-gateway", r = e.hyper?.probeSidecar !== !1;
846
483
  if (n === "http-gateway") {
847
484
  if (e.proxyBaseUrl?.trim()) {
848
485
  let i = W(e.proxyBaseUrl, { origin: t?.origin });
849
486
  if (r && !await G(i, `proxy:${i}`, t?.signal)) throw Error(`Gateway HTTP proxy not reachable at ${i}. Ensure your Node route runs createGatewayProxy (or equivalent) and mounts at proxyBaseUrl.`);
850
- return Ie({
487
+ return je({
851
488
  ...e,
852
489
  transport: n
853
490
  }, i);
854
491
  }
855
- return Pe({
492
+ return ke({
856
493
  ...e,
857
494
  transport: n
858
495
  });
859
496
  }
860
497
  if (n === "hyper") {
861
- let i = await Le({
498
+ let i = await Me({
862
499
  ...e,
863
500
  transport: n
864
501
  }, t);
865
502
  if (i) return i;
866
- let a = Fe({
503
+ let a = Ae({
867
504
  ...e,
868
505
  transport: n
869
506
  });
870
507
  if (r && !await G(a.arweaveBaseUrl, "sidecar", t?.signal)) throw Error(`Gateway Hyper sidecar not reachable at ${a.arweaveBaseUrl}. Run: seed-gateway connect <operator-z32-key> — or configure gateway.proxyBaseUrl for an app-server proxy.`);
871
508
  return a;
872
509
  }
873
- let i = await Le({
510
+ let i = await Me({
874
511
  ...e,
875
512
  transport: n
876
513
  }, t);
877
514
  if (i) return i;
878
- let a = Me(e);
879
- return r && await G(a.baseUrl, "sidecar", t?.signal) ? Fe({
515
+ let a = De(e);
516
+ return r && await G(a.baseUrl, "sidecar", t?.signal) ? Ae({
880
517
  ...e,
881
518
  transport: "hyper"
882
519
  }) : {
883
- ...Pe({
520
+ ...ke({
884
521
  ...e,
885
522
  transport: "http-gateway"
886
523
  }),
@@ -888,23 +525,27 @@ async function Re(e, t) {
888
525
  activePath: "hybrid-fallback-http"
889
526
  };
890
527
  }
891
- function ze(e, t) {
892
- return e.activePath === "hyper-sidecar" || e.activePath === "http-proxy" ? [e.arweaveHost] : u(e.arweaveHost);
528
+ function Pe(e, t) {
529
+ if (e.activePath === "hyper-sidecar" || e.activePath === "http-proxy") {
530
+ let t = new URL(e.publicArweaveBaseUrl), n = l(t.host).map((e, n) => n === 0 ? `${t.protocol}//${e}` : `https://${e}`);
531
+ return [e.arweaveBaseUrl, ...n];
532
+ }
533
+ return l(e.arweaveHost);
893
534
  }
894
535
  //#endregion
895
536
  //#region src/gateway/gatewayState.ts
896
- var Be = null;
537
+ var Fe = null;
897
538
  function K() {
898
- return Be;
539
+ return Fe;
899
540
  }
900
- function Ve(e) {
901
- Be = e;
541
+ function Ie(e) {
542
+ Fe = e;
902
543
  }
903
- var He = [];
544
+ var Le = [];
904
545
  function q() {
905
- return He;
546
+ return Le;
906
547
  }
907
- function Ue(e) {
548
+ function Re(e) {
908
549
  let t = [], n = /* @__PURE__ */ new Set();
909
550
  for (let r of e) {
910
551
  let e = r?.trim();
@@ -918,37 +559,37 @@ function Ue(e) {
918
559
  }
919
560
  n.has(i) || (n.add(i), t.push(i));
920
561
  }
921
- He = t;
562
+ Le = t;
922
563
  }
923
564
  //#endregion
924
565
  //#region src/gateway/readBaseUrls.ts
925
- var We = 1e4;
566
+ var ze = 1e4;
926
567
  function J(e, t, n) {
927
568
  let r = n.trim().replace(/\/$/, "");
928
569
  r && !t.has(r) && (t.add(r), e.push(r));
929
570
  }
930
571
  function Y(e) {
931
- let t = K(), n = C.getProtocol(), r = t ? ze(t) : e?.fallbackHosts?.length ? [...e.fallbackHosts] : u(C.getHost()), i = [], a = /* @__PURE__ */ new Set();
572
+ let t = K(), n = S.getProtocol(), r = t ? Pe(t) : e?.fallbackHosts?.length ? [...e.fallbackHosts] : l(S.getHost()), i = [], a = /* @__PURE__ */ new Set();
932
573
  for (let e of r) {
933
574
  let t = e.trim();
934
575
  t && J(i, a, /^https?:\/\//i.test(t) ? t : `${n}://${t}`);
935
576
  }
936
577
  return i;
937
578
  }
938
- function Ge(e) {
579
+ function Be(e) {
939
580
  let t = [], n = /* @__PURE__ */ new Set();
940
581
  for (let e of q()) J(t, n, e);
941
582
  for (let r of Y(e)) J(t, n, r);
942
583
  return t;
943
584
  }
944
- async function Ke() {
585
+ async function X() {
945
586
  try {
946
587
  let e = K();
947
588
  if (e && (e.activePath === "hyper-sidecar" || e.activePath === "http-proxy")) return;
948
- await De();
589
+ await z();
949
590
  } catch {}
950
591
  }
951
- async function X(e, t, n) {
592
+ async function Z(e, t, n) {
952
593
  let r = new AbortController(), i = setTimeout(() => r.abort(), n?.timeoutMs ?? 1e4);
953
594
  try {
954
595
  let n = await fetch(`${e.replace(/\/$/, "")}/raw/${encodeURIComponent(t)}`, {
@@ -963,24 +604,383 @@ async function X(e, t, n) {
963
604
  clearTimeout(i);
964
605
  }
965
606
  }
966
- async function qe(e, t) {
607
+ async function Ve(e, t) {
967
608
  let n = /* @__PURE__ */ new Set(), r = async (r) => {
968
609
  for (let i of r) {
969
610
  if (n.has(i)) continue;
970
611
  n.add(i);
971
- let r = await X(i, e, t);
612
+ let r = await Z(i, e, t);
972
613
  if (r) try {
973
614
  let { bytes: t } = await ce(r, { transactionId: e }), n = new TextDecoder().decode(t);
974
615
  if (n.length > 0) return n;
975
616
  } catch {}
976
617
  }
977
618
  };
978
- return await r(q()) || (await Ke(), r(Y(t)));
619
+ return await r(q()) || (await X(), r(Y(t)));
979
620
  }
980
621
  //#endregion
981
- //#region src/gateway/transactionStatus.ts
982
- var Je = 1e4, Ye = 2e4, Xe = 1e3, Ze = (e) => e >= 500 || e === 429;
983
- async function Qe(e, t, n) {
622
+ //#region src/graphql/gql/gql.ts
623
+ var He = {
624
+ "\n query GetTransactionTags($transactionId: ID!) {\n tags: transaction(id: $transactionId) {\n id\n tags {\n name\n value\n }\n }\n }\n": {
625
+ kind: "Document",
626
+ definitions: [{
627
+ kind: "OperationDefinition",
628
+ operation: "query",
629
+ name: {
630
+ kind: "Name",
631
+ value: "GetTransactionTags"
632
+ },
633
+ variableDefinitions: [{
634
+ kind: "VariableDefinition",
635
+ variable: {
636
+ kind: "Variable",
637
+ name: {
638
+ kind: "Name",
639
+ value: "transactionId"
640
+ }
641
+ },
642
+ type: {
643
+ kind: "NonNullType",
644
+ type: {
645
+ kind: "NamedType",
646
+ name: {
647
+ kind: "Name",
648
+ value: "ID"
649
+ }
650
+ }
651
+ }
652
+ }],
653
+ selectionSet: {
654
+ kind: "SelectionSet",
655
+ selections: [{
656
+ kind: "Field",
657
+ alias: {
658
+ kind: "Name",
659
+ value: "tags"
660
+ },
661
+ name: {
662
+ kind: "Name",
663
+ value: "transaction"
664
+ },
665
+ arguments: [{
666
+ kind: "Argument",
667
+ name: {
668
+ kind: "Name",
669
+ value: "id"
670
+ },
671
+ value: {
672
+ kind: "Variable",
673
+ name: {
674
+ kind: "Name",
675
+ value: "transactionId"
676
+ }
677
+ }
678
+ }],
679
+ selectionSet: {
680
+ kind: "SelectionSet",
681
+ selections: [{
682
+ kind: "Field",
683
+ name: {
684
+ kind: "Name",
685
+ value: "id"
686
+ }
687
+ }, {
688
+ kind: "Field",
689
+ name: {
690
+ kind: "Name",
691
+ value: "tags"
692
+ },
693
+ selectionSet: {
694
+ kind: "SelectionSet",
695
+ selections: [{
696
+ kind: "Field",
697
+ name: {
698
+ kind: "Name",
699
+ value: "name"
700
+ }
701
+ }, {
702
+ kind: "Field",
703
+ name: {
704
+ kind: "Name",
705
+ value: "value"
706
+ }
707
+ }]
708
+ }
709
+ }]
710
+ }
711
+ }]
712
+ }
713
+ }]
714
+ },
715
+ "\n query GetArweaveTransactions(\n $owners: [String!]\n $first: Int\n $after: String\n ) {\n transactions(owners: $owners, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n anchor\n signature\n block {\n id\n height\n }\n data {\n size\n type\n }\n tags {\n name\n value\n }\n }\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n": {
716
+ kind: "Document",
717
+ definitions: [{
718
+ kind: "OperationDefinition",
719
+ operation: "query",
720
+ name: {
721
+ kind: "Name",
722
+ value: "GetArweaveTransactions"
723
+ },
724
+ variableDefinitions: [
725
+ {
726
+ kind: "VariableDefinition",
727
+ variable: {
728
+ kind: "Variable",
729
+ name: {
730
+ kind: "Name",
731
+ value: "owners"
732
+ }
733
+ },
734
+ type: {
735
+ kind: "ListType",
736
+ type: {
737
+ kind: "NonNullType",
738
+ type: {
739
+ kind: "NamedType",
740
+ name: {
741
+ kind: "Name",
742
+ value: "String"
743
+ }
744
+ }
745
+ }
746
+ }
747
+ },
748
+ {
749
+ kind: "VariableDefinition",
750
+ variable: {
751
+ kind: "Variable",
752
+ name: {
753
+ kind: "Name",
754
+ value: "first"
755
+ }
756
+ },
757
+ type: {
758
+ kind: "NamedType",
759
+ name: {
760
+ kind: "Name",
761
+ value: "Int"
762
+ }
763
+ }
764
+ },
765
+ {
766
+ kind: "VariableDefinition",
767
+ variable: {
768
+ kind: "Variable",
769
+ name: {
770
+ kind: "Name",
771
+ value: "after"
772
+ }
773
+ },
774
+ type: {
775
+ kind: "NamedType",
776
+ name: {
777
+ kind: "Name",
778
+ value: "String"
779
+ }
780
+ }
781
+ }
782
+ ],
783
+ selectionSet: {
784
+ kind: "SelectionSet",
785
+ selections: [{
786
+ kind: "Field",
787
+ name: {
788
+ kind: "Name",
789
+ value: "transactions"
790
+ },
791
+ arguments: [
792
+ {
793
+ kind: "Argument",
794
+ name: {
795
+ kind: "Name",
796
+ value: "owners"
797
+ },
798
+ value: {
799
+ kind: "Variable",
800
+ name: {
801
+ kind: "Name",
802
+ value: "owners"
803
+ }
804
+ }
805
+ },
806
+ {
807
+ kind: "Argument",
808
+ name: {
809
+ kind: "Name",
810
+ value: "first"
811
+ },
812
+ value: {
813
+ kind: "Variable",
814
+ name: {
815
+ kind: "Name",
816
+ value: "first"
817
+ }
818
+ }
819
+ },
820
+ {
821
+ kind: "Argument",
822
+ name: {
823
+ kind: "Name",
824
+ value: "after"
825
+ },
826
+ value: {
827
+ kind: "Variable",
828
+ name: {
829
+ kind: "Name",
830
+ value: "after"
831
+ }
832
+ }
833
+ }
834
+ ],
835
+ selectionSet: {
836
+ kind: "SelectionSet",
837
+ selections: [{
838
+ kind: "Field",
839
+ name: {
840
+ kind: "Name",
841
+ value: "edges"
842
+ },
843
+ selectionSet: {
844
+ kind: "SelectionSet",
845
+ selections: [{
846
+ kind: "Field",
847
+ name: {
848
+ kind: "Name",
849
+ value: "cursor"
850
+ }
851
+ }, {
852
+ kind: "Field",
853
+ name: {
854
+ kind: "Name",
855
+ value: "node"
856
+ },
857
+ selectionSet: {
858
+ kind: "SelectionSet",
859
+ selections: [
860
+ {
861
+ kind: "Field",
862
+ name: {
863
+ kind: "Name",
864
+ value: "id"
865
+ }
866
+ },
867
+ {
868
+ kind: "Field",
869
+ name: {
870
+ kind: "Name",
871
+ value: "anchor"
872
+ }
873
+ },
874
+ {
875
+ kind: "Field",
876
+ name: {
877
+ kind: "Name",
878
+ value: "signature"
879
+ }
880
+ },
881
+ {
882
+ kind: "Field",
883
+ name: {
884
+ kind: "Name",
885
+ value: "block"
886
+ },
887
+ selectionSet: {
888
+ kind: "SelectionSet",
889
+ selections: [{
890
+ kind: "Field",
891
+ name: {
892
+ kind: "Name",
893
+ value: "id"
894
+ }
895
+ }, {
896
+ kind: "Field",
897
+ name: {
898
+ kind: "Name",
899
+ value: "height"
900
+ }
901
+ }]
902
+ }
903
+ },
904
+ {
905
+ kind: "Field",
906
+ name: {
907
+ kind: "Name",
908
+ value: "data"
909
+ },
910
+ selectionSet: {
911
+ kind: "SelectionSet",
912
+ selections: [{
913
+ kind: "Field",
914
+ name: {
915
+ kind: "Name",
916
+ value: "size"
917
+ }
918
+ }, {
919
+ kind: "Field",
920
+ name: {
921
+ kind: "Name",
922
+ value: "type"
923
+ }
924
+ }]
925
+ }
926
+ },
927
+ {
928
+ kind: "Field",
929
+ name: {
930
+ kind: "Name",
931
+ value: "tags"
932
+ },
933
+ selectionSet: {
934
+ kind: "SelectionSet",
935
+ selections: [{
936
+ kind: "Field",
937
+ name: {
938
+ kind: "Name",
939
+ value: "name"
940
+ }
941
+ }, {
942
+ kind: "Field",
943
+ name: {
944
+ kind: "Name",
945
+ value: "value"
946
+ }
947
+ }]
948
+ }
949
+ }
950
+ ]
951
+ }
952
+ }]
953
+ }
954
+ }, {
955
+ kind: "Field",
956
+ name: {
957
+ kind: "Name",
958
+ value: "pageInfo"
959
+ },
960
+ selectionSet: {
961
+ kind: "SelectionSet",
962
+ selections: [{
963
+ kind: "Field",
964
+ name: {
965
+ kind: "Name",
966
+ value: "hasNextPage"
967
+ }
968
+ }]
969
+ }
970
+ }]
971
+ }
972
+ }]
973
+ }
974
+ }]
975
+ }
976
+ };
977
+ function Ue(e) {
978
+ return He[e] ?? {};
979
+ }
980
+ //#endregion
981
+ //#region src/ArweaveClient/queries.ts
982
+ var We = Ue("\n query GetTransactionTags($transactionId: ID!) {\n tags: transaction(id: $transactionId) {\n id\n tags {\n name\n value\n }\n }\n }\n"), Ge = Ue("\n query GetArweaveTransactions(\n $owners: [String!]\n $first: Int\n $after: String\n ) {\n transactions(owners: $owners, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n anchor\n signature\n block {\n id\n height\n }\n data {\n size\n type\n }\n tags {\n name\n value\n }\n }\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n"), Ke = 1e4, qe = 2e4, Je = 1e3, Ye = (e) => e >= 500 || e === 429;
983
+ async function Xe(e, t, n) {
984
984
  let r = new AbortController(), i = setTimeout(() => r.abort(), n);
985
985
  try {
986
986
  let n = await fetch(`${e.replace(/\/$/, "")}/${encodeURIComponent(t)}`, {
@@ -988,7 +988,7 @@ async function Qe(e, t, n) {
988
988
  credentials: "omit",
989
989
  signal: r.signal
990
990
  });
991
- return await n.body?.cancel().catch(() => {}), Ze(n.status) ? {
991
+ return await n.body?.cancel().catch(() => {}), Ye(n.status) ? {
992
992
  kind: "retry",
993
993
  status: n.status
994
994
  } : {
@@ -1004,17 +1004,23 @@ async function Qe(e, t, n) {
1004
1004
  clearTimeout(i);
1005
1005
  }
1006
1006
  }
1007
- async function $e(e, t = {}) {
1008
- let n = t.timeoutMs ?? 1e4, r = performance.now() + (t.totalTimeoutMs ?? 2e4), i = t.baseUrls ?? Ge(), a = i.filter((e) => !j(e)), o = a.length > 0 ? a : i, s = 500;
1007
+ function Ze() {
1008
+ let e = Be(), t = K();
1009
+ if (t?.activePath !== "hyper-sidecar" && t?.activePath !== "http-proxy") return e;
1010
+ let n = /* @__PURE__ */ new Set([...q(), t.arweaveBaseUrl.replace(/\/$/, "")]);
1011
+ return e.filter((e) => n.has(e));
1012
+ }
1013
+ async function Qe(e, t = {}) {
1014
+ let n = t.timeoutMs ?? 1e4, r = performance.now() + (t.totalTimeoutMs ?? 2e4), i = t.baseUrls ?? Ze(), a = i.filter((e) => !O(e)), o = a.length > 0 ? a : i, s = 500;
1009
1015
  for (let [t, i] of o.entries()) {
1010
1016
  let a = r - performance.now();
1011
1017
  if (a <= 0 || t > 0 && a < Math.min(n, 1e3)) break;
1012
- let o = await Qe(i, e, Math.min(n, a));
1013
- if (o.kind === "answer") return N(i), {
1018
+ let o = await Xe(i, e, Math.min(n, a));
1019
+ if (o.kind === "answer") return A(i), {
1014
1020
  status: o.status >= 200 && o.status < 300 ? 200 : o.status,
1015
1021
  confirmed: null
1016
1022
  };
1017
- P(i), s = o.status;
1023
+ j(i), s = o.status;
1018
1024
  }
1019
1025
  return {
1020
1026
  status: s,
@@ -1023,34 +1029,34 @@ async function $e(e, t = {}) {
1023
1029
  }
1024
1030
  //#endregion
1025
1031
  //#region src/default/ArweaveClient.ts
1026
- var Z = t("seedArweave:ArweaveClient"), Q = null, et = null, $ = async () => {
1027
- let e = `${C.getProtocol()}://${C.getHost()}`;
1028
- if (Q && et === e) return Q;
1032
+ var Q = t("seedArweave:ArweaveClient"), $ = null, $e = null, et = async () => {
1033
+ let e = `${S.getProtocol()}://${S.getHost()}`;
1034
+ if ($ && $e === e) return $;
1029
1035
  let t = await import("arweave"), n = t.default ?? t;
1030
- return typeof n.init != "function" && typeof n.default?.init == "function" && (n = n.default), et = e, Q = n.init(C.getArweaveJsApiConfig()), Q;
1036
+ return typeof n.init != "function" && typeof n.default?.init == "function" && (n = n.default), $e = e, $ = n.init(S.getArweaveJsApiConfig()), $;
1031
1037
  }, tt = class {
1032
1038
  getArweaveClient() {
1033
- return new e(C.getEndpoint());
1039
+ return new e(S.getEndpoint());
1034
1040
  }
1035
1041
  async getTransactionStatus(e) {
1036
- return $e(e);
1042
+ return Qe(e);
1037
1043
  }
1038
1044
  async getTransactionData(e, t) {
1039
1045
  let n = t?.decode === !1 ? [] : q();
1040
1046
  for (let r of n) {
1041
- let n = await X(r, e);
1047
+ let n = await Z(r, e);
1042
1048
  if (n) try {
1043
1049
  return t?.string ? await n.text() : new Uint8Array(await n.arrayBuffer());
1044
1050
  } catch (e) {
1045
- Z("Error reading preferred gateway response:", e);
1051
+ Q("Error reading preferred gateway response:", e);
1046
1052
  }
1047
1053
  }
1048
- if (C.getGatewayPath()) {
1049
- let n = await fetch(C.getRawUrl(e));
1054
+ if (S.getGatewayPath()) {
1055
+ let n = await fetch(S.getRawUrl(e));
1050
1056
  if (!n.ok) throw Error(`Failed to fetch transaction data: HTTP ${n.status}`);
1051
1057
  return t?.string ? n.text() : new Uint8Array(await n.arrayBuffer());
1052
1058
  }
1053
- let r = await $();
1059
+ let r = await et();
1054
1060
  try {
1055
1061
  let n = await r.transactions.getData(e, {
1056
1062
  decode: t?.decode ?? !0,
@@ -1058,28 +1064,28 @@ var Z = t("seedArweave:ArweaveClient"), Q = null, et = null, $ = async () => {
1058
1064
  });
1059
1065
  return t?.string && typeof n == "string" || n instanceof Uint8Array ? n : typeof n == "string" ? new TextEncoder().encode(n) : n;
1060
1066
  } catch (e) {
1061
- throw Z("Error fetching transaction data:", e), e;
1067
+ throw Q("Error fetching transaction data:", e), e;
1062
1068
  }
1063
1069
  }
1064
1070
  async getTransactionTags(e) {
1065
1071
  let t = this.getArweaveClient();
1066
1072
  try {
1067
- let n = await t.request(me, { transactionId: e });
1073
+ let n = await t.request(We, { transactionId: e });
1068
1074
  return n.tags?.tags ? n.tags.tags.map((e) => ({
1069
1075
  name: e.name,
1070
1076
  value: e.value
1071
1077
  })) : [];
1072
1078
  } catch (e) {
1073
- return Z("Error fetching transaction tags:", e), [];
1079
+ return Q("Error fetching transaction tags:", e), [];
1074
1080
  }
1075
1081
  }
1076
1082
  async createTransaction(e, t) {
1077
- let n = await (await $()).createTransaction({ data: e });
1083
+ let n = await (await et()).createTransaction({ data: e });
1078
1084
  if (t?.tags) for (let e of t.tags) n.addTag(e.name, e.value);
1079
1085
  return n;
1080
1086
  }
1081
1087
  async downloadFiles(e) {
1082
- let { transactionIds: t, excludedTransactions: n } = e, r = [], i = C.getBaseUrl();
1088
+ let { transactionIds: t, excludedTransactions: n } = e, r = [], i = S.getBaseUrl();
1083
1089
  for (let e of t) if (!n?.has(e)) try {
1084
1090
  let t = `${i}/raw/${e}`, n = await fetch(t);
1085
1091
  if (!n.ok) {
@@ -1098,7 +1104,7 @@ var Z = t("seedArweave:ArweaveClient"), Q = null, et = null, $ = async () => {
1098
1104
  data: a
1099
1105
  });
1100
1106
  } catch (t) {
1101
- Z(`Error downloading transaction ${e}:`, t), r.push({
1107
+ Q(`Error downloading transaction ${e}:`, t), r.push({
1102
1108
  transactionId: e,
1103
1109
  success: !1,
1104
1110
  error: t instanceof Error ? t.message : String(t)
@@ -1108,6 +1114,6 @@ var Z = t("seedArweave:ArweaveClient"), Q = null, et = null, $ = async () => {
1108
1114
  }
1109
1115
  };
1110
1116
  //#endregion
1111
- export { r as $, j as A, ue as B, we as C, M as D, V as E, A as F, se as G, m as H, he as I, c as J, p as K, me as L, D as M, P as N, ve as O, N as P, o as Q, C as R, z as S, Ce as T, f as U, de as V, ce as W, n as X, s as Y, a as Z, ke as _, $e as a, l as at, De as b, X as c, Y as d, i as et, q as f, ze as g, Ve as h, Xe as i, ae as it, be as j, ye as k, qe as l, Ue as m, Je as n, ie as nt, We as o, K as p, te as q, Ye as r, oe as rt, Ke as s, tt as t, u as tt, Ge as u, W as v, B as w, Te as x, Re as y, _ as z };
1117
+ export { r as $, he as A, ue as B, Ce as C, xe as D, L as E, j as F, ae as G, se as H, A as I, c as J, p as K, ge as L, O as M, ve as N, R as O, E as P, o as Q, S as R, z as S, Se as T, oe as U, de as V, ce as W, n as X, s as Y, a as Z, Ie as _, Qe as a, re as at, W as b, ze as c, Ve as d, i as et, Be as f, Re as g, K as h, Je as i, d as it, _e as j, k, X as l, q as m, Ke as n, u as nt, Ge as o, Y as p, te as q, qe as r, ie as rt, We as s, tt as t, l as tt, Z as u, Pe as v, I as w, Ne as x, U as y, g as z };
1112
1118
 
1113
- //# sourceMappingURL=ArweaveClient-k0MOFK7O.js.map
1119
+ //# sourceMappingURL=ArweaveClient-CToEhk_B.js.map