@leofcoin/launch-chain 0.1.1 → 0.1.3
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/launch.js +6 -6
- package/package.json +1 -1
package/exports/launch.js
CHANGED
|
@@ -78,26 +78,26 @@ const launch = async (options = {ws, http, network: 'leofcoin:peach'}) => {
|
|
|
78
78
|
if (options.ws?.port && !options.ws.url) options.ws.url = `ws://localhost:${options.ws.port}`
|
|
79
79
|
|
|
80
80
|
const clients = await hasClient(options.http.url, options.ws.url, options.networkVersion)
|
|
81
|
-
let endpoints
|
|
81
|
+
let endpoints = {}
|
|
82
82
|
let chain
|
|
83
83
|
let mode
|
|
84
84
|
|
|
85
|
-
if (clients) {
|
|
85
|
+
if (clients.http || clients.ws) {
|
|
86
86
|
Object.entries(clients).forEach(([key, value]) => {
|
|
87
87
|
if (value) endpoints[key] = options[key].url
|
|
88
88
|
})
|
|
89
89
|
mode = 'remote'
|
|
90
90
|
} else {
|
|
91
|
-
await new Node({ network })
|
|
92
|
-
await nodeConfig({ network })
|
|
91
|
+
await new Node({ network: options.network })
|
|
92
|
+
await nodeConfig({ network: options.network })
|
|
93
93
|
|
|
94
94
|
chain = await new Chain()
|
|
95
95
|
|
|
96
|
-
if (ws) {
|
|
96
|
+
if (endpoints.ws) {
|
|
97
97
|
await wsServer(chain, options.ws.port, options.networkVersion)
|
|
98
98
|
endpoints.ws = options.ws.url
|
|
99
99
|
}
|
|
100
|
-
if (http) {
|
|
100
|
+
if (endpoints.http) {
|
|
101
101
|
await httpServer(chain, options.http.port, options.networkVersion)
|
|
102
102
|
endpoints.http = options.http.url
|
|
103
103
|
}
|