@ethersphere/bee-js 3.3.2 → 3.3.3-pre.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/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
package/dist/mjs/bee-debug.js
CHANGED
|
@@ -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 * as connectivity from "./modules/debug/connectivity.js";
|
|
2
34
|
import * as balance from "./modules/debug/balance.js";
|
|
3
35
|
import * as chequebook from "./modules/debug/chequebook.js";
|
|
@@ -13,18 +45,9 @@ import * as tag from "./modules/debug/tag.js";
|
|
|
13
45
|
import * as stamps from "./modules/debug/stamps.js";
|
|
14
46
|
import { makeDefaultKy, wrapRequestClosure, wrapResponseClosure } from "./utils/http.js";
|
|
15
47
|
export class BeeDebug {
|
|
16
|
-
/**
|
|
17
|
-
* URL on which is the Debug API of Bee node exposed
|
|
18
|
-
*/
|
|
19
|
-
url;
|
|
20
|
-
/**
|
|
21
|
-
* Ky instance that defines connection to Bee node
|
|
22
|
-
* @private
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
ky;
|
|
26
|
-
|
|
27
48
|
constructor(url, options) {
|
|
49
|
+
var _a;
|
|
50
|
+
|
|
28
51
|
assertBeeUrl(url); // Remove last slash if present, as our endpoint strings starts with `/...`
|
|
29
52
|
// which could lead to double slash in URL to which Bee responds with
|
|
30
53
|
// unnecessary redirects.
|
|
@@ -32,38 +55,42 @@ export class BeeDebug {
|
|
|
32
55
|
this.url = stripLastSlash(url);
|
|
33
56
|
const kyOptions = {
|
|
34
57
|
prefixUrl: this.url,
|
|
35
|
-
timeout: options
|
|
36
|
-
retry: options
|
|
37
|
-
fetch: options
|
|
58
|
+
timeout: (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : false,
|
|
59
|
+
retry: options === null || options === void 0 ? void 0 : options.retry,
|
|
60
|
+
fetch: options === null || options === void 0 ? void 0 : options.fetch,
|
|
38
61
|
hooks: {
|
|
39
62
|
beforeRequest: [],
|
|
40
63
|
afterResponse: []
|
|
41
64
|
}
|
|
42
65
|
};
|
|
43
66
|
|
|
44
|
-
if (options
|
|
67
|
+
if (options === null || options === void 0 ? void 0 : options.defaultHeaders) {
|
|
45
68
|
kyOptions.headers = options.defaultHeaders;
|
|
46
69
|
}
|
|
47
70
|
|
|
48
|
-
if (options
|
|
71
|
+
if (options === null || options === void 0 ? void 0 : options.onRequest) {
|
|
49
72
|
kyOptions.hooks.beforeRequest.push(wrapRequestClosure(options.onRequest));
|
|
50
73
|
}
|
|
51
74
|
|
|
52
|
-
if (options
|
|
75
|
+
if (options === null || options === void 0 ? void 0 : options.onResponse) {
|
|
53
76
|
kyOptions.hooks.afterResponse.push(wrapResponseClosure(options.onResponse));
|
|
54
77
|
}
|
|
55
78
|
|
|
56
79
|
this.ky = makeDefaultKy(kyOptions);
|
|
57
80
|
}
|
|
58
81
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
82
|
+
getNodeAddresses(options) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
assertRequestOptions(options);
|
|
85
|
+
return connectivity.getNodeAddresses(this.getKy(options));
|
|
86
|
+
});
|
|
62
87
|
}
|
|
63
88
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
89
|
+
getBlocklist(options) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
assertRequestOptions(options);
|
|
92
|
+
return connectivity.getBlocklist(this.getKy(options));
|
|
93
|
+
});
|
|
67
94
|
}
|
|
68
95
|
/**
|
|
69
96
|
* Retrieve tag extended information from Bee node
|
|
@@ -77,44 +104,54 @@ export class BeeDebug {
|
|
|
77
104
|
*/
|
|
78
105
|
|
|
79
106
|
|
|
80
|
-
|
|
81
|
-
|
|
107
|
+
retrieveExtendedTag(tagUid, options) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
assertRequestOptions(options);
|
|
82
110
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
111
|
+
if (isTag(tagUid)) {
|
|
112
|
+
tagUid = tagUid.uid;
|
|
113
|
+
} else if (typeof tagUid === 'number') {
|
|
114
|
+
assertNonNegativeInteger(tagUid, 'UID');
|
|
115
|
+
} else {
|
|
116
|
+
throw new TypeError('tagUid has to be either Tag or a number (UID)!');
|
|
117
|
+
}
|
|
90
118
|
|
|
91
|
-
|
|
119
|
+
return tag.retrieveExtendedTag(this.getKy(options), tagUid);
|
|
120
|
+
});
|
|
92
121
|
}
|
|
93
122
|
/**
|
|
94
123
|
* Get list of peers for this node
|
|
95
124
|
*/
|
|
96
125
|
|
|
97
126
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
127
|
+
getPeers(options) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
assertRequestOptions(options);
|
|
130
|
+
return connectivity.getPeers(this.getKy(options));
|
|
131
|
+
});
|
|
101
132
|
}
|
|
102
133
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
134
|
+
removePeer(peer, options) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
assertRequestOptions(options);
|
|
137
|
+
assertAddress(peer);
|
|
138
|
+
return connectivity.removePeer(this.getKy(options), peer);
|
|
139
|
+
});
|
|
107
140
|
}
|
|
108
141
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
142
|
+
getTopology(options) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
assertRequestOptions(options);
|
|
145
|
+
return connectivity.getTopology(this.getKy(options));
|
|
146
|
+
});
|
|
112
147
|
}
|
|
113
148
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
149
|
+
pingPeer(peer, options) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
assertRequestOptions(options);
|
|
152
|
+
assertAddress(peer);
|
|
153
|
+
return connectivity.pingPeer(this.getKy(options), peer);
|
|
154
|
+
});
|
|
118
155
|
}
|
|
119
156
|
/*
|
|
120
157
|
* Balance endpoints
|
|
@@ -125,9 +162,11 @@ export class BeeDebug {
|
|
|
125
162
|
*/
|
|
126
163
|
|
|
127
164
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
165
|
+
getAllBalances(options) {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
assertRequestOptions(options);
|
|
168
|
+
return balance.getAllBalances(this.getKy(options));
|
|
169
|
+
});
|
|
131
170
|
}
|
|
132
171
|
/**
|
|
133
172
|
* Get the balances with a specific peer including prepaid services
|
|
@@ -136,19 +175,23 @@ export class BeeDebug {
|
|
|
136
175
|
*/
|
|
137
176
|
|
|
138
177
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
178
|
+
getPeerBalance(address, options) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
assertRequestOptions(options);
|
|
181
|
+
assertAddress(address);
|
|
182
|
+
return balance.getPeerBalance(this.getKy(options), address);
|
|
183
|
+
});
|
|
143
184
|
}
|
|
144
185
|
/**
|
|
145
186
|
* Get the past due consumption balances with all known peers
|
|
146
187
|
*/
|
|
147
188
|
|
|
148
189
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
190
|
+
getPastDueConsumptionBalances(options) {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
assertRequestOptions(options);
|
|
193
|
+
return balance.getPastDueConsumptionBalances(this.getKy(options));
|
|
194
|
+
});
|
|
152
195
|
}
|
|
153
196
|
/**
|
|
154
197
|
* Get the past due consumption balance with a specific peer
|
|
@@ -157,10 +200,12 @@ export class BeeDebug {
|
|
|
157
200
|
*/
|
|
158
201
|
|
|
159
202
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
203
|
+
getPastDueConsumptionPeerBalance(address, options) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
assertRequestOptions(options);
|
|
206
|
+
assertAddress(address);
|
|
207
|
+
return balance.getPastDueConsumptionPeerBalance(this.getKy(options), address);
|
|
208
|
+
});
|
|
164
209
|
}
|
|
165
210
|
/*
|
|
166
211
|
* Chequebook endpoints
|
|
@@ -174,27 +219,33 @@ export class BeeDebug {
|
|
|
174
219
|
*/
|
|
175
220
|
|
|
176
221
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
222
|
+
getChequebookAddress(options) {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
assertRequestOptions(options);
|
|
225
|
+
return chequebook.getChequebookAddress(this.getKy(options));
|
|
226
|
+
});
|
|
180
227
|
}
|
|
181
228
|
/**
|
|
182
229
|
* Get the balance of the chequebook
|
|
183
230
|
*/
|
|
184
231
|
|
|
185
232
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
233
|
+
getChequebookBalance(options) {
|
|
234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
assertRequestOptions(options);
|
|
236
|
+
return chequebook.getChequebookBalance(this.getKy(options));
|
|
237
|
+
});
|
|
189
238
|
}
|
|
190
239
|
/**
|
|
191
240
|
* Get last cheques for all peers
|
|
192
241
|
*/
|
|
193
242
|
|
|
194
243
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
244
|
+
getLastCheques(options) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
assertRequestOptions(options);
|
|
247
|
+
return chequebook.getLastCheques(this.getKy(options));
|
|
248
|
+
});
|
|
198
249
|
}
|
|
199
250
|
/**
|
|
200
251
|
* Get last cheques for the peer
|
|
@@ -203,10 +254,12 @@ export class BeeDebug {
|
|
|
203
254
|
*/
|
|
204
255
|
|
|
205
256
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
257
|
+
getLastChequesForPeer(address, options) {
|
|
258
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
259
|
+
assertRequestOptions(options);
|
|
260
|
+
assertAddress(address);
|
|
261
|
+
return chequebook.getLastChequesForPeer(this.getKy(options), address);
|
|
262
|
+
});
|
|
210
263
|
}
|
|
211
264
|
/**
|
|
212
265
|
* Get last cashout action for the peer
|
|
@@ -215,10 +268,12 @@ export class BeeDebug {
|
|
|
215
268
|
*/
|
|
216
269
|
|
|
217
270
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
271
|
+
getLastCashoutAction(address, options) {
|
|
272
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
assertRequestOptions(options);
|
|
274
|
+
assertAddress(address);
|
|
275
|
+
return chequebook.getLastCashoutAction(this.getKy(options), address);
|
|
276
|
+
});
|
|
222
277
|
}
|
|
223
278
|
/**
|
|
224
279
|
* Cashout the last cheque for the peer
|
|
@@ -230,10 +285,12 @@ export class BeeDebug {
|
|
|
230
285
|
*/
|
|
231
286
|
|
|
232
287
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
288
|
+
cashoutLastCheque(address, options) {
|
|
289
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
+
assertCashoutOptions(options);
|
|
291
|
+
assertAddress(address);
|
|
292
|
+
return chequebook.cashoutLastCheque(this.getKy(options), address, options);
|
|
293
|
+
});
|
|
237
294
|
}
|
|
238
295
|
/**
|
|
239
296
|
* Deposit tokens from overlay address into chequebook
|
|
@@ -244,15 +301,17 @@ export class BeeDebug {
|
|
|
244
301
|
*/
|
|
245
302
|
|
|
246
303
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
304
|
+
depositTokens(amount, gasPrice, options) {
|
|
305
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
306
|
+
assertRequestOptions(options);
|
|
307
|
+
assertNonNegativeInteger(amount);
|
|
250
308
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
309
|
+
if (gasPrice) {
|
|
310
|
+
assertNonNegativeInteger(gasPrice);
|
|
311
|
+
}
|
|
254
312
|
|
|
255
|
-
|
|
313
|
+
return chequebook.depositTokens(this.getKy(options), amount, gasPrice);
|
|
314
|
+
});
|
|
256
315
|
}
|
|
257
316
|
/**
|
|
258
317
|
* Withdraw tokens from the chequebook to the overlay address
|
|
@@ -263,15 +322,17 @@ export class BeeDebug {
|
|
|
263
322
|
*/
|
|
264
323
|
|
|
265
324
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
325
|
+
withdrawTokens(amount, gasPrice, options) {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
+
assertRequestOptions(options);
|
|
328
|
+
assertNonNegativeInteger(amount);
|
|
269
329
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
330
|
+
if (gasPrice) {
|
|
331
|
+
assertNonNegativeInteger(gasPrice);
|
|
332
|
+
}
|
|
273
333
|
|
|
274
|
-
|
|
334
|
+
return chequebook.withdrawTokens(this.getKy(options), amount, gasPrice);
|
|
335
|
+
});
|
|
275
336
|
}
|
|
276
337
|
/*
|
|
277
338
|
* Settlements endpoint
|
|
@@ -284,37 +345,45 @@ export class BeeDebug {
|
|
|
284
345
|
*/
|
|
285
346
|
|
|
286
347
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
348
|
+
getSettlements(address, options) {
|
|
349
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
350
|
+
assertRequestOptions(options);
|
|
351
|
+
assertAddress(address);
|
|
352
|
+
return settlements.getSettlements(this.getKy(options), address);
|
|
353
|
+
});
|
|
291
354
|
}
|
|
292
355
|
/**
|
|
293
356
|
* Get settlements with all known peers and total amount sent or received
|
|
294
357
|
*/
|
|
295
358
|
|
|
296
359
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
360
|
+
getAllSettlements(options) {
|
|
361
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
362
|
+
assertRequestOptions(options);
|
|
363
|
+
return settlements.getAllSettlements(this.getKy(options));
|
|
364
|
+
});
|
|
300
365
|
}
|
|
301
366
|
/**
|
|
302
367
|
* Get health of node
|
|
303
368
|
*/
|
|
304
369
|
|
|
305
370
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
371
|
+
getHealth(options) {
|
|
372
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
373
|
+
assertRequestOptions(options);
|
|
374
|
+
return status.getHealth(this.getKy(options));
|
|
375
|
+
});
|
|
309
376
|
}
|
|
310
377
|
/**
|
|
311
378
|
* Get mode information of node
|
|
312
379
|
*/
|
|
313
380
|
|
|
314
381
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
382
|
+
getNodeInfo(options) {
|
|
383
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
384
|
+
assertRequestOptions(options);
|
|
385
|
+
return status.getNodeInfo(this.getKy(options));
|
|
386
|
+
});
|
|
318
387
|
}
|
|
319
388
|
/**
|
|
320
389
|
* Connnects to a node and checks if it is a supported Bee version by the bee-js
|
|
@@ -324,9 +393,11 @@ export class BeeDebug {
|
|
|
324
393
|
*/
|
|
325
394
|
|
|
326
395
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
396
|
+
isSupportedVersion(options) {
|
|
397
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
398
|
+
assertRequestOptions(options);
|
|
399
|
+
return status.isSupportedVersion(this.getKy(options));
|
|
400
|
+
});
|
|
330
401
|
}
|
|
331
402
|
/**
|
|
332
403
|
* Connects to a node and checks if its version matches with the one that bee-js supports.
|
|
@@ -340,9 +411,11 @@ export class BeeDebug {
|
|
|
340
411
|
*/
|
|
341
412
|
|
|
342
413
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
414
|
+
isSupportedExactVersion(options) {
|
|
415
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
416
|
+
assertRequestOptions(options);
|
|
417
|
+
return status.isSupportedExactVersion(this.getKy(options));
|
|
418
|
+
});
|
|
346
419
|
}
|
|
347
420
|
/**
|
|
348
421
|
* Connects to a node and checks if its main's API version matches with the one that bee-js supports.
|
|
@@ -354,9 +427,11 @@ export class BeeDebug {
|
|
|
354
427
|
*/
|
|
355
428
|
|
|
356
429
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
430
|
+
isSupportedMainApiVersion(options) {
|
|
431
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
432
|
+
assertRequestOptions(options);
|
|
433
|
+
return status.isSupportedMainApiVersion(this.getKy(options));
|
|
434
|
+
});
|
|
360
435
|
}
|
|
361
436
|
/**
|
|
362
437
|
* Connects to a node and checks if its Debug API version matches with the one that bee-js supports.
|
|
@@ -368,9 +443,11 @@ export class BeeDebug {
|
|
|
368
443
|
*/
|
|
369
444
|
|
|
370
445
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
446
|
+
isSupportedDebugApiVersion(options) {
|
|
447
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
448
|
+
assertRequestOptions(options);
|
|
449
|
+
return status.isSupportedDebugApiVersion(this.getKy(options));
|
|
450
|
+
});
|
|
374
451
|
}
|
|
375
452
|
/**
|
|
376
453
|
*
|
|
@@ -382,9 +459,11 @@ export class BeeDebug {
|
|
|
382
459
|
*/
|
|
383
460
|
|
|
384
461
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
462
|
+
isSupportedApiVersion(options) {
|
|
463
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
464
|
+
assertRequestOptions(options);
|
|
465
|
+
return status.isSupportedDebugApiVersion(this.getKy(options));
|
|
466
|
+
});
|
|
388
467
|
}
|
|
389
468
|
/**
|
|
390
469
|
* Returns object with all versions specified by the connected Bee node (properties prefixed with `bee*`)
|
|
@@ -394,27 +473,33 @@ export class BeeDebug {
|
|
|
394
473
|
*/
|
|
395
474
|
|
|
396
475
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
476
|
+
getVersions(options) {
|
|
477
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
478
|
+
assertRequestOptions(options);
|
|
479
|
+
return status.getVersions(this.getKy(options));
|
|
480
|
+
});
|
|
400
481
|
}
|
|
401
482
|
/**
|
|
402
483
|
* Get reserve state
|
|
403
484
|
*/
|
|
404
485
|
|
|
405
486
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
487
|
+
getReserveState(options) {
|
|
488
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
489
|
+
assertRequestOptions(options);
|
|
490
|
+
return states.getReserveState(this.getKy(options));
|
|
491
|
+
});
|
|
409
492
|
}
|
|
410
493
|
/**
|
|
411
494
|
* Get chain state
|
|
412
495
|
*/
|
|
413
496
|
|
|
414
497
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
498
|
+
getChainState(options) {
|
|
499
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
500
|
+
assertRequestOptions(options);
|
|
501
|
+
return states.getChainState(this.getKy(options));
|
|
502
|
+
});
|
|
418
503
|
}
|
|
419
504
|
/**
|
|
420
505
|
* Creates new postage batch from the funds that the node has available in its Ethereum account.
|
|
@@ -435,28 +520,30 @@ export class BeeDebug {
|
|
|
435
520
|
*/
|
|
436
521
|
|
|
437
522
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
523
|
+
createPostageBatch(amount, depth, options) {
|
|
524
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
525
|
+
assertRequestOptions(options);
|
|
526
|
+
assertNonNegativeInteger(amount);
|
|
527
|
+
assertNonNegativeInteger(depth);
|
|
442
528
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
529
|
+
if (depth < STAMPS_DEPTH_MIN) {
|
|
530
|
+
throw new BeeArgumentError(`Depth has to be at least ${STAMPS_DEPTH_MIN}`, depth);
|
|
531
|
+
}
|
|
446
532
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
533
|
+
if (depth > STAMPS_DEPTH_MAX) {
|
|
534
|
+
throw new BeeArgumentError(`Depth has to be at most ${STAMPS_DEPTH_MAX}`, depth);
|
|
535
|
+
}
|
|
450
536
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
537
|
+
if (options === null || options === void 0 ? void 0 : options.gasPrice) {
|
|
538
|
+
assertNonNegativeInteger(options.gasPrice);
|
|
539
|
+
}
|
|
454
540
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
541
|
+
if ((options === null || options === void 0 ? void 0 : options.immutableFlag) !== undefined) {
|
|
542
|
+
assertBoolean(options.immutableFlag);
|
|
543
|
+
}
|
|
458
544
|
|
|
459
|
-
|
|
545
|
+
return stamps.createPostageBatch(this.getKy(options), amount, depth, options);
|
|
546
|
+
});
|
|
460
547
|
}
|
|
461
548
|
/**
|
|
462
549
|
* Topup a fresh amount of BZZ to given Postage Batch.
|
|
@@ -475,11 +562,13 @@ export class BeeDebug {
|
|
|
475
562
|
*/
|
|
476
563
|
|
|
477
564
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
565
|
+
topUpBatch(postageBatchId, amount, options) {
|
|
566
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
567
|
+
assertRequestOptions(options);
|
|
568
|
+
assertNonNegativeInteger(amount, 'Amount');
|
|
569
|
+
assertBatchId(postageBatchId);
|
|
570
|
+
yield stamps.topUpBatch(this.getKy(options), postageBatchId, amount);
|
|
571
|
+
});
|
|
483
572
|
}
|
|
484
573
|
/**
|
|
485
574
|
* Dilute given Postage Batch with new depth (that has to be bigger then the original depth), which allows
|
|
@@ -499,11 +588,13 @@ export class BeeDebug {
|
|
|
499
588
|
*/
|
|
500
589
|
|
|
501
590
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
591
|
+
diluteBatch(postageBatchId, depth, options) {
|
|
592
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
593
|
+
assertRequestOptions(options);
|
|
594
|
+
assertNonNegativeInteger(depth, 'Depth');
|
|
595
|
+
assertBatchId(postageBatchId);
|
|
596
|
+
yield stamps.diluteBatch(this.getKy(options), postageBatchId, depth);
|
|
597
|
+
});
|
|
507
598
|
}
|
|
508
599
|
/**
|
|
509
600
|
* Return details for specific postage batch.
|
|
@@ -515,10 +606,12 @@ export class BeeDebug {
|
|
|
515
606
|
*/
|
|
516
607
|
|
|
517
608
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
609
|
+
getPostageBatch(postageBatchId, options) {
|
|
610
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
611
|
+
assertRequestOptions(options);
|
|
612
|
+
assertBatchId(postageBatchId);
|
|
613
|
+
return stamps.getPostageBatch(this.getKy(options), postageBatchId);
|
|
614
|
+
});
|
|
522
615
|
}
|
|
523
616
|
/**
|
|
524
617
|
* Return detailed information related to buckets for specific postage batch.
|
|
@@ -530,10 +623,12 @@ export class BeeDebug {
|
|
|
530
623
|
*/
|
|
531
624
|
|
|
532
625
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
626
|
+
getPostageBatchBuckets(postageBatchId, options) {
|
|
627
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
628
|
+
assertRequestOptions(options);
|
|
629
|
+
assertBatchId(postageBatchId);
|
|
630
|
+
return stamps.getPostageBatchBuckets(this.getKy(options), postageBatchId);
|
|
631
|
+
});
|
|
537
632
|
}
|
|
538
633
|
/**
|
|
539
634
|
* Return all postage batches that has the node available.
|
|
@@ -543,18 +638,22 @@ export class BeeDebug {
|
|
|
543
638
|
*/
|
|
544
639
|
|
|
545
640
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
641
|
+
getAllPostageBatch(options) {
|
|
642
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
643
|
+
assertRequestOptions(options);
|
|
644
|
+
return stamps.getAllPostageBatches(this.getKy(options));
|
|
645
|
+
});
|
|
549
646
|
}
|
|
550
647
|
/**
|
|
551
648
|
* Return lists of all current pending transactions that the Bee made
|
|
552
649
|
*/
|
|
553
650
|
|
|
554
651
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
652
|
+
getAllPendingTransactions(options) {
|
|
653
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
654
|
+
assertRequestOptions(options);
|
|
655
|
+
return transactions.getAllTransactions(this.getKy(options));
|
|
656
|
+
});
|
|
558
657
|
}
|
|
559
658
|
/**
|
|
560
659
|
* Return transaction information for specific transaction
|
|
@@ -562,10 +661,12 @@ export class BeeDebug {
|
|
|
562
661
|
*/
|
|
563
662
|
|
|
564
663
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
664
|
+
getPendingTransaction(transactionHash, options) {
|
|
665
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
666
|
+
assertRequestOptions(options);
|
|
667
|
+
assertTransactionHash(transactionHash);
|
|
668
|
+
return transactions.getTransaction(this.getKy(options), transactionHash);
|
|
669
|
+
});
|
|
569
670
|
}
|
|
570
671
|
/**
|
|
571
672
|
* Rebroadcast already created transaction.
|
|
@@ -575,10 +676,12 @@ export class BeeDebug {
|
|
|
575
676
|
*/
|
|
576
677
|
|
|
577
678
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
679
|
+
rebroadcastPendingTransaction(transactionHash, options) {
|
|
680
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
681
|
+
assertRequestOptions(options);
|
|
682
|
+
assertTransactionHash(transactionHash);
|
|
683
|
+
return transactions.rebroadcastTransaction(this.getKy(options), transactionHash);
|
|
684
|
+
});
|
|
582
685
|
}
|
|
583
686
|
/**
|
|
584
687
|
* Cancel currently pending transaction
|
|
@@ -587,15 +690,17 @@ export class BeeDebug {
|
|
|
587
690
|
*/
|
|
588
691
|
|
|
589
692
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
693
|
+
cancelPendingTransaction(transactionHash, gasPrice, options) {
|
|
694
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
695
|
+
assertRequestOptions(options);
|
|
696
|
+
assertTransactionHash(transactionHash);
|
|
593
697
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
698
|
+
if (gasPrice) {
|
|
699
|
+
assertNonNegativeInteger(gasPrice);
|
|
700
|
+
}
|
|
597
701
|
|
|
598
|
-
|
|
702
|
+
return transactions.cancelTransaction(this.getKy(options), transactionHash, gasPrice);
|
|
703
|
+
});
|
|
599
704
|
}
|
|
600
705
|
|
|
601
706
|
getKy(options) {
|