@leofcoin/chain 1.10.5 → 1.10.6

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-D5TgXCwx.js';
1
+ import { g as getDefaultExportFromCjs } from './node-browser-sxrQkd7t.js';
2
2
  import 'crypto';
3
3
  import './constants-CVkCJ-VS.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from './node-browser-D5TgXCwx.js';
1
+ import { g as getDefaultExportFromCjs } from './node-browser-sxrQkd7t.js';
2
2
  import 'crypto';
3
3
  import './constants-CVkCJ-VS.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { i as inflate_1, c as createDebugger, d as deflate_1, L as LittlePubSub } from './node-browser-D5TgXCwx.js';
1
+ import { i as inflate_1, c as createDebugger, d as deflate_1, L as LittlePubSub } from './node-browser-sxrQkd7t.js';
2
2
  import 'crypto';
3
3
  import './constants-CVkCJ-VS.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-_hiyXwPp-CeZtoaRo.js').then(function (n) { return n.b; })).default.w3cwebsocket;
234
+ globalThis.WebSocket = (await import('./browser-_hiyXwPp-DAxbV-UB.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);
@@ -1103,6 +1103,27 @@ class CircuitPeer {
1103
1103
  }
1104
1104
  }
1105
1105
 
1106
+ /** Normalize current star announcements and the legacy peer-id-only format. */
1107
+ const normalizePeerAnnouncement = (value) => {
1108
+ if (typeof value === 'string') {
1109
+ const peerId = value.trim();
1110
+ return peerId && peerId !== 'undefined' ? { peerId } : null;
1111
+ }
1112
+ if (!value || typeof value !== 'object')
1113
+ return null;
1114
+ const candidate = value;
1115
+ if (typeof candidate.peerId !== 'string')
1116
+ return null;
1117
+ const peerId = candidate.peerId.trim();
1118
+ if (!peerId || peerId === 'undefined')
1119
+ return null;
1120
+ return {
1121
+ peerId,
1122
+ version: typeof candidate.version === 'string' ? candidate.version : undefined,
1123
+ transport: candidate.transport
1124
+ };
1125
+ };
1126
+
1106
1127
  // Simple CRC32 implementation
1107
1128
  const crc32 = (data) => {
1108
1129
  let crc = 0xffffffff;
@@ -1302,7 +1323,7 @@ class Client {
1302
1323
  }
1303
1324
  }
1304
1325
  async #loadNodeWebrtcImplementation() {
1305
- const koushWrtcModule = await import('./browser-D-r0O9Qn-BUd-PxvP.js').then(function (n) { return n.b; });
1326
+ const koushWrtcModule = await import('./browser-D-r0O9Qn-8WfVE0Ux.js').then(function (n) { return n.b; });
1306
1327
  const koushWrtc = koushWrtcModule.default;
1307
1328
  if (!isWrtcImplementation(koushWrtc)) {
1308
1329
  throw new Error('@koush/wrtc does not match required wrtc contract');
@@ -1852,7 +1873,16 @@ class Client {
1852
1873
  this.#peerTransportKinds.set(peerId, 'webrtc');
1853
1874
  return peer;
1854
1875
  };
1855
- #peerJoined = async ({ peerId, version, transport }, star) => {
1876
+ #peerJoined = async (announcement, star) => {
1877
+ const normalized = normalizePeerAnnouncement(announcement);
1878
+ if (!normalized) {
1879
+ debug('ignored malformed peer announcement');
1880
+ return;
1881
+ }
1882
+ const { peerId, transport } = normalized;
1883
+ // Legacy stars announce only the peer id. This value is used for transport
1884
+ // negotiation; applications still perform their own version handshake.
1885
+ const version = normalized.version ?? this.version;
1856
1886
  if (this.peerId === peerId)
1857
1887
  return;
1858
1888
  // Stars can announce the same peer more than once while its transport is
@@ -1,4 +1,4 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-D5TgXCwx.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-sxrQkd7t.js';
2
2
  import 'crypto';
3
3
  import './constants-CVkCJ-VS.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './node-browser-D5TgXCwx.js';
1
+ import { F as FormatInterface } from './node-browser-sxrQkd7t.js';
2
2
  import 'crypto';
3
3
  import './constants-CVkCJ-VS.js';
4
4
 
@@ -8384,7 +8384,7 @@ class Identity {
8384
8384
  this.selectedAccount = new TextDecoder().decode(selected);
8385
8385
  }
8386
8386
  else {
8387
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-BD0Anx7_-D-zybnw-.js');
8387
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-BD0Anx7_-Dgedz8qH.js');
8388
8388
  const { identity, accounts } = await importee.default(password, this.network);
8389
8389
  if (fresh) {
8390
8390
  await globalThis.accountStore.clear();
@@ -17133,7 +17133,7 @@ class Peernet {
17133
17133
  await getAddress();
17134
17134
  this.storePrefix = options.storePrefix;
17135
17135
  this.root = options.root;
17136
- const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile } = await import(/* webpackChunkName: "messages" */ './messages-Dr5w-bq6-D-moQFGj.js');
17136
+ const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile } = await import(/* webpackChunkName: "messages" */ './messages-UKnuelZ7-CjCqR-Qe.js');
17137
17137
  /**
17138
17138
  * proto Object containing protos
17139
17139
  * @type {Object}
@@ -17180,7 +17180,7 @@ class Peernet {
17180
17180
  if (this.#starting || this.#started)
17181
17181
  return;
17182
17182
  this.#starting = true;
17183
- const importee = await import('./client-U5AYtQje-DAQ00fHP.js');
17183
+ const importee = await import('./client-BVhUamQG-z0FD6cVJ.js');
17184
17184
  /**
17185
17185
  * @access public
17186
17186
  * @type {PeernetClient}
@@ -1,3 +1,3 @@
1
- export { N as default } from './node-browser-D5TgXCwx.js';
1
+ export { N as default } from './node-browser-sxrQkd7t.js';
2
2
  import 'crypto';
3
3
  import './constants-CVkCJ-VS.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.10.5",
3
+ "version": "1.10.6",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {
@@ -71,7 +71,7 @@
71
71
  "@leofcoin/messages": "^1.6.1",
72
72
  "@leofcoin/multi-wallet": "^3.1.9",
73
73
  "@leofcoin/networks": "^1.1.30",
74
- "@leofcoin/peernet": "^1.2.26",
74
+ "@leofcoin/peernet": "^1.2.27",
75
75
  "@leofcoin/storage": "^3.5.38",
76
76
  "@leofcoin/utils": "^1.1.45",
77
77
  "@leofcoin/workers": "^1.5.34",