@leofcoin/launch-chain 0.1.7 → 0.2.1

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/README.md CHANGED
@@ -18,6 +18,7 @@ const {chain, endpoints, mode} = await launch()
18
18
  ```js
19
19
  {
20
20
  network: 'leofcoin:peach',
21
+ stars: ['wss://peach.leofcoin.org'],
21
22
  ws: {
22
23
  port: 4040,
23
24
  url: 'ws://localhost:4040'
@@ -31,10 +32,30 @@ const {chain, endpoints, mode} = await launch()
31
32
 
32
33
  ### disabling options
33
34
  ```js
35
+ stars: [] // note that disabling stars results in no peer discovery
34
36
  {
35
37
  ws: false,
36
38
  http: false
37
39
  }
38
40
  ```
39
41
 
40
- ## needs --openssl-legacy-provider
42
+ ## build for browser
43
+ no prebuild are provided since the esm switch, everything is written with the browser in mind so some simple ignores are enough to build.
44
+
45
+ ### rollup
46
+ ```js
47
+ external: [
48
+ '@koush/wrtc',
49
+ '@leofcoin/endpoints/ws',
50
+ '@leofcoin/endpoints/http'
51
+ ]
52
+ ```
53
+
54
+ ### webpack
55
+ ```js
56
+ externals: {
57
+ '@koush/wrtc': false,
58
+ '@leofcoin/endpoints/ws': false,
59
+ '@leofcoin/endpoints/http': false
60
+ }
61
+ ```
package/exports/launch.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import Node from '@leofcoin/chain/node'
2
2
  import Chain from '@leofcoin/chain/chain'
3
3
  import nodeConfig from '@leofcoin/lib/node-config'
4
- import wsServer from '@leofcoin/endpoints/ws'
5
- import httpServer from '@leofcoin/endpoints/http'
6
4
 
7
5
  /**
8
6
  *
@@ -70,6 +68,7 @@ const hasClient = async (httpURL, wsURL, networkVersion) => {
70
68
  const launch = async (options = {}) => {
71
69
  if (!options) options = {}
72
70
  if (!options.network) options.network = 'leofcoin:peach'
71
+ if (!options.stars) options.stars = ['wss://peach.leofcoin.org']
73
72
  if (options.ws === undefined) options.ws = { port: 4040 }
74
73
  if (options.http === undefined) options.http = { port: 8080 }
75
74
  if (options.networkVersion === undefined) options.networkVersion = options.network.replace(':', '-')
@@ -88,16 +87,20 @@ const launch = async (options = {}) => {
88
87
  })
89
88
  mode = 'remote'
90
89
  } else {
91
- await new Node({ network: options.network })
92
- await nodeConfig({ network: options.network })
90
+ await new Node({ network: options.network, stars: options.stars })
91
+ await nodeConfig({ network: options.network, stars: options.stars })
93
92
 
94
93
  chain = await new Chain()
95
94
 
96
95
  if (options.ws) {
96
+ const importee = await import('@leofcoin/endpoints/ws')
97
+ const wsServer = importee.default
97
98
  await wsServer(chain, options.ws.port, options.networkVersion)
98
99
  endpoints.ws = options.ws.url
99
100
  }
100
101
  if (options.http) {
102
+ const importee = await import('@leofcoin/endpoints/http')
103
+ const httpServer = importee.default
101
104
  await httpServer(chain, options.http.port, options.networkVersion)
102
105
  endpoints.http = options.http.url
103
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/launch-chain",
3
- "version": "0.1.7",
3
+ "version": "0.2.1",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": "./exports/launch.js"
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "homepage": "https://github.com/leofcoin/launch-chain#readme",
23
23
  "dependencies": {
24
- "@leofcoin/chain": "^1.4.5",
25
- "@leofcoin/endpoints": "^0.1.0"
24
+ "@leofcoin/chain": "^1.4.8",
25
+ "@leofcoin/endpoints": "^0.2.0"
26
26
  }
27
27
  }