@ethersphere/bee-js 8.3.1 → 9.0.2

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.
Files changed (224) hide show
  1. package/README.md +192 -50
  2. package/dist/cjs/bee-dev.js +78 -0
  3. package/dist/cjs/bee.js +341 -417
  4. package/dist/cjs/chunk/bmt.js +15 -32
  5. package/dist/cjs/chunk/cac.js +26 -36
  6. package/dist/cjs/chunk/soc.js +56 -51
  7. package/dist/cjs/feed/identifier.js +3 -28
  8. package/dist/cjs/feed/index.js +95 -44
  9. package/dist/cjs/feed/retrievable.js +11 -22
  10. package/dist/cjs/index.js +17 -1
  11. package/dist/cjs/manifest/manifest.js +369 -0
  12. package/dist/cjs/modules/bytes.js +24 -12
  13. package/dist/cjs/modules/bzz.js +24 -34
  14. package/dist/cjs/modules/chunk.js +13 -7
  15. package/dist/cjs/modules/debug/balance.js +29 -4
  16. package/dist/cjs/modules/debug/chequebook.js +60 -16
  17. package/dist/cjs/modules/debug/connectivity.js +82 -4
  18. package/dist/cjs/modules/debug/settlements.js +22 -2
  19. package/dist/cjs/modules/debug/stake.js +29 -11
  20. package/dist/cjs/modules/debug/stamps.js +88 -7
  21. package/dist/cjs/modules/debug/states.js +25 -3
  22. package/dist/cjs/modules/debug/status.js +45 -47
  23. package/dist/cjs/modules/debug/transactions.js +27 -5
  24. package/dist/cjs/modules/envelope.js +8 -6
  25. package/dist/cjs/modules/feed.js +25 -10
  26. package/dist/cjs/modules/grantee.js +18 -12
  27. package/dist/cjs/modules/gsoc.js +24 -0
  28. package/dist/cjs/modules/pinning.js +13 -2
  29. package/dist/cjs/modules/pss.js +9 -3
  30. package/dist/cjs/modules/soc.js +9 -4
  31. package/dist/cjs/modules/stewardship.js +7 -3
  32. package/dist/cjs/modules/tag.js +35 -3
  33. package/dist/cjs/package.json +1 -0
  34. package/dist/cjs/stamper/stamper.js +43 -0
  35. package/dist/cjs/types/debug.js +16 -1
  36. package/dist/cjs/types/index.js +2 -24
  37. package/dist/cjs/utils/bytes.js +67 -115
  38. package/dist/cjs/utils/chunk-size.js +17 -0
  39. package/dist/cjs/utils/chunk-stream.browser.js +85 -0
  40. package/dist/cjs/utils/chunk-stream.js +84 -0
  41. package/dist/cjs/utils/cid.js +5 -6
  42. package/dist/cjs/utils/collection.browser.js +2 -2
  43. package/dist/cjs/utils/collection.js +3 -2
  44. package/dist/cjs/utils/collection.node.js +0 -2
  45. package/dist/cjs/utils/constants.js +7 -3
  46. package/dist/cjs/utils/data.browser.js +6 -3
  47. package/dist/cjs/utils/data.js +8 -4
  48. package/dist/cjs/utils/duration.js +51 -0
  49. package/dist/cjs/utils/expose.js +11 -40
  50. package/dist/cjs/utils/headers.js +79 -52
  51. package/dist/cjs/utils/http.js +34 -10
  52. package/dist/cjs/utils/mime.js +78 -0
  53. package/dist/cjs/utils/pss.js +3 -4
  54. package/dist/cjs/utils/redundancy.js +18 -14
  55. package/dist/cjs/utils/resource-locator.js +17 -0
  56. package/dist/cjs/utils/size.js +35 -0
  57. package/dist/cjs/utils/stamps.js +67 -51
  58. package/dist/cjs/utils/tar-uploader.browser.js +2 -2
  59. package/dist/cjs/utils/tar-uploader.js +2 -2
  60. package/dist/cjs/utils/tokens.js +144 -0
  61. package/dist/cjs/utils/type.js +142 -350
  62. package/dist/cjs/utils/typed-bytes.js +179 -0
  63. package/dist/cjs/utils/upload-progress.js +2 -0
  64. package/dist/cjs/utils/url.js +0 -4
  65. package/dist/cjs/utils/workaround.js +27 -0
  66. package/dist/index.browser.min.js +1 -2
  67. package/dist/index.browser.min.js.map +1 -1
  68. package/dist/mjs/bee-dev.js +98 -0
  69. package/dist/mjs/bee.js +367 -411
  70. package/dist/mjs/chunk/bmt.js +13 -29
  71. package/dist/mjs/chunk/cac.js +26 -34
  72. package/dist/mjs/chunk/soc.js +57 -53
  73. package/dist/mjs/feed/identifier.js +3 -26
  74. package/dist/mjs/feed/index.js +98 -51
  75. package/dist/mjs/feed/retrievable.js +12 -23
  76. package/dist/mjs/index.js +10 -1
  77. package/dist/mjs/manifest/manifest.js +371 -0
  78. package/dist/mjs/modules/bytes.js +27 -15
  79. package/dist/mjs/modules/bzz.js +25 -32
  80. package/dist/mjs/modules/chunk.js +16 -8
  81. package/dist/mjs/modules/debug/balance.js +61 -4
  82. package/dist/mjs/modules/debug/chequebook.js +116 -16
  83. package/dist/mjs/modules/debug/connectivity.js +144 -3
  84. package/dist/mjs/modules/debug/settlements.js +46 -2
  85. package/dist/mjs/modules/debug/stake.js +69 -11
  86. package/dist/mjs/modules/debug/stamps.js +184 -7
  87. package/dist/mjs/modules/debug/states.js +55 -3
  88. package/dist/mjs/modules/debug/status.js +97 -45
  89. package/dist/mjs/modules/debug/transactions.js +61 -5
  90. package/dist/mjs/modules/envelope.js +11 -9
  91. package/dist/mjs/modules/feed.js +26 -10
  92. package/dist/mjs/modules/grantee.js +35 -13
  93. package/dist/mjs/modules/gsoc.js +16 -0
  94. package/dist/mjs/modules/pinning.js +23 -2
  95. package/dist/mjs/modules/pss.js +10 -4
  96. package/dist/mjs/modules/soc.js +10 -5
  97. package/dist/mjs/modules/stewardship.js +14 -4
  98. package/dist/mjs/modules/tag.js +93 -3
  99. package/dist/mjs/package.json +2 -1
  100. package/dist/mjs/stamper/stamper.js +39 -0
  101. package/dist/mjs/types/debug.js +15 -1
  102. package/dist/mjs/types/index.js +2 -24
  103. package/dist/mjs/utils/bytes.js +63 -104
  104. package/dist/mjs/utils/chunk-size.js +13 -0
  105. package/dist/mjs/utils/chunk-stream.browser.js +85 -0
  106. package/dist/mjs/utils/chunk-stream.js +87 -0
  107. package/dist/mjs/utils/cid.js +5 -6
  108. package/dist/mjs/utils/collection.browser.js +2 -2
  109. package/dist/mjs/utils/collection.js +2 -2
  110. package/dist/mjs/utils/collection.node.js +0 -2
  111. package/dist/mjs/utils/constants.js +6 -2
  112. package/dist/mjs/utils/data.browser.js +9 -3
  113. package/dist/mjs/utils/data.js +12 -4
  114. package/dist/mjs/utils/duration.js +47 -0
  115. package/dist/mjs/utils/expose.js +2 -7
  116. package/dist/mjs/utils/headers.js +73 -48
  117. package/dist/mjs/utils/http.js +33 -11
  118. package/dist/mjs/utils/mime.js +75 -0
  119. package/dist/mjs/utils/pss.js +3 -4
  120. package/dist/mjs/utils/redundancy.js +18 -8
  121. package/dist/mjs/utils/resource-locator.js +13 -0
  122. package/dist/mjs/utils/size.js +31 -0
  123. package/dist/mjs/utils/stamps.js +47 -44
  124. package/dist/mjs/utils/tar-uploader.browser.js +2 -2
  125. package/dist/mjs/utils/tar-uploader.js +2 -2
  126. package/dist/mjs/utils/tokens.js +139 -0
  127. package/dist/mjs/utils/type.js +216 -310
  128. package/dist/mjs/utils/typed-bytes.js +160 -0
  129. package/dist/mjs/utils/upload-progress.js +1 -0
  130. package/dist/mjs/utils/url.js +0 -4
  131. package/dist/mjs/utils/workaround.js +22 -0
  132. package/dist/types/bee-dev.d.ts +5 -0
  133. package/dist/types/bee.d.ts +88 -165
  134. package/dist/types/chunk/bmt.d.ts +2 -2
  135. package/dist/types/chunk/cac.d.ts +7 -24
  136. package/dist/types/chunk/soc.d.ts +15 -15
  137. package/dist/types/feed/identifier.d.ts +2 -4
  138. package/dist/types/feed/index.d.ts +14 -18
  139. package/dist/types/feed/retrievable.d.ts +3 -4
  140. package/dist/types/index.d.ts +28 -1
  141. package/dist/types/manifest/manifest.d.ts +106 -0
  142. package/dist/types/modules/bytes.d.ts +8 -5
  143. package/dist/types/modules/bzz.d.ts +8 -10
  144. package/dist/types/modules/chunk.d.ts +4 -3
  145. package/dist/types/modules/debug/balance.d.ts +3 -2
  146. package/dist/types/modules/debug/chequebook.d.ts +7 -6
  147. package/dist/types/modules/debug/connectivity.d.ts +5 -3
  148. package/dist/types/modules/debug/settlements.d.ts +2 -1
  149. package/dist/types/modules/debug/stake.d.ts +4 -2
  150. package/dist/types/modules/debug/stamps.d.ts +5 -4
  151. package/dist/types/modules/debug/status.d.ts +6 -25
  152. package/dist/types/modules/debug/transactions.d.ts +5 -4
  153. package/dist/types/modules/envelope.d.ts +3 -2
  154. package/dist/types/modules/feed.d.ts +20 -16
  155. package/dist/types/modules/grantee.d.ts +7 -6
  156. package/dist/types/modules/gsoc.d.ts +7 -0
  157. package/dist/types/modules/pinning.d.ts +2 -4
  158. package/dist/types/modules/pss.d.ts +4 -3
  159. package/dist/types/modules/soc.d.ts +3 -2
  160. package/dist/types/modules/stewardship.d.ts +4 -4
  161. package/dist/types/modules/tag.d.ts +2 -1
  162. package/dist/types/stamper/stamper.d.ts +15 -0
  163. package/dist/types/types/debug.d.ts +63 -115
  164. package/dist/types/types/index.d.ts +103 -204
  165. package/dist/types/utils/bytes.d.ts +16 -90
  166. package/dist/types/utils/chunk-size.d.ts +1 -0
  167. package/dist/types/utils/chunk-stream.browser.d.ts +6 -0
  168. package/dist/types/utils/chunk-stream.d.ts +6 -0
  169. package/dist/types/utils/cid.d.ts +3 -2
  170. package/dist/types/utils/collection.browser.d.ts +2 -2
  171. package/dist/types/utils/collection.d.ts +2 -1
  172. package/dist/types/utils/collection.node.d.ts +0 -1
  173. package/dist/types/utils/constants.d.ts +4 -1
  174. package/dist/types/utils/duration.d.ts +17 -0
  175. package/dist/types/utils/error.d.ts +2 -2
  176. package/dist/types/utils/expose.d.ts +2 -7
  177. package/dist/types/utils/headers.d.ts +3 -4
  178. package/dist/types/utils/mime.d.ts +1 -0
  179. package/dist/types/utils/pss.d.ts +2 -2
  180. package/dist/types/utils/resource-locator.d.ts +6 -0
  181. package/dist/types/utils/size.d.ts +16 -0
  182. package/dist/types/utils/stamps.d.ts +27 -33
  183. package/dist/types/utils/tar-uploader.browser.d.ts +3 -4
  184. package/dist/types/utils/tar-uploader.d.ts +3 -4
  185. package/dist/types/utils/tokens.d.ts +77 -0
  186. package/dist/types/utils/type.d.ts +20 -52
  187. package/dist/types/utils/typed-bytes.d.ts +68 -0
  188. package/dist/types/utils/upload-progress.d.ts +4 -0
  189. package/dist/types/utils/workaround.d.ts +2 -0
  190. package/package.json +11 -17
  191. package/dist/cjs/chunk/signer.js +0 -126
  192. package/dist/cjs/chunk/span.js +0 -25
  193. package/dist/cjs/feed/json.js +0 -28
  194. package/dist/cjs/feed/topic.js +0 -25
  195. package/dist/cjs/feed/type.js +0 -15
  196. package/dist/cjs/modules/debug/chunk.js +0 -21
  197. package/dist/cjs/modules/debug/tag.js +0 -19
  198. package/dist/cjs/utils/eth.js +0 -216
  199. package/dist/cjs/utils/hash.js +0 -21
  200. package/dist/cjs/utils/hex.js +0 -150
  201. package/dist/cjs/utils/reference.js +0 -36
  202. package/dist/index.browser.min.js.LICENSE.txt +0 -8
  203. package/dist/mjs/chunk/signer.js +0 -114
  204. package/dist/mjs/chunk/span.js +0 -21
  205. package/dist/mjs/feed/json.js +0 -26
  206. package/dist/mjs/feed/topic.js +0 -19
  207. package/dist/mjs/feed/type.js +0 -10
  208. package/dist/mjs/modules/debug/chunk.js +0 -17
  209. package/dist/mjs/modules/debug/tag.js +0 -15
  210. package/dist/mjs/utils/eth.js +0 -192
  211. package/dist/mjs/utils/hash.js +0 -16
  212. package/dist/mjs/utils/hex.js +0 -135
  213. package/dist/mjs/utils/reference.js +0 -29
  214. package/dist/types/chunk/signer.d.ts +0 -31
  215. package/dist/types/chunk/span.d.ts +0 -10
  216. package/dist/types/feed/json.d.ts +0 -4
  217. package/dist/types/feed/topic.d.ts +0 -3
  218. package/dist/types/feed/type.d.ts +0 -6
  219. package/dist/types/modules/debug/chunk.d.ts +0 -10
  220. package/dist/types/modules/debug/tag.d.ts +0 -8
  221. package/dist/types/utils/eth.d.ts +0 -67
  222. package/dist/types/utils/hash.d.ts +0 -9
  223. package/dist/types/utils/hex.d.ts +0 -86
  224. package/dist/types/utils/reference.d.ts +0 -2
@@ -1,9 +1,9 @@
1
1
  import { BeeRequestOptions } from '../../index';
2
- import type { DebugStatus, Health, NodeInfo } from '../../types/debug';
2
+ import type { DebugStatus, Health, NodeInfo, Readiness } from '../../types/debug';
3
3
  import { BeeVersions } from '../../types/debug';
4
- export declare const SUPPORTED_BEE_VERSION_EXACT = "2.2.0-06a0aca7";
5
- export declare const SUPPORTED_API_VERSION = "7.1.0";
4
+ export declare const SUPPORTED_BEE_VERSION_EXACT = "2.4.0-390a402e";
6
5
  export declare const SUPPORTED_BEE_VERSION: string;
6
+ export declare const SUPPORTED_API_VERSION = "7.2.0";
7
7
  export declare function getDebugStatus(requestOptions: BeeRequestOptions): Promise<DebugStatus>;
8
8
  /**
9
9
  * Get health of node
@@ -16,41 +16,22 @@ export declare function getHealth(requestOptions: BeeRequestOptions): Promise<He
16
16
  *
17
17
  * @param requestOptions Options for making requests
18
18
  */
19
- export declare function getReadiness(requestOptions: BeeRequestOptions): Promise<boolean>;
19
+ export declare function getReadiness(requestOptions: BeeRequestOptions): Promise<Readiness>;
20
20
  /**
21
21
  * Get information about Bee node
22
22
  *
23
23
  * @param requestOptions Options for making requests
24
24
  */
25
25
  export declare function getNodeInfo(requestOptions: BeeRequestOptions): Promise<NodeInfo>;
26
- /**
27
- * Connects to a node and checks if it is a supported Bee version by the bee-js
28
- *
29
- * @param requestOptions Options for making requests
30
- * @returns true if the Bee node version is supported
31
- * @deprecated Use `isSupportedExactVersion` instead
32
- */
33
- export declare function isSupportedVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
34
26
  /**
35
27
  * Connects to a node and checks if its version matches with the one that bee-js supports.
36
28
  *
37
- * Be aware that this is the most strict version check and most probably
38
- * you will want to use more relaxed API-versions based checks like
39
- * `isSupportedApiVersion`, `isSupportedMainApiVersion` or `isSupportedDebugApiVersion`
40
- * based on your use-case.
29
+ * This is the most strict version check and most probably you will
30
+ * want to use the relaxed API-versions check `isSupportedApiVersion`.
41
31
  *
42
32
  * @param requestOptions Options for making requests
43
33
  */
44
34
  export declare function isSupportedExactVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
45
- /**
46
- * Connects to a node and checks if its main's API version matches with the one that bee-js supports.
47
- *
48
- * This is useful if you are not using `Bee` class (for anything else then this check)
49
- * and want to make sure about compatibility.
50
- *
51
- * @param requestOptions Options for making requests
52
- */
53
- export declare function isSupportedMainApiVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
54
35
  /**
55
36
  * Connects to a node and checks if its Main API versions matches with the one that bee-js supports.
56
37
  *
@@ -1,4 +1,5 @@
1
- import { BeeRequestOptions, NumberString, TransactionHash, TransactionInfo } from '../../types';
1
+ import { BeeRequestOptions, NumberString, TransactionInfo } from '../../types';
2
+ import { TransactionId } from '../../utils/typed-bytes';
2
3
  /**
3
4
  * Get list of all pending transactions
4
5
  *
@@ -11,14 +12,14 @@ export declare function getAllTransactions(requestOptions: BeeRequestOptions): P
11
12
  * @param requestOptions Options for making requests
12
13
  * @param transactionHash Hash of the transaction
13
14
  */
14
- export declare function getTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionHash): Promise<TransactionInfo>;
15
+ export declare function getTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionId): Promise<TransactionInfo>;
15
16
  /**
16
17
  * Rebroadcast existing transaction
17
18
  *
18
19
  * @param requestOptions Options for making requests
19
20
  * @param transactionHash Hash of the transaction
20
21
  */
21
- export declare function rebroadcastTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionHash): Promise<TransactionHash>;
22
+ export declare function rebroadcastTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionId): Promise<TransactionId>;
22
23
  /**
23
24
  * Cancel existing transaction
24
25
  *
@@ -26,4 +27,4 @@ export declare function rebroadcastTransaction(requestOptions: BeeRequestOptions
26
27
  * @param transactionHash Hash of the transaction
27
28
  * @param gasPrice Optional gas price
28
29
  */
29
- export declare function cancelTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionHash, gasPrice?: NumberString): Promise<TransactionHash>;
30
+ export declare function cancelTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionId, gasPrice?: NumberString | string | bigint): Promise<TransactionId>;
@@ -1,2 +1,3 @@
1
- import type { BatchId, BeeRequestOptions, Envelope, Reference } from '../types';
2
- export declare function postEnvelope(requestOptions: BeeRequestOptions, postageBatchId: BatchId, reference: Reference): Promise<Envelope>;
1
+ import type { BeeRequestOptions, EnvelopeWithBatchId } from '../types';
2
+ import { BatchId, Reference } from '../utils/typed-bytes';
3
+ export declare function postEnvelope(requestOptions: BeeRequestOptions, postageBatchId: BatchId, reference: Reference): Promise<EnvelopeWithBatchId>;
@@ -1,33 +1,36 @@
1
- import { Index } from '../feed';
2
- import { FeedType } from '../feed/type';
3
- import { BatchId, BeeRequestOptions, Reference, ReferenceResponse, Topic } from '../types';
4
- import { HexEthAddress } from '../utils/eth';
5
- export interface CreateFeedOptions {
6
- type?: FeedType;
7
- }
1
+ import { BeeRequestOptions, UploadOptions } from '../types';
2
+ import { Bytes } from '../utils/bytes';
3
+ import { BatchId, EthAddress, FeedIndex, Reference, Topic } from '../utils/typed-bytes';
8
4
  export interface FeedUpdateOptions {
9
5
  /**
10
6
  * Specifies the start date as unix time stamp
11
7
  */
12
8
  at?: number;
13
- type?: FeedType;
14
9
  /**
15
10
  * Fetch specific previous Feed's update (default fetches latest update)
16
11
  */
17
- index?: Index;
12
+ index?: FeedIndex | number;
13
+ /**
14
+ * Whether the first 8 bytes of the payload are a timestamp
15
+ */
16
+ hasTimestamp?: boolean;
18
17
  }
19
18
  interface FeedUpdateHeaders {
20
19
  /**
21
20
  * The current feed's index
22
21
  */
23
- feedIndex: Index;
22
+ feedIndex: FeedIndex;
24
23
  /**
25
24
  * The feed's index for next update.
26
25
  * Only set for the latest update. If update is fetched using previous index, then this is an empty string.
27
26
  */
28
- feedIndexNext: string;
27
+ feedIndexNext?: FeedIndex;
28
+ }
29
+ export interface FeedPayloadResult extends FeedUpdateHeaders {
30
+ payload: Bytes;
29
31
  }
30
- export interface FetchFeedUpdateResponse extends ReferenceResponse, FeedUpdateHeaders {
32
+ export interface FeedReferenceResult extends FeedUpdateHeaders {
33
+ reference: Reference;
31
34
  }
32
35
  /**
33
36
  * Create an initial feed root manifest
@@ -38,7 +41,7 @@ export interface FetchFeedUpdateResponse extends ReferenceResponse, FeedUpdateHe
38
41
  * @param postageBatchId Postage BatchId to be used to create the Feed Manifest
39
42
  * @param options Additional options, like type (default: 'sequence')
40
43
  */
41
- export declare function createFeedManifest(requestOptions: BeeRequestOptions, owner: HexEthAddress, topic: Topic, stamp: BatchId | Uint8Array | string): Promise<Reference>;
44
+ export declare function createFeedManifest(requestOptions: BeeRequestOptions, owner: EthAddress, topic: Topic, stamp: BatchId | Uint8Array | string, options?: UploadOptions): Promise<Reference>;
42
45
  /**
43
46
  * Find and retrieve feed update
44
47
  *
@@ -48,9 +51,10 @@ export declare function createFeedManifest(requestOptions: BeeRequestOptions, ow
48
51
  * index of the subsequent update.
49
52
  *
50
53
  * @param requestOptions Options for making requests
51
- * @param owner Owner's ethereum address in hex
52
- * @param topic Topic in hex
54
+ * @param owner Owner's ethereum address
55
+ * @param topic Topic
53
56
  * @param options Additional options, like index, at, type
54
57
  */
55
- export declare function fetchLatestFeedUpdate(requestOptions: BeeRequestOptions, owner: HexEthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<FetchFeedUpdateResponse>;
58
+ export declare function fetchLatestFeedUpdate(requestOptions: BeeRequestOptions, owner: EthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<FeedPayloadResult>;
59
+ export declare function probeFeed(requestOptions: BeeRequestOptions, owner: EthAddress, topic: Topic): Promise<FeedUpdateHeaders>;
56
60
  export {};
@@ -1,7 +1,8 @@
1
- import { BatchId, BeeRequestOptions, GetGranteesResult, GranteesResult } from '../types';
2
- export declare function getGrantees(reference: string, requestOptions: BeeRequestOptions): Promise<GetGranteesResult>;
3
- export declare function createGrantees(requestOptions: BeeRequestOptions, postageBatchId: BatchId, grantees: string[]): Promise<GranteesResult>;
4
- export declare function patchGrantees(postageBatchId: BatchId, reference: string, historyRef: string, grantees: {
5
- add?: string[];
6
- revoke?: string[];
1
+ import { BeeRequestOptions, GetGranteesResult, GranteesResult } from '../types';
2
+ import { BatchId, PublicKey, Reference } from '../utils/typed-bytes';
3
+ export declare function getGrantees(reference: Reference, requestOptions: BeeRequestOptions): Promise<GetGranteesResult>;
4
+ export declare function createGrantees(requestOptions: BeeRequestOptions, postageBatchId: BatchId, grantees: PublicKey[]): Promise<GranteesResult>;
5
+ export declare function patchGrantees(postageBatchId: BatchId, reference: Reference, historyRef: Reference, grantees: {
6
+ add?: PublicKey[];
7
+ revoke?: PublicKey[];
7
8
  }, requestOptions: BeeRequestOptions): Promise<GranteesResult>;
@@ -0,0 +1,7 @@
1
+ /// <reference types="ws" />
2
+ import WebSocket from 'isomorphic-ws';
3
+ import { BeeRequestOptions, UploadOptions } from '..';
4
+ import { SingleOwnerChunk } from '../chunk/soc';
5
+ import { BatchId, Reference } from '../utils/typed-bytes';
6
+ export declare function send(requestOptions: BeeRequestOptions, soc: SingleOwnerChunk, stamp: BatchId, options?: UploadOptions): Promise<import("..").UploadResult>;
7
+ export declare function subscribe(url: string, reference: Reference, headers?: Record<string, string>): WebSocket;
@@ -1,7 +1,5 @@
1
- import type { BeeRequestOptions, Pin, Reference } from '../types';
2
- export interface GetAllPinResponse {
3
- references: Reference[];
4
- }
1
+ import type { BeeRequestOptions, Pin } from '../types';
2
+ import { Reference } from '../utils/typed-bytes';
5
3
  /**
6
4
  * Pin data with given reference
7
5
  *
@@ -1,6 +1,7 @@
1
1
  /// <reference types="ws" />
2
2
  import WebSocket from 'isomorphic-ws';
3
- import type { BatchId, BeeRequestOptions, PublicKey } from '../types';
3
+ import type { BeeRequestOptions } from '../types';
4
+ import { BatchId, PublicKey, Topic } from '../utils/typed-bytes';
4
5
  /**
5
6
  * Send to recipient or target with Postal Service for Swarm
6
7
  *
@@ -12,11 +13,11 @@ import type { BatchId, BeeRequestOptions, PublicKey } from '../types';
12
13
  * @param recipient Recipient public key
13
14
  *
14
15
  */
15
- export declare function send(requestOptions: BeeRequestOptions, topic: string, target: string, data: string | Uint8Array, postageBatchId: BatchId, recipient?: PublicKey): Promise<void>;
16
+ export declare function send(requestOptions: BeeRequestOptions, topic: Topic, target: string, data: string | Uint8Array, postageBatchId: BatchId, recipient?: PublicKey): Promise<void>;
16
17
  /**
17
18
  * Subscribe for messages on the given topic
18
19
  *
19
20
  * @param url Bee node URL
20
21
  * @param topic Topic name
21
22
  */
22
- export declare function subscribe(url: string, topic: string): WebSocket;
23
+ export declare function subscribe(url: string, topic: Topic, headers?: Record<string, string>): WebSocket;
@@ -1,4 +1,5 @@
1
- import { BatchId, BeeRequestOptions, UploadOptions, UploadResult } from '../types';
1
+ import { BeeRequestOptions, UploadOptions, UploadResult } from '../types';
2
+ import { BatchId, EthAddress, Identifier, Signature } from '../utils/typed-bytes';
2
3
  /**
3
4
  * Upload single owner chunk (SOC) to a Bee node
4
5
  *
@@ -10,4 +11,4 @@ import { BatchId, BeeRequestOptions, UploadOptions, UploadResult } from '../type
10
11
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
11
12
  * @param options Additional options like tag, encryption, pinning
12
13
  */
13
- export declare function upload(requestOptions: BeeRequestOptions, owner: string, identifier: string, signature: string, data: Uint8Array, stamp: BatchId | Uint8Array | string, options?: UploadOptions): Promise<UploadResult>;
14
+ export declare function upload(requestOptions: BeeRequestOptions, owner: EthAddress, identifier: Identifier, signature: Signature, data: Uint8Array, stamp: BatchId | Uint8Array | string, options?: UploadOptions): Promise<UploadResult>;
@@ -1,10 +1,10 @@
1
- import type { BeeRequestOptions, ReferenceOrEns } from '../types';
1
+ import type { BeeRequestOptions } from '../types';
2
+ import { BatchId, Reference } from '../utils/typed-bytes';
2
3
  /**
3
4
  * Reupload locally pinned data
4
5
  * @param requestOptions Options for making requests
5
6
  * @param reference
6
- * @param options
7
7
  * @throws BeeResponseError if not locally pinned or invalid data
8
8
  */
9
- export declare function reupload(requestOptions: BeeRequestOptions, reference: ReferenceOrEns): Promise<void>;
10
- export declare function isRetrievable(requestOptions: BeeRequestOptions, reference: ReferenceOrEns): Promise<boolean>;
9
+ export declare function reupload(requestOptions: BeeRequestOptions, stamp: BatchId, reference: Reference): Promise<void>;
10
+ export declare function isRetrievable(requestOptions: BeeRequestOptions, reference: Reference | Uint8Array | string): Promise<boolean>;
@@ -1,4 +1,5 @@
1
- import { BeeRequestOptions, Reference, Tag } from '../types';
1
+ import { BeeRequestOptions, Tag } from '../types';
2
+ import { Reference } from '../utils/typed-bytes';
2
3
  /**
3
4
  * Create new tag on the Bee node
4
5
  *
@@ -0,0 +1,15 @@
1
+ import { Chunk } from 'cafe-utility';
2
+ import { EnvelopeWithBatchId } from '../types';
3
+ import { BatchId, PrivateKey } from '../utils/typed-bytes';
4
+ export declare class Stamper {
5
+ signer: PrivateKey;
6
+ batchId: BatchId;
7
+ buckets: Uint32Array;
8
+ depth: number;
9
+ maxSlot: number;
10
+ private constructor();
11
+ static fromBlank(signer: PrivateKey | Uint8Array | string, batchId: BatchId | Uint8Array | string, depth: number): Stamper;
12
+ static fromState(signer: PrivateKey | Uint8Array | string, batchId: BatchId | Uint8Array | string, buckets: Uint32Array, depth: number): Stamper;
13
+ stamp(chunk: Chunk): EnvelopeWithBatchId;
14
+ getState(): Uint32Array;
15
+ }
@@ -1,138 +1,104 @@
1
- import { HexEthAddress } from '../utils/eth';
2
- import { NumberString, PublicKey, Reference, TransactionHash } from './index';
3
- /**
4
- * Object that contains information about progress of upload of data to network.
5
- *
6
- * @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/develop/access-the-swarm/syncing)
7
- */
8
- export interface ExtendedTag {
9
- /**
10
- * Number of all chunks that the data will be split into.
11
- */
12
- total: number;
13
- /**
14
- * Number of chunks already processed by splitter for hashing
15
- */
16
- split: number;
17
- /**
18
- * Number of chunks already seen
19
- */
20
- seen: number;
21
- /**
22
- * Number of chunks already stored locally
23
- */
24
- stored: number;
25
- /**
26
- * Number of chunks sent for push syncing
27
- */
28
- sent: number;
29
- /**
30
- * Number of chunks synced with proof
31
- */
32
- synced: number;
33
- /**
34
- * Unique identifier
35
- */
36
- uid: number;
37
- /**
38
- * The associated swarm hash for this tag
39
- */
40
- address: Reference;
41
- /**
42
- * When the upload process started
43
- */
44
- startedAt: string;
45
- }
1
+ import { BZZ, DAI } from '../utils/tokens';
2
+ import { EthAddress, PeerAddress, PublicKey, TransactionId } from '../utils/typed-bytes';
3
+ import { NumberString } from './index';
46
4
  export interface Settlements {
47
5
  peer: string;
48
- received: NumberString;
49
- sent: NumberString;
6
+ received: BZZ;
7
+ sent: BZZ;
50
8
  }
51
9
  export interface AllSettlements {
52
- totalReceived: NumberString;
53
- totalSent: NumberString;
10
+ totalReceived: BZZ;
11
+ totalSent: BZZ;
54
12
  settlements: Settlements[];
55
13
  }
56
14
  export interface NodeAddresses {
57
- overlay: string;
15
+ overlay: PeerAddress;
58
16
  underlay: string[];
59
- ethereum: HexEthAddress;
17
+ ethereum: EthAddress;
60
18
  publicKey: PublicKey;
61
19
  pssPublicKey: PublicKey;
62
20
  }
63
21
  export interface Peer {
64
22
  address: string;
23
+ fullNode?: boolean;
65
24
  }
66
25
  export interface ChequebookAddressResponse {
67
26
  chequebookAddress: string;
68
27
  }
69
28
  export interface ChequebookBalanceResponse {
70
- totalBalance: NumberString;
71
- availableBalance: NumberString;
29
+ totalBalance: BZZ;
30
+ availableBalance: BZZ;
72
31
  }
73
32
  export interface TransactionOptions {
74
33
  /**
75
34
  * Gas price for the cashout transaction in WEI
76
35
  */
77
- gasPrice?: NumberString;
36
+ gasPrice?: NumberString | string | bigint;
78
37
  /**
79
38
  * Gas limit for the cashout transaction in WEI
80
39
  */
81
- gasLimit?: NumberString;
40
+ gasLimit?: NumberString | string | bigint;
82
41
  }
83
- export type CashoutOptions = TransactionOptions;
84
42
  export interface CashoutResult {
85
43
  recipient: string;
86
- lastPayout: NumberString;
44
+ lastPayout: BZZ;
87
45
  bounced: boolean;
88
46
  }
89
47
  export interface LastCashoutActionResponse {
90
48
  peer: string;
91
- uncashedAmount: NumberString;
49
+ uncashedAmount: BZZ;
92
50
  transactionHash: string | null;
93
51
  lastCashedCheque: Cheque | null;
94
52
  result: CashoutResult | null;
95
53
  }
96
54
  export interface TransactionResponse {
97
- transactionHash: TransactionHash;
55
+ transactionHash: TransactionId;
98
56
  }
99
57
  export interface Cheque {
100
- beneficiary: string;
101
- chequebook: string;
102
- payout: NumberString;
58
+ beneficiary: EthAddress;
59
+ chequebook: EthAddress;
60
+ payout: BZZ;
103
61
  }
104
62
  export interface LastChequesForPeerResponse {
105
63
  peer: string;
106
- lastreceived: Cheque;
107
- lastsent: Cheque;
64
+ lastreceived: Cheque | null;
65
+ lastsent: Cheque | null;
108
66
  }
109
67
  export interface LastChequesResponse {
110
68
  lastcheques: LastChequesForPeerResponse[];
111
69
  }
112
70
  export interface PeerBalance {
113
71
  peer: string;
114
- balance: NumberString;
72
+ balance: BZZ;
115
73
  }
116
74
  export interface BalanceResponse {
117
75
  balances: PeerBalance[];
118
76
  }
119
77
  export interface DebugStatus {
120
- peer: string;
78
+ overlay: string;
121
79
  proximity: number;
122
80
  beeMode: BeeModes;
123
81
  reserveSize: number;
82
+ reserveSizeWithinRadius: number;
124
83
  pullsyncRate: number;
125
84
  storageRadius: number;
126
85
  connectedPeers: number;
127
86
  neighborhoodSize: number;
128
87
  batchCommitment: number;
129
88
  isReachable: boolean;
89
+ lastSyncedBlock: number;
90
+ committedDepth: number;
130
91
  }
131
92
  export interface Health {
132
93
  status: 'ok';
133
94
  version: string;
134
95
  apiVersion: string;
135
96
  }
97
+ export interface Readiness {
98
+ status: 'ready' | string;
99
+ version: string;
100
+ apiVersion: string;
101
+ }
136
102
  export interface BeeVersions {
137
103
  supportedBeeVersion: string;
138
104
  supportedBeeApiVersion: string;
@@ -145,8 +111,9 @@ export declare enum BeeModes {
145
111
  ULTRA_LIGHT = "ultra-light",
146
112
  DEV = "dev"
147
113
  }
114
+ export declare function toBeeMode(value: string): BeeModes;
148
115
  export interface RedistributionState {
149
- minimumGasFunds: NumberString;
116
+ minimumGasFunds: DAI;
150
117
  hasSufficientFunds: boolean;
151
118
  isFrozen: boolean;
152
119
  isFullySynced: boolean;
@@ -156,20 +123,16 @@ export interface RedistributionState {
156
123
  lastPlayedRound: number;
157
124
  lastFrozenRound: number;
158
125
  lastSelectedRound: number;
159
- lastSampleDuration: string;
126
+ lastSampleDurationSeconds: number;
160
127
  block: number;
161
- reward: NumberString;
162
- fees: NumberString;
128
+ reward: BZZ;
129
+ fees: DAI;
130
+ isHealthy: boolean;
163
131
  }
164
132
  /**
165
133
  * Information about Bee node and its configuration
166
134
  */
167
135
  export interface NodeInfo {
168
- /**
169
- * Indicates whether the node is in a Gateway mode.
170
- * Gateway mode is a restricted mode where some features are not available.
171
- */
172
- gatewayMode: boolean;
173
136
  /**
174
137
  * Indicates in what mode Bee is running.
175
138
  */
@@ -177,13 +140,13 @@ export interface NodeInfo {
177
140
  /**
178
141
  * Indicates whether the Bee node has its own deployed chequebook.
179
142
  *
180
- * @see [Bee docs - Chequebook](https://docs.ethswarm.org/docs/learn/glossary#cheques--chequebook)
143
+ * @see [Bee docs - Chequebook](https://docs.ethswarm.org/docs/references/glossary/#cheques--chequebook)
181
144
  */
182
145
  chequebookEnabled: boolean;
183
146
  /**
184
147
  * Indicates whether SWAP is enabled for the Bee node.
185
148
  *
186
- * @see [Bee docs - SWAP](https://docs.ethswarm.org/docs/learn/glossary#swap)
149
+ * @see [Bee docs - SWAP](https://docs.ethswarm.org/docs/references/glossary/#swap)
187
150
  */
188
151
  swapEnabled: boolean;
189
152
  }
@@ -204,6 +167,8 @@ export interface Topology {
204
167
  timestamp: string;
205
168
  nnLowWatermark: number;
206
169
  depth: number;
170
+ reachability: string;
171
+ networkAvailability: string;
207
172
  bins: {
208
173
  bin_0: Bin;
209
174
  bin_1: Bin;
@@ -221,6 +186,22 @@ export interface Topology {
221
186
  bin_13: Bin;
222
187
  bin_14: Bin;
223
188
  bin_15: Bin;
189
+ bin_16: Bin;
190
+ bin_17: Bin;
191
+ bin_18: Bin;
192
+ bin_19: Bin;
193
+ bin_20: Bin;
194
+ bin_21: Bin;
195
+ bin_22: Bin;
196
+ bin_23: Bin;
197
+ bin_24: Bin;
198
+ bin_25: Bin;
199
+ bin_26: Bin;
200
+ bin_27: Bin;
201
+ bin_28: Bin;
202
+ bin_29: Bin;
203
+ bin_30: Bin;
204
+ bin_31: Bin;
224
205
  };
225
206
  }
226
207
  export interface PingResponse {
@@ -228,52 +209,19 @@ export interface PingResponse {
228
209
  }
229
210
  export interface ReserveState {
230
211
  radius: number;
231
- commitment: number;
232
212
  storageRadius: number;
213
+ commitment: number;
233
214
  }
234
215
  export interface ChainState {
235
- block: number;
236
216
  chainTip: number;
217
+ block: number;
237
218
  totalAmount: NumberString;
238
- currentPrice: NumberString;
219
+ currentPrice: number;
239
220
  }
240
221
  export interface WalletBalance {
241
- /**
242
- * Balance of BZZ tokens
243
- *
244
- * @deprecated: Use bzzBalance property instead
245
- */
246
- bzz: NumberString;
247
- /**
248
- * Balance of BZZ tokens
249
- */
250
- bzzBalance: NumberString;
251
- /**
252
- * Balance of xDai
253
- *
254
- * @deprecated: Use nativeTokenBalance property instead
255
- */
256
- xDai: NumberString;
257
- /**
258
- * Balance of xDai
259
- */
260
- nativeTokenBalance: NumberString;
261
- /**
262
- * Chain network ID to which the Bee node is connected
263
- */
222
+ bzzBalance: BZZ;
223
+ nativeTokenBalance: DAI;
264
224
  chainID: number;
265
- /**
266
- * Chequebook contract address
267
- *
268
- * @deprecated: Use chequebookContractAddress property instead
269
- */
270
- contractAddress: string;
271
- /**
272
- * Chequebook contract address
273
- */
274
225
  chequebookContractAddress: string;
275
- /**
276
- * Node's wallet address
277
- */
278
226
  walletAddress: string;
279
227
  }