@leofcoin/peernet 0.10.3 → 0.10.6
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/dist/browser/peernet.js +34852 -31557
- package/dist/commonjs/codec-6367213c.js +205 -0
- package/dist/commonjs/codec-format-interface.js +27 -11
- package/dist/commonjs/codec.js +1 -1
- package/dist/commonjs/dht-response.js +2 -2
- package/dist/commonjs/dht.js +2 -2
- package/dist/commonjs/hash.js +17 -17
- package/dist/commonjs/peernet-message.js +2 -2
- package/dist/commonjs/peernet.js +47 -162
- package/dist/commonjs/request.js +2 -2
- package/dist/commonjs/response.js +2 -2
- package/dist/module/peernet.js +48 -148
- package/package.json +7 -6
- package/rollup.config.js +7 -4
- package/src/codec/codec-format-interface.js +20 -4
- package/src/messages/data.js +7 -3
- package/src/peernet.js +21 -18
package/dist/commonjs/peernet.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var PubSub = require('@vandeurenglenn/little-pubsub');
|
|
4
4
|
var sha256 = require('crypto-js/sha256');
|
|
5
5
|
var P2P = require('p2pt');
|
|
6
|
+
var LeofcoinStorage$1 = require('@leofcoin/storage');
|
|
6
7
|
var websocket = require('websocket');
|
|
7
8
|
var http$1 = require('http');
|
|
8
9
|
var Koa = require('koa');
|
|
@@ -14,7 +15,7 @@ var codecFormatInterface = require('./codec-format-interface.js');
|
|
|
14
15
|
var request = require('./request.js');
|
|
15
16
|
var response = require('./response.js');
|
|
16
17
|
var fetch$1 = require('node-fetch');
|
|
17
|
-
var codec = require('./codec-
|
|
18
|
+
var codec = require('./codec-6367213c.js');
|
|
18
19
|
var hash = require('./hash.js');
|
|
19
20
|
var MultiWallet = require('@leofcoin/multi-wallet');
|
|
20
21
|
require('bs32');
|
|
@@ -28,6 +29,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
28
29
|
var PubSub__default = /*#__PURE__*/_interopDefaultLegacy(PubSub);
|
|
29
30
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
30
31
|
var P2P__default = /*#__PURE__*/_interopDefaultLegacy(P2P);
|
|
32
|
+
var LeofcoinStorage__default = /*#__PURE__*/_interopDefaultLegacy(LeofcoinStorage$1);
|
|
31
33
|
var Koa__default = /*#__PURE__*/_interopDefaultLegacy(Koa);
|
|
32
34
|
var protons__default = /*#__PURE__*/_interopDefaultLegacy(protons);
|
|
33
35
|
var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch$1);
|
|
@@ -108,7 +110,7 @@ class PeernetPeer {
|
|
|
108
110
|
*/
|
|
109
111
|
globalThis.connections = new Map();
|
|
110
112
|
globalThis.recentConnections = new Map();
|
|
111
|
-
globalThis.pubsub = globalThis.pubsub || new PubSub__default[
|
|
113
|
+
globalThis.pubsub = globalThis.pubsub || new PubSub__default["default"]({verbose: false});
|
|
112
114
|
|
|
113
115
|
class PeernetClient {
|
|
114
116
|
constructor(options = {}) {
|
|
@@ -117,14 +119,14 @@ class PeernetClient {
|
|
|
117
119
|
if (!options.networkName) options.networkName = 'peernet';
|
|
118
120
|
this.id = options.id;
|
|
119
121
|
|
|
120
|
-
this.topic = Buffer.from(sha256__default[
|
|
122
|
+
this.topic = Buffer.from(sha256__default["default"](`${options.networkName}-${options.networkVersion}`).toString());
|
|
121
123
|
|
|
122
124
|
const trackers = [
|
|
123
125
|
'wss://star.leofcoin.org',
|
|
124
126
|
'wss://tracker.openwebtorrent.com',
|
|
125
127
|
// 'wss://tracker.sloppyta.co:443/announce',
|
|
126
128
|
];
|
|
127
|
-
this.p2p = new P2P__default[
|
|
129
|
+
this.p2p = new P2P__default["default"](trackers, this.topic.slice(0, 20));
|
|
128
130
|
this.p2p.on('peerconnect', (peer) => {
|
|
129
131
|
peer = new PeernetPeer(peer.id, peer);
|
|
130
132
|
connections.set(peer.id, peer);
|
|
@@ -170,129 +172,7 @@ class PeernetClient {
|
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
|
|
174
|
-
const LevelStore = require('datastore-level');
|
|
175
|
-
const { homedir } = require('os');
|
|
176
|
-
const { join } = require('path');
|
|
177
|
-
const Key = require('interface-datastore').Key;
|
|
178
|
-
const {readdirSync, mkdirSync} = require('fs');
|
|
179
|
-
|
|
180
|
-
class LeofcoinStorage$1 {
|
|
181
|
-
|
|
182
|
-
constructor(path, root = '.leofcoin', home = true) {
|
|
183
|
-
if (!home) this.root = root;
|
|
184
|
-
else this.root = join(homedir(), root);
|
|
185
|
-
if (readdirSync) try {
|
|
186
|
-
readdirSync(this.root);
|
|
187
|
-
} catch (e) {
|
|
188
|
-
let _path = home ? homedir() : root;
|
|
189
|
-
const parts = root.split('/');
|
|
190
|
-
if (e.code === 'ENOENT') {
|
|
191
|
-
|
|
192
|
-
if (parts.length > 0) {
|
|
193
|
-
for (const path of parts) {
|
|
194
|
-
_path = join(_path, path);
|
|
195
|
-
try {
|
|
196
|
-
readdirSync(_path);
|
|
197
|
-
} catch (e) {
|
|
198
|
-
if (e.code === 'ENOENT') mkdirSync(_path);
|
|
199
|
-
else throw e
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
mkdirSync(this.root);
|
|
204
|
-
}
|
|
205
|
-
} else throw e
|
|
206
|
-
}
|
|
207
|
-
this.db = new LevelStore(join(this.root, path));
|
|
208
|
-
// this.db = level(path, { prefix: 'lfc-'})
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
toBuffer(value) {
|
|
212
|
-
if (Buffer.isBuffer(value)) return value;
|
|
213
|
-
if (typeof value === 'object' ||
|
|
214
|
-
typeof value === 'boolean' ||
|
|
215
|
-
!isNaN(value)) value = JSON.stringify(value);
|
|
216
|
-
|
|
217
|
-
return Buffer.from(value)
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
async many(type, _value) {
|
|
221
|
-
const jobs = [];
|
|
222
|
-
|
|
223
|
-
for (const key of Object.keys(_value)) {
|
|
224
|
-
const value = this.toBuffer(_value[key]);
|
|
225
|
-
|
|
226
|
-
jobs.push(this[type](key, value));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return Promise.all(jobs)
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
async put(key, value) {
|
|
233
|
-
if (typeof key === 'object') return this.many('put', key);
|
|
234
|
-
value = this.toBuffer(value);
|
|
235
|
-
|
|
236
|
-
return this.db.put(new Key(String(key)), value);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
async query() {
|
|
240
|
-
const object = {};
|
|
241
|
-
|
|
242
|
-
for await (let query of this.db.query({})) {
|
|
243
|
-
const key = query.key.baseNamespace();
|
|
244
|
-
object[key] = this.possibleJSON(query.value);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return object
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
async get(key) {
|
|
251
|
-
if (!key) return this.query()
|
|
252
|
-
if (typeof key === 'object') return this.many('get', key);
|
|
253
|
-
let data = await this.db.get(new Key(String(key)));
|
|
254
|
-
if (!data) return undefined
|
|
255
|
-
return this.possibleJSON(data)
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
async has(key) {
|
|
259
|
-
if (typeof key === 'object') return this.many('has', key);
|
|
260
|
-
|
|
261
|
-
try {
|
|
262
|
-
await this.db.get(new Key(String(key)));
|
|
263
|
-
return true;
|
|
264
|
-
} catch (e) {
|
|
265
|
-
return false
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
async delete(key) {
|
|
270
|
-
return this.db.delete(new Key(String(key)))
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
async size() {
|
|
274
|
-
const object = await this.query();
|
|
275
|
-
return Object.keys(object).length
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// TODO: deprecate usage possibleJSON
|
|
279
|
-
// make possibleJSON optional
|
|
280
|
-
// or release as its own package
|
|
281
|
-
possibleJSON(data) {
|
|
282
|
-
let string = data.toString();
|
|
283
|
-
if (string.charAt(0) === '{' && string.charAt(string.length - 1) === '}' ||
|
|
284
|
-
string.charAt(0) === '[' && string.charAt(string.length - 1) === ']' ||
|
|
285
|
-
string === 'true' ||
|
|
286
|
-
string === 'false' ||
|
|
287
|
-
!isNaN(string))
|
|
288
|
-
return JSON.parse(string);
|
|
289
|
-
|
|
290
|
-
return data
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
var version = "0.10.2";
|
|
175
|
+
var version = "0.10.5";
|
|
296
176
|
|
|
297
177
|
var api$1 = {
|
|
298
178
|
version: ({send}) => send({client: '@peernet/api/http', version}),
|
|
@@ -460,7 +340,7 @@ const socketRequestServer = (options, routes = {}) => {
|
|
|
460
340
|
// else if (!options && !routes) return console.error('no routes defined');
|
|
461
341
|
|
|
462
342
|
let {httpServer, httpsServer, port, protocol, credentials, origin, pubsub } = options;
|
|
463
|
-
if (!pubsub) pubsub = new PubSub__default[
|
|
343
|
+
if (!pubsub) pubsub = new PubSub__default["default"]({verbose: false});
|
|
464
344
|
if (!port) port = 6000;
|
|
465
345
|
const connections = [];
|
|
466
346
|
let connection;
|
|
@@ -585,7 +465,7 @@ var http = (config = {}) => {
|
|
|
585
465
|
if (!config.port) config.port = 2000;
|
|
586
466
|
if (!config.host) config.host = '127.0.0.1';
|
|
587
467
|
|
|
588
|
-
const app = new Koa__default[
|
|
468
|
+
const app = new Koa__default["default"]();
|
|
589
469
|
|
|
590
470
|
app.use(async (ctx) => {
|
|
591
471
|
const url = ctx.url.split('/api/')[1];
|
|
@@ -727,7 +607,7 @@ var clientApi = _pubsub => {
|
|
|
727
607
|
|
|
728
608
|
const socketRequestClient = (url, protocols = 'echo-protocol', options = { retry: false, pubsub: false }) => {
|
|
729
609
|
let { pubsub, retry } = options;
|
|
730
|
-
if (!pubsub) pubsub = new PubSub__default[
|
|
610
|
+
if (!pubsub) pubsub = new PubSub__default["default"]({verbose: false});
|
|
731
611
|
|
|
732
612
|
const api = clientApi(pubsub);
|
|
733
613
|
|
|
@@ -955,14 +835,18 @@ message PeernetDataMessage {
|
|
|
955
835
|
}
|
|
956
836
|
`;
|
|
957
837
|
|
|
838
|
+
/**
|
|
839
|
+
* @extends {CodecFormat}
|
|
840
|
+
*/
|
|
958
841
|
class DataMessage extends codecFormatInterface {
|
|
959
842
|
get keys() {
|
|
960
843
|
return ['hash', 'store']
|
|
961
844
|
}
|
|
962
|
-
|
|
845
|
+
/**
|
|
846
|
+
* @param {Buffer|String|Object|DataMessage} data - The data needed to create the DataMessage
|
|
847
|
+
*/
|
|
963
848
|
constructor(data) {
|
|
964
|
-
|
|
965
|
-
super(data, protons__default['default'](proto$5).PeernetDataMessage, {name});
|
|
849
|
+
super(data, protons__default["default"](proto$5).PeernetDataMessage, {name: 'peernet-data'});
|
|
966
850
|
}
|
|
967
851
|
}
|
|
968
852
|
|
|
@@ -980,7 +864,7 @@ class PsMessage extends codecFormatInterface {
|
|
|
980
864
|
|
|
981
865
|
constructor(buffer) {
|
|
982
866
|
const name = 'peernet-ps';
|
|
983
|
-
super(buffer, protons__default[
|
|
867
|
+
super(buffer, protons__default["default"](proto$4).PsMessage, {name});
|
|
984
868
|
}
|
|
985
869
|
}
|
|
986
870
|
|
|
@@ -998,7 +882,7 @@ class PeerMessage extends codecFormatInterface {
|
|
|
998
882
|
|
|
999
883
|
constructor(data) {
|
|
1000
884
|
const name = 'peernet-peer';
|
|
1001
|
-
super(data, protons__default[
|
|
885
|
+
super(data, protons__default["default"](proto$3).PeernetPeerMessage, {name});
|
|
1002
886
|
}
|
|
1003
887
|
}
|
|
1004
888
|
|
|
@@ -1016,7 +900,7 @@ class PeerMessageResponse extends codecFormatInterface {
|
|
|
1016
900
|
|
|
1017
901
|
constructor(data) {
|
|
1018
902
|
const name = 'peernet-peer-response';
|
|
1019
|
-
super(data, protons__default[
|
|
903
|
+
super(data, protons__default["default"](proto$2).PeernetPeerMessageResponse, {name});
|
|
1020
904
|
}
|
|
1021
905
|
}
|
|
1022
906
|
|
|
@@ -1035,7 +919,7 @@ class DataMessageResponse extends codecFormatInterface {
|
|
|
1035
919
|
|
|
1036
920
|
constructor(data) {
|
|
1037
921
|
const name = 'peernet-data-response';
|
|
1038
|
-
super(data, protons__default[
|
|
922
|
+
super(data, protons__default["default"](proto$1).PeernetDataMessageResponse, {name});
|
|
1039
923
|
}
|
|
1040
924
|
}
|
|
1041
925
|
|
|
@@ -1054,7 +938,7 @@ class ChatMessage extends codecFormatInterface {
|
|
|
1054
938
|
|
|
1055
939
|
constructor(buffer) {
|
|
1056
940
|
const name = 'chat-message';
|
|
1057
|
-
super(buffer, protons__default[
|
|
941
|
+
super(buffer, protons__default["default"](proto).ChatMessage, {name});
|
|
1058
942
|
}
|
|
1059
943
|
}
|
|
1060
944
|
|
|
@@ -1077,7 +961,7 @@ const protoFor = (data) => {
|
|
|
1077
961
|
*/
|
|
1078
962
|
const hasDaemon = async () => {
|
|
1079
963
|
try {
|
|
1080
|
-
let response = await fetch__default[
|
|
964
|
+
let response = await fetch__default["default"]('http://127.0.0.1:1000/api/version');
|
|
1081
965
|
response = await response.json();
|
|
1082
966
|
return Boolean(response.client === '@peernet/api/http')
|
|
1083
967
|
} catch (e) {
|
|
@@ -1213,7 +1097,7 @@ const getAddress = async () => {
|
|
|
1213
1097
|
const {address} = lastFetched;
|
|
1214
1098
|
const now = Math.round(new Date().getTime() / 1000);
|
|
1215
1099
|
if (now - address.timestamp > 1200000) {
|
|
1216
|
-
address.value = await fetch__default[
|
|
1100
|
+
address.value = await fetch__default["default"]('https://icanhazip.com/');
|
|
1217
1101
|
address.value = await address.value.text();
|
|
1218
1102
|
address.timestamp = Math.round(new Date().getTime() / 1000);
|
|
1219
1103
|
lastFetched.address = address;
|
|
@@ -1255,7 +1139,7 @@ class DhtEarth {
|
|
|
1255
1139
|
async getCoordinates(address) {
|
|
1256
1140
|
// const {address} = parseAddress(provider)
|
|
1257
1141
|
const request = `https://whereis.leofcoin.org/?ip=${address}`;
|
|
1258
|
-
let response = await fetch__default[
|
|
1142
|
+
let response = await fetch__default["default"](request);
|
|
1259
1143
|
response = await response.json();
|
|
1260
1144
|
const {lat, lon} = response;
|
|
1261
1145
|
return {latitude: lat, longitude: lon}
|
|
@@ -1318,7 +1202,7 @@ class DhtEarth {
|
|
|
1318
1202
|
* @return {object} { identity, accounts, config }
|
|
1319
1203
|
*/
|
|
1320
1204
|
var generateAccount = async network => {
|
|
1321
|
-
const wallet = new MultiWallet__default[
|
|
1205
|
+
const wallet = new MultiWallet__default["default"](network);
|
|
1322
1206
|
/**
|
|
1323
1207
|
* @type {string}
|
|
1324
1208
|
*/
|
|
@@ -1371,7 +1255,7 @@ class MessageHandler {
|
|
|
1371
1255
|
const hasher = new hash(message, {name: 'peernet-message'});
|
|
1372
1256
|
const identity = await walletStore.get('identity');
|
|
1373
1257
|
|
|
1374
|
-
const wallet = new MultiWallet__default[
|
|
1258
|
+
const wallet = new MultiWallet__default["default"](this.network);
|
|
1375
1259
|
wallet.import(identity.multiWIF);
|
|
1376
1260
|
return wallet.sign(hasher.hash.slice(0, 32))
|
|
1377
1261
|
}
|
|
@@ -1416,7 +1300,7 @@ const nothingFoundError = (hash) => {
|
|
|
1416
1300
|
};
|
|
1417
1301
|
|
|
1418
1302
|
globalThis.leofcoin = globalThis.leofcoin || {};
|
|
1419
|
-
globalThis.globalSub = globalThis.globalSub || new PubSub__default[
|
|
1303
|
+
globalThis.globalSub = globalThis.globalSub || new PubSub__default["default"]({verbose: true});
|
|
1420
1304
|
|
|
1421
1305
|
/**
|
|
1422
1306
|
* @access public
|
|
@@ -1478,7 +1362,7 @@ class Peernet {
|
|
|
1478
1362
|
if (this.hasDaemon) {
|
|
1479
1363
|
Storage = LeofcoinStorageClient;
|
|
1480
1364
|
} else {
|
|
1481
|
-
Storage =
|
|
1365
|
+
Storage = LeofcoinStorage__default["default"];
|
|
1482
1366
|
}
|
|
1483
1367
|
globalThis[`${name}Store`] = globalThis[`${name}Store`] ||
|
|
1484
1368
|
await new Storage(`${prefix}-${name}`, root);
|
|
@@ -1733,24 +1617,23 @@ class Peernet {
|
|
|
1733
1617
|
} else if (proto.name === 'peernet-data') {
|
|
1734
1618
|
let { hash, store } = proto.decoded;
|
|
1735
1619
|
let data;
|
|
1736
|
-
|
|
1737
1620
|
if (!store) {
|
|
1738
|
-
|
|
1621
|
+
store = await this.whichStore([...this.stores], hash);
|
|
1739
1622
|
} else {
|
|
1740
|
-
store = globalThis[`${store}Store`];
|
|
1741
|
-
if (store.private) {
|
|
1742
|
-
// TODO: ban
|
|
1743
|
-
return
|
|
1744
|
-
} else data = await store.get(hash);
|
|
1623
|
+
store = globalThis.stores[`${store}Store`];
|
|
1745
1624
|
}
|
|
1625
|
+
if (store && !store.private) {
|
|
1626
|
+
data = await store.get(hash);
|
|
1746
1627
|
|
|
1747
|
-
|
|
1748
|
-
|
|
1628
|
+
if (data) {
|
|
1629
|
+
data = new DataMessageResponse({hash, data: data.decoded ? Buffer.from(JSON.stringify(data)) : Buffer.from(data)});
|
|
1749
1630
|
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1631
|
+
const node = await this.prepareMessage(from, data.encoded);
|
|
1632
|
+
peer.write(Buffer.from(JSON.stringify({id, data: node.encoded})));
|
|
1633
|
+
this.bw.up += node.encoded.length;
|
|
1634
|
+
}
|
|
1753
1635
|
}
|
|
1636
|
+
|
|
1754
1637
|
} else if (proto.name === 'peernet-peer') {
|
|
1755
1638
|
const from = proto.decoded.id;
|
|
1756
1639
|
if (!this.peerMap.has(from)) this.peerMap.set(from, [peer.id]);
|
|
@@ -1853,7 +1736,7 @@ class Peernet {
|
|
|
1853
1736
|
get: async (hash) => {
|
|
1854
1737
|
const data = await blockStore.has(hash);
|
|
1855
1738
|
if (data) return await blockStore.get(hash)
|
|
1856
|
-
return this.requestData(hash)
|
|
1739
|
+
return this.requestData(hash, 'block')
|
|
1857
1740
|
},
|
|
1858
1741
|
put: async (hash, data) => {
|
|
1859
1742
|
if (await blockStore.has(hash)) return
|
|
@@ -1885,7 +1768,7 @@ class Peernet {
|
|
|
1885
1768
|
// get closest peer on earth
|
|
1886
1769
|
const closestPeer = await this.dht.closestPeer(providers);
|
|
1887
1770
|
// get peer instance by id
|
|
1888
|
-
if (!closestPeer || !closestPeer.id) return this.requestData(hash, store)
|
|
1771
|
+
if (!closestPeer || !closestPeer.id) return this.requestData(hash, store.name ? store.name : store)
|
|
1889
1772
|
|
|
1890
1773
|
const id = closestPeer.id.toString();
|
|
1891
1774
|
if (this.peers) {
|
|
@@ -1989,7 +1872,8 @@ class Peernet {
|
|
|
1989
1872
|
/**
|
|
1990
1873
|
* Get content for given hash
|
|
1991
1874
|
*
|
|
1992
|
-
* @param {String} hash
|
|
1875
|
+
* @param {String} hash - the hash of the wanted data
|
|
1876
|
+
* @param {String} store - storeName to access
|
|
1993
1877
|
*/
|
|
1994
1878
|
async get(hash, store) {
|
|
1995
1879
|
debug(`get ${hash}`);
|
|
@@ -1999,7 +1883,7 @@ class Peernet {
|
|
|
1999
1883
|
if (store && await store.has(hash)) data = await store.get(hash);
|
|
2000
1884
|
if (data) return data
|
|
2001
1885
|
|
|
2002
|
-
return this.requestData(hash,
|
|
1886
|
+
return this.requestData(hash, store.name ? store.name : store)
|
|
2003
1887
|
}
|
|
2004
1888
|
|
|
2005
1889
|
/**
|
|
@@ -2007,10 +1891,11 @@ class Peernet {
|
|
|
2007
1891
|
*
|
|
2008
1892
|
* @param {String} hash
|
|
2009
1893
|
* @param {Buffer} data
|
|
1894
|
+
* @param {String} store - storeName to access
|
|
2010
1895
|
*/
|
|
2011
1896
|
async put(hash, data, store = 'data') {
|
|
2012
1897
|
store = globalThis[`${store}Store`];
|
|
2013
|
-
return
|
|
1898
|
+
return store.put(hash, data)
|
|
2014
1899
|
}
|
|
2015
1900
|
|
|
2016
1901
|
/**
|
package/dist/commonjs/request.js
CHANGED
|
@@ -5,7 +5,7 @@ var codecFormatInterface = require('./codec-format-interface.js');
|
|
|
5
5
|
require('bs32');
|
|
6
6
|
require('bs58');
|
|
7
7
|
require('is-hex');
|
|
8
|
-
require('./codec-
|
|
8
|
+
require('./codec-6367213c.js');
|
|
9
9
|
require('varint');
|
|
10
10
|
require('./hash.js');
|
|
11
11
|
require('keccak');
|
|
@@ -28,7 +28,7 @@ class RequestMessage extends codecFormatInterface {
|
|
|
28
28
|
|
|
29
29
|
constructor(data) {
|
|
30
30
|
const name = 'peernet-request';
|
|
31
|
-
super(data, protons__default[
|
|
31
|
+
super(data, protons__default["default"](proto).PeernetRequestMessage, {name});
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -5,7 +5,7 @@ var codecFormatInterface = require('./codec-format-interface.js');
|
|
|
5
5
|
require('bs32');
|
|
6
6
|
require('bs58');
|
|
7
7
|
require('is-hex');
|
|
8
|
-
require('./codec-
|
|
8
|
+
require('./codec-6367213c.js');
|
|
9
9
|
require('varint');
|
|
10
10
|
require('./hash.js');
|
|
11
11
|
require('keccak');
|
|
@@ -28,7 +28,7 @@ class ResponseMessage extends codecFormatInterface {
|
|
|
28
28
|
|
|
29
29
|
constructor(data) {
|
|
30
30
|
const name = 'peernet-response';
|
|
31
|
-
super(data, protons__default[
|
|
31
|
+
super(data, protons__default["default"](proto).PeernetResponseMessage, {name});
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|