@leofcoin/peernet 1.1.32 → 1.1.34

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, c as commonjsGlobal } from './peernet-4c63c3a2.js';
1
+ import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './peernet-4e7dbb95.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  function commonjsRequire(path) {
@@ -4,11 +4,7 @@ export default class DhtEarth {
4
4
  *
5
5
  */
6
6
  constructor();
7
- /**
8
- * @param {Object} address
9
- * @return {Object} {latitude: lat, longitude: lon}
10
- */
11
- getCoordinates(address: object): object;
7
+ getCoordinates(address: string): Promise<object>;
12
8
  /**
13
9
  * @param {Object} peer
14
10
  * @param {Object} provider
@@ -17,7 +13,7 @@ export default class DhtEarth {
17
13
  getDistance(peer: object, provider: object): object;
18
14
  closestPeer(providers: Array<any>): object;
19
15
  hasProvider(hash: string): boolean;
20
- providersFor(hash: string): string[];
21
- addProvider(address: string, hash: string): string[];
16
+ providersFor(hash: string): Set<string>;
17
+ addProvider(address: string, hash: string): void;
22
18
  removeProvider(address: string, hash: string): true | undefined;
23
19
  }
@@ -1,4 +1,4 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-4c63c3a2.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-4e7dbb95.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './peernet-4c63c3a2.js';
1
+ import { F as FormatInterface } from './peernet-4e7dbb95.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  var proto$b = {
@@ -6233,10 +6233,6 @@ class DhtEarth {
6233
6233
  constructor() {
6234
6234
  this.providerMap = new Map();
6235
6235
  }
6236
- /**
6237
- * @param {Object} address
6238
- * @return {Object} {latitude: lat, longitude: lon}
6239
- */
6240
6236
  async getCoordinates(address) {
6241
6237
  if (!fetchedCoordinates[address]) {
6242
6238
  const request = `https://whereis.leofcoin.org/?ip=${address}`;
@@ -6274,9 +6270,9 @@ class DhtEarth {
6274
6270
  return this.providerMap.has(hash);
6275
6271
  }
6276
6272
  providersFor(hash) {
6277
- let providers = [];
6273
+ let providers;
6278
6274
  if (this.providerMap.has(hash))
6279
- providers = [...this.providerMap.get(hash)];
6275
+ providers = this.providerMap.get(hash);
6280
6276
  return providers;
6281
6277
  }
6282
6278
  addProvider(address, hash) {
@@ -20187,7 +20183,7 @@ class Identity {
20187
20183
  globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
20188
20184
  }
20189
20185
  else {
20190
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-da3c0bea.js');
20186
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-cf8b44ca.js');
20191
20187
  const { identity, accounts } = await importee.default(password, this.network);
20192
20188
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
20193
20189
  await globalThis.walletStore.put('version', String(1));
@@ -20228,7 +20224,7 @@ class Identity {
20228
20224
  globalThis.LeofcoinStorage = LeofcoinStorage;
20229
20225
  globalThis.leofcoin = globalThis.leofcoin || {};
20230
20226
  globalThis.pubsub = globalThis.pubsub || new LittlePubSub();
20231
- globalThis.globalSub = globalThis.globalSub || new LittlePubSub(true);
20227
+ globalThis.globalSub = globalThis.globalSub || new LittlePubSub();
20232
20228
  /**
20233
20229
  * @access public
20234
20230
  * @example
@@ -20358,7 +20354,7 @@ class Peernet {
20358
20354
  this.root = options.root;
20359
20355
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
20360
20356
  // FolderMessageResponse
20361
- } = await import(/* webpackChunkName: "messages" */ './messages-b4ab65f6.js');
20357
+ } = await import(/* webpackChunkName: "messages" */ './messages-d292642b.js');
20362
20358
  /**
20363
20359
  * proto Object containing protos
20364
20360
  * @type {Object}
@@ -20437,7 +20433,7 @@ class Peernet {
20437
20433
  if (this.#starting || this.#started)
20438
20434
  return;
20439
20435
  this.#starting = true;
20440
- const importee = await import('./client-e2df99cf.js');
20436
+ const importee = await import('./client-10cfc17d.js');
20441
20437
  /**
20442
20438
  * @access public
20443
20439
  * @type {PeernetClient}
@@ -1,2 +1,2 @@
1
- export { P as default } from './peernet-4c63c3a2.js';
1
+ export { P as default } from './peernet-4e7dbb95.js';
2
2
  import './value-157ab062.js';
@@ -4,11 +4,7 @@ export default class DhtEarth {
4
4
  *
5
5
  */
6
6
  constructor();
7
- /**
8
- * @param {Object} address
9
- * @return {Object} {latitude: lat, longitude: lon}
10
- */
11
- getCoordinates(address: object): object;
7
+ getCoordinates(address: string): Promise<object>;
12
8
  /**
13
9
  * @param {Object} peer
14
10
  * @param {Object} provider
@@ -17,7 +13,7 @@ export default class DhtEarth {
17
13
  getDistance(peer: object, provider: object): object;
18
14
  closestPeer(providers: Array<any>): object;
19
15
  hasProvider(hash: string): boolean;
20
- providersFor(hash: string): string[];
21
- addProvider(address: string, hash: string): string[];
16
+ providersFor(hash: string): Set<string>;
17
+ addProvider(address: string, hash: string): void;
22
18
  removeProvider(address: string, hash: string): true | undefined;
23
19
  }
@@ -194,10 +194,6 @@ class DhtEarth {
194
194
  constructor() {
195
195
  this.providerMap = new Map();
196
196
  }
197
- /**
198
- * @param {Object} address
199
- * @return {Object} {latitude: lat, longitude: lon}
200
- */
201
197
  async getCoordinates(address) {
202
198
  if (!fetchedCoordinates[address]) {
203
199
  const request = `https://whereis.leofcoin.org/?ip=${address}`;
@@ -235,9 +231,9 @@ class DhtEarth {
235
231
  return this.providerMap.has(hash);
236
232
  }
237
233
  providersFor(hash) {
238
- let providers = [];
234
+ let providers;
239
235
  if (this.providerMap.has(hash))
240
- providers = [...this.providerMap.get(hash)];
236
+ providers = this.providerMap.get(hash);
241
237
  return providers;
242
238
  }
243
239
  addProvider(address, hash) {
@@ -386,7 +382,7 @@ class Identity {
386
382
  globalThis.LeofcoinStorage = LeofcoinStorage;
387
383
  globalThis.leofcoin = globalThis.leofcoin || {};
388
384
  globalThis.pubsub = globalThis.pubsub || new PubSub();
389
- globalThis.globalSub = globalThis.globalSub || new PubSub(true);
385
+ globalThis.globalSub = globalThis.globalSub || new PubSub();
390
386
  /**
391
387
  * @access public
392
388
  * @example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "1.1.32",
3
+ "version": "1.1.34",
4
4
  "description": "",
5
5
  "main": "src/peernet.js",
6
6
  "exports": {
package/src/dht/dht.ts CHANGED
@@ -94,13 +94,13 @@ export default class DhtEarth {
94
94
  return this.providerMap.has(hash)
95
95
  }
96
96
 
97
- providersFor(hash: string): string[] {
98
- let providers = []
99
- if (this.providerMap.has(hash)) providers = [...this.providerMap.get(hash)]
97
+ providersFor(hash: string): Set<string> {
98
+ let providers
99
+ if (this.providerMap.has(hash)) providers = this.providerMap.get(hash)
100
100
  return providers
101
101
  }
102
102
 
103
- addProvider(address: string, hash: string): string[] {
103
+ addProvider(address: string, hash: string) {
104
104
  let providers:Set<string> = new Set()
105
105
  if (this.providerMap.has(hash)) {
106
106
  providers = this.providerMap.get(hash)
package/src/peernet.ts CHANGED
@@ -15,7 +15,7 @@ globalThis.LeofcoinStorage = LeofcoinStorage
15
15
 
16
16
  globalThis.leofcoin = globalThis.leofcoin || {}
17
17
  globalThis.pubsub = globalThis.pubsub || new PubSub()
18
- globalThis.globalSub = globalThis.globalSub || new PubSub(true)
18
+ globalThis.globalSub = globalThis.globalSub || new PubSub()
19
19
  /**
20
20
  * @access public
21
21
  * @example