@upcoming/bee-js 0.3.0 → 0.4.0

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.
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BeeDev = void 0;
4
+ const cafe_utility_1 = require("cafe-utility");
5
+ const _1 = require(".");
6
+ const connectivity_1 = require("./modules/debug/connectivity");
7
+ const http_1 = require("./utils/http");
8
+ const type_1 = require("./utils/type");
9
+ class BeeDev extends _1.Bee {
10
+ async getNodeAddresses(options) {
11
+ (0, type_1.assertRequestOptions)(options);
12
+ const requestOptions = super.getRequestOptionsForCall(options);
13
+ const response = await (0, http_1.http)(requestOptions, {
14
+ url: 'addresses',
15
+ responseType: 'json',
16
+ });
17
+ const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
18
+ return {
19
+ overlay: new _1.PeerAddress(cafe_utility_1.Types.asString(body.overlay, { name: 'overlay' })),
20
+ underlay: [],
21
+ ethereum: new _1.EthAddress(cafe_utility_1.Types.asString(body.ethereum, { name: 'ethereum' })),
22
+ publicKey: new _1.PublicKey(cafe_utility_1.Types.asString(body.publicKey, { name: 'publicKey' })),
23
+ pssPublicKey: new _1.PublicKey(cafe_utility_1.Types.asString(body.pssPublicKey, { name: 'pssPublicKey' })),
24
+ };
25
+ }
26
+ async getTopology(options) {
27
+ (0, type_1.assertRequestOptions)(options);
28
+ const requestOptions = super.getRequestOptionsForCall(options);
29
+ const response = await (0, http_1.http)(requestOptions, {
30
+ url: `topology`,
31
+ responseType: 'json',
32
+ });
33
+ const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
34
+ const bins = cafe_utility_1.Types.asObject(body.bins, { name: 'bins' });
35
+ return {
36
+ baseAddr: '0bab5ca208a980950604f900f2791613fc980676c2dee7dd92a4fdda5a54bf26',
37
+ population: cafe_utility_1.Types.asNumber(body.population, { name: 'population' }),
38
+ connected: cafe_utility_1.Types.asNumber(body.connected, { name: 'connected' }),
39
+ timestamp: cafe_utility_1.Types.asString(body.timestamp, { name: 'timestamp' }),
40
+ nnLowWatermark: cafe_utility_1.Types.asNumber(body.nnLowWatermark, { name: 'nnLowWatermark' }),
41
+ depth: cafe_utility_1.Types.asNumber(body.depth, { name: 'depth' }),
42
+ reachability: 'Public',
43
+ networkAvailability: 'Available',
44
+ bins: {
45
+ bin_0: (0, connectivity_1.asBin)(bins.bin_0, 'bin_0'),
46
+ bin_1: (0, connectivity_1.asBin)(bins.bin_1, 'bin_1'),
47
+ bin_2: (0, connectivity_1.asBin)(bins.bin_2, 'bin_2'),
48
+ bin_3: (0, connectivity_1.asBin)(bins.bin_3, 'bin_3'),
49
+ bin_4: (0, connectivity_1.asBin)(bins.bin_4, 'bin_4'),
50
+ bin_5: (0, connectivity_1.asBin)(bins.bin_5, 'bin_5'),
51
+ bin_6: (0, connectivity_1.asBin)(bins.bin_6, 'bin_6'),
52
+ bin_7: (0, connectivity_1.asBin)(bins.bin_7, 'bin_7'),
53
+ bin_8: (0, connectivity_1.asBin)(bins.bin_8, 'bin_8'),
54
+ bin_9: (0, connectivity_1.asBin)(bins.bin_9, 'bin_9'),
55
+ bin_10: (0, connectivity_1.asBin)(bins.bin_10, 'bin_10'),
56
+ bin_11: (0, connectivity_1.asBin)(bins.bin_11, 'bin_11'),
57
+ bin_12: (0, connectivity_1.asBin)(bins.bin_12, 'bin_12'),
58
+ bin_13: (0, connectivity_1.asBin)(bins.bin_13, 'bin_13'),
59
+ bin_14: (0, connectivity_1.asBin)(bins.bin_14, 'bin_14'),
60
+ bin_15: (0, connectivity_1.asBin)(bins.bin_15, 'bin_15'),
61
+ bin_16: (0, connectivity_1.asBin)(bins.bin_16, 'bin_16'),
62
+ bin_17: (0, connectivity_1.asBin)(bins.bin_17, 'bin_17'),
63
+ bin_18: (0, connectivity_1.asBin)(bins.bin_18, 'bin_18'),
64
+ bin_19: (0, connectivity_1.asBin)(bins.bin_19, 'bin_19'),
65
+ bin_20: (0, connectivity_1.asBin)(bins.bin_20, 'bin_20'),
66
+ bin_21: (0, connectivity_1.asBin)(bins.bin_21, 'bin_21'),
67
+ bin_22: (0, connectivity_1.asBin)(bins.bin_22, 'bin_22'),
68
+ bin_23: (0, connectivity_1.asBin)(bins.bin_23, 'bin_23'),
69
+ bin_24: (0, connectivity_1.asBin)(bins.bin_24, 'bin_24'),
70
+ bin_25: (0, connectivity_1.asBin)(bins.bin_25, 'bin_25'),
71
+ bin_26: (0, connectivity_1.asBin)(bins.bin_26, 'bin_26'),
72
+ bin_27: (0, connectivity_1.asBin)(bins.bin_27, 'bin_27'),
73
+ bin_28: (0, connectivity_1.asBin)(bins.bin_28, 'bin_28'),
74
+ bin_29: (0, connectivity_1.asBin)(bins.bin_29, 'bin_29'),
75
+ bin_30: (0, connectivity_1.asBin)(bins.bin_30, 'bin_30'),
76
+ bin_31: (0, connectivity_1.asBin)(bins.bin_31, 'bin_31'),
77
+ },
78
+ };
79
+ }
80
+ }
81
+ exports.BeeDev = BeeDev;
package/dist/cjs/index.js CHANGED
@@ -26,9 +26,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Bee = exports.Utils = exports.Bytes = exports.SUPPORTED_BEE_VERSION_EXACT = exports.SUPPORTED_BEE_VERSION = exports.MantarayNode = exports.MerkleTree = void 0;
29
+ exports.BeeDev = exports.Bee = exports.Utils = exports.Bytes = exports.SUPPORTED_BEE_VERSION_EXACT = exports.SUPPORTED_BEE_VERSION = exports.MantarayNode = exports.MerkleTree = void 0;
30
30
  const bee_1 = require("./bee");
31
31
  Object.defineProperty(exports, "Bee", { enumerable: true, get: function () { return bee_1.Bee; } });
32
+ const bee_dev_1 = require("./bee-dev");
33
+ Object.defineProperty(exports, "BeeDev", { enumerable: true, get: function () { return bee_dev_1.BeeDev; } });
32
34
  var cafe_utility_1 = require("cafe-utility");
33
35
  Object.defineProperty(exports, "MerkleTree", { enumerable: true, get: function () { return cafe_utility_1.MerkleTree; } });
34
36
  var manifest_1 = require("./manifest/manifest");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pingPeer = exports.getTopology = exports.removePeer = exports.getBlocklist = exports.getPeers = exports.getNodeAddresses = void 0;
3
+ exports.asBin = exports.pingPeer = exports.getTopology = exports.removePeer = exports.getBlocklist = exports.getPeers = exports.getNodeAddresses = void 0;
4
4
  const cafe_utility_1 = require("cafe-utility");
5
5
  const http_1 = require("../../utils/http");
6
6
  const typed_bytes_1 = require("../../utils/typed-bytes");
@@ -129,3 +129,4 @@ function asBin(value, name) {
129
129
  })),
130
130
  };
131
131
  }
132
+ exports.asBin = asBin;