@ethersphere/bee-js 9.2.1 → 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/dist/mjs/bee.js CHANGED
@@ -21,6 +21,7 @@ import * as grantee from "./modules/grantee.js";
21
21
  import * as gsoc from "./modules/gsoc.js";
22
22
  import * as pinning from "./modules/pinning.js";
23
23
  import * as pss from "./modules/pss.js";
24
+ import { rchash } from "./modules/rchash.js";
24
25
  import * as status from "./modules/status.js";
25
26
  import * as stewardship from "./modules/stewardship.js";
26
27
  import * as tag from "./modules/tag.js";
@@ -837,6 +838,12 @@ export class Bee {
837
838
  reference = new Reference(reference);
838
839
  return postEnvelope(this.getRequestOptionsForCall(options), postageBatchId, reference);
839
840
  }
841
+ /**
842
+ * Get reserve commitment hash duration seconds
843
+ */
844
+ async rchash(depth, anchor1, anchor2, options) {
845
+ return rchash(this.getRequestOptionsForCall(options), depth, anchor1, anchor2);
846
+ }
840
847
  /**
841
848
  * Ping the Bee node to see if there is a live Bee node on the given URL.
842
849
  *
@@ -0,0 +1,15 @@
1
+ import { Types } from 'cafe-utility';
2
+ import { http } from "../utils/http.js";
3
+ const RCHASH_ENDPOINT = 'rchash';
4
+ export async function rchash(requestOptions, depth, anchor1, anchor2) {
5
+ const response = await http(requestOptions, {
6
+ responseType: 'json',
7
+ url: `${RCHASH_ENDPOINT}/${depth}/${anchor1}/${anchor2}`
8
+ });
9
+ const body = Types.asObject(response.data, {
10
+ name: 'response.data'
11
+ });
12
+ return Types.asNumber(body.durationSeconds, {
13
+ name: 'durationSeconds'
14
+ });
15
+ }
@@ -479,6 +479,10 @@ export declare class Bee {
479
479
  */
480
480
  makeSOCWriter(signer?: PrivateKey | Uint8Array | string, options?: BeeRequestOptions): SOCWriter;
481
481
  createEnvelope(postageBatchId: BatchId | Uint8Array | string, reference: Reference | Uint8Array | string, options?: BeeRequestOptions): Promise<EnvelopeWithBatchId>;
482
+ /**
483
+ * Get reserve commitment hash duration seconds
484
+ */
485
+ rchash(depth: number, anchor1: string, anchor2: string, options?: BeeRequestOptions): Promise<number>;
482
486
  /**
483
487
  * Ping the Bee node to see if there is a live Bee node on the given URL.
484
488
  *
@@ -0,0 +1,2 @@
1
+ import type { BeeRequestOptions } from '../types';
2
+ export declare function rchash(requestOptions: BeeRequestOptions, depth: number, anchor1: string, anchor2: string): Promise<number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethersphere/bee-js",
3
- "version": "9.2.1",
3
+ "version": "9.3.0",
4
4
  "description": "Javascript client for Bee",
5
5
  "keywords": [
6
6
  "bee",