@ethersphere/bee-js 1.2.1 → 3.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 (181) hide show
  1. package/CHANGELOG.md +135 -2
  2. package/README.md +3 -1
  3. package/dist/index.browser.min.js +1 -1
  4. package/dist/index.browser.min.js.LICENSE.txt +51 -0
  5. package/dist/index.browser.min.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.LICENSE.txt +42 -0
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/src/bee-debug.d.ts +75 -38
  10. package/dist/src/bee.d.ts +88 -82
  11. package/dist/src/chunk/soc.d.ts +6 -6
  12. package/dist/src/feed/index.d.ts +7 -7
  13. package/dist/src/feed/json.d.ts +2 -2
  14. package/dist/src/modules/bytes.d.ts +8 -11
  15. package/dist/src/modules/bzz.d.ts +9 -14
  16. package/dist/src/modules/chunk.d.ts +7 -11
  17. package/dist/src/modules/debug/balance.d.ts +9 -9
  18. package/dist/src/modules/debug/chequebook.d.ts +17 -18
  19. package/dist/src/modules/debug/chunk.d.ts +5 -5
  20. package/dist/src/modules/debug/connectivity.d.ts +7 -7
  21. package/dist/src/modules/debug/settlements.d.ts +5 -5
  22. package/dist/src/modules/debug/stamps.d.ts +7 -5
  23. package/dist/src/modules/debug/states.d.ts +5 -5
  24. package/dist/src/modules/debug/status.d.ts +5 -4
  25. package/dist/src/modules/debug/tag.d.ts +3 -3
  26. package/dist/src/modules/debug/transactions.d.ts +9 -9
  27. package/dist/src/modules/feed.d.ts +5 -5
  28. package/dist/src/modules/pinning.d.ts +9 -9
  29. package/dist/src/modules/pss.d.ts +4 -3
  30. package/dist/src/modules/soc.d.ts +3 -3
  31. package/dist/src/modules/status.d.ts +3 -2
  32. package/dist/src/modules/stewardship.d.ts +4 -4
  33. package/dist/src/modules/tag.d.ts +6 -6
  34. package/dist/src/types/debug.d.ts +4 -2
  35. package/dist/src/types/index.d.ts +71 -19
  36. package/dist/src/utils/bytes.d.ts +1 -1
  37. package/dist/src/utils/data.browser.d.ts +3 -1
  38. package/dist/src/utils/data.d.ts +7 -4
  39. package/dist/src/utils/expose.d.ts +6 -9
  40. package/dist/src/utils/headers.d.ts +3 -3
  41. package/dist/src/utils/http.d.ts +25 -0
  42. package/dist/src/utils/merge.d.ts +8 -0
  43. package/dist/src/utils/pss.d.ts +9 -0
  44. package/dist/src/utils/stream.d.ts +37 -0
  45. package/dist/src/utils/type.d.ts +19 -9
  46. package/package.json +15 -8
  47. package/.babelrc.js +0 -33
  48. package/.depcheckrc.json +0 -27
  49. package/.editorconfig +0 -6
  50. package/.eslintignore +0 -1
  51. package/.eslintrc.js +0 -108
  52. package/.gitattributes +0 -1
  53. package/.github/config.yaml +0 -23
  54. package/.github/workflows/check.yaml +0 -57
  55. package/.github/workflows/publish_npmjs.yaml +0 -20
  56. package/.github/workflows/release_github.yaml +0 -20
  57. package/.github/workflows/tests.yaml +0 -128
  58. package/.huskyrc +0 -5
  59. package/.prettierrc +0 -13
  60. package/.vscode/launch.json +0 -49
  61. package/.vscode/settings.json +0 -39
  62. package/CODEOWNERS +0 -1
  63. package/CODE_OF_CONDUCT.md +0 -76
  64. package/commitlint.config.js +0 -3
  65. package/dist/src/modules/stamps.d.ts +0 -4
  66. package/dist/src/utils/hooks.d.ts +0 -31
  67. package/dist/src/utils/safe-axios.d.ts +0 -8
  68. package/jest-puppeteer.config.js +0 -5
  69. package/jest.config.ts +0 -170
  70. package/src/bee-debug.ts +0 -440
  71. package/src/bee.ts +0 -941
  72. package/src/chunk/bmt.ts +0 -55
  73. package/src/chunk/cac.ts +0 -79
  74. package/src/chunk/serialize.ts +0 -16
  75. package/src/chunk/signer.ts +0 -141
  76. package/src/chunk/soc.ts +0 -190
  77. package/src/chunk/span.ts +0 -33
  78. package/src/feed/index.ts +0 -221
  79. package/src/feed/json.ts +0 -32
  80. package/src/feed/topic.ts +0 -23
  81. package/src/feed/type.ts +0 -12
  82. package/src/index.ts +0 -24
  83. package/src/modules/bytes.ts +0 -75
  84. package/src/modules/bzz.ts +0 -184
  85. package/src/modules/chunk.ts +0 -75
  86. package/src/modules/debug/balance.ts +0 -63
  87. package/src/modules/debug/chequebook.ts +0 -174
  88. package/src/modules/debug/chunk.ts +0 -39
  89. package/src/modules/debug/connectivity.ts +0 -61
  90. package/src/modules/debug/settlements.ts +0 -33
  91. package/src/modules/debug/stamps.ts +0 -69
  92. package/src/modules/debug/states.ts +0 -35
  93. package/src/modules/debug/status.ts +0 -34
  94. package/src/modules/debug/tag.ts +0 -19
  95. package/src/modules/debug/transactions.ts +0 -79
  96. package/src/modules/feed.ts +0 -92
  97. package/src/modules/pinning.ts +0 -74
  98. package/src/modules/pss.ts +0 -48
  99. package/src/modules/soc.ts +0 -41
  100. package/src/modules/stamps.ts +0 -59
  101. package/src/modules/status.ts +0 -13
  102. package/src/modules/stewardship.ts +0 -21
  103. package/src/modules/tag.ts +0 -83
  104. package/src/types/axios/index.d.ts +0 -18
  105. package/src/types/debug.ts +0 -204
  106. package/src/types/index.ts +0 -497
  107. package/src/types/tar-js.d.ts +0 -1
  108. package/src/types/webpack-bundle-analyzer/index.d.ts +0 -13
  109. package/src/utils/bytes.ts +0 -144
  110. package/src/utils/collection.ts +0 -151
  111. package/src/utils/data.browser.ts +0 -24
  112. package/src/utils/data.ts +0 -35
  113. package/src/utils/error.ts +0 -23
  114. package/src/utils/eth.ts +0 -229
  115. package/src/utils/expose.ts +0 -10
  116. package/src/utils/file.ts +0 -40
  117. package/src/utils/hash.ts +0 -16
  118. package/src/utils/headers.ts +0 -63
  119. package/src/utils/hex.ts +0 -186
  120. package/src/utils/hooks.ts +0 -89
  121. package/src/utils/safe-axios.ts +0 -98
  122. package/src/utils/tar.ts +0 -30
  123. package/src/utils/type.ts +0 -302
  124. package/src/utils/uint64.ts +0 -31
  125. package/src/utils/url.ts +0 -52
  126. package/test/bee.sh +0 -187
  127. package/test/data/1.txt +0 -1
  128. package/test/data/2.txt +0 -0
  129. package/test/data/empty +0 -0
  130. package/test/data/sub/3.txt +0 -1
  131. package/test/data/sub//303/251 +0 -0
  132. package/test/data/sub//360/237/230/216 +0 -0
  133. package/test/integration/bee-class.browser.spec.ts +0 -215
  134. package/test/integration/bee-class.spec.ts +0 -595
  135. package/test/integration/bee-debug-class.spec.ts +0 -85
  136. package/test/integration/chunk/bmt.spec.ts +0 -33
  137. package/test/integration/chunk/cac.spec.ts +0 -27
  138. package/test/integration/chunk/soc.spec.ts +0 -38
  139. package/test/integration/feed/index.spec.ts +0 -84
  140. package/test/integration/modules/bytes.spec.ts +0 -23
  141. package/test/integration/modules/bzz.spec.ts +0 -270
  142. package/test/integration/modules/chunk.spec.ts +0 -29
  143. package/test/integration/modules/debug/balance.spec.ts +0 -70
  144. package/test/integration/modules/debug/chequebook.spec.ts +0 -64
  145. package/test/integration/modules/debug/connectivity.spec.ts +0 -69
  146. package/test/integration/modules/debug/settlements.spec.ts +0 -34
  147. package/test/integration/modules/debug/states.spec.ts +0 -34
  148. package/test/integration/modules/debug/status.spec.ts +0 -65
  149. package/test/integration/modules/debug/tag.spec.ts +0 -27
  150. package/test/integration/modules/feed.spec.ts +0 -61
  151. package/test/integration/modules/pinning.spec.ts +0 -155
  152. package/test/integration/modules/pss.spec.ts +0 -92
  153. package/test/integration/modules/status.spec.ts +0 -10
  154. package/test/integration/modules/stewardship.spec.ts +0 -32
  155. package/test/integration/modules/tag.spec.ts +0 -51
  156. package/test/test-type-sequencer.js +0 -36
  157. package/test/testpage/testpage.html +0 -20
  158. package/test/unit/assertions.ts +0 -376
  159. package/test/unit/bee-class.spec.ts +0 -685
  160. package/test/unit/bee-debug-class.spec.ts +0 -365
  161. package/test/unit/chunk/bmt.spec.ts +0 -16
  162. package/test/unit/chunk/cac.spec.ts +0 -29
  163. package/test/unit/chunk/serialize.spec.ts +0 -24
  164. package/test/unit/chunk/signer.spec.ts +0 -140
  165. package/test/unit/chunk/soc.spec.ts +0 -25
  166. package/test/unit/chunk/span.spec.ts +0 -38
  167. package/test/unit/feed/json.spec.ts +0 -73
  168. package/test/unit/nock.ts +0 -134
  169. package/test/unit/utils/bytes.spec.ts +0 -32
  170. package/test/unit/utils/collection.spec.ts +0 -22
  171. package/test/unit/utils/eth.spec.ts +0 -224
  172. package/test/unit/utils/hex.spec.ts +0 -115
  173. package/test/unit/utils/hooks.spec.ts +0 -179
  174. package/test/unit/utils/safe-axios.spec.ts +0 -20
  175. package/test/unit/utils/type.spec.ts +0 -32
  176. package/test/unit/utils/uint64.spec.ts +0 -102
  177. package/test/utils.ts +0 -292
  178. package/tsconfig.json +0 -18
  179. package/tsconfig.test.json +0 -11
  180. package/typedoc.json +0 -7
  181. package/webpack.config.ts +0 -141
package/src/bee-debug.ts DELETED
@@ -1,440 +0,0 @@
1
- import * as connectivity from './modules/debug/connectivity'
2
- import * as balance from './modules/debug/balance'
3
- import * as chequebook from './modules/debug/chequebook'
4
- import * as settlements from './modules/debug/settlements'
5
- import * as status from './modules/debug/status'
6
- import * as transactions from './modules/debug/transactions'
7
- import * as states from './modules/debug/states'
8
- import type {
9
- Address,
10
- Peer,
11
- BalanceResponse,
12
- PeerBalance,
13
- ChequebookAddressResponse,
14
- ChequebookBalanceResponse,
15
- LastChequesResponse,
16
- LastChequesForPeerResponse,
17
- LastCashoutActionResponse,
18
- Settlements,
19
- AllSettlements,
20
- RemovePeerResponse,
21
- Topology,
22
- PingResponse,
23
- Health,
24
- NodeAddresses,
25
- ReserveState,
26
- ChainState,
27
- NumberString,
28
- ExtendedTag,
29
- PostageBatchBuckets,
30
- DebugPostageBatch,
31
- TransactionInfo,
32
- TransactionHash,
33
- } from './types'
34
- import { BeeArgumentError } from './utils/error'
35
- import { assertBeeUrl, stripLastSlash } from './utils/url'
36
- import {
37
- assertAddress,
38
- assertBatchId,
39
- assertBoolean,
40
- assertNonNegativeInteger,
41
- assertTransactionHash,
42
- isTag,
43
- } from './utils/type'
44
- import { BatchId, CashoutOptions, PostageBatchOptions, STAMPS_DEPTH_MAX, STAMPS_DEPTH_MIN, Tag } from './types'
45
- import * as tag from './modules/debug/tag'
46
- import * as stamps from './modules/debug/stamps'
47
-
48
- /**
49
- * The BeeDebug class provides a way of interacting with the Bee debug APIs based on the provided url
50
- *
51
- * @param url URL of a running Bee node
52
- */
53
- export class BeeDebug {
54
- public readonly url: string
55
-
56
- constructor(url: string) {
57
- assertBeeUrl(url)
58
-
59
- // Remove last slash if present, as our endpoint strings starts with `/...`
60
- // which could lead to double slash in URL to which Bee responds with
61
- // unnecessary redirects.
62
- this.url = stripLastSlash(url)
63
- }
64
-
65
- async getNodeAddresses(): Promise<NodeAddresses> {
66
- return connectivity.getNodeAddresses(this.url)
67
- }
68
-
69
- async getBlocklist(): Promise<Peer[]> {
70
- return connectivity.getBlocklist(this.url)
71
- }
72
-
73
- /**
74
- * Retrieve tag extended information from Bee node
75
- *
76
- * @param tagUid UID or tag object to be retrieved
77
- * @throws TypeError if tagUid is in not correct format
78
- *
79
- * @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
80
- * @see [Bee API reference - `GET /tags/{uid}`](https://docs.ethswarm.org/debug-api/#tag/Tag)
81
- *
82
- */
83
- async retrieveExtendedTag(tagUid: number | Tag): Promise<ExtendedTag> {
84
- if (isTag(tagUid)) {
85
- tagUid = tagUid.uid
86
- } else if (typeof tagUid === 'number') {
87
- assertNonNegativeInteger(tagUid, 'UID')
88
- } else {
89
- throw new TypeError('tagUid has to be either Tag or a number (UID)!')
90
- }
91
-
92
- return tag.retrieveExtendedTag(this.url, tagUid)
93
- }
94
-
95
- /**
96
- * Get list of peers for this node
97
- */
98
- async getPeers(): Promise<Peer[]> {
99
- return connectivity.getPeers(this.url)
100
- }
101
-
102
- async removePeer(peer: string | Address): Promise<RemovePeerResponse> {
103
- assertAddress(peer)
104
-
105
- return connectivity.removePeer(this.url, peer)
106
- }
107
-
108
- async getTopology(): Promise<Topology> {
109
- return connectivity.getTopology(this.url)
110
- }
111
-
112
- async pingPeer(peer: string | Address): Promise<PingResponse> {
113
- assertAddress(peer)
114
-
115
- return connectivity.pingPeer(this.url, peer)
116
- }
117
-
118
- /*
119
- * Balance endpoints
120
- */
121
-
122
- /**
123
- * Get the balances with all known peers including prepaid services
124
- */
125
- async getAllBalances(): Promise<BalanceResponse> {
126
- return balance.getAllBalances(this.url)
127
- }
128
-
129
- /**
130
- * Get the balances with a specific peer including prepaid services
131
- *
132
- * @param address Swarm address of peer
133
- */
134
- async getPeerBalance(address: Address | string): Promise<PeerBalance> {
135
- assertAddress(address)
136
-
137
- return balance.getPeerBalance(this.url, address)
138
- }
139
-
140
- /**
141
- * Get the past due consumption balances with all known peers
142
- */
143
- async getPastDueConsumptionBalances(): Promise<BalanceResponse> {
144
- return balance.getPastDueConsumptionBalances(this.url)
145
- }
146
-
147
- /**
148
- * Get the past due consumption balance with a specific peer
149
- *
150
- * @param address Swarm address of peer
151
- */
152
- async getPastDueConsumptionPeerBalance(address: Address | string): Promise<PeerBalance> {
153
- assertAddress(address)
154
-
155
- return balance.getPastDueConsumptionPeerBalance(this.url, address)
156
- }
157
-
158
- /*
159
- * Chequebook endpoints
160
- */
161
-
162
- /**
163
- * Get the address of the chequebook contract used.
164
- *
165
- * **Warning:** The address is returned with 0x prefix unlike all other calls.
166
- * https://github.com/ethersphere/bee/issues/1443
167
- */
168
- async getChequebookAddress(): Promise<ChequebookAddressResponse> {
169
- return chequebook.getChequebookAddress(this.url)
170
- }
171
-
172
- /**
173
- * Get the balance of the chequebook
174
- */
175
- async getChequebookBalance(): Promise<ChequebookBalanceResponse> {
176
- return chequebook.getChequebookBalance(this.url)
177
- }
178
-
179
- /**
180
- * Get last cheques for all peers
181
- */
182
- async getLastCheques(): Promise<LastChequesResponse> {
183
- return chequebook.getLastCheques(this.url)
184
- }
185
-
186
- /**
187
- * Get last cheques for the peer
188
- *
189
- * @param address Swarm address of peer
190
- */
191
- async getLastChequesForPeer(address: Address | string): Promise<LastChequesForPeerResponse> {
192
- assertAddress(address)
193
-
194
- return chequebook.getLastChequesForPeer(this.url, address)
195
- }
196
-
197
- /**
198
- * Get last cashout action for the peer
199
- *
200
- * @param address Swarm address of peer
201
- */
202
- async getLastCashoutAction(address: Address | string): Promise<LastCashoutActionResponse> {
203
- assertAddress(address)
204
-
205
- return chequebook.getLastCashoutAction(this.url, address)
206
- }
207
-
208
- /**
209
- * Cashout the last cheque for the peer
210
- *
211
- * @param address Swarm address of peer
212
- * @param options
213
- * @param options.gasPrice Gas price for the cashout transaction in WEI
214
- * @param options.gasLimit Gas limit for the cashout transaction in WEI
215
- */
216
- async cashoutLastCheque(address: string | Address, options?: CashoutOptions): Promise<string> {
217
- assertAddress(address)
218
-
219
- if (options?.gasLimit) {
220
- assertNonNegativeInteger(options.gasLimit)
221
- }
222
-
223
- if (options?.gasPrice) {
224
- assertNonNegativeInteger(options.gasPrice)
225
- }
226
-
227
- return chequebook.cashoutLastCheque(this.url, address, options)
228
- }
229
-
230
- /**
231
- * Deposit tokens from overlay address into chequebook
232
- *
233
- * @param amount Amount of tokens to deposit (must be positive integer)
234
- * @param gasPrice Gas Price in WEI for the transaction call
235
- * @return string Hash of the transaction
236
- */
237
- async depositTokens(amount: number | NumberString, gasPrice?: NumberString): Promise<string> {
238
- assertNonNegativeInteger(amount)
239
-
240
- if (gasPrice) {
241
- assertNonNegativeInteger(gasPrice)
242
- }
243
-
244
- return chequebook.depositTokens(this.url, amount, gasPrice)
245
- }
246
-
247
- /**
248
- * Withdraw tokens from the chequebook to the overlay address
249
- *
250
- * @param amount Amount of tokens to withdraw (must be positive integer)
251
- * @param gasPrice Gas Price in WEI for the transaction call
252
- * @return string Hash of the transaction
253
- */
254
- async withdrawTokens(amount: number | NumberString, gasPrice?: NumberString): Promise<string> {
255
- assertNonNegativeInteger(amount)
256
-
257
- if (gasPrice) {
258
- assertNonNegativeInteger(gasPrice)
259
- }
260
-
261
- return chequebook.withdrawTokens(this.url, amount, gasPrice)
262
- }
263
-
264
- /*
265
- * Settlements endpoint
266
- */
267
-
268
- /**
269
- * Get amount of sent and received from settlements with a peer
270
- *
271
- * @param address Swarm address of peer
272
- */
273
- async getSettlements(address: Address | string): Promise<Settlements> {
274
- assertAddress(address)
275
-
276
- return settlements.getSettlements(this.url, address)
277
- }
278
-
279
- /**
280
- * Get settlements with all known peers and total amount sent or received
281
- */
282
- async getAllSettlements(): Promise<AllSettlements> {
283
- return settlements.getAllSettlements(this.url)
284
- }
285
-
286
- /**
287
- * Get health of node
288
- */
289
- async getHealth(): Promise<Health> {
290
- return status.getHealth(this.url)
291
- }
292
-
293
- /**
294
- * Connnects to a node and checks if it is a supported Bee version by the bee-js
295
- *
296
- * @returns true if the Bee node version is supported
297
- */
298
- async isSupportedVersion(): Promise<boolean> | never {
299
- return status.isSupportedVersion(this.url)
300
- }
301
-
302
- /**
303
- * Get reserve state
304
- */
305
- async getReserveState(): Promise<ReserveState> {
306
- return states.getReserveState(this.url)
307
- }
308
-
309
- /**
310
- * Get chain state
311
- */
312
- async getChainState(): Promise<ChainState> {
313
- return states.getChainState(this.url)
314
- }
315
-
316
- /**
317
- * Creates new postage batch from the funds that the node has available in its Ethereum account.
318
- *
319
- * For better understanding what each parameter means and what are the optimal values please see
320
- * [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive).
321
- *
322
- * **WARNING: THIS CREATES TRANSACTIONS THAT SPENDS MONEY**
323
- *
324
- * @param amount Amount that represents the value per chunk, has to be greater or equal zero.
325
- * @param depth Logarithm of the number of chunks that can be stamped with the batch.
326
- * @param options Options for creation of postage batch
327
- * @throws BeeArgumentError when negative amount or depth is specified
328
- * @throws TypeError if non-integer value is passed to amount or depth
329
- *
330
- * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
331
- * @see [Bee Debug API reference - `POST /stamps`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps~1{amount}~1{depth}/post)
332
- */
333
- async createPostageBatch(amount: NumberString, depth: number, options?: PostageBatchOptions): Promise<BatchId> {
334
- assertNonNegativeInteger(amount)
335
- assertNonNegativeInteger(depth)
336
-
337
- if (depth < STAMPS_DEPTH_MIN) {
338
- throw new BeeArgumentError(`Depth has to be at least ${STAMPS_DEPTH_MIN}`, depth)
339
- }
340
-
341
- if (depth > STAMPS_DEPTH_MAX) {
342
- throw new BeeArgumentError(`Depth has to be at most ${STAMPS_DEPTH_MAX}`, depth)
343
- }
344
-
345
- if (options?.gasPrice) {
346
- assertNonNegativeInteger(options.gasPrice)
347
- }
348
-
349
- if (options?.immutableFlag !== undefined) {
350
- assertBoolean(options.immutableFlag)
351
- }
352
-
353
- return stamps.createPostageBatch(this.url, amount, depth, options)
354
- }
355
-
356
- /**
357
- * Return details for specific postage batch.
358
- *
359
- * @param postageBatchId Batch ID
360
- *
361
- * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
362
- * @see [Bee Debug API reference - `GET /stamps/${id}`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps~1{id}/get)
363
- */
364
- async getPostageBatch(postageBatchId: BatchId | string): Promise<DebugPostageBatch> {
365
- assertBatchId(postageBatchId)
366
-
367
- return stamps.getPostageBatch(this.url, postageBatchId)
368
- }
369
-
370
- /**
371
- * Return detailed information related to buckets for specific postage batch.
372
- *
373
- * @param postageBatchId Batch ID
374
- *
375
- * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
376
- * @see [Bee Debug API reference - `GET /stamps/${id}/buckets`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps~1{id}~1buckets/get)
377
- */
378
- async getPostageBatchBuckets(postageBatchId: BatchId | string): Promise<PostageBatchBuckets> {
379
- assertBatchId(postageBatchId)
380
-
381
- return stamps.getPostageBatchBuckets(this.url, postageBatchId)
382
- }
383
-
384
- /**
385
- * Return all postage batches that has the node available.
386
- *
387
- * @see [Bee docs - Keep your data alive / Postage stamps](https://docs.ethswarm.org/docs/access-the-swarm/keep-your-data-alive)
388
- * @see [Bee Debug API reference - `GET /stamps`](https://docs.ethswarm.org/debug-api/#tag/Postage-Stamps/paths/~1stamps/get)
389
- */
390
- async getAllPostageBatch(): Promise<DebugPostageBatch[]> {
391
- return stamps.getAllPostageBatches(this.url)
392
- }
393
-
394
- /**
395
- * Return lists of all current pending transactions that the Bee made
396
- */
397
- async getAllPendingTransactions(): Promise<TransactionInfo[]> {
398
- return transactions.getAllTransactions(this.url)
399
- }
400
-
401
- /**
402
- * Return transaction information for specific transaction
403
- * @param transactionHash
404
- */
405
- async getPendingTransaction(transactionHash: TransactionHash | string): Promise<TransactionInfo> {
406
- assertTransactionHash(transactionHash)
407
-
408
- return transactions.getTransaction(this.url, transactionHash)
409
- }
410
-
411
- /**
412
- * Rebroadcast already created transaction.
413
- * This is mainly needed when your transaction fall off mempool from other reason is not incorporated into block.
414
- *
415
- * @param transactionHash
416
- */
417
- async rebroadcastPendingTransaction(transactionHash: TransactionHash | string): Promise<TransactionHash> {
418
- assertTransactionHash(transactionHash)
419
-
420
- return transactions.rebroadcastTransaction(this.url, transactionHash)
421
- }
422
-
423
- /**
424
- * Cancel currently pending transaction
425
- * @param transactionHash
426
- * @param gasPrice
427
- */
428
- async cancelPendingTransaction(
429
- transactionHash: TransactionHash | string,
430
- gasPrice?: NumberString,
431
- ): Promise<TransactionHash> {
432
- assertTransactionHash(transactionHash)
433
-
434
- if (gasPrice) {
435
- assertNonNegativeInteger(gasPrice)
436
- }
437
-
438
- return transactions.cancelTransaction(this.url, transactionHash, gasPrice)
439
- }
440
- }