@leofcoin/chain 1.9.24 → 1.9.25

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,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from './node-browser-Dc4HZiX0.js';
1
+ import { g as getDefaultExportFromCjs } from './node-browser-Cdgaf6tz.js';
2
2
  import 'crypto';
3
3
  import './constants-COpvMqFX.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from './node-browser-Dc4HZiX0.js';
1
+ import { g as getDefaultExportFromCjs } from './node-browser-Cdgaf6tz.js';
2
2
  import 'crypto';
3
3
  import './constants-COpvMqFX.js';
4
4
 
@@ -2473,6 +2473,11 @@ function requireRange () {
2473
2473
 
2474
2474
  const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
2475
2475
 
2476
+ const invalidXRangeOrder = (M, m, p) => (
2477
+ (isX(M) && !isX(m)) ||
2478
+ (isX(m) && p && !isX(p))
2479
+ );
2480
+
2476
2481
  // ~, ~> --> * (any, kinda silly)
2477
2482
  // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
2478
2483
  // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
@@ -2490,6 +2495,10 @@ function requireRange () {
2490
2495
 
2491
2496
  const replaceTilde = (comp, options) => {
2492
2497
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
2498
+ // if we're including prereleases in the match, then the lower bound is
2499
+ // -0, the lowest possible prerelease value, just like x-ranges and carets.
2500
+ // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.
2501
+ const z = options.includePrerelease ? '-0' : '';
2493
2502
  return comp.replace(r, (_, M, m, p, pr) => {
2494
2503
  debug('tilde', comp, _, M, m, p, pr);
2495
2504
  let ret;
@@ -2497,10 +2506,10 @@ function requireRange () {
2497
2506
  if (isX(M)) {
2498
2507
  ret = '';
2499
2508
  } else if (isX(m)) {
2500
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
2509
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
2501
2510
  } else if (isX(p)) {
2502
2511
  // ~1.2 == >=1.2.0 <1.3.0-0
2503
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
2512
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
2504
2513
  } else if (pr) {
2505
2514
  debug('replaceTilde pr', pr);
2506
2515
  ret = `>=${M}.${m}.${p}-${pr
@@ -2569,10 +2578,10 @@ function requireRange () {
2569
2578
  if (M === '0') {
2570
2579
  if (m === '0') {
2571
2580
  ret = `>=${M}.${m}.${p
2572
- }${z} <${M}.${m}.${+p + 1}-0`;
2581
+ } <${M}.${m}.${+p + 1}-0`;
2573
2582
  } else {
2574
2583
  ret = `>=${M}.${m}.${p
2575
- }${z} <${M}.${+m + 1}.0-0`;
2584
+ } <${M}.${+m + 1}.0-0`;
2576
2585
  }
2577
2586
  } else {
2578
2587
  ret = `>=${M}.${m}.${p
@@ -2598,6 +2607,10 @@ function requireRange () {
2598
2607
  const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
2599
2608
  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
2600
2609
  debug('xRange', comp, ret, gtlt, M, m, p, pr);
2610
+ if (invalidXRangeOrder(M, m, p)) {
2611
+ return comp
2612
+ }
2613
+
2601
2614
  const xM = isX(M);
2602
2615
  const xm = xM || isX(m);
2603
2616
  const xp = xm || isX(p);
@@ -1,4 +1,4 @@
1
- import { i as inflate_1, c as createDebugger, d as deflate_1, L as LittlePubSub } from './node-browser-Dc4HZiX0.js';
1
+ import { i as inflate_1, c as createDebugger, d as deflate_1, L as LittlePubSub } from './node-browser-Cdgaf6tz.js';
2
2
  import 'crypto';
3
3
  import './constants-COpvMqFX.js';
4
4
 
@@ -231,7 +231,7 @@ class SocketRequestClient {
231
231
  const init = async () => {
232
232
  // @ts-ignore
233
233
  if (!globalThis.WebSocket && !this.#experimentalWebsocket)
234
- globalThis.WebSocket = (await import('./browser-8BFql6K9-BMXXABIY.js').then(function (n) { return n.b; })).default.w3cwebsocket;
234
+ globalThis.WebSocket = (await import('./browser-tK3uOLQV-CtcRBohi.js').then(function (n) { return n.b; })).default.w3cwebsocket;
235
235
  const client = new WebSocket(this.#url, this.#protocol);
236
236
  if (this.#experimentalWebsocket) {
237
237
  client.addEventListener('error', this.onerror);
@@ -1302,7 +1302,7 @@ class Client {
1302
1302
  }
1303
1303
  }
1304
1304
  async #loadNodeWebrtcImplementation() {
1305
- const koushWrtcModule = await import('./browser-FVp_QbaL-C-GWIuv6.js').then(function (n) { return n.b; });
1305
+ const koushWrtcModule = await import('./browser-DEjI2nFg-CL-zDjzl.js').then(function (n) { return n.b; });
1306
1306
  const koushWrtc = koushWrtcModule.default;
1307
1307
  if (!isWrtcImplementation(koushWrtc)) {
1308
1308
  throw new Error('@koush/wrtc does not match required wrtc contract');
@@ -1853,14 +1853,15 @@ class Client {
1853
1853
  return peer;
1854
1854
  };
1855
1855
  #peerJoined = async ({ peerId, version, transport }, star) => {
1856
- // check if peer rejoined before the previous connection closed
1857
- if (this.#connections[peerId]) {
1858
- this.#connections[peerId].destroy();
1859
- delete this.#connections[peerId];
1860
- }
1861
1856
  if (this.peerId === peerId)
1862
1857
  return;
1863
- this.#startPeerTransportAttempt(peerId, star, version, true, transport);
1858
+ // Stars can announce the same peer more than once while its transport is
1859
+ // still negotiating. Keep that connection/attempt alive; destroying it
1860
+ // here makes simultaneous joins continually reset each other.
1861
+ // Both sides receive the discovery event. Elect exactly one offerer so
1862
+ // simultaneous joins do not create competing channels/SDP negotiations.
1863
+ const initiator = String(this.peerId) < String(peerId);
1864
+ this.#startPeerTransportAttempt(peerId, star, version, initiator, transport);
1864
1865
  debug(`peer ${peerId} joined`);
1865
1866
  };
1866
1867
  #inComingSignal = async ({ from, signal, channelName, version }, star) => {
@@ -1926,12 +1927,16 @@ class Client {
1926
1927
  });
1927
1928
  };
1928
1929
  #peerClose = (peer) => {
1930
+ // A failed transport can finish closing after fallback has already placed a
1931
+ // replacement in the connection map. Never let that stale close delete or
1932
+ // advance the replacement's active attempt.
1933
+ if (this.#connections[peer.peerId] !== peer) {
1934
+ debug(`ignored stale close for ${peer.peerId}`);
1935
+ return;
1936
+ }
1929
1937
  const wasConnected = peer.connected;
1930
1938
  this.#peerTransportKinds.delete(peer.peerId);
1931
- if (this.#connections[peer.peerId]) {
1932
- peer.destroy();
1933
- delete this.#connections[peer.peerId];
1934
- }
1939
+ delete this.#connections[peer.peerId];
1935
1940
  if (!wasConnected && this.#peerTransportAttempts.has(peer.peerId)) {
1936
1941
  this.#advanceTransportAttempt(peer.peerId);
1937
1942
  }
@@ -1,4 +1,4 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-Dc4HZiX0.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-Cdgaf6tz.js';
2
2
  import 'crypto';
3
3
  import './constants-COpvMqFX.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './node-browser-Dc4HZiX0.js';
1
+ import { F as FormatInterface } from './node-browser-Cdgaf6tz.js';
2
2
  import 'crypto';
3
3
  import './constants-COpvMqFX.js';
4
4