@leofcoin/chain 1.5.35 → 1.5.37
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 +13 -11
- package/exports/browser/{index-3614702b-6244d21e.js → index-20ad607b-d0eaabce.js} +1 -1
- package/exports/browser/{messages-92c1c441-6c77c6bd.js → messages-29f5675b-a1c47a58.js} +1 -1
- package/exports/browser/{node-browser-484d9d8b.js → node-browser-1bc3977e.js} +10 -6
- package/exports/browser/node-browser.js +1 -1
- package/exports/chain.d.ts +1 -1
- package/exports/chain.js +13 -11
- package/exports/contract.d.ts +1 -1
- package/exports/protocol.d.ts +2 -0
- package/exports/state.d.ts +1 -1
- package/exports/transaction.d.ts +1 -1
- package/exports/version-control.d.ts +1 -1
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -473,8 +473,10 @@ const transactionLimit = 1800;
|
|
|
473
473
|
const requestTimeout = 30000;
|
|
474
474
|
const syncTimeout = 30000;
|
|
475
475
|
class Protocol {
|
|
476
|
-
constructor() {
|
|
476
|
+
constructor(config) {
|
|
477
477
|
this.resolveTimeout = 10000;
|
|
478
|
+
if (config?.resolveTimeout)
|
|
479
|
+
this.resolveTimeout = config.resolveTimeout;
|
|
478
480
|
}
|
|
479
481
|
get limit() {
|
|
480
482
|
return limit;
|
|
@@ -491,8 +493,8 @@ class Protocol {
|
|
|
491
493
|
}
|
|
492
494
|
|
|
493
495
|
class Transaction extends Protocol {
|
|
494
|
-
constructor() {
|
|
495
|
-
super();
|
|
496
|
+
constructor(config) {
|
|
497
|
+
super(config);
|
|
496
498
|
}
|
|
497
499
|
/**
|
|
498
500
|
*
|
|
@@ -674,8 +676,8 @@ class Transaction extends Protocol {
|
|
|
674
676
|
* @extends {Transaction}
|
|
675
677
|
*/
|
|
676
678
|
class Contract extends Transaction {
|
|
677
|
-
constructor() {
|
|
678
|
-
super();
|
|
679
|
+
constructor(config) {
|
|
680
|
+
super(config);
|
|
679
681
|
}
|
|
680
682
|
async init() { }
|
|
681
683
|
/**
|
|
@@ -1163,8 +1165,8 @@ class State extends Contract {
|
|
|
1163
1165
|
get machine() {
|
|
1164
1166
|
return this.#machine;
|
|
1165
1167
|
}
|
|
1166
|
-
constructor() {
|
|
1167
|
-
super();
|
|
1168
|
+
constructor(config) {
|
|
1169
|
+
super(config);
|
|
1168
1170
|
this.#lastResolvedTime = 0;
|
|
1169
1171
|
this.#resolving = false;
|
|
1170
1172
|
this.#resolveErrorCount = 0;
|
|
@@ -1663,8 +1665,8 @@ class State extends Contract {
|
|
|
1663
1665
|
}
|
|
1664
1666
|
|
|
1665
1667
|
class VersionControl extends State {
|
|
1666
|
-
constructor() {
|
|
1667
|
-
super();
|
|
1668
|
+
constructor(config) {
|
|
1669
|
+
super(config);
|
|
1668
1670
|
}
|
|
1669
1671
|
async init() {
|
|
1670
1672
|
super.init && (await super.init());
|
|
@@ -1708,8 +1710,8 @@ class Chain extends VersionControl {
|
|
|
1708
1710
|
#participants;
|
|
1709
1711
|
#participating;
|
|
1710
1712
|
#jail;
|
|
1711
|
-
constructor() {
|
|
1712
|
-
super();
|
|
1713
|
+
constructor(config) {
|
|
1714
|
+
super(config);
|
|
1713
1715
|
this.#slotTime = 10000;
|
|
1714
1716
|
this.utils = {};
|
|
1715
1717
|
/** {Address[]} */
|
|
@@ -12542,7 +12542,7 @@ const BufferToUint8Array = (data) => {
|
|
|
12542
12542
|
|
|
12543
12543
|
const protoFor = (message) => {
|
|
12544
12544
|
const codec = new Codec(message);
|
|
12545
|
-
if (!codec.name) throw new Error(
|
|
12545
|
+
if (!codec.name) throw new Error(`proto not found ${message}`)
|
|
12546
12546
|
const Proto = globalThis.peernet.protos[codec.name];
|
|
12547
12547
|
if (!Proto) throw new Error(`No proto defined for ${codec.name}`)
|
|
12548
12548
|
return new Proto(message)
|
|
@@ -12816,9 +12816,13 @@ class MessageHandler {
|
|
|
12816
12816
|
const dataHandler = async (message) => {
|
|
12817
12817
|
if (!message) return
|
|
12818
12818
|
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12819
|
+
try {
|
|
12820
|
+
const { data, id, from, peer } = message;
|
|
12821
|
+
const proto = await protoFor(data);
|
|
12822
|
+
peernet._protoHandler({ id, proto }, peernet.connections[from] || peer, from);
|
|
12823
|
+
} catch (error) {
|
|
12824
|
+
console.error(error);
|
|
12825
|
+
}
|
|
12822
12826
|
};
|
|
12823
12827
|
|
|
12824
12828
|
const dhtError = (proto) => {
|
|
@@ -27169,7 +27173,7 @@ class Identity {
|
|
|
27169
27173
|
this.selectedAccount = new TextDecoder().decode(selected);
|
|
27170
27174
|
}
|
|
27171
27175
|
else {
|
|
27172
|
-
const importee = await import(/* webpackChunkName: "generate-account" */ './index-
|
|
27176
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-20ad607b-d0eaabce.js');
|
|
27173
27177
|
const { identity, accounts } = await importee.default(password, this.network);
|
|
27174
27178
|
await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
|
|
27175
27179
|
await globalThis.walletStore.put('version', String(1));
|
|
@@ -27361,7 +27365,7 @@ class Peernet {
|
|
|
27361
27365
|
this.root = options.root;
|
|
27362
27366
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
27363
27367
|
// FolderMessageResponse
|
|
27364
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
27368
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-29f5675b-a1c47a58.js');
|
|
27365
27369
|
/**
|
|
27366
27370
|
* proto Object containing protos
|
|
27367
27371
|
* @type {Object}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { N as default } from './node-browser-
|
|
1
|
+
export { N as default } from './node-browser-1bc3977e.js';
|
|
2
2
|
import './index-4420907d.js';
|
package/exports/chain.d.ts
CHANGED
package/exports/chain.js
CHANGED
|
@@ -11,8 +11,10 @@ const transactionLimit = 1800;
|
|
|
11
11
|
const requestTimeout = 30000;
|
|
12
12
|
const syncTimeout = 30000;
|
|
13
13
|
class Protocol {
|
|
14
|
-
constructor() {
|
|
14
|
+
constructor(config) {
|
|
15
15
|
this.resolveTimeout = 10000;
|
|
16
|
+
if (config?.resolveTimeout)
|
|
17
|
+
this.resolveTimeout = config.resolveTimeout;
|
|
16
18
|
}
|
|
17
19
|
get limit() {
|
|
18
20
|
return limit;
|
|
@@ -29,8 +31,8 @@ class Protocol {
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
class Transaction extends Protocol {
|
|
32
|
-
constructor() {
|
|
33
|
-
super();
|
|
34
|
+
constructor(config) {
|
|
35
|
+
super(config);
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
*
|
|
@@ -212,8 +214,8 @@ class Transaction extends Protocol {
|
|
|
212
214
|
* @extends {Transaction}
|
|
213
215
|
*/
|
|
214
216
|
class Contract extends Transaction {
|
|
215
|
-
constructor() {
|
|
216
|
-
super();
|
|
217
|
+
constructor(config) {
|
|
218
|
+
super(config);
|
|
217
219
|
}
|
|
218
220
|
async init() { }
|
|
219
221
|
/**
|
|
@@ -599,8 +601,8 @@ class State extends Contract {
|
|
|
599
601
|
get machine() {
|
|
600
602
|
return this.#machine;
|
|
601
603
|
}
|
|
602
|
-
constructor() {
|
|
603
|
-
super();
|
|
604
|
+
constructor(config) {
|
|
605
|
+
super(config);
|
|
604
606
|
this.#lastResolvedTime = 0;
|
|
605
607
|
this.#resolving = false;
|
|
606
608
|
this.#resolveErrorCount = 0;
|
|
@@ -1099,8 +1101,8 @@ class State extends Contract {
|
|
|
1099
1101
|
}
|
|
1100
1102
|
|
|
1101
1103
|
class VersionControl extends State {
|
|
1102
|
-
constructor() {
|
|
1103
|
-
super();
|
|
1104
|
+
constructor(config) {
|
|
1105
|
+
super(config);
|
|
1104
1106
|
}
|
|
1105
1107
|
async init() {
|
|
1106
1108
|
super.init && (await super.init());
|
|
@@ -1144,8 +1146,8 @@ class Chain extends VersionControl {
|
|
|
1144
1146
|
#participants;
|
|
1145
1147
|
#participating;
|
|
1146
1148
|
#jail;
|
|
1147
|
-
constructor() {
|
|
1148
|
-
super();
|
|
1149
|
+
constructor(config) {
|
|
1150
|
+
super(config);
|
|
1149
1151
|
this.#slotTime = 10000;
|
|
1150
1152
|
this.utils = {};
|
|
1151
1153
|
/** {Address[]} */
|
package/exports/contract.d.ts
CHANGED
package/exports/protocol.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ChainConfig } from './types.js';
|
|
1
2
|
export declare const limit = 1800;
|
|
2
3
|
export declare const transactionLimit = 1800;
|
|
3
4
|
export declare const requestTimeout = 30000;
|
|
@@ -5,6 +6,7 @@ export declare const syncTimeout = 30000;
|
|
|
5
6
|
export declare class Protocol {
|
|
6
7
|
version: string;
|
|
7
8
|
resolveTimeout: EpochTimeStamp;
|
|
9
|
+
constructor(config: ChainConfig);
|
|
8
10
|
get limit(): number;
|
|
9
11
|
get transactionLimit(): number;
|
|
10
12
|
get requestTimeout(): number;
|
package/exports/state.d.ts
CHANGED
package/exports/transaction.d.ts
CHANGED