@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.
- package/README.md +104 -103
- package/dist/cjs/api/bytes.js +3 -4
- package/dist/cjs/api/bzz.js +5 -6
- package/dist/cjs/api/chunk.js +3 -3
- package/dist/cjs/api/envelope.js +3 -2
- package/dist/cjs/api/feed.js +4 -5
- package/dist/cjs/api/pin.js +2 -2
- package/dist/cjs/api/soc.js +2 -2
- package/dist/cjs/bee.js +18 -19
- package/dist/cjs/chunk/soc.js +21 -63
- package/dist/cjs/feed/identifier.js +3 -4
- package/dist/cjs/feed/index.js +17 -19
- package/dist/cjs/feed/retrievable.js +2 -2
- package/dist/cjs/index.js +18 -8
- package/dist/cjs/manifest/manifest.js +97 -333
- package/dist/cjs/modules/balance.js +3 -3
- package/dist/cjs/modules/cheque.js +4 -4
- package/dist/cjs/modules/chunk.js +8 -8
- package/dist/cjs/modules/collection.js +6 -6
- package/dist/cjs/modules/connectivity.js +3 -3
- package/dist/cjs/modules/data.js +6 -6
- package/dist/cjs/modules/feed.js +10 -10
- package/dist/cjs/modules/file.js +3 -3
- package/dist/cjs/modules/grantee.js +9 -9
- package/dist/cjs/modules/messaging.js +15 -17
- package/dist/cjs/modules/pin.js +6 -6
- package/dist/cjs/modules/settlement.js +2 -2
- package/dist/cjs/modules/soc.js +3 -3
- package/dist/cjs/modules/stamp.js +7 -7
- package/dist/cjs/modules/tag.js +2 -2
- package/dist/cjs/modules/transaction.js +4 -4
- package/dist/cjs/modules/wallet.js +3 -3
- package/dist/cjs/types/schema/chequebook.js +5 -5
- package/dist/cjs/types/schema/connectivity.js +5 -5
- package/dist/cjs/types/schema/envelope.js +5 -5
- package/dist/cjs/types/schema/grantee.js +4 -4
- package/dist/cjs/types/schema/stake.js +2 -2
- package/dist/cjs/types/schema/stamps.js +4 -4
- package/dist/cjs/types/schema/states.js +2 -2
- package/dist/cjs/types/schema/transactions.js +3 -3
- package/dist/cjs/types/schema/upload.js +2 -2
- package/dist/cjs/utils/chunk-stream.browser.js +24 -16
- package/dist/cjs/utils/chunk-stream.js +17 -9
- package/dist/cjs/utils/constants.js +3 -3
- package/dist/cjs/utils/expose.js +4 -4
- package/dist/cjs/utils/headers.js +4 -4
- package/dist/cjs/utils/http.js +3 -1
- package/dist/cjs/utils/pss.js +2 -2
- package/dist/cjs/utils/resource-locator.js +2 -2
- package/dist/cjs/utils/schema.js +4 -4
- package/dist/cjs/utils/stamps.js +15 -130
- package/dist/cjs/utils/type.js +2 -2
- package/dist/codemod/index.js +141 -0
- package/dist/codemod/transforms/v13.js +524 -0
- package/dist/index.browser.min.js +2 -1
- package/dist/index.browser.min.js.LICENSE.txt +3 -0
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/api/bytes.js +1 -2
- package/dist/mjs/api/bzz.js +1 -2
- package/dist/mjs/api/chunk.js +1 -1
- package/dist/mjs/api/envelope.js +3 -2
- package/dist/mjs/api/feed.js +1 -2
- package/dist/mjs/api/pin.js +1 -1
- package/dist/mjs/api/soc.js +1 -1
- package/dist/mjs/bee.js +13 -14
- package/dist/mjs/chunk/soc.js +11 -49
- package/dist/mjs/feed/identifier.js +2 -3
- package/dist/mjs/feed/index.js +6 -8
- package/dist/mjs/feed/retrievable.js +1 -1
- package/dist/mjs/index.js +2 -5
- package/dist/mjs/manifest/manifest.js +95 -339
- package/dist/mjs/modules/balance.js +1 -1
- package/dist/mjs/modules/cheque.js +1 -1
- package/dist/mjs/modules/chunk.js +1 -1
- package/dist/mjs/modules/collection.js +1 -1
- package/dist/mjs/modules/connectivity.js +1 -1
- package/dist/mjs/modules/data.js +3 -3
- package/dist/mjs/modules/feed.js +1 -1
- package/dist/mjs/modules/file.js +1 -1
- package/dist/mjs/modules/grantee.js +1 -1
- package/dist/mjs/modules/messaging.js +3 -5
- package/dist/mjs/modules/pin.js +1 -1
- package/dist/mjs/modules/settlement.js +1 -1
- package/dist/mjs/modules/soc.js +1 -1
- package/dist/mjs/modules/stamp.js +1 -1
- package/dist/mjs/modules/tag.js +1 -1
- package/dist/mjs/modules/transaction.js +1 -1
- package/dist/mjs/modules/wallet.js +1 -1
- package/dist/mjs/types/schema/chequebook.js +1 -1
- package/dist/mjs/types/schema/connectivity.js +1 -1
- package/dist/mjs/types/schema/envelope.js +5 -5
- package/dist/mjs/types/schema/grantee.js +1 -1
- package/dist/mjs/types/schema/stake.js +1 -1
- package/dist/mjs/types/schema/stamps.js +1 -1
- package/dist/mjs/types/schema/states.js +1 -1
- package/dist/mjs/types/schema/transactions.js +1 -1
- package/dist/mjs/types/schema/upload.js +1 -1
- package/dist/mjs/utils/chunk-stream.browser.js +28 -18
- package/dist/mjs/utils/chunk-stream.js +21 -11
- package/dist/mjs/utils/constants.js +1 -1
- package/dist/mjs/utils/expose.js +1 -1
- package/dist/mjs/utils/headers.js +1 -1
- package/dist/mjs/utils/http.js +6 -1
- package/dist/mjs/utils/pss.js +1 -1
- package/dist/mjs/utils/resource-locator.js +1 -1
- package/dist/mjs/utils/schema.js +1 -1
- package/dist/mjs/utils/stamps.js +5 -99
- package/dist/mjs/utils/type.js +2 -2
- package/dist/types/api/balance.d.ts +1 -1
- package/dist/types/api/batches.d.ts +1 -1
- package/dist/types/api/bytes.d.ts +3 -3
- package/dist/types/api/bzz.d.ts +1 -2
- package/dist/types/api/chequebook.d.ts +1 -1
- package/dist/types/api/chunk.d.ts +1 -1
- package/dist/types/api/connectivity.d.ts +1 -1
- package/dist/types/api/consumed.d.ts +1 -1
- package/dist/types/api/envelope.d.ts +1 -1
- package/dist/types/api/feed.d.ts +1 -2
- package/dist/types/api/grantee.d.ts +1 -1
- package/dist/types/api/pin.d.ts +1 -1
- package/dist/types/api/pss.d.ts +1 -1
- package/dist/types/api/settlement.d.ts +1 -1
- package/dist/types/api/soc.d.ts +1 -1
- package/dist/types/api/stake.d.ts +1 -1
- package/dist/types/api/stamp.d.ts +1 -1
- package/dist/types/api/stewardship.d.ts +1 -1
- package/dist/types/api/tag.d.ts +1 -1
- package/dist/types/api/transaction.d.ts +1 -1
- package/dist/types/api/wallet.d.ts +1 -1
- package/dist/types/bee.d.ts +11 -13
- package/dist/types/chunk/soc.d.ts +3 -48
- package/dist/types/feed/identifier.d.ts +1 -1
- package/dist/types/feed/index.d.ts +1 -3
- package/dist/types/feed/retrievable.d.ts +1 -1
- package/dist/types/index.d.ts +17 -20
- package/dist/types/manifest/manifest.d.ts +24 -33
- package/dist/types/modules/balance.d.ts +1 -1
- package/dist/types/modules/cheque.d.ts +1 -1
- package/dist/types/modules/chequebook.d.ts +1 -1
- package/dist/types/modules/chunk.d.ts +1 -2
- package/dist/types/modules/collection.d.ts +2 -2
- package/dist/types/modules/connectivity.d.ts +1 -1
- package/dist/types/modules/context.d.ts +1 -1
- package/dist/types/modules/data.d.ts +3 -3
- package/dist/types/modules/feed.d.ts +1 -1
- package/dist/types/modules/file.d.ts +1 -2
- package/dist/types/modules/grantee.d.ts +1 -1
- package/dist/types/modules/messaging.d.ts +1 -2
- package/dist/types/modules/pin.d.ts +1 -1
- package/dist/types/modules/settlement.d.ts +1 -1
- package/dist/types/modules/soc.d.ts +1 -1
- package/dist/types/modules/stake.d.ts +1 -1
- package/dist/types/modules/stamp.d.ts +1 -1
- package/dist/types/modules/storage.d.ts +1 -1
- package/dist/types/modules/tag.d.ts +1 -1
- package/dist/types/modules/transaction.d.ts +1 -1
- package/dist/types/modules/wallet.d.ts +1 -1
- package/dist/types/types/debug.d.ts +1 -1
- package/dist/types/types/index.d.ts +2 -11
- package/dist/types/types/schema/chequebook.d.ts +1 -1
- package/dist/types/types/schema/connectivity.d.ts +1 -1
- package/dist/types/types/schema/grantee.d.ts +1 -1
- package/dist/types/types/schema/stake.d.ts +1 -1
- package/dist/types/types/schema/stamps.d.ts +1 -1
- package/dist/types/types/schema/states.d.ts +1 -1
- package/dist/types/types/schema/transactions.d.ts +1 -1
- package/dist/types/types/schema/upload.d.ts +1 -1
- package/dist/types/utils/chunk-stream.browser.d.ts +1 -1
- package/dist/types/utils/chunk-stream.d.ts +2 -2
- package/dist/types/utils/constants.d.ts +1 -1
- package/dist/types/utils/expose.d.ts +1 -1
- package/dist/types/utils/headers.d.ts +1 -1
- package/dist/types/utils/pss.d.ts +1 -1
- package/dist/types/utils/resource-locator.d.ts +1 -1
- package/dist/types/utils/schema.d.ts +1 -1
- package/dist/types/utils/stamps.d.ts +2 -27
- package/dist/types/utils/tar-uploader.browser.d.ts +1 -1
- package/dist/types/utils/tar-uploader.d.ts +1 -1
- package/dist/types/utils/type.d.ts +1 -1
- package/package.json +7 -2
- package/dist/cjs/chunk/bmt.js +0 -37
- package/dist/cjs/chunk/cac.js +0 -43
- package/dist/cjs/stamper/stamper.js +0 -44
- package/dist/cjs/utils/bytes.js +0 -116
- package/dist/cjs/utils/cid.js +0 -37
- package/dist/cjs/utils/redundancy.js +0 -133
- package/dist/cjs/utils/typed-bytes.js +0 -186
- package/dist/mjs/chunk/bmt.js +0 -34
- package/dist/mjs/chunk/cac.js +0 -34
- package/dist/mjs/stamper/stamper.js +0 -40
- package/dist/mjs/utils/bytes.js +0 -102
- package/dist/mjs/utils/cid.js +0 -32
- package/dist/mjs/utils/redundancy.js +0 -98
- package/dist/mjs/utils/typed-bytes.js +0 -167
- package/dist/types/chunk/bmt.d.ts +0 -16
- package/dist/types/chunk/cac.d.ts +0 -40
- package/dist/types/stamper/stamper.d.ts +0 -15
- package/dist/types/utils/bytes.d.ts +0 -19
- package/dist/types/utils/cid.d.ts +0 -10
- package/dist/types/utils/redundancy.d.ts +0 -21
- 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.
|
|
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`,
|
|
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
|
|
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
|
|
117
|
-
|
|
|
118
|
-
| MantarayNode
|
|
119
|
-
|
|
|
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.
|
|
126
|
-
| SOCReader | SingleOwnerChunk reader | `bee.
|
|
127
|
-
| FeedWriter | Feed writer | `bee.
|
|
128
|
-
| FeedReader | Feed reader | `bee.
|
|
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
|
|
137
|
-
|
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
143
|
-
| `
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `SOCWriter.upload`
|
|
147
|
-
| `FeedReader.download`
|
|
148
|
-
| `FeedWriter.
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `isConnected`
|
|
157
|
-
| `getHealth`
|
|
158
|
-
| `getReadiness`
|
|
159
|
-
| `getNodeInfo`
|
|
160
|
-
| `getChainState`
|
|
161
|
-
| `getRedistributionState`
|
|
162
|
-
| `getReserveState`
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `getTopology`
|
|
166
|
-
| `
|
|
167
|
-
| `getPeers`
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `getLastCashoutAction`
|
|
179
|
-
| `
|
|
180
|
-
| `
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
191
|
-
| `pin`
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `pssSend`
|
|
201
|
-
| `pssSubscribe` _Websocket_
|
|
202
|
-
| `pssReceive`
|
|
203
|
-
| `
|
|
204
|
-
| `
|
|
205
|
-
| `
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `createEnvelope`
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
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
|
-
- `
|
|
234
|
-
- `
|
|
234
|
+
- `getAmountForDuration`
|
|
235
|
+
- `getDepthForSize`
|
|
235
236
|
- `getStampCost`
|
|
236
237
|
- `getStampEffectiveBytes`
|
|
237
|
-
- `
|
|
238
|
-
- `
|
|
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.
|
|
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,
|
|
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.
|
|
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.
|
|
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.
|
|
290
|
-
const data = await bee.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
package/dist/cjs/api/bytes.js
CHANGED
|
@@ -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
|
|
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
|
|
57
|
+
return new core_sdk_1.Bytes(response.data);
|
|
59
58
|
}
|
|
60
59
|
async function downloadReadable(requestOptions, resource, options) {
|
|
61
60
|
if (options) {
|
package/dist/cjs/api/bzz.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
}
|
package/dist/cjs/api/chunk.js
CHANGED
|
@@ -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
|
|
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
|
|
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}`,
|
package/dist/cjs/api/envelope.js
CHANGED
|
@@ -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
|
}
|
package/dist/cjs/api/feed.js
CHANGED
|
@@ -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
|
|
33
|
-
feedIndexNext: new
|
|
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
|
|
42
|
+
payload: new core_sdk_1.Bytes(response.data),
|
|
44
43
|
...readFeedUpdateHeaders(response.headers),
|
|
45
44
|
};
|
|
46
45
|
}
|
package/dist/cjs/api/pin.js
CHANGED
|
@@ -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
|
|
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) {
|
package/dist/cjs/api/soc.js
CHANGED
|
@@ -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
|
|
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
|
}
|