@ethersphere/bee-js 13.0.0-upcoming.gf9d33e6 → 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.
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
 
@@ -35,11 +35,11 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Data = void 0;
37
37
  const core_sdk_1 = require("@ethersphere/core-sdk");
38
+ const bytes = __importStar(require("../api/bytes"));
39
+ const stewardship = __importStar(require("../api/stewardship"));
38
40
  const resource_locator_1 = require("../utils/resource-locator");
39
41
  const schema_1 = require("../utils/schema");
40
42
  const type_1 = require("../utils/type");
41
- const bytes = __importStar(require("../api/bytes"));
42
- const stewardship = __importStar(require("../api/stewardship"));
43
43
  /**
44
44
  * Raw data operations backed by the `/bytes` endpoint.
45
45
  *
@@ -25,7 +25,9 @@ exports.DEFAULT_HTTP_CONFIG = {
25
25
  * @param config Internal settings and/or Bee settings
26
26
  */
27
27
  async function http(options, config) {
28
- const requestConfig = cafe_utility_1.Objects.deepMerge3(exports.DEFAULT_HTTP_CONFIG, config, options);
28
+ const rawData = config.data;
29
+ const requestConfig = cafe_utility_1.Objects.deepMerge3(exports.DEFAULT_HTTP_CONFIG, { ...config, data: undefined }, options);
30
+ requestConfig.data = rawData;
29
31
  if (options.signal) {
30
32
  requestConfig.signal = options.signal;
31
33
  }
@@ -69,8 +69,8 @@ function isTag(value) {
69
69
  * @throws TypeError if not valid
70
70
  */
71
71
  function assertData(value) {
72
- if (typeof value !== 'string' && !(value instanceof Uint8Array)) {
73
- throw new TypeError('Data must be either string or Uint8Array!');
72
+ if (typeof value !== 'string' && !(value instanceof Uint8Array) && !(value instanceof Blob) && !isReadable(value)) {
73
+ throw new TypeError('Data must be either string, Uint8Array, Blob or Readable!');
74
74
  }
75
75
  }
76
76
  /**
@@ -46,6 +46,14 @@ catch {
46
46
  console.error('Run: npm install --save-dev typescript');
47
47
  process.exit(1);
48
48
  }
49
+ // TypeScript 7 replaced the classic Compiler API (ts.createProgram, ts.sys, etc.) this tool
50
+ // is built on with a new, explicitly "unstable" native AST API with a different shape -
51
+ // there's no ts.createProgram to fall back to, so fail clearly instead of crashing on it.
52
+ if (typeof ts.createProgram !== 'function') {
53
+ console.error(`This tool needs TypeScript's classic Compiler API, removed in TypeScript 7.0 (found ${ts.version}).`);
54
+ console.error('Install a supported version: npm install --save-dev typescript@^5.9.0');
55
+ process.exit(1);
56
+ }
49
57
  const EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx'];
50
58
  const SKIP_DIRS = new Set(['node_modules', 'dist', '.git']);
51
59
  function walkFiles(dir) {
@@ -452,8 +452,23 @@ function transform(sourceFile, checker) {
452
452
  const [receiverArg, methodArg] = node.arguments;
453
453
  if (receiverArg && methodArg && ts.isStringLiteralLike(methodArg)) {
454
454
  const mapping = METHOD_MAP[methodArg.text];
455
- if (mapping && isBeeReceiver(receiverArg)) {
456
- const quote = methodArg.getText(sourceFile)[0];
455
+ const quote = methodArg.getText(sourceFile)[0];
456
+ // Namespaces are per-instance properties, not on Bee.prototype, so spying there
457
+ // needs a throwaway instance to reach the namespace's own (shared) prototype.
458
+ if (mapping && ts.isPropertyAccessExpression(receiverArg) && receiverArg.name.text === 'prototype' && isBeeReceiver(receiverArg.expression)) {
459
+ const className = receiverArg.expression.getText(sourceFile);
460
+ replacements.push({
461
+ start: receiverArg.getStart(sourceFile),
462
+ end: receiverArg.getEnd(),
463
+ text: `Object.getPrototypeOf(new ${className}('http://localhost:1633').${mapping.namespace})`,
464
+ });
465
+ replacements.push({
466
+ start: methodArg.getStart(sourceFile),
467
+ end: methodArg.getEnd(),
468
+ text: `${quote}${mapping.newName}${quote}`,
469
+ });
470
+ }
471
+ else if (mapping && isBeeReceiver(receiverArg)) {
457
472
  replacements.push({
458
473
  start: receiverArg.getStart(sourceFile),
459
474
  end: receiverArg.getEnd(),