@ethersphere/bee-js 9.2.1 → 9.4.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/cjs/bee.js +7 -0
- package/dist/cjs/modules/rchash.js +15 -0
- package/dist/cjs/utils/bytes.js +3 -0
- package/dist/cjs/utils/duration.js +4 -0
- package/dist/cjs/utils/size.js +3 -0
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +7 -0
- package/dist/mjs/modules/rchash.js +15 -0
- package/dist/mjs/utils/bytes.js +3 -0
- package/dist/mjs/utils/duration.js +4 -0
- package/dist/mjs/utils/size.js +3 -0
- package/dist/types/bee.d.ts +4 -0
- package/dist/types/modules/rchash.d.ts +2 -0
- package/dist/types/utils/bytes.d.ts +1 -0
- package/dist/types/utils/duration.d.ts +1 -0
- package/dist/types/utils/size.d.ts +1 -0
- package/package.json +2 -2
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
|
+
}
|
package/dist/mjs/utils/bytes.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Dates } from 'cafe-utility';
|
|
1
2
|
export class Duration {
|
|
2
3
|
constructor(seconds) {
|
|
3
4
|
this.seconds = Math.ceil(seconds);
|
|
@@ -44,4 +45,7 @@ export class Duration {
|
|
|
44
45
|
toEndDate(startDate) {
|
|
45
46
|
return new Date((startDate ?? new Date()).getTime() + this.seconds * 1000);
|
|
46
47
|
}
|
|
48
|
+
represent() {
|
|
49
|
+
return Dates.secondsToHumanTime(this.seconds);
|
|
50
|
+
}
|
|
47
51
|
}
|
package/dist/mjs/utils/size.js
CHANGED
package/dist/types/bee.d.ts
CHANGED
|
@@ -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
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.0",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"axios": "^0.30.0",
|
|
65
|
-
"cafe-utility": "^
|
|
65
|
+
"cafe-utility": "^28.1.0",
|
|
66
66
|
"isomorphic-ws": "^4.0.1",
|
|
67
67
|
"semver": "^7.3.5",
|
|
68
68
|
"ws": "^8.7.0"
|