@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.
- package/dist/cjs/bee-dev.js +81 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/modules/debug/connectivity.js +2 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee-dev.js +101 -0
- package/dist/mjs/index.js +2 -1
- package/dist/mjs/modules/debug/connectivity.js +1 -1
- package/dist/types/bee-dev.d.ts +5 -0
- package/dist/types/bee.d.ts +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/modules/debug/connectivity.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Types } from 'cafe-utility';
|
|
2
|
+
import { Bee, EthAddress, PeerAddress, PublicKey } from "./index.js";
|
|
3
|
+
import { asBin } from "./modules/debug/connectivity.js";
|
|
4
|
+
import { http } from "./utils/http.js";
|
|
5
|
+
import { assertRequestOptions } from "./utils/type.js";
|
|
6
|
+
export class BeeDev extends Bee {
|
|
7
|
+
async getNodeAddresses(options) {
|
|
8
|
+
assertRequestOptions(options);
|
|
9
|
+
const requestOptions = super.getRequestOptionsForCall(options);
|
|
10
|
+
const response = await http(requestOptions, {
|
|
11
|
+
url: 'addresses',
|
|
12
|
+
responseType: 'json'
|
|
13
|
+
});
|
|
14
|
+
const body = Types.asObject(response.data, {
|
|
15
|
+
name: 'response.data'
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
overlay: new PeerAddress(Types.asString(body.overlay, {
|
|
19
|
+
name: 'overlay'
|
|
20
|
+
})),
|
|
21
|
+
underlay: [],
|
|
22
|
+
ethereum: new EthAddress(Types.asString(body.ethereum, {
|
|
23
|
+
name: 'ethereum'
|
|
24
|
+
})),
|
|
25
|
+
publicKey: new PublicKey(Types.asString(body.publicKey, {
|
|
26
|
+
name: 'publicKey'
|
|
27
|
+
})),
|
|
28
|
+
pssPublicKey: new PublicKey(Types.asString(body.pssPublicKey, {
|
|
29
|
+
name: 'pssPublicKey'
|
|
30
|
+
}))
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async getTopology(options) {
|
|
34
|
+
assertRequestOptions(options);
|
|
35
|
+
const requestOptions = super.getRequestOptionsForCall(options);
|
|
36
|
+
const response = await http(requestOptions, {
|
|
37
|
+
url: `topology`,
|
|
38
|
+
responseType: 'json'
|
|
39
|
+
});
|
|
40
|
+
const body = Types.asObject(response.data, {
|
|
41
|
+
name: 'response.data'
|
|
42
|
+
});
|
|
43
|
+
const bins = Types.asObject(body.bins, {
|
|
44
|
+
name: 'bins'
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
baseAddr: '0bab5ca208a980950604f900f2791613fc980676c2dee7dd92a4fdda5a54bf26',
|
|
48
|
+
population: Types.asNumber(body.population, {
|
|
49
|
+
name: 'population'
|
|
50
|
+
}),
|
|
51
|
+
connected: Types.asNumber(body.connected, {
|
|
52
|
+
name: 'connected'
|
|
53
|
+
}),
|
|
54
|
+
timestamp: Types.asString(body.timestamp, {
|
|
55
|
+
name: 'timestamp'
|
|
56
|
+
}),
|
|
57
|
+
nnLowWatermark: Types.asNumber(body.nnLowWatermark, {
|
|
58
|
+
name: 'nnLowWatermark'
|
|
59
|
+
}),
|
|
60
|
+
depth: Types.asNumber(body.depth, {
|
|
61
|
+
name: 'depth'
|
|
62
|
+
}),
|
|
63
|
+
reachability: 'Public',
|
|
64
|
+
networkAvailability: 'Available',
|
|
65
|
+
bins: {
|
|
66
|
+
bin_0: asBin(bins.bin_0, 'bin_0'),
|
|
67
|
+
bin_1: asBin(bins.bin_1, 'bin_1'),
|
|
68
|
+
bin_2: asBin(bins.bin_2, 'bin_2'),
|
|
69
|
+
bin_3: asBin(bins.bin_3, 'bin_3'),
|
|
70
|
+
bin_4: asBin(bins.bin_4, 'bin_4'),
|
|
71
|
+
bin_5: asBin(bins.bin_5, 'bin_5'),
|
|
72
|
+
bin_6: asBin(bins.bin_6, 'bin_6'),
|
|
73
|
+
bin_7: asBin(bins.bin_7, 'bin_7'),
|
|
74
|
+
bin_8: asBin(bins.bin_8, 'bin_8'),
|
|
75
|
+
bin_9: asBin(bins.bin_9, 'bin_9'),
|
|
76
|
+
bin_10: asBin(bins.bin_10, 'bin_10'),
|
|
77
|
+
bin_11: asBin(bins.bin_11, 'bin_11'),
|
|
78
|
+
bin_12: asBin(bins.bin_12, 'bin_12'),
|
|
79
|
+
bin_13: asBin(bins.bin_13, 'bin_13'),
|
|
80
|
+
bin_14: asBin(bins.bin_14, 'bin_14'),
|
|
81
|
+
bin_15: asBin(bins.bin_15, 'bin_15'),
|
|
82
|
+
bin_16: asBin(bins.bin_16, 'bin_16'),
|
|
83
|
+
bin_17: asBin(bins.bin_17, 'bin_17'),
|
|
84
|
+
bin_18: asBin(bins.bin_18, 'bin_18'),
|
|
85
|
+
bin_19: asBin(bins.bin_19, 'bin_19'),
|
|
86
|
+
bin_20: asBin(bins.bin_20, 'bin_20'),
|
|
87
|
+
bin_21: asBin(bins.bin_21, 'bin_21'),
|
|
88
|
+
bin_22: asBin(bins.bin_22, 'bin_22'),
|
|
89
|
+
bin_23: asBin(bins.bin_23, 'bin_23'),
|
|
90
|
+
bin_24: asBin(bins.bin_24, 'bin_24'),
|
|
91
|
+
bin_25: asBin(bins.bin_25, 'bin_25'),
|
|
92
|
+
bin_26: asBin(bins.bin_26, 'bin_26'),
|
|
93
|
+
bin_27: asBin(bins.bin_27, 'bin_27'),
|
|
94
|
+
bin_28: asBin(bins.bin_28, 'bin_28'),
|
|
95
|
+
bin_29: asBin(bins.bin_29, 'bin_29'),
|
|
96
|
+
bin_30: asBin(bins.bin_30, 'bin_30'),
|
|
97
|
+
bin_31: asBin(bins.bin_31, 'bin_31')
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
package/dist/mjs/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Bee } from "./bee.js";
|
|
2
|
+
import { BeeDev } from "./bee-dev.js";
|
|
2
3
|
export { MerkleTree } from 'cafe-utility';
|
|
3
4
|
export { MantarayNode } from "./manifest/manifest.js";
|
|
4
5
|
export { SUPPORTED_BEE_VERSION, SUPPORTED_BEE_VERSION_EXACT } from "./modules/debug/status.js";
|
|
@@ -9,4 +10,4 @@ export * from "./utils/error.js";
|
|
|
9
10
|
export * as Utils from "./utils/expose.js";
|
|
10
11
|
export * from "./utils/tokens.js";
|
|
11
12
|
export * from "./utils/typed-bytes.js";
|
|
12
|
-
export { Bee };
|
|
13
|
+
export { Bee, BeeDev };
|
package/dist/types/bee.d.ts
CHANGED
|
@@ -752,5 +752,5 @@ export declare class Bee {
|
|
|
752
752
|
*/
|
|
753
753
|
getRedistributionState(options?: BeeRequestOptions): Promise<RedistributionState>;
|
|
754
754
|
private waitForUsablePostageStamp;
|
|
755
|
-
|
|
755
|
+
protected getRequestOptionsForCall(options?: BeeRequestOptions): BeeRequestOptions;
|
|
756
756
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Bee } from './bee';
|
|
2
|
+
import { BeeDev } from './bee-dev';
|
|
2
3
|
export { MerkleTree } from 'cafe-utility';
|
|
3
4
|
export { MantarayNode } from './manifest/manifest';
|
|
4
5
|
export { SUPPORTED_BEE_VERSION, SUPPORTED_BEE_VERSION_EXACT } from './modules/debug/status';
|
|
@@ -9,11 +10,12 @@ export * from './utils/error';
|
|
|
9
10
|
export * as Utils from './utils/expose';
|
|
10
11
|
export * from './utils/tokens';
|
|
11
12
|
export * from './utils/typed-bytes';
|
|
12
|
-
export { Bee };
|
|
13
|
+
export { Bee, BeeDev };
|
|
13
14
|
declare global {
|
|
14
15
|
interface Window {
|
|
15
16
|
BeeJs: {
|
|
16
17
|
Bee: typeof import('./bee').Bee;
|
|
18
|
+
BeeDev: typeof import('./bee-dev').BeeDev;
|
|
17
19
|
Utils: typeof import('./utils/expose');
|
|
18
20
|
BeeError: typeof import('./utils/error').BeeError;
|
|
19
21
|
BeeArgumentError: typeof import('./utils/error').BeeArgumentError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BeeRequestOptions, NodeAddresses, Peer, PingResponse, RemovePeerResponse, Topology } from '../../types';
|
|
1
|
+
import type { BeeRequestOptions, Bin, NodeAddresses, Peer, PingResponse, RemovePeerResponse, Topology } from '../../types';
|
|
2
2
|
import { PeerAddress } from '../../utils/typed-bytes';
|
|
3
3
|
export declare function getNodeAddresses(requestOptions: BeeRequestOptions): Promise<NodeAddresses>;
|
|
4
4
|
export declare function getPeers(requestOptions: BeeRequestOptions): Promise<Peer[]>;
|
|
@@ -6,3 +6,4 @@ export declare function getBlocklist(requestOptions: BeeRequestOptions): Promise
|
|
|
6
6
|
export declare function removePeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<RemovePeerResponse>;
|
|
7
7
|
export declare function getTopology(requestOptions: BeeRequestOptions): Promise<Topology>;
|
|
8
8
|
export declare function pingPeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<PingResponse>;
|
|
9
|
+
export declare function asBin(value: unknown, name: string): Bin;
|