@ethersphere/bee-js 13.0.0-upcoming.gcfb9756 → 13.0.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.
Files changed (201) hide show
  1. package/README.md +104 -103
  2. package/dist/cjs/api/bytes.js +3 -4
  3. package/dist/cjs/api/bzz.js +5 -6
  4. package/dist/cjs/api/chunk.js +3 -3
  5. package/dist/cjs/api/envelope.js +3 -2
  6. package/dist/cjs/api/feed.js +4 -5
  7. package/dist/cjs/api/pin.js +2 -2
  8. package/dist/cjs/api/soc.js +2 -2
  9. package/dist/cjs/bee.js +18 -19
  10. package/dist/cjs/chunk/soc.js +21 -63
  11. package/dist/cjs/feed/identifier.js +3 -4
  12. package/dist/cjs/feed/index.js +17 -19
  13. package/dist/cjs/feed/retrievable.js +2 -2
  14. package/dist/cjs/index.js +18 -8
  15. package/dist/cjs/manifest/manifest.js +97 -333
  16. package/dist/cjs/modules/balance.js +3 -3
  17. package/dist/cjs/modules/cheque.js +4 -4
  18. package/dist/cjs/modules/chunk.js +8 -8
  19. package/dist/cjs/modules/collection.js +6 -6
  20. package/dist/cjs/modules/connectivity.js +3 -3
  21. package/dist/cjs/modules/data.js +6 -6
  22. package/dist/cjs/modules/feed.js +10 -10
  23. package/dist/cjs/modules/file.js +3 -3
  24. package/dist/cjs/modules/grantee.js +9 -9
  25. package/dist/cjs/modules/messaging.js +15 -17
  26. package/dist/cjs/modules/pin.js +6 -6
  27. package/dist/cjs/modules/settlement.js +2 -2
  28. package/dist/cjs/modules/soc.js +3 -3
  29. package/dist/cjs/modules/stamp.js +7 -7
  30. package/dist/cjs/modules/tag.js +2 -2
  31. package/dist/cjs/modules/transaction.js +4 -4
  32. package/dist/cjs/modules/wallet.js +3 -3
  33. package/dist/cjs/types/schema/chequebook.js +5 -5
  34. package/dist/cjs/types/schema/connectivity.js +5 -5
  35. package/dist/cjs/types/schema/envelope.js +5 -5
  36. package/dist/cjs/types/schema/grantee.js +4 -4
  37. package/dist/cjs/types/schema/stake.js +2 -2
  38. package/dist/cjs/types/schema/stamps.js +4 -4
  39. package/dist/cjs/types/schema/states.js +2 -2
  40. package/dist/cjs/types/schema/transactions.js +3 -3
  41. package/dist/cjs/types/schema/upload.js +2 -2
  42. package/dist/cjs/utils/chunk-stream.browser.js +24 -16
  43. package/dist/cjs/utils/chunk-stream.js +17 -9
  44. package/dist/cjs/utils/constants.js +3 -3
  45. package/dist/cjs/utils/expose.js +4 -4
  46. package/dist/cjs/utils/headers.js +4 -4
  47. package/dist/cjs/utils/http.js +3 -1
  48. package/dist/cjs/utils/pss.js +2 -2
  49. package/dist/cjs/utils/resource-locator.js +2 -2
  50. package/dist/cjs/utils/schema.js +4 -4
  51. package/dist/cjs/utils/stamps.js +15 -130
  52. package/dist/cjs/utils/type.js +2 -2
  53. package/dist/codemod/index.js +141 -0
  54. package/dist/codemod/transforms/v13.js +524 -0
  55. package/dist/index.browser.min.js +2 -1
  56. package/dist/index.browser.min.js.LICENSE.txt +3 -0
  57. package/dist/index.browser.min.js.map +1 -1
  58. package/dist/mjs/api/bytes.js +1 -2
  59. package/dist/mjs/api/bzz.js +1 -2
  60. package/dist/mjs/api/chunk.js +1 -1
  61. package/dist/mjs/api/envelope.js +3 -2
  62. package/dist/mjs/api/feed.js +1 -2
  63. package/dist/mjs/api/pin.js +1 -1
  64. package/dist/mjs/api/soc.js +1 -1
  65. package/dist/mjs/bee.js +13 -14
  66. package/dist/mjs/chunk/soc.js +11 -49
  67. package/dist/mjs/feed/identifier.js +2 -3
  68. package/dist/mjs/feed/index.js +6 -8
  69. package/dist/mjs/feed/retrievable.js +1 -1
  70. package/dist/mjs/index.js +2 -5
  71. package/dist/mjs/manifest/manifest.js +95 -339
  72. package/dist/mjs/modules/balance.js +1 -1
  73. package/dist/mjs/modules/cheque.js +1 -1
  74. package/dist/mjs/modules/chunk.js +1 -1
  75. package/dist/mjs/modules/collection.js +1 -1
  76. package/dist/mjs/modules/connectivity.js +1 -1
  77. package/dist/mjs/modules/data.js +3 -3
  78. package/dist/mjs/modules/feed.js +1 -1
  79. package/dist/mjs/modules/file.js +1 -1
  80. package/dist/mjs/modules/grantee.js +1 -1
  81. package/dist/mjs/modules/messaging.js +3 -5
  82. package/dist/mjs/modules/pin.js +1 -1
  83. package/dist/mjs/modules/settlement.js +1 -1
  84. package/dist/mjs/modules/soc.js +1 -1
  85. package/dist/mjs/modules/stamp.js +1 -1
  86. package/dist/mjs/modules/tag.js +1 -1
  87. package/dist/mjs/modules/transaction.js +1 -1
  88. package/dist/mjs/modules/wallet.js +1 -1
  89. package/dist/mjs/types/schema/chequebook.js +1 -1
  90. package/dist/mjs/types/schema/connectivity.js +1 -1
  91. package/dist/mjs/types/schema/envelope.js +5 -5
  92. package/dist/mjs/types/schema/grantee.js +1 -1
  93. package/dist/mjs/types/schema/stake.js +1 -1
  94. package/dist/mjs/types/schema/stamps.js +1 -1
  95. package/dist/mjs/types/schema/states.js +1 -1
  96. package/dist/mjs/types/schema/transactions.js +1 -1
  97. package/dist/mjs/types/schema/upload.js +1 -1
  98. package/dist/mjs/utils/chunk-stream.browser.js +28 -18
  99. package/dist/mjs/utils/chunk-stream.js +21 -11
  100. package/dist/mjs/utils/constants.js +1 -1
  101. package/dist/mjs/utils/expose.js +1 -1
  102. package/dist/mjs/utils/headers.js +1 -1
  103. package/dist/mjs/utils/http.js +6 -1
  104. package/dist/mjs/utils/pss.js +1 -1
  105. package/dist/mjs/utils/resource-locator.js +1 -1
  106. package/dist/mjs/utils/schema.js +1 -1
  107. package/dist/mjs/utils/stamps.js +5 -99
  108. package/dist/mjs/utils/type.js +2 -2
  109. package/dist/types/api/balance.d.ts +1 -1
  110. package/dist/types/api/batches.d.ts +1 -1
  111. package/dist/types/api/bytes.d.ts +3 -3
  112. package/dist/types/api/bzz.d.ts +1 -2
  113. package/dist/types/api/chequebook.d.ts +1 -1
  114. package/dist/types/api/chunk.d.ts +1 -1
  115. package/dist/types/api/connectivity.d.ts +1 -1
  116. package/dist/types/api/consumed.d.ts +1 -1
  117. package/dist/types/api/envelope.d.ts +1 -1
  118. package/dist/types/api/feed.d.ts +1 -2
  119. package/dist/types/api/grantee.d.ts +1 -1
  120. package/dist/types/api/pin.d.ts +1 -1
  121. package/dist/types/api/pss.d.ts +1 -1
  122. package/dist/types/api/settlement.d.ts +1 -1
  123. package/dist/types/api/soc.d.ts +1 -1
  124. package/dist/types/api/stake.d.ts +1 -1
  125. package/dist/types/api/stamp.d.ts +1 -1
  126. package/dist/types/api/stewardship.d.ts +1 -1
  127. package/dist/types/api/tag.d.ts +1 -1
  128. package/dist/types/api/transaction.d.ts +1 -1
  129. package/dist/types/api/wallet.d.ts +1 -1
  130. package/dist/types/bee.d.ts +11 -13
  131. package/dist/types/chunk/soc.d.ts +3 -48
  132. package/dist/types/feed/identifier.d.ts +1 -1
  133. package/dist/types/feed/index.d.ts +1 -3
  134. package/dist/types/feed/retrievable.d.ts +1 -1
  135. package/dist/types/index.d.ts +17 -20
  136. package/dist/types/manifest/manifest.d.ts +24 -33
  137. package/dist/types/modules/balance.d.ts +1 -1
  138. package/dist/types/modules/cheque.d.ts +1 -1
  139. package/dist/types/modules/chequebook.d.ts +1 -1
  140. package/dist/types/modules/chunk.d.ts +1 -2
  141. package/dist/types/modules/collection.d.ts +2 -2
  142. package/dist/types/modules/connectivity.d.ts +1 -1
  143. package/dist/types/modules/context.d.ts +1 -1
  144. package/dist/types/modules/data.d.ts +3 -3
  145. package/dist/types/modules/feed.d.ts +1 -1
  146. package/dist/types/modules/file.d.ts +1 -2
  147. package/dist/types/modules/grantee.d.ts +1 -1
  148. package/dist/types/modules/messaging.d.ts +1 -2
  149. package/dist/types/modules/pin.d.ts +1 -1
  150. package/dist/types/modules/settlement.d.ts +1 -1
  151. package/dist/types/modules/soc.d.ts +1 -1
  152. package/dist/types/modules/stake.d.ts +1 -1
  153. package/dist/types/modules/stamp.d.ts +1 -1
  154. package/dist/types/modules/storage.d.ts +1 -1
  155. package/dist/types/modules/tag.d.ts +1 -1
  156. package/dist/types/modules/transaction.d.ts +1 -1
  157. package/dist/types/modules/wallet.d.ts +1 -1
  158. package/dist/types/types/debug.d.ts +1 -1
  159. package/dist/types/types/index.d.ts +2 -11
  160. package/dist/types/types/schema/chequebook.d.ts +1 -1
  161. package/dist/types/types/schema/connectivity.d.ts +1 -1
  162. package/dist/types/types/schema/grantee.d.ts +1 -1
  163. package/dist/types/types/schema/stake.d.ts +1 -1
  164. package/dist/types/types/schema/stamps.d.ts +1 -1
  165. package/dist/types/types/schema/states.d.ts +1 -1
  166. package/dist/types/types/schema/transactions.d.ts +1 -1
  167. package/dist/types/types/schema/upload.d.ts +1 -1
  168. package/dist/types/utils/chunk-stream.browser.d.ts +1 -1
  169. package/dist/types/utils/chunk-stream.d.ts +2 -2
  170. package/dist/types/utils/constants.d.ts +1 -1
  171. package/dist/types/utils/expose.d.ts +1 -1
  172. package/dist/types/utils/headers.d.ts +1 -1
  173. package/dist/types/utils/pss.d.ts +1 -1
  174. package/dist/types/utils/resource-locator.d.ts +1 -1
  175. package/dist/types/utils/schema.d.ts +1 -1
  176. package/dist/types/utils/stamps.d.ts +2 -27
  177. package/dist/types/utils/tar-uploader.browser.d.ts +1 -1
  178. package/dist/types/utils/tar-uploader.d.ts +1 -1
  179. package/dist/types/utils/type.d.ts +1 -1
  180. package/package.json +7 -2
  181. package/dist/cjs/chunk/bmt.js +0 -37
  182. package/dist/cjs/chunk/cac.js +0 -43
  183. package/dist/cjs/stamper/stamper.js +0 -44
  184. package/dist/cjs/utils/bytes.js +0 -116
  185. package/dist/cjs/utils/cid.js +0 -37
  186. package/dist/cjs/utils/redundancy.js +0 -133
  187. package/dist/cjs/utils/typed-bytes.js +0 -186
  188. package/dist/mjs/chunk/bmt.js +0 -34
  189. package/dist/mjs/chunk/cac.js +0 -34
  190. package/dist/mjs/stamper/stamper.js +0 -40
  191. package/dist/mjs/utils/bytes.js +0 -102
  192. package/dist/mjs/utils/cid.js +0 -32
  193. package/dist/mjs/utils/redundancy.js +0 -98
  194. package/dist/mjs/utils/typed-bytes.js +0 -167
  195. package/dist/types/chunk/bmt.d.ts +0 -16
  196. package/dist/types/chunk/cac.d.ts +0 -40
  197. package/dist/types/stamper/stamper.d.ts +0 -15
  198. package/dist/types/utils/bytes.d.ts +0 -19
  199. package/dist/types/utils/cid.d.ts +0 -10
  200. package/dist/types/utils/redundancy.d.ts +0 -21
  201. package/dist/types/utils/typed-bytes.d.ts +0 -69
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  > Write your code in CJS, MJS or TypeScript.
15
15
 
16
- > Intended to be used with Bee version 2.5.0.
16
+ > Intended to be used with Bee version 2.8.1.
17
17
 
18
18
  ## Quick start
19
19
 
@@ -68,7 +68,7 @@ types. Where `NumberString` is present, `number` is disallowed in order to avoid
68
68
 
69
69
  ### Byte primitives
70
70
 
71
- All the classes below extend `Bytes`, therefor the following methods are available on all of them: `toUint8Array`,
71
+ All the classes below extend `Bytes`, therefore the following methods are available on all of them: `toUint8Array`,
72
72
  `toHex`, `toBase64`, `toBase32`, `toUtf8`, `toJSON`, `static keccak256`, `static fromUtf8`.
73
73
 
74
74
  The `toString` method uses `toHex`.
@@ -108,24 +108,25 @@ The `toString` method uses `toHex`.
108
108
 
109
109
  | Name | Description | Creation |
110
110
  | ---------------- | ----------------------------------------------------------------------------------------------- | --------------------------- |
111
- | Chunk | Span, max. 4096 bytes payload; address dervied from content | `makeContentAddressedChunk` |
111
+ | Chunk | Span, max. 4096 bytes payload; address derived from content | `makeContentAddressedChunk` |
112
112
  | SingleOwnerChunk | Identifier, signature, span, max. 4096 bytes payload; address derived from identifier and owner | `makeSingleOwnerChunk` |
113
113
 
114
114
  ### Swarm primitives
115
115
 
116
- | Name | Description | Methods |
117
- | ------------ | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
118
- | MantarayNode | Compact trie with reference values and JSON metadata | `addFork`, `removeFork`, `calculateSelfAddress`, `find`, `findClosest`, `collect`, `marshal`, `unmarshal`, `saveRecursively`, `loadRecursively` |
119
- | MerkleTree | Streaming BMT of chunks | `append`, `finalize`, `static root` |
116
+ | Name | Description | Methods |
117
+ | ------------- | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
118
+ | MantarayNode | Compact trie with reference values and JSON metadata | `addFork`, `removeFork`, `calculateSelfAddress`, `find`, `findClosest`, `collect`, `marshal`, `unmarshal`, `saveRecursively`, `loadRecursively` |
119
+ | ChunkSplitter | Streaming BMT chunk-tree builder | `append`, `finalize`, `static root` |
120
+ | ChunkJoiner | Reconstructs data from a chunk tree | `join`, `static collect` |
120
121
 
121
122
  ### Swarm objects
122
123
 
123
124
  | Name | Description | Creation |
124
125
  | ---------- | ----------------------- | -------------------- |
125
- | SOCWriter | SingleOwnerChunk writer | `bee.makeSOCWriter` |
126
- | SOCReader | SingleOwnerChunk reader | `bee.makeSOCReader` |
127
- | FeedWriter | Feed writer | `bee.makeFeedWriter` |
128
- | FeedReader | Feed reader | `bee.makeFeedReader` |
126
+ | SOCWriter | SingleOwnerChunk writer | `bee.soc.makeWriter` |
127
+ | SOCReader | SingleOwnerChunk reader | `bee.soc.makeReader` |
128
+ | FeedWriter | Feed writer | `bee.feed.makeWriter` |
129
+ | FeedReader | Feed reader | `bee.feed.makeReader` |
129
130
 
130
131
  ### Bee API
131
132
 
@@ -133,83 +134,83 @@ The `toString` method uses `toHex`.
133
134
  - ❌✅✅ - Light node and full node
134
135
  - ✅✅✅ - Ultra-light node, light node and full node
135
136
 
136
- | JS Call | Bee Endpoint | Bee Mode |
137
- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
138
- | `uploadFile` | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | ❌✅✅ |
139
- | `uploadFilesFromDirectory` _Node.js_ | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | ❌✅✅ |
140
- | `uploadFiles` | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | ❌✅✅ |
141
- | `uploadCollection` | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | ❌✅✅ |
142
- | `uploadData` | `POST /bytes` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes/post) | ❌✅✅ |
143
- | `uploadChunk` | `POST /chunks` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post) | ❌✅✅ |
144
- | `streamDirectory` _Node.js_ | `POST /chunks` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post) | ❌✅✅ |
145
- | `streamFiles` _Browser_ | `POST /chunks` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post) | ❌✅✅ |
146
- | `SOCWriter.upload` | `POST /soc/:owner/:identifier` [🔗](https://docs.ethswarm.org/api/#tag/Single-owner-chunk/paths/~1soc~1%7Bowner%7D~1%7Bid%7D/post) | ❌✅✅ |
147
- | `FeedReader.download` | `GET /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/get) | ✅✅✅ |
148
- | `FeedWriter.updateFeed` | `POST /soc/:owner/:identifier` [🔗](https://docs.ethswarm.org/api/#tag/Single-owner-chunk/paths/~1soc~1%7Bowner%7D~1%7Bid%7D/post) | ❌✅✅ |
149
- | `downloadFile` | `GET /bzz/:reference` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz~1%7Breference%7D/get) | ✅✅✅ |
150
- | `downloadFile` | `GET /bzz/:reference/:path` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz~1%7Breference%7D~1%7Bpath%7D/get) | ✅✅✅ |
151
- | `downloadReadableFile` | `GET /bzz/:reference` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz~1%7Breference%7D/get) | ✅✅✅ |
152
- | `downloadData` | `GET /bytes/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1%7Breference%7D/get) | ✅✅✅ |
153
- | `downloadReadableData` | `GET /bytes/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1%7Breference%7D/get) | ✅✅✅ |
154
- | `downloadChunk` | `GET /chunks/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks~1%7Baddress%7D/get) | ✅✅✅ |
155
- | `createFeedManifest` | `POST /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/post) | ❌✅✅ |
156
- | `isConnected` | `GET /` | ✅✅✅ |
157
- | `getHealth` | `GET /health` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1health/get) | ✅✅✅ |
158
- | `getReadiness` | `GET /readiness` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1readiness/get) | ✅✅✅ |
159
- | `getNodeInfo` | `GET /node` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1node/get) | ✅✅✅ |
160
- | `getChainState` | `GET /chainstate` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1chainstate/get) | ❌✅✅ |
161
- | `getRedistributionState` | `GET /redistributionstate` [🔗](https://docs.ethswarm.org/api/#tag/RedistributionState/paths/~1redistributionstate/get) | ❌❌✅ |
162
- | `getReserveState` | `GET /reservestate` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1reservestate/get) | ❌❌✅ |
163
- | `getStatus` | `GET /status` [🔗](https://docs.ethswarm.org/api/#tag/Node-Status/paths/~1status/get) | ✅✅✅ |
164
- | `getWallet` | `GET /wallet` [🔗](https://docs.ethswarm.org/api/#tag/Wallet/paths/~1wallet/get) | ❌✅✅ |
165
- | `getTopology` | `GET /topology` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1topology/get) | ✅✅✅ |
166
- | `getAddresses` | `GET /addresses` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1addresses/get) | ✅✅✅ |
167
- | `getPeers` | `GET /peers` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1peers/get) | ✅✅✅ |
168
- | `getAllBalances` | `GET /balances` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1balances/get) | ❌✅✅ |
169
- | `getPeerBalance` | `GET /balances/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1balances~1%7Baddress%7D/get) | ❌✅✅ |
170
- | `getPastDueConsumptionBalances` | `GET /consumed` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1consumed/get) | ❌✅✅ |
171
- | `getPastDueConsumptionPeerBalance` | `GET /consumed/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1consumed~1%7Baddress%7D/get) | ❌✅✅ |
172
- | `getAllSettlements` | `GET /settlements` [🔗](https://docs.ethswarm.org/api/#tag/Settlements/paths/~1settlements/get) | ❌✅✅ |
173
- | `getSettlements` | `GET /settlements/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Settlements/paths/~1settlements~1%7Baddress%7D/get) | ❌✅✅ |
174
- | `getChequebookAddress` | `GET /chequebook/address` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1address/get) | ❌✅✅ |
175
- | `getChequebookBalance` | `GET /chequebook/balance` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1balance/get) | ❌✅✅ |
176
- | `getLastCheques` | `GET /chequebook/cheque` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cheque/get) | ❌✅✅ |
177
- | `getLastChequesForPeer` | `GET /chequebook/cheque/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cheque~1%7Bpeer-id%7D/get) | ❌✅✅ |
178
- | `getLastCashoutAction` | `GET /chequebook/cashout/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cashout~1%7Bpeer-id%7D/get) | ❌✅✅ |
179
- | `cashoutLastCheque` | `POST /chequebook/cashout/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cashout~1%7Bpeer-id%7D/post) | ❌✅✅ |
180
- | `depositTokens` | `POST /chequebook/deposit` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1deposit/post) | ❌✅✅ |
181
- | `withdrawTokens` | `POST /chequebook/withdraw` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1withdraw/post) | ❌✅✅ |
182
- | `getAllPendingTransactions` | `GET /transactions` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions/get) | ❌✅✅ |
183
- | `getPendingTransaction` | `GET /transactions/:id` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions~1%7BtxHash%7D/get) | ❌✅✅ |
184
- | `rebroadcastTransaction` | `POST /transactions/:id` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions~1%7BtxHash%7D/post) | ❌✅✅ |
185
- | `cancelTransaction` | `DELETE /transactions/:id` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions~1%7BtxHash%7D/delete) | ❌✅✅ |
186
- | `createTag` | `POST /tags` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags/post) | ❌✅✅ |
187
- | `retrieveTag` | `GET /tags/:id` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1%7Buid%7D/get) | ❌✅✅ |
188
- | `getAllTags` | `GET /tags` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags/get) | ❌✅✅ |
189
- | `deleteTag` | `DELETE /tags/:id` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1%7Buid%7D/delete) | ❌✅✅ |
190
- | `updateTag` | `PATCH /tags/:id` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1%7Buid%7D/patch) | ❌✅✅ |
191
- | `pin` | `POST /pins/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins~1%7Breference%7D/post) | ✅✅✅ |
192
- | `getAllPins` | `GET /pins` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins/get) | ✅✅✅ |
193
- | `getPin` | `GET /pins/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins~1%7Breference%7D/get) | ✅✅✅ |
194
- | `isReferenceRetrievable` | `GET /stewardship/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1%7Breference%7D/get) | ✅✅✅ |
195
- | `reuploadPinnedData` | `PUT /stewardship/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1%7Breference%7D/put) | ❌✅✅ |
196
- | `unpin` | `DELETE /pins/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins~1%7Breference%7D/delete) | ✅✅✅ |
197
- | `getGrantees` | `GET /grantee/:reference` [🔗](https://docs.ethswarm.org/api/#tag/ACT/paths/~1grantee~1%7Breference%7D/get) | ❌✅✅ |
198
- | `createGrantees` | `POST /grantee` [🔗](https://docs.ethswarm.org/api/#tag/ACT/paths/~1grantee/post) | ❌✅✅ |
199
- | `patchGrantees` | `PATCH /grantee/:reference` [🔗](https://docs.ethswarm.org/api/#tag/ACT/paths/~1grantee~1%7Breference%7D/patch) | ❌✅✅ |
200
- | `pssSend` | `POST /pss/send/:topic/:target` [🔗](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1send~1%7Btopic%7D~1%7Btargets%7D/post) | ❌✅✅ |
201
- | `pssSubscribe` _Websocket_ | `GET /pss/subscribe/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1subscribe~1%7Btopic%7D/get) | ❌❌✅ |
202
- | `pssReceive` | `GET /pss/subscribe/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1subscribe~1%7Btopic%7D/get) | ❌❌✅ |
203
- | `getPostageBatches` | `GET /stamps` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get) | ❌✅✅ |
204
- | `getGlobalPostageBatches` | `GET /batches` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1batches/get) | ❌✅✅ |
205
- | `getPostageBatch` | `GET /stamps/:batchId` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D/get) | ❌✅✅ |
206
- | `getPostageBatchBuckets` | `GET /stamps/:batchId/buckets` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D~1buckets/get) | ❌✅✅ |
207
- | `createPostageBatch` | `POST /stamps/:amount/:depth` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bamount%7D~1%7Bdepth%7D/post) | ❌✅✅ |
208
- | `topUpBatch` | `PATCH /stamps/topup/:batchId/:amount` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1topup~1%7Bbatch_id%7D~1%7Bamount%7D/patch) | ❌✅✅ |
209
- | `diluteBatch` | `PATCH /stamps/dilute/:batchId/:depth` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1dilute~1%7Bbatch_id%7D~1%7Bdepth%7D/patch) | ❌✅✅ |
210
- | `createEnvelope` | `POST /envelope/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Envelope/paths/~1envelope~1%7Baddress%7D/post) | ❌✅✅ |
211
- | `getStake` | `GET /stake` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake/get) | ❌❌✅ |
212
- | `depositStake` | `POST /stake` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake~1%7Bamount%7D/post) | ❌❌✅ |
137
+ | JS Call | Bee Endpoint | Bee Mode |
138
+ | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
139
+ | `file.upload` | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | ❌✅✅ |
140
+ | `collection.uploadFromDirectory` _Node.js_ | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | ❌✅✅ |
141
+ | `collection.uploadFromFileList` | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | ❌✅✅ |
142
+ | `collection.upload` | `POST /bzz` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz/post) | ❌✅✅ |
143
+ | `data.upload` | `POST /bytes` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes/post) | ❌✅✅ |
144
+ | `chunk.upload` | `POST /chunks` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post) | ❌✅✅ |
145
+ | `collection.streamFromDirectory` _Node.js_ | `POST /chunks` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post) | ❌✅✅ |
146
+ | `collection.stream` _Browser_ | `POST /chunks` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks/post) | ❌✅✅ |
147
+ | `SOCWriter.upload` | `POST /soc/:owner/:identifier` [🔗](https://docs.ethswarm.org/api/#tag/Single-owner-chunk/paths/~1soc~1%7Bowner%7D~1%7Bid%7D/post) | ❌✅✅ |
148
+ | `FeedReader.download` | `GET /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/get) | ✅✅✅ |
149
+ | `FeedWriter.uploadReference` | `POST /soc/:owner/:identifier` [🔗](https://docs.ethswarm.org/api/#tag/Single-owner-chunk/paths/~1soc~1%7Bowner%7D~1%7Bid%7D/post) | ❌✅✅ |
150
+ | `file.download` | `GET /bzz/:reference` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz~1%7Breference%7D/get) | ✅✅✅ |
151
+ | `file.download` | `GET /bzz/:reference/:path` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz~1%7Breference%7D~1%7Bpath%7D/get) | ✅✅✅ |
152
+ | `file.downloadReadable` | `GET /bzz/:reference` [🔗](https://docs.ethswarm.org/api/#tag/BZZ/paths/~1bzz~1%7Breference%7D/get) | ✅✅✅ |
153
+ | `data.download` | `GET /bytes/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1%7Breference%7D/get) | ✅✅✅ |
154
+ | `data.downloadReadable` | `GET /bytes/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Bytes/paths/~1bytes~1%7Breference%7D/get) | ✅✅✅ |
155
+ | `chunk.download` | `GET /chunks/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Chunk/paths/~1chunks~1%7Baddress%7D/get) | ✅✅✅ |
156
+ | `feed.createManifest` | `POST /feeds/:owner/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Feed/paths/~1feeds~1%7Bowner%7D~1%7Btopic%7D/post) | ❌✅✅ |
157
+ | `connectivity.isConnected` | `GET /` | ✅✅✅ |
158
+ | `status.getHealth` | `GET /health` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1health/get) | ✅✅✅ |
159
+ | `status.getReadiness` | `GET /readiness` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1readiness/get) | ✅✅✅ |
160
+ | `status.getNodeInfo` | `GET /node` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1node/get) | ✅✅✅ |
161
+ | `status.getChainState` | `GET /chainstate` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1chainstate/get) | ❌✅✅ |
162
+ | `stake.getRedistributionState` | `GET /redistributionstate` [🔗](https://docs.ethswarm.org/api/#tag/RedistributionState/paths/~1redistributionstate/get) | ❌❌✅ |
163
+ | `status.getReserveState` | `GET /reservestate` [🔗](https://docs.ethswarm.org/api/#tag/Status/paths/~1reservestate/get) | ❌❌✅ |
164
+ | `status.get` | `GET /status` [🔗](https://docs.ethswarm.org/api/#tag/Node-Status/paths/~1status/get) | ✅✅✅ |
165
+ | `wallet.getBalance` | `GET /wallet` [🔗](https://docs.ethswarm.org/api/#tag/Wallet/paths/~1wallet/get) | ❌✅✅ |
166
+ | `connectivity.getTopology` | `GET /topology` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1topology/get) | ✅✅✅ |
167
+ | `connectivity.getNodeAddresses` | `GET /addresses` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1addresses/get) | ✅✅✅ |
168
+ | `connectivity.getPeers` | `GET /peers` [🔗](https://docs.ethswarm.org/api/#tag/Connectivity/paths/~1peers/get) | ✅✅✅ |
169
+ | `balance.getAll` | `GET /balances` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1balances/get) | ❌✅✅ |
170
+ | `balance.getPeer` | `GET /balances/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1balances~1%7Baddress%7D/get) | ❌✅✅ |
171
+ | `balance.getAllPastDueConsumption` | `GET /consumed` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1consumed/get) | ❌✅✅ |
172
+ | `balance.getAllPastDueConsumptionForPeer` | `GET /consumed/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Balance/paths/~1consumed~1%7Baddress%7D/get) | ❌✅✅ |
173
+ | `settlement.getAll` | `GET /settlements` [🔗](https://docs.ethswarm.org/api/#tag/Settlements/paths/~1settlements/get) | ❌✅✅ |
174
+ | `settlement.get` | `GET /settlements/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Settlements/paths/~1settlements~1%7Baddress%7D/get) | ❌✅✅ |
175
+ | `chequebook.getAddress` | `GET /chequebook/address` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1address/get) | ❌✅✅ |
176
+ | `chequebook.getBalance` | `GET /chequebook/balance` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1balance/get) | ❌✅✅ |
177
+ | `cheque.getAllLatest` | `GET /chequebook/cheque` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cheque/get) | ❌✅✅ |
178
+ | `cheque.getAllLatestForPeer` | `GET /chequebook/cheque/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cheque~1%7Bpeer-id%7D/get) | ❌✅✅ |
179
+ | `cheque.getLastCashoutAction` | `GET /chequebook/cashout/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cashout~1%7Bpeer-id%7D/get) | ❌✅✅ |
180
+ | `cheque.cashoutLast` | `POST /chequebook/cashout/:peer` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1cashout~1%7Bpeer-id%7D/post) | ❌✅✅ |
181
+ | `chequebook.deposit` | `POST /chequebook/deposit` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1deposit/post) | ❌✅✅ |
182
+ | `chequebook.withdraw` | `POST /chequebook/withdraw` [🔗](https://docs.ethswarm.org/api/#tag/Chequebook/paths/~1chequebook~1withdraw/post) | ❌✅✅ |
183
+ | `transaction.getAll` | `GET /transactions` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions/get) | ❌✅✅ |
184
+ | `transaction.get` | `GET /transactions/:id` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions~1%7BtxHash%7D/get) | ❌✅✅ |
185
+ | `transaction.rebroadcast` | `POST /transactions/:id` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions~1%7BtxHash%7D/post) | ❌✅✅ |
186
+ | `transaction.cancel` | `DELETE /transactions/:id` [🔗](https://docs.ethswarm.org/api/#tag/Transaction/paths/~1transactions~1%7BtxHash%7D/delete) | ❌✅✅ |
187
+ | `tag.create` | `POST /tags` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags/post) | ❌✅✅ |
188
+ | `tag.get` | `GET /tags/:id` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1%7Buid%7D/get) | ❌✅✅ |
189
+ | `tag.getAll` | `GET /tags` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags/get) | ❌✅✅ |
190
+ | `tag.delete` | `DELETE /tags/:id` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1%7Buid%7D/delete) | ❌✅✅ |
191
+ | `tag.update` | `PATCH /tags/:id` [🔗](https://docs.ethswarm.org/api/#tag/Tag/paths/~1tags~1%7Buid%7D/patch) | ❌✅✅ |
192
+ | `pin.add` | `POST /pins/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins~1%7Breference%7D/post) | ✅✅✅ |
193
+ | `pin.getAll` | `GET /pins` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins/get) | ✅✅✅ |
194
+ | `pin.get` | `GET /pins/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins~1%7Breference%7D/get) | ✅✅✅ |
195
+ | `data.isRetrievable` | `GET /stewardship/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1%7Breference%7D/get) | ✅✅✅ |
196
+ | `pin.reuploadData` | `PUT /stewardship/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Stewardship/paths/~1stewardship~1%7Breference%7D/put) | ❌✅✅ |
197
+ | `pin.remove` | `DELETE /pins/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Pinning/paths/~1pins~1%7Breference%7D/delete) | ✅✅✅ |
198
+ | `grantee.get` | `GET /grantee/:reference` [🔗](https://docs.ethswarm.org/api/#tag/ACT/paths/~1grantee~1%7Breference%7D/get) | ❌✅✅ |
199
+ | `grantee.create` | `POST /grantee` [🔗](https://docs.ethswarm.org/api/#tag/ACT/paths/~1grantee/post) | ❌✅✅ |
200
+ | `grantee.patch` | `PATCH /grantee/:reference` [🔗](https://docs.ethswarm.org/api/#tag/ACT/paths/~1grantee~1%7Breference%7D/patch) | ❌✅✅ |
201
+ | `messaging.pssSend` | `POST /pss/send/:topic/:target` [🔗](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1send~1%7Btopic%7D~1%7Btargets%7D/post) | ❌✅✅ |
202
+ | `messaging.pssSubscribe` _Websocket_ | `GET /pss/subscribe/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1subscribe~1%7Btopic%7D/get) | ❌❌✅ |
203
+ | `messaging.pssReceive` | `GET /pss/subscribe/:topic` [🔗](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1subscribe~1%7Btopic%7D/get) | ❌❌✅ |
204
+ | `stamp.getAll` | `GET /stamps` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps/get) | ❌✅✅ |
205
+ | `stamp.getAllGlobal` | `GET /batches` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1batches/get) | ❌✅✅ |
206
+ | `stamp.get` | `GET /stamps/:batchId` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D/get) | ❌✅✅ |
207
+ | `stamp.getBuckets` | `GET /stamps/:batchId/buckets` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D~1buckets/get) | ❌✅✅ |
208
+ | `stamp.create` | `POST /stamps/:amount/:depth` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bamount%7D~1%7Bdepth%7D/post) | ❌✅✅ |
209
+ | `stamp.topUp` | `PATCH /stamps/topup/:batchId/:amount` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1topup~1%7Bbatch_id%7D~1%7Bamount%7D/patch) | ❌✅✅ |
210
+ | `stamp.dilute` | `PATCH /stamps/dilute/:batchId/:depth` [🔗](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1dilute~1%7Bbatch_id%7D~1%7Bdepth%7D/patch) | ❌✅✅ |
211
+ | `createEnvelope` | `POST /envelope/:reference` [🔗](https://docs.ethswarm.org/api/#tag/Envelope/paths/~1envelope~1%7Baddress%7D/post) | ❌✅✅ |
212
+ | `stake.get` | `GET /stake` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake/get) | ❌❌✅ |
213
+ | `stake.deposit` | `POST /stake` [🔗](https://docs.ethswarm.org/api/#tag/Staking/paths/~1stake~1%7Bamount%7D/post) | ❌❌✅ |
213
214
 
214
215
  ### Utils
215
216
 
@@ -230,12 +231,12 @@ The `toString` method uses `toHex`.
230
231
 
231
232
  #### Stamps
232
233
 
233
- - `getAmountForTtl`
234
- - `getDepthForCapacity`
234
+ - `getAmountForDuration`
235
+ - `getDepthForSize`
235
236
  - `getStampCost`
236
237
  - `getStampEffectiveBytes`
237
- - `getStampMaximumCapacityBytes`
238
- - `getStampTtlSeconds`
238
+ - `getStampTheoreticalBytes`
239
+ - `getStampDuration`
239
240
  - `getStampUsage`
240
241
 
241
242
  ## Usage
@@ -249,14 +250,14 @@ main()
249
250
 
250
251
  async function main() {
251
252
  const bee = new Bee(SWARM_GATEWAY_URL)
252
- const { reference } = await bee.uploadData(NULL_STAMP, 'Hello, World!')
253
+ const { reference } = await bee.data.upload(NULL_STAMP, 'Hello, World!')
253
254
  console.log(reference.toHex())
254
255
  }
255
256
  ```
256
257
 
257
258
  ### Create or select an existing postage batch
258
259
 
259
- Swarm incentivizes nodes in the network to store content, therefor all uploads require a paid
260
+ Swarm incentivizes nodes in the network to store content, therefore all uploads require a paid
260
261
  [postage batch](https://docs.ethswarm.org/docs/learn/technology/contracts/postage-stamp).
261
262
 
262
263
  ```js
@@ -266,13 +267,13 @@ async function getOrCreatePostageBatch() {
266
267
  const bee = new Bee('http://localhost:1633')
267
268
  let batchId
268
269
 
269
- const batches = await bee.getPostageBatches()
270
+ const batches = await bee.stamp.getAll()
270
271
  const usable = batches.find(x => x.usable)
271
272
 
272
273
  if (usable) {
273
274
  batchId = usable.batchID
274
275
  } else {
275
- batchId = await bee.buyStorage(Size.fromGigabytes(1), Duration.fromDays(7))
276
+ batchId = await bee.storage.buy(Size.fromGigabytes(1), Duration.fromDays(7))
276
277
  }
277
278
  }
278
279
  ```
@@ -286,8 +287,8 @@ import { Bee } from '@ethersphere/bee-js'
286
287
 
287
288
  const bee = new Bee('http://localhost:1633')
288
289
 
289
- const uploadResult = await bee.uploadData(batchId, 'Bee is awesome!')
290
- const data = await bee.downloadData(uploadResult.reference)
290
+ const uploadResult = await bee.data.upload(batchId, 'Bee is awesome!')
291
+ const data = await bee.data.download(uploadResult.reference)
291
292
 
292
293
  console.log(data.toUtf8()) // prints 'Bee is awesome!'
293
294
  ```
@@ -298,7 +299,7 @@ console.log(data.toUtf8()) // prints 'Bee is awesome!'
298
299
  import { Bee } from '@ethersphere/bee-js'
299
300
 
300
301
  const bee = new Bee('http://localhost:1633')
301
- const result = await bee.uploadFile(batchId, file)
302
+ const result = await bee.file.upload(batchId, file)
302
303
  ```
303
304
 
304
305
  ### Upload multiple files or a directory (React)
@@ -307,7 +308,7 @@ const result = await bee.uploadFile(batchId, file)
307
308
  import { Bee } from '@ethersphere/bee-js'
308
309
 
309
310
  const bee = new Bee('http://localhost:1633')
310
- const result = await bee.uploadFiles(batchId, fileList)
311
+ const result = await bee.collection.uploadFromFileList(batchId, fileList)
311
312
  ```
312
313
 
313
314
  ### Upload arbitrary large file (Node.js)
@@ -318,7 +319,7 @@ import { createReadStream } from 'fs'
318
319
 
319
320
  const bee = new Bee('http://localhost:1633')
320
321
  const readable = createReadStream('./path/to/large.bin')
321
- const uploadResult = await bee.uploadFile(batchId, readable)
322
+ const uploadResult = await bee.file.upload(batchId, readable)
322
323
  ```
323
324
 
324
325
  ### Upload arbitrary large directories (Node.js)
@@ -328,7 +329,7 @@ import { Bee } from '@ethersphere/bee-js'
328
329
  import { createReadStream } from 'fs'
329
330
 
330
331
  const bee = new Bee('http://localhost:1633')
331
- const uploadResult = await bee.uploadFilesFromDirectory(batchId, './path/to/gallery/')
332
+ const uploadResult = await bee.collection.uploadFromDirectory(batchId, './path/to/gallery/')
332
333
  ```
333
334
 
334
335
  ### Customize http/https agent and headers
@@ -379,7 +380,7 @@ After making changes, link the package to your project by running `npm link` in
379
380
 
380
381
  [Code coverage](https://bah5acgza26tlmya36bdiu5cdfs3hh22hqthkhfv6cvq2ugxqrv5aw267ydlq.bzz.limo/)
381
382
 
382
- Tests are currently run against a mainnet Bee nodes. This is temporary and this section will be revised in the future.
383
+ Tests are currently run against a mainnet Bee node. This is temporary and this section will be revised in the future.
383
384
 
384
385
  ## License
385
386
 
@@ -4,14 +4,13 @@ exports.upload = upload;
4
4
  exports.head = head;
5
5
  exports.download = download;
6
6
  exports.downloadReadable = downloadReadable;
7
+ const core_sdk_1 = require("@ethersphere/core-sdk");
7
8
  const cafe_utility_1 = require("cafe-utility");
8
9
  const upload_1 = require("../types/schema/upload");
9
- const bytes_1 = require("../utils/bytes");
10
10
  const headers_1 = require("../utils/headers");
11
11
  const http_1 = require("../utils/http");
12
12
  const schema_1 = require("../utils/schema");
13
13
  const type_1 = require("../utils/type");
14
- const typed_bytes_1 = require("../utils/typed-bytes");
15
14
  const endpoint = 'bytes';
16
15
  /**
17
16
  * Raw HTTP calls for the `/bytes` endpoint.
@@ -32,7 +31,7 @@ async function upload(requestOptions, data, postageBatchId, options) {
32
31
  reference: body.reference,
33
32
  tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
34
33
  historyAddress: response.headers['swarm-act-history-address']
35
- ? cafe_utility_1.Optional.of(new typed_bytes_1.Reference(response.headers['swarm-act-history-address']))
34
+ ? cafe_utility_1.Optional.of(new core_sdk_1.Reference(response.headers['swarm-act-history-address']))
36
35
  : cafe_utility_1.Optional.empty(),
37
36
  };
38
37
  }
@@ -55,7 +54,7 @@ async function download(requestOptions, resource, options) {
55
54
  url: `${endpoint}/${resource}`,
56
55
  headers: (0, headers_1.prepareRequestHeaders)(null, options),
57
56
  });
58
- return new bytes_1.Bytes(response.data);
57
+ return new core_sdk_1.Bytes(response.data);
59
58
  }
60
59
  async function downloadReadable(requestOptions, resource, options) {
61
60
  if (options) {
@@ -4,15 +4,14 @@ exports.uploadFile = uploadFile;
4
4
  exports.downloadFile = downloadFile;
5
5
  exports.downloadFileReadable = downloadFileReadable;
6
6
  exports.uploadCollection = uploadCollection;
7
+ const core_sdk_1 = require("@ethersphere/core-sdk");
7
8
  const cafe_utility_1 = require("cafe-utility");
8
9
  const upload_1 = require("../types/schema/upload");
9
- const bytes_1 = require("../utils/bytes");
10
10
  const collection_1 = require("../utils/collection");
11
11
  const headers_1 = require("../utils/headers");
12
12
  const http_1 = require("../utils/http");
13
13
  const tar_uploader_1 = require("../utils/tar-uploader");
14
14
  const type_1 = require("../utils/type");
15
- const typed_bytes_1 = require("../utils/typed-bytes");
16
15
  const bzzEndpoint = 'bzz';
17
16
  /**
18
17
  * Raw HTTP calls for the `/bzz` endpoint.
@@ -37,7 +36,7 @@ async function uploadFile(requestOptions, data, postageBatchId, name, options) {
37
36
  reference: body.reference,
38
37
  tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
39
38
  historyAddress: response.headers['swarm-act-history-address']
40
- ? cafe_utility_1.Optional.of(new typed_bytes_1.Reference(response.headers['swarm-act-history-address']))
39
+ ? cafe_utility_1.Optional.of(new core_sdk_1.Reference(response.headers['swarm-act-history-address']))
41
40
  : cafe_utility_1.Optional.empty(),
42
41
  };
43
42
  }
@@ -50,12 +49,12 @@ async function downloadFile(requestOptions, resource, path = '', options) {
50
49
  });
51
50
  const file = {
52
51
  ...(0, headers_1.readFileHeaders)(response.headers),
53
- data: new bytes_1.Bytes(response.data),
52
+ data: new core_sdk_1.Bytes(response.data),
54
53
  };
55
54
  return file;
56
55
  }
57
56
  async function downloadFileReadable(requestOptions, reference, path = '', options) {
58
- reference = new typed_bytes_1.Reference(reference);
57
+ reference = new core_sdk_1.Reference(reference);
59
58
  const response = await (0, http_1.http)(requestOptions, {
60
59
  method: 'GET',
61
60
  responseType: 'stream',
@@ -78,7 +77,7 @@ async function uploadCollection(requestOptions, collection, postageBatchId, opti
78
77
  reference: body.reference,
79
78
  tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
80
79
  historyAddress: response.headers['swarm-act-history-address']
81
- ? cafe_utility_1.Optional.of(new typed_bytes_1.Reference(response.headers['swarm-act-history-address']))
80
+ ? cafe_utility_1.Optional.of(new core_sdk_1.Reference(response.headers['swarm-act-history-address']))
82
81
  : cafe_utility_1.Optional.empty(),
83
82
  };
84
83
  }
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.upload = upload;
4
4
  exports.download = download;
5
+ const core_sdk_1 = require("@ethersphere/core-sdk");
5
6
  const cafe_utility_1 = require("cafe-utility");
6
7
  const upload_1 = require("../types/schema/upload");
7
8
  const headers_1 = require("../utils/headers");
8
9
  const http_1 = require("../utils/http");
9
10
  const type_1 = require("../utils/type");
10
- const typed_bytes_1 = require("../utils/typed-bytes");
11
11
  const endpoint = 'chunks';
12
12
  /**
13
13
  * Raw HTTP calls for the `/chunks` endpoint.
@@ -28,12 +28,12 @@ async function upload(requestOptions, data, stamp, options) {
28
28
  reference: body.reference,
29
29
  tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
30
30
  historyAddress: response.headers['swarm-act-history-address']
31
- ? cafe_utility_1.Optional.of(new typed_bytes_1.Reference(response.headers['swarm-act-history-address']))
31
+ ? cafe_utility_1.Optional.of(new core_sdk_1.Reference(response.headers['swarm-act-history-address']))
32
32
  : cafe_utility_1.Optional.empty(),
33
33
  };
34
34
  }
35
35
  async function download(requestOptions, reference, options) {
36
- reference = new typed_bytes_1.Reference(reference);
36
+ reference = new core_sdk_1.Reference(reference);
37
37
  const response = await (0, http_1.http)(requestOptions, {
38
38
  responseType: 'arraybuffer',
39
39
  url: `${endpoint}/${reference}`,
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.postEnvelope = postEnvelope;
4
+ const core_sdk_1 = require("@ethersphere/core-sdk");
4
5
  const envelope_1 = require("../types/schema/envelope");
5
6
  const http_1 = require("../utils/http");
6
7
  const ENVELOPE_ENDPOINT = 'envelope';
@@ -15,10 +16,10 @@ async function postEnvelope(requestOptions, postageBatchId, reference) {
15
16
  });
16
17
  const body = envelope_1.PostEnvelopeBodyResponse.parse(response.data);
17
18
  return {
18
- issuer: body.issuer,
19
+ issuer: new core_sdk_1.EthAddress(body.issuer),
19
20
  index: body.index,
20
21
  timestamp: body.timestamp,
21
- signature: body.signature,
22
+ signature: new core_sdk_1.Signature(body.signature),
22
23
  batchId: postageBatchId,
23
24
  };
24
25
  }
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createFeedManifest = createFeedManifest;
4
4
  exports.fetchLatestFeedUpdate = fetchLatestFeedUpdate;
5
5
  exports.probeFeed = probeFeed;
6
+ const core_sdk_1 = require("@ethersphere/core-sdk");
6
7
  const upload_1 = require("../types/schema/upload");
7
- const bytes_1 = require("../utils/bytes");
8
8
  const error_1 = require("../utils/error");
9
9
  const headers_1 = require("../utils/headers");
10
10
  const http_1 = require("../utils/http");
11
- const typed_bytes_1 = require("../utils/typed-bytes");
12
11
  const feedEndpoint = 'feeds';
13
12
  async function createFeedManifest(requestOptions, owner, topic, stamp, options) {
14
13
  const response = await (0, http_1.http)(requestOptions, {
@@ -29,8 +28,8 @@ function readFeedUpdateHeaders(headers) {
29
28
  throw new error_1.BeeError('Response did not contain expected swarm-feed-index-next!');
30
29
  }
31
30
  return {
32
- feedIndex: new typed_bytes_1.FeedIndex(feedIndex),
33
- feedIndexNext: new typed_bytes_1.FeedIndex(feedIndexNext),
31
+ feedIndex: new core_sdk_1.FeedIndex(feedIndex),
32
+ feedIndexNext: new core_sdk_1.FeedIndex(feedIndexNext),
34
33
  };
35
34
  }
36
35
  async function fetchLatestFeedUpdate(requestOptions, owner, topic, options) {
@@ -40,7 +39,7 @@ async function fetchLatestFeedUpdate(requestOptions, owner, topic, options) {
40
39
  params: { ...options },
41
40
  });
42
41
  return {
43
- payload: new bytes_1.Bytes(response.data),
42
+ payload: new core_sdk_1.Bytes(response.data),
44
43
  ...readFeedUpdateHeaders(response.headers),
45
44
  };
46
45
  }
@@ -4,10 +4,10 @@ exports.pin = pin;
4
4
  exports.unpin = unpin;
5
5
  exports.getAllPins = getAllPins;
6
6
  exports.getPin = getPin;
7
+ const core_sdk_1 = require("@ethersphere/core-sdk");
7
8
  const pinning_1 = require("../types/schema/pinning");
8
9
  const upload_1 = require("../types/schema/upload");
9
10
  const http_1 = require("../utils/http");
10
- const typed_bytes_1 = require("../utils/typed-bytes");
11
11
  const PINNING_ENDPOINT = 'pins';
12
12
  /** Pins local data with the given reference. */
13
13
  async function pin(requestOptions, reference) {
@@ -33,7 +33,7 @@ async function getAllPins(requestOptions) {
33
33
  url: PINNING_ENDPOINT,
34
34
  });
35
35
  const { references } = pinning_1.GetAllPinsResponse.parse(response.data);
36
- return (references ?? []).map(x => new typed_bytes_1.Reference(x));
36
+ return (references ?? []).map(x => new core_sdk_1.Reference(x));
37
37
  }
38
38
  /** Gets the pinning status of the chunk with the given reference. */
39
39
  async function getPin(requestOptions, reference) {
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.upload = upload;
4
+ const core_sdk_1 = require("@ethersphere/core-sdk");
4
5
  const cafe_utility_1 = require("cafe-utility");
5
6
  const upload_1 = require("../types/schema/upload");
6
7
  const headers_1 = require("../utils/headers");
7
8
  const http_1 = require("../utils/http");
8
9
  const type_1 = require("../utils/type");
9
- const typed_bytes_1 = require("../utils/typed-bytes");
10
10
  const socEndpoint = 'soc';
11
11
  /**
12
12
  * Raw HTTP calls for the `/soc` endpoint.
@@ -28,7 +28,7 @@ async function upload(requestOptions, owner, identifier, signature, data, stamp,
28
28
  reference: body.reference,
29
29
  tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
30
30
  historyAddress: response.headers['swarm-act-history-address']
31
- ? cafe_utility_1.Optional.of(new typed_bytes_1.Reference(response.headers['swarm-act-history-address']))
31
+ ? cafe_utility_1.Optional.of(new core_sdk_1.Reference(response.headers['swarm-act-history-address']))
32
32
  : cafe_utility_1.Optional.empty(),
33
33
  };
34
34
  }