@ethersphere/bee-js 12.2.1 → 12.3.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 (143) hide show
  1. package/dist/cjs/bee.js +56 -23
  2. package/dist/cjs/chunk/cac.js +4 -2
  3. package/dist/cjs/feed/index.js +3 -1
  4. package/dist/cjs/index.js +1 -3
  5. package/dist/cjs/modules/bytes.js +6 -4
  6. package/dist/cjs/modules/bzz.js +5 -4
  7. package/dist/cjs/modules/chunk.js +3 -2
  8. package/dist/cjs/modules/debug/balance.js +5 -29
  9. package/dist/cjs/modules/debug/chequebook.js +9 -58
  10. package/dist/cjs/modules/debug/connectivity.js +5 -82
  11. package/dist/cjs/modules/debug/settlements.js +3 -22
  12. package/dist/cjs/modules/debug/stake.js +8 -33
  13. package/dist/cjs/modules/debug/stamps.js +27 -53
  14. package/dist/cjs/modules/debug/states.js +6 -31
  15. package/dist/cjs/modules/debug/status.js +5 -37
  16. package/dist/cjs/modules/debug/transactions.js +5 -26
  17. package/dist/cjs/modules/envelope.js +6 -6
  18. package/dist/cjs/modules/feed.js +3 -4
  19. package/dist/cjs/modules/grantee.js +8 -10
  20. package/dist/cjs/modules/pinning.js +5 -11
  21. package/dist/cjs/modules/rchash.js +2 -3
  22. package/dist/cjs/modules/soc.js +3 -2
  23. package/dist/cjs/modules/status.js +3 -3
  24. package/dist/cjs/modules/stewardship.js +2 -3
  25. package/dist/cjs/modules/tag.js +4 -35
  26. package/dist/cjs/stamper/stamper.js +2 -1
  27. package/dist/cjs/types/schema/balance.js +14 -0
  28. package/dist/cjs/types/schema/chequebook.js +49 -0
  29. package/dist/cjs/types/schema/connectivity.js +46 -0
  30. package/dist/cjs/types/schema/envelope.js +11 -0
  31. package/dist/cjs/types/schema/grantee.js +10 -0
  32. package/dist/cjs/types/schema/pinning.js +7 -0
  33. package/dist/cjs/types/schema/rchash.js +7 -0
  34. package/dist/cjs/types/schema/settlements.js +17 -0
  35. package/dist/cjs/types/schema/stake.js +33 -0
  36. package/dist/cjs/types/schema/stamps.js +48 -0
  37. package/dist/cjs/types/schema/states.js +34 -0
  38. package/dist/cjs/types/schema/status.js +39 -0
  39. package/dist/cjs/types/schema/stewardship.js +7 -0
  40. package/dist/cjs/types/schema/tag.js +20 -0
  41. package/dist/cjs/types/schema/transactions.js +24 -0
  42. package/dist/cjs/types/schema/upload.js +8 -0
  43. package/dist/cjs/utils/bad-ports.js +92 -0
  44. package/dist/cjs/utils/bytes.js +5 -3
  45. package/dist/cjs/utils/error.js +1 -0
  46. package/dist/cjs/utils/headers.js +19 -13
  47. package/dist/cjs/utils/hex-schema.js +8 -0
  48. package/dist/cjs/utils/http.js +92 -52
  49. package/dist/cjs/utils/resource-locator.js +4 -3
  50. package/dist/cjs/utils/schema.js +88 -0
  51. package/dist/cjs/utils/stamps.js +2 -1
  52. package/dist/cjs/utils/type.js +12 -130
  53. package/dist/cjs/utils/url.js +24 -0
  54. package/dist/index.browser.min.js +1 -1
  55. package/dist/index.browser.min.js.map +1 -1
  56. package/dist/mjs/bee.js +59 -30
  57. package/dist/mjs/chunk/cac.js +5 -3
  58. package/dist/mjs/feed/index.js +4 -2
  59. package/dist/mjs/index.js +1 -2
  60. package/dist/mjs/modules/bytes.js +8 -8
  61. package/dist/mjs/modules/bzz.js +6 -9
  62. package/dist/mjs/modules/chunk.js +4 -7
  63. package/dist/mjs/modules/debug/balance.js +5 -61
  64. package/dist/mjs/modules/debug/chequebook.js +9 -114
  65. package/dist/mjs/modules/debug/connectivity.js +5 -145
  66. package/dist/mjs/modules/debug/settlements.js +3 -46
  67. package/dist/mjs/modules/debug/stake.js +8 -85
  68. package/dist/mjs/modules/debug/stamps.js +24 -126
  69. package/dist/mjs/modules/debug/states.js +6 -71
  70. package/dist/mjs/modules/debug/status.js +5 -91
  71. package/dist/mjs/modules/debug/transactions.js +5 -60
  72. package/dist/mjs/modules/envelope.js +6 -20
  73. package/dist/mjs/modules/feed.js +6 -7
  74. package/dist/mjs/modules/grantee.js +8 -26
  75. package/dist/mjs/modules/pinning.js +7 -21
  76. package/dist/mjs/modules/rchash.js +2 -7
  77. package/dist/mjs/modules/soc.js +4 -5
  78. package/dist/mjs/modules/status.js +4 -4
  79. package/dist/mjs/modules/stewardship.js +2 -7
  80. package/dist/mjs/modules/tag.js +4 -93
  81. package/dist/mjs/stamper/stamper.js +2 -1
  82. package/dist/mjs/types/schema/balance.js +13 -0
  83. package/dist/mjs/types/schema/chequebook.js +53 -0
  84. package/dist/mjs/types/schema/connectivity.js +41 -0
  85. package/dist/mjs/types/schema/envelope.js +8 -0
  86. package/dist/mjs/types/schema/grantee.js +7 -0
  87. package/dist/mjs/types/schema/pinning.js +4 -0
  88. package/dist/mjs/types/schema/rchash.js +4 -0
  89. package/dist/mjs/types/schema/settlements.js +22 -0
  90. package/dist/mjs/types/schema/stake.js +40 -0
  91. package/dist/mjs/types/schema/stamps.js +47 -0
  92. package/dist/mjs/types/schema/states.js +34 -0
  93. package/dist/mjs/types/schema/status.js +36 -0
  94. package/dist/mjs/types/schema/stewardship.js +4 -0
  95. package/dist/mjs/types/schema/tag.js +14 -0
  96. package/dist/mjs/types/schema/transactions.js +25 -0
  97. package/dist/mjs/types/schema/upload.js +5 -0
  98. package/dist/mjs/utils/bad-ports.js +6 -0
  99. package/dist/mjs/utils/bytes.js +6 -8
  100. package/dist/mjs/utils/error.js +5 -0
  101. package/dist/mjs/utils/headers.js +19 -13
  102. package/dist/mjs/utils/hex-schema.js +2 -0
  103. package/dist/mjs/utils/http.js +97 -59
  104. package/dist/mjs/utils/resource-locator.js +4 -3
  105. package/dist/mjs/utils/schema.js +81 -0
  106. package/dist/mjs/utils/stamps.js +2 -1
  107. package/dist/mjs/utils/type.js +13 -233
  108. package/dist/mjs/utils/url.js +23 -0
  109. package/dist/types/bee.d.ts +23 -0
  110. package/dist/types/index.d.ts +1 -3
  111. package/dist/types/modules/debug/connectivity.d.ts +2 -2
  112. package/dist/types/modules/debug/stamps.d.ts +2 -0
  113. package/dist/types/types/debug.d.ts +1 -0
  114. package/dist/types/types/schema/balance.d.ts +12 -0
  115. package/dist/types/types/schema/chequebook.d.ts +104 -0
  116. package/dist/types/types/schema/connectivity.d.ts +49 -0
  117. package/dist/types/types/schema/envelope.d.ts +7 -0
  118. package/dist/types/types/schema/grantee.d.ts +7 -0
  119. package/dist/types/types/schema/pinning.d.ts +4 -0
  120. package/dist/types/types/schema/rchash.d.ts +4 -0
  121. package/dist/types/types/schema/settlements.d.ts +16 -0
  122. package/dist/types/types/schema/stake.d.ts +29 -0
  123. package/dist/types/types/schema/stamps.d.ts +77 -0
  124. package/dist/types/types/schema/states.d.ts +26 -0
  125. package/dist/types/types/schema/status.d.ts +38 -0
  126. package/dist/types/types/schema/stewardship.d.ts +4 -0
  127. package/dist/types/types/schema/tag.d.ts +23 -0
  128. package/dist/types/types/schema/transactions.d.ts +29 -0
  129. package/dist/types/types/schema/upload.d.ts +5 -0
  130. package/dist/types/utils/bad-ports.d.ts +6 -0
  131. package/dist/types/utils/error.d.ts +5 -0
  132. package/dist/types/utils/hex-schema.d.ts +2 -0
  133. package/dist/types/utils/http.d.ts +18 -3
  134. package/dist/types/utils/schema.d.ts +90 -0
  135. package/dist/types/utils/stamps.d.ts +1 -0
  136. package/dist/types/utils/tar-uploader.browser.d.ts +1 -1
  137. package/dist/types/utils/tar-uploader.d.ts +1 -1
  138. package/dist/types/utils/type.d.ts +1 -16
  139. package/dist/types/utils/url.d.ts +9 -0
  140. package/package.json +10 -10
  141. package/dist/cjs/bee-dev.js +0 -78
  142. package/dist/mjs/bee-dev.js +0 -98
  143. package/dist/types/bee-dev.d.ts +0 -5
@@ -1,8 +1,6 @@
1
- import { Types } from 'cafe-utility';
2
1
  import * as stream from 'stream';
3
- import { TAGS_LIMIT_MAX, TAGS_LIMIT_MIN } from "../types/index.js";
4
2
  import { isFile } from "./file.js";
5
- import { PublicKey, Reference } from "./typed-bytes.js";
3
+ import { TagInputSchema, TagUidSchema } from "./schema.js";
6
4
  export function isReadable(value) {
7
5
  return typeof stream.Readable !== 'undefined' && value instanceof stream.Readable;
8
6
  }
@@ -10,214 +8,19 @@ export function asNumberString(value, options) {
10
8
  if (typeof value === 'bigint') {
11
9
  value = value.toString();
12
10
  }
13
- return Types.asIntegerString(value, options);
14
- }
15
- export function prepareBeeRequestOptions(value) {
16
- const object = Types.asObject(value, {
17
- name: 'BeeRequestOptions'
18
- });
19
- return {
20
- baseURL: Types.asOptional(x => Types.asString(x, {
21
- name: 'baseURL'
22
- }), object.baseURL),
23
- timeout: Types.asOptional(x => Types.asInteger(x, {
24
- name: 'timeout',
25
- min: 0
26
- }), object.timeout),
27
- headers: Types.asOptional(x => Types.asStringMap(x, {
28
- name: 'headers'
29
- }), object.headers),
30
- onRequest: Types.asOptional(x => Types.asFunction(x, {
31
- name: 'onRequest'
32
- }), object.onRequest),
33
- httpAgent: object.httpAgent,
34
- httpsAgent: object.httpsAgent,
35
- endlesslyRetry: Types.asOptional(x => Types.asBoolean(x, {
36
- name: 'endlesslyRetry'
37
- }), object.endlesslyRetry),
38
- signal: object.signal
39
- };
40
- }
41
- export function prepareDownloadOptions(value) {
42
- const object = Types.asObject(value, {
43
- name: 'DownloadOptions'
44
- });
45
- return {
46
- redundancyStrategy: Types.asOptional(x => Types.asInteger(x, {
47
- name: 'redundancyStrategy'
48
- }), object.redundancyStrategy),
49
- fallback: Types.asOptional(x => Types.asBoolean(x, {
50
- name: 'fallback'
51
- }), object.fallback),
52
- timeoutMs: Types.asOptional(x => Types.asInteger(x, {
53
- name: 'timeoutMs',
54
- min: 0
55
- }), object.timeoutMs),
56
- actPublisher: Types.asOptional(x => new PublicKey(x), object.actPublisher),
57
- actHistoryAddress: Types.asOptional(x => new Reference(x), object.actHistoryAddress),
58
- actTimestamp: Types.asOptional(x => Types.asNumber(x, {
59
- name: 'actTimestamp'
60
- }), object.actTimestamp)
61
- };
62
- }
63
- export function prepareUploadOptions(value, name = 'UploadOptions') {
64
- const object = Types.asObject(value, {
65
- name
66
- });
67
- return {
68
- act: Types.asOptional(x => Types.asBoolean(x, {
69
- name: 'act'
70
- }), object.act),
71
- actHistoryAddress: Types.asOptional(x => new Reference(x), object.actHistoryAddress),
72
- deferred: Types.asOptional(x => Types.asBoolean(x, {
73
- name: 'deferred'
74
- }), object.deferred),
75
- encrypt: Types.asOptional(x => Types.asBoolean(x, {
76
- name: 'encrypt'
77
- }), object.encrypt),
78
- pin: Types.asOptional(x => Types.asBoolean(x, {
79
- name: 'pin'
80
- }), object.pin),
81
- tag: Types.asOptional(x => Types.asInteger(x, {
82
- name: 'tag',
83
- min: 0
84
- }), object.tag)
85
- };
86
- }
87
- export function prepareRedundantUploadOptions(value, name = 'UploadOptions') {
88
- const uploadOptions = prepareUploadOptions(value, name);
89
- const object = Types.asObject(value, {
90
- name
91
- });
92
- return {
93
- ...uploadOptions,
94
- redundancyLevel: Types.asOptional(x => Types.asInteger(x, {
95
- name: 'redundancyLevel',
96
- min: 0
97
- }), object.redundancyLevel)
98
- };
99
- }
100
- export function prepareFileUploadOptions(value) {
101
- const uploadOptions = prepareUploadOptions(value, 'FileUploadOptions');
102
- const object = Types.asObject(value, {
103
- name: 'FileUploadOptions'
104
- });
105
- return {
106
- ...uploadOptions,
107
- size: Types.asOptional(x => Types.asInteger(x, {
108
- name: 'size',
109
- min: 0
110
- }), object.size),
111
- contentType: Types.asOptional(x => Types.asString(x, {
112
- name: 'contentType'
113
- }), object.contentType),
114
- redundancyLevel: Types.asOptional(x => Types.asInteger(x, {
115
- name: 'redundancyLevel',
116
- min: 0
117
- }), object.redundancyLevel)
118
- };
119
- }
120
- export function prepareCollectionUploadOptions(value) {
121
- const uploadOptions = prepareUploadOptions(value, 'CollectionUploadOptions');
122
- const object = Types.asObject(value, {
123
- name: 'CollectionUploadOptions'
124
- });
125
- return {
126
- ...uploadOptions,
127
- errorDocument: Types.asOptional(x => Types.asString(x, {
128
- name: 'errorDocument'
129
- }), object.errorDocument),
130
- indexDocument: Types.asOptional(x => Types.asString(x, {
131
- name: 'indexDocument'
132
- }), object.indexDocument),
133
- redundancyLevel: Types.asOptional(x => Types.asInteger(x, {
134
- name: 'redundancyLevel',
135
- min: 0
136
- }), object.redundancyLevel)
137
- };
138
- }
139
- export function isTag(value) {
140
- try {
141
- const object = Types.asObject(value, {
142
- name: 'Tag'
143
- });
144
- Types.asInteger(object.uid, {
145
- name: 'Tag.uid'
146
- });
147
- return true;
148
- } catch {
149
- return false;
11
+ if (typeof value !== 'string' || !/^-?\d+$/.test(value)) {
12
+ throw new TypeError(`${options?.name ?? 'value'} is not a valid integer string, got: ${value}`);
150
13
  }
14
+ if (options?.min !== undefined && BigInt(value) < options.min) {
15
+ throw new RangeError(`${options?.name ?? 'value'} must be >= ${options.min}, got: ${value}`);
16
+ }
17
+ if (options?.max !== undefined && BigInt(value) > options.max) {
18
+ throw new RangeError(`${options?.name ?? 'value'} must be <= ${options.max}, got: ${value}`);
19
+ }
20
+ return value;
151
21
  }
152
- export function preparePssMessageHandler(value) {
153
- const object = Types.asObject(value, {
154
- name: 'PssMessageHandler'
155
- });
156
- return {
157
- onMessage: Types.asFunction(object.onMessage, {
158
- name: 'onMessage'
159
- }),
160
- onError: Types.asFunction(object.onError, {
161
- name: 'onError'
162
- }),
163
- onClose: Types.asFunction(object.onClose, {
164
- name: 'onClose'
165
- })
166
- };
167
- }
168
- export function prepareGsocMessageHandler(value) {
169
- const object = Types.asObject(value, {
170
- name: 'GsocMessageHandler'
171
- });
172
- return {
173
- onMessage: Types.asFunction(object.onMessage, {
174
- name: 'onMessage'
175
- }),
176
- onError: Types.asFunction(object.onError, {
177
- name: 'onError'
178
- }),
179
- onClose: Types.asFunction(object.onClose, {
180
- name: 'onClose'
181
- })
182
- };
183
- }
184
- export function preparePostageBatchOptions(value) {
185
- const object = Types.asObject(value, {
186
- name: 'PostageBatchOptions'
187
- });
188
- return {
189
- gasPrice: Types.asOptional(x => asNumberString(x, {
190
- name: 'gasPrice'
191
- }), object.gasPrice),
192
- immutableFlag: Types.asOptional(x => Types.asBoolean(x, {
193
- name: 'immutableFlag'
194
- }), object.immutableFlag),
195
- label: Types.asOptional(x => Types.asString(x, {
196
- name: 'label'
197
- }), object.label),
198
- waitForUsable: Types.asOptional(x => Types.asBoolean(x, {
199
- name: 'waitForUsable'
200
- }), object.waitForUsable),
201
- waitForUsableTimeout: Types.asOptional(x => Types.asInteger(x, {
202
- name: 'waitForUsableTimeout',
203
- min: 0
204
- }), object.waitForUsableTimeout)
205
- };
206
- }
207
- export function prepareTransactionOptions(value, name = 'TransactionOptions') {
208
- const object = Types.asObject(value, {
209
- name
210
- });
211
- return {
212
- gasLimit: Types.asOptional(x => asNumberString(x, {
213
- name: 'gasLimit',
214
- min: 0n
215
- }), object.gasLimit),
216
- gasPrice: Types.asOptional(x => asNumberString(x, {
217
- name: 'gasPrice',
218
- min: 0n
219
- }), object.gasPrice)
220
- };
22
+ export function isTag(value) {
23
+ return TagInputSchema.safeParse(value).success;
221
24
  }
222
25
  /**
223
26
  * Check whether the given parameter is valid data to upload
@@ -239,26 +42,6 @@ export function assertFileData(value) {
239
42
  throw new TypeError('Data must be either string, Readable, Uint8Array or File!');
240
43
  }
241
44
  }
242
- /**
243
- * Checks whether optional options for AllTags query are valid
244
- * @param options
245
- */
246
- export function prepareAllTagsOptions(value) {
247
- const object = Types.asObject(value, {
248
- name: 'AllTagsOptions'
249
- });
250
- return {
251
- limit: Types.asOptional(x => Types.asInteger(x, {
252
- name: 'limit',
253
- min: TAGS_LIMIT_MIN,
254
- max: TAGS_LIMIT_MAX
255
- }), object.limit),
256
- offset: Types.asOptional(x => Types.asInteger(x, {
257
- name: 'offset',
258
- min: 0
259
- }), object.offset)
260
- };
261
- }
262
45
  /**
263
46
  * Utility functions that return Tag UID
264
47
  * @param tagUid
@@ -270,10 +53,7 @@ export function makeTagUid(tagUid) {
270
53
  if (isTag(tagUid)) {
271
54
  return tagUid.uid;
272
55
  } else if (typeof tagUid === 'number' || typeof tagUid === 'string') {
273
- return Types.asNumber(tagUid, {
274
- name: 'tagUid',
275
- min: 0
276
- });
56
+ return TagUidSchema.parse(tagUid);
277
57
  }
278
58
  throw new TypeError(`Expected number | Tag | string from tagUid, got: ${tagUid}`);
279
59
  }
@@ -1,3 +1,4 @@
1
+ import { BAD_PORTS } from "./bad-ports.js";
1
2
  import { BeeArgumentError } from "./error.js";
2
3
  /**
3
4
  * Validates that passed string is valid URL of Bee.
@@ -17,6 +18,24 @@ export function isValidBeeUrl(url) {
17
18
  return false;
18
19
  }
19
20
  }
21
+ /**
22
+ * Validates that passed string is valid port to use Bee and is not a bad port.
23
+ * We support only HTTP and HTTPS protocols. Bad ports are defined in
24
+ * the WHATWG Fetch spec (https://fetch.spec.whatwg.org/#port-blocking)
25
+ * and are blocked for HTTP/HTTPS requests.
26
+ *
27
+ * @param port
28
+ */
29
+ export function isValidBeePort(port) {
30
+ if (typeof port !== 'string') {
31
+ return false;
32
+ }
33
+ if (BAD_PORTS.includes(port)) {
34
+ return false;
35
+ }
36
+ const portNumber = parseInt(port, 10);
37
+ return portNumber > 0 && portNumber < 65536 && !isNaN(portNumber);
38
+ }
20
39
  /**
21
40
  * Validates that passed string is valid URL of Bee, if not it throws BeeArgumentError.
22
41
  * We support only HTTP and HTTPS protocols.
@@ -27,6 +46,10 @@ export function assertBeeUrl(url) {
27
46
  if (!isValidBeeUrl(url)) {
28
47
  throw new BeeArgumentError('URL is not valid!', url);
29
48
  }
49
+ const port = new URL(url).port;
50
+ if (port && !isValidBeePort(port)) {
51
+ throw new BeeArgumentError('Port in URL is considered bad port and cannot be used!', port);
52
+ }
30
53
  }
31
54
  /**
32
55
  * Removes trailing slash out of the given string.
@@ -1154,6 +1154,22 @@ export declare class Bee {
1154
1154
  * @returns
1155
1155
  */
1156
1156
  getDurationExtensionCost(postageBatchId: BatchId | Uint8Array | string, duration: Duration, requestOptions?: BeeRequestOptions): Promise<BZZ>;
1157
+ /**
1158
+ * Updates the label of a certain postage batch.
1159
+ *
1160
+ * @param postageBatchId Batch ID of the postage batch to update.
1161
+ * @param label New label for the postage batch.
1162
+ * @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
1163
+ */
1164
+ updatePostageBatchLabel(postageBatchId: BatchId | Uint8Array | string, label: string, requestOptions?: BeeRequestOptions): Promise<void>;
1165
+ /**
1166
+ * Renames a storage. This is a convenience method that calls {@link updatePostageBatchLabel}.
1167
+ *
1168
+ * @param postageBatchId Batch ID of the postage batch to update.
1169
+ * @param newName New name for the storage.
1170
+ * @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
1171
+ */
1172
+ renameStorage(postageBatchId: BatchId | Uint8Array | string, newLabel: string, requestOptions?: BeeRequestOptions): Promise<void>;
1157
1173
  /**
1158
1174
  * Calculates the `amount` and expected duration extension for topping up a postage batch with a given BZZ value.
1159
1175
  *
@@ -1228,6 +1244,13 @@ export declare class Bee {
1228
1244
  * @see [Bee Debug API reference - `GET /stamps/${id}`](https://docs.ethswarm.org/api/#tag/Postage-Stamps/paths/~1stamps~1%7Bbatch_id%7D/get)
1229
1245
  */
1230
1246
  getPostageBatch(postageBatchId: BatchId | Uint8Array | string, requestOptions?: BeeRequestOptions, encryption?: boolean, erasureCodeLevel?: RedundancyLevel): Promise<PostageBatch>;
1247
+ /**
1248
+ * Returns details for specific globally available postage batch.
1249
+ *
1250
+ * @param postageBatchId Batch ID
1251
+ * @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
1252
+ */
1253
+ getGlobalPostageBatch(postageBatchId: BatchId | Uint8Array | string, requestOptions?: BeeRequestOptions): Promise<GlobalPostageBatch>;
1231
1254
  /**
1232
1255
  * Return detailed information related to buckets for specific postage batch.
1233
1256
  *
@@ -1,5 +1,4 @@
1
1
  import { Bee } from './bee';
2
- import { BeeDev } from './bee-dev';
3
2
  import { Stamper } from './stamper/stamper';
4
3
  export { MerkleTree } from 'cafe-utility';
5
4
  export type { Chunk } from './chunk/cac';
@@ -16,12 +15,11 @@ export { Size } from './utils/size';
16
15
  export * from './utils/tokens';
17
16
  export * from './utils/typed-bytes';
18
17
  export type { UploadProgress } from './utils/upload-progress';
19
- export { Bee, BeeDev, Stamper };
18
+ export { Bee, Stamper };
20
19
  declare global {
21
20
  interface Window {
22
21
  BeeJs: {
23
22
  Bee: typeof import('./bee').Bee;
24
- BeeDev: typeof import('./bee-dev').BeeDev;
25
23
  Stamper: typeof import('./stamper/stamper').Stamper;
26
24
  Utils: typeof import('./utils/expose');
27
25
  Duration: typeof import('./utils/duration').Duration;
@@ -1,4 +1,5 @@
1
- import type { BeeRequestOptions, Bin, NodeAddresses, Peer, PingResponse, RemovePeerResponse, Topology } from '../../types';
1
+ import type { BeeRequestOptions, Peer, PingResponse, RemovePeerResponse, Topology } from '../../types';
2
+ import { NodeAddresses } from '../../types/debug';
2
3
  import { PeerAddress } from '../../utils/typed-bytes';
3
4
  export declare function getNodeAddresses(requestOptions: BeeRequestOptions): Promise<NodeAddresses>;
4
5
  export declare function getPeers(requestOptions: BeeRequestOptions): Promise<Peer[]>;
@@ -6,4 +7,3 @@ export declare function getBlocklist(requestOptions: BeeRequestOptions): Promise
6
7
  export declare function removePeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<RemovePeerResponse>;
7
8
  export declare function getTopology(requestOptions: BeeRequestOptions): Promise<Topology>;
8
9
  export declare function pingPeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<PingResponse>;
9
- export declare function asBin(value: unknown, name: string): Bin;
@@ -1,9 +1,11 @@
1
1
  import type { BeeRequestOptions, GlobalPostageBatch, NumberString, PostageBatch, PostageBatchBuckets, PostageBatchOptions, RedundancyLevel } from '../../types';
2
2
  import { BatchId } from '../../utils/typed-bytes';
3
3
  export declare function getGlobalPostageBatches(requestOptions: BeeRequestOptions): Promise<GlobalPostageBatch[]>;
4
+ export declare function getGlobalPostageBatch(requestOptions: BeeRequestOptions, postageBatchId: BatchId): Promise<GlobalPostageBatch>;
4
5
  export declare function getAllPostageBatches(requestOptions: BeeRequestOptions): Promise<PostageBatch[]>;
5
6
  export declare function getPostageBatch(requestOptions: BeeRequestOptions, postageBatchId: BatchId, encryption?: boolean, erasureCodeLevel?: RedundancyLevel): Promise<PostageBatch>;
6
7
  export declare function getPostageBatchBuckets(requestOptions: BeeRequestOptions, postageBatchId: BatchId): Promise<PostageBatchBuckets>;
7
8
  export declare function createPostageBatch(requestOptions: BeeRequestOptions, amount: NumberString, depth: number, options?: PostageBatchOptions): Promise<BatchId>;
9
+ export declare function updatePostageBatchLabel(requestOptions: BeeRequestOptions, id: BatchId, label: string): Promise<void>;
8
10
  export declare function topUpBatch(requestOptions: BeeRequestOptions, id: BatchId, amount: NumberString): Promise<BatchId>;
9
11
  export declare function diluteBatch(requestOptions: BeeRequestOptions, id: BatchId, depth: number): Promise<BatchId>;
@@ -219,6 +219,7 @@ export interface ChainState {
219
219
  block: number;
220
220
  totalAmount: NumberString;
221
221
  currentPrice: number;
222
+ minimumValidityBlocks?: number;
222
223
  }
223
224
  export interface WalletBalance {
224
225
  bzzBalance: BZZ;
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { BZZ } from '../../utils/tokens';
3
+ export declare const GetAllBalancesResponse: z.ZodObject<{
4
+ balances: z.ZodArray<z.ZodObject<{
5
+ peer: z.ZodString;
6
+ balance: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
7
+ }, z.core.$strip>>;
8
+ }, z.core.$strip>;
9
+ export declare const GetPeerBalanceResponse: z.ZodObject<{
10
+ peer: z.ZodString;
11
+ balance: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
12
+ }, z.core.$strip>;
@@ -0,0 +1,104 @@
1
+ import { z } from 'zod';
2
+ import { BZZ } from '../../utils/tokens';
3
+ import { EthAddress, TransactionId } from '../../utils/typed-bytes';
4
+ export declare const GetChequebookAddressResponse: z.ZodObject<{
5
+ chequebookAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
6
+ }, z.core.$strip>;
7
+ export declare const GetChequebookBalanceResponse: z.ZodObject<{
8
+ availableBalance: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
9
+ totalBalance: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
10
+ }, z.core.$strip>;
11
+ export declare const GetLastCashoutActionResponse: z.ZodObject<{
12
+ peer: z.ZodString;
13
+ uncashedAmount: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
14
+ transactionHash: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
15
+ lastCashedCheque: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
16
+ beneficiary: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
17
+ chequebook: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
18
+ payout: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
19
+ }, z.core.$strip>>>, z.ZodTransform<{
20
+ beneficiary: EthAddress;
21
+ chequebook: EthAddress;
22
+ payout: BZZ;
23
+ } | null, {
24
+ beneficiary: EthAddress;
25
+ chequebook: EthAddress;
26
+ payout: BZZ;
27
+ } | null | undefined>>;
28
+ result: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
29
+ recipient: z.ZodString;
30
+ lastPayout: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
31
+ bounced: z.ZodBoolean;
32
+ }, z.core.$strip>>>, z.ZodTransform<{
33
+ recipient: string;
34
+ lastPayout: BZZ;
35
+ bounced: boolean;
36
+ } | null, {
37
+ recipient: string;
38
+ lastPayout: BZZ;
39
+ bounced: boolean;
40
+ } | null | undefined>>;
41
+ }, z.core.$strip>;
42
+ export declare const GetLastChequesForPeerResponse: z.ZodObject<{
43
+ peer: z.ZodString;
44
+ lastreceived: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
45
+ beneficiary: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
46
+ chequebook: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
47
+ payout: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
48
+ }, z.core.$strip>>>, z.ZodTransform<{
49
+ beneficiary: EthAddress;
50
+ chequebook: EthAddress;
51
+ payout: BZZ;
52
+ } | null, {
53
+ beneficiary: EthAddress;
54
+ chequebook: EthAddress;
55
+ payout: BZZ;
56
+ } | null | undefined>>;
57
+ lastsent: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
58
+ beneficiary: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
59
+ chequebook: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
60
+ payout: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
61
+ }, z.core.$strip>>>, z.ZodTransform<{
62
+ beneficiary: EthAddress;
63
+ chequebook: EthAddress;
64
+ payout: BZZ;
65
+ } | null, {
66
+ beneficiary: EthAddress;
67
+ chequebook: EthAddress;
68
+ payout: BZZ;
69
+ } | null | undefined>>;
70
+ }, z.core.$strip>;
71
+ export declare const GetLastChequesResponse: z.ZodObject<{
72
+ lastcheques: z.ZodArray<z.ZodObject<{
73
+ peer: z.ZodString;
74
+ lastreceived: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
75
+ beneficiary: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
76
+ chequebook: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
77
+ payout: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
78
+ }, z.core.$strip>>>, z.ZodTransform<{
79
+ beneficiary: EthAddress;
80
+ chequebook: EthAddress;
81
+ payout: BZZ;
82
+ } | null, {
83
+ beneficiary: EthAddress;
84
+ chequebook: EthAddress;
85
+ payout: BZZ;
86
+ } | null | undefined>>;
87
+ lastsent: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodObject<{
88
+ beneficiary: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
89
+ chequebook: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
90
+ payout: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
91
+ }, z.core.$strip>>>, z.ZodTransform<{
92
+ beneficiary: EthAddress;
93
+ chequebook: EthAddress;
94
+ payout: BZZ;
95
+ } | null, {
96
+ beneficiary: EthAddress;
97
+ chequebook: EthAddress;
98
+ payout: BZZ;
99
+ } | null | undefined>>;
100
+ }, z.core.$strip>>;
101
+ }, z.core.$strip>;
102
+ export declare const TransactionHashResponse: z.ZodObject<{
103
+ transactionHash: z.ZodPipe<z.ZodString, z.ZodTransform<TransactionId, string>>;
104
+ }, z.core.$strip>;
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ import { EthAddress, PeerAddress, PublicKey } from '../../utils/typed-bytes';
3
+ export declare const GetNodeAddressesResponse: z.ZodObject<{
4
+ overlay: z.ZodPipe<z.ZodString, z.ZodTransform<PeerAddress, string>>;
5
+ underlay: z.ZodArray<z.ZodString>;
6
+ ethereum: z.ZodPipe<z.ZodString, z.ZodTransform<EthAddress, string>>;
7
+ publicKey: z.ZodPipe<z.ZodString, z.ZodTransform<PublicKey, string>>;
8
+ pssPublicKey: z.ZodPipe<z.ZodString, z.ZodTransform<PublicKey, string>>;
9
+ }, z.core.$strip>;
10
+ export declare const GetPeersResponse: z.ZodObject<{
11
+ peers: z.ZodArray<z.ZodObject<{
12
+ address: z.ZodString;
13
+ fullNode: z.ZodBoolean;
14
+ }, z.core.$strip>>;
15
+ }, z.core.$strip>;
16
+ export declare const GetBlocklistResponse: z.ZodObject<{
17
+ peers: z.ZodArray<z.ZodObject<{
18
+ address: z.ZodString;
19
+ fullNode: z.ZodBoolean;
20
+ }, z.core.$strip>>;
21
+ }, z.core.$strip>;
22
+ export declare const GetTopologyResponse: z.ZodObject<{
23
+ baseAddr: z.ZodString;
24
+ population: z.ZodNumber;
25
+ connected: z.ZodNumber;
26
+ timestamp: z.ZodString;
27
+ nnLowWatermark: z.ZodNumber;
28
+ depth: z.ZodNumber;
29
+ reachability: z.ZodString;
30
+ networkAvailability: z.ZodString;
31
+ bins: z.ZodRecord<z.ZodString, z.ZodObject<{
32
+ population: z.ZodNumber;
33
+ connected: z.ZodNumber;
34
+ connectedPeers: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
35
+ address: z.ZodString;
36
+ }, z.core.$strip>>>>, z.ZodTransform<{
37
+ address: string;
38
+ }[], {
39
+ address: string;
40
+ }[] | null | undefined>>;
41
+ disconnectedPeers: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
42
+ address: z.ZodString;
43
+ }, z.core.$strip>>>>, z.ZodTransform<{
44
+ address: string;
45
+ }[], {
46
+ address: string;
47
+ }[] | null | undefined>>;
48
+ }, z.core.$strip>>;
49
+ }, z.core.$strip>;
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ export declare const PostEnvelopeBodyResponse: z.ZodObject<{
3
+ issuer: z.ZodPipe<z.ZodString, z.ZodTransform<Uint8Array<ArrayBufferLike>, string>>;
4
+ index: z.ZodPipe<z.ZodString, z.ZodTransform<Uint8Array<ArrayBufferLike>, string>>;
5
+ timestamp: z.ZodPipe<z.ZodString, z.ZodTransform<Uint8Array<ArrayBufferLike>, string>>;
6
+ signature: z.ZodPipe<z.ZodString, z.ZodTransform<Uint8Array<ArrayBufferLike>, string>>;
7
+ }, z.core.$strip>;
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ import { PublicKey, Reference } from '../../utils/typed-bytes';
3
+ export declare const GetGranteesBodyResponse: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<PublicKey, string>>>;
4
+ export declare const GranteesResultBodyResponse: z.ZodObject<{
5
+ ref: z.ZodPipe<z.ZodString, z.ZodTransform<Reference, string>>;
6
+ historyref: z.ZodPipe<z.ZodString, z.ZodTransform<Reference, string>>;
7
+ }, z.core.$strip>;
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const GetAllPinsResponse: z.ZodObject<{
3
+ references: z.ZodNullable<z.ZodArray<z.ZodString>>;
4
+ }, z.core.$strip>;
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ export declare const RchashResponse: z.ZodObject<{
3
+ durationSeconds: z.ZodNumber;
4
+ }, z.core.$strip>;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { BZZ } from '../../utils/tokens';
3
+ export declare const GetSettlementsResponse: z.ZodObject<{
4
+ peer: z.ZodString;
5
+ sent: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
6
+ received: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
7
+ }, z.core.$strip>;
8
+ export declare const GetAllSettlementsResponse: z.ZodObject<{
9
+ totalSent: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
10
+ totalReceived: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
11
+ settlements: z.ZodArray<z.ZodObject<{
12
+ peer: z.ZodString;
13
+ sent: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
14
+ received: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
15
+ }, z.core.$strip>>;
16
+ }, z.core.$strip>;
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { BZZ, DAI } from '../../utils/tokens';
3
+ import { TransactionId } from '../../utils/typed-bytes';
4
+ export declare const GetStakeResponse: z.ZodObject<{
5
+ stakedAmount: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
6
+ }, z.core.$strip>;
7
+ export declare const GetWithdrawableStakeResponse: z.ZodObject<{
8
+ withdrawableAmount: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
9
+ }, z.core.$strip>;
10
+ export declare const TxHashResponse: z.ZodObject<{
11
+ txHash: z.ZodPipe<z.ZodString, z.ZodTransform<TransactionId, string>>;
12
+ }, z.core.$strip>;
13
+ export declare const GetRedistributionStateResponse: z.ZodObject<{
14
+ minimumGasFunds: z.ZodPipe<z.ZodString, z.ZodTransform<DAI, string>>;
15
+ hasSufficientFunds: z.ZodBoolean;
16
+ isFrozen: z.ZodBoolean;
17
+ isFullySynced: z.ZodBoolean;
18
+ phase: z.ZodString;
19
+ round: z.ZodNumber;
20
+ lastWonRound: z.ZodNumber;
21
+ lastPlayedRound: z.ZodNumber;
22
+ lastFrozenRound: z.ZodNumber;
23
+ lastSelectedRound: z.ZodNumber;
24
+ lastSampleDurationSeconds: z.ZodNumber;
25
+ block: z.ZodNumber;
26
+ reward: z.ZodPipe<z.ZodString, z.ZodTransform<BZZ, string>>;
27
+ fees: z.ZodPipe<z.ZodString, z.ZodTransform<DAI, string>>;
28
+ isHealthy: z.ZodBoolean;
29
+ }, z.core.$strip>;