@leofcoin/messages 1.0.0 → 1.0.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/dist/messages.js CHANGED
@@ -1,13 +1,20 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var protons = require('protons');
6
- var codecFormatInterface = require('@leofcoin/codec-format-interface');
4
+ var bs32 = require('@vandeurenglenn/base32');
5
+ var bs58 = require('@vandeurenglenn/base58');
6
+ var isHex = require('@vandeurenglenn/is-hex');
7
+ var varint = require('varint');
8
+ var createKeccakHash = require('keccak');
7
9
 
8
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
11
 
10
12
  var protons__default = /*#__PURE__*/_interopDefaultLegacy(protons);
13
+ var bs32__default = /*#__PURE__*/_interopDefaultLegacy(bs32);
14
+ var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
15
+ var isHex__default = /*#__PURE__*/_interopDefaultLegacy(isHex);
16
+ var varint__default = /*#__PURE__*/_interopDefaultLegacy(varint);
17
+ var createKeccakHash__default = /*#__PURE__*/_interopDefaultLegacy(createKeccakHash);
11
18
 
12
19
  var proto$4 = `
13
20
  message ContractMessage {
@@ -17,7 +24,511 @@ message ContractMessage {
17
24
  }
18
25
  `;
19
26
 
20
- class ContractMessage extends codecFormatInterface.FormatInterface {
27
+ class BasicInterface {
28
+ #handleDecode() {
29
+ if (!this.decode) throw new Error('bad implementation: needs decode func')
30
+ this.decode();
31
+ }
32
+
33
+ #handleEncode() {
34
+ if (!this.encode) throw new Error('bad implementation: needs encode func')
35
+ this.encode();
36
+ }
37
+ isHex(string) {
38
+ return isHex__default['default'](string)
39
+ }
40
+ isBase32(string) {
41
+ return base32.isBase32(string)
42
+ }
43
+ isBase58(string) {
44
+ return base58.isBase32(string)
45
+ }
46
+ /**
47
+ * @param {String} encoded
48
+ */
49
+ fromBs32(encoded) {
50
+ this.encoded = bs32__default['default'].decode(encoded);
51
+ return this.#handleDecode()
52
+ }
53
+
54
+ /**
55
+ * @param {String} encoded
56
+ */
57
+ fromBs58(encoded) {
58
+ this.encoded = bs58__default['default'].decode(encoded);
59
+ return this.#handleDecode()
60
+ }
61
+
62
+ async toArray() {
63
+ const array = [];
64
+ for await (const value of this.encoded.values()) {
65
+ array.push(value);
66
+ }
67
+ return array
68
+ }
69
+
70
+ fromString(string) {
71
+ this.encoded = new Uint8Array(string.split(','));
72
+ return this.#handleDecode()
73
+ }
74
+
75
+ fromArray(array) {
76
+ this.encoded = new Uint8Array([...array]);
77
+ return this.#handleDecode()
78
+ }
79
+
80
+ /**
81
+ * @param {Buffer} encoded
82
+ */
83
+ fromEncoded(encoded) {
84
+ this.encoded = encoded;
85
+ return this.#handleDecode()
86
+ }
87
+
88
+ /**
89
+ * @param {String} encoded
90
+ */
91
+ fromHex(encoded) {
92
+ this.encoded = Buffer.from(encoded, 'hex');
93
+ return this.#handleDecode()
94
+ }
95
+
96
+ toString(encoding = 'utf8') {
97
+ if (!this.encoded) this.#handleEncode();
98
+ return this.encoded.toString(encoding)
99
+ }
100
+
101
+ /**
102
+ * @return {String} encoded
103
+ */
104
+ toHex() {
105
+ return this.toString('hex')
106
+ }
107
+
108
+ /**
109
+ * @return {String} encoded
110
+ */
111
+ toBs32() {
112
+ if (!this.encoded) this.#handleEncode();
113
+ return bs32__default['default'].encode(this.encoded)
114
+ }
115
+
116
+ /**
117
+ * @return {String} encoded
118
+ */
119
+ toBs58() {
120
+ if (!this.encoded) this.#handleEncode();
121
+ return bs58__default['default'].encode(this.encoded)
122
+ }
123
+
124
+ /**
125
+ * @param {Object} data
126
+ */
127
+ create(data) {
128
+ const decoded = {};
129
+ if (this.keys?.length > 0) {
130
+ for (const key of this.keys) {
131
+ Object.defineProperties(decoded, {
132
+ [key]: {
133
+ enumerable: true,
134
+ configurable: true,
135
+ set: (val) => value = data[key],
136
+ get: () => data[key]
137
+ }
138
+ });
139
+ }
140
+
141
+ this.decoded = decoded;
142
+ this.encode();
143
+ }
144
+ }
145
+ }
146
+
147
+ var codecs = {
148
+ // just a hash
149
+ 'disco-hash': {
150
+ codec: parseInt('30', 16),
151
+ hashAlg: 'dbl-keccak-256', // ,
152
+ // testnet: 'olivia'
153
+ },
154
+ 'peernet-peer-response': {
155
+ codec: parseInt('707072', 16),
156
+ hashAlg: 'keccak-256',
157
+ },
158
+ 'peernet-peer': {
159
+ codec: parseInt('7070', 16),
160
+ hashAlg: 'keccak-256',
161
+ },
162
+ 'peernet-dht': {
163
+ codec: parseInt('706468', 16),
164
+ hashAlg: 'keccak-256',
165
+ },
166
+ 'peernet-dht-response': {
167
+ codec: parseInt('706472', 16),
168
+ hashAlg: 'keccak-256',
169
+ },
170
+ // data
171
+ 'peernet-data': {
172
+ codec: parseInt('706461', 16),
173
+ hashAlg: 'keccak-256',
174
+ },
175
+ 'peernet-data-response': {
176
+ codec: parseInt('70646172', 16),
177
+ hashAlg: 'keccak-256',
178
+ },
179
+ // message
180
+ 'peernet-message': {
181
+ codec: parseInt('706d65', 16),
182
+ hashAlg: 'keccak-256',
183
+ },
184
+ // pubsub
185
+ 'peernet-ps': {
186
+ codec: parseInt('707073', 16),
187
+ hashAlg: 'keccak-256',
188
+ },
189
+ 'peernet-response': {
190
+ codec: parseInt('7072', 16),
191
+ hashAlg: 'keccak-256',
192
+ },
193
+ 'peernet-request': {
194
+ codec: parseInt('707271', 16),
195
+ hashAlg: 'keccak-256',
196
+ },
197
+ // normal block
198
+ 'leofcoin-block': {
199
+ codec: parseInt('6c62', 16),
200
+ hashAlg: 'dbl-keccak-512', // ,
201
+ // testnet: 'olivia'
202
+ },
203
+ 'leofcoin-tx': {
204
+ codec: parseInt('6c74', 16),
205
+ hashAlg: 'dbl-keccak-512', // ,
206
+ // testnet: 'olivia'
207
+ },
208
+ // itx
209
+ 'leofcoin-itx': {
210
+ codec: parseInt('6c69', 16),
211
+ hashAlg: 'keccak-512', // ,
212
+ // testnet: 'olivia'
213
+ },
214
+ // peer reputation
215
+ 'leofcoin-pr': {
216
+ codec: parseInt('6c70', 16),
217
+ hashAlg: 'keccak-256', // ,
218
+ // testnet: 'olivia'
219
+ },
220
+ // chat message
221
+ 'chat-message': {
222
+ codec: parseInt('636d', 16),
223
+ hashAlg: 'dbl-keccak-256',
224
+ },
225
+ };
226
+
227
+ class PeernetCodec extends BasicInterface {
228
+ get codecs() {
229
+ return {...globalThis.peernet.codecs, ...codecs}
230
+ }
231
+ constructor(buffer) {
232
+ super();
233
+ if (buffer) {
234
+ if (buffer instanceof Uint8Array) {
235
+ const codec = varint__default['default'].decode(buffer);
236
+ const name = this.getCodecName(codec);
237
+ if (name) {
238
+ this.name = name;
239
+ this.encoded = buffer;
240
+ this.decode(buffer);
241
+ } else {
242
+ this.encode(buffer);
243
+ }
244
+ } else if (buffer instanceof ArrayBuffer) {
245
+ const encoded = new Uint8Array(buffer.byteLength);
246
+
247
+ for (let i = 0; i < buffer.byteLength; i++) {
248
+ encoded[i] = buffer[i];
249
+ }
250
+ this.encoded = encoded;
251
+ // this.encoded = new Uint8Array(buffer, buffer.byteOffset, buffer.byteLength)
252
+ this.decode(buffer);
253
+ return
254
+ }
255
+ if (typeof buffer === 'string') {
256
+ if (this.codecs[buffer]) this.fromName(buffer);
257
+ else if (this.isHex(buffer)) this.fromHex(buffer);
258
+ else if (this.isBase32(buffer)) this.fromBs32(buffer);
259
+ else if (this.isBase58(buffer)) this.fromBs58(buffer);
260
+ else throw new Error(`unsupported string ${buffer}`)
261
+ }
262
+ if (!isNaN(buffer)) if (this.codecs[this.getCodecName(buffer)]) this.fromCodec(buffer);
263
+ }
264
+ }
265
+
266
+ fromEncoded(encoded) {
267
+ const codec = varint__default['default'].decode(encoded);
268
+ const name = this.getCodecName(codec);
269
+ this.name = name;
270
+ this.encoded = encoded;
271
+ this.decode(encoded);
272
+ }
273
+
274
+ getCodec(name) {
275
+ return this.codecs[name].codec
276
+ }
277
+
278
+ getCodecName(codec) {
279
+ return Object.keys(this.codecs).reduce((p, c) => {
280
+ const item = this.codecs[c];
281
+ if (item.codec === codec) return c;
282
+ else return p;
283
+ }, undefined)
284
+ }
285
+
286
+ getHashAlg(name) {
287
+ return this.codecs[name].hashAlg
288
+ }
289
+
290
+ fromCodec(codec) {
291
+ this.name = this.getCodecName(codec);
292
+ this.hashAlg = this.getHashAlg(this.name);
293
+
294
+ this.codec = this.getCodec(this.name);
295
+ this.codecBuffer = varint__default['default'].encode(codec);
296
+ }
297
+
298
+ fromName(name) {
299
+ const codec = this.getCodec(name);
300
+ this.name = name;
301
+ this.codec = codec;
302
+ this.hashAlg = this.getHashAlg(name);
303
+ this.codecBuffer = varint__default['default'].encode(codec);
304
+ }
305
+
306
+ decode() {
307
+ const codec = varint__default['default'].decode(this.encoded);
308
+ this.fromCodec(codec);
309
+ }
310
+
311
+ encode() {
312
+ const codec = varint__default['default'].encode(this.decoded);
313
+ this.encoded = codec;
314
+ return this.encoded
315
+ }
316
+ }
317
+
318
+ class CodecHash extends BasicInterface {
319
+ constructor(buffer, options = {}) {
320
+ super();
321
+ if (options.name) this.name = options.name;
322
+ else this.name = 'disco-hash';
323
+ if (options.codecs) this.codecs = options.codecs;
324
+ if (buffer) {
325
+ if (buffer instanceof Uint8Array) {
326
+ this.discoCodec = new PeernetCodec(buffer, this.codecs);
327
+ const name = this.discoCodec.name;
328
+
329
+ if (name) {
330
+ this.name = name;
331
+ this.decode(buffer);
332
+ } else {
333
+ this.encode(buffer);
334
+ }
335
+ }
336
+
337
+ if (typeof buffer === 'string') {
338
+ if (this.isHex(buffer)) this.fromHex(buffer);
339
+ if (this.isBase32(buffer)) this.fromBs32(buffer);
340
+ else if (this.isBase58(buffer)) this.fromBs58(buffer);
341
+ else throw new Error(`unsupported string ${buffer}`)
342
+ } else if (typeof buffer === 'object') this.fromJSON(buffer);
343
+ }
344
+ }
345
+
346
+ get prefix() {
347
+ const length = this.length;
348
+ const uint8Array = new Uint8Array(length.length + this.discoCodec.codecBuffer.length);
349
+ uint8Array.set(length);
350
+ uint8Array.set(this.discoCodec.codecBuffer, length.length);
351
+
352
+ return uint8Array
353
+ }
354
+
355
+ get length() {
356
+ return varint__default['default'].encode(this.size)
357
+ }
358
+
359
+ get buffer() {
360
+ return this.encoded
361
+ }
362
+
363
+ get hash() {
364
+ return this.encoded
365
+ }
366
+
367
+ fromJSON(json) {
368
+ return this.encode(Buffer.from(JSON.stringify(json)))
369
+ }
370
+
371
+ encode(buffer, name) {
372
+ if (!this.name && name) this.name = name;
373
+ if (!buffer) buffer = this.buffer;
374
+ this.discoCodec = new PeernetCodec(this.name, this.codecs);
375
+ this.discoCodec.fromName(this.name);
376
+ let hashAlg = this.discoCodec.hashAlg;
377
+ if (hashAlg.includes('dbl')) {
378
+ hashAlg = hashAlg.replace('dbl-', '');
379
+ buffer = createKeccakHash__default['default'](hashAlg.replace('-', '')).update(buffer).digest();
380
+ }
381
+ this.digest = createKeccakHash__default['default'](hashAlg.replace('-', '')).update(buffer).digest();
382
+ this.size = this.digest.length;
383
+
384
+ this.codec = this.discoCodec.encode();
385
+ this.codec = this.discoCodec.codecBuffer;
386
+ const uint8Array = new Uint8Array(this.digest.length + this.prefix.length);
387
+ uint8Array.set(this.prefix);
388
+ uint8Array.set(this.digest, this.prefix.length);
389
+
390
+ this.encoded = uint8Array;
391
+
392
+ return this.encoded
393
+ }
394
+
395
+ validate(buffer) {
396
+ if (Buffer.isBuffer(buffer)) {
397
+ const codec = varint__default['default'].decode(buffer);
398
+ if (this.codecs[codec]) {
399
+ this.decode(buffer);
400
+ } else {
401
+ this.encode(buffer);
402
+ }
403
+ }
404
+ if (typeof buffer === 'string') {
405
+ if (this.isHex(buffer)) this.fromHex(buffer);
406
+ if (this.isBase32(buffer)) this.fromBs32(buffer);
407
+ }
408
+ if (typeof buffer === 'object') this.fromJSON(buffer);
409
+ }
410
+
411
+ decode(buffer) {
412
+ this.encoded = buffer;
413
+ const codec = varint__default['default'].decode(buffer);
414
+
415
+ this.discoCodec = new PeernetCodec(codec, this.codecs);
416
+ // TODO: validate codec
417
+ buffer = buffer.slice(varint__default['default'].decode.bytes);
418
+ this.size = varint__default['default'].decode(buffer);
419
+ this.digest = buffer.slice(varint__default['default'].decode.bytes);
420
+ if (this.digest.length !== this.size) {
421
+ throw new Error(`hash length inconsistent: 0x${this.encoded.toString('hex')}`)
422
+ }
423
+
424
+ // const discoCodec = new Codec(codec, this.codecs)
425
+
426
+ this.name = this.discoCodec.name;
427
+
428
+
429
+ this.size = this.digest.length;
430
+
431
+ return {
432
+ codec: this.codec,
433
+ name: this.name,
434
+ size: this.size,
435
+ length: this.length,
436
+ digest: this.digest,
437
+ }
438
+ }
439
+ }
440
+
441
+ class FormatInterface extends BasicInterface {
442
+ /**
443
+ * @param {Buffer|String|Object} buffer - data - The data needed to create the desired message
444
+ * @param {Object} proto - {encode, decode}
445
+ * @param {Object} options - {hashFormat, name}
446
+ */
447
+ constructor(buffer, proto, options = {}) {
448
+ super();
449
+ this.protoEncode = proto.encode;
450
+ this.protoDecode = proto.decode;
451
+ this.hashFormat = options.hashFormat || 'bs32';
452
+ if (options.name) this.name = options.name;
453
+ if (buffer instanceof Uint8Array) this.fromUint8Array(buffer);
454
+ else if (buffer instanceof ArrayBuffer) this.fromArrayBuffer(buffer);
455
+ else if (buffer.name === options.name) return buffer
456
+ else if (buffer instanceof String) {
457
+ if (this.isHex(buffer)) this.fromHex(buffer);
458
+ else if (this.isBase32(buffer)) this.fromBs32(buffer);
459
+ else if (this.isBase58(buffer)) this.fromBs58(buffer);
460
+ else throw new Error(`unsupported string ${buffer}`)
461
+ } else {
462
+ this.create(buffer);
463
+ }
464
+ }
465
+
466
+ /**
467
+ * @return {PeernetHash}
468
+ */
469
+ get peernetHash() {
470
+ return new CodecHash(this.decoded, {name: this.name})
471
+ }
472
+
473
+ /**
474
+ * @return {peernetHash}
475
+ */
476
+ get hash() {
477
+ const upper = this.hashFormat.charAt(0).toUpperCase();
478
+ const format = `${upper}${this.hashFormat.substring(1, this.hashFormat.length)}`;
479
+ return this.peernetHash[`to${format}`]()
480
+ }
481
+
482
+ /**
483
+ * @return {Object}
484
+ */
485
+ decode() {
486
+ let encoded = this.encoded;
487
+ const discoCodec = new PeernetCodec(this.encoded);
488
+ encoded = encoded.slice(discoCodec.codecBuffer.length);
489
+ this.name = discoCodec.name;
490
+ this.decoded = this.protoDecode(encoded);
491
+ return this.decoded
492
+ }
493
+
494
+ /**
495
+ * @return {Buffer}
496
+ */
497
+ encode(decoded) {
498
+ if (!decoded) decoded = this.decoded;
499
+ const codec = new PeernetCodec(this.name);
500
+ const encoded = this.protoEncode(decoded);
501
+ const uint8Array = new Uint8Array(encoded.length + codec.codecBuffer.length);
502
+ uint8Array.set(codec.codecBuffer);
503
+ uint8Array.set(encoded, codec.codecBuffer.length);
504
+ this.encoded = uint8Array;
505
+ return this.encoded
506
+ }
507
+
508
+ hasCodec() {
509
+ if (!this.encoded) return false
510
+ const codec = new PeernetCodec(this.encoded);
511
+ if (codec.name) return true
512
+ }
513
+
514
+ fromUint8Array(buffer) {
515
+ this.encoded = buffer;
516
+ if (!this.hasCodec()) this.create(
517
+ JSON.parse(new TextDecoder().decode(this.encoded))
518
+ );
519
+ else this.decode();
520
+ }
521
+
522
+ fromArrayBuffer(buffer) {
523
+ this.encoded = new Uint8Array(buffer, buffer.byteOffset, buffer.byteLength);
524
+ if (!this.hasCodec()) this.create(
525
+ JSON.parse(new TextDecoder().decode(this.encoded))
526
+ );
527
+ else this.decode();
528
+ }
529
+ }
530
+
531
+ class ContractMessage extends FormatInterface {
21
532
  get keys() {
22
533
  return ['creator', 'contract', 'constructorParameters']
23
534
  }
@@ -27,11 +538,6 @@ class ContractMessage extends codecFormatInterface.FormatInterface {
27
538
  }
28
539
  }
29
540
 
30
- var contract = /*#__PURE__*/Object.freeze({
31
- __proto__: null,
32
- 'default': ContractMessage
33
- });
34
-
35
541
  var proto$3 = `
36
542
 
37
543
  message TransactionMessage {
@@ -44,7 +550,7 @@ message TransactionMessage {
44
550
  }
45
551
  `;
46
552
 
47
- class TransactionMessage extends codecFormatInterface.FormatInterface {
553
+ class TransactionMessage extends FormatInterface {
48
554
  get keys() {
49
555
  return ['timestamp', 'from', 'to', 'nonce', 'method', 'params']
50
556
  }
@@ -55,11 +561,6 @@ class TransactionMessage extends codecFormatInterface.FormatInterface {
55
561
  }
56
562
  }
57
563
 
58
- var transaction = /*#__PURE__*/Object.freeze({
59
- __proto__: null,
60
- 'default': TransactionMessage
61
- });
62
-
63
564
  var proto$2 = `
64
565
  message ValidatorMessage {
65
566
  required string address = 1;
@@ -87,7 +588,7 @@ message BlockMessage {
87
588
  }
88
589
  `;
89
590
 
90
- class BlockMessage extends codecFormatInterface.FormatInterface {
591
+ class BlockMessage extends FormatInterface {
91
592
  get keys() {
92
593
  return ['index', 'previousHash', 'timestamp', 'reward', 'fees', 'transactions', 'validators']
93
594
  }
@@ -98,11 +599,6 @@ class BlockMessage extends codecFormatInterface.FormatInterface {
98
599
  }
99
600
  }
100
601
 
101
- var block = /*#__PURE__*/Object.freeze({
102
- __proto__: null,
103
- 'default': BlockMessage
104
- });
105
-
106
602
  var proto$1 = `
107
603
 
108
604
  message BWMessage {
@@ -111,7 +607,7 @@ message BWMessage {
111
607
  }
112
608
  `;
113
609
 
114
- class BWMessage extends codecFormatInterface.FormatInterface {
610
+ class BWMessage extends FormatInterface {
115
611
  get keys() {
116
612
  return ['up', 'down']
117
613
  }
@@ -122,18 +618,13 @@ class BWMessage extends codecFormatInterface.FormatInterface {
122
618
  }
123
619
  }
124
620
 
125
- var bw = /*#__PURE__*/Object.freeze({
126
- __proto__: null,
127
- 'default': BWMessage
128
- });
129
-
130
621
  var proto = `
131
622
 
132
623
  message BWRequestMessage {
133
624
  }
134
625
  `;
135
626
 
136
- class BWRequestMessage extends codecFormatInterface.FormatInterface {
627
+ class BWRequestMessage extends FormatInterface {
137
628
  get keys() {
138
629
  return []
139
630
  }
@@ -144,13 +635,12 @@ class BWRequestMessage extends codecFormatInterface.FormatInterface {
144
635
  }
145
636
  }
146
637
 
147
- var bwRequest = /*#__PURE__*/Object.freeze({
148
- __proto__: null,
149
- 'default': BWRequestMessage
150
- });
638
+ var messages = {
639
+ ContractMessage,
640
+ TransactionMessage,
641
+ BlockMessage,
642
+ BWMessage,
643
+ BWRequestMessage
644
+ };
151
645
 
152
- exports.BWMessage = bw;
153
- exports.BWRequestMessage = bwRequest;
154
- exports.BlockMessage = block;
155
- exports.ContractMessage = contract;
156
- exports.TransactionMessage = transaction;
646
+ module.exports = messages;
package/package.json CHANGED
@@ -1,17 +1,22 @@
1
1
  {
2
2
  "name": "@leofcoin/messages",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "dist/messages.js",
6
- "module": "src/messages/js",
6
+ "module": "dist/messages.esm",
7
7
  "scripts": {
8
- "build": "rollup -c",
8
+ "build": "rollup -c && webpack",
9
9
  "test": "echo \"Error: no test specified\" && exit 1"
10
10
  },
11
11
  "keywords": [],
12
12
  "author": "",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@leofcoin/codec-format-interface": "^1.0.1"
15
+ "@leofcoin/codec-format-interface": "^1.0.1",
16
+ "protons": "^2.0.1"
17
+ },
18
+ "devDependencies": {
19
+ "webpack": "^5.73.0",
20
+ "webpack-cli": "^4.9.2"
16
21
  }
17
22
  }
@@ -1,8 +1,8 @@
1
1
  import protons from 'protons'
2
2
  import proto from './../protos/block.proto.js'
3
- import { FormatInterface as CodecFormat } from '@leofcoin/codec-format-interface'
3
+ import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
4
4
 
5
- export default class BlockMessage extends CodecFormat {
5
+ export default class BlockMessage extends FormatInterface {
6
6
  get keys() {
7
7
  return ['index', 'previousHash', 'timestamp', 'reward', 'fees', 'transactions', 'validators']
8
8
  }
@@ -1,8 +1,8 @@
1
1
  import protons from 'protons'
2
2
  import proto from './../protos/bw-request.proto.js'
3
- import {FormatInterface as CodecFormat} from '@leofcoin/codec-format-interface'
3
+ import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
4
4
 
5
- export default class BWRequestMessage extends CodecFormat {
5
+ export default class BWRequestMessage extends FormatInterface {
6
6
  get keys() {
7
7
  return []
8
8
  }
@@ -1,8 +1,8 @@
1
1
  import protons from 'protons'
2
2
  import proto from './../protos/bw.proto.js'
3
- import { FormatInterface as CodecFormat } from '@leofcoin/codec-format-interface'
3
+ import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
4
4
 
5
- export default class BWMessage extends CodecFormat {
5
+ export default class BWMessage extends FormatInterface {
6
6
  get keys() {
7
7
  return ['up', 'down']
8
8
  }
@@ -1,8 +1,8 @@
1
1
  import protons from 'protons'
2
2
  import proto from './../protos/contract.proto.js'
3
- import { FormatInterface as CodecFormat } from '@leofcoin/codec-format-interface'
3
+ import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
4
4
 
5
- export default class ContractMessage extends CodecFormat {
5
+ export default class ContractMessage extends FormatInterface {
6
6
  get keys() {
7
7
  return ['creator', 'contract', 'constructorParameters']
8
8
  }