@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 +3 -0
- package/dist/cjs/bee.js +25 -1
- package/dist/cjs/modules/rchash.js +15 -0
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +25 -1
- package/dist/mjs/modules/rchash.js +15 -0
- package/dist/types/bee.d.ts +17 -0
- package/dist/types/modules/rchash.d.ts +2 -0
- package/package.json +1 -1
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
|
*
|
|
@@ -1276,14 +1283,31 @@ export class Bee {
|
|
|
1276
1283
|
*
|
|
1277
1284
|
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/develop/access-the-swarm/introduction/#keep-your-data-alive)
|
|
1278
1285
|
* @see [Bee Debug API reference - `GET /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get)
|
|
1286
|
+
* @deprecated Use `getPostageBatches` instead
|
|
1279
1287
|
*/
|
|
1280
1288
|
async getAllPostageBatch(options) {
|
|
1281
|
-
return stamps.getAllPostageBatches(this.getRequestOptionsForCall(options));
|
|
1289
|
+
return stamps.getAllPostageBatches(this.getRequestOptionsForCall(options)); // TODO: remove in June 2025
|
|
1282
1290
|
}
|
|
1283
1291
|
/**
|
|
1284
1292
|
* Return all globally available postage batches.
|
|
1293
|
+
* @deprecated Use `getGlobalPostageBatches` instead
|
|
1285
1294
|
*/
|
|
1286
1295
|
async getAllGlobalPostageBatch(options) {
|
|
1296
|
+
return stamps.getGlobalPostageBatches(this.getRequestOptionsForCall(options)); // TODO: remove in June 2025
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Return all postage batches that belong to the node.
|
|
1300
|
+
*
|
|
1301
|
+
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/develop/access-the-swarm/introduction/#keep-your-data-alive)
|
|
1302
|
+
* @see [Bee Debug API reference - `GET /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get)
|
|
1303
|
+
*/
|
|
1304
|
+
async getPostageBatches(options) {
|
|
1305
|
+
return stamps.getAllPostageBatches(this.getRequestOptionsForCall(options));
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Return all globally available postage batches.
|
|
1309
|
+
*/
|
|
1310
|
+
async getGlobalPostageBatches(options) {
|
|
1287
1311
|
return stamps.getGlobalPostageBatches(this.getRequestOptionsForCall(options));
|
|
1288
1312
|
}
|
|
1289
1313
|
/**
|
|
@@ -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/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
|
*
|
|
@@ -713,12 +717,25 @@ export declare class Bee {
|
|
|
713
717
|
*
|
|
714
718
|
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/develop/access-the-swarm/introduction/#keep-your-data-alive)
|
|
715
719
|
* @see [Bee Debug API reference - `GET /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get)
|
|
720
|
+
* @deprecated Use `getPostageBatches` instead
|
|
716
721
|
*/
|
|
717
722
|
getAllPostageBatch(options?: BeeRequestOptions): Promise<PostageBatch[]>;
|
|
718
723
|
/**
|
|
719
724
|
* Return all globally available postage batches.
|
|
725
|
+
* @deprecated Use `getGlobalPostageBatches` instead
|
|
720
726
|
*/
|
|
721
727
|
getAllGlobalPostageBatch(options?: BeeRequestOptions): Promise<GlobalPostageBatch[]>;
|
|
728
|
+
/**
|
|
729
|
+
* Return all postage batches that belong to the node.
|
|
730
|
+
*
|
|
731
|
+
* @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/develop/access-the-swarm/introduction/#keep-your-data-alive)
|
|
732
|
+
* @see [Bee Debug API reference - `GET /stamps`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get)
|
|
733
|
+
*/
|
|
734
|
+
getPostageBatches(options?: BeeRequestOptions): Promise<PostageBatch[]>;
|
|
735
|
+
/**
|
|
736
|
+
* Return all globally available postage batches.
|
|
737
|
+
*/
|
|
738
|
+
getGlobalPostageBatches(options?: BeeRequestOptions): Promise<GlobalPostageBatch[]>;
|
|
722
739
|
/**
|
|
723
740
|
* Return lists of all current pending transactions that the Bee made
|
|
724
741
|
*/
|