@leofcoin/chain 1.7.91 → 1.7.92

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 { L as LittlePubSub } from './node-browser-CsSAehTl.js';
1
+ import { L as LittlePubSub } from './node-browser-D4im-c4V.js';
2
2
  import './identity-Cn0iQbY3-CeW0giQS.js';
3
3
  import './index-DUfUgiQY.js';
4
4
 
@@ -42,7 +42,7 @@ class Api {
42
42
  if (state !== 'open')
43
43
  return reject(`coudn't send request to ${client.id}, no open connection found.`);
44
44
  request.id = Math.random().toString(36).slice(-12);
45
- const handler = result => {
45
+ const handler = (result) => {
46
46
  if (result && result.error)
47
47
  return reject(result.error);
48
48
  resolve({ result, id: request.id, handler });
@@ -62,11 +62,17 @@ class Api {
62
62
  },
63
63
  subscribe: (topic = 'pubsub', cb) => {
64
64
  this.subscribe(topic, cb);
65
- return this.send(client, { url: 'pubsub', params: { topic, subscribe: true } });
65
+ return this.send(client, {
66
+ url: 'pubsub',
67
+ params: { topic, subscribe: true }
68
+ });
66
69
  },
67
70
  unsubscribe: (topic = 'pubsub', cb) => {
68
71
  this.unsubscribe(topic, cb);
69
- return this.send(client, { url: 'pubsub', params: { topic, unsubscribe: true } });
72
+ return this.send(client, {
73
+ url: 'pubsub',
74
+ params: { topic, unsubscribe: true }
75
+ });
70
76
  },
71
77
  subscribers: this._pubsub.subscribers
72
78
  };
@@ -75,7 +81,9 @@ class Api {
75
81
  return {
76
82
  uptime: async () => {
77
83
  try {
78
- const { result, id, handler } = await this.request(client, { url: 'uptime' });
84
+ const { result, id, handler } = await this.request(client, {
85
+ url: 'uptime'
86
+ });
79
87
  this.unsubscribe(id, handler);
80
88
  return result;
81
89
  }
@@ -86,9 +94,11 @@ class Api {
86
94
  ping: async () => {
87
95
  try {
88
96
  const now = new Date().getTime();
89
- const { result, id, handler } = await this.request(client, { url: 'ping' });
97
+ const { result, id, handler } = await this.request(client, {
98
+ url: 'ping'
99
+ });
90
100
  this.unsubscribe(id, handler);
91
- return (Number(result) - now);
101
+ return Number(result) - now;
92
102
  }
93
103
  catch (e) {
94
104
  throw e;
@@ -121,6 +131,18 @@ class Api {
121
131
  catch (e) {
122
132
  throw e;
123
133
  }
134
+ },
135
+ peers: async (params) => {
136
+ try {
137
+ params.peers = true;
138
+ const requested = { url: 'peernet', params };
139
+ const { result, id, handler } = await this.request(client, requested);
140
+ this.unsubscribe(id, handler);
141
+ return result;
142
+ }
143
+ catch (e) {
144
+ throw e;
145
+ }
124
146
  }
125
147
  };
126
148
  }
@@ -475,7 +497,7 @@ class Client {
475
497
  });
476
498
  }
477
499
  else {
478
- globalThis.addEventListener('beforeunload', async () => this.close());
500
+ globalThis.addEventListener('beforeunload', this.close.bind(this));
479
501
  }
480
502
  }
481
503
  setupStarListeners(star) {
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './node-browser-CsSAehTl.js';
1
+ import { F as FormatInterface } from './node-browser-D4im-c4V.js';
2
2
  import './identity-Cn0iQbY3-CeW0giQS.js';
3
3
  import './index-DUfUgiQY.js';
4
4
 
@@ -8496,7 +8496,7 @@ class Peernet {
8496
8496
  this.root = options.root;
8497
8497
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
8498
8498
  // FolderMessageResponse
8499
- } = await import(/* webpackChunkName: "messages" */ './messages-BYZZUpuv-MiKV0Pk4.js');
8499
+ } = await import(/* webpackChunkName: "messages" */ './messages-B9TrXtD1-B5p-nLLO.js');
8500
8500
  /**
8501
8501
  * proto Object containing protos
8502
8502
  * @type {Object}
@@ -8590,7 +8590,7 @@ class Peernet {
8590
8590
  if (this.#starting || this.#started)
8591
8591
  return;
8592
8592
  this.#starting = true;
8593
- const importee = await import('./client-Vbt0C3YZ-BSi2TKqM.js');
8593
+ const importee = await import('./client-BScgNzXE-Vdpk0JDu.js');
8594
8594
  /**
8595
8595
  * @access public
8596
8596
  * @type {PeernetClient}
@@ -1,3 +1,3 @@
1
- export { N as default } from './node-browser-CsSAehTl.js';
1
+ export { N as default } from './node-browser-D4im-c4V.js';
2
2
  import './identity-Cn0iQbY3-CeW0giQS.js';
3
3
  import './index-DUfUgiQY.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.7.91",
3
+ "version": "1.7.92",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {
@@ -55,7 +55,7 @@
55
55
  "@rollup/plugin-typescript": "^12.1.4",
56
56
  "@types/semver": "^7.7.0",
57
57
  "@vandeurenglenn/debug": "^1.2.6",
58
- "rollup": "^4.45.1",
58
+ "rollup": "^4.46.2",
59
59
  "rollup-plugin-modify": "^3.0.0",
60
60
  "tape": "^5.9.0",
61
61
  "tslib": "^2.8.1"
@@ -71,7 +71,7 @@
71
71
  "@leofcoin/networks": "^1.1.25",
72
72
  "@leofcoin/peernet": "^1.1.92",
73
73
  "@leofcoin/storage": "^3.5.38",
74
- "@leofcoin/utils": "^1.1.39",
74
+ "@leofcoin/utils": "^1.1.40",
75
75
  "@leofcoin/workers": "^1.5.27",
76
76
  "@vandeurenglenn/base58": "^1.1.9",
77
77
  "@vandeurenglenn/easy-worker": "^1.0.2",