@leofcoin/chain 1.9.17 → 1.9.19
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-8BFql6K9-BMRX6B2u.js → browser-8BFql6K9-Cfm2axSE.js} +2 -2
- package/exports/browser/{browser-FVp_QbaL-zB8FF4EN.js → browser-FVp_QbaL-DShoEW2_.js} +2 -2
- package/exports/browser/chain.js +44 -24
- package/exports/browser/{client-lPe0SUWx-DR-mCTBz.js → client-lPe0SUWx-Cm8Ph6Z5.js} +4 -4
- package/exports/browser/{constants-V2VjIc2r.js → constants-BCaq9RBn.js} +1 -1
- package/exports/browser/{index-D6qd-AUn-CCzkkXys.js → index-D6qd-AUn-q2EQ9wfH.js} +2 -2
- package/exports/browser/{messages-BfDvXW-x-C-CI69S2.js → messages-BfDvXW-x-CNuQ6tVL.js} +2 -2
- package/exports/browser/{node-browser-y2adT6_R.js → node-browser-CYsu-WiL.js} +4 -4
- package/exports/browser/node-browser.js +2 -2
- package/exports/chain.js +23 -20
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs } from './node-browser-
|
|
1
|
+
import { g as getDefaultExportFromCjs } from './node-browser-CYsu-WiL.js';
|
|
2
2
|
import 'crypto';
|
|
3
|
-
import './constants-
|
|
3
|
+
import './constants-BCaq9RBn.js';
|
|
4
4
|
|
|
5
5
|
function _mergeNamespaces$1(n, m) {
|
|
6
6
|
m.forEach(function (e) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getDefaultExportFromCjs } from './node-browser-
|
|
1
|
+
import { g as getDefaultExportFromCjs } from './node-browser-CYsu-WiL.js';
|
|
2
2
|
import 'crypto';
|
|
3
|
-
import './constants-
|
|
3
|
+
import './constants-BCaq9RBn.js';
|
|
4
4
|
|
|
5
5
|
function _mergeNamespaces$1(n, m) {
|
|
6
6
|
m.forEach(function (e) {
|
package/exports/browser/chain.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as toBase58, T as TransactionMessage, C as ContractMessage,
|
|
1
|
+
import { t as toBase58, T as TransactionMessage, C as ContractMessage, R as RawTransactionMessage, B as BlockMessage, L as LastBlockMessage, P as PROTOCOL_VERSION, a as REACHED_ONE_ZERO_ZERO, b as PrevoteMessage, c as PrecommitMessage, d as ProposalMessage, e as BWMessage, S as StateMessage, f as BWRequestMessage } from './constants-BCaq9RBn.js';
|
|
2
2
|
|
|
3
3
|
const getTargets = () => Array.from([]);
|
|
4
4
|
const isEnabled = (target) => {
|
|
@@ -1234,6 +1234,22 @@ function requireSemver$1 () {
|
|
|
1234
1234
|
|
|
1235
1235
|
const parseOptions = requireParseOptions();
|
|
1236
1236
|
const { compareIdentifiers } = requireIdentifiers();
|
|
1237
|
+
|
|
1238
|
+
const isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
1239
|
+
const identifiers = identifier.split('.');
|
|
1240
|
+
if (identifiers.length > prerelease.length) {
|
|
1241
|
+
return false
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
for (let i = 0; i < identifiers.length; i++) {
|
|
1245
|
+
if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {
|
|
1246
|
+
return false
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
return true
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1237
1253
|
class SemVer {
|
|
1238
1254
|
constructor (version, options) {
|
|
1239
1255
|
options = parseOptions(options);
|
|
@@ -1537,8 +1553,9 @@ function requireSemver$1 () {
|
|
|
1537
1553
|
if (identifierBase === false) {
|
|
1538
1554
|
prerelease = [identifier];
|
|
1539
1555
|
}
|
|
1540
|
-
if (
|
|
1541
|
-
|
|
1556
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
1557
|
+
const prereleaseBase = this.prerelease[identifier.split('.').length];
|
|
1558
|
+
if (isNaN(prereleaseBase)) {
|
|
1542
1559
|
this.prerelease = prerelease;
|
|
1543
1560
|
}
|
|
1544
1561
|
} else {
|
|
@@ -5798,7 +5815,7 @@ class ConnectionMonitor {
|
|
|
5798
5815
|
try {
|
|
5799
5816
|
const networkName = globalThis.peernet?.network;
|
|
5800
5817
|
if (networkName && typeof networkName === "string") {
|
|
5801
|
-
const { default: networks } = await import('./constants-
|
|
5818
|
+
const { default: networks } = await import('./constants-BCaq9RBn.js').then(function (n) { return n.n; });
|
|
5802
5819
|
const [mainKey, subKey] = networkName.split(":");
|
|
5803
5820
|
const networkConfig = networks?.[mainKey]?.[subKey];
|
|
5804
5821
|
if (networkConfig?.stars && Array.isArray(networkConfig.stars)) {
|
|
@@ -6364,31 +6381,31 @@ class Chain extends VersionControl {
|
|
|
6364
6381
|
const node = await this.#prepareRequest(request);
|
|
6365
6382
|
try {
|
|
6366
6383
|
let response = await peer.request(node.encoded);
|
|
6367
|
-
response
|
|
6384
|
+
if (response === void 0 || response === null) return response;
|
|
6368
6385
|
const normalizeResponse = async (payload) => {
|
|
6369
|
-
if (payload
|
|
6370
|
-
|
|
6386
|
+
if (payload === void 0 || payload === null) return payload;
|
|
6387
|
+
if (payload && typeof payload === "object") {
|
|
6388
|
+
if ("decoded" in payload && payload?.decoded && "response" in payload.decoded) {
|
|
6389
|
+
return normalizeResponse(payload.decoded.response);
|
|
6390
|
+
}
|
|
6391
|
+
if ("response" in payload) {
|
|
6392
|
+
return normalizeResponse(payload.response);
|
|
6393
|
+
}
|
|
6371
6394
|
}
|
|
6372
6395
|
if (payload instanceof Uint8Array || typeof Buffer !== "undefined" && Buffer.isBuffer(payload)) {
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
if (!(payload instanceof Uint8Array)) break;
|
|
6379
|
-
bytes = payload;
|
|
6380
|
-
} catch {
|
|
6381
|
-
break;
|
|
6396
|
+
const bytes = payload instanceof Uint8Array ? payload : new Uint8Array(payload);
|
|
6397
|
+
try {
|
|
6398
|
+
const wrapped = await new globalThis.peernet.protos["peernet-response"](bytes);
|
|
6399
|
+
if (wrapped?.decoded?.response !== void 0) {
|
|
6400
|
+
return normalizeResponse(wrapped.decoded.response);
|
|
6382
6401
|
}
|
|
6402
|
+
} catch {
|
|
6383
6403
|
}
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
return payload;
|
|
6389
|
-
}
|
|
6404
|
+
try {
|
|
6405
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
6406
|
+
} catch {
|
|
6407
|
+
return bytes;
|
|
6390
6408
|
}
|
|
6391
|
-
return payload;
|
|
6392
6409
|
}
|
|
6393
6410
|
if (typeof payload === "string") {
|
|
6394
6411
|
try {
|
|
@@ -6399,7 +6416,7 @@ class Chain extends VersionControl {
|
|
|
6399
6416
|
}
|
|
6400
6417
|
return payload;
|
|
6401
6418
|
};
|
|
6402
|
-
return await normalizeResponse(response
|
|
6419
|
+
return await normalizeResponse(response);
|
|
6403
6420
|
} catch (error) {
|
|
6404
6421
|
const peerId = peer?.peerId || peer?.id || peer?.address || "unknown";
|
|
6405
6422
|
debug(`peernet request failed: ${request} -> ${peerId}:`, error?.message ?? error);
|
|
@@ -6518,6 +6535,9 @@ class Chain extends VersionControl {
|
|
|
6518
6535
|
console.log("requesting last block from peer...");
|
|
6519
6536
|
console.log(await this.lastBlock);
|
|
6520
6537
|
const lastBlockRaw = await this.#makeRequest(peer, "lastBlock");
|
|
6538
|
+
if (lastBlockRaw === void 0 || lastBlockRaw === null || typeof lastBlockRaw !== "object" && !(lastBlockRaw instanceof Uint8Array)) {
|
|
6539
|
+
throw new Error(`invalid lastBlock payload: ${typeof lastBlockRaw}`);
|
|
6540
|
+
}
|
|
6521
6541
|
console.log(new LastBlockMessage(lastBlockRaw));
|
|
6522
6542
|
lastBlock = new LastBlockMessage(lastBlockRaw).decoded;
|
|
6523
6543
|
} catch (error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as inflate_1, c as createDebugger, d as deflate_1, L as LittlePubSub } from './node-browser-
|
|
1
|
+
import { i as inflate_1, c as createDebugger, d as deflate_1, L as LittlePubSub } from './node-browser-CYsu-WiL.js';
|
|
2
2
|
import 'crypto';
|
|
3
|
-
import './constants-
|
|
3
|
+
import './constants-BCaq9RBn.js';
|
|
4
4
|
|
|
5
5
|
class Api {
|
|
6
6
|
_pubsub;
|
|
@@ -231,7 +231,7 @@ class SocketRequestClient {
|
|
|
231
231
|
const init = async () => {
|
|
232
232
|
// @ts-ignore
|
|
233
233
|
if (!globalThis.WebSocket && !this.#experimentalWebsocket)
|
|
234
|
-
globalThis.WebSocket = (await import('./browser-8BFql6K9-
|
|
234
|
+
globalThis.WebSocket = (await import('./browser-8BFql6K9-Cfm2axSE.js').then(function (n) { return n.b; })).default.w3cwebsocket;
|
|
235
235
|
const client = new WebSocket(this.#url, this.#protocol);
|
|
236
236
|
if (this.#experimentalWebsocket) {
|
|
237
237
|
client.addEventListener('error', this.onerror);
|
|
@@ -1302,7 +1302,7 @@ class Client {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
1304
1304
|
async #loadNodeWebrtcImplementation() {
|
|
1305
|
-
const koushWrtcModule = await import('./browser-FVp_QbaL-
|
|
1305
|
+
const koushWrtcModule = await import('./browser-FVp_QbaL-DShoEW2_.js').then(function (n) { return n.b; });
|
|
1306
1306
|
const koushWrtc = koushWrtcModule.default;
|
|
1307
1307
|
if (!isWrtcImplementation(koushWrtc)) {
|
|
1308
1308
|
throw new Error('@koush/wrtc does not match required wrtc contract');
|
|
@@ -9040,4 +9040,4 @@ const DEFAULT_NODE_OPTIONS = {
|
|
|
9040
9040
|
stars: networks.leofcoin.peach.stars
|
|
9041
9041
|
};
|
|
9042
9042
|
|
|
9043
|
-
export {
|
|
9043
|
+
export { BlockMessage as B, ContractMessage as C, DEFAULT_NODE_OPTIONS as D, LastBlockMessage as L, PROTOCOL_VERSION as P, RawTransactionMessage as R, StateMessage as S, TransactionMessage as T, ValidatorMessage as V, REACHED_ONE_ZERO_ZERO as a, PrevoteMessage as b, PrecommitMessage as c, ProposalMessage as d, BWMessage as e, BWRequestMessage as f, networks$1 as n, toBase58 as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-
|
|
1
|
+
import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-CYsu-WiL.js';
|
|
2
2
|
import 'crypto';
|
|
3
|
-
import './constants-
|
|
3
|
+
import './constants-BCaq9RBn.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @params {String} network
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as FormatInterface } from './node-browser-
|
|
1
|
+
import { F as FormatInterface } from './node-browser-CYsu-WiL.js';
|
|
2
2
|
import 'crypto';
|
|
3
|
-
import './constants-
|
|
3
|
+
import './constants-BCaq9RBn.js';
|
|
4
4
|
|
|
5
5
|
var proto$b = {
|
|
6
6
|
data: new Uint8Array(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash as createHash$1 } from 'crypto';
|
|
2
|
-
import { T as TransactionMessage, C as ContractMessage,
|
|
2
|
+
import { T as TransactionMessage, C as ContractMessage, B as BlockMessage, e as BWMessage, f as BWRequestMessage, V as ValidatorMessage, S as StateMessage, L as LastBlockMessage, D as DEFAULT_NODE_OPTIONS } from './constants-BCaq9RBn.js';
|
|
3
3
|
|
|
4
4
|
var nodeConfig = async (config = {
|
|
5
5
|
network: "leofcoin:peach",
|
|
@@ -8337,7 +8337,7 @@ class Identity {
|
|
|
8337
8337
|
this.selectedAccount = new TextDecoder().decode(selected);
|
|
8338
8338
|
}
|
|
8339
8339
|
else {
|
|
8340
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-D6qd-AUn-
|
|
8340
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-D6qd-AUn-q2EQ9wfH.js');
|
|
8341
8341
|
const { identity, accounts } = await importee.default(password, this.network);
|
|
8342
8342
|
await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
|
|
8343
8343
|
await globalThis.walletStore.put('version', String(1));
|
|
@@ -16998,7 +16998,7 @@ class Peernet {
|
|
|
16998
16998
|
await getAddress();
|
|
16999
16999
|
this.storePrefix = options.storePrefix;
|
|
17000
17000
|
this.root = options.root;
|
|
17001
|
-
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile } = await import(/* webpackChunkName: "messages" */ './messages-BfDvXW-x-
|
|
17001
|
+
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile } = await import(/* webpackChunkName: "messages" */ './messages-BfDvXW-x-CNuQ6tVL.js');
|
|
17002
17002
|
/**
|
|
17003
17003
|
* proto Object containing protos
|
|
17004
17004
|
* @type {Object}
|
|
@@ -17045,7 +17045,7 @@ class Peernet {
|
|
|
17045
17045
|
if (this.#starting || this.#started)
|
|
17046
17046
|
return;
|
|
17047
17047
|
this.#starting = true;
|
|
17048
|
-
const importee = await import('./client-lPe0SUWx-
|
|
17048
|
+
const importee = await import('./client-lPe0SUWx-Cm8Ph6Z5.js');
|
|
17049
17049
|
/**
|
|
17050
17050
|
* @access public
|
|
17051
17051
|
* @type {PeernetClient}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { N as default } from './node-browser-
|
|
1
|
+
export { N as default } from './node-browser-CYsu-WiL.js';
|
|
2
2
|
import 'crypto';
|
|
3
|
-
import './constants-
|
|
3
|
+
import './constants-BCaq9RBn.js';
|
package/exports/chain.js
CHANGED
|
@@ -2587,31 +2587,31 @@ class Chain extends VersionControl {
|
|
|
2587
2587
|
const node = await this.#prepareRequest(request);
|
|
2588
2588
|
try {
|
|
2589
2589
|
let response = await peer.request(node.encoded);
|
|
2590
|
-
response
|
|
2590
|
+
if (response === void 0 || response === null) return response;
|
|
2591
2591
|
const normalizeResponse = async (payload) => {
|
|
2592
|
-
if (payload
|
|
2593
|
-
|
|
2592
|
+
if (payload === void 0 || payload === null) return payload;
|
|
2593
|
+
if (payload && typeof payload === "object") {
|
|
2594
|
+
if ("decoded" in payload && payload?.decoded && "response" in payload.decoded) {
|
|
2595
|
+
return normalizeResponse(payload.decoded.response);
|
|
2596
|
+
}
|
|
2597
|
+
if ("response" in payload) {
|
|
2598
|
+
return normalizeResponse(payload.response);
|
|
2599
|
+
}
|
|
2594
2600
|
}
|
|
2595
2601
|
if (payload instanceof Uint8Array || typeof Buffer !== "undefined" && Buffer.isBuffer(payload)) {
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
if (!(payload instanceof Uint8Array)) break;
|
|
2602
|
-
bytes = payload;
|
|
2603
|
-
} catch {
|
|
2604
|
-
break;
|
|
2602
|
+
const bytes = payload instanceof Uint8Array ? payload : new Uint8Array(payload);
|
|
2603
|
+
try {
|
|
2604
|
+
const wrapped = await new globalThis.peernet.protos["peernet-response"](bytes);
|
|
2605
|
+
if (wrapped?.decoded?.response !== void 0) {
|
|
2606
|
+
return normalizeResponse(wrapped.decoded.response);
|
|
2605
2607
|
}
|
|
2608
|
+
} catch {
|
|
2606
2609
|
}
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
return payload;
|
|
2612
|
-
}
|
|
2610
|
+
try {
|
|
2611
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
2612
|
+
} catch {
|
|
2613
|
+
return bytes;
|
|
2613
2614
|
}
|
|
2614
|
-
return payload;
|
|
2615
2615
|
}
|
|
2616
2616
|
if (typeof payload === "string") {
|
|
2617
2617
|
try {
|
|
@@ -2622,7 +2622,7 @@ class Chain extends VersionControl {
|
|
|
2622
2622
|
}
|
|
2623
2623
|
return payload;
|
|
2624
2624
|
};
|
|
2625
|
-
return await normalizeResponse(response
|
|
2625
|
+
return await normalizeResponse(response);
|
|
2626
2626
|
} catch (error) {
|
|
2627
2627
|
const peerId = peer?.peerId || peer?.id || peer?.address || "unknown";
|
|
2628
2628
|
debug(`peernet request failed: ${request} -> ${peerId}:`, error?.message ?? error);
|
|
@@ -2741,6 +2741,9 @@ class Chain extends VersionControl {
|
|
|
2741
2741
|
console.log("requesting last block from peer...");
|
|
2742
2742
|
console.log(await this.lastBlock);
|
|
2743
2743
|
const lastBlockRaw = await this.#makeRequest(peer, "lastBlock");
|
|
2744
|
+
if (lastBlockRaw === void 0 || lastBlockRaw === null || typeof lastBlockRaw !== "object" && !(lastBlockRaw instanceof Uint8Array)) {
|
|
2745
|
+
throw new Error(`invalid lastBlock payload: ${typeof lastBlockRaw}`);
|
|
2746
|
+
}
|
|
2744
2747
|
console.log(new LastBlockMessage(lastBlockRaw));
|
|
2745
2748
|
lastBlock = new LastBlockMessage(lastBlockRaw).decoded;
|
|
2746
2749
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/chain",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.19",
|
|
4
4
|
"description": "Official javascript implementation",
|
|
5
5
|
"private": false,
|
|
6
6
|
"exports": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
56
56
|
"@types/semver": "^7.7.1",
|
|
57
57
|
"@vandeurenglenn/debug": "^1.4.0",
|
|
58
|
-
"rollup": "^4.
|
|
58
|
+
"rollup": "^4.61.1",
|
|
59
59
|
"rollup-plugin-esbuild": "^6.2.1",
|
|
60
60
|
"rollup-plugin-modify": "^3.0.0",
|
|
61
61
|
"tape": "^5.9.0",
|
|
@@ -77,6 +77,6 @@
|
|
|
77
77
|
"@leofcoin/workers": "^1.5.30",
|
|
78
78
|
"@vandeurenglenn/base58": "^1.1.9",
|
|
79
79
|
"@vandeurenglenn/easy-worker": "^1.0.3",
|
|
80
|
-
"semver": "^7.8.
|
|
80
|
+
"semver": "^7.8.2"
|
|
81
81
|
}
|
|
82
82
|
}
|