@ethersphere/bee-js 4.1.1 → 5.1.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/README.md +8 -7
- package/dist/cjs/bee-debug.js +42 -2
- package/dist/cjs/bee.js +9 -3
- package/dist/cjs/chunk/soc.js +5 -1
- package/dist/cjs/feed/index.js +5 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/modules/debug/connectivity.js +2 -2
- package/dist/cjs/modules/debug/stake.js +55 -0
- package/dist/cjs/modules/debug/stamps.js +1 -1
- package/dist/cjs/modules/debug/status.js +26 -4
- package/dist/cjs/modules/pinning.js +1 -5
- package/dist/cjs/types/index.js +5 -1
- package/dist/cjs/utils/type.js +16 -7
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee-debug.js +44 -2
- package/dist/mjs/bee.js +4 -2
- package/dist/mjs/modules/debug/connectivity.js +2 -2
- package/dist/mjs/modules/debug/stake.js +78 -0
- package/dist/mjs/modules/debug/stamps.js +1 -1
- package/dist/mjs/modules/debug/status.js +24 -3
- package/dist/mjs/modules/pinning.js +1 -7
- package/dist/mjs/utils/type.js +15 -6
- package/dist/types/bee-debug.d.ts +20 -1
- package/dist/types/bee.d.ts +2 -3
- package/dist/types/modules/debug/stake.d.ts +15 -0
- package/dist/types/modules/debug/status.d.ts +9 -3
- package/dist/types/modules/pinning.d.ts +1 -1
- package/dist/types/types/debug.d.ts +4 -8
- package/dist/types/types/index.d.ts +25 -8
- package/dist/types/utils/type.d.ts +7 -2
- package/package.json +11 -11
package/dist/mjs/bee-debug.js
CHANGED
|
@@ -37,9 +37,10 @@ import * as settlements from "./modules/debug/settlements.js";
|
|
|
37
37
|
import * as status from "./modules/debug/status.js";
|
|
38
38
|
import * as transactions from "./modules/debug/transactions.js";
|
|
39
39
|
import * as states from "./modules/debug/states.js";
|
|
40
|
+
import * as stake from "./modules/debug/stake.js";
|
|
40
41
|
import { BeeArgumentError, BeeError } from "./utils/error.js";
|
|
41
42
|
import { assertBeeUrl, stripLastSlash } from "./utils/url.js";
|
|
42
|
-
import { assertAddress, assertBatchId, assertCashoutOptions, assertNonNegativeInteger, assertPositiveInteger, assertPostageBatchOptions, assertRequestOptions, assertTransactionHash, isTag } from "./utils/type.js";
|
|
43
|
+
import { assertAddress, assertBatchId, assertCashoutOptions, assertNonNegativeInteger, assertPositiveInteger, assertPostageBatchOptions, assertRequestOptions, assertTransactionHash, assertTransactionOptions, isTag } from "./utils/type.js";
|
|
43
44
|
import { STAMPS_DEPTH_MAX, STAMPS_DEPTH_MIN } from "./types/index.js";
|
|
44
45
|
import * as tag from "./modules/debug/tag.js";
|
|
45
46
|
import * as stamps from "./modules/debug/stamps.js";
|
|
@@ -375,6 +376,17 @@ export class BeeDebug {
|
|
|
375
376
|
return status.getHealth(this.getKy(options));
|
|
376
377
|
});
|
|
377
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* Get readiness of node
|
|
381
|
+
*/
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
getReadiness(options) {
|
|
385
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
386
|
+
assertRequestOptions(options);
|
|
387
|
+
return status.getReadiness(this.getKy(options));
|
|
388
|
+
});
|
|
389
|
+
}
|
|
378
390
|
/**
|
|
379
391
|
* Get mode information of node
|
|
380
392
|
*/
|
|
@@ -550,7 +562,7 @@ export class BeeDebug {
|
|
|
550
562
|
|
|
551
563
|
const stamp = yield stamps.createPostageBatch(this.getKy(options), amount, depth, options);
|
|
552
564
|
|
|
553
|
-
if (options === null || options === void 0 ? void 0 : options.waitForUsable) {
|
|
565
|
+
if ((options === null || options === void 0 ? void 0 : options.waitForUsable) !== false) {
|
|
554
566
|
yield this.waitForUsablePostageStamp(stamp, options === null || options === void 0 ? void 0 : options.waitForUsableTimeout);
|
|
555
567
|
}
|
|
556
568
|
|
|
@@ -714,6 +726,36 @@ export class BeeDebug {
|
|
|
714
726
|
return transactions.cancelTransaction(this.getKy(options), transactionHash, gasPrice);
|
|
715
727
|
});
|
|
716
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* Gets the staked amount of BZZ (in PLUR unit) as number string.
|
|
731
|
+
*
|
|
732
|
+
* @param options
|
|
733
|
+
*/
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
getStake(options) {
|
|
737
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
738
|
+
assertRequestOptions(options);
|
|
739
|
+
return stake.getStake(this.getKy(options));
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Deposits given amount of BZZ token (in PLUR unit).
|
|
744
|
+
*
|
|
745
|
+
* Be aware that staked BZZ tokens can **not** be withdrawn.
|
|
746
|
+
*
|
|
747
|
+
* @param amount Amount of BZZ token (in PLUR unit) to be staked. Minimum is 100_000_000_000_000_000 PLUR (10 BZZ).
|
|
748
|
+
* @param options
|
|
749
|
+
*/
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
depositStake(amount, options) {
|
|
753
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
754
|
+
assertRequestOptions(options);
|
|
755
|
+
assertTransactionOptions(options);
|
|
756
|
+
yield stake.stake(this.getKy(options), amount, options);
|
|
757
|
+
});
|
|
758
|
+
}
|
|
717
759
|
|
|
718
760
|
waitForUsablePostageStamp(id, timeout = 120000) {
|
|
719
761
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/mjs/bee.js
CHANGED
|
@@ -833,7 +833,6 @@ export class Bee {
|
|
|
833
833
|
*
|
|
834
834
|
* @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
|
|
835
835
|
* @see [Bee API reference - `POST /feeds`](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1{owner}~1{topic}/post)
|
|
836
|
-
* TODO: Once breaking add support for Feed CID
|
|
837
836
|
*/
|
|
838
837
|
|
|
839
838
|
|
|
@@ -844,9 +843,12 @@ export class Bee {
|
|
|
844
843
|
assertBatchId(postageBatchId);
|
|
845
844
|
const canonicalTopic = makeTopic(topic);
|
|
846
845
|
const canonicalOwner = makeHexEthAddress(owner);
|
|
847
|
-
|
|
846
|
+
const reference = yield createFeedManifest(this.getKy(options), canonicalOwner, canonicalTopic, postageBatchId, {
|
|
848
847
|
type
|
|
849
848
|
});
|
|
849
|
+
return addCidConversionFunction({
|
|
850
|
+
reference
|
|
851
|
+
}, ReferenceType.FEED);
|
|
850
852
|
});
|
|
851
853
|
}
|
|
852
854
|
/**
|
|
@@ -46,7 +46,7 @@ export function getPeers(ky) {
|
|
|
46
46
|
path: 'peers',
|
|
47
47
|
responseType: 'json'
|
|
48
48
|
});
|
|
49
|
-
return response.data.peers
|
|
49
|
+
return response.data.peers;
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
export function getBlocklist(ky) {
|
|
@@ -55,7 +55,7 @@ export function getBlocklist(ky) {
|
|
|
55
55
|
path: 'blocklist',
|
|
56
56
|
responseType: 'json'
|
|
57
57
|
});
|
|
58
|
-
return response.data.peers
|
|
58
|
+
return response.data.peers;
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
export function removePeer(ky, peer) {
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
|
|
33
|
+
import { http } from "../../utils/http.js";
|
|
34
|
+
const STAKE_ENDPOINT = 'stake';
|
|
35
|
+
/**
|
|
36
|
+
* Gets the staked amount
|
|
37
|
+
*
|
|
38
|
+
* @param ky Ky instance for given Bee class instance
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
export function getStake(ky) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const response = yield http(ky, {
|
|
44
|
+
method: 'get',
|
|
45
|
+
responseType: 'json',
|
|
46
|
+
path: `${STAKE_ENDPOINT}`
|
|
47
|
+
});
|
|
48
|
+
return response.data.stakedAmount.toString();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Stake given amount of tokens.
|
|
53
|
+
*
|
|
54
|
+
* @param ky
|
|
55
|
+
* @param amount
|
|
56
|
+
* @param options
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
export function stake(ky, amount, options) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const headers = {};
|
|
62
|
+
|
|
63
|
+
if (options === null || options === void 0 ? void 0 : options.gasPrice) {
|
|
64
|
+
headers['gas-price'] = options.gasPrice.toString();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (options === null || options === void 0 ? void 0 : options.gasLimit) {
|
|
68
|
+
headers['gas-limit'] = options.gasLimit.toString();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
yield http(ky, {
|
|
72
|
+
method: 'post',
|
|
73
|
+
responseType: 'json',
|
|
74
|
+
path: `${STAKE_ENDPOINT}/deposit/${amount}`,
|
|
75
|
+
headers
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -34,12 +34,13 @@ import { http } from "../../utils/http.js";
|
|
|
34
34
|
import getMajorSemver from 'semver/functions/major.js'; // Following lines bellow are automatically updated with GitHub Action when Bee version is updated
|
|
35
35
|
// so if you are changing anything about them change the `update_bee` action accordingly!
|
|
36
36
|
|
|
37
|
-
export const SUPPORTED_BEE_VERSION_EXACT = '1.
|
|
38
|
-
export const SUPPORTED_API_VERSION = '3.0
|
|
39
|
-
export const SUPPORTED_DEBUG_API_VERSION = '2.0
|
|
37
|
+
export const SUPPORTED_BEE_VERSION_EXACT = '1.9.0-13a47043';
|
|
38
|
+
export const SUPPORTED_API_VERSION = '3.2.0';
|
|
39
|
+
export const SUPPORTED_DEBUG_API_VERSION = '3.2.0';
|
|
40
40
|
export const SUPPORTED_BEE_VERSION = SUPPORTED_BEE_VERSION_EXACT.substring(0, SUPPORTED_BEE_VERSION_EXACT.indexOf('-'));
|
|
41
41
|
const NODE_INFO_URL = 'node';
|
|
42
42
|
const HEALTH_URL = 'health';
|
|
43
|
+
const READINESS_URL = 'readiness';
|
|
43
44
|
/**
|
|
44
45
|
* Get health of node
|
|
45
46
|
*
|
|
@@ -56,6 +57,25 @@ export function getHealth(ky) {
|
|
|
56
57
|
return response.data;
|
|
57
58
|
});
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Get readiness of node
|
|
62
|
+
*
|
|
63
|
+
* @param ky Ky debug instance
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
export function getReadiness(ky) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
try {
|
|
69
|
+
const response = yield http(ky, {
|
|
70
|
+
method: 'get',
|
|
71
|
+
path: READINESS_URL
|
|
72
|
+
});
|
|
73
|
+
return response.status === 200;
|
|
74
|
+
} catch (_a) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
59
79
|
/**
|
|
60
80
|
* Get information about Bee node
|
|
61
81
|
*
|
|
@@ -80,6 +100,7 @@ export function getNodeInfo(ky) {
|
|
|
80
100
|
* @returns true if the Bee node version is supported
|
|
81
101
|
* @deprecated Use `isSupportedExactVersion` instead
|
|
82
102
|
*/
|
|
103
|
+
// TODO: Remove on break
|
|
83
104
|
|
|
84
105
|
export function isSupportedVersion(ky) {
|
|
85
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -95,12 +95,6 @@ export function getAllPins(ky) {
|
|
|
95
95
|
responseType: 'json',
|
|
96
96
|
path: `${PINNING_ENDPOINT}`
|
|
97
97
|
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (result === null) {
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return result;
|
|
98
|
+
return response.data.references;
|
|
105
99
|
});
|
|
106
100
|
}
|
package/dist/mjs/utils/type.js
CHANGED
|
@@ -151,7 +151,7 @@ export function makeReferenceOrEns(value, expectedCidType) {
|
|
|
151
151
|
|
|
152
152
|
export function addCidConversionFunction(result, cidType) {
|
|
153
153
|
return Object.assign(Object.assign({}, result), {
|
|
154
|
-
|
|
154
|
+
cid() {
|
|
155
155
|
return encodeReference(result.reference, cidType).toString();
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -329,22 +329,31 @@ export function assertPostageBatchOptions(value) {
|
|
|
329
329
|
assertNonNegativeInteger(options.waitForUsableTimeout, 'options.waitForUsableTimeout');
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
export function
|
|
332
|
+
export function assertTransactionOptions(value, name = 'TransactionOptions') {
|
|
333
333
|
if (value === undefined) {
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
assertStrictlyObject(value);
|
|
337
|
+
assertStrictlyObject(value, name);
|
|
338
338
|
const options = value;
|
|
339
|
-
assertRequestOptions(options, 'PostageBatchOptions');
|
|
340
339
|
|
|
341
340
|
if (options === null || options === void 0 ? void 0 : options.gasLimit) {
|
|
342
|
-
assertNonNegativeInteger(options.gasLimit);
|
|
341
|
+
assertNonNegativeInteger(options.gasLimit, name);
|
|
343
342
|
}
|
|
344
343
|
|
|
345
344
|
if (options === null || options === void 0 ? void 0 : options.gasPrice) {
|
|
346
|
-
assertNonNegativeInteger(options.gasPrice);
|
|
345
|
+
assertNonNegativeInteger(options.gasPrice, name);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
export function assertCashoutOptions(value) {
|
|
349
|
+
if (value === undefined) {
|
|
350
|
+
return;
|
|
347
351
|
}
|
|
352
|
+
|
|
353
|
+
assertStrictlyObject(value);
|
|
354
|
+
const options = value;
|
|
355
|
+
assertRequestOptions(options, 'CashoutOptions');
|
|
356
|
+
assertTransactionOptions(options, 'CashoutOptions');
|
|
348
357
|
}
|
|
349
358
|
/**
|
|
350
359
|
* Check whether the given parameter is valid data to upload
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address, Peer, BalanceResponse, PeerBalance, ChequebookAddressResponse, ChequebookBalanceResponse, LastChequesResponse, LastChequesForPeerResponse, LastCashoutActionResponse, Settlements, AllSettlements, RemovePeerResponse, Topology, PingResponse, Health, NodeAddresses, ReserveState, ChainState, NumberString, ExtendedTag, PostageBatchBuckets, PostageBatch, TransactionInfo, TransactionHash, NodeInfo, BeeVersions, WalletBalance } from './types';
|
|
2
|
-
import { BatchId, BeeOptions, CashoutOptions, PostageBatchOptions, RequestOptions, Tag } from './types';
|
|
2
|
+
import { BatchId, BeeOptions, CashoutOptions, PostageBatchOptions, RequestOptions, Tag, TransactionOptions } from './types';
|
|
3
3
|
export declare class BeeDebug {
|
|
4
4
|
/**
|
|
5
5
|
* URL on which is the Debug API of Bee node exposed
|
|
@@ -117,6 +117,10 @@ export declare class BeeDebug {
|
|
|
117
117
|
* Get health of node
|
|
118
118
|
*/
|
|
119
119
|
getHealth(options?: RequestOptions): Promise<Health>;
|
|
120
|
+
/**
|
|
121
|
+
* Get readiness of node
|
|
122
|
+
*/
|
|
123
|
+
getReadiness(options?: RequestOptions): Promise<boolean>;
|
|
120
124
|
/**
|
|
121
125
|
* Get mode information of node
|
|
122
126
|
*/
|
|
@@ -285,6 +289,21 @@ export declare class BeeDebug {
|
|
|
285
289
|
* @param gasPrice
|
|
286
290
|
*/
|
|
287
291
|
cancelPendingTransaction(transactionHash: TransactionHash | string, gasPrice?: NumberString, options?: RequestOptions): Promise<TransactionHash>;
|
|
292
|
+
/**
|
|
293
|
+
* Gets the staked amount of BZZ (in PLUR unit) as number string.
|
|
294
|
+
*
|
|
295
|
+
* @param options
|
|
296
|
+
*/
|
|
297
|
+
getStake(options?: RequestOptions): Promise<NumberString>;
|
|
298
|
+
/**
|
|
299
|
+
* Deposits given amount of BZZ token (in PLUR unit).
|
|
300
|
+
*
|
|
301
|
+
* Be aware that staked BZZ tokens can **not** be withdrawn.
|
|
302
|
+
*
|
|
303
|
+
* @param amount Amount of BZZ token (in PLUR unit) to be staked. Minimum is 100_000_000_000_000_000 PLUR (10 BZZ).
|
|
304
|
+
* @param options
|
|
305
|
+
*/
|
|
306
|
+
depositStake(amount: NumberString, options?: RequestOptions & TransactionOptions): Promise<void>;
|
|
288
307
|
private waitForUsablePostageStamp;
|
|
289
308
|
private getKy;
|
|
290
309
|
}
|
package/dist/types/bee.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Index, IndexBytes } from './feed';
|
|
|
2
2
|
import { FeedType } from './feed/type';
|
|
3
3
|
import { EthAddress } from './utils/eth';
|
|
4
4
|
import type { AddressPrefix, AnyJson, BatchId, BeeOptions, CollectionUploadOptions, Data, FeedReader, FeedWriter, FileData, FileUploadOptions, JsonFeedOptions, Pin, PssMessageHandler, PssSubscription, PublicKey, Reference, Signer, SOCReader, SOCWriter, Tag, Topic, UploadOptions, UploadResultWithCid } from './types';
|
|
5
|
-
import { AllTagsOptions, Collection, Readable, ReferenceCidOrEns, ReferenceOrEns, RequestOptions, UploadResult } from './types';
|
|
5
|
+
import { AllTagsOptions, Collection, FeedManifestResult, Readable, ReferenceCidOrEns, ReferenceOrEns, RequestOptions, UploadResult } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* The main component that abstracts operations available on the main Bee API.
|
|
8
8
|
*
|
|
@@ -411,9 +411,8 @@ export declare class Bee {
|
|
|
411
411
|
*
|
|
412
412
|
* @see [Bee docs - Feeds](https://docs.ethswarm.org/docs/dapps-on-swarm/feeds)
|
|
413
413
|
* @see [Bee API reference - `POST /feeds`](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1{owner}~1{topic}/post)
|
|
414
|
-
* TODO: Once breaking add support for Feed CID
|
|
415
414
|
*/
|
|
416
|
-
createFeedManifest(postageBatchId: string | BatchId, type: FeedType, topic: Topic | Uint8Array | string, owner: EthAddress | Uint8Array | string, options?: RequestOptions): Promise<
|
|
415
|
+
createFeedManifest(postageBatchId: string | BatchId, type: FeedType, topic: Topic | Uint8Array | string, owner: EthAddress | Uint8Array | string, options?: RequestOptions): Promise<FeedManifestResult>;
|
|
417
416
|
/**
|
|
418
417
|
* Make a new feed reader for downloading feed updates.
|
|
419
418
|
*
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Ky, NumberString, TransactionOptions } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the staked amount
|
|
4
|
+
*
|
|
5
|
+
* @param ky Ky instance for given Bee class instance
|
|
6
|
+
*/
|
|
7
|
+
export declare function getStake(ky: Ky): Promise<NumberString>;
|
|
8
|
+
/**
|
|
9
|
+
* Stake given amount of tokens.
|
|
10
|
+
*
|
|
11
|
+
* @param ky
|
|
12
|
+
* @param amount
|
|
13
|
+
* @param options
|
|
14
|
+
*/
|
|
15
|
+
export declare function stake(ky: Ky, amount: NumberString, options?: TransactionOptions): Promise<void>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Health, NodeInfo } from '../../types/debug';
|
|
2
2
|
import { Ky } from '../../types';
|
|
3
3
|
import { BeeVersions } from '../../types/debug';
|
|
4
|
-
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.
|
|
5
|
-
export declare const SUPPORTED_API_VERSION = "3.0
|
|
6
|
-
export declare const SUPPORTED_DEBUG_API_VERSION = "2.0
|
|
4
|
+
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.9.0-13a47043";
|
|
5
|
+
export declare const SUPPORTED_API_VERSION = "3.2.0";
|
|
6
|
+
export declare const SUPPORTED_DEBUG_API_VERSION = "3.2.0";
|
|
7
7
|
export declare const SUPPORTED_BEE_VERSION: string;
|
|
8
8
|
/**
|
|
9
9
|
* Get health of node
|
|
@@ -11,6 +11,12 @@ export declare const SUPPORTED_BEE_VERSION: string;
|
|
|
11
11
|
* @param ky Ky debug instance
|
|
12
12
|
*/
|
|
13
13
|
export declare function getHealth(ky: Ky): Promise<Health>;
|
|
14
|
+
/**
|
|
15
|
+
* Get readiness of node
|
|
16
|
+
*
|
|
17
|
+
* @param ky Ky debug instance
|
|
18
|
+
*/
|
|
19
|
+
export declare function getReadiness(ky: Ky): Promise<boolean>;
|
|
14
20
|
/**
|
|
15
21
|
* Get information about Bee node
|
|
16
22
|
*
|
|
@@ -70,7 +70,7 @@ export interface ChequebookBalanceResponse {
|
|
|
70
70
|
totalBalance: NumberString;
|
|
71
71
|
availableBalance: NumberString;
|
|
72
72
|
}
|
|
73
|
-
export interface
|
|
73
|
+
export interface TransactionOptions {
|
|
74
74
|
/**
|
|
75
75
|
* Gas price for the cashout transaction in WEI
|
|
76
76
|
*/
|
|
@@ -80,6 +80,7 @@ export interface CashoutOptions extends RequestOptions {
|
|
|
80
80
|
*/
|
|
81
81
|
gasLimit?: NumberString;
|
|
82
82
|
}
|
|
83
|
+
export declare type CashoutOptions = TransactionOptions & RequestOptions;
|
|
83
84
|
export interface CashoutResult {
|
|
84
85
|
recipient: string;
|
|
85
86
|
lastPayout: NumberString;
|
|
@@ -161,11 +162,6 @@ export interface NodeInfo {
|
|
|
161
162
|
*/
|
|
162
163
|
swapEnabled: boolean;
|
|
163
164
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Information about Bee node and its configuration
|
|
166
|
-
* @deprecated Use NodeInfo instead
|
|
167
|
-
*/
|
|
168
|
-
export declare type NodesInfo = NodeInfo;
|
|
169
165
|
export interface RemovePeerResponse {
|
|
170
166
|
message: string;
|
|
171
167
|
code: 0;
|
|
@@ -173,8 +169,8 @@ export interface RemovePeerResponse {
|
|
|
173
169
|
export interface Bin {
|
|
174
170
|
population: number;
|
|
175
171
|
connected: number;
|
|
176
|
-
disconnectedPeers: Peer[]
|
|
177
|
-
connectedPeers: Peer[]
|
|
172
|
+
disconnectedPeers: Peer[];
|
|
173
|
+
connectedPeers: Peer[];
|
|
178
174
|
}
|
|
179
175
|
export interface Topology {
|
|
180
176
|
baseAddr: string;
|
|
@@ -124,7 +124,13 @@ export interface BeeOptions extends RequestOptions {
|
|
|
124
124
|
onResponse?: HookCallback<BeeResponse>;
|
|
125
125
|
}
|
|
126
126
|
export interface UploadResultWithCid extends UploadResult {
|
|
127
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Function that converts the reference into Swarm CIDs
|
|
129
|
+
*
|
|
130
|
+
* @throws TypeError if the reference is encrypted reference (eq. 128 chars long) which is not supported in CID
|
|
131
|
+
* @see https://github.com/ethersphere/swarm-cid-js
|
|
132
|
+
*/
|
|
133
|
+
cid: () => string;
|
|
128
134
|
}
|
|
129
135
|
/**
|
|
130
136
|
* Result of upload calls.
|
|
@@ -332,6 +338,21 @@ export declare const TOPIC_HEX_LENGTH = 64;
|
|
|
332
338
|
* Hex string of length 64 chars without prefix that specifies topics for feed.
|
|
333
339
|
*/
|
|
334
340
|
export declare type Topic = HexString<typeof TOPIC_HEX_LENGTH>;
|
|
341
|
+
/**
|
|
342
|
+
* Result of upload calls.
|
|
343
|
+
*/
|
|
344
|
+
export interface FeedManifestResult {
|
|
345
|
+
/**
|
|
346
|
+
* Reference of the uploaded data
|
|
347
|
+
*/
|
|
348
|
+
reference: Reference;
|
|
349
|
+
/**
|
|
350
|
+
* Function that converts the reference into Swarm Feed CID.
|
|
351
|
+
*
|
|
352
|
+
* @see https://github.com/ethersphere/swarm-cid-js
|
|
353
|
+
*/
|
|
354
|
+
cid: () => string;
|
|
355
|
+
}
|
|
335
356
|
/**
|
|
336
357
|
* FeedReader is an interface for downloading feed updates
|
|
337
358
|
*/
|
|
@@ -417,10 +438,6 @@ export interface PostageBatch {
|
|
|
417
438
|
batchTTL: number;
|
|
418
439
|
exists: boolean;
|
|
419
440
|
}
|
|
420
|
-
/**
|
|
421
|
-
* @deprecated Use PostageBatch instead.
|
|
422
|
-
*/
|
|
423
|
-
export declare type DebugPostageBatch = PostageBatch;
|
|
424
441
|
export interface BatchBucket {
|
|
425
442
|
bucketID: number;
|
|
426
443
|
collisions: number;
|
|
@@ -459,12 +476,12 @@ export interface PostageBatchOptions extends RequestOptions {
|
|
|
459
476
|
/**
|
|
460
477
|
* The returned Promise will await until the purchased Postage Batch is usable.
|
|
461
478
|
* In other word, it has to have enough block confirmations that Bee pronounce it usable.
|
|
462
|
-
*
|
|
479
|
+
* When turned on, this significantly prolongs the creation of postage batch!
|
|
480
|
+
*
|
|
463
481
|
* If you plan to use the stamp right away for some action with Bee (like uploading using this stamp) it is
|
|
464
482
|
* highly recommended to use this option, otherwise you might get errors "stamp not usable" from Bee.
|
|
465
483
|
*
|
|
466
|
-
*
|
|
467
|
-
* @default false
|
|
484
|
+
* @default true
|
|
468
485
|
*/
|
|
469
486
|
waitForUsable?: boolean;
|
|
470
487
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, AddressPrefix, AllTagsOptions, BatchId, CollectionUploadOptions, FileUploadOptions, NumberString, PssMessageHandler, PublicKey, Readable, Reference, Tag, UploadOptions, TransactionHash, RequestOptions, PostageBatchOptions, CashoutOptions, ReferenceOrEns,
|
|
1
|
+
import { Address, AddressPrefix, AllTagsOptions, BatchId, CollectionUploadOptions, FileUploadOptions, NumberString, PssMessageHandler, PublicKey, Readable, Reference, Tag, UploadOptions, TransactionHash, RequestOptions, PostageBatchOptions, CashoutOptions, ReferenceOrEns, TransactionOptions } from '../types';
|
|
2
2
|
import { ReferenceType } from '@ethersphere/swarm-cid';
|
|
3
3
|
export declare function isUint8Array(obj: unknown): obj is Uint8Array;
|
|
4
4
|
export declare function isInteger(value: unknown): value is number | NumberString;
|
|
@@ -38,7 +38,11 @@ export declare function makeReferenceOrEns(value: unknown, expectedCidType: Refe
|
|
|
38
38
|
* @param result
|
|
39
39
|
* @param cidType Type as described in the @ethersphere/swarm-cids-js -> ReferenceType
|
|
40
40
|
*/
|
|
41
|
-
export declare function addCidConversionFunction
|
|
41
|
+
export declare function addCidConversionFunction<T extends {
|
|
42
|
+
reference: string;
|
|
43
|
+
}>(result: T, cidType: ReferenceType): T & {
|
|
44
|
+
cid: () => string;
|
|
45
|
+
};
|
|
42
46
|
export declare function assertAddress(value: unknown): asserts value is Address;
|
|
43
47
|
export declare function assertBatchId(value: unknown): asserts value is BatchId;
|
|
44
48
|
export declare function assertRequestOptions(value: unknown, name?: string): asserts value is RequestOptions;
|
|
@@ -51,6 +55,7 @@ export declare function assertAddressPrefix(value: unknown): asserts value is Ad
|
|
|
51
55
|
export declare function assertPssMessageHandler(value: unknown): asserts value is PssMessageHandler;
|
|
52
56
|
export declare function assertPublicKey(value: unknown): asserts value is PublicKey;
|
|
53
57
|
export declare function assertPostageBatchOptions(value: unknown): asserts value is PostageBatchOptions;
|
|
58
|
+
export declare function assertTransactionOptions(value: unknown, name?: string): asserts value is TransactionOptions;
|
|
54
59
|
export declare function assertCashoutOptions(value: unknown): asserts value is CashoutOptions;
|
|
55
60
|
/**
|
|
56
61
|
* Check whether the given parameter is valid data to upload
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -77,18 +77,18 @@
|
|
|
77
77
|
"tar-js": "^0.3.0",
|
|
78
78
|
"utf-8-validate": "^5.0.9",
|
|
79
79
|
"web-streams-polyfill": "^4.0.0-beta.1",
|
|
80
|
-
"ws": "^8.
|
|
80
|
+
"ws": "^8.7.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@babel/cli": "^7.17.10",
|
|
84
|
-
"@babel/core": "^7.
|
|
84
|
+
"@babel/core": "^7.18.2",
|
|
85
85
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
86
86
|
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
87
87
|
"@babel/preset-env": "^7.17.10",
|
|
88
88
|
"@babel/preset-typescript": "^7.14.5",
|
|
89
|
-
"@commitlint/cli": "^
|
|
89
|
+
"@commitlint/cli": "^17.0.2",
|
|
90
90
|
"@commitlint/config-conventional": "^16.2.1",
|
|
91
|
-
"@ethersphere/bee-factory": "^0.
|
|
91
|
+
"@ethersphere/bee-factory": "^0.5.0",
|
|
92
92
|
"@fluffy-spoon/substitute": "^1.208.0",
|
|
93
93
|
"@jest/test-sequencer": "^27.5.0",
|
|
94
94
|
"@jest/types": "^27.5.1",
|
|
@@ -126,17 +126,17 @@
|
|
|
126
126
|
"puppeteer": "^14.1.0",
|
|
127
127
|
"rimraf": "^3.0.2",
|
|
128
128
|
"terser-webpack-plugin": "^5.3.1",
|
|
129
|
-
"ts-node": "^10.
|
|
129
|
+
"ts-node": "^10.8.0",
|
|
130
130
|
"typescript": "^4.5.4",
|
|
131
|
-
"webpack": "^5.72.
|
|
131
|
+
"webpack": "^5.72.1",
|
|
132
132
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
133
133
|
"webpack-cli": "^4.9.2"
|
|
134
134
|
},
|
|
135
135
|
"engines": {
|
|
136
|
-
"node": ">=
|
|
136
|
+
"node": ">=14.0.0",
|
|
137
137
|
"npm": ">=6.0.0",
|
|
138
|
-
"beeApiVersion": "3.0
|
|
139
|
-
"beeDebugApiVersion": "2.0
|
|
140
|
-
"bee": "1.
|
|
138
|
+
"beeApiVersion": "3.2.0",
|
|
139
|
+
"beeDebugApiVersion": "3.2.0",
|
|
140
|
+
"bee": "1.9.0-13a47043"
|
|
141
141
|
}
|
|
142
142
|
}
|