@leofcoin/chain 1.4.45 → 1.4.46
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.
- package/exports/browser/chain.js +11 -3
- package/exports/browser/{client-e3216b03-fd2d3b03.js → client-31b62450-447815f7.js} +1 -1
- package/exports/browser/{index-2c2a9d47-00b5d0df.js → index-e407f1a3-a07c9df0.js} +1 -1
- package/exports/browser/{messages-6cc87ed7-c16a1408.js → messages-2465e07d-6cd91c3d.js} +1 -1
- package/exports/browser/{node-browser-aa07a41d.js → node-browser-5de1f022.js} +12 -9
- package/exports/browser/node-browser.js +1 -1
- package/exports/chain.js +11 -3
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -8317,7 +8317,7 @@ class Chain extends Contract {
|
|
|
8317
8317
|
}
|
|
8318
8318
|
catch (error) {
|
|
8319
8319
|
console.log({ error });
|
|
8320
|
-
globalThis.peernet.
|
|
8320
|
+
globalThis.peernet.publish('invalid-transaction', hash);
|
|
8321
8321
|
globalThis.pubsub.publish(`transaction.completed.${hash}`, { status: 'fail', hash, error: error });
|
|
8322
8322
|
throw { error, hash, from, to, params, nonce };
|
|
8323
8323
|
}
|
|
@@ -8414,8 +8414,16 @@ class Chain extends Contract {
|
|
|
8414
8414
|
transactions = transactions.sort((a, b) => a.nonce - b.nonce);
|
|
8415
8415
|
for (let transaction of transactions) {
|
|
8416
8416
|
const hash = await transaction.hash();
|
|
8417
|
-
const
|
|
8418
|
-
|
|
8417
|
+
const doubleTransactions = [];
|
|
8418
|
+
for (const block of this.#blocks) {
|
|
8419
|
+
for (const transaction of block.transactions) {
|
|
8420
|
+
if (transaction.hash === hash) {
|
|
8421
|
+
doubleTransactions.push(hash);
|
|
8422
|
+
}
|
|
8423
|
+
}
|
|
8424
|
+
}
|
|
8425
|
+
console.log();
|
|
8426
|
+
if (doubleTransactions.length > 0) {
|
|
8419
8427
|
await globalThis.transactionPoolStore.delete(hash);
|
|
8420
8428
|
await globalThis.peernet.publish('invalid-transaction', hash);
|
|
8421
8429
|
}
|
|
@@ -6283,6 +6283,7 @@ const lastFetched = {
|
|
|
6283
6283
|
timestamp: 0,
|
|
6284
6284
|
},
|
|
6285
6285
|
};
|
|
6286
|
+
const fetchedCoordinates = {};
|
|
6286
6287
|
const getAddress = async () => {
|
|
6287
6288
|
const { address } = lastFetched;
|
|
6288
6289
|
const now = Math.round(new Date().getTime() / 1000);
|
|
@@ -6320,12 +6321,14 @@ class DhtEarth {
|
|
|
6320
6321
|
* @return {Object} {latitude: lat, longitude: lon}
|
|
6321
6322
|
*/
|
|
6322
6323
|
async getCoordinates(address) {
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6324
|
+
if (!fetchedCoordinates[address]) {
|
|
6325
|
+
const request = `https://whereis.leofcoin.org/?ip=${address}`;
|
|
6326
|
+
let response = await fetch(request);
|
|
6327
|
+
response = await response.json();
|
|
6328
|
+
const { lat, lon } = response;
|
|
6329
|
+
fetchedCoordinates[address] = { latitude: lat, longitude: lon };
|
|
6330
|
+
}
|
|
6331
|
+
return fetchedCoordinates[address];
|
|
6329
6332
|
}
|
|
6330
6333
|
/**
|
|
6331
6334
|
* @param {Object} peer
|
|
@@ -20265,7 +20268,7 @@ class Identity {
|
|
|
20265
20268
|
globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
|
|
20266
20269
|
}
|
|
20267
20270
|
else {
|
|
20268
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-
|
|
20271
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-e407f1a3-a07c9df0.js');
|
|
20269
20272
|
const { identity, accounts } = await importee.default(password, this.network);
|
|
20270
20273
|
await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
|
|
20271
20274
|
await globalThis.walletStore.put('version', String(1));
|
|
@@ -20436,7 +20439,7 @@ class Peernet {
|
|
|
20436
20439
|
this.root = options.root;
|
|
20437
20440
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
20438
20441
|
// FolderMessageResponse
|
|
20439
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
20442
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-2465e07d-6cd91c3d.js');
|
|
20440
20443
|
/**
|
|
20441
20444
|
* proto Object containing protos
|
|
20442
20445
|
* @type {Object}
|
|
@@ -20508,7 +20511,7 @@ class Peernet {
|
|
|
20508
20511
|
if (this.#starting || this.#started)
|
|
20509
20512
|
return;
|
|
20510
20513
|
this.#starting = true;
|
|
20511
|
-
const importee = await import('./client-
|
|
20514
|
+
const importee = await import('./client-31b62450-447815f7.js');
|
|
20512
20515
|
/**
|
|
20513
20516
|
* @access public
|
|
20514
20517
|
* @type {PeernetClient}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { N as default } from './node-browser-
|
|
1
|
+
export { N as default } from './node-browser-5de1f022.js';
|
|
2
2
|
import './contract-f76383c3.js';
|
package/exports/chain.js
CHANGED
|
@@ -912,7 +912,7 @@ class Chain extends Contract {
|
|
|
912
912
|
}
|
|
913
913
|
catch (error) {
|
|
914
914
|
console.log({ error });
|
|
915
|
-
globalThis.peernet.
|
|
915
|
+
globalThis.peernet.publish('invalid-transaction', hash);
|
|
916
916
|
globalThis.pubsub.publish(`transaction.completed.${hash}`, { status: 'fail', hash, error: error });
|
|
917
917
|
throw { error, hash, from, to, params, nonce };
|
|
918
918
|
}
|
|
@@ -1009,8 +1009,16 @@ class Chain extends Contract {
|
|
|
1009
1009
|
transactions = transactions.sort((a, b) => a.nonce - b.nonce);
|
|
1010
1010
|
for (let transaction of transactions) {
|
|
1011
1011
|
const hash = await transaction.hash();
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1012
|
+
const doubleTransactions = [];
|
|
1013
|
+
for (const block of this.#blocks) {
|
|
1014
|
+
for (const transaction of block.transactions) {
|
|
1015
|
+
if (transaction.hash === hash) {
|
|
1016
|
+
doubleTransactions.push(hash);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
console.log();
|
|
1021
|
+
if (doubleTransactions.length > 0) {
|
|
1014
1022
|
await globalThis.transactionPoolStore.delete(hash);
|
|
1015
1023
|
await globalThis.peernet.publish('invalid-transaction', hash);
|
|
1016
1024
|
}
|