@leofcoin/chain 1.7.70 → 1.7.72
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/{browser-DQJ6xf_F-BCS5wcAv.js → browser-BogfGRzB-D3fc2MzB.js} +2 -1
- package/exports/browser/chain.js +6 -5
- package/exports/browser/{client-C0VVXIWm-DcqDljSm.js → client-DD7vhDK_-UAymLS2i.js} +31 -8
- package/exports/browser/{identity-CQ_ieRiz-CTM-_kGF.js → identity--VAIVSMm-DTWL357I.js} +217 -127
- package/exports/browser/{index-CEwkDK9g-CHsuUR8y.js → index-Vgr1JQcP-DNJYAZ_u.js} +63 -42
- package/exports/browser/{index-BeqbCwUk-BNpn0JK0.js → index-Vl0cNziw-Dw2QX2H3.js} +1 -1
- package/exports/browser/{messages-BdevLRCA-DCm-zGuC.js → messages-CW17jRdc-c9cSXiiQ.js} +2 -2
- package/exports/browser/{node-browser-DcYcGvEF.js → node-browser-BvxzAdLe.js} +279 -4323
- package/exports/browser/node-browser.js +2 -2
- package/exports/browser/workers/machine-worker.js +5 -3
- package/exports/chain.js +6 -5
- package/exports/workers/machine-worker.js +5 -3
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs } from './identity-
|
|
1
|
+
import { g as getDefaultExportFromCjs } from './identity--VAIVSMm-DTWL357I.js';
|
|
2
2
|
|
|
3
3
|
var global;
|
|
4
4
|
var hasRequiredGlobal;
|
|
@@ -43,6 +43,7 @@ function requireGlobal () {
|
|
|
43
43
|
})();
|
|
44
44
|
return global;
|
|
45
45
|
}
|
|
46
|
+
|
|
46
47
|
var version$1 = "1.0.35";
|
|
47
48
|
var require$$0 = {
|
|
48
49
|
version: version$1};
|
package/exports/browser/chain.js
CHANGED
|
@@ -5392,6 +5392,10 @@ class Chain extends VersionControl {
|
|
|
5392
5392
|
}
|
|
5393
5393
|
async #invalidTransaction(hash) {
|
|
5394
5394
|
hash = new TextDecoder().decode(hash);
|
|
5395
|
+
if (!(await globalThis.transactionPoolStore.has(hash))) {
|
|
5396
|
+
debug(`transaction ${hash} not in pool`);
|
|
5397
|
+
return;
|
|
5398
|
+
}
|
|
5395
5399
|
console.log(`removing invalid transaction: ${hash}`);
|
|
5396
5400
|
await globalThis.transactionPoolStore.delete(hash);
|
|
5397
5401
|
}
|
|
@@ -5528,9 +5532,9 @@ class Chain extends VersionControl {
|
|
|
5528
5532
|
promises = await Promise.allSettled(promises);
|
|
5529
5533
|
const noncesByAddress = {};
|
|
5530
5534
|
for (let transaction of transactions) {
|
|
5531
|
-
globalThis.pubsub.publish('transaction-processed', transaction);
|
|
5535
|
+
globalThis.pubsub.publish('transaction-processed', transaction.encoded);
|
|
5532
5536
|
if (transaction.decoded.to === globalThis.peernet.selectedAccount)
|
|
5533
|
-
globalThis.pubsub.publish('account-transaction-processed', transaction);
|
|
5537
|
+
globalThis.pubsub.publish('account-transaction-processed', transaction.encoded);
|
|
5534
5538
|
if (!noncesByAddress[transaction.decoded.from] ||
|
|
5535
5539
|
noncesByAddress?.[transaction.decoded.from] < transaction.decoded.nonce) {
|
|
5536
5540
|
noncesByAddress[transaction.decoded.from] = transaction.decoded.nonce;
|
|
@@ -5603,10 +5607,7 @@ class Chain extends VersionControl {
|
|
|
5603
5607
|
console.log({ e });
|
|
5604
5608
|
console.log(hash);
|
|
5605
5609
|
peernet.publish('invalid-transaction', hash);
|
|
5606
|
-
console.log(await globalThis.transactionPoolStore.keys());
|
|
5607
|
-
console.log(await globalThis.transactionPoolStore.has(e.hash));
|
|
5608
5610
|
await globalThis.transactionPoolStore.delete(e.hash);
|
|
5609
|
-
console.log(await globalThis.transactionPoolStore.has(e.hash));
|
|
5610
5611
|
}
|
|
5611
5612
|
}
|
|
5612
5613
|
// todo filter tx that need to wait on prev nonce
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LittlePubSub } from './node-browser-
|
|
2
|
-
import './identity-
|
|
1
|
+
import { L as LittlePubSub } from './node-browser-BvxzAdLe.js';
|
|
2
|
+
import './identity--VAIVSMm-DTWL357I.js';
|
|
3
3
|
import './index-DUfUgiQY.js';
|
|
4
4
|
|
|
5
5
|
class Api {
|
|
@@ -210,7 +210,7 @@ class SocketRequestClient {
|
|
|
210
210
|
const init = async () => {
|
|
211
211
|
// @ts-ignore
|
|
212
212
|
if (!globalThis.WebSocket && !this.#experimentalWebsocket)
|
|
213
|
-
globalThis.WebSocket = (await import('./browser-
|
|
213
|
+
globalThis.WebSocket = (await import('./browser-BogfGRzB-D3fc2MzB.js').then(function (n) { return n.b; })).default.w3cwebsocket;
|
|
214
214
|
const client = new WebSocket(this.#url, this.#protocol);
|
|
215
215
|
if (this.#experimentalWebsocket) {
|
|
216
216
|
client.addEventListener('error', this.onerror);
|
|
@@ -314,7 +314,7 @@ const iceServers = [
|
|
|
314
314
|
credential: 'openrelayproject'
|
|
315
315
|
}
|
|
316
316
|
];
|
|
317
|
-
const SimplePeer = (await import('./index-
|
|
317
|
+
const SimplePeer = (await import('./index-Vgr1JQcP-DNJYAZ_u.js').then(function (n) { return n.i; })).default;
|
|
318
318
|
class Peer extends SimplePeer {
|
|
319
319
|
peerId;
|
|
320
320
|
channelName;
|
|
@@ -391,6 +391,14 @@ class Peer extends SimplePeer {
|
|
|
391
391
|
this.send(data, id);
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
|
+
toJSON() {
|
|
395
|
+
return {
|
|
396
|
+
peerId: this.peerId,
|
|
397
|
+
channelName: this.channelName,
|
|
398
|
+
version: this.version,
|
|
399
|
+
bw: this.bw
|
|
400
|
+
};
|
|
401
|
+
}
|
|
394
402
|
}
|
|
395
403
|
|
|
396
404
|
const debug = globalThis.createDebugger('@netpeer/swarm/client');
|
|
@@ -538,8 +546,8 @@ class Client {
|
|
|
538
546
|
this.#connections[peerId].destroy();
|
|
539
547
|
delete this.#connections[peerId];
|
|
540
548
|
}
|
|
541
|
-
|
|
542
|
-
|
|
549
|
+
if (this.peerId !== peerId)
|
|
550
|
+
this.#createRTCPeerConnection(peerId, star, version, true);
|
|
543
551
|
debug(`peer ${peerId} joined`);
|
|
544
552
|
};
|
|
545
553
|
#inComingSignal = async ({ from, signal, channelName, version }, star) => {
|
|
@@ -547,13 +555,28 @@ class Client {
|
|
|
547
555
|
console.warn(`${from} joined using the wrong version.\nexpected: ${this.version} but got:${version}`);
|
|
548
556
|
return;
|
|
549
557
|
}
|
|
558
|
+
if (from === this.peerId) {
|
|
559
|
+
console.warn(`${from} tried to connect to itself.`);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
550
562
|
let peer = this.#connections[from];
|
|
551
563
|
if (!peer) {
|
|
552
564
|
this.#createRTCPeerConnection(from, star, version);
|
|
553
565
|
peer = this.#connections[from];
|
|
554
566
|
}
|
|
555
|
-
if (
|
|
556
|
-
|
|
567
|
+
if (peer.connected) {
|
|
568
|
+
debug(`peer ${from} already connected`);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
if (String(peer.channelName) !== String(channelName)) {
|
|
572
|
+
console.warn(`channelNames don't match: got ${peer.channelName}, expected: ${channelName}. Recreating connection.`);
|
|
573
|
+
// Destroy the existing peer connection
|
|
574
|
+
peer.destroy();
|
|
575
|
+
delete this.#connections[from];
|
|
576
|
+
// Create a new peer connection with the correct configuration
|
|
577
|
+
this.#createRTCPeerConnection(from, star, version, false);
|
|
578
|
+
peer = this.#connections[from];
|
|
579
|
+
}
|
|
557
580
|
peer.signal(signal);
|
|
558
581
|
};
|
|
559
582
|
#peerSignal = (peer, signal, star, version) => {
|