@ethersphere/bee-js 9.2.0 → 9.3.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 CHANGED
@@ -348,6 +348,9 @@ const bee = new Bee('http://localhost:1633', {
348
348
  Stay up to date by joining the [official Discord](https://discord.gg/GU22h2utj6) and by keeping an eye on the
349
349
  [releases tab](https://github.com/ethersphere/bee-js/releases).
350
350
 
351
+ We are using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for our commit messages and pull
352
+ requests, following the [Semantic Versioning](https://semver.org/) rules.
353
+
351
354
  There are some ways you can make this module better:
352
355
 
353
356
  - Consult our [open issues](https://github.com/ethersphere/bee-js/issues) and take on one of them
package/dist/cjs/bee.js CHANGED
@@ -47,6 +47,7 @@ const grantee = __importStar(require("./modules/grantee"));
47
47
  const gsoc = __importStar(require("./modules/gsoc"));
48
48
  const pinning = __importStar(require("./modules/pinning"));
49
49
  const pss = __importStar(require("./modules/pss"));
50
+ const rchash_1 = require("./modules/rchash");
50
51
  const status = __importStar(require("./modules/status"));
51
52
  const stewardship = __importStar(require("./modules/stewardship"));
52
53
  const tag = __importStar(require("./modules/tag"));
@@ -865,6 +866,12 @@ class Bee {
865
866
  reference = new typed_bytes_1.Reference(reference);
866
867
  return (0, envelope_1.postEnvelope)(this.getRequestOptionsForCall(options), postageBatchId, reference);
867
868
  }
869
+ /**
870
+ * Get reserve commitment hash duration seconds
871
+ */
872
+ async rchash(depth, anchor1, anchor2, options) {
873
+ return (0, rchash_1.rchash)(this.getRequestOptionsForCall(options), depth, anchor1, anchor2);
874
+ }
868
875
  /**
869
876
  * Ping the Bee node to see if there is a live Bee node on the given URL.
870
877
  *
@@ -1283,14 +1290,31 @@ class Bee {
1283
1290
  *
1284
1291
  * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/develop/access-the-swarm/introduction/#keep-your-data-alive)
1285
1292
  * @see [Bee Debug API reference - `GET /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get)
1293
+ * @deprecated Use `getPostageBatches` instead
1286
1294
  */
1287
1295
  async getAllPostageBatch(options) {
1288
- return stamps.getAllPostageBatches(this.getRequestOptionsForCall(options));
1296
+ return stamps.getAllPostageBatches(this.getRequestOptionsForCall(options)); // TODO: remove in June 2025
1289
1297
  }
1290
1298
  /**
1291
1299
  * Return all globally available postage batches.
1300
+ * @deprecated Use `getGlobalPostageBatches` instead
1292
1301
  */
1293
1302
  async getAllGlobalPostageBatch(options) {
1303
+ return stamps.getGlobalPostageBatches(this.getRequestOptionsForCall(options)); // TODO: remove in June 2025
1304
+ }
1305
+ /**
1306
+ * Return all postage batches that belong to the node.
1307
+ *
1308
+ * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/develop/access-the-swarm/introduction/#keep-your-data-alive)
1309
+ * @see [Bee Debug API reference - `GET /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get)
1310
+ */
1311
+ async getPostageBatches(options) {
1312
+ return stamps.getAllPostageBatches(this.getRequestOptionsForCall(options));
1313
+ }
1314
+ /**
1315
+ * Return all globally available postage batches.
1316
+ */
1317
+ async getGlobalPostageBatches(options) {
1294
1318
  return stamps.getGlobalPostageBatches(this.getRequestOptionsForCall(options));
1295
1319
  }
1296
1320
  /**
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rchash = void 0;
4
+ const cafe_utility_1 = require("cafe-utility");
5
+ const http_1 = require("../utils/http");
6
+ const RCHASH_ENDPOINT = 'rchash';
7
+ async function rchash(requestOptions, depth, anchor1, anchor2) {
8
+ const response = await (0, http_1.http)(requestOptions, {
9
+ responseType: 'json',
10
+ url: `${RCHASH_ENDPOINT}/${depth}/${anchor1}/${anchor2}`,
11
+ });
12
+ const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
13
+ return cafe_utility_1.Types.asNumber(body.durationSeconds, { name: 'durationSeconds' });
14
+ }
15
+ exports.rchash = rchash;