@ethersphere/bee-js 3.3.2-pre.1 → 3.3.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/mjs/bee-debug.js +294 -189
- package/dist/mjs/bee.js +316 -237
- package/dist/mjs/chunk/signer.js +46 -12
- package/dist/mjs/chunk/soc.js +71 -31
- package/dist/mjs/chunk/span.js +1 -1
- package/dist/mjs/feed/index.js +86 -42
- package/dist/mjs/feed/json.js +46 -10
- package/dist/mjs/index.js +2 -1
- package/dist/mjs/modules/bytes.js +61 -24
- package/dist/mjs/modules/bzz.js +96 -58
- package/dist/mjs/modules/chunk.js +51 -16
- package/dist/mjs/modules/debug/balance.js +60 -20
- package/dist/mjs/modules/debug/chequebook.js +115 -67
- package/dist/mjs/modules/debug/chunk.js +47 -11
- package/dist/mjs/modules/debug/connectivity.js +76 -32
- package/dist/mjs/modules/debug/settlements.js +46 -10
- package/dist/mjs/modules/debug/stamps.js +91 -47
- package/dist/mjs/modules/debug/states.js +48 -12
- package/dist/mjs/modules/debug/status.js +97 -49
- package/dist/mjs/modules/debug/tag.js +39 -5
- package/dist/mjs/modules/debug/transactions.js +65 -25
- package/dist/mjs/modules/feed.js +50 -16
- package/dist/mjs/modules/pinning.js +67 -27
- package/dist/mjs/modules/pss.js +44 -10
- package/dist/mjs/modules/soc.js +47 -14
- package/dist/mjs/modules/status.js +37 -3
- package/dist/mjs/modules/stewardship.js +46 -10
- package/dist/mjs/modules/tag.js +73 -31
- package/dist/mjs/utils/collection.browser.js +41 -4
- package/dist/mjs/utils/collection.js +45 -11
- package/dist/mjs/utils/collection.node.js +137 -42
- package/dist/mjs/utils/data.browser.js +88 -52
- package/dist/mjs/utils/data.js +57 -21
- package/dist/mjs/utils/error.js +0 -9
- package/dist/mjs/utils/eth.js +68 -32
- package/dist/mjs/utils/file.js +42 -8
- package/dist/mjs/utils/headers.js +4 -4
- package/dist/mjs/utils/http.js +110 -64
- package/dist/mjs/utils/merge.js +2 -2
- package/dist/mjs/utils/stream.js +0 -4
- package/dist/mjs/utils/type.js +6 -6
- package/package.json +2 -2
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) {
|
|
10
|
+
try {
|
|
11
|
+
step(generator.next(value));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
reject(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function step(result) {
|
|
26
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
1
33
|
import { http } from "../../utils/http.js";
|
|
2
34
|
const endpoint = 'chunks';
|
|
3
35
|
/**
|
|
@@ -9,12 +41,14 @@ const endpoint = 'chunks';
|
|
|
9
41
|
* @returns BeeGenericResponse if chunk is found or throws an exception
|
|
10
42
|
*/
|
|
11
43
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
44
|
+
export function checkIfChunkExistsLocally(ky, address) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const response = yield http(ky, {
|
|
47
|
+
path: endpoint + `/${address}`,
|
|
48
|
+
responseType: 'json'
|
|
49
|
+
});
|
|
50
|
+
return response.data;
|
|
16
51
|
});
|
|
17
|
-
return response.data;
|
|
18
52
|
}
|
|
19
53
|
/**
|
|
20
54
|
* Delete a chunk from local storage
|
|
@@ -25,11 +59,13 @@ export async function checkIfChunkExistsLocally(ky, address) {
|
|
|
25
59
|
* @returns BeeGenericResponse if chunk was deleted or throws an exception
|
|
26
60
|
*/
|
|
27
61
|
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
62
|
+
export function deleteChunkFromLocalStorage(ky, address) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const response = yield http(ky, {
|
|
65
|
+
method: 'delete',
|
|
66
|
+
path: endpoint + `/${address}`,
|
|
67
|
+
responseType: 'json'
|
|
68
|
+
});
|
|
69
|
+
return response.data;
|
|
33
70
|
});
|
|
34
|
-
return response.data;
|
|
35
71
|
}
|
|
@@ -1,45 +1,89 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) {
|
|
10
|
+
try {
|
|
11
|
+
step(generator.next(value));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
reject(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function step(result) {
|
|
26
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
1
33
|
import { http } from "../../utils/http.js";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
34
|
+
export function getNodeAddresses(ky) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const response = yield http(ky, {
|
|
37
|
+
path: 'addresses',
|
|
38
|
+
responseType: 'json'
|
|
39
|
+
});
|
|
40
|
+
return response.data;
|
|
6
41
|
});
|
|
7
|
-
return response.data;
|
|
8
42
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
43
|
+
export function getPeers(ky) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const response = yield http(ky, {
|
|
46
|
+
path: 'peers',
|
|
47
|
+
responseType: 'json'
|
|
48
|
+
});
|
|
49
|
+
return response.data.peers || [];
|
|
13
50
|
});
|
|
14
|
-
return response.data.peers || [];
|
|
15
51
|
}
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
52
|
+
export function getBlocklist(ky) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const response = yield http(ky, {
|
|
55
|
+
path: 'blocklist',
|
|
56
|
+
responseType: 'json'
|
|
57
|
+
});
|
|
58
|
+
return response.data.peers || [];
|
|
20
59
|
});
|
|
21
|
-
return response.data.peers || [];
|
|
22
60
|
}
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
61
|
+
export function removePeer(ky, peer) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const response = yield http(ky, {
|
|
64
|
+
path: `peers/${peer}`,
|
|
65
|
+
responseType: 'json',
|
|
66
|
+
method: 'DELETE'
|
|
67
|
+
});
|
|
68
|
+
return response.data;
|
|
28
69
|
});
|
|
29
|
-
return response.data;
|
|
30
70
|
}
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
71
|
+
export function getTopology(ky) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const response = yield http(ky, {
|
|
74
|
+
path: `topology`,
|
|
75
|
+
responseType: 'json'
|
|
76
|
+
});
|
|
77
|
+
return response.data;
|
|
35
78
|
});
|
|
36
|
-
return response.data;
|
|
37
79
|
}
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
80
|
+
export function pingPeer(ky, peer) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const response = yield http(ky, {
|
|
83
|
+
path: `pingpong/${peer}`,
|
|
84
|
+
responseType: 'json',
|
|
85
|
+
method: 'POST'
|
|
86
|
+
});
|
|
87
|
+
return response.data;
|
|
43
88
|
});
|
|
44
|
-
return response.data;
|
|
45
89
|
}
|
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) {
|
|
10
|
+
try {
|
|
11
|
+
step(generator.next(value));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
reject(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function step(result) {
|
|
26
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
1
33
|
import { http } from "../../utils/http.js";
|
|
2
34
|
const settlementsEndpoint = 'settlements';
|
|
3
35
|
/**
|
|
@@ -7,12 +39,14 @@ const settlementsEndpoint = 'settlements';
|
|
|
7
39
|
* @param peer Swarm address of peer
|
|
8
40
|
*/
|
|
9
41
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
42
|
+
export function getSettlements(ky, peer) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const response = yield http(ky, {
|
|
45
|
+
path: `${settlementsEndpoint}/${peer}`,
|
|
46
|
+
responseType: 'json'
|
|
47
|
+
});
|
|
48
|
+
return response.data;
|
|
14
49
|
});
|
|
15
|
-
return response.data;
|
|
16
50
|
}
|
|
17
51
|
/**
|
|
18
52
|
* Get settlements with all known peers and total amount sent or received
|
|
@@ -20,10 +54,12 @@ export async function getSettlements(ky, peer) {
|
|
|
20
54
|
* @param ky Ky debug instance
|
|
21
55
|
*/
|
|
22
56
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
57
|
+
export function getAllSettlements(ky) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const response = yield http(ky, {
|
|
60
|
+
path: settlementsEndpoint,
|
|
61
|
+
responseType: 'json'
|
|
62
|
+
});
|
|
63
|
+
return response.data;
|
|
27
64
|
});
|
|
28
|
-
return response.data;
|
|
29
65
|
}
|
|
@@ -1,64 +1,108 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) {
|
|
10
|
+
try {
|
|
11
|
+
step(generator.next(value));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
reject(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function step(result) {
|
|
26
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
1
33
|
import { http } from "../../utils/http.js";
|
|
2
34
|
const STAMPS_ENDPOINT = 'stamps';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
35
|
+
export function getAllPostageBatches(ky) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const response = yield http(ky, {
|
|
38
|
+
method: 'get',
|
|
39
|
+
path: `${STAMPS_ENDPOINT}`,
|
|
40
|
+
responseType: 'json'
|
|
41
|
+
});
|
|
42
|
+
return response.data.stamps || [];
|
|
8
43
|
});
|
|
9
|
-
return response.data.stamps || [];
|
|
10
44
|
}
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
45
|
+
export function getPostageBatch(ky, postageBatchId) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const response = yield http(ky, {
|
|
48
|
+
method: 'get',
|
|
49
|
+
path: `${STAMPS_ENDPOINT}/${postageBatchId}`,
|
|
50
|
+
responseType: 'json'
|
|
51
|
+
});
|
|
52
|
+
return response.data;
|
|
16
53
|
});
|
|
17
|
-
return response.data;
|
|
18
54
|
}
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
55
|
+
export function getPostageBatchBuckets(ky, postageBatchId) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const response = yield http(ky, {
|
|
58
|
+
method: 'get',
|
|
59
|
+
path: `${STAMPS_ENDPOINT}/${postageBatchId}/buckets`,
|
|
60
|
+
responseType: 'json'
|
|
61
|
+
});
|
|
62
|
+
return response.data;
|
|
24
63
|
});
|
|
25
|
-
return response.data;
|
|
26
64
|
}
|
|
27
|
-
export
|
|
28
|
-
|
|
65
|
+
export function createPostageBatch(ky, amount, depth, options) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const headers = {};
|
|
29
68
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
69
|
+
if (options === null || options === void 0 ? void 0 : options.gasPrice) {
|
|
70
|
+
headers['gas-price'] = options.gasPrice.toString();
|
|
71
|
+
}
|
|
33
72
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
73
|
+
if ((options === null || options === void 0 ? void 0 : options.immutableFlag) !== undefined) {
|
|
74
|
+
headers.immutable = String(options.immutableFlag);
|
|
75
|
+
}
|
|
37
76
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
77
|
+
const response = yield http(ky, {
|
|
78
|
+
method: 'post',
|
|
79
|
+
path: `${STAMPS_ENDPOINT}/${amount}/${depth}`,
|
|
80
|
+
responseType: 'json',
|
|
81
|
+
searchParams: {
|
|
82
|
+
label: options === null || options === void 0 ? void 0 : options.label
|
|
83
|
+
},
|
|
84
|
+
headers
|
|
85
|
+
});
|
|
86
|
+
return response.data.batchID;
|
|
46
87
|
});
|
|
47
|
-
return response.data.batchID;
|
|
48
88
|
}
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
89
|
+
export function topUpBatch(ky, id, amount) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const response = yield http(ky, {
|
|
92
|
+
method: 'patch',
|
|
93
|
+
path: `${STAMPS_ENDPOINT}/topup/${id}/${amount}`,
|
|
94
|
+
responseType: 'json'
|
|
95
|
+
});
|
|
96
|
+
return response.data.batchID;
|
|
54
97
|
});
|
|
55
|
-
return response.data.batchID;
|
|
56
98
|
}
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
99
|
+
export function diluteBatch(ky, id, depth) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
const response = yield http(ky, {
|
|
102
|
+
method: 'patch',
|
|
103
|
+
path: `${STAMPS_ENDPOINT}/dilute/${id}/${depth}`,
|
|
104
|
+
responseType: 'json'
|
|
105
|
+
});
|
|
106
|
+
return response.data.batchID;
|
|
62
107
|
});
|
|
63
|
-
return response.data.batchID;
|
|
64
108
|
}
|
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) {
|
|
10
|
+
try {
|
|
11
|
+
step(generator.next(value));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
reject(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function rejected(value) {
|
|
18
|
+
try {
|
|
19
|
+
step(generator["throw"](value));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function step(result) {
|
|
26
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
1
33
|
import { http } from "../../utils/http.js";
|
|
2
34
|
const RESERVE_STATE_ENDPOINT = 'reservestate';
|
|
3
35
|
const CHAIN_STATE_ENDPOINT = 'chainstate';
|
|
@@ -7,13 +39,15 @@ const CHAIN_STATE_ENDPOINT = 'chainstate';
|
|
|
7
39
|
* @param ky Ky debug instance
|
|
8
40
|
*/
|
|
9
41
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
42
|
+
export function getReserveState(ky) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const response = yield http(ky, {
|
|
45
|
+
method: 'get',
|
|
46
|
+
path: `${RESERVE_STATE_ENDPOINT}`,
|
|
47
|
+
responseType: 'json'
|
|
48
|
+
});
|
|
49
|
+
return response.data;
|
|
15
50
|
});
|
|
16
|
-
return response.data;
|
|
17
51
|
}
|
|
18
52
|
/**
|
|
19
53
|
* Get state of reserve
|
|
@@ -21,11 +55,13 @@ export async function getReserveState(ky) {
|
|
|
21
55
|
* @param ky Ky debug instance
|
|
22
56
|
*/
|
|
23
57
|
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
58
|
+
export function getChainState(ky) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const response = yield http(ky, {
|
|
61
|
+
method: 'get',
|
|
62
|
+
path: `${CHAIN_STATE_ENDPOINT}`,
|
|
63
|
+
responseType: 'json'
|
|
64
|
+
});
|
|
65
|
+
return response.data;
|
|
29
66
|
});
|
|
30
|
-
return response.data;
|
|
31
67
|
}
|