@leofcoin/chain 1.5.3 → 1.5.5
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 +2 -2
- package/exports/browser/{client-c8558012-c8558012.js → client-d602421d-d602421d.js} +25 -1
- package/exports/browser/{index-ed6cbdf7-8662153e.js → index-ba1b3977-4c483021.js} +1 -1
- package/exports/browser/{messages-35d069e1-7ad3a4bb.js → messages-dd1ad11c-8c747755.js} +1 -1
- package/exports/browser/{node-browser-b56b946d.js → node-browser-b55ccb01.js} +16 -13
- package/exports/browser/node-browser.js +1 -1
- package/exports/chain.js +2 -2
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -1381,9 +1381,9 @@ class State extends Contract {
|
|
|
1381
1381
|
catch (error) {
|
|
1382
1382
|
this.#syncErrorCount += 1;
|
|
1383
1383
|
if (this.#syncErrorCount < 3)
|
|
1384
|
-
|
|
1385
|
-
this.#chainSyncing = false;
|
|
1384
|
+
return this.syncChain(lastBlock);
|
|
1386
1385
|
this.#syncErrorCount = 0;
|
|
1386
|
+
this.#chainSyncing = false;
|
|
1387
1387
|
return 'errored';
|
|
1388
1388
|
}
|
|
1389
1389
|
if (lastBlock.index === this.#lastBlockInQue?.index)
|
|
@@ -323,6 +323,30 @@ base(ALPHABET);
|
|
|
323
323
|
|
|
324
324
|
const fromBase58 = (string) => base58$1.decode(string);
|
|
325
325
|
|
|
326
|
+
// todo only one star needed, no need to have one for each network
|
|
327
|
+
// unless we change anything to the star protocoll
|
|
328
|
+
// version diferences should be handled in the chain
|
|
329
|
+
// maybe a good way to handle could be in p2pt-swarm
|
|
330
|
+
var networks = {
|
|
331
|
+
leofcoin: {
|
|
332
|
+
mainnet: {
|
|
333
|
+
// ports don't really matter since it is favorable to have it begind a ngninx proxy but if we change something to the proto it's easier maybe?
|
|
334
|
+
port: 44444,
|
|
335
|
+
// todo a versionhash would be nice to have as a double check?
|
|
336
|
+
versionHash: '0',
|
|
337
|
+
// a short description identifying the version
|
|
338
|
+
description: 'Main net current version',
|
|
339
|
+
stars: ['wss://star.leofcoin.org'] // todo webrtc and bittorent stars
|
|
340
|
+
},
|
|
341
|
+
peach: {
|
|
342
|
+
port: 44444,
|
|
343
|
+
description: 'Main testnet: latest step before merging into main',
|
|
344
|
+
versionHash: '1',
|
|
345
|
+
stars: ['wss://star.leofcoin.org'] // todo webrtc and bittorent stars
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
|
|
326
350
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f();}else if(typeof define==="function"&&define.amd){define([],f);}else {var g;if(typeof window!=="undefined"){g=window;}else if(typeof global!=="undefined"){g=global;}else if(typeof self!=="undefined"){g=self;}else {g=this;}g.P2PT = f();}})(function(){return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t);}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
327
351
|
|
|
328
352
|
var WebSocketTracker = require('bittorrent-tracker/lib/client/websocket-tracker.js');
|
|
@@ -10645,7 +10669,7 @@ class P2PTClient extends P2PT {
|
|
|
10645
10669
|
get discovered() {
|
|
10646
10670
|
return this.#discovered || {};
|
|
10647
10671
|
}
|
|
10648
|
-
constructor(peerId, networkVersion = 'leofcoin:peach', stars =
|
|
10672
|
+
constructor(peerId, networkVersion = 'leofcoin:peach', stars = networks.leofcoin.peach.stars) {
|
|
10649
10673
|
// @ts-ignore
|
|
10650
10674
|
super(stars, networkVersion, fromBase58(peerId));
|
|
10651
10675
|
this.stars = stars;
|
|
@@ -130,15 +130,18 @@ class LittlePubSub {
|
|
|
130
130
|
if (this.subscribers[event].handlers.length === 0)
|
|
131
131
|
delete this.subscribers[event];
|
|
132
132
|
}
|
|
133
|
-
publish(event,
|
|
133
|
+
publish(event, value) {
|
|
134
|
+
// always set value even when having no subscribers
|
|
134
135
|
if (!this.hasSubscribers(event))
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
this.subscribers[event] = {
|
|
137
|
+
handlers: []
|
|
138
|
+
};
|
|
139
|
+
const oldValue = this.subscribers[event]?.value;
|
|
140
|
+
this.subscribers[event].value = value;
|
|
141
|
+
if (this.verbose || oldValue !== value)
|
|
142
|
+
for (const handler of this.subscribers[event].handlers) {
|
|
143
|
+
handler(value, oldValue);
|
|
144
|
+
}
|
|
142
145
|
}
|
|
143
146
|
once(event) {
|
|
144
147
|
return new Promise((resolve) => {
|
|
@@ -6430,7 +6433,7 @@ let LeofcoinStorage$1 = class LeofcoinStorage {
|
|
|
6430
6433
|
this.name = name;
|
|
6431
6434
|
this.root = root;
|
|
6432
6435
|
}
|
|
6433
|
-
async init(
|
|
6436
|
+
async init() {
|
|
6434
6437
|
const importee = await import(globalThis.navigator ? './browser-store.js' : './store.js');
|
|
6435
6438
|
const Store = importee.default;
|
|
6436
6439
|
this.db = new Store(this.name, this.root);
|
|
@@ -20166,7 +20169,7 @@ class Identity {
|
|
|
20166
20169
|
globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
|
|
20167
20170
|
}
|
|
20168
20171
|
else {
|
|
20169
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-
|
|
20172
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-ba1b3977-4c483021.js');
|
|
20170
20173
|
const { identity, accounts } = await importee.default(password, this.network);
|
|
20171
20174
|
await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
|
|
20172
20175
|
await globalThis.walletStore.put('version', String(1));
|
|
@@ -20345,7 +20348,7 @@ class Peernet {
|
|
|
20345
20348
|
this.root = options.root;
|
|
20346
20349
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
20347
20350
|
// FolderMessageResponse
|
|
20348
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
20351
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-dd1ad11c-8c747755.js');
|
|
20349
20352
|
/**
|
|
20350
20353
|
* proto Object containing protos
|
|
20351
20354
|
* @type {Object}
|
|
@@ -20430,7 +20433,7 @@ class Peernet {
|
|
|
20430
20433
|
if (this.#starting || this.#started)
|
|
20431
20434
|
return;
|
|
20432
20435
|
this.#starting = true;
|
|
20433
|
-
const importee = await import('./client-
|
|
20436
|
+
const importee = await import('./client-d602421d-d602421d.js');
|
|
20434
20437
|
/**
|
|
20435
20438
|
* @access public
|
|
20436
20439
|
* @type {PeernetClient}
|
|
@@ -20603,7 +20606,7 @@ class Peernet {
|
|
|
20603
20606
|
}
|
|
20604
20607
|
async requestData(hash, store) {
|
|
20605
20608
|
const providers = await this.providersFor(hash);
|
|
20606
|
-
if (!providers || Object.keys(providers).length === 0)
|
|
20609
|
+
if (!providers || providers && Object.keys(providers).length === 0)
|
|
20607
20610
|
throw nothingFoundError(hash);
|
|
20608
20611
|
debug(`found ${Object.keys(providers).length} provider(s) for ${hash}`);
|
|
20609
20612
|
// get closest peer on earth
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { N as default } from './node-browser-
|
|
1
|
+
export { N as default } from './node-browser-b55ccb01.js';
|
|
2
2
|
import './index-b32f624f.js';
|
package/exports/chain.js
CHANGED
|
@@ -821,9 +821,9 @@ class State extends Contract {
|
|
|
821
821
|
catch (error) {
|
|
822
822
|
this.#syncErrorCount += 1;
|
|
823
823
|
if (this.#syncErrorCount < 3)
|
|
824
|
-
|
|
825
|
-
this.#chainSyncing = false;
|
|
824
|
+
return this.syncChain(lastBlock);
|
|
826
825
|
this.#syncErrorCount = 0;
|
|
826
|
+
this.#chainSyncing = false;
|
|
827
827
|
return 'errored';
|
|
828
828
|
}
|
|
829
829
|
if (lastBlock.index === this.#lastBlockInQue?.index)
|