@leofcoin/chain 1.9.6 → 1.9.9

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.
Files changed (35) hide show
  1. package/exports/browser/chain.js +3932 -4500
  2. package/exports/browser/{constants-M3qbPwZp.js → constants-BCaq9RBn.js} +408 -426
  3. package/exports/browser/node-browser.js +50 -57
  4. package/exports/chain.js +3185 -3567
  5. package/exports/constants-C83ZCYKa.js +12 -0
  6. package/exports/node.js +19 -24
  7. package/package.json +2 -1
  8. package/exports/chain.d.ts +0 -73
  9. package/exports/config/config.d.ts +0 -1
  10. package/exports/config/main.d.ts +0 -5
  11. package/exports/config/protocol.d.ts +0 -6
  12. package/exports/connection-monitor.d.ts +0 -14
  13. package/exports/consensus/consensus.d.ts +0 -1
  14. package/exports/consensus/helpers/sort-transactions.d.ts +0 -1
  15. package/exports/constants-eo0U5-D_.js +0 -12
  16. package/exports/constants.d.ts +0 -15
  17. package/exports/contract-registry.d.ts +0 -106
  18. package/exports/contract-utils.d.ts +0 -49
  19. package/exports/contract.d.ts +0 -90
  20. package/exports/examples/contract-inheritance-example.d.ts +0 -58
  21. package/exports/examples/hash-based-contracts.d.ts +0 -82
  22. package/exports/fee/config.d.ts +0 -4
  23. package/exports/helpers/contract.d.ts +0 -4
  24. package/exports/jobs/jobber.d.ts +0 -7
  25. package/exports/machine-state.d.ts +0 -6
  26. package/exports/machine.d.ts +0 -64
  27. package/exports/node-browser.d.ts +0 -6
  28. package/exports/node.d.ts +0 -8
  29. package/exports/protocol.d.ts +0 -15
  30. package/exports/simplifiers/state.d.ts +0 -3
  31. package/exports/state.d.ts +0 -66
  32. package/exports/sync-controller.d.ts +0 -14
  33. package/exports/transaction.d.ts +0 -41
  34. package/exports/types.d.ts +0 -24
  35. package/exports/version-control.d.ts +0 -7
@@ -1,68 +1,61 @@
1
1
  import Peernet from '@leofcoin/peernet/browser';
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-M3qbPwZp.js';
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
- network: 'leofcoin:peach',
6
- networkVersion: 'v1.0.0'
5
+ network: "leofcoin:peach",
6
+ networkVersion: "v1.0.0"
7
7
  }) => {
8
- const protos = [
9
- { name: 'transaction-message', handler: TransactionMessage },
10
- { name: 'contract-message', handler: ContractMessage },
11
- { name: 'block-message', handler: BlockMessage },
12
- { name: 'bw-message', handler: BWMessage },
13
- { name: 'bw-request-message', handler: BWRequestMessage },
14
- { name: 'validator-message', handler: ValidatorMessage },
15
- { name: 'state-message', handler: StateMessage },
16
- { name: 'last-block', handler: LastBlockMessage }
17
- ];
18
- for (const proto of protos) {
19
- peernet.addProto(proto.name, proto.handler);
8
+ const protos = [
9
+ { name: "transaction-message", handler: TransactionMessage },
10
+ { name: "contract-message", handler: ContractMessage },
11
+ { name: "block-message", handler: BlockMessage },
12
+ { name: "bw-message", handler: BWMessage },
13
+ { name: "bw-request-message", handler: BWRequestMessage },
14
+ { name: "validator-message", handler: ValidatorMessage },
15
+ { name: "state-message", handler: StateMessage },
16
+ { name: "last-block", handler: LastBlockMessage }
17
+ ];
18
+ for (const proto of protos) {
19
+ peernet.addProto(proto.name, proto.handler);
20
+ }
21
+ let name = `.${config.network}`;
22
+ const parts = config.network.split(":");
23
+ if (parts[1])
24
+ name = `.${parts[0]}/${parts[1]}`;
25
+ if (typeof config.storeNamespace === "string" && config.storeNamespace.length > 0) {
26
+ name = `${name}/${config.storeNamespace}`;
27
+ }
28
+ const stores = ["transactionPool", "state", "accounts", "contract", { name: "wallet", private: true }];
29
+ for (const store of stores) {
30
+ if (typeof store === "string") {
31
+ await peernet.addStore(store, "lfc", name, false);
32
+ } else {
33
+ await peernet.addStore(store.name, "lfc", name, store.private);
20
34
  }
21
- let name = `.${config.network}`;
22
- const parts = config.network.split(':');
23
- if (parts[1])
24
- name = `.${parts[0]}/${parts[1]}`;
25
- // optional namespace suffix to isolate multiple local nodes on same network
26
- // e.g., '.leofcoin/peach/dev-validator-1'
27
- if (typeof config.storeNamespace === 'string' && config.storeNamespace.length > 0) {
28
- name = `${name}/${config.storeNamespace}`;
29
- }
30
- const stores = ['transactionPool', 'state', 'accounts', 'contract', { name: 'wallet', private: true }];
31
- for (const store of stores) {
32
- if (typeof store === 'string') {
33
- await peernet.addStore(store, 'lfc', name, false);
34
- }
35
- else {
36
- await peernet.addStore(store.name, 'lfc', name, store.private);
37
- }
38
- }
39
- return {
40
- stores,
41
- protos
42
- };
35
+ }
36
+ return {
37
+ stores,
38
+ protos
39
+ };
43
40
  };
44
41
 
45
- // import config from './config/config'
46
42
  class Node {
47
- #node;
48
- constructor(config, password) {
49
- return this._init(config, password);
50
- }
51
- async _init(config = {}, password) {
52
- config = { ...DEFAULT_NODE_OPTIONS, ...config };
53
- this.#node = globalThis.Peernet
54
- ? await new globalThis.Peernet(config, password)
55
- : await new Peernet(config, password);
56
- await nodeConfig(config);
57
- globalThis.pubsub.subscribe('chain:ready', async () => {
58
- if (!this.#node.autoStart) {
59
- await this.#node.start();
60
- pubsub.publish('node:ready', true);
61
- }
62
- });
63
- return this;
64
- // this.config = await config()
65
- }
43
+ #node;
44
+ constructor(config, password) {
45
+ return this._init(config, password);
46
+ }
47
+ async _init(config = {}, password) {
48
+ config = { ...DEFAULT_NODE_OPTIONS, ...config };
49
+ this.#node = globalThis.Peernet ? await new globalThis.Peernet(config, password) : await new Peernet(config, password);
50
+ await nodeConfig(config);
51
+ globalThis.pubsub.subscribe("chain:ready", async () => {
52
+ if (!this.#node.autoStart) {
53
+ await this.#node.start();
54
+ pubsub.publish("node:ready", true);
55
+ }
56
+ });
57
+ return this;
58
+ }
66
59
  }
67
60
 
68
61
  export { Node as default };