@leofcoin/peernet 1.1.23 → 1.1.24

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-98e14e24.js';
1
+ import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './peernet-805b1e8e.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  function commonjsRequire(path) {
@@ -1,4 +1,4 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-98e14e24.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-805b1e8e.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './peernet-98e14e24.js';
1
+ import { F as FormatInterface } from './peernet-805b1e8e.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  var proto$b = {
@@ -6200,6 +6200,7 @@ const lastFetched = {
6200
6200
  timestamp: 0,
6201
6201
  },
6202
6202
  };
6203
+ const fetchedCoordinates = {};
6203
6204
  const getAddress = async () => {
6204
6205
  const { address } = lastFetched;
6205
6206
  const now = Math.round(new Date().getTime() / 1000);
@@ -6237,12 +6238,14 @@ class DhtEarth {
6237
6238
  * @return {Object} {latitude: lat, longitude: lon}
6238
6239
  */
6239
6240
  async getCoordinates(address) {
6240
- // const {address} = parseAddress(provider)
6241
- const request = `https://whereis.leofcoin.org/?ip=${address}`;
6242
- let response = await fetch(request);
6243
- response = await response.json();
6244
- const { lat, lon } = response;
6245
- return { latitude: lat, longitude: lon };
6241
+ if (!fetchedCoordinates[address]) {
6242
+ const request = `https://whereis.leofcoin.org/?ip=${address}`;
6243
+ let response = await fetch(request);
6244
+ response = await response.json();
6245
+ const { lat, lon } = response;
6246
+ fetchedCoordinates[address] = { latitude: lat, longitude: lon };
6247
+ }
6248
+ return fetchedCoordinates[address];
6246
6249
  }
6247
6250
  /**
6248
6251
  * @param {Object} peer
@@ -20182,7 +20185,7 @@ class Identity {
20182
20185
  globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
20183
20186
  }
20184
20187
  else {
20185
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-2c2a9d47.js');
20188
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-e407f1a3.js');
20186
20189
  const { identity, accounts } = await importee.default(password, this.network);
20187
20190
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
20188
20191
  await globalThis.walletStore.put('version', String(1));
@@ -20353,7 +20356,7 @@ class Peernet {
20353
20356
  this.root = options.root;
20354
20357
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
20355
20358
  // FolderMessageResponse
20356
- } = await import(/* webpackChunkName: "messages" */ './messages-6cc87ed7.js');
20359
+ } = await import(/* webpackChunkName: "messages" */ './messages-2465e07d.js');
20357
20360
  /**
20358
20361
  * proto Object containing protos
20359
20362
  * @type {Object}
@@ -20425,7 +20428,7 @@ class Peernet {
20425
20428
  if (this.#starting || this.#started)
20426
20429
  return;
20427
20430
  this.#starting = true;
20428
- const importee = await import('./client-e3216b03.js');
20431
+ const importee = await import('./client-31b62450.js');
20429
20432
  /**
20430
20433
  * @access public
20431
20434
  * @type {PeernetClient}
@@ -1,2 +1,2 @@
1
- export { P as default } from './peernet-98e14e24.js';
1
+ export { P as default } from './peernet-805b1e8e.js';
2
2
  import './value-157ab062.js';
@@ -161,6 +161,7 @@ const lastFetched = {
161
161
  timestamp: 0,
162
162
  },
163
163
  };
164
+ const fetchedCoordinates = {};
164
165
  const getAddress = async () => {
165
166
  const { address } = lastFetched;
166
167
  const now = Math.round(new Date().getTime() / 1000);
@@ -198,12 +199,14 @@ class DhtEarth {
198
199
  * @return {Object} {latitude: lat, longitude: lon}
199
200
  */
200
201
  async getCoordinates(address) {
201
- // const {address} = parseAddress(provider)
202
- const request = `https://whereis.leofcoin.org/?ip=${address}`;
203
- let response = await fetch(request);
204
- response = await response.json();
205
- const { lat, lon } = response;
206
- return { latitude: lat, longitude: lon };
202
+ if (!fetchedCoordinates[address]) {
203
+ const request = `https://whereis.leofcoin.org/?ip=${address}`;
204
+ let response = await fetch(request);
205
+ response = await response.json();
206
+ const { lat, lon } = response;
207
+ fetchedCoordinates[address] = { latitude: lat, longitude: lon };
208
+ }
209
+ return fetchedCoordinates[address];
207
210
  }
208
211
  /**
209
212
  * @param {Object} peer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "1.1.23",
3
+ "version": "1.1.24",
4
4
  "description": "",
5
5
  "main": "src/peernet.js",
6
6
  "exports": {
package/src/dht/dht.js CHANGED
@@ -14,6 +14,8 @@ const lastFetched = {
14
14
  },
15
15
  }
16
16
 
17
+ const fetchedCoordinates = {}
18
+
17
19
  const getAddress = async () => {
18
20
  const {address} = lastFetched
19
21
  const now = Math.round(new Date().getTime() / 1000);
@@ -58,12 +60,14 @@ export default class DhtEarth {
58
60
  * @return {Object} {latitude: lat, longitude: lon}
59
61
  */
60
62
  async getCoordinates(address) {
61
- // const {address} = parseAddress(provider)
62
- const request = `https://whereis.leofcoin.org/?ip=${address}`
63
- let response = await fetch(request)
64
- response = await response.json()
65
- const {lat, lon} = response;
66
- return {latitude: lat, longitude: lon}
63
+ if (!fetchedCoordinates[address]) {
64
+ const request = `https://whereis.leofcoin.org/?ip=${address}`
65
+ let response = await fetch(request)
66
+ response = await response.json()
67
+ const {lat, lon} = response;
68
+ fetchedCoordinates[address] = {latitude: lat, longitude: lon}
69
+ }
70
+ return fetchedCoordinates[address]
67
71
  }
68
72
 
69
73
  /**